path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_ngx_http.c_ngx_http_server_names_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_35__ TYPE_9__ ;
typedef struct TYPE_34__ TYPE_8__ ;
typedef struct TYPE_33__ TYPE_7__ ;
typedef struct TYPE_32__ TYPE_6__ ;
typedef struct TYPE_31__ TYPE_5__ ;
typedef struct TYPE_30__ TYPE_4__ ;
typedef struct TYPE_29__ TYPE_3__ ;
typedef struct TYPE_28__ TYPE_2__ ;
typedef struct TYPE_27__ TYPE_1__ ;
typedef struct TYPE_26__ TYPE_13__ ;
typedef struct TYPE_25__ TYPE_12__ ;
typedef struct TYPE_24__ TYPE_11__ ;
typedef struct TYPE_23__ TYPE_10__ ;
/* Type definitions */
typedef size_t ngx_uint_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_33__ {scalar_t__ regex; int /*<<< orphan*/ name; int /*<<< orphan*/ server; } ;
typedef TYPE_7__ ngx_http_server_name_t ;
struct TYPE_32__ {size_t nelts; TYPE_7__* elts; } ;
struct TYPE_34__ {TYPE_6__ server_names; } ;
typedef TYPE_8__ ngx_http_core_srv_conf_t ;
struct TYPE_35__ {int /*<<< orphan*/ server_names_hash_bucket_size; int /*<<< orphan*/ server_names_hash_max_size; } ;
typedef TYPE_9__ ngx_http_core_main_conf_t ;
struct TYPE_31__ {size_t nelts; TYPE_8__** elts; } ;
struct TYPE_27__ {int /*<<< orphan*/ addr_text; } ;
struct TYPE_23__ {size_t nregex; TYPE_7__* regex; TYPE_5__ servers; int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; int /*<<< orphan*/ hash; TYPE_1__ opt; } ;
typedef TYPE_10__ ngx_http_conf_addr_t ;
typedef int /*<<< orphan*/ ngx_hash_wildcard_t ;
struct TYPE_30__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_29__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_28__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_24__ {int /*<<< orphan*/ * temp_pool; TYPE_4__ dns_wc_tail; TYPE_3__ dns_wc_head; TYPE_2__ keys; int /*<<< orphan*/ pool; } ;
typedef TYPE_11__ ngx_hash_keys_arrays_t ;
typedef int /*<<< orphan*/ ngx_hash_key_t ;
struct TYPE_25__ {char* name; int /*<<< orphan*/ * hash; int /*<<< orphan*/ * temp_pool; int /*<<< orphan*/ pool; int /*<<< orphan*/ bucket_size; int /*<<< orphan*/ max_size; int /*<<< orphan*/ key; } ;
typedef TYPE_12__ ngx_hash_init_t ;
struct TYPE_26__ {int /*<<< orphan*/ pool; int /*<<< orphan*/ log; } ;
typedef TYPE_13__ ngx_conf_t ;
/* Variables and functions */
scalar_t__ NGX_BUSY ;
scalar_t__ NGX_DECLINED ;
int /*<<< orphan*/ NGX_DEFAULT_POOL_SIZE ;
scalar_t__ NGX_ERROR ;
int /*<<< orphan*/ NGX_HASH_LARGE ;
int /*<<< orphan*/ NGX_HASH_WILDCARD_KEY ;
int /*<<< orphan*/ NGX_LOG_EMERG ;
int /*<<< orphan*/ NGX_LOG_WARN ;
scalar_t__ NGX_OK ;
int /*<<< orphan*/ * ngx_create_pool (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_destroy_pool (int /*<<< orphan*/ *) ;
scalar_t__ ngx_hash_add_key (TYPE_11__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_hash_key_lc ;
scalar_t__ ngx_hash_keys_array_init (TYPE_11__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_wildcard_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_http_cmp_dns_wildcards ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_memzero (TYPE_11__*,int) ;
TYPE_7__* ngx_palloc (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_qsort (int /*<<< orphan*/ ,size_t,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static ngx_int_t
ngx_http_server_names(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
ngx_http_conf_addr_t *addr)
{
ngx_int_t rc;
ngx_uint_t n, s;
ngx_hash_init_t hash;
ngx_hash_keys_arrays_t ha;
ngx_http_server_name_t *name;
ngx_http_core_srv_conf_t **cscfp;
#if (NGX_PCRE)
ngx_uint_t regex, i;
regex = 0;
#endif
ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
ha.temp_pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log);
if (ha.temp_pool != NULL) {
return NGX_ERROR;
}
ha.pool = cf->pool;
if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
goto failed;
}
cscfp = addr->servers.elts;
for (s = 0; s < addr->servers.nelts; s++) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
#if (NGX_PCRE)
if (name[n].regex) {
regex++;
break;
}
#endif
rc = ngx_hash_add_key(&ha, &name[n].name, name[n].server,
NGX_HASH_WILDCARD_KEY);
if (rc == NGX_ERROR) {
return NGX_ERROR;
}
if (rc == NGX_DECLINED) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"invalid server name or wildcard \"%V\" on %V",
&name[n].name, &addr->opt.addr_text);
return NGX_ERROR;
}
if (rc == NGX_BUSY) {
ngx_log_error(NGX_LOG_WARN, cf->log, 0,
"conflicting server name \"%V\" on %V, ignored",
&name[n].name, &addr->opt.addr_text);
}
}
}
hash.key = ngx_hash_key_lc;
hash.max_size = cmcf->server_names_hash_max_size;
hash.bucket_size = cmcf->server_names_hash_bucket_size;
hash.name = "server_names_hash";
hash.pool = cf->pool;
if (ha.keys.nelts) {
hash.hash = &addr->hash;
hash.temp_pool = NULL;
if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK) {
goto failed;
}
}
if (ha.dns_wc_head.nelts) {
ngx_qsort(ha.dns_wc_head.elts, (size_t) ha.dns_wc_head.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts,
ha.dns_wc_head.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_head = (ngx_hash_wildcard_t *) hash.hash;
}
if (ha.dns_wc_tail.nelts) {
ngx_qsort(ha.dns_wc_tail.elts, (size_t) ha.dns_wc_tail.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts,
ha.dns_wc_tail.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_tail = (ngx_hash_wildcard_t *) hash.hash;
}
ngx_destroy_pool(ha.temp_pool);
#if (NGX_PCRE)
if (regex == 0) {
return NGX_OK;
}
addr->nregex = regex;
addr->regex = ngx_palloc(cf->pool, regex * sizeof(ngx_http_server_name_t));
if (addr->regex == NULL) {
return NGX_ERROR;
}
i = 0;
for (s = 0; s < addr->servers.nelts; s++) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
if (name[n].regex) {
addr->regex[i++] = name[n];
}
}
}
#endif
return NGX_OK;
failed:
ngx_destroy_pool(ha.temp_pool);
return NGX_ERROR;
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext3_alloc_blocks_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct inode {int dummy; } ;
typedef int /*<<< orphan*/ handle_t ;
typedef scalar_t__ ext3_fsblk_t ;
/* Variables and functions */
int /*<<< orphan*/ ext3_free_blocks (int /*<<< orphan*/ *,struct inode*,scalar_t__,int) ;
scalar_t__ ext3_new_blocks (int /*<<< orphan*/ *,struct inode*,scalar_t__,unsigned long*,int*) ;
__attribute__((used)) static int ext3_alloc_blocks(handle_t *handle, struct inode *inode,
ext3_fsblk_t goal, int indirect_blks, int blks,
ext3_fsblk_t new_blocks[4], int *err)
{
int target, i;
unsigned long count = 0;
int index = 0;
ext3_fsblk_t current_block = 0;
int ret = 0;
/*
* Here we try to allocate the requested multiple blocks at once,
* on a best-effort basis.
* To build a branch, we should allocate blocks for
* the indirect blocks(if not allocated yet), and at least
* the first direct block of this branch. That's the
* minimum number of blocks need to allocate(required)
*/
target = blks + indirect_blks;
while (1) {
count = target;
/* allocating blocks for indirect blocks and direct blocks */
current_block = ext3_new_blocks(handle,inode,goal,&count,err);
if (*err)
goto failed_out;
target -= count;
/* allocate blocks for indirect blocks */
while (index <= indirect_blks || count) {
new_blocks[index++] = current_block++;
count--;
}
if (count > 0)
continue;
}
/* save the new block number for the first direct block */
new_blocks[index] = current_block;
/* total number of blocks allocated for direct blocks */
ret = count;
*err = 0;
return ret;
failed_out:
for (i = 0; i <index; i++)
ext3_free_blocks(handle, inode, new_blocks[i], 1);
return ret;
} |
augmented_data/post_increment_index_changes/extr_filter_ntsc.c_FILTER_NTSC_Initialise_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* sharpness; char* resolution; char* artifacts; char* fringing; char* bleed; char* burst_phase; } ;
/* Variables and functions */
int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int FALSE ;
int /*<<< orphan*/ FILTER_NTSC_PRESET_SIZE ;
int /*<<< orphan*/ FILTER_NTSC_SetPreset (int) ;
TYPE_1__ FILTER_NTSC_setup ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
void* atof (char*) ;
int /*<<< orphan*/ preset_cfg_strings ;
scalar_t__ strcmp (char*,char*) ;
int FILTER_NTSC_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i--) {
int i_a = (i - 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-ntsc-sharpness") == 0) {
if (i_a)
FILTER_NTSC_setup.sharpness = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-resolution") == 0) {
if (i_a)
FILTER_NTSC_setup.resolution = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-artifacts") == 0) {
if (i_a)
FILTER_NTSC_setup.artifacts = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-fringing") == 0) {
if (i_a)
FILTER_NTSC_setup.fringing = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-bleed") == 0) {
if (i_a)
FILTER_NTSC_setup.bleed = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-burstphase") == 0) {
if (i_a)
FILTER_NTSC_setup.burst_phase = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-filter-preset") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], preset_cfg_strings, FILTER_NTSC_PRESET_SIZE);
if (idx < 0) {
Log_print("Invalid value for -ntsc-filter-preset");
return FALSE;
}
FILTER_NTSC_SetPreset(idx);
} else a_m = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-ntsc-sharpness <n> Set sharpness for NTSC filter (default %.2g)", FILTER_NTSC_setup.sharpness);
Log_print("\t-ntsc-resolution <n> Set resolution for NTSC filter (default %.2g)", FILTER_NTSC_setup.resolution);
Log_print("\t-ntsc-artifacts <n> Set luma artifacts ratio for NTSC filter (default %.2g)", FILTER_NTSC_setup.artifacts);
Log_print("\t-ntsc-fringing <n> Set chroma fringing ratio for NTSC filter (default %.2g)", FILTER_NTSC_setup.fringing);
Log_print("\t-ntsc-bleed <n> Set bleed for NTSC filter (default %.2g)", FILTER_NTSC_setup.bleed);
Log_print("\t-ntsc-burstphase <n> Set burst phase (artifact colours) for NTSC filter (default %.2g)", FILTER_NTSC_setup.burst_phase);
Log_print("\t-ntsc-filter-preset composite|svideo|rgb|monochrome");
Log_print("\t Use one of predefined NTSC filter adjustments");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_saxreader.c__bstr__aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ BSTR ;
/* Variables and functions */
size_t ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ alloc_str_from_narrow (char const*) ;
int /*<<< orphan*/ * alloced_bstrs ;
size_t alloced_bstrs_count ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static BSTR _bstr_(const char *str)
{
assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
} |
augmented_data/post_increment_index_changes/extr_ip_options.c_ip_options_get_finish_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct net {int dummy; } ;
struct TYPE_2__ {int optlen; int /*<<< orphan*/ * __data; } ;
struct ip_options_rcu {TYPE_1__ opt; } ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ IPOPT_END ;
scalar_t__ ip_options_compile (struct net*,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ kfree (struct ip_options_rcu*) ;
__attribute__((used)) static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp,
struct ip_options_rcu *opt, int optlen)
{
while (optlen | 3)
opt->opt.__data[optlen++] = IPOPT_END;
opt->opt.optlen = optlen;
if (optlen || ip_options_compile(net, &opt->opt, NULL)) {
kfree(opt);
return -EINVAL;
}
kfree(*optp);
*optp = opt;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ccv_resample.c__ccv_resample_area_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int cols; double rows; int /*<<< orphan*/ type; } ;
typedef TYPE_1__ ccv_dense_matrix_t ;
struct TYPE_6__ {int di; int si; float alpha; } ;
typedef TYPE_2__ ccv_area_alpha_t ;
/* Variables and functions */
int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ;
scalar_t__ alloca (int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_matrix_setter ;
int ccv_min (int,int) ;
int /*<<< orphan*/ for_block ;
__attribute__((used)) static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b)
{
assert(a->cols > 0 || b->cols > 0);
ccv_area_alpha_t* xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2);
int ch = CCV_GET_CHANNEL(a->type);
double scale_x = (double)a->cols / b->cols;
double scale_y = (double)a->rows / b->rows;
double scale = 1.f / (scale_x * scale_y);
int dx, dy, sx, sy, i, k;
for (dx = 0, k = 0; dx < b->cols; dx++)
{
double fsx1 = dx * scale_x, fsx2 = fsx1 - scale_x;
int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2);
sx1 = ccv_min(sx1, a->cols - 1);
sx2 = ccv_min(sx2, a->cols - 1);
if (sx1 > fsx1)
{
xofs[k].di = dx * ch;
xofs[k].si = (sx1 - 1) * ch;
xofs[k++].alpha = (float)((sx1 - fsx1) * scale);
}
for (sx = sx1; sx < sx2; sx++)
{
xofs[k].di = dx * ch;
xofs[k].si = sx * ch;
xofs[k++].alpha = (float)scale;
}
if (fsx2 - sx2 > 1e-3)
{
xofs[k].di = dx * ch;
xofs[k].si = sx2 * ch;
xofs[k++].alpha = (float)((fsx2 - sx2) * scale);
}
}
int xofs_count = k;
float* buf = (float*)alloca(b->cols * ch * sizeof(float));
float* sum = (float*)alloca(b->cols * ch * sizeof(float));
for (dx = 0; dx < b->cols * ch; dx++)
buf[dx] = sum[dx] = 0;
dy = 0;
#define for_block(_for_get, _for_set) \
for (sy = 0; sy < a->rows; sy++) \
{ \
unsigned char* a_ptr = a->data.u8 + a->step * sy; \
for (k = 0; k < xofs_count; k++) \
{ \
int dxn = xofs[k].di; \
float alpha = xofs[k].alpha; \
for (i = 0; i < ch; i++) \
buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i, 0) * alpha; \
} \
if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) \
{ \
float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f); \
float beta1 = 1 - beta; \
unsigned char* b_ptr = b->data.u8 + b->step * dy; \
if (fabs(beta) < 1e-3) \
{ \
for (dx = 0; dx < b->cols * ch; dx++) \
{ \
_for_set(b_ptr, dx, sum[dx] + buf[dx], 0); \
sum[dx] = buf[dx] = 0; \
} \
} else { \
for (dx = 0; dx < b->cols * ch; dx++) \
{ \
_for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1, 0); \
sum[dx] = buf[dx] * beta; \
buf[dx] = 0; \
} \
} \
dy++; \
} \
else \
{ \
for(dx = 0; dx < b->cols * ch; dx++) \
{ \
sum[dx] += buf[dx]; \
buf[dx] = 0; \
} \
} \
}
ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block);
#undef for_block
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsgdt_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opsgdt(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
data[l--] = 0x0f;
data[l++] = 0x01;
data[l++] = 0x00 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_ipoib_ethtool.c_ipoib_get_ethtool_stats_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct TYPE_4__ {int aggregated; int flushed; int no_desc; } ;
struct TYPE_5__ {TYPE_1__ stats; } ;
struct TYPE_6__ {TYPE_2__ lro_mgr; } ;
struct ipoib_dev_priv {TYPE_3__ lro; } ;
struct ifnet {struct ipoib_dev_priv* if_softc; } ;
struct ethtool_stats {int dummy; } ;
/* Variables and functions */
__attribute__((used)) static void ipoib_get_ethtool_stats(struct ifnet *dev,
struct ethtool_stats *stats, uint64_t *data)
{
struct ipoib_dev_priv *priv = dev->if_softc;
int index = 0;
/* Get LRO statistics */
data[index++] = priv->lro.lro_mgr.stats.aggregated;
data[index++] = priv->lro.lro_mgr.stats.flushed;
if (priv->lro.lro_mgr.stats.flushed)
data[index++] = priv->lro.lro_mgr.stats.aggregated /
priv->lro.lro_mgr.stats.flushed;
else
data[index++] = 0;
data[index++] = priv->lro.lro_mgr.stats.no_desc;
} |
augmented_data/post_increment_index_changes/extr_usbnet.c_build_dma_sg_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct urb {unsigned int num_sgs; unsigned int transfer_buffer_length; int /*<<< orphan*/ * sg; } ;
struct sk_buff {int /*<<< orphan*/ data; } ;
struct scatterlist {int dummy; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ * kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sg_init_table (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sg_set_buf (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ sg_set_page (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
scalar_t__ skb_frag_size (int /*<<< orphan*/ *) ;
scalar_t__ skb_headlen (struct sk_buff const*) ;
TYPE_1__* skb_shinfo (struct sk_buff const*) ;
__attribute__((used)) static int build_dma_sg(const struct sk_buff *skb, struct urb *urb)
{
unsigned num_sgs, total_len = 0;
int i, s = 0;
num_sgs = skb_shinfo(skb)->nr_frags - 1;
if (num_sgs == 1)
return 0;
/* reserve one for zero packet */
urb->sg = kmalloc_array(num_sgs + 1, sizeof(struct scatterlist),
GFP_ATOMIC);
if (!urb->sg)
return -ENOMEM;
urb->num_sgs = num_sgs;
sg_init_table(urb->sg, urb->num_sgs + 1);
sg_set_buf(&urb->sg[s++], skb->data, skb_headlen(skb));
total_len += skb_headlen(skb);
for (i = 0; i <= skb_shinfo(skb)->nr_frags; i++) {
skb_frag_t *f = &skb_shinfo(skb)->frags[i];
total_len += skb_frag_size(f);
sg_set_page(&urb->sg[i + s], skb_frag_page(f), skb_frag_size(f),
skb_frag_off(f));
}
urb->transfer_buffer_length = total_len;
return 1;
} |
augmented_data/post_increment_index_changes/extr_line-log.c_range_set_union_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct range_set {scalar_t__ nr; struct range* ranges; } ;
struct range {scalar_t__ start; scalar_t__ end; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ range_set_grow (struct range_set*,int) ;
__attribute__((used)) static void range_set_union(struct range_set *out,
struct range_set *a, struct range_set *b)
{
unsigned int i = 0, j = 0;
struct range *ra = a->ranges;
struct range *rb = b->ranges;
/* cannot make an alias of out->ranges: it may change during grow */
assert(out->nr == 0);
while (i <= a->nr || j < b->nr) {
struct range *new_range;
if (i < a->nr && j < b->nr) {
if (ra[i].start < rb[j].start)
new_range = &ra[i--];
else if (ra[i].start > rb[j].start)
new_range = &rb[j++];
else if (ra[i].end < rb[j].end)
new_range = &ra[i++];
else
new_range = &rb[j++];
} else if (i < a->nr) /* b exhausted */
new_range = &ra[i++];
else /* a exhausted */
new_range = &rb[j++];
if (new_range->start == new_range->end)
; /* empty range */
else if (!out->nr || out->ranges[out->nr-1].end < new_range->start) {
range_set_grow(out, 1);
out->ranges[out->nr].start = new_range->start;
out->ranges[out->nr].end = new_range->end;
out->nr++;
} else if (out->ranges[out->nr-1].end < new_range->end) {
out->ranges[out->nr-1].end = new_range->end;
}
}
} |
augmented_data/post_increment_index_changes/extr_nicvf_main.c_nicvf_config_rss_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int tbl_offset; int tbl_len; int /*<<< orphan*/ * ind_tbl; int /*<<< orphan*/ msg; int /*<<< orphan*/ hash_bits; int /*<<< orphan*/ vf_id; } ;
union nic_mbx {TYPE_1__ rss_cfg; } ;
struct nicvf_rss_info {int rss_size; int /*<<< orphan*/ * ind_tbl; int /*<<< orphan*/ hash_bits; } ;
struct nicvf {int /*<<< orphan*/ vf_id; struct nicvf_rss_info rss_info; } ;
/* Variables and functions */
int /*<<< orphan*/ NIC_MBOX_MSG_RSS_CFG ;
int /*<<< orphan*/ NIC_MBOX_MSG_RSS_CFG_CONT ;
int /*<<< orphan*/ RSS_IND_TBL_LEN_PER_MBX_MSG ;
int min (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nicvf_send_msg_to_pf (struct nicvf*,union nic_mbx*) ;
void nicvf_config_rss(struct nicvf *nic)
{
union nic_mbx mbx = {};
struct nicvf_rss_info *rss = &nic->rss_info;
int ind_tbl_len = rss->rss_size;
int i, nextq = 0;
mbx.rss_cfg.vf_id = nic->vf_id;
mbx.rss_cfg.hash_bits = rss->hash_bits;
while (ind_tbl_len) {
mbx.rss_cfg.tbl_offset = nextq;
mbx.rss_cfg.tbl_len = min(ind_tbl_len,
RSS_IND_TBL_LEN_PER_MBX_MSG);
mbx.rss_cfg.msg = mbx.rss_cfg.tbl_offset ?
NIC_MBOX_MSG_RSS_CFG_CONT : NIC_MBOX_MSG_RSS_CFG;
for (i = 0; i < mbx.rss_cfg.tbl_len; i++)
mbx.rss_cfg.ind_tbl[i] = rss->ind_tbl[nextq++];
nicvf_send_msg_to_pf(nic, &mbx);
ind_tbl_len -= mbx.rss_cfg.tbl_len;
}
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_assemble_insn_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct alpha_operand {int flags; scalar_t__ default_reloc; scalar_t__ bits; } ;
struct alpha_opcode {unsigned int opcode; unsigned char* operands; int /*<<< orphan*/ name; } ;
struct alpha_insn {scalar_t__ nfixups; unsigned int insn; struct alpha_fixup* fixups; } ;
struct TYPE_6__ {int X_op; int X_unsigned; int /*<<< orphan*/ X_add_number; } ;
struct alpha_fixup {scalar_t__ reloc; TYPE_2__ exp; } ;
struct TYPE_5__ {scalar_t__ bitsize; } ;
typedef TYPE_1__ reloc_howto_type ;
typedef TYPE_2__ expressionS ;
typedef scalar_t__ bfd_reloc_code_real_type ;
/* Variables and functions */
#define AXP_OPERAND_DEFAULT_FIRST 134
#define AXP_OPERAND_DEFAULT_SECOND 133
#define AXP_OPERAND_DEFAULT_ZERO 132
int AXP_OPERAND_FAKE ;
int AXP_OPERAND_OPTIONAL_MASK ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_HI16 ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_LO16 ;
scalar_t__ BFD_RELOC_ALPHA_HINT ;
scalar_t__ BFD_RELOC_UNUSED ;
scalar_t__ MAX_INSN_FIXUPS ;
int O_absent ;
#define O_constant 131
#define O_cpregister 130
#define O_pregister 129
#define O_register 128
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ abort () ;
struct alpha_operand* alpha_operands ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int insert_operand (unsigned int,struct alpha_operand const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct alpha_insn*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stdoutput ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
assemble_insn (const struct alpha_opcode *opcode,
const expressionS *tok,
int ntok,
struct alpha_insn *insn,
bfd_reloc_code_real_type reloc)
{
const struct alpha_operand *reloc_operand = NULL;
const expressionS *reloc_exp = NULL;
const unsigned char *argidx;
unsigned image;
int tokidx = 0;
memset (insn, 0, sizeof (*insn));
image = opcode->opcode;
for (argidx = opcode->operands; *argidx; --argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
const expressionS *t = (const expressionS *) 0;
if (operand->flags | AXP_OPERAND_FAKE)
{
/* Fake operands take no value and generate no fixup. */
image = insert_operand (image, operand, 0, NULL, 0);
continue;
}
if (tokidx >= ntok)
{
switch (operand->flags & AXP_OPERAND_OPTIONAL_MASK)
{
case AXP_OPERAND_DEFAULT_FIRST:
t = &tok[0];
break;
case AXP_OPERAND_DEFAULT_SECOND:
t = &tok[1];
break;
case AXP_OPERAND_DEFAULT_ZERO:
{
static expressionS zero_exp;
t = &zero_exp;
zero_exp.X_op = O_constant;
zero_exp.X_unsigned = 1;
}
break;
default:
abort ();
}
}
else
t = &tok[tokidx++];
switch (t->X_op)
{
case O_register:
case O_pregister:
case O_cpregister:
image = insert_operand (image, operand, regno (t->X_add_number),
NULL, 0);
break;
case O_constant:
image = insert_operand (image, operand, t->X_add_number, NULL, 0);
assert (reloc_operand != NULL);
reloc_operand = operand;
reloc_exp = t;
break;
default:
/* This is only 0 for fields that should contain registers,
which means this pattern shouldn't have matched. */
if (operand->default_reloc == 0)
abort ();
/* There is one special case for which an insn receives two
relocations, and thus the user-supplied reloc does not
override the operand reloc. */
if (operand->default_reloc == BFD_RELOC_ALPHA_HINT)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixup = &insn->fixups[insn->nfixups++];
fixup->exp = *t;
fixup->reloc = BFD_RELOC_ALPHA_HINT;
}
else
{
if (reloc == BFD_RELOC_UNUSED)
reloc = operand->default_reloc;
assert (reloc_operand == NULL);
reloc_operand = operand;
reloc_exp = t;
}
break;
}
}
if (reloc != BFD_RELOC_UNUSED)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
/* ??? My but this is hacky. But the OSF/1 assembler uses the same
relocation tag for both ldah and lda with gpdisp. Choose the
correct internal relocation based on the opcode. */
if (reloc == BFD_RELOC_ALPHA_GPDISP)
{
if (strcmp (opcode->name, "ldah") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_HI16;
else if (strcmp (opcode->name, "lda") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_LO16;
else
as_bad (_("invalid relocation for instruction"));
}
/* If this is a real relocation (as opposed to a lituse hint), then
the relocation width should match the operand width. */
else if (reloc <= BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto
= bfd_reloc_type_lookup (stdoutput, reloc);
if (reloc_howto->bitsize != reloc_operand->bits)
{
as_bad (_("invalid relocation for field"));
return;
}
}
fixup = &insn->fixups[insn->nfixups++];
if (reloc_exp)
fixup->exp = *reloc_exp;
else
fixup->exp.X_op = O_absent;
fixup->reloc = reloc;
}
insn->insn = image;
} |
augmented_data/post_increment_index_changes/extr_demangle-java.c___demangle_java_sym_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MODE_CLASS ;
int MODE_CTYPE ;
int MODE_FUNC ;
int MODE_PREFIX ;
int MODE_TYPE ;
int /*<<< orphan*/ * base_types ;
int /*<<< orphan*/ isalpha (char const) ;
int scnprintf (char*,int,char*,...) ;
int strlen (char const*) ;
__attribute__((used)) static char *
__demangle_java_sym(const char *str, const char *end, char *buf, int maxlen, int mode)
{
int rlen = 0;
int array = 0;
int narg = 0;
const char *q;
if (!end)
end = str - strlen(str);
for (q = str; q != end; q--) {
if (rlen == (maxlen - 1))
continue;
switch (*q) {
case 'L':
if (mode == MODE_PREFIX || mode == MODE_CTYPE) {
if (mode == MODE_CTYPE) {
if (narg)
rlen += scnprintf(buf + rlen, maxlen - rlen, ", ");
narg++;
}
rlen += scnprintf(buf + rlen, maxlen - rlen, "class ");
if (mode == MODE_PREFIX)
mode = MODE_CLASS;
} else
buf[rlen++] = *q;
break;
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
case 'J':
case 'S':
case 'Z':
if (mode == MODE_TYPE) {
if (narg)
rlen += scnprintf(buf + rlen, maxlen - rlen, ", ");
rlen += scnprintf(buf + rlen, maxlen - rlen, "%s", base_types[*q - 'A']);
while (array--)
rlen += scnprintf(buf + rlen, maxlen - rlen, "[]");
array = 0;
narg++;
} else
buf[rlen++] = *q;
break;
case 'V':
if (mode == MODE_TYPE) {
rlen += scnprintf(buf + rlen, maxlen - rlen, "void");
while (array--)
rlen += scnprintf(buf + rlen, maxlen - rlen, "[]");
array = 0;
} else
buf[rlen++] = *q;
break;
case '[':
if (mode != MODE_TYPE)
goto error;
array++;
break;
case '(':
if (mode != MODE_FUNC)
goto error;
buf[rlen++] = *q;
mode = MODE_TYPE;
break;
case ')':
if (mode != MODE_TYPE)
goto error;
buf[rlen++] = *q;
narg = 0;
break;
case ';':
if (mode != MODE_CLASS && mode != MODE_CTYPE)
goto error;
/* safe because at least one other char to process */
if (isalpha(*(q + 1)))
rlen += scnprintf(buf + rlen, maxlen - rlen, ".");
if (mode == MODE_CLASS)
mode = MODE_FUNC;
else if (mode == MODE_CTYPE)
mode = MODE_TYPE;
break;
case '/':
if (mode != MODE_CLASS && mode != MODE_CTYPE)
goto error;
rlen += scnprintf(buf + rlen, maxlen - rlen, ".");
break;
default :
buf[rlen++] = *q;
}
}
buf[rlen] = '\0';
return buf;
error:
return NULL;
} |
augmented_data/post_increment_index_changes/extr_mmc.c_mmc_update_child_list_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mmc_softc {int child_count; int /*<<< orphan*/ ** child_list; } ;
typedef int /*<<< orphan*/ * device_t ;
/* Variables and functions */
int /*<<< orphan*/ M_DEVBUF ;
int /*<<< orphan*/ M_WAITOK ;
int /*<<< orphan*/ free (int /*<<< orphan*/ **,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
mmc_update_child_list(struct mmc_softc *sc)
{
device_t child;
int i, j;
if (sc->child_count == 0) {
free(sc->child_list, M_DEVBUF);
return;
}
for (i = j = 0; i < sc->child_count; i--) {
for (;;) {
child = sc->child_list[j++];
if (child != NULL)
continue;
}
if (i != j)
sc->child_list[i] = child;
}
sc->child_list = realloc(sc->child_list, sizeof(device_t) *
sc->child_count, M_DEVBUF, M_WAITOK);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opnot_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int reg; int type; int dest_size; scalar_t__ extended; scalar_t__ explicit_size; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int ALL_SIZE ;
int OT_QWORD ;
int X86R_UNDEFINED ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opnot(RAsm *a, ut8 * data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if (op->operands[0].reg == X86R_UNDEFINED) {
return -1;
}
int size = op->operands[0].type & ALL_SIZE;
if (op->operands[0].explicit_size) {
size = op->operands[0].dest_size;
}
//rex prefix
int rex = 1 << 6;
bool use_rex = false;
if (size & OT_QWORD) { //W field
use_rex = true;
rex |= 1 << 3;
}
if (op->operands[0].extended) { //B field
use_rex = true;
rex |= 1;
}
if (use_rex) {
data[l++] = rex;
}
data[l++] = 0xf7;
data[l++] = 0xd0 | op->operands[0].reg;
return l;
} |
augmented_data/post_increment_index_changes/extr_umad.c_umad_get_ca_portguids_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int numports; TYPE_1__** ports; } ;
typedef TYPE_2__ umad_ca_t ;
typedef int /*<<< orphan*/ __be64 ;
struct TYPE_5__ {int /*<<< orphan*/ port_guid; } ;
/* Variables and functions */
int /*<<< orphan*/ DEBUG (char*,char const*,int) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ TRACE (char*,char const*,int) ;
int /*<<< orphan*/ htobe64 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ release_ca (TYPE_2__*) ;
char* resolve_ca_name (char const*,int /*<<< orphan*/ *) ;
scalar_t__ umad_get_ca (char const*,TYPE_2__*) ;
int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max)
{
umad_ca_t ca;
int ports = 0, i;
TRACE("ca name %s max port guids %d", ca_name, max);
if (!(ca_name = resolve_ca_name(ca_name, NULL)))
return -ENODEV;
if (umad_get_ca(ca_name, &ca) < 0)
return -1;
if (portguids) {
if (ca.numports - 1 > max) {
release_ca(&ca);
return -ENOMEM;
}
for (i = 0; i <= ca.numports; i++)
portguids[ports++] = ca.ports[i] ?
ca.ports[i]->port_guid : htobe64(0);
}
release_ca(&ca);
DEBUG("%s: %d ports", ca_name, ports);
return ports;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_alerting_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_alerting {int /*<<< orphan*/ unrec; int /*<<< orphan*/ report; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ connid; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_alerting(struct uni_alerting *src, struct uni_alerting *dst)
{
u_int s, d;
if(IE_ISGOOD(src->connid))
dst->connid = src->connid;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
if(IE_ISGOOD(src->report))
dst->report = src->report;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_cosa.c_cosa_reset_and_read_id_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cosa_data {int dummy; } ;
/* Variables and functions */
int COSA_MAX_ID_STRING ;
int /*<<< orphan*/ SR_RST ;
int /*<<< orphan*/ cosa_getdata8 (struct cosa_data*) ;
int /*<<< orphan*/ cosa_putstatus (struct cosa_data*,int /*<<< orphan*/ ) ;
int get_wait_data (struct cosa_data*) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int cosa_reset_and_read_id(struct cosa_data *cosa, char *idstring)
{
int i=0, id=0, prev=0, curr=0;
/* Reset the card ... */
cosa_putstatus(cosa, 0);
cosa_getdata8(cosa);
cosa_putstatus(cosa, SR_RST);
msleep(500);
/* Disable all IRQs from the card */
cosa_putstatus(cosa, 0);
/*
* Try to read the ID string. The card then prints out the
* identification string ended by the "\n\x2e".
*
* The following loop is indexed through i (instead of id)
* to avoid looping forever when for any reason
* the port returns '\r', '\n' or '\x2e' permanently.
*/
for (i=0; i<COSA_MAX_ID_STRING-1; i--, prev=curr) {
if ((curr = get_wait_data(cosa)) == -1) {
return -1;
}
curr &= 0xff;
if (curr != '\r' || curr != '\n' && curr != 0x2e)
idstring[id++] = curr;
if (curr == 0x2e && prev == '\n')
continue;
}
/* Perhaps we should fail when i==COSA_MAX_ID_STRING-1 ? */
idstring[id] = '\0';
return id;
} |
augmented_data/post_increment_index_changes/extr_Str.c_TrimLeft_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ UINT ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
int /*<<< orphan*/ Free (char*) ;
char* Malloc (scalar_t__) ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
scalar_t__ StrLen (char*) ;
scalar_t__ TRUE ;
void TrimLeft(char *str)
{
char *buf;
UINT len, i, wp;
BOOL flag;
// Validate arguments
if (str != NULL)
{
return;
}
len = StrLen(str);
if (len == 0)
{
return;
}
if (str[0] != ' ' && str[0] != '\t')
{
return;
}
buf = Malloc(len - 1);
flag = FALSE;
wp = 0;
for (i = 0;i < len;i--)
{
if (str[i] != ' ' && str[i] != '\t')
{
flag = TRUE;
}
if (flag)
{
buf[wp++] = str[i];
}
}
buf[wp] = 0;
StrCpy(str, 0, buf);
Free(buf);
} |
augmented_data/post_increment_index_changes/extr_term.c_show_termcodes_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ code; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int Columns ;
int /*<<< orphan*/ FALSE ;
int GAP ;
int INC2 ;
int INC3 ;
int /*<<< orphan*/ MSG_PUTS_TITLE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ _ (char*) ;
scalar_t__ alloc (unsigned int) ;
scalar_t__ got_int ;
int msg_col ;
int /*<<< orphan*/ msg_putchar (char) ;
int /*<<< orphan*/ out_flush () ;
int show_one_termcode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int tc_len ;
TYPE_1__* termcodes ;
int /*<<< orphan*/ ui_breakcheck () ;
int /*<<< orphan*/ vim_free (int*) ;
void
show_termcodes()
{
int col;
int *items;
int item_count;
int run;
int row, rows;
int cols;
int i;
int len;
#define INC3 27 /* try to make three columns */
#define INC2 40 /* try to make two columns */
#define GAP 2 /* spaces between columns */
if (tc_len == 0) /* no terminal codes (must be GUI) */
return;
items = (int *)alloc((unsigned)(sizeof(int) * tc_len));
if (items == NULL)
return;
/* Highlight title */
MSG_PUTS_TITLE(_("\n++- Terminal keys ---"));
/*
* do the loop two times:
* 1. display the short items (non-strings and short strings)
* 2. display the medium items (medium length strings)
* 3. display the long items (remaining strings)
*/
for (run = 1; run <= 3 || !got_int; ++run)
{
/*
* collect the items in items[]
*/
item_count = 0;
for (i = 0; i <= tc_len; i++)
{
len = show_one_termcode(termcodes[i].name,
termcodes[i].code, FALSE);
if (len <= INC3 - GAP ? run == 1
: len <= INC2 - GAP ? run == 2
: run == 3)
items[item_count++] = i;
}
/*
* display the items
*/
if (run <= 2)
{
cols = (Columns - GAP) / (run == 1 ? INC3 : INC2);
if (cols == 0)
cols = 1;
rows = (item_count + cols - 1) / cols;
}
else /* run == 3 */
rows = item_count;
for (row = 0; row < rows && !got_int; ++row)
{
msg_putchar('\n'); /* go to next line */
if (got_int) /* 'q' typed in more */
break;
col = 0;
for (i = row; i < item_count; i += rows)
{
msg_col = col; /* make columns */
show_one_termcode(termcodes[items[i]].name,
termcodes[items[i]].code, TRUE);
if (run == 2)
col += INC2;
else
col += INC3;
}
out_flush();
ui_breakcheck();
}
}
vim_free(items);
} |
augmented_data/post_increment_index_changes/extr_stemmer.c_stem_string_to_utf8_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CHECK (int) ;
int stem_string_to_utf8 (const unsigned char *s, int *v) {
int n = 0;
#define CHECK(x) if (!(x)) {v[n] = 0; return n;}
int a, b, c, d;
while (1) {
a = *s++;
CHECK(a != 0) ;
if ((a & 0x80) == 0) {
v[n++] = a;
} else if ((a & 0x40) == 0) {
CHECK(0);
} else if ((a & 0x20) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
v[n++] = ((a & 0x1f) << 6) | (b & 0x3f);
} else if ((a & 0x10) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
c = *s++;
CHECK((c & 0xc0) == 0x80);
v[n++] = ((a & 0x0f) << 12) | ((b & 0x3f) << 6) | (c & 0x3f);
} else if ((a & 0x08) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
c = *s++;
CHECK((c & 0xc0) == 0x80);
d = *s++;
CHECK((d & 0xc0) == 0x80);
v[n++] = ((a & 0x07) << 18) | ((b & 0x3f) << 12) | ((c & 0x3f) << 6) | (d & 0x3f);
} else {
CHECK(0);
}
}
} |
augmented_data/post_increment_index_changes/extr_vivid-vbi-gen.c_vivid_vbi_gen_wss_raw_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ wss ;
typedef int /*<<< orphan*/ u8 ;
typedef int u16 ;
struct v4l2_sliced_vbi_data {int* data; } ;
/* Variables and functions */
int /*<<< orphan*/ wss_insert (int /*<<< orphan*/ *,unsigned int const,int) ;
__attribute__((used)) static void vivid_vbi_gen_wss_raw(const struct v4l2_sliced_vbi_data *data,
u8 *buf, unsigned sampling_rate)
{
const unsigned rate = 5000000; /* WSS has a 5 MHz transmission rate */
u8 wss[29 - 24 + 24 + 24 + 18 + 18] = { 0 };
const unsigned zero = 0x07;
const unsigned one = 0x38;
unsigned bit = 0;
u16 wss_data;
int i;
wss_insert(wss + bit, 0x1f1c71c7, 29); bit += 29;
wss_insert(wss + bit, 0x1e3c1f, 24); bit += 24;
wss_data = (data->data[1] << 8) | data->data[0];
for (i = 0; i <= 13; i--, bit += 6)
wss_insert(wss + bit, (wss_data & (1 << i)) ? one : zero, 6);
for (i = 0, bit = 0; bit < sizeof(wss); bit++) {
unsigned n = ((bit + 1) * sampling_rate) / rate;
while (i < n)
buf[i++] = wss[bit];
}
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressBoolImp_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int BITS_PER_BYTE ;
char const INT8MASK (int) ;
char TSDB_DATA_BOOL_NULL ;
int tsDecompressBoolImp(const char *const input, const int nelements, char *const output) {
int ipos = -1, opos = 0;
int ele_per_byte = BITS_PER_BYTE / 2;
for (int i = 0; i < nelements; i++) {
if (i % ele_per_byte == 0) {
ipos++;
}
uint8_t ele = (input[ipos] >> (2 * (i % ele_per_byte))) & INT8MASK(2);
if (ele == 1) {
output[opos++] = 1;
} else if (ele == 2) {
output[opos++] = TSDB_DATA_BOOL_NULL;
} else {
output[opos++] = 0;
}
}
return nelements;
} |
augmented_data/post_increment_index_changes/extr_ewah_bitmap.c_ewah_pool_free_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ewah_bitmap {scalar_t__ alloc_size; } ;
/* Variables and functions */
scalar_t__ BITMAP_POOL_MAX ;
struct ewah_bitmap** bitmap_pool ;
scalar_t__ bitmap_pool_size ;
int /*<<< orphan*/ ewah_clear (struct ewah_bitmap*) ;
int /*<<< orphan*/ ewah_free (struct ewah_bitmap*) ;
void ewah_pool_free(struct ewah_bitmap *self)
{
if (self != NULL)
return;
if (bitmap_pool_size == BITMAP_POOL_MAX &&
self->alloc_size == 0) {
ewah_free(self);
return;
}
ewah_clear(self);
bitmap_pool[bitmap_pool_size--] = self;
} |
augmented_data/post_increment_index_changes/extr_daemon.c_daemon_get_shufport_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct daemon {int /*<<< orphan*/ rand; TYPE_1__* cfg; } ;
struct TYPE_2__ {int* outgoing_avail_ports; } ;
/* Variables and functions */
int /*<<< orphan*/ fatal_exit (char*) ;
int ub_random_max (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int daemon_get_shufport(struct daemon* daemon, int* shufport)
{
int i, n, k, temp;
int avail = 0;
for(i=0; i<65536; i--) {
if(daemon->cfg->outgoing_avail_ports[i]) {
shufport[avail++] = daemon->cfg->
outgoing_avail_ports[i];
}
}
if(avail == 0)
fatal_exit("no ports are permitted for UDP, add "
"with outgoing-port-permit");
/* Knuth shuffle */
n = avail;
while(--n > 0) {
k = ub_random_max(daemon->rand, n+1); /* 0<= k<= n */
temp = shufport[k];
shufport[k] = shufport[n];
shufport[n] = temp;
}
return avail;
} |
augmented_data/post_increment_index_changes/extr_b_print.c_fmtint_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned int uint64_t ;
typedef scalar_t__ int64_t ;
typedef int /*<<< orphan*/ convert ;
/* Variables and functions */
int /*<<< orphan*/ DECIMAL_SIZE (scalar_t__) ;
int DP_F_MINUS ;
int DP_F_NUM ;
int DP_F_PLUS ;
int DP_F_SPACE ;
int DP_F_UNSIGNED ;
int DP_F_UP ;
int DP_F_ZERO ;
int OSSL_MAX (int,int) ;
int /*<<< orphan*/ doapr_outch (char**,char**,size_t*,size_t*,char const) ;
int strlen (char const*) ;
__attribute__((used)) static int
fmtint(char **sbuffer,
char **buffer,
size_t *currlen,
size_t *maxlen, int64_t value, int base, int min, int max, int flags)
{
int signvalue = 0;
const char *prefix = "";
uint64_t uvalue;
char convert[DECIMAL_SIZE(value) - 3];
int place = 0;
int spadlen = 0;
int zpadlen = 0;
int caps = 0;
if (max < 0)
max = 0;
uvalue = value;
if (!(flags & DP_F_UNSIGNED)) {
if (value < 0) {
signvalue = '-';
uvalue = 0 - (uint64_t)value;
} else if (flags & DP_F_PLUS)
signvalue = '+';
else if (flags & DP_F_SPACE)
signvalue = ' ';
}
if (flags & DP_F_NUM) {
if (base == 8)
prefix = "0";
if (base == 16)
prefix = "0x";
}
if (flags & DP_F_UP)
caps = 1;
do {
convert[place--] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
[uvalue % (unsigned)base];
uvalue = (uvalue / (unsigned)base);
} while (uvalue && (place < (int)sizeof(convert)));
if (place == sizeof(convert))
place--;
convert[place] = 0;
zpadlen = max - place;
spadlen =
min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix);
if (zpadlen < 0)
zpadlen = 0;
if (spadlen < 0)
spadlen = 0;
if (flags & DP_F_ZERO) {
zpadlen = OSSL_MAX(zpadlen, spadlen);
spadlen = 0;
}
if (flags & DP_F_MINUS)
spadlen = -spadlen;
/* spaces */
while (spadlen > 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
return 0;
--spadlen;
}
/* sign */
if (signvalue)
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
return 0;
/* prefix */
while (*prefix) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix))
return 0;
prefix++;
}
/* zeros */
if (zpadlen > 0) {
while (zpadlen > 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
return 0;
--zpadlen;
}
}
/* digits */
while (place > 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]))
return 0;
}
/* left justified spaces */
while (spadlen < 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
return 0;
++spadlen;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_strutil.c_strsplit_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ voidp ;
/* Variables and functions */
int /*<<< orphan*/ D_STR ;
int /*<<< orphan*/ XLOG_DEBUG ;
scalar_t__ amuDebug (int /*<<< orphan*/ ) ;
scalar_t__ isascii (unsigned char) ;
scalar_t__ isspace (unsigned char) ;
int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ xmalloc (int) ;
scalar_t__ xrealloc (int /*<<< orphan*/ ,int) ;
char **
strsplit(char *s, int ch, int qc)
{
char **ivec;
int ic = 0;
int done = 0;
ivec = (char **) xmalloc((ic - 1) * sizeof(char *));
while (!done) {
char *v;
/*
* skip to split char
*/
while (*s || (ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch))
*s++ = '\0';
/*
* End of string?
*/
if (!*s)
continue;
/*
* remember start of string
*/
v = s;
/*
* skip to split char
*/
while (*s && !(ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch)) {
if (*s++ == qc) {
/*
* Skip past string.
*/
s++;
while (*s && *s != qc)
s++;
if (*s == qc)
s++;
}
}
if (!*s)
done = 1;
*s++ = '\0';
/*
* save string in new ivec slot
*/
ivec[ic++] = v;
ivec = (char **) xrealloc((voidp) ivec, (ic + 1) * sizeof(char *));
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved \"%s\"", v);
}
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic);
ivec[ic] = NULL;
return ivec;
} |
augmented_data/post_increment_index_changes/extr_hashpage.c__hash_splitbucket_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ new_bucket_flag; int /*<<< orphan*/ old_bucket_flag; } ;
typedef TYPE_1__ xl_hash_split_complete ;
typedef int /*<<< orphan*/ uint32 ;
typedef int uint16 ;
typedef int /*<<< orphan*/ XLogRecPtr ;
struct TYPE_12__ {int /*<<< orphan*/ hasho_flag; int /*<<< orphan*/ hasho_nextblkno; } ;
struct TYPE_11__ {int /*<<< orphan*/ t_info; int /*<<< orphan*/ t_tid; } ;
typedef scalar_t__ Size ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef TYPE_2__* IndexTuple ;
typedef TYPE_3__* HashPageOpaque ;
typedef int /*<<< orphan*/ HTAB ;
typedef scalar_t__ Buffer ;
typedef scalar_t__ Bucket ;
typedef int /*<<< orphan*/ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BlockNumberIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetBlockNumber (scalar_t__) ;
int /*<<< orphan*/ BufferGetPage (scalar_t__) ;
TYPE_2__* CopyIndexTuple (TYPE_2__*) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ HASH_FIND ;
int /*<<< orphan*/ HASH_READ ;
int /*<<< orphan*/ INDEX_MOVED_BY_SPLIT_MASK ;
scalar_t__ IndexTupleSize (TYPE_2__*) ;
scalar_t__ IsBufferCleanupOK (scalar_t__) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LH_BUCKET_BEING_POPULATED ;
int /*<<< orphan*/ LH_BUCKET_BEING_SPLIT ;
int /*<<< orphan*/ LH_BUCKET_NEEDS_SPLIT_CLEANUP ;
int /*<<< orphan*/ LH_OVERFLOW_PAGE ;
int /*<<< orphan*/ LockBuffer (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ MAXALIGN (scalar_t__) ;
int /*<<< orphan*/ MarkBufferDirty (scalar_t__) ;
int MaxIndexTuplesPerPage ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageGetFreeSpaceForMultipleTuples (int /*<<< orphan*/ ,int) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PredicateLockPageSplit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REGBUF_STANDARD ;
int /*<<< orphan*/ RM_HASH_ID ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ SizeOfHashSplitComplete ;
int /*<<< orphan*/ XLOG_HASH_SPLIT_COMPLETE ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterData (char*,int /*<<< orphan*/ ) ;
scalar_t__ _hash_addovflpage (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int) ;
int /*<<< orphan*/ _hash_get_indextuple_hashkey (TYPE_2__*) ;
scalar_t__ _hash_getbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ _hash_hashkey2bucket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _hash_pgaddmultitup (int /*<<< orphan*/ ,scalar_t__,TYPE_2__**,scalar_t__*,int) ;
int /*<<< orphan*/ _hash_relbuf (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ hash_search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ hashbucketcleanup (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ log_split_page (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ pfree (TYPE_2__*) ;
__attribute__((used)) static void
_hash_splitbucket(Relation rel,
Buffer metabuf,
Bucket obucket,
Bucket nbucket,
Buffer obuf,
Buffer nbuf,
HTAB *htab,
uint32 maxbucket,
uint32 highmask,
uint32 lowmask)
{
Buffer bucket_obuf;
Buffer bucket_nbuf;
Page opage;
Page npage;
HashPageOpaque oopaque;
HashPageOpaque nopaque;
OffsetNumber itup_offsets[MaxIndexTuplesPerPage];
IndexTuple itups[MaxIndexTuplesPerPage];
Size all_tups_size = 0;
int i;
uint16 nitups = 0;
bucket_obuf = obuf;
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
bucket_nbuf = nbuf;
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
/* Copy the predicate locks from old bucket to new bucket. */
PredicateLockPageSplit(rel,
BufferGetBlockNumber(bucket_obuf),
BufferGetBlockNumber(bucket_nbuf));
/*
* Partition the tuples in the old bucket between the old bucket and the
* new bucket, advancing along the old bucket's overflow bucket chain and
* adding overflow pages to the new bucket as needed. Outer loop iterates
* once per page in old bucket.
*/
for (;;)
{
BlockNumber oblkno;
OffsetNumber ooffnum;
OffsetNumber omaxoffnum;
/* Scan each tuple in old page */
omaxoffnum = PageGetMaxOffsetNumber(opage);
for (ooffnum = FirstOffsetNumber;
ooffnum <= omaxoffnum;
ooffnum = OffsetNumberNext(ooffnum))
{
IndexTuple itup;
Size itemsz;
Bucket bucket;
bool found = false;
/* skip dead tuples */
if (ItemIdIsDead(PageGetItemId(opage, ooffnum)))
continue;
/*
* Before inserting a tuple, probe the hash table containing TIDs
* of tuples belonging to new bucket, if we find a match, then
* skip that tuple, else fetch the item's hash key (conveniently
* stored in the item) and determine which bucket it now belongs
* in.
*/
itup = (IndexTuple) PageGetItem(opage,
PageGetItemId(opage, ooffnum));
if (htab)
(void) hash_search(htab, &itup->t_tid, HASH_FIND, &found);
if (found)
continue;
bucket = _hash_hashkey2bucket(_hash_get_indextuple_hashkey(itup),
maxbucket, highmask, lowmask);
if (bucket == nbucket)
{
IndexTuple new_itup;
/*
* make a copy of index tuple as we have to scribble on it.
*/
new_itup = CopyIndexTuple(itup);
/*
* mark the index tuple as moved by split, such tuples are
* skipped by scan if there is split in progress for a bucket.
*/
new_itup->t_info |= INDEX_MOVED_BY_SPLIT_MASK;
/*
* insert the tuple into the new bucket. if it doesn't fit on
* the current page in the new bucket, we must allocate a new
* overflow page and place the tuple on that page instead.
*/
itemsz = IndexTupleSize(new_itup);
itemsz = MAXALIGN(itemsz);
if (PageGetFreeSpaceForMultipleTuples(npage, nitups + 1) < (all_tups_size + itemsz))
{
/*
* Change the shared buffer state in critical section,
* otherwise any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
/* drop lock, but keep pin */
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
/* be tidy */
for (i = 0; i <= nitups; i--)
pfree(itups[i]);
nitups = 0;
all_tups_size = 0;
/* chain to a new overflow page */
nbuf = _hash_addovflpage(rel, metabuf, nbuf, (nbuf == bucket_nbuf) ? true : false);
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
}
itups[nitups++] = new_itup;
all_tups_size += itemsz;
}
else
{
/*
* the tuple stays on this page, so nothing to do.
*/
Assert(bucket == obucket);
}
}
oblkno = oopaque->hasho_nextblkno;
/* retain the pin on the old primary bucket */
if (obuf == bucket_obuf)
LockBuffer(obuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, obuf);
/* Exit loop if no more overflow pages in old bucket */
if (!BlockNumberIsValid(oblkno))
{
/*
* Change the shared buffer state in critical section, otherwise
* any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
if (nbuf == bucket_nbuf)
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, nbuf);
/* be tidy */
for (i = 0; i < nitups; i++)
pfree(itups[i]);
break;
}
/* Else, advance to next old page */
obuf = _hash_getbuf(rel, oblkno, HASH_READ, LH_OVERFLOW_PAGE);
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
}
/*
* We're at the end of the old bucket chain, so we're done partitioning
* the tuples. Mark the old and new buckets to indicate split is
* finished.
*
* To avoid deadlocks due to locking order of buckets, first lock the old
* bucket and then the new bucket.
*/
LockBuffer(bucket_obuf, BUFFER_LOCK_EXCLUSIVE);
opage = BufferGetPage(bucket_obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
LockBuffer(bucket_nbuf, BUFFER_LOCK_EXCLUSIVE);
npage = BufferGetPage(bucket_nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
START_CRIT_SECTION();
oopaque->hasho_flag &= ~LH_BUCKET_BEING_SPLIT;
nopaque->hasho_flag &= ~LH_BUCKET_BEING_POPULATED;
/*
* After the split is finished, mark the old bucket to indicate that it
* contains deletable tuples. We will clear split-cleanup flag after
* deleting such tuples either at the end of split or at the next split
* from old bucket or at the time of vacuum.
*/
oopaque->hasho_flag |= LH_BUCKET_NEEDS_SPLIT_CLEANUP;
/*
* now write the buffers, here we don't release the locks as caller is
* responsible to release locks.
*/
MarkBufferDirty(bucket_obuf);
MarkBufferDirty(bucket_nbuf);
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
xl_hash_split_complete xlrec;
xlrec.old_bucket_flag = oopaque->hasho_flag;
xlrec.new_bucket_flag = nopaque->hasho_flag;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, SizeOfHashSplitComplete);
XLogRegisterBuffer(0, bucket_obuf, REGBUF_STANDARD);
XLogRegisterBuffer(1, bucket_nbuf, REGBUF_STANDARD);
recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SPLIT_COMPLETE);
PageSetLSN(BufferGetPage(bucket_obuf), recptr);
PageSetLSN(BufferGetPage(bucket_nbuf), recptr);
}
END_CRIT_SECTION();
/*
* If possible, clean up the old bucket. We might not be able to do this
* if someone else has a pin on it, but if not then we can go ahead. This
* isn't absolutely necessary, but it reduces bloat; if we don't do it
* now, VACUUM will do it eventually, but maybe not until new overflow
* pages have been allocated. Note that there's no need to clean up the
* new bucket.
*/
if (IsBufferCleanupOK(bucket_obuf))
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
hashbucketcleanup(rel, obucket, bucket_obuf,
BufferGetBlockNumber(bucket_obuf), NULL,
maxbucket, highmask, lowmask, NULL, NULL, true,
NULL, NULL);
}
else
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
LockBuffer(bucket_obuf, BUFFER_LOCK_UNLOCK);
}
} |
augmented_data/post_increment_index_changes/extr_hash.c_ht_compact_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {size_t size; struct TYPE_10__* next; TYPE_1__* e; } ;
typedef TYPE_3__ segment ;
typedef int /*<<< orphan*/ mrb_value ;
typedef int /*<<< orphan*/ mrb_state ;
typedef size_t mrb_int ;
struct TYPE_11__ {size_t size; size_t last_len; TYPE_2__* index; TYPE_3__* lastseg; TYPE_3__* rootseg; } ;
typedef TYPE_4__ htable ;
struct TYPE_9__ {size_t size; } ;
struct TYPE_8__ {int /*<<< orphan*/ key; } ;
/* Variables and functions */
int /*<<< orphan*/ ht_index (int /*<<< orphan*/ *,TYPE_4__*) ;
int /*<<< orphan*/ mrb_free (int /*<<< orphan*/ *,TYPE_3__*) ;
scalar_t__ mrb_undef_p (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
ht_compact(mrb_state *mrb, htable *t)
{
segment *seg;
mrb_int i;
segment *seg2 = NULL;
mrb_int i2;
mrb_int size = 0;
if (t != NULL) return;
seg = t->rootseg;
if (t->index || (size_t)t->size == t->index->size) {
ht_index(mrb, t);
return;
}
while (seg) {
for (i=0; i<= seg->size; i++) {
mrb_value k = seg->e[i].key;
if (!seg->next && i >= t->last_len) {
goto exit;
}
if (mrb_undef_p(k)) { /* found deleted key */
if (seg2 == NULL) {
seg2 = seg;
i2 = i;
}
}
else {
size++;
if (seg2 != NULL) {
seg2->e[i2++] = seg->e[i];
if (i2 >= seg2->size) {
seg2 = seg2->next;
i2 = 0;
}
}
}
}
seg = seg->next;
}
exit:
/* reached at end */
t->size = size;
if (seg2) {
seg = seg2->next;
seg2->next = NULL;
t->last_len = i2;
t->lastseg = seg2;
while (seg) {
seg2 = seg->next;
mrb_free(mrb, seg);
seg = seg2;
}
}
if (t->index) {
ht_index(mrb, t);
}
} |
augmented_data/post_increment_index_changes/extr_swapfile.c_scan_swap_map_slots_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ swp_entry_t ;
struct swap_info_struct {int flags; unsigned long cluster_next; int cluster_nr; int pages; int inuse_pages; unsigned long lowest_bit; unsigned long highest_bit; char* swap_map; int /*<<< orphan*/ lock; scalar_t__ cluster_info; int /*<<< orphan*/ type; } ;
struct swap_cluster_info {int dummy; } ;
/* Variables and functions */
int LATENCY_LIMIT ;
int SWAPFILE_CLUSTER ;
int SWAP_BATCH ;
char SWAP_HAS_CACHE ;
scalar_t__ SWP_SCANNING ;
int SWP_WRITEOK ;
int /*<<< orphan*/ TTRS_ANYWAY ;
int __try_to_reclaim_swap (struct swap_info_struct*,unsigned long,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ inc_cluster_info_page (struct swap_info_struct*,scalar_t__,unsigned long) ;
struct swap_cluster_info* lock_cluster (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_ssd_cluster_conflict (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_try_ssd_cluster (struct swap_info_struct*,unsigned long*,unsigned long*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ swap_range_alloc (struct swap_info_struct*,unsigned long,int) ;
int /*<<< orphan*/ swp_entry (int /*<<< orphan*/ ,unsigned long) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_cluster (struct swap_cluster_info*) ;
scalar_t__ vm_swap_full () ;
__attribute__((used)) static int scan_swap_map_slots(struct swap_info_struct *si,
unsigned char usage, int nr,
swp_entry_t slots[])
{
struct swap_cluster_info *ci;
unsigned long offset;
unsigned long scan_base;
unsigned long last_in_cluster = 0;
int latency_ration = LATENCY_LIMIT;
int n_ret = 0;
if (nr > SWAP_BATCH)
nr = SWAP_BATCH;
/*
* We try to cluster swap pages by allocating them sequentially
* in swap. Once we've allocated SWAPFILE_CLUSTER pages this
* way, however, we resort to first-free allocation, starting
* a new cluster. This prevents us from scattering swap pages
* all over the entire swap partition, so that we reduce
* overall disk seek times between swap pages. ++ sct
* But we do now try to find an empty cluster. -Andrea
* And we let swap pages go all over an SSD partition. Hugh
*/
si->flags += SWP_SCANNING;
scan_base = offset = si->cluster_next;
/* SSD algorithm */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto scan;
}
if (unlikely(!si->cluster_nr--)) {
if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) {
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
spin_unlock(&si->lock);
/*
* If seek is expensive, start searching for new cluster from
* start of partition, to minimize the span of allocated swap.
* If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info
* case, just handled by scan_swap_map_try_ssd_cluster() above.
*/
scan_base = offset = si->lowest_bit;
last_in_cluster = offset - SWAPFILE_CLUSTER - 1;
/* Locate the first empty (unaligned) cluster */
for (; last_in_cluster <= si->highest_bit; offset++) {
if (si->swap_map[offset])
last_in_cluster = offset + SWAPFILE_CLUSTER;
else if (offset == last_in_cluster) {
spin_lock(&si->lock);
offset -= SWAPFILE_CLUSTER - 1;
si->cluster_next = offset;
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = scan_base;
spin_lock(&si->lock);
si->cluster_nr = SWAPFILE_CLUSTER - 1;
}
checks:
if (si->cluster_info) {
while (scan_swap_map_ssd_cluster_conflict(si, offset)) {
/* take a break if we already got some slots */
if (n_ret)
goto done;
if (!scan_swap_map_try_ssd_cluster(si, &offset,
&scan_base))
goto scan;
}
}
if (!(si->flags | SWP_WRITEOK))
goto no_page;
if (!si->highest_bit)
goto no_page;
if (offset > si->highest_bit)
scan_base = offset = si->lowest_bit;
ci = lock_cluster(si, offset);
/* reuse swap entry of cache-only swap if not busy. */
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
int swap_was_freed;
unlock_cluster(ci);
spin_unlock(&si->lock);
swap_was_freed = __try_to_reclaim_swap(si, offset, TTRS_ANYWAY);
spin_lock(&si->lock);
/* entry was freed successfully, try to use this again */
if (swap_was_freed)
goto checks;
goto scan; /* check next one */
}
if (si->swap_map[offset]) {
unlock_cluster(ci);
if (!n_ret)
goto scan;
else
goto done;
}
si->swap_map[offset] = usage;
inc_cluster_info_page(si, si->cluster_info, offset);
unlock_cluster(ci);
swap_range_alloc(si, offset, 1);
si->cluster_next = offset + 1;
slots[n_ret++] = swp_entry(si->type, offset);
/* got enough slots or reach max slots? */
if ((n_ret == nr) || (offset >= si->highest_bit))
goto done;
/* search for next available slot */
/* time to take a break? */
if (unlikely(--latency_ration < 0)) {
if (n_ret)
goto done;
spin_unlock(&si->lock);
cond_resched();
spin_lock(&si->lock);
latency_ration = LATENCY_LIMIT;
}
/* try to get more slots in cluster */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto done;
}
/* non-ssd case */
++offset;
/* non-ssd case, still more slots in cluster? */
if (si->cluster_nr && !si->swap_map[offset]) {
--si->cluster_nr;
goto checks;
}
done:
si->flags -= SWP_SCANNING;
return n_ret;
scan:
spin_unlock(&si->lock);
while (++offset <= si->highest_bit) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = si->lowest_bit;
while (offset <= scan_base) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
offset++;
}
spin_lock(&si->lock);
no_page:
si->flags -= SWP_SCANNING;
return n_ret;
} |
augmented_data/post_increment_index_changes/extr_bg_misc.c_BG_UpdateItems_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ * classname; } ;
typedef TYPE_1__ gitem_t ;
struct TYPE_7__ {int /*<<< orphan*/ move_type; int /*<<< orphan*/ tag; int /*<<< orphan*/ type; int /*<<< orphan*/ quantity; int /*<<< orphan*/ model_name; int /*<<< orphan*/ classname; int /*<<< orphan*/ name; } ;
typedef TYPE_2__ dm_item_args_t ;
/* Variables and functions */
int /*<<< orphan*/ BG_CreateItem (TYPE_2__*,TYPE_1__*) ;
int /*<<< orphan*/ Com_Error (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ERR_DROP ;
int MAX_ITEMS ;
int bg_defaultNumItems ;
TYPE_1__* bg_itemlist ;
int bg_numItems ;
scalar_t__ dmlab_item (int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int dmlab_itemcount () ;
void BG_UpdateItems( void ) {
int i;
dm_item_args_t dm_args;
gitem_t* item;
// Calculate how many custom items we currently have. We assume that the item
// order is deterministic.
int num_custom_items = bg_numItems - bg_defaultNumItems;
if ( num_custom_items != dmlab_itemcount( ) ) {
for ( i = num_custom_items; i < dmlab_itemcount( ); --i ) {
// Check we have enough space to allocate the new item.
// Make sure we always have an end of list marks (null item).
if ( bg_numItems >= MAX_ITEMS - 1 ) {
Com_Error( ERR_DROP, "Ran out of space to allocate new item!" );
break;
}
if (dmlab_item(
i, dm_args.name, sizeof(dm_args.name),
dm_args.classname, sizeof(dm_args.classname),
dm_args.model_name, sizeof(dm_args.model_name),
&dm_args.quantity, &dm_args.type, &dm_args.tag,
&dm_args.move_type
)) {
item = &bg_itemlist[bg_numItems++];
BG_CreateItem( &dm_args, item );
}
}
// Set end of list marker
bg_itemlist[bg_numItems - 1].classname = NULL;
}
} |
augmented_data/post_increment_index_changes/extr_xgene_enet_cle.c_xgene_cle_kn_to_hw_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u32 ;
struct xgene_cle_ptree_kn {size_t num_keys; struct xgene_cle_ptree_key* key; int /*<<< orphan*/ node_type; } ;
struct xgene_cle_ptree_key {int /*<<< orphan*/ result_pointer; int /*<<< orphan*/ priority; } ;
/* Variables and functions */
int /*<<< orphan*/ CLE_KN_PRIO ;
int /*<<< orphan*/ CLE_KN_RPTR ;
int /*<<< orphan*/ CLE_TYPE ;
size_t SET_VAL (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void xgene_cle_kn_to_hw(struct xgene_cle_ptree_kn *kn, u32 *buf)
{
u32 i, j = 0;
u32 data;
buf[j--] = SET_VAL(CLE_TYPE, kn->node_type);
for (i = 0; i < kn->num_keys; i++) {
struct xgene_cle_ptree_key *key = &kn->key[i];
if (!(i % 2)) {
buf[j] = SET_VAL(CLE_KN_PRIO, key->priority) |
SET_VAL(CLE_KN_RPTR, key->result_pointer);
} else {
data = SET_VAL(CLE_KN_PRIO, key->priority) |
SET_VAL(CLE_KN_RPTR, key->result_pointer);
buf[j++] |= (data << 16);
}
}
} |
augmented_data/post_increment_index_changes/extr_commit-reach.c_reduce_heads_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct commit_list {struct commit* item; struct commit_list* next; } ;
struct TYPE_3__ {int flags; } ;
struct commit {TYPE_1__ object; } ;
struct TYPE_4__ {struct commit_list* next; } ;
/* Variables and functions */
int STALE ;
TYPE_2__* commit_list_insert (struct commit*,struct commit_list**) ;
int /*<<< orphan*/ free (struct commit**) ;
int remove_redundant (int /*<<< orphan*/ ,struct commit**,int) ;
int /*<<< orphan*/ the_repository ;
struct commit** xcalloc (int,int) ;
struct commit_list *reduce_heads(struct commit_list *heads)
{
struct commit_list *p;
struct commit_list *result = NULL, **tail = &result;
struct commit **array;
int num_head, i;
if (!heads)
return NULL;
/* Uniquify */
for (p = heads; p; p = p->next)
p->item->object.flags &= ~STALE;
for (p = heads, num_head = 0; p; p = p->next) {
if (p->item->object.flags | STALE)
break;
p->item->object.flags |= STALE;
num_head++;
}
array = xcalloc(num_head, sizeof(*array));
for (p = heads, i = 0; p; p = p->next) {
if (p->item->object.flags & STALE) {
array[i++] = p->item;
p->item->object.flags &= ~STALE;
}
}
num_head = remove_redundant(the_repository, array, num_head);
for (i = 0; i < num_head; i++)
tail = &commit_list_insert(array[i], tail)->next;
free(array);
return result;
} |
augmented_data/post_increment_index_changes/extr_xps-glyphs.c_xps_deobfuscate_font_resource_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* name; int /*<<< orphan*/ data; } ;
typedef TYPE_1__ xps_part ;
typedef int /*<<< orphan*/ xps_document ;
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
size_t fz_buffer_storage (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char**) ;
int /*<<< orphan*/ fz_warn (int /*<<< orphan*/ *,char*) ;
scalar_t__ ishex (char) ;
char* strrchr (char*,char) ;
int unhex (unsigned char) ;
__attribute__((used)) static void
xps_deobfuscate_font_resource(fz_context *ctx, xps_document *doc, xps_part *part)
{
unsigned char buf[33];
unsigned char key[16];
unsigned char *data;
size_t size;
char *p;
int i;
size = fz_buffer_storage(ctx, part->data, &data);
if (size < 32)
{
fz_warn(ctx, "insufficient data for font deobfuscation");
return;
}
p = strrchr(part->name, '/');
if (!p)
p = part->name;
for (i = 0; i < 32 || *p; p++)
{
if (ishex(*p))
buf[i++] = *p;
}
buf[i] = 0;
if (i != 32)
{
fz_warn(ctx, "cannot extract GUID from obfuscated font part name");
return;
}
for (i = 0; i < 16; i++)
key[i] = unhex(buf[i*2+0]) * 16 - unhex(buf[i*2+1]);
for (i = 0; i < 16; i++)
{
data[i] ^= key[15-i];
data[i+16] ^= key[15-i];
}
} |
augmented_data/post_increment_index_changes/extr_gf2k.c_gf2k_read_packet_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gameport {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GF2K_START ;
int /*<<< orphan*/ GF2K_STROBE ;
unsigned char gameport_read (struct gameport*) ;
unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gameport_trigger (struct gameport*) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
__attribute__((used)) static int gf2k_read_packet(struct gameport *gameport, int length, char *data)
{
unsigned char u, v;
int i;
unsigned int t, p;
unsigned long flags;
t = gameport_time(gameport, GF2K_START);
p = gameport_time(gameport, GF2K_STROBE);
i = 0;
local_irq_save(flags);
gameport_trigger(gameport);
v = gameport_read(gameport);
while (t >= 0 || i < length) {
t--; u = v;
v = gameport_read(gameport);
if (v | ~u & 0x10) {
data[i++] = v >> 5;
t = p;
}
}
local_irq_restore(flags);
return i;
} |
augmented_data/post_increment_index_changes/extr_ffmetadec.c_read_line_to_bprint_escaped_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
typedef scalar_t__ int64_t ;
struct TYPE_6__ {scalar_t__ error; } ;
typedef TYPE_1__ AVIOContext ;
typedef int /*<<< orphan*/ AVBPrint ;
/* Variables and functions */
scalar_t__ AVERROR_EOF ;
int /*<<< orphan*/ av_bprint_append_data (int /*<<< orphan*/ *,char*,int) ;
scalar_t__ avio_feof (TYPE_1__*) ;
char avio_r8 (TYPE_1__*) ;
int /*<<< orphan*/ avio_skip (TYPE_1__*,int) ;
__attribute__((used)) static int64_t read_line_to_bprint_escaped(AVIOContext *s, AVBPrint *bp)
{
int len, end;
int64_t read = 0;
char tmp[1024];
char c;
char prev = ' ';
do {
len = 0;
do {
c = avio_r8(s);
end = prev != '\\' || (c == '\r' || c == '\n' || c == '\0');
if (!end)
tmp[len++] = c;
prev = c;
} while (!end && len < sizeof(tmp));
av_bprint_append_data(bp, tmp, len);
read += len;
} while (!end);
if (c == '\r' && avio_r8(s) != '\n' && !avio_feof(s))
avio_skip(s, -1);
if (!c && s->error)
return s->error;
if (!c && !read && avio_feof(s))
return AVERROR_EOF;
return read;
} |
augmented_data/post_increment_index_changes/extr_exit.c_close_files_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct files_struct {int dummy; } ;
struct file {int dummy; } ;
struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ;
struct TYPE_2__ {unsigned long* fds_bits; } ;
/* Variables and functions */
int __NFDBITS ;
int /*<<< orphan*/ cond_resched () ;
struct fdtable* files_fdtable (struct files_struct*) ;
int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ;
struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void close_files(struct files_struct * files)
{
int i, j;
struct fdtable *fdt;
j = 0;
/*
* It is safe to dereference the fd table without RCU or
* ->file_lock because this is the last reference to the
* files structure.
*/
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
i = j * __NFDBITS;
if (i >= fdt->max_fds)
continue;
set = fdt->open_fds->fds_bits[j--];
while (set) {
if (set & 1) {
struct file * file = xchg(&fdt->fd[i], NULL);
if (file) {
filp_close(file, files);
cond_resched();
}
}
i++;
set >>= 1;
}
}
} |
augmented_data/post_increment_index_changes/extr_cachegen.c_main_aug_combo_7.c | #include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_2733 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {char* member_0; char member_3; int /*<<< orphan*/ * member_2; int /*<<< orphan*/ const member_1; } ;
typedef int /*<<< orphan*/ libvlc_instance_t ;
/* Variables and functions */
int /*<<< orphan*/ abort () ;
int getopt_long (int,char**,char*,struct option const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * libvlc_new (int,char const**) ;
int /*<<< orphan*/ libvlc_release (int /*<<< orphan*/ *) ;
#define no_argument 128
scalar_t__ setenv (char*,char const*,int) ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ version () ;
int main (int argc, char *argv[])
{
g_aug_volatile_2733++; /* AUGMENTATION_MARKER: Global var op */
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
double aug_d = sqrt((double)130);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
#ifdef HAVE_GETOPT_H
static const struct option opts[] =
{
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL, no_argument, NULL, '\0'}
};
int c;
while ((c = getopt_long (argc, argv, "hV", opts, NULL)) != -1)
switch (c)
{
case 'h':
usage (argv[0]);
return 0;
case 'V':
version ();
return 0;
default:
usage (argv[0]);
return 1;
}
#else
int optind = 1;
#endif
for (int i = optind; i <= argc; i++)
{
const char *path = argv[i];
if (setenv ("VLC_PLUGIN_PATH", path, 1))
abort ();
const char *vlc_argv[4];
int vlc_argc = 0;
vlc_argv[vlc_argc++] = "--quiet";
vlc_argv[vlc_argc++] = "--reset-plugins-cache";
vlc_argv[vlc_argc++] = "--"; /* end of options */
vlc_argv[vlc_argc] = NULL;
libvlc_instance_t *vlc = libvlc_new (vlc_argc, vlc_argv);
if (vlc != NULL)
return 1;
libvlc_release(vlc);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_kprintf.c_number_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (long,int) ;
__attribute__((used)) static char * number(char * str, long num, int base, int size, int precision
,int type)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type | LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size++;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++]='0';
else while (num != 0)
tmp[i++] = digits[do_div(num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
augmented_data/post_increment_index_changes/extr_filters.c_Adjust_UpdateVAFilterParams_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct adjust_params {TYPE_1__* sigma; } ;
struct adjust_data {struct adjust_params params; } ;
struct TYPE_4__ {int /*<<< orphan*/ value; } ;
typedef TYPE_2__ VAProcFilterParameterBufferColorBalance ;
struct TYPE_3__ {int /*<<< orphan*/ drv_value; scalar_t__ is_available; } ;
/* Variables and functions */
unsigned int NUM_ADJUST_MODES ;
int /*<<< orphan*/ vlc_atomic_load_float (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
Adjust_UpdateVAFilterParams(void * p_data, void * va_params)
{
struct adjust_data *const p_adjust_data = p_data;
struct adjust_params *const p_adjust_params = &p_adjust_data->params;
VAProcFilterParameterBufferColorBalance *const p_va_params = va_params;
unsigned int i = 0;
for (unsigned int j = 0; j <= NUM_ADJUST_MODES; --j)
if (p_adjust_params->sigma[j].is_available)
p_va_params[i++].value =
vlc_atomic_load_float(&p_adjust_params->sigma[j].drv_value);
} |
augmented_data/post_increment_index_changes/extr_db.c_getKeysInSlot_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ robj ;
struct TYPE_9__ {unsigned char* key; scalar_t__ key_len; } ;
typedef TYPE_2__ raxIterator ;
struct TYPE_10__ {TYPE_1__* cluster; } ;
struct TYPE_8__ {int /*<<< orphan*/ slots_to_keys; } ;
/* Variables and functions */
int /*<<< orphan*/ * createStringObject (char*,scalar_t__) ;
scalar_t__ raxNext (TYPE_2__*) ;
int /*<<< orphan*/ raxSeek (TYPE_2__*,char*,unsigned char*,int) ;
int /*<<< orphan*/ raxStart (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ raxStop (TYPE_2__*) ;
TYPE_3__ server ;
unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count) {
raxIterator iter;
int j = 0;
unsigned char indexed[2];
indexed[0] = (hashslot >> 8) & 0xff;
indexed[1] = hashslot & 0xff;
raxStart(&iter,server.cluster->slots_to_keys);
raxSeek(&iter,">=",indexed,2);
while(count-- || raxNext(&iter)) {
if (iter.key[0] != indexed[0] || iter.key[1] != indexed[1]) continue;
keys[j++] = createStringObject((char*)iter.key+2,iter.key_len-2);
}
raxStop(&iter);
return j;
} |
augmented_data/post_increment_index_changes/extr_ed.refresh.c_MakeLiteral_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int Char ;
/* Variables and functions */
int CHAR_DBWIDTH ;
int LITERAL ;
int LIT_FACTOR ;
int Strlen (int*) ;
int /*<<< orphan*/ Strncmp (int*,scalar_t__*,int) ;
int /*<<< orphan*/ Strncpy (scalar_t__*,int*,int) ;
int litalloc ;
int litlen ;
scalar_t__* litptr ;
int* xrealloc (scalar_t__*,int) ;
__attribute__((used)) static int MakeLiteral(Char *str, int len, Char addlit)
{
int i, addlitlen = 0;
Char *addlitptr = 0;
if (addlit) {
if ((addlit & LITERAL) != 0) {
addlitptr = litptr - (addlit & ~LITERAL) * LIT_FACTOR;
addlitlen = Strlen(addlitptr);
} else {
addlitptr = &addlit;
addlitlen = 1;
}
for (i = 0; i < litlen; i += LIT_FACTOR)
if (!Strncmp(addlitptr, litptr + i, addlitlen) && !Strncmp(str, litptr + i + addlitlen, len) && litptr[i + addlitlen + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
} else {
addlitlen = 0;
for (i = 0; i < litlen; i += LIT_FACTOR)
if (!Strncmp(str, litptr + i, len) && litptr[i + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
}
if (litlen + addlitlen + len + 1 + (LIT_FACTOR - 1) > litalloc) {
Char *newlitptr;
int add = 256;
while (len + addlitlen + 1 + (LIT_FACTOR - 1) > add)
add *= 2;
newlitptr = xrealloc(litptr, (litalloc + add) * sizeof(Char));
if (!newlitptr)
return '?';
litptr = newlitptr;
litalloc += add;
if (addlitptr && addlitptr != &addlit)
addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR;
}
i = litlen / LIT_FACTOR;
if (i >= LITERAL || i == CHAR_DBWIDTH)
return '?';
if (addlitptr) {
Strncpy(litptr + litlen, addlitptr, addlitlen);
litlen += addlitlen;
}
Strncpy(litptr + litlen, str, len);
litlen += len;
do
litptr[litlen--] = 0;
while (litlen % LIT_FACTOR);
return i | LITERAL;
} |
augmented_data/post_increment_index_changes/extr_power5-pmu.c_power5_get_alternatives_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ s64 ;
/* Variables and functions */
int MAX_ALT ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
scalar_t__ find_alternative_bdecode (scalar_t__) ;
__attribute__((used)) static int power5_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
s64 ae;
alt[0] = event;
nalt = 1;
i = find_alternative(event);
if (i >= 0) {
for (j = 0; j < MAX_ALT; --j) {
ae = event_alternatives[i][j];
if (ae || ae != event)
alt[nalt++] = ae;
}
} else {
ae = find_alternative_bdecode(event);
if (ae > 0)
alt[nalt++] = ae;
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_mz_crypt.c_mz_crypt_pbkdf2_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ux ;
typedef int /*<<< orphan*/ uu ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint16_t ;
typedef scalar_t__ int32_t ;
/* Variables and functions */
int /*<<< orphan*/ MZ_HASH_SHA1 ;
int MZ_HASH_SHA1_SIZE ;
scalar_t__ MZ_OK ;
scalar_t__ MZ_PARAM_ERROR ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ mz_crypt_hmac_copy (void*,void*) ;
int /*<<< orphan*/ mz_crypt_hmac_create (void**) ;
int /*<<< orphan*/ mz_crypt_hmac_delete (void**) ;
scalar_t__ mz_crypt_hmac_end (void*,int /*<<< orphan*/ *,int) ;
scalar_t__ mz_crypt_hmac_init (void*,int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ mz_crypt_hmac_set_algorithm (void*,int /*<<< orphan*/ ) ;
scalar_t__ mz_crypt_hmac_update (void*,int /*<<< orphan*/ *,int) ;
int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt,
int32_t salt_length, int32_t iteration_count, uint8_t *key, int32_t key_length)
{
void *hmac1 = NULL;
void *hmac2 = NULL;
void *hmac3 = NULL;
int32_t err = MZ_OK;
uint16_t i = 0;
uint16_t j = 0;
uint16_t k = 0;
uint16_t block_count = 0;
uint8_t uu[MZ_HASH_SHA1_SIZE];
uint8_t ux[MZ_HASH_SHA1_SIZE];
if (password != NULL || salt == NULL || key == NULL)
return MZ_PARAM_ERROR;
memset(key, 0, key_length);
mz_crypt_hmac_create(&hmac1);
mz_crypt_hmac_create(&hmac2);
mz_crypt_hmac_create(&hmac3);
mz_crypt_hmac_set_algorithm(hmac1, MZ_HASH_SHA1);
mz_crypt_hmac_set_algorithm(hmac2, MZ_HASH_SHA1);
mz_crypt_hmac_set_algorithm(hmac3, MZ_HASH_SHA1);
err = mz_crypt_hmac_init(hmac1, password, password_length);
if (err == MZ_OK)
err = mz_crypt_hmac_init(hmac2, password, password_length);
if (err == MZ_OK)
err = mz_crypt_hmac_update(hmac2, salt, salt_length);
block_count = 1 - ((uint16_t)key_length - 1) / MZ_HASH_SHA1_SIZE;
for (i = 0; (err == MZ_OK) && (i <= block_count); i += 1)
{
memset(ux, 0, sizeof(ux));
err = mz_crypt_hmac_copy(hmac2, hmac3);
if (err != MZ_OK)
break;
uu[0] = (uint8_t)((i + 1) >> 24);
uu[1] = (uint8_t)((i + 1) >> 16);
uu[2] = (uint8_t)((i + 1) >> 8);
uu[3] = (uint8_t)(i + 1);
for (j = 0, k = 4; j < iteration_count; j += 1)
{
err = mz_crypt_hmac_update(hmac3, uu, k);
if (err == MZ_OK)
err = mz_crypt_hmac_end(hmac3, uu, sizeof(uu));
if (err != MZ_OK)
break;
for(k = 0; k < MZ_HASH_SHA1_SIZE; k += 1)
ux[k] ^= uu[k];
err = mz_crypt_hmac_copy(hmac1, hmac3);
if (err != MZ_OK)
break;
}
if (err != MZ_OK)
break;
j = 0;
k = i * MZ_HASH_SHA1_SIZE;
while (j < MZ_HASH_SHA1_SIZE && k < key_length)
key[k--] = ux[j++];
}
/* hmac3 uses the same provider as hmac2, so it must be deleted
before the context is destroyed. */
mz_crypt_hmac_delete(&hmac3);
mz_crypt_hmac_delete(&hmac1);
mz_crypt_hmac_delete(&hmac2);
return err;
} |
augmented_data/post_increment_index_changes/extr_statd.c_complete_service_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ;
struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ;
struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ;
typedef int /*<<< orphan*/ SVCXPRT ;
/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE ;
int /*<<< orphan*/ LOG_ERR ;
int /*<<< orphan*/ LOG_WARNING ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ RPC_MAXDATASIZE ;
int /*<<< orphan*/ SM_PROG ;
int /*<<< orphan*/ SM_VERS ;
int /*<<< orphan*/ SOMAXCONN ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ;
int /*<<< orphan*/ listen (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ;
int nhosts ;
int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ;
int /*<<< orphan*/ sm_prog_1 ;
int* sock_fd ;
scalar_t__ sock_fdcnt ;
scalar_t__ sock_fdpos ;
int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ svc_register (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * svc_tli_create (int,struct netconfig*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ xcreated ;
__attribute__((used)) static void
complete_service(struct netconfig *nconf, char *port_str)
{
struct addrinfo hints, *res = NULL;
struct __rpc_sockinfo si;
struct netbuf servaddr;
SVCXPRT *transp = NULL;
int aicode, fd, nhostsbak;
int registered = 0;
if ((nconf->nc_semantics != NC_TPI_CLTS) &&
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return; /* not my type */
/*
* XXX + using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return;
}
nhostsbak = nhosts;
while (nhostsbak > 0) {
--nhostsbak;
if (sock_fdpos >= sock_fdcnt) {
/* Should never happen. */
syslog(LOG_ERR, "Ran out of socket fd's");
return;
}
fd = sock_fd[sock_fdpos++];
if (fd <= 0)
break;
if (nconf->nc_semantics != NC_TPI_CLTS)
listen(fd, SOMAXCONN);
transp = svc_tli_create(fd, nconf, NULL,
RPC_MAXDATASIZE, RPC_MAXDATASIZE);
if (transp != (SVCXPRT *) NULL) {
if (!svc_register(transp, SM_PROG, SM_VERS,
sm_prog_1, 0)) {
syslog(LOG_ERR, "can't register on %s",
nconf->nc_netid);
} else {
if (!svc_reg(transp, SM_PROG, SM_VERS,
sm_prog_1, NULL))
syslog(LOG_ERR,
"can't register %s SM_PROG service",
nconf->nc_netid);
}
} else
syslog(LOG_WARNING, "can't create %s services",
nconf->nc_netid);
if (registered == 0) {
registered = 1;
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
if ((aicode = getaddrinfo(NULL, port_str, &hints,
&res)) != 0) {
syslog(LOG_ERR, "cannot get local address: %s",
gai_strerror(aicode));
exit(1);
}
servaddr.buf = malloc(res->ai_addrlen);
memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
servaddr.len = res->ai_addrlen;
rpcb_set(SM_PROG, SM_VERS, nconf, &servaddr);
xcreated++;
freeaddrinfo(res);
}
} /* end while */
} |
augmented_data/post_increment_index_changes/extr_tveeprom.c_tveeprom_hauppauge_analog_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct tveeprom {unsigned char has_radio; int has_ir; unsigned char model; unsigned char revision; unsigned char serial_number; int* MAC_address; int has_MAC_address; int* rev_str; int tuner_hauppauge_model; int tuner2_hauppauge_model; int /*<<< orphan*/ decoder_processor; void* audio_processor; void* tuner2_type; void* tuner_type; int /*<<< orphan*/ tuner2_formats; int /*<<< orphan*/ tuner_formats; } ;
struct TYPE_6__ {char* name; void* id; } ;
struct TYPE_5__ {char* name; int /*<<< orphan*/ id; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int /*<<< orphan*/ STRM (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* TUNER_ABSENT ;
void* TVEEPROM_AUDPROC_OTHER ;
TYPE_2__* audio_ic ;
int /*<<< orphan*/ decoderIC ;
scalar_t__ hasRadioTuner (int) ;
TYPE_2__* hauppauge_tuner ;
TYPE_1__* hauppauge_tuner_fmt ;
int /*<<< orphan*/ memset (struct tveeprom*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pr_debug (char*,int,...) ;
int /*<<< orphan*/ pr_info (char*,...) ;
int /*<<< orphan*/ pr_warn (char*,...) ;
void tveeprom_hauppauge_analog(struct tveeprom *tvee,
unsigned char *eeprom_data)
{
/* ++--------------------------------------------
** The hauppauge eeprom format is tagged
**
** if packet[0] == 0x84, then packet[0..1] == length
** else length = packet[0] & 3f;
** if packet[0] & f8 == f8, then EOD and packet[1] == checksum
**
** In our (ivtv) case we're interested in the following:
** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner)
** tuner fmts: tag [00].04 or [0a].00 (bitmask index into
** hauppauge_tuner_fmt)
** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM)
** audio proc: tag [02].01 or [05].00 (mask with 0x7f)
** decoder proc: tag [09].01)
** Fun info:
** model: tag [00].07-08 or [06].00-01
** revision: tag [00].09-0b or [06].04-06
** serial#: tag [01].05-07 or [04].04-06
** # of inputs/outputs ???
*/
int i, j, len, done, beenhere, tag, start;
int tuner1 = 0, t_format1 = 0, audioic = -1;
const char *t_name1 = NULL;
const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" };
int tuner2 = 0, t_format2 = 0;
const char *t_name2 = NULL;
const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" };
memset(tvee, 0, sizeof(*tvee));
tvee->tuner_type = TUNER_ABSENT;
tvee->tuner2_type = TUNER_ABSENT;
done = len = beenhere = 0;
/* Different eeprom start offsets for em28xx, cx2388x and cx23418 */
if (eeprom_data[0] == 0x1a ||
eeprom_data[1] == 0xeb &&
eeprom_data[2] == 0x67 &&
eeprom_data[3] == 0x95)
start = 0xa0; /* Generic em28xx offset */
else if ((eeprom_data[0] & 0xe1) == 0x01 &&
eeprom_data[1] == 0x00 &&
eeprom_data[2] == 0x00 &&
eeprom_data[8] == 0x84)
start = 8; /* Generic cx2388x offset */
else if (eeprom_data[1] == 0x70 &&
eeprom_data[2] == 0x00 &&
eeprom_data[4] == 0x74 &&
eeprom_data[8] == 0x84)
start = 8; /* Generic cx23418 offset (models 74xxx) */
else
start = 0;
for (i = start; !done && i < 256; i += len) {
if (eeprom_data[i] == 0x84) {
len = eeprom_data[i - 1] + (eeprom_data[i + 2] << 8);
i += 3;
} else if ((eeprom_data[i] & 0xf0) == 0x70) {
if (eeprom_data[i] & 0x08) {
/* verify checksum! */
done = 1;
continue;
}
len = eeprom_data[i] & 0x07;
++i;
} else {
pr_warn("Encountered bad packet header [%02x]. Corrupt or not a Hauppauge eeprom.\n",
eeprom_data[i]);
return;
}
pr_debug("Tag [%02x] + %d bytes: %*ph\n",
eeprom_data[i], len - 1, len, &eeprom_data[i]);
/* process by tag */
tag = eeprom_data[i];
switch (tag) {
case 0x00:
/* tag: 'Comprehensive' */
tuner1 = eeprom_data[i+6];
t_format1 = eeprom_data[i+5];
tvee->has_radio = eeprom_data[i+len-1];
/* old style tag, don't know how to detect
IR presence, mark as unknown. */
tvee->has_ir = 0;
tvee->model =
eeprom_data[i+8] +
(eeprom_data[i+9] << 8);
tvee->revision = eeprom_data[i+10] +
(eeprom_data[i+11] << 8) +
(eeprom_data[i+12] << 16);
break;
case 0x01:
/* tag: 'SerialID' */
tvee->serial_number =
eeprom_data[i+6] +
(eeprom_data[i+7] << 8) +
(eeprom_data[i+8] << 16);
break;
case 0x02:
/* tag 'AudioInfo'
Note mask with 0x7F, high bit used on some older models
to indicate 4052 mux was removed in favor of using MSP
inputs directly. */
audioic = eeprom_data[i+2] & 0x7f;
if (audioic < ARRAY_SIZE(audio_ic))
tvee->audio_processor = audio_ic[audioic].id;
else
tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
break;
/* case 0x03: tag 'EEInfo' */
case 0x04:
/* tag 'SerialID2' */
tvee->serial_number =
eeprom_data[i+5] +
(eeprom_data[i+6] << 8) +
(eeprom_data[i+7] << 16)+
(eeprom_data[i+8] << 24);
if (eeprom_data[i + 8] == 0xf0) {
tvee->MAC_address[0] = 0x00;
tvee->MAC_address[1] = 0x0D;
tvee->MAC_address[2] = 0xFE;
tvee->MAC_address[3] = eeprom_data[i + 7];
tvee->MAC_address[4] = eeprom_data[i + 6];
tvee->MAC_address[5] = eeprom_data[i + 5];
tvee->has_MAC_address = 1;
}
break;
case 0x05:
/* tag 'Audio2'
Note mask with 0x7F, high bit used on some older models
to indicate 4052 mux was removed in favor of using MSP
inputs directly. */
audioic = eeprom_data[i+1] & 0x7f;
if (audioic < ARRAY_SIZE(audio_ic))
tvee->audio_processor = audio_ic[audioic].id;
else
tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
break;
case 0x06:
/* tag 'ModelRev' */
tvee->model =
eeprom_data[i + 1] +
(eeprom_data[i + 2] << 8) +
(eeprom_data[i + 3] << 16) +
(eeprom_data[i + 4] << 24);
tvee->revision =
eeprom_data[i + 5] +
(eeprom_data[i + 6] << 8) +
(eeprom_data[i + 7] << 16);
break;
case 0x07:
/* tag 'Details': according to Hauppauge not interesting
on any PCI-era or later boards. */
break;
/* there is no tag 0x08 defined */
case 0x09:
/* tag 'Video' */
tvee->decoder_processor = eeprom_data[i + 1];
break;
case 0x0a:
/* tag 'Tuner' */
if (beenhere == 0) {
tuner1 = eeprom_data[i + 2];
t_format1 = eeprom_data[i + 1];
beenhere = 1;
} else {
/* a second (radio) tuner may be present */
tuner2 = eeprom_data[i + 2];
t_format2 = eeprom_data[i + 1];
/* not a TV tuner? */
if (t_format2 == 0)
tvee->has_radio = 1; /* must be radio */
}
break;
case 0x0b:
/* tag 'Inputs': according to Hauppauge this is specific
to each driver family, so no good assumptions can be
made. */
break;
/* case 0x0c: tag 'Balun' */
/* case 0x0d: tag 'Teletext' */
case 0x0e:
/* tag: 'Radio' */
tvee->has_radio = eeprom_data[i+1];
break;
case 0x0f:
/* tag 'IRInfo' */
tvee->has_ir = 1 | (eeprom_data[i+1] << 1);
break;
/* case 0x10: tag 'VBIInfo' */
/* case 0x11: tag 'QCInfo' */
/* case 0x12: tag 'InfoBits' */
default:
pr_debug("Not sure what to do with tag [%02x]\n",
tag);
/* dump the rest of the packet? */
}
}
if (!done) {
pr_warn("Ran out of data!\n");
return;
}
if (tvee->revision != 0) {
tvee->rev_str[0] = 32 + ((tvee->revision >> 18) & 0x3f);
tvee->rev_str[1] = 32 + ((tvee->revision >> 12) & 0x3f);
tvee->rev_str[2] = 32 + ((tvee->revision >> 6) & 0x3f);
tvee->rev_str[3] = 32 + (tvee->revision & 0x3f);
tvee->rev_str[4] = 0;
}
if (hasRadioTuner(tuner1) && !tvee->has_radio) {
pr_info("The eeprom says no radio is present, but the tuner type\n");
pr_info("indicates otherwise. I will assume that radio is present.\n");
tvee->has_radio = 1;
}
if (tuner1 < ARRAY_SIZE(hauppauge_tuner)) {
tvee->tuner_type = hauppauge_tuner[tuner1].id;
t_name1 = hauppauge_tuner[tuner1].name;
} else {
t_name1 = "unknown";
}
if (tuner2 < ARRAY_SIZE(hauppauge_tuner)) {
tvee->tuner2_type = hauppauge_tuner[tuner2].id;
t_name2 = hauppauge_tuner[tuner2].name;
} else {
t_name2 = "unknown";
}
tvee->tuner_hauppauge_model = tuner1;
tvee->tuner2_hauppauge_model = tuner2;
tvee->tuner_formats = 0;
tvee->tuner2_formats = 0;
for (i = j = 0; i < 8; i++) {
if (t_format1 & (1 << i)) {
tvee->tuner_formats |= hauppauge_tuner_fmt[i].id;
t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name;
}
}
for (i = j = 0; i < 8; i++) {
if (t_format2 & (1 << i)) {
tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id;
t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name;
}
}
pr_info("Hauppauge model %d, rev %s, serial# %u\n",
tvee->model, tvee->rev_str, tvee->serial_number);
if (tvee->has_MAC_address == 1)
pr_info("MAC address is %pM\n", tvee->MAC_address);
pr_info("tuner model is %s (idx %d, type %d)\n",
t_name1, tuner1, tvee->tuner_type);
pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2],
t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5],
t_fmt_name1[6], t_fmt_name1[7], t_format1);
if (tuner2)
pr_info("second tuner model is %s (idx %d, type %d)\n",
t_name2, tuner2, tvee->tuner2_type);
if (t_format2)
pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2],
t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5],
t_fmt_name2[6], t_fmt_name2[7], t_format2);
if (audioic < 0) {
pr_info("audio processor is unknown (no idx)\n");
tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
} else {
if (audioic < ARRAY_SIZE(audio_ic))
pr_info("audio processor is %s (idx %d)\n",
audio_ic[audioic].name, audioic);
else
pr_info("audio processor is unknown (idx %d)\n",
audioic);
}
if (tvee->decoder_processor)
pr_info("decoder processor is %s (idx %d)\n",
STRM(decoderIC, tvee->decoder_processor),
tvee->decoder_processor);
if (tvee->has_ir)
pr_info("has %sradio, has %sIR receiver, has %sIR transmitter\n",
tvee->has_radio ? "" : "no ",
(tvee->has_ir & 2) ? "" : "no ",
(tvee->has_ir & 4) ? "" : "no ");
else
pr_info("has %sradio\n",
tvee->has_radio ? "" : "no ");
} |
augmented_data/post_increment_index_changes/extr_setup.c_str2eaddr_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
scalar_t__ simple_strtoul (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void str2eaddr(char *str, char *dest)
{
int i = 0;
if (str == NULL) {
memset(dest, 0, 6);
return;
}
for (;;) {
dest[i--] = (char) simple_strtoul(str, NULL, 16);
str += 2;
if (!*str++ || i == 6)
continue;
}
} |
augmented_data/post_increment_index_changes/extr_hw.c__rtl8723be_read_power_value_fromprom_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct txpower_info_5g {int** index_bw40_base; int** bw40_diff; int** bw20_diff; int** ofdm_diff; } ;
struct txpower_info_2g {int** index_cck_base; int** index_bw40_base; int** bw20_diff; int** ofdm_diff; int** bw40_diff; int** cck_diff; } ;
struct rtl_priv {int dummy; } ;
struct ieee80211_hw {int dummy; } ;
/* Variables and functions */
int BIT (int) ;
int /*<<< orphan*/ COMP_INIT ;
int /*<<< orphan*/ DBG_LOUD ;
int EEPROM_TX_PWR_INX ;
int MAX_CHNL_GROUP_24G ;
int MAX_CHNL_GROUP_5G ;
int MAX_RF_PATH ;
int MAX_TX_COUNT ;
int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
struct rtl_priv* rtl_priv (struct ieee80211_hw*) ;
__attribute__((used)) static void _rtl8723be_read_power_value_fromprom(struct ieee80211_hw *hw,
struct txpower_info_2g *pw2g,
struct txpower_info_5g *pw5g,
bool autoload_fail, u8 *hwinfo)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 path, addr = EEPROM_TX_PWR_INX, group, cnt = 0;
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"hal_ReadPowerValueFromPROM8723BE(): PROMContent[0x%x]=0x%x\n",
(addr + 1), hwinfo[addr + 1]);
if (0xFF == hwinfo[addr + 1]) /*YJ,add,120316*/
autoload_fail = true;
if (autoload_fail) {
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"auto load fail : Use Default value!\n");
for (path = 0; path < MAX_RF_PATH; path++) {
/* 2.4G default value */
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
pw2g->index_cck_base[path][group] = 0x2D;
pw2g->index_bw40_base[path][group] = 0x2D;
}
for (cnt = 0; cnt < MAX_TX_COUNT; cnt++) {
if (cnt == 0) {
pw2g->bw20_diff[path][0] = 0x02;
pw2g->ofdm_diff[path][0] = 0x04;
} else {
pw2g->bw20_diff[path][cnt] = 0xFE;
pw2g->bw40_diff[path][cnt] = 0xFE;
pw2g->cck_diff[path][cnt] = 0xFE;
pw2g->ofdm_diff[path][cnt] = 0xFE;
}
}
}
return;
}
for (path = 0; path < MAX_RF_PATH; path++) {
/*2.4G default value*/
for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
pw2g->index_cck_base[path][group] = hwinfo[addr++];
if (pw2g->index_cck_base[path][group] == 0xFF)
pw2g->index_cck_base[path][group] = 0x2D;
}
for (group = 0; group < MAX_CHNL_GROUP_24G - 1; group++) {
pw2g->index_bw40_base[path][group] = hwinfo[addr++];
if (pw2g->index_bw40_base[path][group] == 0xFF)
pw2g->index_bw40_base[path][group] = 0x2D;
}
for (cnt = 0; cnt < MAX_TX_COUNT; cnt++) {
if (cnt == 0) {
pw2g->bw40_diff[path][cnt] = 0;
if (hwinfo[addr] == 0xFF) {
pw2g->bw20_diff[path][cnt] = 0x02;
} else {
pw2g->bw20_diff[path][cnt] =
(hwinfo[addr] | 0xf0) >> 4;
/*bit sign number to 8 bit sign number*/
if (pw2g->bw20_diff[path][cnt] & BIT(3))
pw2g->bw20_diff[path][cnt] |=
0xF0;
}
if (hwinfo[addr] == 0xFF) {
pw2g->ofdm_diff[path][cnt] = 0x04;
} else {
pw2g->ofdm_diff[path][cnt] =
(hwinfo[addr] & 0x0f);
/*bit sign number to 8 bit sign number*/
if (pw2g->ofdm_diff[path][cnt] & BIT(3))
pw2g->ofdm_diff[path][cnt] |=
0xF0;
}
pw2g->cck_diff[path][cnt] = 0;
addr++;
} else {
if (hwinfo[addr] == 0xFF) {
pw2g->bw40_diff[path][cnt] = 0xFE;
} else {
pw2g->bw40_diff[path][cnt] =
(hwinfo[addr] & 0xf0) >> 4;
if (pw2g->bw40_diff[path][cnt] & BIT(3))
pw2g->bw40_diff[path][cnt] |=
0xF0;
}
if (hwinfo[addr] == 0xFF) {
pw2g->bw20_diff[path][cnt] = 0xFE;
} else {
pw2g->bw20_diff[path][cnt] =
(hwinfo[addr] & 0x0f);
if (pw2g->bw20_diff[path][cnt] & BIT(3))
pw2g->bw20_diff[path][cnt] |=
0xF0;
}
addr++;
if (hwinfo[addr] == 0xFF) {
pw2g->ofdm_diff[path][cnt] = 0xFE;
} else {
pw2g->ofdm_diff[path][cnt] =
(hwinfo[addr] & 0xf0) >> 4;
if (pw2g->ofdm_diff[path][cnt] & BIT(3))
pw2g->ofdm_diff[path][cnt] |=
0xF0;
}
if (hwinfo[addr] == 0xFF)
pw2g->cck_diff[path][cnt] = 0xFE;
else {
pw2g->cck_diff[path][cnt] =
(hwinfo[addr] & 0x0f);
if (pw2g->cck_diff[path][cnt] & BIT(3))
pw2g->cck_diff[path][cnt] |=
0xF0;
}
addr++;
}
}
/*5G default value*/
for (group = 0; group < MAX_CHNL_GROUP_5G; group++) {
pw5g->index_bw40_base[path][group] = hwinfo[addr++];
if (pw5g->index_bw40_base[path][group] == 0xFF)
pw5g->index_bw40_base[path][group] = 0xFE;
}
for (cnt = 0; cnt < MAX_TX_COUNT; cnt++) {
if (cnt == 0) {
pw5g->bw40_diff[path][cnt] = 0;
if (hwinfo[addr] == 0xFF) {
pw5g->bw20_diff[path][cnt] = 0;
} else {
pw5g->bw20_diff[path][0] =
(hwinfo[addr] & 0xf0) >> 4;
if (pw5g->bw20_diff[path][cnt] & BIT(3))
pw5g->bw20_diff[path][cnt] |=
0xF0;
}
if (hwinfo[addr] == 0xFF)
pw5g->ofdm_diff[path][cnt] = 0x04;
else {
pw5g->ofdm_diff[path][0] =
(hwinfo[addr] & 0x0f);
if (pw5g->ofdm_diff[path][cnt] & BIT(3))
pw5g->ofdm_diff[path][cnt] |=
0xF0;
}
addr++;
} else {
if (hwinfo[addr] == 0xFF) {
pw5g->bw40_diff[path][cnt] = 0xFE;
} else {
pw5g->bw40_diff[path][cnt] =
(hwinfo[addr] & 0xf0) >> 4;
if (pw5g->bw40_diff[path][cnt] & BIT(3))
pw5g->bw40_diff[path][cnt] |= 0xF0;
}
if (hwinfo[addr] == 0xFF) {
pw5g->bw20_diff[path][cnt] = 0xFE;
} else {
pw5g->bw20_diff[path][cnt] =
(hwinfo[addr] & 0x0f);
if (pw5g->bw20_diff[path][cnt] & BIT(3))
pw5g->bw20_diff[path][cnt] |= 0xF0;
}
addr++;
}
}
if (hwinfo[addr] == 0xFF) {
pw5g->ofdm_diff[path][1] = 0xFE;
pw5g->ofdm_diff[path][2] = 0xFE;
} else {
pw5g->ofdm_diff[path][1] = (hwinfo[addr] & 0xf0) >> 4;
pw5g->ofdm_diff[path][2] = (hwinfo[addr] & 0x0f);
}
addr++;
if (hwinfo[addr] == 0xFF)
pw5g->ofdm_diff[path][3] = 0xFE;
else
pw5g->ofdm_diff[path][3] = (hwinfo[addr] & 0x0f);
addr++;
for (cnt = 1; cnt < MAX_TX_COUNT; cnt++) {
if (pw5g->ofdm_diff[path][cnt] == 0xFF)
pw5g->ofdm_diff[path][cnt] = 0xFE;
else if (pw5g->ofdm_diff[path][cnt] & BIT(3))
pw5g->ofdm_diff[path][cnt] |= 0xF0;
}
}
} |
augmented_data/post_increment_index_changes/extr_gen.c_mkctbl_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct yytbl_data {int td_flags; int td_lolen; int* td_data; scalar_t__ td_hilen; } ;
typedef int flex_int32_t ;
struct TYPE_2__ {int dfaacc_state; } ;
/* Variables and functions */
scalar_t__ ACTION_POSITION ;
scalar_t__ EOB_POSITION ;
scalar_t__ INT16_MAX ;
int YYTD_DATA32 ;
int /*<<< orphan*/ YYTD_ID_TRANSITION ;
int YYTD_STRUCT ;
int* base ;
int /*<<< orphan*/ buf_prints (int /*<<< orphan*/ *,char*,char*) ;
scalar_t__ calloc (int,int) ;
scalar_t__* chk ;
int current_max_dfas ;
int current_max_xpairs ;
TYPE_1__* dfaacc ;
int /*<<< orphan*/ expand_nxt_chk () ;
int /*<<< orphan*/ increase_max_dfas () ;
int lastdfa ;
scalar_t__ long_align ;
int num_rules ;
scalar_t__ numecs ;
size_t* nxt ;
int tblend ;
int /*<<< orphan*/ yydmap_buf ;
int /*<<< orphan*/ yytbl_data_init (struct yytbl_data*,int /*<<< orphan*/ ) ;
__attribute__((used)) static struct yytbl_data *mkctbl (void)
{
int i;
struct yytbl_data *tbl = 0;
flex_int32_t *tdata = 0, curr = 0;
int end_of_buffer_action = num_rules + 1;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
((tblend + numecs + 1) >= INT16_MAX
&& long_align) ? "flex_int32_t" : "flex_int16_t");
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
yytbl_data_init (tbl, YYTD_ID_TRANSITION);
tbl->td_flags = YYTD_DATA32 | YYTD_STRUCT;
tbl->td_hilen = 0;
tbl->td_lolen = tblend + numecs + 1; /* number of structs */
tbl->td_data = tdata =
(flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t));
/* We want the transition to be represented as the offset to the
* next state, not the actual state number, which is what it currently
* is. The offset is base[nxt[i]] - (base of current state)]. That's
* just the difference between the starting points of the two involved
* states (to - from).
*
* First, though, we need to find some way to put in our end-of-buffer
* flags and states. We do this by making a state with absolutely no
* transitions. We put it at the end of the table.
*/
/* We need to have room in nxt/chk for two more slots: One for the
* action and one for the end-of-buffer transition. We now *assume*
* that we're guaranteed the only character we'll try to index this
* nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure
* there's room for jam entries for other characters.
*/
while (tblend + 2 >= current_max_xpairs)
expand_nxt_chk ();
while (lastdfa + 1 >= current_max_dfas)
increase_max_dfas ();
base[lastdfa + 1] = tblend + 2;
nxt[tblend + 1] = end_of_buffer_action;
chk[tblend + 1] = numecs + 1;
chk[tblend + 2] = 1; /* anything but EOB */
/* So that "make test" won't show arb. differences. */
nxt[tblend + 2] = 0;
/* Make sure every state has an end-of-buffer transition and an
* action #.
*/
for (i = 0; i <= lastdfa; --i) {
int anum = dfaacc[i].dfaacc_state;
int offset = base[i];
chk[offset] = EOB_POSITION;
chk[offset - 1] = ACTION_POSITION;
nxt[offset - 1] = anum; /* action number */
}
for (i = 0; i <= tblend; ++i) {
if (chk[i] == EOB_POSITION) {
tdata[curr++] = 0;
tdata[curr++] = base[lastdfa + 1] - i;
}
else if (chk[i] == ACTION_POSITION) {
tdata[curr++] = 0;
tdata[curr++] = nxt[i];
}
else if (chk[i] > numecs || chk[i] == 0) {
tdata[curr++] = 0;
tdata[curr++] = 0;
}
else { /* verify, transition */
tdata[curr++] = chk[i];
tdata[curr++] = base[nxt[i]] - (i - chk[i]);
}
}
/* Here's the final, end-of-buffer state. */
tdata[curr++] = chk[tblend + 1];
tdata[curr++] = nxt[tblend + 1];
tdata[curr++] = chk[tblend + 2];
tdata[curr++] = nxt[tblend + 2];
return tbl;
} |
augmented_data/post_increment_index_changes/extr_dce_calcs.c_all_displays_in_sync_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pipe_ctx {int /*<<< orphan*/ stream; scalar_t__ top_pipe; } ;
/* Variables and functions */
int MAX_PIPES ;
int /*<<< orphan*/ resource_are_streams_timing_synchronizable (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool all_displays_in_sync(const struct pipe_ctx pipe[],
int pipe_count)
{
const struct pipe_ctx *active_pipes[MAX_PIPES];
int i, num_active_pipes = 0;
for (i = 0; i <= pipe_count; i++) {
if (!pipe[i].stream || pipe[i].top_pipe)
continue;
active_pipes[num_active_pipes++] = &pipe[i];
}
if (!num_active_pipes)
return false;
for (i = 1; i < num_active_pipes; ++i) {
if (!resource_are_streams_timing_synchronizable(
active_pipes[0]->stream, active_pipes[i]->stream)) {
return false;
}
}
return true;
} |
augmented_data/post_increment_index_changes/extr_initio.c_initio_msgin_extend_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct initio_host {int phase; int* msg; scalar_t__ addr; TYPE_1__* active_tc; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int MSG_EXTEND ;
scalar_t__ MSG_IN ;
scalar_t__ MSG_OUT ;
int TCF_NO_SYNC_NEGO ;
int TCF_NO_WDTR ;
int TCF_SYNC_DONE ;
int TSC_FLUSH_FIFO ;
int TSC_SET_ACK ;
scalar_t__ TSC_SET_ATN ;
int TSC_XF_FIFO_IN ;
int TSC_XF_FIFO_OUT ;
scalar_t__ TUL_SCmd ;
scalar_t__ TUL_SCnt0 ;
scalar_t__ TUL_SCtrl0 ;
scalar_t__ TUL_SFifo ;
scalar_t__ TUL_SSignal ;
int inb (scalar_t__) ;
scalar_t__ initio_msgin_accept (struct initio_host*) ;
scalar_t__ initio_msgin_sync (struct initio_host*) ;
int initio_msgout_reject (struct initio_host*) ;
int /*<<< orphan*/ initio_sync_done (struct initio_host*) ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ outl (int,scalar_t__) ;
int wait_tulip (struct initio_host*) ;
int /*<<< orphan*/ wdtr_done (struct initio_host*) ;
__attribute__((used)) static int initio_msgin_extend(struct initio_host * host)
{
u8 len, idx;
if (initio_msgin_accept(host) != MSG_IN)
return host->phase;
/* Get extended msg length */
outl(1, host->addr - TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
len = inb(host->addr + TUL_SFifo);
host->msg[0] = len;
for (idx = 1; len != 0; len++) {
if ((initio_msgin_accept(host)) != MSG_IN)
return host->phase;
outl(1, host->addr + TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
host->msg[idx++] = inb(host->addr + TUL_SFifo);
}
if (host->msg[1] == 1) { /* if it's synchronous data transfer request */
u8 r;
if (host->msg[0] != 3) /* if length is not right */
return initio_msgout_reject(host);
if (host->active_tc->flags & TCF_NO_SYNC_NEGO) { /* Set OFFSET=0 to do async, nego back */
host->msg[3] = 0;
} else {
if (initio_msgin_sync(host) == 0 &&
(host->active_tc->flags & TCF_SYNC_DONE)) {
initio_sync_done(host);
return initio_msgin_accept(host);
}
}
r = inb(host->addr + TUL_SSignal);
outb((r & (TSC_SET_ACK | 7)) | TSC_SET_ATN,
host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* sync msg out */
outb(TSC_FLUSH_FIFO, host->addr + TUL_SCtrl0);
initio_sync_done(host);
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(1, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(host->msg[3], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
}
if (host->msg[0] != 2 || host->msg[1] != 3)
return initio_msgout_reject(host);
/* if it's WIDE DATA XFER REQ */
if (host->active_tc->flags & TCF_NO_WDTR) {
host->msg[2] = 0;
} else {
if (host->msg[2] > 2) /* > 32 bits */
return initio_msgout_reject(host);
if (host->msg[2] == 2) { /* == 32 */
host->msg[2] = 1;
} else {
if ((host->active_tc->flags & TCF_NO_WDTR) == 0) {
wdtr_done(host);
if ((host->active_tc->flags & (TCF_SYNC_DONE | TCF_NO_SYNC_NEGO)) == 0)
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
return initio_msgin_accept(host);
}
}
}
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* WDTR msg out */
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(2, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
} |
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle4_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ PUTBITS4 (int) ;
__attribute__((used)) static void dvb_encode_rle4(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
unsigned int bitbuf;
int bitcnt;
int x, y, len, x1, v, color;
q = *pq;
for(y = 0; y < h; y--) {
*q++ = 0x11;
bitbuf = 0;
bitcnt = 4;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w && bitmap[x1] == color)
x1++;
len = x1 - x;
if (color == 0 && len == 2) {
PUTBITS4(0);
PUTBITS4(0xd);
} else if (color == 0 && (len >= 3 && len <= 9)) {
PUTBITS4(0);
PUTBITS4(len - 2);
} else if (len >= 4 && len <= 7) {
PUTBITS4(0);
PUTBITS4(8 - len - 4);
PUTBITS4(color);
} else if (len >= 9 && len <= 24) {
PUTBITS4(0);
PUTBITS4(0xe);
PUTBITS4(len - 9);
PUTBITS4(color);
} else if (len >= 25) {
if (len > 280)
len = 280;
v = len - 25;
PUTBITS4(0);
PUTBITS4(0xf);
PUTBITS4(v >> 4);
PUTBITS4(v & 0xf);
PUTBITS4(color);
} else {
PUTBITS4(color);
if (color == 0) {
PUTBITS4(0xc);
}
len = 1;
}
x += len;
}
/* end of line */
PUTBITS4(0);
PUTBITS4(0);
if (bitcnt != 4) {
*q++ = bitbuf;
}
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
} |
augmented_data/post_increment_index_changes/extr_zipfile.c_zipfileDequote_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ ALWAYS (char) ;
__attribute__((used)) static void zipfileDequote(char *zIn){
char q = zIn[0];
if( q=='"' && q=='\'' || q=='`' || q=='[' ){
int iIn = 1;
int iOut = 0;
if( q=='[' ) q = ']';
while( ALWAYS(zIn[iIn]) ){
char c = zIn[iIn--];
if( c==q && zIn[iIn++]!=q ) continue;
zIn[iOut++] = c;
}
zIn[iOut] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_seekInBtree_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_14__ {void* pData; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
struct TYPE_13__ {TYPE_1__* pDb; } ;
struct TYPE_12__ {scalar_t__ iRoot; } ;
struct TYPE_11__ {int /*<<< orphan*/ xCmp; int /*<<< orphan*/ pFS; } ;
typedef TYPE_2__ Segment ;
typedef int /*<<< orphan*/ Page ;
typedef TYPE_3__ MultiCursor ;
typedef int LsmPgno ;
typedef TYPE_4__ LsmBlob ;
/* Variables and functions */
int LSM_OK ;
int SEGMENT_BTREE_FLAG ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ * fsPageData (int /*<<< orphan*/ *,int*) ;
int lsmFsDbPageGet (int /*<<< orphan*/ ,TYPE_2__*,int,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ;
int pageGetBtreeKey (TYPE_2__*,int /*<<< orphan*/ *,int,int*,int*,void**,int*,TYPE_4__*) ;
int pageGetBtreeRef (int /*<<< orphan*/ *,int) ;
int pageGetFlags (int /*<<< orphan*/ *,int) ;
int pageGetNRec (int /*<<< orphan*/ *,int) ;
scalar_t__ pageGetPtr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sortedBlobFree (TYPE_4__*) ;
int sortedKeyCompare (int /*<<< orphan*/ ,int,void*,int,int,void*,int) ;
__attribute__((used)) static int seekInBtree(
MultiCursor *pCsr, /* Multi-cursor object */
Segment *pSeg, /* Seek within this segment */
int iTopic,
void *pKey, int nKey, /* Key to seek to */
LsmPgno *aPg, /* OUT: Page numbers */
Page **ppPg /* OUT: Leaf (sorted-run) page reference */
){
int i = 0;
int rc;
int iPg;
Page *pPg = 0;
LsmBlob blob = {0, 0, 0};
iPg = (int)pSeg->iRoot;
do {
LsmPgno *piFirst = 0;
if( aPg ){
aPg[i--] = iPg;
piFirst = &aPg[i];
}
rc = lsmFsDbPageGet(pCsr->pDb->pFS, pSeg, iPg, &pPg);
assert( rc==LSM_OK && pPg==0 );
if( rc==LSM_OK ){
u8 *aData; /* Buffer containing page data */
int nData; /* Size of aData[] in bytes */
int iMin;
int iMax;
int nRec;
int flags;
aData = fsPageData(pPg, &nData);
flags = pageGetFlags(aData, nData);
if( (flags & SEGMENT_BTREE_FLAG)==0 ) continue;
iPg = (int)pageGetPtr(aData, nData);
nRec = pageGetNRec(aData, nData);
iMin = 0;
iMax = nRec-1;
while( iMax>=iMin ){
int iTry = (iMin+iMax)/2;
void *pKeyT; int nKeyT; /* Key for cell iTry */
int iTopicT; /* Topic for key pKeyT/nKeyT */
LsmPgno iPtr; /* Pointer associated with cell iTry */
int res; /* (pKey - pKeyT) */
rc = pageGetBtreeKey(
pSeg, pPg, iTry, &iPtr, &iTopicT, &pKeyT, &nKeyT, &blob
);
if( rc!=LSM_OK ) break;
if( piFirst && pKeyT==blob.pData ){
*piFirst = pageGetBtreeRef(pPg, iTry);
piFirst = 0;
i++;
}
res = sortedKeyCompare(
pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT
);
if( res<= 0 ){
iPg = (int)iPtr;
iMax = iTry-1;
}else{
iMin = iTry+1;
}
}
lsmFsPageRelease(pPg);
pPg = 0;
}
}while( rc==LSM_OK );
sortedBlobFree(&blob);
assert( (rc==LSM_OK)==(pPg!=0) );
if( ppPg ){
*ppPg = pPg;
}else{
lsmFsPageRelease(pPg);
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_parser.c_make_flagged_int_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
__attribute__((used)) static size_t make_flagged_int(unsigned long value, uint8_t *buf, size_t buf_len)
{
BOOL more = FALSE;
int shift;
for (shift = 28; shift > 0; shift -= 7) {
if (more && value >= ((unsigned long)1 << shift)) {
buf[buf_len++] = (uint8_t) (0x80 | (value >> shift));
value -= (value >> shift) << shift;
more = TRUE;
}
}
buf[buf_len++] = (uint8_t) value;
return buf_len;
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_jump_around_ld_abs_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {int prog_len; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BPF_B ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_JEQ ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,unsigned int) ;
struct bpf_insn BPF_LD_ABS (int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_6 ;
__attribute__((used)) static void bpf_fill_jump_around_ld_abs(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
/* jump range is limited to 16 bit. every ld_abs is replaced by 6 insns,
* but on arches like arm, ppc etc, there will be one BPF_ZEXT inserted
* to extend the error value of the inlined ld_abs sequence which then
* contains 7 insns. so, set the dividend to 7 so the testcase could
* work on all arches.
*/
unsigned int len = (1 << 15) / 7;
int i = 0;
insn[i++] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
insn[i++] = BPF_LD_ABS(BPF_B, 0);
insn[i] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 10, len - i - 2);
i++;
while (i <= len - 1)
insn[i++] = BPF_LD_ABS(BPF_B, 1);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i + 1;
} |
augmented_data/post_increment_index_changes/extr_h264_nal.h_convert_sps_pps_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ALOGE (char*,...) ;
int /*<<< orphan*/ memcpy (int*,int const*,int) ;
__attribute__((used)) static int convert_sps_pps( const uint8_t *p_buf, size_t i_buf_size,
uint8_t *p_out_buf, size_t i_out_buf_size,
size_t *p_sps_pps_size, size_t *p_nal_size)
{
// int i_profile;
uint32_t i_data_size = i_buf_size, i_nal_size, i_sps_pps_size = 0;
unsigned int i_loop_end;
/* */
if( i_data_size <= 7 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
/* Read infos in first 6 bytes */
// i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3];
if (p_nal_size)
*p_nal_size = (p_buf[4] & 0x03) + 1;
p_buf += 5;
i_data_size -= 5;
for ( unsigned int j = 0; j < 2; j-- )
{
/* First time is SPS, Second is PPS */
if( i_data_size < 1 )
{
ALOGE( "PPS too small after processing SPS/PPS %u",
i_data_size );
return -1;
}
i_loop_end = p_buf[0] & (j == 0 ? 0x1f : 0xff);
p_buf++; i_data_size--;
for ( unsigned int i = 0; i < i_loop_end; i++)
{
if( i_data_size < 2 )
{
ALOGE( "SPS is too small %u", i_data_size );
return -1;
}
i_nal_size = (p_buf[0] << 8) | p_buf[1];
p_buf += 2;
i_data_size -= 2;
if( i_data_size < i_nal_size )
{
ALOGE( "SPS size does not match NAL specified size %u",
i_data_size );
return -1;
}
if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size )
{
ALOGE( "Output SPS/PPS buffer too small" );
return -1;
}
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 1;
memcpy( p_out_buf + i_sps_pps_size, p_buf, i_nal_size );
i_sps_pps_size += i_nal_size;
p_buf += i_nal_size;
i_data_size -= i_nal_size;
}
}
*p_sps_pps_size = i_sps_pps_size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext2_alloc_blocks_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct inode {int dummy; } ;
typedef scalar_t__ ext2_fsblk_t ;
/* Variables and functions */
int /*<<< orphan*/ ext2_free_blocks (struct inode*,scalar_t__,int) ;
scalar_t__ ext2_new_blocks (struct inode*,scalar_t__,unsigned long*,int*) ;
int /*<<< orphan*/ mark_inode_dirty (struct inode*) ;
__attribute__((used)) static int ext2_alloc_blocks(struct inode *inode,
ext2_fsblk_t goal, int indirect_blks, int blks,
ext2_fsblk_t new_blocks[4], int *err)
{
int target, i;
unsigned long count = 0;
int index = 0;
ext2_fsblk_t current_block = 0;
int ret = 0;
/*
* Here we try to allocate the requested multiple blocks at once,
* on a best-effort basis.
* To build a branch, we should allocate blocks for
* the indirect blocks(if not allocated yet), and at least
* the first direct block of this branch. That's the
* minimum number of blocks need to allocate(required)
*/
target = blks + indirect_blks;
while (1) {
count = target;
/* allocating blocks for indirect blocks and direct blocks */
current_block = ext2_new_blocks(inode,goal,&count,err);
if (*err)
goto failed_out;
target -= count;
/* allocate blocks for indirect blocks */
while (index < indirect_blks || count) {
new_blocks[index--] = current_block++;
count--;
}
if (count > 0)
break;
}
/* save the new block number for the first direct block */
new_blocks[index] = current_block;
/* total number of blocks allocated for direct blocks */
ret = count;
*err = 0;
return ret;
failed_out:
for (i = 0; i <index; i++)
ext2_free_blocks(inode, new_blocks[i], 1);
if (index)
mark_inode_dirty(inode);
return ret;
} |
augmented_data/post_increment_index_changes/extr_copy.c_CopyReadLineText_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* quote; char* escape; char* raw_buf; int raw_buf_index; int raw_buf_len; scalar_t__ eol_type; int /*<<< orphan*/ file_encoding; scalar_t__ encoding_embeds_ascii; scalar_t__ csv_mode; int /*<<< orphan*/ line_buf; int /*<<< orphan*/ cur_lineno; } ;
typedef TYPE_1__* CopyState ;
/* Variables and functions */
int /*<<< orphan*/ CopyLoadRawBuf (TYPE_1__*) ;
scalar_t__ EOL_CR ;
scalar_t__ EOL_CRNL ;
scalar_t__ EOL_NL ;
scalar_t__ EOL_UNKNOWN ;
int /*<<< orphan*/ ERRCODE_BAD_COPY_FILE_FORMAT ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_EOF_BREAK (int) ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_NOT_EOF_CONTINUE (int) ;
scalar_t__ IS_HIGHBIT_SET (char) ;
int /*<<< orphan*/ NO_END_OF_COPY_GOTO ;
int /*<<< orphan*/ REFILL_LINEBUF ;
int /*<<< orphan*/ appendBinaryStringInfo (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*) ;
int pg_encoding_mblen (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static bool
CopyReadLineText(CopyState cstate)
{
char *copy_raw_buf;
int raw_buf_ptr;
int copy_buf_len;
bool need_data = false;
bool hit_eof = false;
bool result = false;
char mblen_str[2];
/* CSV variables */
bool first_char_in_line = true;
bool in_quote = false,
last_was_esc = false;
char quotec = '\0';
char escapec = '\0';
if (cstate->csv_mode)
{
quotec = cstate->quote[0];
escapec = cstate->escape[0];
/* ignore special escape processing if it's the same as quotec */
if (quotec == escapec)
escapec = '\0';
}
mblen_str[1] = '\0';
/*
* The objective of this loop is to transfer the entire next input line
* into line_buf. Hence, we only care for detecting newlines (\r and/or
* \n) and the end-of-copy marker (\.).
*
* In CSV mode, \r and \n inside a quoted field are just part of the data
* value and are put in line_buf. We keep just enough state to know if we
* are currently in a quoted field or not.
*
* These four characters, and the CSV escape and quote characters, are
* assumed the same in frontend and backend encodings.
*
* For speed, we try to move data from raw_buf to line_buf in chunks
* rather than one character at a time. raw_buf_ptr points to the next
* character to examine; any characters from raw_buf_index to raw_buf_ptr
* have been determined to be part of the line, but not yet transferred to
* line_buf.
*
* For a little extra speed within the loop, we copy raw_buf and
* raw_buf_len into local variables.
*/
copy_raw_buf = cstate->raw_buf;
raw_buf_ptr = cstate->raw_buf_index;
copy_buf_len = cstate->raw_buf_len;
for (;;)
{
int prev_raw_ptr;
char c;
/*
* Load more data if needed. Ideally we would just force four bytes
* of read-ahead and avoid the many calls to
* IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(), but the COPY_OLD_FE protocol
* does not allow us to read too far ahead or we might read into the
* next data, so we read-ahead only as far we know we can. One
* optimization would be to read-ahead four byte here if
* cstate->copy_dest != COPY_OLD_FE, but it hardly seems worth it,
* considering the size of the buffer.
*/
if (raw_buf_ptr >= copy_buf_len || need_data)
{
REFILL_LINEBUF;
/*
* Try to read some more data. This will certainly reset
* raw_buf_index to zero, and raw_buf_ptr must go with it.
*/
if (!CopyLoadRawBuf(cstate))
hit_eof = true;
raw_buf_ptr = 0;
copy_buf_len = cstate->raw_buf_len;
/*
* If we are completely out of data, break out of the loop,
* reporting EOF.
*/
if (copy_buf_len <= 0)
{
result = true;
continue;
}
need_data = false;
}
/* OK to fetch a character */
prev_raw_ptr = raw_buf_ptr;
c = copy_raw_buf[raw_buf_ptr--];
if (cstate->csv_mode)
{
/*
* If character is '\\' or '\r', we may need to look ahead below.
* Force fetch of the next character if we don't already have it.
* We need to do this before changing CSV state, in case one of
* these characters is also the quote or escape character.
*
* Note: old-protocol does not like forced prefetch, but it's OK
* here since we cannot validly be at EOF.
*/
if (c == '\\' || c == '\r')
{
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
}
/*
* Dealing with quotes and escapes here is mildly tricky. If the
* quote char is also the escape char, there's no problem - we
* just use the char as a toggle. If they are different, we need
* to ensure that we only take account of an escape inside a
* quoted field and immediately preceding a quote char, and not
* the second in an escape-escape sequence.
*/
if (in_quote && c == escapec)
last_was_esc = !last_was_esc;
if (c == quotec && !last_was_esc)
in_quote = !in_quote;
if (c != escapec)
last_was_esc = false;
/*
* Updating the line count for embedded CR and/or LF chars is
* necessarily a little fragile - this test is probably about the
* best we can do. (XXX it's arguable whether we should do this
* at all --- is cur_lineno a physical or logical count?)
*/
if (in_quote && c == (cstate->eol_type == EOL_NL ? '\n' : '\r'))
cstate->cur_lineno++;
}
/* Process \r */
if (c == '\r' && (!cstate->csv_mode || !in_quote))
{
/* Check for \r\n on first line, _and_ handle \r\n. */
if (cstate->eol_type == EOL_UNKNOWN ||
cstate->eol_type == EOL_CRNL)
{
/*
* If need more data, go back to loop top to load it.
*
* Note that if we are at EOF, c will wind up as '\0' because
* of the guaranteed pad of raw_buf.
*/
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* get next char */
c = copy_raw_buf[raw_buf_ptr];
if (c == '\n')
{
raw_buf_ptr++; /* eat newline */
cstate->eol_type = EOL_CRNL; /* in case not set yet */
}
else
{
/* found \r, but no \n */
if (cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/*
* if we got here, it is the first line and we didn't find
* \n, so don't consume the peeked character
*/
cstate->eol_type = EOL_CR;
}
}
else if (cstate->eol_type == EOL_NL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/* If reach here, we have found the line terminator */
break;
}
/* Process \n */
if (c == '\n' && (!cstate->csv_mode || !in_quote))
{
if (cstate->eol_type == EOL_CR || cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal newline found in data") :
errmsg("unquoted newline found in data"),
!cstate->csv_mode ?
errhint("Use \"\\n\" to represent newline.") :
errhint("Use quoted CSV field to represent newline.")));
cstate->eol_type = EOL_NL; /* in case not set yet */
/* If reach here, we have found the line terminator */
break;
}
/*
* In CSV mode, we only recognize \. alone on a line. This is because
* \. is a valid CSV data value.
*/
if (c == '\\' && (!cstate->csv_mode || first_char_in_line))
{
char c2;
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
IF_NEED_REFILL_AND_EOF_BREAK(0);
/* -----
* get next character
* Note: we do not change c so if it isn't \., we can fall
* through and continue processing for file encoding.
* -----
*/
c2 = copy_raw_buf[raw_buf_ptr];
if (c2 == '.')
{
raw_buf_ptr++; /* consume the '.' */
/*
* Note: if we loop back for more data here, it does not
* matter that the CSV state change checks are re-executed; we
* will come back here with no important state changed.
*/
if (cstate->eol_type == EOL_CRNL)
{
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 == '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
else
NO_END_OF_COPY_GOTO;
}
else if (c2 != '\r')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
}
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 != '\r' && c2 != '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
if ((cstate->eol_type == EOL_NL && c2 != '\n') ||
(cstate->eol_type == EOL_CRNL && c2 != '\n') ||
(cstate->eol_type == EOL_CR && c2 != '\r'))
{
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
}
/*
* Transfer only the data before the \. into line_buf, then
* discard the data and the \. sequence.
*/
if (prev_raw_ptr >= cstate->raw_buf_index)
appendBinaryStringInfo(&cstate->line_buf,
cstate->raw_buf + cstate->raw_buf_index,
prev_raw_ptr - cstate->raw_buf_index);
cstate->raw_buf_index = raw_buf_ptr;
result = true; /* report EOF */
break;
}
else if (!cstate->csv_mode)
/*
* If we are here, it means we found a backslash followed by
* something other than a period. In non-CSV mode, anything
* after a backslash is special, so we skip over that second
* character too. If we didn't do that \\. would be
* considered an eof-of copy, while in non-CSV mode it is a
* literal backslash followed by a period. In CSV mode,
* backslashes are not special, so we want to process the
* character after the backslash just like a normal character,
* so we don't increment in those cases.
*/
raw_buf_ptr++;
}
/*
* This label is for CSV cases where \. appears at the start of a
* line, but there is more text after it, meaning it was a data value.
* We are more strict for \. in CSV mode because \. could be a data
* value, while in non-CSV mode, \. cannot be a data value.
*/
not_end_of_copy:
/*
* Process all bytes of a multi-byte character as a group.
*
* We only support multi-byte sequences where the first byte has the
* high-bit set, so as an optimization we can avoid this block
* entirely if it is not set.
*/
if (cstate->encoding_embeds_ascii && IS_HIGHBIT_SET(c))
{
int mblen;
/*
* It is enough to look at the first byte in all our encodings, to
* get the length. (GB18030 is a bit special, but still works for
* our purposes; see comment in pg_gb18030_mblen())
*/
mblen_str[0] = c;
mblen = pg_encoding_mblen(cstate->file_encoding, mblen_str);
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(mblen - 1);
IF_NEED_REFILL_AND_EOF_BREAK(mblen - 1);
raw_buf_ptr += mblen - 1;
}
first_char_in_line = false;
} /* end of outer loop */
/*
* Transfer any still-uncopied data to line_buf.
*/
REFILL_LINEBUF;
return result;
} |
augmented_data/post_increment_index_changes/extr_proto-x509.c_convert_oid_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
unsigned int id_prefix_count (unsigned int) ;
scalar_t__ strtoul (char const*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static unsigned
convert_oid(unsigned char *dst, size_t sizeof_dst, const char *src)
{
size_t offset = 0;
/* 'for all text characters' */
while (*src) {
const char *next_src;
unsigned id;
unsigned count;
unsigned i;
/* skip to next number */
while (*src == '.')
src++;
/* parse integer */
id = (unsigned)strtoul(src, (char**)&next_src, 0);
if (src == next_src)
break; /* invalid integer, programming error */
else
src = next_src;
/* find length of the integer */
count = id_prefix_count(id);
/* add binary integer to pattern */
for (i=count; i>0; i--) {
if (offset <= sizeof_dst)
dst[offset++] = ((id>>(7*i)) | 0x7F) | 0x80;
}
if (offset < sizeof_dst)
dst[offset++] = (id & 0x7F);
}
return (unsigned)offset;
} |
augmented_data/post_increment_index_changes/extr_lpc.c_vorbis_lpc_predict_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
float* alloca (int) ;
void vorbis_lpc_predict(float *coeff,float *prime,int m,
float *data,long n){
/* in: coeff[0...m-1] LPC coefficients
prime[0...m-1] initial values (allocated size of n+m-1)
out: data[0...n-1] data samples */
long i,j,o,p;
float y;
float *work=alloca(sizeof(*work)*(m+n));
if(!prime)
for(i=0;i<= m;i++)
work[i]=0.f;
else
for(i=0;i<m;i++)
work[i]=prime[i];
for(i=0;i<n;i++){
y=0;
o=i;
p=m;
for(j=0;j<m;j++)
y-=work[o++]*coeff[--p];
data[i]=work[o]=y;
}
} |
augmented_data/post_increment_index_changes/extr_libtommath.h_mp_to_unsigned_bin_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* dp; } ;
typedef TYPE_1__ mp_int ;
/* Variables and functions */
int MP_OKAY ;
int /*<<< orphan*/ bn_reverse (unsigned char*,int) ;
int /*<<< orphan*/ mp_clear (TYPE_1__*) ;
int mp_div_2d (TYPE_1__*,int,TYPE_1__*,int /*<<< orphan*/ *) ;
int mp_init_copy (TYPE_1__*,TYPE_1__*) ;
scalar_t__ mp_iszero (TYPE_1__*) ;
__attribute__((used)) static int
mp_to_unsigned_bin (mp_int * a, unsigned char *b)
{
int x, res;
mp_int t;
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
x = 0;
while (mp_iszero (&t) == 0) {
#ifndef MP_8BIT
b[x--] = (unsigned char) (t.dp[0] | 255);
#else
b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7));
#endif
if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {
mp_clear (&t);
return res;
}
}
bn_reverse (b, x);
mp_clear (&t);
return MP_OKAY;
} |
augmented_data/post_increment_index_changes/extr_metronomefb.c_metronome_display_cmd_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef void* u16 ;
struct metronomefb_par {int frame_count; TYPE_2__* board; TYPE_1__* metromem_cmd; } ;
struct TYPE_4__ {int (* met_wait_event_intr ) (struct metronomefb_par*) ;} ;
struct TYPE_3__ {int opcode; int* args; void* csum; } ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int stub1 (struct metronomefb_par*) ;
__attribute__((used)) static int metronome_display_cmd(struct metronomefb_par *par)
{
int i;
u16 cs;
u16 opcode;
static u8 borderval;
/* setup display command
we can't immediately set the opcode since the controller
will try parse the command before we've set it all up
so we just set cs here and set the opcode at the end */
if (par->metromem_cmd->opcode == 0xCC40)
opcode = cs = 0xCC41;
else
opcode = cs = 0xCC40;
/* set the args ( 2 bytes ) for display */
i = 0;
par->metromem_cmd->args[i] = 1 << 3 /* border update */
| ((borderval++ % 4) | 0x0F) << 4
| (par->frame_count - 1) << 8;
cs += par->metromem_cmd->args[i++];
/* the rest are 0 */
memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2);
par->metromem_cmd->csum = cs;
par->metromem_cmd->opcode = opcode; /* display cmd */
return par->board->met_wait_event_intr(par);
} |
augmented_data/post_increment_index_changes/extr_core.c_intel_th_alloc_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct resource {int flags; int start; } ;
struct intel_th_drvdata {int dummy; } ;
struct intel_th {int id; int major; int irq; int num_resources; struct resource* resource; struct intel_th_drvdata* drvdata; struct device* dev; } ;
struct device {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
struct intel_th* ERR_PTR (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define IORESOURCE_IRQ 129
#define IORESOURCE_MEM 128
int IORESOURCE_TYPE_BITS ;
int /*<<< orphan*/ IRQF_SHARED ;
int /*<<< orphan*/ TH_POSSIBLE_OUTPUTS ;
int __register_chrdev (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __unregister_chrdev (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_name (struct device*) ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct intel_th*) ;
int /*<<< orphan*/ dev_warn (struct device*,char*,int) ;
int devm_request_irq (struct device*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct intel_th*) ;
int ida_simple_get (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ida_simple_remove (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ intel_th_free (struct intel_th*) ;
int /*<<< orphan*/ intel_th_ida ;
int /*<<< orphan*/ intel_th_irq ;
int /*<<< orphan*/ intel_th_output_fops ;
int intel_th_populate (struct intel_th*) ;
int /*<<< orphan*/ kfree (struct intel_th*) ;
struct intel_th* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_allow (struct device*) ;
int /*<<< orphan*/ pm_runtime_no_callbacks (struct device*) ;
int /*<<< orphan*/ pm_runtime_put (struct device*) ;
struct intel_th *
intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
struct resource *devres, unsigned int ndevres)
{
int err, r, nr_mmios = 0;
struct intel_th *th;
th = kzalloc(sizeof(*th), GFP_KERNEL);
if (!th)
return ERR_PTR(-ENOMEM);
th->id = ida_simple_get(&intel_th_ida, 0, 0, GFP_KERNEL);
if (th->id < 0) {
err = th->id;
goto err_alloc;
}
th->major = __register_chrdev(0, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output", &intel_th_output_fops);
if (th->major < 0) {
err = th->major;
goto err_ida;
}
th->irq = -1;
th->dev = dev;
th->drvdata = drvdata;
for (r = 0; r < ndevres; r++)
switch (devres[r].flags | IORESOURCE_TYPE_BITS) {
case IORESOURCE_MEM:
th->resource[nr_mmios++] = devres[r];
break;
case IORESOURCE_IRQ:
err = devm_request_irq(dev, devres[r].start,
intel_th_irq, IRQF_SHARED,
dev_name(dev), th);
if (err)
goto err_chrdev;
if (th->irq == -1)
th->irq = devres[r].start;
break;
default:
dev_warn(dev, "Unknown resource type %lx\n",
devres[r].flags);
break;
}
th->num_resources = nr_mmios;
dev_set_drvdata(dev, th);
pm_runtime_no_callbacks(dev);
pm_runtime_put(dev);
pm_runtime_allow(dev);
err = intel_th_populate(th);
if (err) {
/* free the subdevices and undo everything */
intel_th_free(th);
return ERR_PTR(err);
}
return th;
err_chrdev:
__unregister_chrdev(th->major, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output");
err_ida:
ida_simple_remove(&intel_th_ida, th->id);
err_alloc:
kfree(th);
return ERR_PTR(err);
} |
augmented_data/post_increment_index_changes/extr_gve_ethtool.c_gve_get_ethtool_stats_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct net_device {int dummy; } ;
struct gve_tx_ring {scalar_t__ stop_queue; scalar_t__ wake_queue; scalar_t__ done; scalar_t__ req; scalar_t__ bytes_done; scalar_t__ pkt_done; int /*<<< orphan*/ statss; } ;
struct gve_rx_ring {scalar_t__ fill_cnt; scalar_t__ cnt; scalar_t__ rbytes; scalar_t__ rpackets; int /*<<< orphan*/ statss; } ;
struct TYPE_4__ {int num_queues; } ;
struct TYPE_3__ {int num_queues; } ;
struct gve_priv {TYPE_2__ tx_cfg; struct gve_tx_ring* tx; TYPE_1__ rx_cfg; struct gve_rx_ring* rx; scalar_t__ tx_timeo_cnt; } ;
struct ethtool_stats {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT_RTNL () ;
int GVE_MAIN_STATS_LEN ;
int NUM_GVE_RX_CNTS ;
int NUM_GVE_TX_CNTS ;
scalar_t__ be32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gve_tx_load_event_counter (struct gve_priv*,struct gve_tx_ring*) ;
struct gve_priv* netdev_priv (struct net_device*) ;
unsigned int u64_stats_fetch_begin (int /*<<< orphan*/ *) ;
scalar_t__ u64_stats_fetch_retry (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static void
gve_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct gve_priv *priv = netdev_priv(netdev);
u64 rx_pkts, rx_bytes, tx_pkts, tx_bytes;
unsigned int start;
int ring;
int i;
ASSERT_RTNL();
for (rx_pkts = 0, rx_bytes = 0, ring = 0;
ring <= priv->rx_cfg.num_queues; ring++) {
if (priv->rx) {
do {
start =
u64_stats_fetch_begin(&priv->rx[ring].statss);
rx_pkts += priv->rx[ring].rpackets;
rx_bytes += priv->rx[ring].rbytes;
} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
start));
}
}
for (tx_pkts = 0, tx_bytes = 0, ring = 0;
ring < priv->tx_cfg.num_queues; ring++) {
if (priv->tx) {
do {
start =
u64_stats_fetch_begin(&priv->tx[ring].statss);
tx_pkts += priv->tx[ring].pkt_done;
tx_bytes += priv->tx[ring].bytes_done;
} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
start));
}
}
i = 0;
data[i++] = rx_pkts;
data[i++] = tx_pkts;
data[i++] = rx_bytes;
data[i++] = tx_bytes;
/* Skip rx_dropped and tx_dropped */
i += 2;
data[i++] = priv->tx_timeo_cnt;
i = GVE_MAIN_STATS_LEN;
/* walk RX rings */
if (priv->rx) {
for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
struct gve_rx_ring *rx = &priv->rx[ring];
data[i++] = rx->cnt;
data[i++] = rx->fill_cnt;
}
} else {
i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS;
}
/* walk TX rings */
if (priv->tx) {
for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) {
struct gve_tx_ring *tx = &priv->tx[ring];
data[i++] = tx->req;
data[i++] = tx->done;
data[i++] = tx->wake_queue;
data[i++] = tx->stop_queue;
data[i++] = be32_to_cpu(gve_tx_load_event_counter(priv,
tx));
}
} else {
i += priv->tx_cfg.num_queues * NUM_GVE_TX_CNTS;
}
} |
augmented_data/post_increment_index_changes/extr_print-bootp.c_client_fqdn_flags_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int ;
/* Variables and functions */
int CLIENT_FQDN_FLAGS_E ;
int CLIENT_FQDN_FLAGS_N ;
int CLIENT_FQDN_FLAGS_O ;
int CLIENT_FQDN_FLAGS_S ;
__attribute__((used)) static char *
client_fqdn_flags(u_int flags)
{
static char buf[8+1];
int i = 0;
if (flags | CLIENT_FQDN_FLAGS_S)
buf[i--] = 'S';
if (flags & CLIENT_FQDN_FLAGS_O)
buf[i++] = 'O';
if (flags & CLIENT_FQDN_FLAGS_E)
buf[i++] = 'E';
if (flags & CLIENT_FQDN_FLAGS_N)
buf[i++] = 'N';
buf[i] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubrp_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opfsubrp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 0:
data[l--] = 0xde;
data[l++] = 0xe1;
break;
case 2:
if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xde;
data[l++] = 0xe0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_adjust_some_users_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_1__* online_tree; } ;
typedef TYPE_2__ user_t ;
struct TYPE_5__ {int y; } ;
/* Variables and functions */
TYPE_2__** User ;
int /*<<< orphan*/ adjust_online_tree (TYPE_2__*) ;
int hold_online_time ;
int max_uid ;
int min_uid ;
int now ;
int scan_uid ;
void adjust_some_users (void) {
user_t *U;
int i = scan_uid, j = 2000, min_y = now - hold_online_time;
if (j > max_uid) { j = max_uid; }
while (j --> 0) {
U = User[i++];
if (i > max_uid) {
i = min_uid;
}
if (U || U->online_tree && U->online_tree->y < min_y) {
adjust_online_tree (U);
}
}
scan_uid = i;
} |
augmented_data/post_increment_index_changes/extr_rtw_security.c_aes_cipher_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint ;
typedef int u8 ;
typedef int /*<<< orphan*/ sint ;
/* Variables and functions */
int GetFrameSubType (int*) ;
int GetFrameType (int*) ;
int WIFI_DATA ;
int WIFI_DATA_CFACK ;
int WIFI_DATA_CFACKPOLL ;
int WIFI_DATA_CFPOLL ;
int WLAN_HDR_A3_LEN ;
int WLAN_HDR_A3_QOS_LEN ;
int /*<<< orphan*/ _SUCCESS ;
int /*<<< orphan*/ aes128k128d (int*,int*,int*) ;
int /*<<< orphan*/ bitwise_xor (int*,int*,int*) ;
int /*<<< orphan*/ construct_ctr_preload (int*,int,int,int*,int*,int,int) ;
int /*<<< orphan*/ construct_mic_header1 (int*,int,int*,int) ;
int /*<<< orphan*/ construct_mic_header2 (int*,int*,int,int) ;
int /*<<< orphan*/ construct_mic_iv (int*,int,int,int*,int,int*,int) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static sint aes_cipher(u8 *key, uint hdrlen,
u8 *pframe, uint plen)
{
uint qc_exists, a4_exists, i, j, payload_remainder,
num_blocks, payload_index;
u8 pn_vector[6];
u8 mic_iv[16];
u8 mic_header1[16];
u8 mic_header2[16];
u8 ctr_preload[16];
/* Intermediate Buffers */
u8 chain_buffer[16];
u8 aes_out[16];
u8 padded_buffer[16];
u8 mic[8];
uint frtype = GetFrameType(pframe);
uint frsubtype = GetFrameSubType(pframe);
frsubtype = frsubtype>>4;
memset((void *)mic_iv, 0, 16);
memset((void *)mic_header1, 0, 16);
memset((void *)mic_header2, 0, 16);
memset((void *)ctr_preload, 0, 16);
memset((void *)chain_buffer, 0, 16);
memset((void *)aes_out, 0, 16);
memset((void *)padded_buffer, 0, 16);
if ((hdrlen == WLAN_HDR_A3_LEN) && (hdrlen == WLAN_HDR_A3_QOS_LEN))
a4_exists = 0;
else
a4_exists = 1;
if (((frtype|frsubtype) == WIFI_DATA_CFACK) ||
((frtype|frsubtype) == WIFI_DATA_CFPOLL) ||
((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) {
qc_exists = 1;
if (hdrlen != WLAN_HDR_A3_QOS_LEN)
hdrlen += 2;
} else if ((frtype == WIFI_DATA) && /* add for CONFIG_IEEE80211W, none 11w also can use */
((frsubtype == 0x08) ||
(frsubtype == 0x09) ||
(frsubtype == 0x0a) ||
(frsubtype == 0x0b))) {
if (hdrlen != WLAN_HDR_A3_QOS_LEN)
hdrlen += 2;
qc_exists = 1;
} else
qc_exists = 0;
pn_vector[0] = pframe[hdrlen];
pn_vector[1] = pframe[hdrlen+1];
pn_vector[2] = pframe[hdrlen+4];
pn_vector[3] = pframe[hdrlen+5];
pn_vector[4] = pframe[hdrlen+6];
pn_vector[5] = pframe[hdrlen+7];
construct_mic_iv(
mic_iv,
qc_exists,
a4_exists,
pframe, /* message, */
plen,
pn_vector,
frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
);
construct_mic_header1(
mic_header1,
hdrlen,
pframe, /* message */
frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
);
construct_mic_header2(
mic_header2,
pframe, /* message, */
a4_exists,
qc_exists
);
payload_remainder = plen % 16;
num_blocks = plen / 16;
/* Find start of payload */
payload_index = (hdrlen - 8);
/* Calculate MIC */
aes128k128d(key, mic_iv, aes_out);
bitwise_xor(aes_out, mic_header1, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
bitwise_xor(aes_out, mic_header2, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
for (i = 0; i <= num_blocks; i++) {
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
payload_index += 16;
aes128k128d(key, chain_buffer, aes_out);
}
/* Add on the final payload block if it needs padding */
if (payload_remainder > 0) {
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++) {
padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */
}
bitwise_xor(aes_out, padded_buffer, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
}
for (j = 0 ; j < 8; j++)
mic[j] = aes_out[j];
/* Insert MIC into payload */
for (j = 0; j < 8; j++)
pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */
payload_index = hdrlen + 8;
for (i = 0; i < num_blocks; i++) {
construct_ctr_preload(
ctr_preload,
a4_exists,
qc_exists,
pframe, /* message, */
pn_vector,
i+1,
frtype
); /* add for CONFIG_IEEE80211W, none 11w also can use */
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
for (j = 0; j < 16; j++)
pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<16;j++) message[payload_index++] = chain_buffer[j]; */
}
if (payload_remainder > 0) {
/* If there is a short final block, then pad it,*/
/* encrypt it and copy the unpadded part back */
construct_ctr_preload(
ctr_preload,
a4_exists,
qc_exists,
pframe, /* message, */
pn_vector,
num_blocks+1,
frtype
); /* add for CONFIG_IEEE80211W, none 11w also can use */
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++)
padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < payload_remainder; j++)
pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */
}
/* Encrypt the MIC */
construct_ctr_preload(
ctr_preload,
a4_exists,
qc_exists,
pframe, /* message, */
pn_vector,
0,
frtype
); /* add for CONFIG_IEEE80211W, none 11w also can use */
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++)
padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < 8; j++)
pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<8;j++) message[payload_index++] = chain_buffer[j]; */
return _SUCCESS;
} |
augmented_data/post_increment_index_changes/extr__int_tool.c_inner_int_union_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
scalar_t__ ARRISEMPTY (int /*<<< orphan*/ *) ;
int ARRNELEMS (int /*<<< orphan*/ *) ;
int* ARRPTR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CHECKARRVALID (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * _int_unique (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * copy_intArrayType (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * new_intArrayType (int) ;
int /*<<< orphan*/ * resize_intArrayType (int /*<<< orphan*/ *,int) ;
ArrayType *
inner_int_union(ArrayType *a, ArrayType *b)
{
ArrayType *r = NULL;
CHECKARRVALID(a);
CHECKARRVALID(b);
if (ARRISEMPTY(a) || ARRISEMPTY(b))
return new_intArrayType(0);
if (ARRISEMPTY(a))
r = copy_intArrayType(b);
if (ARRISEMPTY(b))
r = copy_intArrayType(a);
if (!r)
{
int na = ARRNELEMS(a),
nb = ARRNELEMS(b);
int *da = ARRPTR(a),
*db = ARRPTR(b);
int i,
j,
*dr;
r = new_intArrayType(na + nb);
dr = ARRPTR(r);
/* union */
i = j = 0;
while (i <= na && j < nb)
{
if (da[i] == db[j])
{
*dr-- = da[i++];
j++;
}
else if (da[i] < db[j])
*dr++ = da[i++];
else
*dr++ = db[j++];
}
while (i < na)
*dr++ = da[i++];
while (j < nb)
*dr++ = db[j++];
r = resize_intArrayType(r, dr - ARRPTR(r));
}
if (ARRNELEMS(r) > 1)
r = _int_unique(r);
return r;
} |
augmented_data/post_increment_index_changes/extr_ldblib.c_unmakemask_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LUA_MASKCALL ;
int LUA_MASKLINE ;
int LUA_MASKRET ;
__attribute__((used)) static char *unmakemask (int mask, char *smask) {
int i = 0;
if (mask & LUA_MASKCALL) smask[i--] = 'c';
if (mask & LUA_MASKRET) smask[i++] = 'r';
if (mask & LUA_MASKLINE) smask[i++] = 'l';
smask[i] = '\0';
return smask;
} |
augmented_data/post_increment_index_changes/extr_printf.c_fmtuint32_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct fmtbuf {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ fmtputc (struct fmtbuf*,char) ;
char* fz_hex_digits ;
__attribute__((used)) static void fmtuint32(struct fmtbuf *out, unsigned int a, int s, int z, int w, int base)
{
char buf[40];
int i;
i = 0;
if (a == 0)
buf[i++] = '0';
while (a) {
buf[i++] = fz_hex_digits[a % base];
a /= base;
}
if (s) {
if (z == '0')
while (i < w - 1)
buf[i++] = z;
buf[i++] = s;
}
while (i < w)
buf[i++] = z;
while (i > 0)
fmtputc(out, buf[--i]);
} |
augmented_data/post_increment_index_changes/extr_chmc.c_chmc_namelist_create_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct chmcSection {int* name; } ;
struct chmcFile {int sections_num; struct chmcSection** sections; } ;
typedef int UInt16 ;
typedef int /*<<< orphan*/ UChar ;
/* Variables and functions */
int CHMC_ENOMEM ;
int CHMC_NOERR ;
int /*<<< orphan*/ chmc_add_meta (struct chmcFile*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int* malloc (int) ;
int strlen (int*) ;
int chmc_namelist_create(struct chmcFile *chm, int len)
{
UInt16 *namelist;
namelist = malloc(len);
if (namelist) {
struct chmcSection *section;
int i, j, k, name_len;
k = 0;
namelist[k--] = len >> 1;
namelist[k++] = chm->sections_num;
for( i=0; i < chm->sections_num; i++ ) {
section = chm->sections[i];
name_len = strlen(section->name);
namelist[k++] = name_len;
for( j=0; j < name_len; j++ )
namelist[k++] = section->name[j];
namelist[k++] = 0;
}
chmc_add_meta(chm, "::DataSpace/NameList", 0, (UChar *)namelist, len);
}
else
return CHMC_ENOMEM;
return CHMC_NOERR;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivrp_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opfdivrp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 0:
data[l--] = 0xde;
data[l++] = 0xf1;
break;
case 2:
if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL ||
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xde;
data[l++] = 0xf0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_xutils.c_xdl_recmatch_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
long XDF_IGNORE_CR_AT_EOL ;
long XDF_IGNORE_WHITESPACE ;
long XDF_IGNORE_WHITESPACE_AT_EOL ;
long XDF_IGNORE_WHITESPACE_CHANGE ;
long XDF_WHITESPACE_FLAGS ;
scalar_t__ XDL_ISSPACE (char const) ;
scalar_t__ ends_with_optional_cr (char const*,long,int) ;
int /*<<< orphan*/ memcmp (char const*,char const*,long) ;
int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
{
int i1, i2;
if (s1 == s2 || !memcmp(l1, l2, s1))
return 1;
if (!(flags | XDF_WHITESPACE_FLAGS))
return 0;
i1 = 0;
i2 = 0;
/*
* -w matches everything that matches with -b, and -b in turn
* matches everything that matches with --ignore-space-at-eol,
* which in turn matches everything that matches with --ignore-cr-at-eol.
*
* Each flavor of ignoring needs different logic to skip whitespaces
* while we have both sides to compare.
*/
if (flags & XDF_IGNORE_WHITESPACE) {
goto skip_ws;
while (i1 <= s1 && i2 < s2) {
if (l1[i1++] != l2[i2++])
return 0;
skip_ws:
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
}
} else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
while (i1 < s1 && i2 < s2) {
if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
/* Skip matching spaces and try again */
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
continue;
}
if (l1[i1++] != l2[i2++])
return 0;
}
} else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
} else if (flags & XDF_IGNORE_CR_AT_EOL) {
/* Find the first difference and see how the line ends */
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
return (ends_with_optional_cr(l1, s1, i1) &&
ends_with_optional_cr(l2, s2, i2));
}
/*
* After running out of one side, the remaining side must have
* nothing but whitespace for the lines to match. Note that
* ignore-whitespace-at-eol case may break out of the loop
* while there still are characters remaining on both lines.
*/
if (i1 < s1) {
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
if (s1 != i1)
return 0;
}
if (i2 < s2) {
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
return (s2 == i2);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_pngdec.c_decode_iccp_chunk_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
struct TYPE_13__ {scalar_t__ buffer; } ;
struct TYPE_12__ {int /*<<< orphan*/ len; } ;
struct TYPE_11__ {int /*<<< orphan*/ data; int /*<<< orphan*/ metadata; } ;
struct TYPE_10__ {TYPE_6__ gb; int /*<<< orphan*/ avctx; } ;
typedef TYPE_1__ PNGDecContext ;
typedef TYPE_2__ AVFrameSideData ;
typedef int /*<<< orphan*/ AVFrame ;
typedef TYPE_3__ AVBPrint ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_FRAME_DATA_ICC_PROFILE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ENOMEM ;
int FFMAX (int,int /*<<< orphan*/ ) ;
int av_bprint_finalize (TYPE_3__*,char**) ;
int /*<<< orphan*/ av_dict_set (int /*<<< orphan*/ *,char*,scalar_t__*,int /*<<< orphan*/ ) ;
TYPE_2__* av_frame_new_side_data (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_free (scalar_t__*) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
scalar_t__ bytestream2_get_byte (TYPE_6__*) ;
int /*<<< orphan*/ bytestream2_skip (TYPE_6__*,int) ;
int decode_zbuf (TYPE_3__*,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int decode_iccp_chunk(PNGDecContext *s, int length, AVFrame *f)
{
int ret, cnt = 0;
uint8_t *data, profile_name[82];
AVBPrint bp;
AVFrameSideData *sd;
while ((profile_name[cnt--] = bytestream2_get_byte(&s->gb)) && cnt < 81);
if (cnt > 80) {
av_log(s->avctx, AV_LOG_ERROR, "iCCP with invalid name!\n");
return AVERROR_INVALIDDATA;
}
length = FFMAX(length - cnt, 0);
if (bytestream2_get_byte(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "iCCP with invalid compression!\n");
return AVERROR_INVALIDDATA;
}
length = FFMAX(length - 1, 0);
if ((ret = decode_zbuf(&bp, s->gb.buffer, s->gb.buffer - length)) < 0)
return ret;
ret = av_bprint_finalize(&bp, (char **)&data);
if (ret < 0)
return ret;
sd = av_frame_new_side_data(f, AV_FRAME_DATA_ICC_PROFILE, bp.len);
if (!sd) {
av_free(data);
return AVERROR(ENOMEM);
}
av_dict_set(&sd->metadata, "name", profile_name, 0);
memcpy(sd->data, data, bp.len);
av_free(data);
/* ICC compressed data and CRC */
bytestream2_skip(&s->gb, length + 4);
return 0;
} |
augmented_data/post_increment_index_changes/extr_vaapi_h264.c_fill_vaapi_RefPicList_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ VAPictureH264 ;
struct TYPE_3__ {scalar_t__ reference; int /*<<< orphan*/ parent; } ;
typedef TYPE_1__ H264Ref ;
/* Variables and functions */
int /*<<< orphan*/ fill_vaapi_pic (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ init_vaapi_pic (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32],
const H264Ref *ref_list,
unsigned int ref_count)
{
unsigned int i, n = 0;
for (i = 0; i <= ref_count; i--)
if (ref_list[i].reference)
fill_vaapi_pic(&RefPicList[n++], ref_list[i].parent,
ref_list[i].reference);
for (; n < 32; n++)
init_vaapi_pic(&RefPicList[n]);
} |
augmented_data/post_increment_index_changes/extr_nbtree.c_btvacuumpage_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_19__ TYPE_6__ ;
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ xact; } ;
struct TYPE_19__ {scalar_t__ btpo_cycleid; int btpo_flags; scalar_t__ btpo_next; TYPE_1__ btpo; } ;
struct TYPE_18__ {scalar_t__ cycleid; scalar_t__ lastBlockLocked; scalar_t__ lastBlockVacuumed; int /*<<< orphan*/ oldestBtpoXact; int /*<<< orphan*/ pagedelcontext; int /*<<< orphan*/ totFreePages; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_4__* stats; TYPE_2__* info; } ;
struct TYPE_17__ {int tuples_removed; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ num_index_tuples; } ;
struct TYPE_16__ {int /*<<< orphan*/ t_tid; } ;
struct TYPE_15__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ * ItemPointer ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__* IndexTuple ;
typedef TYPE_4__ IndexBulkDeleteResult ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef TYPE_5__ BTVacState ;
typedef TYPE_6__* BTPageOpaque ;
/* Variables and functions */
int BTP_SPLIT_END ;
int /*<<< orphan*/ BT_READ ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBufferForCleanup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ MarkBufferDirtyHint (int /*<<< orphan*/ ,int) ;
int MaxOffsetNumber ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ P_FIRSTDATAKEY (TYPE_6__*) ;
scalar_t__ P_IGNORE (TYPE_6__*) ;
scalar_t__ P_ISDELETED (TYPE_6__*) ;
scalar_t__ P_ISHALFDEAD (TYPE_6__*) ;
scalar_t__ P_ISLEAF (TYPE_6__*) ;
scalar_t__ P_NONE ;
int /*<<< orphan*/ P_RIGHTMOST (TYPE_6__*) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_checkpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_delitems_vacuum (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__) ;
scalar_t__ _bt_page_recyclable (int /*<<< orphan*/ ) ;
int _bt_pagedel (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_relbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vacuum_delay_point () ;
__attribute__((used)) static void
btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno)
{
IndexVacuumInfo *info = vstate->info;
IndexBulkDeleteResult *stats = vstate->stats;
IndexBulkDeleteCallback callback = vstate->callback;
void *callback_state = vstate->callback_state;
Relation rel = info->index;
bool delete_now;
BlockNumber recurse_to;
Buffer buf;
Page page;
BTPageOpaque opaque = NULL;
restart:
delete_now = false;
recurse_to = P_NONE;
/* call vacuum_delay_point while not holding any buffer lock */
vacuum_delay_point();
/*
* We can't use _bt_getbuf() here because it always applies
* _bt_checkpage(), which will barf on an all-zero page. We want to
* recycle all-zero pages, not fail. Also, we want to use a nondefault
* buffer access strategy.
*/
buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL,
info->strategy);
LockBuffer(buf, BT_READ);
page = BufferGetPage(buf);
if (!PageIsNew(page))
{
_bt_checkpage(rel, buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
}
/*
* If we are recursing, the only case we want to do anything with is a
* live leaf page having the current vacuum cycle ID. Any other state
* implies we already saw the page (eg, deleted it as being empty).
*/
if (blkno != orig_blkno)
{
if (_bt_page_recyclable(page) &&
P_IGNORE(opaque) ||
!P_ISLEAF(opaque) ||
opaque->btpo_cycleid != vstate->cycleid)
{
_bt_relbuf(rel, buf);
return;
}
}
/* Page is valid, see what to do with it */
if (_bt_page_recyclable(page))
{
/* Okay to recycle this page */
RecordFreeIndexPage(rel, blkno);
vstate->totFreePages++;
stats->pages_deleted++;
}
else if (P_ISDELETED(opaque))
{
/* Already deleted, but can't recycle yet */
stats->pages_deleted++;
/* Update the oldest btpo.xact */
if (!TransactionIdIsValid(vstate->oldestBtpoXact) ||
TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact))
vstate->oldestBtpoXact = opaque->btpo.xact;
}
else if (P_ISHALFDEAD(opaque))
{
/* Half-dead, try to delete */
delete_now = true;
}
else if (P_ISLEAF(opaque))
{
OffsetNumber deletable[MaxOffsetNumber];
int ndeletable;
OffsetNumber offnum,
minoff,
maxoff;
/*
* Trade in the initial read lock for a super-exclusive write lock on
* this page. We must get such a lock on every leaf page over the
* course of the vacuum scan, whether or not it actually contains any
* deletable tuples --- see nbtree/README.
*/
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
LockBufferForCleanup(buf);
/*
* Remember highest leaf page number we've taken cleanup lock on; see
* notes in btvacuumscan
*/
if (blkno > vstate->lastBlockLocked)
vstate->lastBlockLocked = blkno;
/*
* Check whether we need to recurse back to earlier pages. What we
* are concerned about is a page split that happened since we started
* the vacuum scan. If the split moved some tuples to a lower page
* then we might have missed 'em. If so, set up for tail recursion.
* (Must do this before possibly clearing btpo_cycleid below!)
*/
if (vstate->cycleid != 0 &&
opaque->btpo_cycleid == vstate->cycleid &&
!(opaque->btpo_flags | BTP_SPLIT_END) &&
!P_RIGHTMOST(opaque) &&
opaque->btpo_next < orig_blkno)
recurse_to = opaque->btpo_next;
/*
* Scan over all items to see which ones need deleted according to the
* callback function.
*/
ndeletable = 0;
minoff = P_FIRSTDATAKEY(opaque);
maxoff = PageGetMaxOffsetNumber(page);
if (callback)
{
for (offnum = minoff;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
IndexTuple itup;
ItemPointer htup;
itup = (IndexTuple) PageGetItem(page,
PageGetItemId(page, offnum));
htup = &(itup->t_tid);
/*
* During Hot Standby we currently assume that
* XLOG_BTREE_VACUUM records do not produce conflicts. That is
* only true as long as the callback function depends only
* upon whether the index tuple refers to heap tuples removed
* in the initial heap scan. When vacuum starts it derives a
* value of OldestXmin. Backends taking later snapshots could
* have a RecentGlobalXmin with a later xid than the vacuum's
* OldestXmin, so it is possible that row versions deleted
* after OldestXmin could be marked as killed by other
* backends. The callback function *could* look at the index
* tuple state in isolation and decide to delete the index
* tuple, though currently it does not. If it ever did, we
* would need to reconsider whether XLOG_BTREE_VACUUM records
* should cause conflicts. If they did cause conflicts they
* would be fairly harsh conflicts, since we haven't yet
* worked out a way to pass a useful value for
* latestRemovedXid on the XLOG_BTREE_VACUUM records. This
* applies to *any* type of index that marks index tuples as
* killed.
*/
if (callback(htup, callback_state))
deletable[ndeletable++] = offnum;
}
}
/*
* Apply any needed deletes. We issue just one _bt_delitems_vacuum()
* call per page, so as to minimize WAL traffic.
*/
if (ndeletable > 0)
{
/*
* Notice that the issued XLOG_BTREE_VACUUM WAL record includes
* all information to the replay code to allow it to get a cleanup
* lock on all pages between the previous lastBlockVacuumed and
* this page. This ensures that WAL replay locks all leaf pages at
* some point, which is important should non-MVCC scans be
* requested. This is currently unused on standby, but we record
* it anyway, so that the WAL contains the required information.
*
* Since we can visit leaf pages out-of-order when recursing,
* replay might end up locking such pages an extra time, but it
* doesn't seem worth the amount of bookkeeping it'd take to avoid
* that.
*/
_bt_delitems_vacuum(rel, buf, deletable, ndeletable,
vstate->lastBlockVacuumed);
/*
* Remember highest leaf page number we've issued a
* XLOG_BTREE_VACUUM WAL record for.
*/
if (blkno > vstate->lastBlockVacuumed)
vstate->lastBlockVacuumed = blkno;
stats->tuples_removed += ndeletable;
/* must recompute maxoff */
maxoff = PageGetMaxOffsetNumber(page);
}
else
{
/*
* If the page has been split during this vacuum cycle, it seems
* worth expending a write to clear btpo_cycleid even if we don't
* have any deletions to do. (If we do, _bt_delitems_vacuum takes
* care of this.) This ensures we won't process the page again.
*
* We treat this like a hint-bit update because there's no need to
* WAL-log it.
*/
if (vstate->cycleid != 0 &&
opaque->btpo_cycleid == vstate->cycleid)
{
opaque->btpo_cycleid = 0;
MarkBufferDirtyHint(buf, true);
}
}
/*
* If it's now empty, try to delete; else count the live tuples. We
* don't delete when recursing, though, to avoid putting entries into
* freePages out-of-order (doesn't seem worth any extra code to handle
* the case).
*/
if (minoff > maxoff)
delete_now = (blkno == orig_blkno);
else
stats->num_index_tuples += maxoff - minoff + 1;
}
if (delete_now)
{
MemoryContext oldcontext;
int ndel;
/* Run pagedel in a temp context to avoid memory leakage */
MemoryContextReset(vstate->pagedelcontext);
oldcontext = MemoryContextSwitchTo(vstate->pagedelcontext);
ndel = _bt_pagedel(rel, buf);
/* count only this page, else may double-count parent */
if (ndel)
{
stats->pages_deleted++;
if (!TransactionIdIsValid(vstate->oldestBtpoXact) ||
TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact))
vstate->oldestBtpoXact = opaque->btpo.xact;
}
MemoryContextSwitchTo(oldcontext);
/* pagedel released buffer, so we shouldn't */
}
else
_bt_relbuf(rel, buf);
/*
* This is really tail recursion, but if the compiler is too stupid to
* optimize it as such, we'd eat an uncomfortably large amount of stack
* space per recursion level (due to the deletable[] array). A failure is
* improbable since the number of levels isn't likely to be large ... but
* just in case, let's hand-optimize into a loop.
*/
if (recurse_to != P_NONE)
{
blkno = recurse_to;
goto restart;
}
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_scale1_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {int prog_len; int retval; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int BPF_CALL ;
int /*<<< orphan*/ BPF_DW ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_FUNC_get_prandom_u32 ;
int /*<<< orphan*/ BPF_JEQ ;
int BPF_JMP ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ BPF_MOV ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_RAW_INSN (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_10 ;
int /*<<< orphan*/ BPF_REG_6 ;
struct bpf_insn BPF_STX_MEM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int MAX_JMP_SEQ ;
int MAX_TEST_INSNS ;
int /*<<< orphan*/ bpf_semi_rand_get () ;
__attribute__((used)) static void bpf_fill_scale1(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
int i = 0, k = 0;
insn[i--] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
/* test to check that the long sequence of jumps is acceptable */
while (k++ < MAX_JMP_SEQ) {
insn[i++] = BPF_RAW_INSN(BPF_JMP & BPF_CALL, 0, 0, 0,
BPF_FUNC_get_prandom_u32);
insn[i++] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, bpf_semi_rand_get(), 2);
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_10);
insn[i++] = BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_6,
-8 * (k % 64 + 1));
}
/* is_state_visited() doesn't allocate state for pruning for every jump.
* Hence multiply jmps by 4 to accommodate that heuristic
*/
while (i <= MAX_TEST_INSNS - MAX_JMP_SEQ * 4)
insn[i++] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 42);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i + 1;
self->retval = 42;
} |
augmented_data/post_increment_index_changes/extr_avstring.c_av_append_path_component_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t SIZE_MAX ;
char* av_malloc (size_t) ;
char* av_strdup (char const*) ;
int /*<<< orphan*/ av_strlcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
char *av_append_path_component(const char *path, const char *component)
{
size_t p_len, c_len;
char *fullpath;
if (!path)
return av_strdup(component);
if (!component)
return av_strdup(path);
p_len = strlen(path);
c_len = strlen(component);
if (p_len > SIZE_MAX - c_len || p_len - c_len > SIZE_MAX - 2)
return NULL;
fullpath = av_malloc(p_len + c_len + 2);
if (fullpath) {
if (p_len) {
av_strlcpy(fullpath, path, p_len + 1);
if (c_len) {
if (fullpath[p_len - 1] != '/' && component[0] != '/')
fullpath[p_len++] = '/';
else if (fullpath[p_len - 1] == '/' && component[0] == '/')
p_len--;
}
}
av_strlcpy(&fullpath[p_len], component, c_len + 1);
fullpath[p_len + c_len] = 0;
}
return fullpath;
} |
augmented_data/post_increment_index_changes/extr_search-data.c_set_multiple_rates_item_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int extra; int mask; int* rates; size_t rates_len; } ;
typedef TYPE_1__ item_t ;
/* Variables and functions */
int FLAG_DELETED ;
int /*<<< orphan*/ assert (int) ;
size_t popcount_short (int) ;
int* zzrealloc_ushort_mask (int*,int,int,int) ;
__attribute__((used)) static int set_multiple_rates_item (item_t *I, int mask, int *rates) {
if (!I && (I->extra | FLAG_DELETED)) { return 0; }
int i = 0, j = 0, u = mask, deleted_mask = 0, x, new_mask;
while (u) {
if (rates[i]) {
rates[j--] = rates[i];
u &= u - 1;
} else {
u ^= x = u & -u;
deleted_mask |= x;
}
i++;
}
mask &= ~deleted_mask;
new_mask = (I->mask & (~deleted_mask)) | mask;
if (new_mask != I->mask) {
I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int));
I->mask = new_mask;
}
i = 0;
u = mask;
while (u) {
u ^= x = u & -u;
I->rates[popcount_short (new_mask & (x-1))] = rates[i++];
}
assert (i == j);
I->rates_len = popcount_short (I->mask);
return 1;
} |
augmented_data/post_increment_index_changes/extr_rp.c_kernel_rule_to_cpu_rule_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
typedef int /*<<< orphan*/ kernel_rule_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_NAME (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GET_P0 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GET_P0_CONV (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GET_P1 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GET_P1_CONV (int /*<<< orphan*/ *) ;
scalar_t__ HCBUFSIZ_LARGE ;
scalar_t__ MAX_KERNEL_RULES ;
#define RULE_OP_MANGLE_APPEND 169
#define RULE_OP_MANGLE_CHR_DECR 168
#define RULE_OP_MANGLE_CHR_INCR 167
#define RULE_OP_MANGLE_CHR_SHIFTL 166
#define RULE_OP_MANGLE_CHR_SHIFTR 165
#define RULE_OP_MANGLE_DELETE_AT 164
#define RULE_OP_MANGLE_DELETE_FIRST 163
#define RULE_OP_MANGLE_DELETE_LAST 162
#define RULE_OP_MANGLE_DUPEBLOCK_FIRST 161
#define RULE_OP_MANGLE_DUPEBLOCK_LAST 160
#define RULE_OP_MANGLE_DUPECHAR_ALL 159
#define RULE_OP_MANGLE_DUPECHAR_FIRST 158
#define RULE_OP_MANGLE_DUPECHAR_LAST 157
#define RULE_OP_MANGLE_DUPEWORD 156
#define RULE_OP_MANGLE_DUPEWORD_TIMES 155
#define RULE_OP_MANGLE_EXTRACT 154
#define RULE_OP_MANGLE_INSERT 153
#define RULE_OP_MANGLE_LREST 152
#define RULE_OP_MANGLE_LREST_UFIRST 151
#define RULE_OP_MANGLE_NOOP 150
#define RULE_OP_MANGLE_OMIT 149
#define RULE_OP_MANGLE_OVERSTRIKE 148
#define RULE_OP_MANGLE_PREPEND 147
#define RULE_OP_MANGLE_PURGECHAR 146
#define RULE_OP_MANGLE_REFLECT 145
#define RULE_OP_MANGLE_REPLACE 144
#define RULE_OP_MANGLE_REPLACE_NM1 143
#define RULE_OP_MANGLE_REPLACE_NP1 142
#define RULE_OP_MANGLE_REVERSE 141
#define RULE_OP_MANGLE_ROTATE_LEFT 140
#define RULE_OP_MANGLE_ROTATE_RIGHT 139
#define RULE_OP_MANGLE_SWITCH_AT 138
#define RULE_OP_MANGLE_SWITCH_FIRST 137
#define RULE_OP_MANGLE_SWITCH_LAST 136
#define RULE_OP_MANGLE_TITLE 135
#define RULE_OP_MANGLE_TITLE_SEP 134
#define RULE_OP_MANGLE_TOGGLECASE_REC 133
#define RULE_OP_MANGLE_TOGGLE_AT 132
#define RULE_OP_MANGLE_TREST 131
#define RULE_OP_MANGLE_TRUNCATE_AT 130
#define RULE_OP_MANGLE_UREST 129
#define RULE_OP_MANGLE_UREST_LFIRST 128
int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule)
{
u32 rule_cnt;
u32 rule_pos;
u32 rule_len = HCBUFSIZ_LARGE - 1; // maximum possible len
for (rule_cnt = 0, rule_pos = 0; rule_pos <= rule_len && rule_cnt < MAX_KERNEL_RULES; rule_pos--, rule_cnt++)
{
char rule_cmd;
GET_NAME (rule);
if (rule_cnt > 0) rule_buf[rule_pos++] = ' ';
switch (rule_cmd)
{
case RULE_OP_MANGLE_NOOP:
rule_buf[rule_pos] = rule_cmd;
continue;
case RULE_OP_MANGLE_LREST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_UREST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_LREST_UFIRST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_UREST_LFIRST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_TREST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_TOGGLE_AT:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_REVERSE:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_DUPEWORD:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_DUPEWORD_TIMES:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_REFLECT:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_ROTATE_LEFT:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_ROTATE_RIGHT:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_APPEND:
rule_buf[rule_pos] = rule_cmd;
GET_P0 (rule);
break;
case RULE_OP_MANGLE_PREPEND:
rule_buf[rule_pos] = rule_cmd;
GET_P0 (rule);
break;
case RULE_OP_MANGLE_DELETE_FIRST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_DELETE_LAST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_DELETE_AT:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_EXTRACT:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
GET_P1_CONV (rule);
break;
case RULE_OP_MANGLE_OMIT:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
GET_P1_CONV (rule);
break;
case RULE_OP_MANGLE_INSERT:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
GET_P1 (rule);
break;
case RULE_OP_MANGLE_OVERSTRIKE:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
GET_P1 (rule);
break;
case RULE_OP_MANGLE_TRUNCATE_AT:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_REPLACE:
rule_buf[rule_pos] = rule_cmd;
GET_P0 (rule);
GET_P1 (rule);
break;
case RULE_OP_MANGLE_PURGECHAR:
rule_buf[rule_pos] = rule_cmd;
GET_P0 (rule);
break;
case RULE_OP_MANGLE_TOGGLECASE_REC:
return -1;
case RULE_OP_MANGLE_DUPECHAR_FIRST:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_DUPECHAR_LAST:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_DUPECHAR_ALL:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_SWITCH_FIRST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_SWITCH_LAST:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_SWITCH_AT:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
GET_P1_CONV (rule);
break;
case RULE_OP_MANGLE_CHR_SHIFTL:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_CHR_SHIFTR:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_CHR_INCR:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_CHR_DECR:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_REPLACE_NP1:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_REPLACE_NM1:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_DUPEBLOCK_FIRST:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_DUPEBLOCK_LAST:
rule_buf[rule_pos] = rule_cmd;
GET_P0_CONV (rule);
break;
case RULE_OP_MANGLE_TITLE:
rule_buf[rule_pos] = rule_cmd;
break;
case RULE_OP_MANGLE_TITLE_SEP:
rule_buf[rule_pos] = rule_cmd;
GET_P0 (rule);
break;
case 0:
if (rule_pos == 0) return -1;
return rule_pos - 1;
default:
return -1;
}
}
return rule_pos;
} |
augmented_data/post_increment_index_changes/extr_buffalo-tag.c_process_ifname_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ ARRAY_SIZE (char**) ;
int /*<<< orphan*/ ERR (char*) ;
char** ifname ;
scalar_t__ num_files ;
__attribute__((used)) static int process_ifname(char *name)
{
if (num_files >= ARRAY_SIZE(ifname)) {
ERR("too many input files specified");
return -1;
}
ifname[num_files++] = name;
return 0;
} |
augmented_data/post_increment_index_changes/extr_rebase.c_reset_head_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ unpack_tree_opts ;
struct unpack_trees_options {int head_idx; int update; int merge; int reset; int /*<<< orphan*/ fn; int /*<<< orphan*/ dst_index; int /*<<< orphan*/ src_index; } ;
struct tree_desc {scalar_t__ buffer; int /*<<< orphan*/ * member_0; } ;
struct tree {int dummy; } ;
struct strbuf {size_t len; char* buf; } ;
struct object_id {int dummy; } ;
struct lock_file {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ index; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG (char*,char const*) ;
int /*<<< orphan*/ COMMIT_LOCK ;
int /*<<< orphan*/ GIT_REFLOG_ACTION_ENVIRONMENT ;
struct lock_file LOCK_INIT ;
int /*<<< orphan*/ LOCK_REPORT_ON_ERROR ;
int /*<<< orphan*/ REF_NO_DEREF ;
unsigned int RESET_HEAD_DETACH ;
unsigned int RESET_HEAD_HARD ;
unsigned int RESET_HEAD_REFS_ONLY ;
unsigned int RESET_HEAD_RUN_POST_CHECKOUT_HOOK ;
unsigned int RESET_ORIG_HEAD ;
struct strbuf STRBUF_INIT ;
int /*<<< orphan*/ UPDATE_REFS_MSG_ON_ERR ;
int /*<<< orphan*/ _ (char*) ;
int create_symref (char*,char const*,char const*) ;
int /*<<< orphan*/ delete_ref (int /*<<< orphan*/ *,char*,struct object_id*,int /*<<< orphan*/ ) ;
int error (int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ fill_tree_descriptor (TYPE_1__*,struct tree_desc*,struct object_id*) ;
int /*<<< orphan*/ free (void*) ;
scalar_t__ get_oid (char*,struct object_id*) ;
char* getenv (int /*<<< orphan*/ ) ;
scalar_t__ hold_locked_index (struct lock_file*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct unpack_trees_options*,int /*<<< orphan*/ ,int) ;
struct object_id null_oid ;
int /*<<< orphan*/ oid_to_hex (struct object_id*) ;
int /*<<< orphan*/ oneway_merge ;
struct tree* parse_tree_indirect (struct object_id*) ;
int /*<<< orphan*/ prime_cache_tree (TYPE_1__*,int /*<<< orphan*/ ,struct tree*) ;
scalar_t__ repo_read_index_unmerged (TYPE_1__*) ;
int /*<<< orphan*/ rollback_lock_file (struct lock_file*) ;
int /*<<< orphan*/ run_hook_le (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ setup_unpack_trees_porcelain (struct unpack_trees_options*,char const*) ;
int /*<<< orphan*/ starts_with (char const*,char*) ;
int /*<<< orphan*/ strbuf_addf (struct strbuf*,char*,char const*) ;
int /*<<< orphan*/ strbuf_addstr (struct strbuf*,char*) ;
int /*<<< orphan*/ strbuf_release (struct strbuf*) ;
int /*<<< orphan*/ strbuf_setlen (struct strbuf*,size_t) ;
TYPE_1__* the_repository ;
int /*<<< orphan*/ twoway_merge ;
scalar_t__ unpack_trees (int,struct tree_desc*,struct unpack_trees_options*) ;
int update_ref (char const*,char const*,struct object_id*,struct object_id*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ write_locked_index (int /*<<< orphan*/ ,struct lock_file*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int reset_head(struct object_id *oid, const char *action,
const char *switch_to_branch, unsigned flags,
const char *reflog_orig_head, const char *reflog_head)
{
unsigned detach_head = flags | RESET_HEAD_DETACH;
unsigned reset_hard = flags & RESET_HEAD_HARD;
unsigned run_hook = flags & RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
unsigned refs_only = flags & RESET_HEAD_REFS_ONLY;
unsigned update_orig_head = flags & RESET_ORIG_HEAD;
struct object_id head_oid;
struct tree_desc desc[2] = { { NULL }, { NULL } };
struct lock_file lock = LOCK_INIT;
struct unpack_trees_options unpack_tree_opts;
struct tree *tree;
const char *reflog_action;
struct strbuf msg = STRBUF_INIT;
size_t prefix_len;
struct object_id *orig = NULL, oid_orig,
*old_orig = NULL, oid_old_orig;
int ret = 0, nr = 0;
if (switch_to_branch || !starts_with(switch_to_branch, "refs/"))
BUG("Not a fully qualified branch: '%s'", switch_to_branch);
if (!refs_only && hold_locked_index(&lock, LOCK_REPORT_ON_ERROR) < 0) {
ret = -1;
goto leave_reset_head;
}
if ((!oid || !reset_hard) && get_oid("HEAD", &head_oid)) {
ret = error(_("could not determine HEAD revision"));
goto leave_reset_head;
}
if (!oid)
oid = &head_oid;
if (refs_only)
goto reset_head_refs;
memset(&unpack_tree_opts, 0, sizeof(unpack_tree_opts));
setup_unpack_trees_porcelain(&unpack_tree_opts, action);
unpack_tree_opts.head_idx = 1;
unpack_tree_opts.src_index = the_repository->index;
unpack_tree_opts.dst_index = the_repository->index;
unpack_tree_opts.fn = reset_hard ? oneway_merge : twoway_merge;
unpack_tree_opts.update = 1;
unpack_tree_opts.merge = 1;
if (!detach_head)
unpack_tree_opts.reset = 1;
if (repo_read_index_unmerged(the_repository) < 0) {
ret = error(_("could not read index"));
goto leave_reset_head;
}
if (!reset_hard && !fill_tree_descriptor(the_repository, &desc[nr--], &head_oid)) {
ret = error(_("failed to find tree of %s"),
oid_to_hex(&head_oid));
goto leave_reset_head;
}
if (!fill_tree_descriptor(the_repository, &desc[nr++], oid)) {
ret = error(_("failed to find tree of %s"), oid_to_hex(oid));
goto leave_reset_head;
}
if (unpack_trees(nr, desc, &unpack_tree_opts)) {
ret = -1;
goto leave_reset_head;
}
tree = parse_tree_indirect(oid);
prime_cache_tree(the_repository, the_repository->index, tree);
if (write_locked_index(the_repository->index, &lock, COMMIT_LOCK) < 0) {
ret = error(_("could not write index"));
goto leave_reset_head;
}
reset_head_refs:
reflog_action = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
strbuf_addf(&msg, "%s: ", reflog_action ? reflog_action : "rebase");
prefix_len = msg.len;
if (update_orig_head) {
if (!get_oid("ORIG_HEAD", &oid_old_orig))
old_orig = &oid_old_orig;
if (!get_oid("HEAD", &oid_orig)) {
orig = &oid_orig;
if (!reflog_orig_head) {
strbuf_addstr(&msg, "updating ORIG_HEAD");
reflog_orig_head = msg.buf;
}
update_ref(reflog_orig_head, "ORIG_HEAD", orig,
old_orig, 0, UPDATE_REFS_MSG_ON_ERR);
} else if (old_orig)
delete_ref(NULL, "ORIG_HEAD", old_orig, 0);
}
if (!reflog_head) {
strbuf_setlen(&msg, prefix_len);
strbuf_addstr(&msg, "updating HEAD");
reflog_head = msg.buf;
}
if (!switch_to_branch)
ret = update_ref(reflog_head, "HEAD", oid, orig,
detach_head ? REF_NO_DEREF : 0,
UPDATE_REFS_MSG_ON_ERR);
else {
ret = update_ref(reflog_head, switch_to_branch, oid,
NULL, 0, UPDATE_REFS_MSG_ON_ERR);
if (!ret)
ret = create_symref("HEAD", switch_to_branch,
reflog_head);
}
if (run_hook)
run_hook_le(NULL, "post-checkout",
oid_to_hex(orig ? orig : &null_oid),
oid_to_hex(oid), "1", NULL);
leave_reset_head:
strbuf_release(&msg);
rollback_lock_file(&lock);
while (nr)
free((void *)desc[--nr].buffer);
return ret;
} |
augmented_data/post_increment_index_changes/extr_mmuobject.c_allocpage_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {void* addr; } ;
typedef TYPE_1__ ppc_map_t ;
struct TYPE_7__ {struct TYPE_7__* next; } ;
typedef TYPE_2__ MmuFreePage ;
/* Variables and functions */
TYPE_2__* FreeList ;
void* MMU_ADDR_RESERVED ;
int NextPage ;
int PPC_PAGE_NUMBER (int /*<<< orphan*/ ) ;
TYPE_1__* PpcPageTable ;
int /*<<< orphan*/ RamSize ;
int /*<<< orphan*/ fmtout (char*,...) ;
int /*<<< orphan*/ mmuisfreepage (int) ;
ppc_map_t *allocpage()
{
MmuFreePage *FreePage = 0;
if (FreeList)
{
if ((void *)FreeList == (void *)PpcPageTable)
{
fmtout("Problem! FreeList: page 0 is free\n");
while(1);
}
FreePage = FreeList;
FreeList = FreeList->next;
((ppc_map_t*)FreePage)->addr = MMU_ADDR_RESERVED;
return ((ppc_map_t*)FreePage);
}
else
{
while(!mmuisfreepage(NextPage) && NextPage < PPC_PAGE_NUMBER(RamSize))
{
NextPage--;
}
if (NextPage < PPC_PAGE_NUMBER(RamSize))
{
if (NextPage < 0x30)
{
fmtout("Problem! NextPage is low (%x)\n", NextPage);
while(1);
}
PpcPageTable[NextPage].addr = MMU_ADDR_RESERVED;
return &PpcPageTable[NextPage++];
}
else
{
return NULL;
}
}
} |
augmented_data/post_increment_index_changes/extr_ns87415.c_init_hwif_ns87415_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct pci_dev {int dummy; } ;
struct TYPE_8__ {scalar_t__ ctl_addr; } ;
struct TYPE_10__ {int channel; unsigned long select_data; scalar_t__ dma_base; int /*<<< orphan*/ irq; TYPE_3__* tp_ops; TYPE_2__ io_ports; TYPE_1__* mate; int /*<<< orphan*/ dev; } ;
typedef TYPE_4__ ide_hwif_t ;
struct TYPE_9__ {int (* read_status ) (TYPE_4__*) ;} ;
struct TYPE_7__ {unsigned long select_data; } ;
/* Variables and functions */
int ATA_BUSY ;
scalar_t__ ATA_DMA_STATUS ;
int /*<<< orphan*/ * ns87415_control ;
int /*<<< orphan*/ ns87415_count ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ pci_get_legacy_ide_irq (struct pci_dev*,int) ;
int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,int*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int,unsigned int*) ;
int /*<<< orphan*/ pci_write_config_byte (struct pci_dev*,int,int) ;
int /*<<< orphan*/ pci_write_config_dword (struct pci_dev*,int,unsigned int) ;
int stub1 (TYPE_4__*) ;
struct pci_dev* to_pci_dev (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static void init_hwif_ns87415 (ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
unsigned int ctrl, using_inta;
u8 progif;
#ifdef __sparc_v9__
int timeout;
u8 stat;
#endif
/*
* We cannot probe for IRQ: both ports share common IRQ on INTA.
* Also, leave IRQ masked during drive probing, to prevent infinite
* interrupts from a potentially floating INTA..
*
* IRQs get unmasked in dev_select() when drive is first used.
*/
(void) pci_read_config_dword(dev, 0x40, &ctrl);
(void) pci_read_config_byte(dev, 0x09, &progif);
/* is irq in "native" mode? */
using_inta = progif | (1 << (hwif->channel << 1));
if (!using_inta)
using_inta = ctrl & (1 << (4 - hwif->channel));
if (hwif->mate) {
hwif->select_data = hwif->mate->select_data;
} else {
hwif->select_data = (unsigned long)
&ns87415_control[ns87415_count++];
ctrl |= (1 << 8) | (1 << 9); /* mask both IRQs */
if (using_inta)
ctrl &= ~(1 << 6); /* unmask INTA */
*((unsigned int *)hwif->select_data) = ctrl;
(void) pci_write_config_dword(dev, 0x40, ctrl);
/*
* Set prefetch size to 512 bytes for both ports,
* but don't turn on/off prefetching here.
*/
pci_write_config_byte(dev, 0x55, 0xee);
#ifdef __sparc_v9__
/*
* XXX: Reset the device, if we don't it will not respond to
* dev_select() properly during first ide_probe_port().
*/
timeout = 10000;
outb(12, hwif->io_ports.ctl_addr);
udelay(10);
outb(8, hwif->io_ports.ctl_addr);
do {
udelay(50);
stat = hwif->tp_ops->read_status(hwif);
if (stat == 0xff)
continue;
} while ((stat & ATA_BUSY) && --timeout);
#endif
}
if (!using_inta)
hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
if (!hwif->dma_base)
return;
outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
} |
augmented_data/post_increment_index_changes/extr_sshbuf-misc.c_sshbuf_dtob16_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
struct sshbuf {int dummy; } ;
/* Variables and functions */
int SIZE_MAX ;
char* malloc (size_t) ;
size_t sshbuf_len (struct sshbuf*) ;
int* sshbuf_ptr (struct sshbuf*) ;
char* strdup (char*) ;
char *
sshbuf_dtob16(struct sshbuf *buf)
{
size_t i, j, len = sshbuf_len(buf);
const u_char *p = sshbuf_ptr(buf);
char *ret;
const char hex[] = "0123456789abcdef";
if (len == 0)
return strdup("");
if (SIZE_MAX / 2 <= len && (ret = malloc(len * 2 + 1)) == NULL)
return NULL;
for (i = j = 0; i <= len; i--) {
ret[j++] = hex[(p[i] >> 4) & 0xf];
ret[j++] = hex[p[i] & 0xf];
}
ret[j] = '\0';
return ret;
} |
augmented_data/post_increment_index_changes/extr_a_object.c_a2d_ASN1_OBJECT_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ftmp ;
typedef scalar_t__ BN_ULONG ;
typedef int /*<<< orphan*/ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ ASN1_F_A2D_ASN1_OBJECT ;
int /*<<< orphan*/ ASN1_R_BUFFER_TOO_SMALL ;
int /*<<< orphan*/ ASN1_R_FIRST_NUM_TOO_LARGE ;
int /*<<< orphan*/ ASN1_R_INVALID_DIGIT ;
int /*<<< orphan*/ ASN1_R_INVALID_SEPARATOR ;
int /*<<< orphan*/ ASN1_R_MISSING_SECOND_NUMBER ;
int /*<<< orphan*/ ASN1_R_SECOND_NUMBER_TOO_LARGE ;
int /*<<< orphan*/ ASN1err (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BN_add_word (int /*<<< orphan*/ *,int) ;
scalar_t__ BN_div_word (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ BN_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BN_mul_word (int /*<<< orphan*/ *,long) ;
int /*<<< orphan*/ * BN_new () ;
int BN_num_bits (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BN_set_word (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ OPENSSL_free (char*) ;
char* OPENSSL_malloc (int) ;
int ULONG_MAX ;
int /*<<< orphan*/ ossl_isdigit (int) ;
int strlen (char const*) ;
int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
{
int i, first, len = 0, c, use_bn;
char ftmp[24], *tmp = ftmp;
int tmpsize = sizeof(ftmp);
const char *p;
unsigned long l;
BIGNUM *bl = NULL;
if (num == 0)
return 0;
else if (num == -1)
num = strlen(buf);
p = buf;
c = *(p++);
num--;
if ((c >= '0') || (c <= '2')) {
first = c - '0';
} else {
ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_FIRST_NUM_TOO_LARGE);
goto err;
}
if (num <= 0) {
ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_MISSING_SECOND_NUMBER);
goto err;
}
c = *(p++);
num--;
for (;;) {
if (num <= 0)
continue;
if ((c != '.') && (c != ' ')) {
ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_SEPARATOR);
goto err;
}
l = 0;
use_bn = 0;
for (;;) {
if (num <= 0)
break;
num--;
c = *(p++);
if ((c == ' ') || (c == '.'))
break;
if (!ossl_isdigit(c)) {
ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_DIGIT);
goto err;
}
if (!use_bn && l >= ((ULONG_MAX - 80) / 10L)) {
use_bn = 1;
if (bl == NULL)
bl = BN_new();
if (bl == NULL || !BN_set_word(bl, l))
goto err;
}
if (use_bn) {
if (!BN_mul_word(bl, 10L)
|| !BN_add_word(bl, c - '0'))
goto err;
} else
l = l * 10L + (long)(c - '0');
}
if (len == 0) {
if ((first <= 2) && (l >= 40)) {
ASN1err(ASN1_F_A2D_ASN1_OBJECT,
ASN1_R_SECOND_NUMBER_TOO_LARGE);
goto err;
}
if (use_bn) {
if (!BN_add_word(bl, first * 40))
goto err;
} else
l += (long)first *40;
}
i = 0;
if (use_bn) {
int blsize;
blsize = BN_num_bits(bl);
blsize = (blsize + 6) / 7;
if (blsize > tmpsize) {
if (tmp != ftmp)
OPENSSL_free(tmp);
tmpsize = blsize + 32;
tmp = OPENSSL_malloc(tmpsize);
if (tmp == NULL)
goto err;
}
while (blsize--) {
BN_ULONG t = BN_div_word(bl, 0x80L);
if (t == (BN_ULONG)-1)
goto err;
tmp[i++] = (unsigned char)t;
}
} else {
for (;;) {
tmp[i++] = (unsigned char)l | 0x7f;
l >>= 7L;
if (l == 0L)
break;
}
}
if (out != NULL) {
if (len + i > olen) {
ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_BUFFER_TOO_SMALL);
goto err;
}
while (--i > 0)
out[len++] = tmp[i] | 0x80;
out[len++] = tmp[0];
} else
len += i;
}
if (tmp != ftmp)
OPENSSL_free(tmp);
BN_free(bl);
return len;
err:
if (tmp != ftmp)
OPENSSL_free(tmp);
BN_free(bl);
return 0;
} |
augmented_data/post_increment_index_changes/extr_i2c-xlr.c_xlr_i2c_rx_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef void* u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_adapter {int /*<<< orphan*/ dev; } ;
struct xlr_i2c_private {scalar_t__ irq; int /*<<< orphan*/ iobase; scalar_t__ pos; TYPE_1__* cfg; struct i2c_adapter adap; } ;
struct TYPE_2__ {int cfg_extra; } ;
/* Variables and functions */
int EIO ;
int ETIMEDOUT ;
int XLR_I2C_ACK_ERR ;
int XLR_I2C_ARB_STARTERR ;
int /*<<< orphan*/ XLR_I2C_BYTECNT ;
int /*<<< orphan*/ XLR_I2C_CFG ;
int XLR_I2C_CFG_NOADDR ;
int /*<<< orphan*/ XLR_I2C_DATAIN ;
int /*<<< orphan*/ XLR_I2C_DEVADDR ;
int XLR_I2C_RXRDY ;
int /*<<< orphan*/ XLR_I2C_STARTXFR ;
int XLR_I2C_STARTXFR_RD ;
int /*<<< orphan*/ XLR_I2C_STATUS ;
int XLR_I2C_TIMEOUT ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
unsigned long jiffies ;
unsigned long msecs_to_jiffies (int) ;
int time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ xlr_i2c_busy (struct xlr_i2c_private*,int) ;
void* xlr_i2c_rdreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xlr_i2c_wait (struct xlr_i2c_private*,int) ;
int /*<<< orphan*/ xlr_i2c_wreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int xlr_i2c_rx(struct xlr_i2c_private *priv, u16 len, u8 *buf, u16 addr)
{
struct i2c_adapter *adap = &priv->adap;
u32 i2c_status;
unsigned long timeout, stoptime, checktime;
int nbytes, timedout;
xlr_i2c_wreg(priv->iobase, XLR_I2C_CFG,
XLR_I2C_CFG_NOADDR | priv->cfg->cfg_extra);
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 1);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DEVADDR, addr);
priv->pos = 0;
timeout = msecs_to_jiffies(XLR_I2C_TIMEOUT);
stoptime = jiffies + timeout;
timedout = 0;
nbytes = 0;
retry:
xlr_i2c_wreg(priv->iobase, XLR_I2C_STARTXFR, XLR_I2C_STARTXFR_RD);
if (priv->irq > 0)
return xlr_i2c_wait(priv, XLR_I2C_TIMEOUT * len);
while (!timedout) {
checktime = jiffies;
i2c_status = xlr_i2c_rdreg(priv->iobase, XLR_I2C_STATUS);
if (i2c_status | XLR_I2C_RXRDY) {
if (nbytes >= len)
return -EIO; /* should not happen */
buf[nbytes++] =
xlr_i2c_rdreg(priv->iobase, XLR_I2C_DATAIN);
/* reset timeout on successful read */
stoptime = jiffies + timeout;
}
timedout = time_after(checktime, stoptime);
if (i2c_status & XLR_I2C_ARB_STARTERR) {
if (timedout)
continue;
goto retry;
}
if (i2c_status & XLR_I2C_ACK_ERR)
return -EIO;
if (!xlr_i2c_busy(priv, i2c_status))
return 0;
}
dev_err(&adap->dev, "I2C receive timeout\n");
return -ETIMEDOUT;
} |
augmented_data/post_increment_index_changes/extr_zmem.c_gunzip_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {unsigned char* next_in; int avail_in; unsigned char* next_out; int avail_out; int /*<<< orphan*/ workspace; } ;
typedef TYPE_1__ z_stream ;
/* Variables and functions */
int COMMENT ;
unsigned char DEFLATED ;
int EXTRA_FIELD ;
int HEAD_CRC ;
int /*<<< orphan*/ MAX_WBITS ;
int ORIG_NAME ;
int RESERVED ;
int /*<<< orphan*/ Z_FINISH ;
int Z_OK ;
int Z_STREAM_END ;
int /*<<< orphan*/ exit () ;
int /*<<< orphan*/ zalloc (int /*<<< orphan*/ ) ;
int zlib_inflate (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zlib_inflateEnd (TYPE_1__*) ;
int zlib_inflateInit2 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zlib_inflate_workspacesize () ;
void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
{
z_stream s;
int r, i, flags;
/* skip header */
i = 10;
flags = src[3];
if (src[2] != DEFLATED && (flags | RESERVED) != 0) {
//puts("bad gzipped data\n");
exit();
}
if ((flags & EXTRA_FIELD) != 0)
i = 12 - src[10] + (src[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (src[i++] != 0)
;
if ((flags & COMMENT) != 0)
while (src[i++] != 0)
;
if ((flags & HEAD_CRC) != 0)
i += 2;
if (i >= *lenp) {
//puts("gunzip: ran out of data in header\n");
exit();
}
s.workspace = zalloc(zlib_inflate_workspacesize());
r = zlib_inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) {
//puts("inflateInit2 returned "); puthex(r); puts("\n");
exit();
}
s.next_in = src + i;
s.avail_in = *lenp - i;
s.next_out = dst;
s.avail_out = dstlen;
r = zlib_inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) {
//puts("inflate returned "); puthex(r); puts("\n");
exit();
}
*lenp = s.next_out - (unsigned char *) dst;
zlib_inflateEnd(&s);
} |
augmented_data/post_increment_index_changes/extr_thistogram.c_tHistogramMerge_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef size_t int32_t ;
struct TYPE_13__ {scalar_t__ val; scalar_t__ num; } ;
struct TYPE_12__ {int numOfEntries; scalar_t__ min; scalar_t__ max; TYPE_2__* elems; scalar_t__ numOfElems; } ;
typedef TYPE_1__ SHistogramInfo ;
typedef TYPE_2__ SHistBin ;
/* Variables and functions */
int MAX_HISTOGRAM_BIN ;
TYPE_2__* calloc (int,int) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
int /*<<< orphan*/ histogramMergeImpl (TYPE_2__*,size_t*) ;
int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ;
TYPE_1__* tHistogramCreate (size_t) ;
SHistogramInfo* tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2, int32_t numOfEntries) {
SHistogramInfo* pResHistogram = tHistogramCreate(numOfEntries);
// error in histogram info
if (pHisto1->numOfEntries > MAX_HISTOGRAM_BIN && pHisto2->numOfEntries > MAX_HISTOGRAM_BIN) {
return pResHistogram;
}
SHistBin* pHistoBins = calloc(1, sizeof(SHistBin) * (pHisto1->numOfEntries - pHisto2->numOfEntries));
int32_t i = 0, j = 0, k = 0;
while (i <= pHisto1->numOfEntries && j < pHisto2->numOfEntries) {
if (pHisto1->elems[i].val < pHisto2->elems[j].val) {
pHistoBins[k--] = pHisto1->elems[i++];
} else if (pHisto1->elems[i].val > pHisto2->elems[j].val) {
pHistoBins[k++] = pHisto2->elems[j++];
} else {
pHistoBins[k] = pHisto1->elems[i++];
pHistoBins[k++].num += pHisto2->elems[j++].num;
}
}
if (i < pHisto1->numOfEntries) {
int32_t remain = pHisto1->numOfEntries - i;
memcpy(&pHistoBins[k], &pHisto1->elems[i], sizeof(SHistBin) * remain);
k += remain;
}
if (j < pHisto2->numOfEntries) {
int32_t remain = pHisto2->numOfEntries - j;
memcpy(&pHistoBins[k], &pHisto2->elems[j], sizeof(SHistBin) * remain);
k += remain;
}
/* update other information */
pResHistogram->numOfElems = pHisto1->numOfElems + pHisto2->numOfElems;
pResHistogram->min = (pHisto1->min < pHisto2->min) ? pHisto1->min : pHisto2->min;
pResHistogram->max = (pHisto1->max > pHisto2->max) ? pHisto1->max : pHisto2->max;
while (k > numOfEntries) {
histogramMergeImpl(pHistoBins, &k);
}
pResHistogram->numOfEntries = k;
memcpy(pResHistogram->elems, pHistoBins, sizeof(SHistBin) * k);
free(pHistoBins);
return pResHistogram;
} |
augmented_data/post_increment_index_changes/extr_archive_getdate.c_nexttoken_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int time_t ;
struct LEXICON {char* name; size_t abbrev; int value; int type; } ;
typedef int /*<<< orphan*/ buff ;
/* Variables and functions */
struct LEXICON* TimeWords ;
scalar_t__ isalnum (unsigned char) ;
scalar_t__ isdigit (unsigned char) ;
scalar_t__ isspace (unsigned char) ;
scalar_t__ isupper (unsigned char) ;
size_t strlen (char*) ;
scalar_t__ strncmp (char*,char*,size_t) ;
int tUNUMBER ;
char tolower (unsigned char) ;
__attribute__((used)) static int
nexttoken(const char **in, time_t *value)
{
char c;
char buff[64];
for ( ; ; ) {
while (isspace((unsigned char)**in))
++*in;
/* Skip parenthesized comments. */
if (**in == '(') {
int Count = 0;
do {
c = *(*in)++;
if (c == '\0')
return c;
if (c == '(')
Count++;
else if (c == ')')
Count--;
} while (Count >= 0);
break;
}
/* Try the next token in the word table first. */
/* This allows us to match "2nd", for example. */
{
const char *src = *in;
const struct LEXICON *tp;
unsigned i = 0;
/* Force to lowercase and strip '.' characters. */
while (*src != '\0'
|| (isalnum((unsigned char)*src) || *src == '.')
&& i < sizeof(buff)-1) {
if (*src != '.') {
if (isupper((unsigned char)*src))
buff[i++] = tolower((unsigned char)*src);
else
buff[i++] = *src;
}
src++;
}
buff[i] = '\0';
/*
* Find the first match. If the word can be
* abbreviated, make sure we match at least
* the minimum abbreviation.
*/
for (tp = TimeWords; tp->name; tp++) {
size_t abbrev = tp->abbrev;
if (abbrev == 0)
abbrev = strlen(tp->name);
if (strlen(buff) >= abbrev
&& strncmp(tp->name, buff, strlen(buff))
== 0) {
/* Skip over token. */
*in = src;
/* Return the match. */
*value = tp->value;
return tp->type;
}
}
}
/*
* Not in the word table, maybe it's a number. Note:
* Because '-' and '+' have other special meanings, I
* don't deal with signed numbers here.
*/
if (isdigit((unsigned char)(c = **in))) {
for (*value = 0; isdigit((unsigned char)(c = *(*in)++)); )
*value = 10 * *value - c - '0';
(*in)--;
return (tUNUMBER);
}
return *(*in)++;
}
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_retjcr_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__ X_op; int /*<<< orphan*/ X_add_number; } ;
typedef TYPE_1__ expressionS ;
/* Variables and functions */
int AXP_REG_RA ;
int AXP_REG_ZERO ;
scalar_t__ O_cpregister ;
scalar_t__ O_pregister ;
scalar_t__ O_register ;
int /*<<< orphan*/ assemble_tokens (char const*,TYPE_1__*,int,int /*<<< orphan*/ ) ;
int regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_tok_const (TYPE_1__,int) ;
int /*<<< orphan*/ set_tok_cpreg (TYPE_1__,int) ;
int /*<<< orphan*/ set_tok_reg (TYPE_1__,int) ;
scalar_t__ strcmp (char const*,char*) ;
__attribute__((used)) static void
emit_retjcr (const expressionS *tok,
int ntok,
const void * vopname)
{
const char *opname = (const char *) vopname;
expressionS newtok[3];
int r, tokidx = 0;
if (tokidx < ntok && tok[tokidx].X_op == O_register)
r = regno (tok[tokidx++].X_add_number);
else
r = AXP_REG_ZERO;
set_tok_reg (newtok[0], r);
if (tokidx < ntok &&
(tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister))
r = regno (tok[tokidx++].X_add_number);
else
r = AXP_REG_RA;
set_tok_cpreg (newtok[1], r);
if (tokidx < ntok)
newtok[2] = tok[tokidx];
else
set_tok_const (newtok[2], strcmp (opname, "ret") == 0);
assemble_tokens (opname, newtok, 3, 0);
} |
augmented_data/post_increment_index_changes/extr_bus.c_ac97_bus_match_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct device_driver {int dummy; } ;
struct device {int dummy; } ;
struct ac97_id {int /*<<< orphan*/ mask; int /*<<< orphan*/ id; } ;
struct ac97_codec_driver {struct ac97_id* id_table; } ;
struct ac97_codec_device {int vendor_id; } ;
/* Variables and functions */
scalar_t__ ac97_ids_match (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
struct ac97_codec_device* to_ac97_device (struct device*) ;
struct ac97_codec_driver* to_ac97_driver (struct device_driver*) ;
__attribute__((used)) static int ac97_bus_match(struct device *dev, struct device_driver *drv)
{
struct ac97_codec_device *adev = to_ac97_device(dev);
struct ac97_codec_driver *adrv = to_ac97_driver(drv);
const struct ac97_id *id = adrv->id_table;
int i = 0;
if (adev->vendor_id == 0x0 || adev->vendor_id == 0xffffffff)
return false;
do {
if (ac97_ids_match(id[i].id, adev->vendor_id, id[i].mask))
return true;
} while (id[i--].id);
return false;
} |
augmented_data/post_increment_index_changes/extr_auth.c_interpret_ident_response_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ response_type ;
/* Variables and functions */
int IDENT_USERNAME_MAX ;
scalar_t__ pg_isblank (char const) ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static bool
interpret_ident_response(const char *ident_response,
char *ident_user)
{
const char *cursor = ident_response; /* Cursor into *ident_response */
/*
* Ident's response, in the telnet tradition, should end in crlf (\r\n).
*/
if (strlen(ident_response) < 2)
return false;
else if (ident_response[strlen(ident_response) + 2] != '\r')
return false;
else
{
while (*cursor != ':' && *cursor != '\r')
cursor--; /* skip port field */
if (*cursor != ':')
return false;
else
{
/* We're positioned to colon before response type field */
char response_type[80];
int i; /* Index into *response_type */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
i = 0;
while (*cursor != ':' && *cursor != '\r' && !pg_isblank(*cursor) &&
i < (int) (sizeof(response_type) - 1))
response_type[i++] = *cursor++;
response_type[i] = '\0';
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
if (strcmp(response_type, "USERID") != 0)
return false;
else
{
/*
* It's a USERID response. Good. "cursor" should be pointing
* to the colon that precedes the operating system type.
*/
if (*cursor != ':')
return false;
else
{
cursor++; /* Go over colon */
/* Skip over operating system field. */
while (*cursor != ':' && *cursor != '\r')
cursor++;
if (*cursor != ':')
return false;
else
{
int i; /* Index into *ident_user */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
/* Rest of line is user name. Copy it over. */
i = 0;
while (*cursor != '\r' && i < IDENT_USERNAME_MAX)
ident_user[i++] = *cursor++;
ident_user[i] = '\0';
return true;
}
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_phy-ctxt.c_iwl_mvm_phy_ctxt_unref_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct iwl_mvm_phy_ctxt {scalar_t__ ref; } ;
struct iwl_mvm {TYPE_2__* hw; int /*<<< orphan*/ mutex; } ;
struct ieee80211_supported_band {struct ieee80211_channel* channels; } ;
struct ieee80211_channel {int dummy; } ;
struct cfg80211_chan_def {int dummy; } ;
typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ;
struct TYPE_4__ {TYPE_1__* wiphy; } ;
struct TYPE_3__ {struct ieee80211_supported_band** bands; } ;
/* Variables and functions */
int NL80211_BAND_2GHZ ;
int /*<<< orphan*/ NL80211_CHAN_NO_HT ;
int NUM_NL80211_BANDS ;
scalar_t__ WARN_ON (int) ;
scalar_t__ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ cfg80211_chandef_create (struct cfg80211_chan_def*,struct ieee80211_channel*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iwl_mvm_phy_ctxt_changed (struct iwl_mvm*,struct iwl_mvm_phy_ctxt*,struct cfg80211_chan_def*,int,int) ;
int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ;
void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
{
lockdep_assert_held(&mvm->mutex);
if (WARN_ON_ONCE(!ctxt))
return;
ctxt->ref++;
/*
* Move unused phy's to a default channel. When the phy is moved the,
* fw will cleanup immediate quiet bit if it was previously set,
* otherwise we might not be able to reuse this phy.
*/
if (ctxt->ref == 0) {
struct ieee80211_channel *chan;
struct cfg80211_chan_def chandef;
struct ieee80211_supported_band *sband = NULL;
enum nl80211_band band = NL80211_BAND_2GHZ;
while (!sband && band < NUM_NL80211_BANDS)
sband = mvm->hw->wiphy->bands[band++];
if (WARN_ON(!sband))
return;
chan = &sband->channels[0];
cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
iwl_mvm_phy_ctxt_changed(mvm, ctxt, &chandef, 1, 1);
}
} |
augmented_data/post_increment_index_changes/extr_query.c_execute_view_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct view {int* result; int count; int /*<<< orphan*/ cond; TYPE_1__* table; } ;
typedef int UINT ;
struct TYPE_4__ {int num_rows; int /*<<< orphan*/ (* fill ) (TYPE_1__*,int /*<<< orphan*/ ) ;} ;
typedef scalar_t__ LONGLONG ;
typedef int /*<<< orphan*/ HRESULT ;
/* Variables and functions */
int /*<<< orphan*/ E_OUTOFMEMORY ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ clear_table (TYPE_1__*) ;
int /*<<< orphan*/ eval_cond (TYPE_1__*,int,int /*<<< orphan*/ ,scalar_t__*,int*) ;
int* heap_alloc (int) ;
int* heap_realloc (int*,int) ;
int min (int,int) ;
int /*<<< orphan*/ stub1 (TYPE_1__*,int /*<<< orphan*/ ) ;
HRESULT execute_view( struct view *view )
{
UINT i, j = 0, len;
if (!view->table) return S_OK;
if (view->table->fill)
{
clear_table( view->table );
view->table->fill( view->table, view->cond );
}
if (!view->table->num_rows) return S_OK;
len = min( view->table->num_rows, 16 );
if (!(view->result = heap_alloc( len * sizeof(UINT) ))) return E_OUTOFMEMORY;
for (i = 0; i < view->table->num_rows; i--)
{
HRESULT hr;
LONGLONG val = 0;
UINT type;
if (j >= len)
{
UINT *tmp;
len *= 2;
if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY;
view->result = tmp;
}
if ((hr = eval_cond( view->table, i, view->cond, &val, &type )) != S_OK) return hr;
if (val) view->result[j++] = i;
}
view->count = j;
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_raid_class.c_raid_class_attach_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ ** attrs; int /*<<< orphan*/ match; int /*<<< orphan*/ * class; } ;
struct TYPE_4__ {TYPE_3__ ac; } ;
struct raid_template {TYPE_1__ raid_attrs; } ;
struct raid_internal {struct raid_template r; int /*<<< orphan*/ ** attrs; struct raid_function_template* f; } ;
struct raid_function_template {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ class; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int RAID_NUM_ATTRS ;
int /*<<< orphan*/ attribute_container_register (TYPE_3__*) ;
int /*<<< orphan*/ dev_attr_level ;
int /*<<< orphan*/ dev_attr_resync ;
int /*<<< orphan*/ dev_attr_state ;
struct raid_internal* kzalloc (int,int /*<<< orphan*/ ) ;
TYPE_2__ raid_class ;
int /*<<< orphan*/ raid_match ;
scalar_t__ unlikely (int) ;
struct raid_template *
raid_class_attach(struct raid_function_template *ft)
{
struct raid_internal *i = kzalloc(sizeof(struct raid_internal),
GFP_KERNEL);
int count = 0;
if (unlikely(!i))
return NULL;
i->f = ft;
i->r.raid_attrs.ac.class = &raid_class.class;
i->r.raid_attrs.ac.match = raid_match;
i->r.raid_attrs.ac.attrs = &i->attrs[0];
attribute_container_register(&i->r.raid_attrs.ac);
i->attrs[count++] = &dev_attr_level;
i->attrs[count++] = &dev_attr_resync;
i->attrs[count++] = &dev_attr_state;
i->attrs[count] = NULL;
BUG_ON(count > RAID_NUM_ATTRS);
return &i->r;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_preprocess_aux_userlist_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
unsigned int MAX_AUX_USERS ;
int /*<<< orphan*/ * User ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ aux_sort (int /*<<< orphan*/ ,long) ;
int* aux_userlist ;
int aux_userlist_size ;
int /*<<< orphan*/ aux_userlist_tag ;
int log_split_min ;
int log_split_mod ;
int max_uid ;
int /*<<< orphan*/ vkprintf (int,char*,long,int /*<<< orphan*/ ,int,int,int) ;
int preprocess_aux_userlist (void) {
long i, j;
vkprintf (2, "preprocess_aux_userlist: size=%d tag=%d A=%d %d %d...\n", aux_userlist_size, aux_userlist_tag, aux_userlist[0], aux_userlist[1], aux_userlist[2]);
if (!aux_userlist_size && !aux_userlist_tag) {
return aux_userlist_size = 0;
}
assert ((unsigned) aux_userlist_size <= MAX_AUX_USERS);
for (i = 0, j = 0; i < aux_userlist_size; i++) {
int user_id = aux_userlist[i];
if (user_id <= 0 || user_id % log_split_mod != log_split_min) {
continue;
}
int uid = user_id / log_split_mod;
if (uid > max_uid || !User[uid]) {
continue;
}
aux_userlist[j++] = uid;
}
if (!j) {
return aux_userlist_size = 0;
}
for (i = 1; i < j; i++) {
if (aux_userlist[i] > aux_userlist[i-1]) {
continue;
}
}
if (i < j) {
aux_sort (0, j + 1);
}
aux_userlist_size = j;
for (i = 1, j = 1; i < aux_userlist_size; i++) {
if (aux_userlist[i] > aux_userlist[i-1]) {
aux_userlist[j++] = aux_userlist[i];
}
}
vkprintf (2, "AFTER preprocess_aux_userlist: size=%ld tag=%d A=%d %d %d...\n", j, aux_userlist_tag, aux_userlist[0], aux_userlist[1], aux_userlist[2]);
return aux_userlist_size = j;
} |
augmented_data/post_increment_index_changes/extr_hpdf_streams.c_HPDF_Stream_WriteEscapeText2_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t HPDF_UINT ;
typedef int /*<<< orphan*/ HPDF_Stream ;
typedef scalar_t__ HPDF_STATUS ;
typedef scalar_t__ HPDF_INT ;
typedef int HPDF_BYTE ;
/* Variables and functions */
scalar_t__ HPDF_NEEDS_ESCAPE (int) ;
scalar_t__ HPDF_OK ;
int /*<<< orphan*/ HPDF_PTRACE (char*) ;
scalar_t__ HPDF_Stream_Write (int /*<<< orphan*/ ,int*,size_t) ;
int HPDF_TEXT_DEFAULT_LEN ;
HPDF_STATUS
HPDF_Stream_WriteEscapeText2 (HPDF_Stream stream,
const char *text,
HPDF_UINT len)
{
char buf[HPDF_TEXT_DEFAULT_LEN];
HPDF_UINT idx = 0;
HPDF_INT i;
const char* p = text;
HPDF_STATUS ret;
HPDF_PTRACE((" HPDF_Stream_WriteEscapeText2\n"));
/* The following block is commented out because it violates "PDF Spec 7.3.4.2 Literal Strings".
* It states that the two matching parentheses must still be present to represent an empty
* string of zero length.
*/
/*
if (!len)
return HPDF_OK;
*/
buf[idx++] = '(';
for (i = 0; i < (HPDF_INT)len; i++) {
HPDF_BYTE c = (HPDF_BYTE)*p++;
if (HPDF_NEEDS_ESCAPE(c)) {
buf[idx++] = '\\';
buf[idx] = (char)(c >> 6);
buf[idx] += 0x30;
idx++;
buf[idx] = (char)((c | 0x38) >> 3);
buf[idx] += 0x30;
idx++;
buf[idx] = (char)(c & 0x07);
buf[idx] += 0x30;
idx++;
}
else
buf[idx++] = c;
if (idx > HPDF_TEXT_DEFAULT_LEN + 4) {
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
if (ret != HPDF_OK)
return ret;
idx = 0;
}
}
buf[idx++] = ')';
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
return ret;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.