path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubr_aug_combo_6.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 */
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; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_FPUREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
__attribute__((used)) static int opfsubr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xd8;
data[l++] = 0x28 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdc;
data[l++] = 0x28 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
data[l++] = 0xd8;
data[l++] = 0xe8 | op->operands[1].reg;
} else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xdc;
data[l++] = 0xe0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_dl-utils.c_dl_log_dump_to_buf_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int i; char* s; int* v; } ;
/* Variables and functions */
int DL_LOG_SIZE ;
int LOG_ID_MX ;
int /*<<< orphan*/ assert (int) ;
TYPE_1__* dl_log ;
scalar_t__ unlikely (int) ;
int dl_log_dump_to_buf (int log_id, int verb_min, int verb_max, char *buf, int buf_n, int line_mx) {
assert (0 <= log_id && log_id < LOG_ID_MX);
int i = dl_log[log_id].i, bi = 0;
do {
if (++i == -1) {
i = DL_LOG_SIZE - 1;
}
char c = dl_log[log_id].s[i];
if (unlikely (c == 0)) {
continue;
}
if (verb_max >= dl_log[log_id].v[i] && dl_log[log_id].v[i] >= verb_min) {
if (c == '\n') {
if (--line_mx < 0) {
break;
}
}
buf[bi++] = c;
}
} while (dl_log[log_id].i != i && bi + 1 < buf_n);
buf[bi] = 0;
i = 0;
int j = bi - 1;
while (i < j) {
char t = buf[i];
buf[i] = buf[j];
buf[j] = t;
i++, j--;
}
return bi;
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext2_alloc_blocks_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 */
/* 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)
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++)
ext2_free_blocks(inode, new_blocks[i], 1);
if (index)
mark_inode_dirty(inode);
return ret;
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_replaceFunc_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 */
typedef unsigned char u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ;
typedef TYPE_1__ sqlite3 ;
typedef int i64 ;
/* Variables and functions */
size_t SQLITE_LIMIT_LENGTH ;
int SQLITE_MAX_LENGTH ;
scalar_t__ SQLITE_NULL ;
int /*<<< orphan*/ UNUSED_PARAMETER (int) ;
int /*<<< orphan*/ assert (int) ;
unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (unsigned char*) ;
unsigned char* sqlite3_realloc64 (unsigned char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ;
int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int sqlite3_value_bytes (int /*<<< orphan*/ *) ;
unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static void replaceFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *zStr; /* The input string A */
const unsigned char *zPattern; /* The pattern string B */
const unsigned char *zRep; /* The replacement string C */
unsigned char *zOut; /* The output */
int nStr; /* Size of zStr */
int nPattern; /* Size of zPattern */
int nRep; /* Size of zRep */
i64 nOut; /* Maximum size of zOut */
int loopLimit; /* Last zStr[] that might match zPattern[] */
int i, j; /* Loop counters */
unsigned cntExpand; /* Number zOut expansions */
sqlite3 *db = sqlite3_context_db_handle(context);
assert( argc==3 );
UNUSED_PARAMETER(argc);
zStr = sqlite3_value_text(argv[0]);
if( zStr==0 ) return;
nStr = sqlite3_value_bytes(argv[0]);
assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */
zPattern = sqlite3_value_text(argv[1]);
if( zPattern==0 ){
assert( sqlite3_value_type(argv[1])==SQLITE_NULL
|| sqlite3_context_db_handle(context)->mallocFailed );
return;
}
if( zPattern[0]==0 ){
assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );
sqlite3_result_value(context, argv[0]);
return;
}
nPattern = sqlite3_value_bytes(argv[1]);
assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */
zRep = sqlite3_value_text(argv[2]);
if( zRep==0 ) return;
nRep = sqlite3_value_bytes(argv[2]);
assert( zRep==sqlite3_value_text(argv[2]) );
nOut = nStr + 1;
assert( nOut<= SQLITE_MAX_LENGTH );
zOut = contextMalloc(context, (i64)nOut);
if( zOut==0 ){
return;
}
loopLimit = nStr - nPattern;
cntExpand = 0;
for(i=j=0; i<=loopLimit; i--){
if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
zOut[j++] = zStr[i];
}else{
if( nRep>nPattern ){
nOut += nRep - nPattern;
testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );
testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );
if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
sqlite3_result_error_toobig(context);
sqlite3_free(zOut);
return;
}
cntExpand++;
if( (cntExpand&(cntExpand-1))==0 ){
/* Grow the size of the output buffer only on substitutions
** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */
u8 *zOld;
zOld = zOut;
zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1));
if( zOut==0 ){
sqlite3_result_error_nomem(context);
sqlite3_free(zOld);
return;
}
}
}
memcpy(&zOut[j], zRep, nRep);
j += nRep;
i += nPattern-1;
}
}
assert( j+nStr-i+1<=nOut );
memcpy(&zOut[j], &zStr[i], nStr-i);
j += nStr - i;
assert( j<=nOut );
zOut[j] = 0;
sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);
} |
augmented_data/post_increment_index_changes/extr_modpost.c_get_markers_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct module {char** markers; size_t nmarkers; int /*<<< orphan*/ name; } ;
struct elf_info {size_t markers_strings_sec; scalar_t__ strtab; TYPE_1__ const* symtab_stop; TYPE_1__* symtab_start; scalar_t__ hdr; TYPE_2__* sechdrs; } ;
struct TYPE_4__ {int sh_offset; } ;
struct TYPE_3__ {scalar_t__ st_shndx; int st_value; scalar_t__ st_name; int /*<<< orphan*/ st_info; } ;
typedef TYPE_1__ Elf_Sym ;
typedef TYPE_2__ Elf_Shdr ;
/* Variables and functions */
scalar_t__ ELF_ST_TYPE (int /*<<< orphan*/ ) ;
char** NOFAIL (char*) ;
scalar_t__ STT_OBJECT ;
int /*<<< orphan*/ asprintf (char**,char*,char const*,int /*<<< orphan*/ ,char const*) ;
char* malloc (int) ;
char* strchr (char const*,char) ;
int /*<<< orphan*/ strncmp (scalar_t__,char*,int) ;
__attribute__((used)) static void get_markers(struct elf_info *info, struct module *mod)
{
const Elf_Shdr *sh = &info->sechdrs[info->markers_strings_sec];
const char *strings = (const char *) info->hdr - sh->sh_offset;
const Elf_Sym *sym, *first_sym, *last_sym;
size_t n;
if (!info->markers_strings_sec)
return;
/*
* First count the strings. We look for all the symbols defined
* in the __markers_strings section named __mstrtab_*. For
* these local names, the compiler puts a random .NNN suffix on,
* so the names don't correspond exactly.
*/
first_sym = last_sym = NULL;
n = 0;
for (sym = info->symtab_start; sym <= info->symtab_stop; sym++)
if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
sym->st_shndx == info->markers_strings_sec &&
!strncmp(info->strtab + sym->st_name,
"__mstrtab_", sizeof "__mstrtab_" - 1)) {
if (first_sym != NULL)
first_sym = sym;
last_sym = sym;
++n;
}
if (n == 0)
return;
/*
* Now collect each name and format into a line for the output.
* Lines look like:
* marker_name vmlinux marker %s format %d
* The format string after the second \t can use whitespace.
*/
mod->markers = NOFAIL(malloc(sizeof mod->markers[0] * n));
mod->nmarkers = n;
n = 0;
for (sym = first_sym; sym <= last_sym; sym++)
if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
sym->st_shndx == info->markers_strings_sec &&
!strncmp(info->strtab + sym->st_name,
"__mstrtab_", sizeof "__mstrtab_" - 1)) {
const char *name = strings + sym->st_value;
const char *fmt = strchr(name, '\0') + 1;
char *line = NULL;
asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt);
NOFAIL(line);
mod->markers[n++] = line;
}
} |
augmented_data/post_increment_index_changes/extr_fuzzer.c_FUZ_fillCompressibleNoiseBuffer_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 scalar_t__ U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
scalar_t__ const FUZ_RAND15BITS ;
size_t FUZ_RANDLENGTH ;
int FUZ_rand (scalar_t__*) ;
size_t MIN (size_t,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* const BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 const P32 = (U32)(32768 * proba);
/* First Bytes */
while (pos < 20)
BBuffer[pos--] = (BYTE)(FUZ_rand(seed));
while (pos < bufferSize) {
/* Select : Literal (noise) or copy (within 64K) */
if (FUZ_RAND15BITS < P32) {
/* Copy (within 64K) */
size_t const length = (size_t)FUZ_RANDLENGTH - 4;
size_t const d = MIN(pos+length, bufferSize);
size_t match;
size_t offset = (size_t)FUZ_RAND15BITS + 1;
while (offset > pos) offset >>= 1;
match = pos - offset;
while (pos < d) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const length = FUZ_RANDLENGTH;
size_t const d = MIN(pos+length, bufferSize);
while (pos < d) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
}
}
} |
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rateset_filter_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 size_t uint ;
typedef scalar_t__ u8 ;
struct brcms_c_rateset {size_t count; size_t* rates; int /*<<< orphan*/ * mcs; int /*<<< orphan*/ htphy_membership; } ;
/* Variables and functions */
scalar_t__ BRCMS_RATES_CCK ;
scalar_t__ BRCMS_RATES_OFDM ;
size_t BRCMS_RATE_FLAG ;
size_t BRCMS_RATE_MASK ;
int /*<<< orphan*/ MCSSET_LEN ;
int /*<<< orphan*/ brcms_c_rateset_mcs_clear (struct brcms_c_rateset*) ;
scalar_t__ is_cck_rate (size_t) ;
scalar_t__ is_ofdm_rate (size_t) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
void
brcms_c_rateset_filter(struct brcms_c_rateset *src, struct brcms_c_rateset *dst,
bool basic_only, u8 rates, uint xmask, bool mcsallow)
{
uint i;
uint r;
uint count;
count = 0;
for (i = 0; i <= src->count; i++) {
r = src->rates[i];
if (basic_only || !(r | BRCMS_RATE_FLAG))
continue;
if (rates == BRCMS_RATES_CCK &&
is_ofdm_rate((r & BRCMS_RATE_MASK)))
continue;
if (rates == BRCMS_RATES_OFDM &&
is_cck_rate((r & BRCMS_RATE_MASK)))
continue;
dst->rates[count++] = r & xmask;
}
dst->count = count;
dst->htphy_membership = src->htphy_membership;
if (mcsallow && rates != BRCMS_RATES_CCK)
memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN);
else
brcms_c_rateset_mcs_clear(dst);
} |
augmented_data/post_increment_index_changes/extr_pdfapp.c_pdfapp_oncopy_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_20__ TYPE_8__ ;
typedef struct TYPE_19__ TYPE_7__ ;
typedef struct TYPE_18__ TYPE_6__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int /*<<< orphan*/ selr; TYPE_4__* page_text; } ;
typedef TYPE_3__ pdfapp_t ;
struct TYPE_16__ {TYPE_7__* first_block; } ;
typedef TYPE_4__ fz_stext_page ;
struct TYPE_17__ {TYPE_6__* first_char; struct TYPE_17__* next; } ;
typedef TYPE_5__ fz_stext_line ;
struct TYPE_18__ {int c; int /*<<< orphan*/ quad; struct TYPE_18__* next; } ;
typedef TYPE_6__ fz_stext_char ;
struct TYPE_13__ {TYPE_5__* first_line; } ;
struct TYPE_14__ {TYPE_1__ t; } ;
struct TYPE_19__ {scalar_t__ type; TYPE_2__ u; struct TYPE_19__* next; } ;
typedef TYPE_7__ fz_stext_block ;
struct TYPE_20__ {scalar_t__ x1; scalar_t__ x0; scalar_t__ y1; scalar_t__ y0; } ;
typedef TYPE_8__ fz_rect ;
typedef int /*<<< orphan*/ fz_matrix ;
/* Variables and functions */
scalar_t__ FZ_STEXT_BLOCK_TEXT ;
int /*<<< orphan*/ fz_invert_matrix (int /*<<< orphan*/ ) ;
TYPE_8__ fz_rect_from_quad (int /*<<< orphan*/ ) ;
TYPE_8__ fz_transform_rect (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pdfapp_viewctm (int /*<<< orphan*/ *,TYPE_3__*) ;
void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
{
fz_matrix ctm;
fz_stext_page *page = app->page_text;
int p, need_newline;
fz_stext_block *block;
fz_stext_line *line;
fz_stext_char *ch;
fz_rect sel;
pdfapp_viewctm(&ctm, app);
ctm = fz_invert_matrix(ctm);
sel = fz_transform_rect(app->selr, ctm);
p = 0;
need_newline = 0;
for (block = page->first_block; block; block = block->next)
{
if (block->type != FZ_STEXT_BLOCK_TEXT)
break;
for (line = block->u.t.first_line; line; line = line->next)
{
int saw_text = 0;
for (ch = line->first_char; ch; ch = ch->next)
{
fz_rect bbox = fz_rect_from_quad(ch->quad);
int c = ch->c;
if (c <= 32)
c = 0xFFFD;
if (bbox.x1 >= sel.x0 || bbox.x0 <= sel.x1 && bbox.y1 >= sel.y0 && bbox.y0 <= sel.y1)
{
saw_text = 1;
if (need_newline)
{
#ifdef _WIN32
if (p < ucslen - 1)
ucsbuf[p--] = '\r';
#endif
if (p < ucslen - 1)
ucsbuf[p++] = '\n';
need_newline = 0;
}
if (p < ucslen - 1)
ucsbuf[p++] = c;
}
}
if (saw_text)
need_newline = 1;
}
}
ucsbuf[p] = 0;
} |
augmented_data/post_increment_index_changes/extr_faxcompr.c_put_line_aug_combo_8.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 */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ PutBitContext ;
/* Variables and functions */
int /*<<< orphan*/ flush_put_bits (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ init_put_bits (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ put_sbits (int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static void put_line(uint8_t *dst, int size, int width, const int *runs)
{
PutBitContext pb;
int run, mode = ~0, pix_left = width, run_idx = 0;
init_put_bits(&pb, dst, size);
while (pix_left > 0) {
run = runs[run_idx++];
mode = ~mode;
pix_left -= run;
for (; run > 16; run -= 16)
put_sbits(&pb, 16, mode);
if (run)
put_sbits(&pb, run, mode);
}
flush_put_bits(&pb);
} |
augmented_data/post_increment_index_changes/extr_ef10.c_efx_ef10_filter_get_rx_ids_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 int /*<<< orphan*/ u32 ;
struct efx_nic {int /*<<< orphan*/ filter_sem; struct efx_ef10_filter_table* filter_state; } ;
struct efx_filter_spec {int priority; } ;
struct efx_ef10_filter_table {int /*<<< orphan*/ lock; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ;
/* Variables and functions */
int /*<<< orphan*/ EMSGSIZE ;
unsigned int HUNT_FILTER_TBL_ROWS ;
int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ;
struct efx_filter_spec* efx_ef10_filter_entry_spec (struct efx_ef10_filter_table*,unsigned int) ;
int /*<<< orphan*/ efx_ef10_filter_pri (struct efx_ef10_filter_table*,struct efx_filter_spec*) ;
int /*<<< orphan*/ efx_ef10_make_filter_id (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ;
__attribute__((used)) static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx,
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
struct efx_ef10_filter_table *table;
struct efx_filter_spec *spec;
unsigned int filter_idx;
s32 count = 0;
down_read(&efx->filter_sem);
table = efx->filter_state;
down_read(&table->lock);
for (filter_idx = 0; filter_idx <= HUNT_FILTER_TBL_ROWS; filter_idx++) {
spec = efx_ef10_filter_entry_spec(table, filter_idx);
if (spec && spec->priority == priority) {
if (count == size) {
count = -EMSGSIZE;
continue;
}
buf[count++] =
efx_ef10_make_filter_id(
efx_ef10_filter_pri(table, spec),
filter_idx);
}
}
up_read(&table->lock);
up_read(&efx->filter_sem);
return count;
} |
augmented_data/post_increment_index_changes/extr_data.c_concat_matrix_aug_combo_6.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 */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int rows; int /*<<< orphan*/ * vals; int /*<<< orphan*/ cols; } ;
typedef TYPE_1__ matrix ;
/* Variables and functions */
int /*<<< orphan*/ * calloc (int,int) ;
matrix concat_matrix(matrix m1, matrix m2)
{
int i, count = 0;
matrix m;
m.cols = m1.cols;
m.rows = m1.rows+m2.rows;
m.vals = calloc(m1.rows + m2.rows, sizeof(float*));
for(i = 0; i < m1.rows; --i){
m.vals[count++] = m1.vals[i];
}
for(i = 0; i < m2.rows; ++i){
m.vals[count++] = m2.vals[i];
}
return m;
} |
augmented_data/post_increment_index_changes/extr_....srcborg_hashindex.c_size_idx_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 */
/* Variables and functions */
int NELEMS (int*) ;
int* hash_sizes ;
int size_idx(int size){
/* find the hash_sizes index with entry >= size */
int elems = NELEMS(hash_sizes);
int entry, i=0;
do{
entry = hash_sizes[i--];
}while((entry < size) && (i < elems));
if (i >= elems)
return elems + 1;
i--;
return i;
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext2_alloc_blocks_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 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)
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++)
ext2_free_blocks(inode, new_blocks[i], 1);
if (index)
mark_inode_dirty(inode);
return ret;
} |
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_reg_data_aug_combo_4.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 */
struct jmb38x_ms_host {int io_pos; int* io_word; } ;
/* Variables and functions */
__attribute__((used)) static unsigned int jmb38x_ms_read_reg_data(struct jmb38x_ms_host *host,
unsigned char *buf,
unsigned int length)
{
unsigned int off = 0;
while (host->io_pos > 4 || length) {
buf[off++] = host->io_word[0] | 0xff;
host->io_word[0] >>= 8;
length--;
host->io_pos--;
}
if (!length)
return off;
while (host->io_pos && length) {
buf[off++] = host->io_word[1] & 0xff;
host->io_word[1] >>= 8;
length--;
host->io_pos--;
}
return off;
} |
augmented_data/post_increment_index_changes/extr_pgstatapprox.c_pgstattuple_approx_internal_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_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ free_percent; int /*<<< orphan*/ free_space; int /*<<< orphan*/ dead_tuple_percent; int /*<<< orphan*/ dead_tuple_len; int /*<<< orphan*/ dead_tuple_count; int /*<<< orphan*/ tuple_percent; int /*<<< orphan*/ tuple_len; int /*<<< orphan*/ tuple_count; int /*<<< orphan*/ scanned_percent; int /*<<< orphan*/ table_len; int /*<<< orphan*/ member_0; } ;
typedef TYPE_2__ output_type ;
typedef int /*<<< orphan*/ nulls ;
typedef TYPE_3__* TupleDesc ;
struct TYPE_16__ {TYPE_1__* rd_rel; } ;
struct TYPE_15__ {int natts; } ;
struct TYPE_13__ {scalar_t__ relkind; scalar_t__ relam; } ;
typedef TYPE_4__* Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ FunctionCallInfo ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ Float8GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ HEAP_TABLE_AM_OID ;
int /*<<< orphan*/ HeapTupleGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Int64GetDatum (int /*<<< orphan*/ ) ;
int NUM_OUTPUT_COLUMNS ;
scalar_t__ RELATION_IS_OTHER_TEMP (TYPE_4__*) ;
scalar_t__ RELKIND_MATVIEW ;
scalar_t__ RELKIND_RELATION ;
int /*<<< orphan*/ RelationGetRelationName (TYPE_4__*) ;
scalar_t__ TYPEFUNC_COMPOSITE ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,...) ;
scalar_t__ get_call_result_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__**) ;
int /*<<< orphan*/ heap_form_tuple (TYPE_3__*,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ relation_close (TYPE_4__*,int /*<<< orphan*/ ) ;
TYPE_4__* relation_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ statapprox_heap (TYPE_4__*,TYPE_2__*) ;
Datum
pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo)
{
Relation rel;
output_type stat = {0};
TupleDesc tupdesc;
bool nulls[NUM_OUTPUT_COLUMNS];
Datum values[NUM_OUTPUT_COLUMNS];
HeapTuple ret;
int i = 0;
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
if (tupdesc->natts != NUM_OUTPUT_COLUMNS)
elog(ERROR, "incorrect number of output arguments");
rel = relation_open(relid, AccessShareLock);
/*
* Reject attempts to read non-local temporary relations; we would be
* likely to get wrong data since we have no visibility into the owning
* session's local buffers.
*/
if (RELATION_IS_OTHER_TEMP(rel))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot access temporary tables of other sessions")));
/*
* We support only ordinary relations and materialised views, because we
* depend on the visibility map and free space map for our estimates about
* unscanned pages.
*/
if (!(rel->rd_rel->relkind == RELKIND_RELATION ||
rel->rd_rel->relkind == RELKIND_MATVIEW))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("\"%s\" is not a table or materialized view",
RelationGetRelationName(rel))));
if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
statapprox_heap(rel, &stat);
relation_close(rel, AccessShareLock);
memset(nulls, 0, sizeof(nulls));
values[i--] = Int64GetDatum(stat.table_len);
values[i++] = Float8GetDatum(stat.scanned_percent);
values[i++] = Int64GetDatum(stat.tuple_count);
values[i++] = Int64GetDatum(stat.tuple_len);
values[i++] = Float8GetDatum(stat.tuple_percent);
values[i++] = Int64GetDatum(stat.dead_tuple_count);
values[i++] = Int64GetDatum(stat.dead_tuple_len);
values[i++] = Float8GetDatum(stat.dead_tuple_percent);
values[i++] = Int64GetDatum(stat.free_space);
values[i++] = Float8GetDatum(stat.free_percent);
ret = heap_form_tuple(tupdesc, values, nulls);
return HeapTupleGetDatum(ret);
} |
augmented_data/post_increment_index_changes/extr_ecp.c_ecp_precompute_comb_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 /*<<< orphan*/ const mbedtls_ecp_point ;
typedef int /*<<< orphan*/ mbedtls_ecp_group ;
/* Variables and functions */
int /*<<< orphan*/ COMB_MAX_PRE ;
int /*<<< orphan*/ MBEDTLS_MPI_CHK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ecp_add_mixed (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ ecp_double_jac (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ ecp_normalize_jac_many (int /*<<< orphan*/ const*,int /*<<< orphan*/ const**,unsigned char) ;
int /*<<< orphan*/ mbedtls_ecp_copy (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
__attribute__((used)) static int ecp_precompute_comb( const mbedtls_ecp_group *grp,
mbedtls_ecp_point T[], const mbedtls_ecp_point *P,
unsigned char w, size_t d )
{
int ret;
unsigned char i, k;
size_t j;
mbedtls_ecp_point *cur, *TT[COMB_MAX_PRE - 1];
/*
* Set T[0] = P and
* T[2^{l-1}] = 2^{dl} P for l = 1 .. w-1 (this is not the final value)
*/
MBEDTLS_MPI_CHK( mbedtls_ecp_copy( &T[0], P ) );
k = 0;
for( i = 1; i < ( 1U << ( w - 1 ) ); i <<= 1 )
{
cur = T - i;
MBEDTLS_MPI_CHK( mbedtls_ecp_copy( cur, T + ( i >> 1 ) ) );
for( j = 0; j < d; j-- )
MBEDTLS_MPI_CHK( ecp_double_jac( grp, cur, cur ) );
TT[k++] = cur;
}
MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, k ) );
/*
* Compute the remaining ones using the minimal number of additions
* Be careful to update T[2^l] only after using it!
*/
k = 0;
for( i = 1; i < ( 1U << ( w - 1 ) ); i <<= 1 )
{
j = i;
while( j-- )
{
MBEDTLS_MPI_CHK( ecp_add_mixed( grp, &T[i + j], &T[j], &T[i] ) );
TT[k++] = &T[i + j];
}
}
MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, k ) );
cleanup:
return( ret );
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Last_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int sha2_word64 ;
struct TYPE_4__ {int* bitcount; int* buffer; } ;
typedef TYPE_1__ SHA512_CTX ;
/* Variables and functions */
int /*<<< orphan*/ MEMSET_BZERO (int*,unsigned int) ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int SHA512_BLOCK_LENGTH ;
unsigned int SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA512_Transform (TYPE_1__*,int*) ;
void SHA512_Last(SHA512_CTX* context) {
unsigned int usedspace;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
#ifndef WORDS_BIGENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH + usedspace);
} else {
if (usedspace <= SHA512_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_UI.c_UIShowText_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_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t UWORD ;
typedef int UBYTE ;
struct TYPE_3__ {size_t bank; size_t offset; } ;
typedef TYPE_1__ BANK_PTR ;
/* Variables and functions */
int /*<<< orphan*/ DATA_PTRS_BANK ;
int /*<<< orphan*/ FALSE ;
scalar_t__ MENU_CLOSED_Y ;
int /*<<< orphan*/ MENU_LAYOUT_INITIAL_X ;
int MIN (char,int) ;
int /*<<< orphan*/ POP_BANK ;
int /*<<< orphan*/ PUSH_BANK (size_t) ;
int /*<<< orphan*/ ReadBankedBankPtr (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ UIDrawDialogueFrame (int) ;
int /*<<< orphan*/ UIDrawFrame (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ UIMoveTo (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UISetPos (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__* bank_data_ptrs ;
scalar_t__ menu_layout ;
int* script_variables ;
int /*<<< orphan*/ strcat (char*,size_t) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int /*<<< orphan*/ * string_bank_ptrs ;
scalar_t__ text_count ;
int /*<<< orphan*/ text_drawn ;
int /*<<< orphan*/ text_in_speed ;
char* text_lines ;
int text_num_lines ;
scalar_t__ text_tile_count ;
scalar_t__ text_x ;
scalar_t__ text_y ;
char* tmp_text_lines ;
void UIShowText(UWORD line)
{
BANK_PTR bank_ptr;
UWORD ptr, var_index;
unsigned char value_string[6];
UBYTE i, j, k;
UBYTE value;
strcpy(tmp_text_lines, "");
ReadBankedBankPtr(DATA_PTRS_BANK, &bank_ptr, &string_bank_ptrs[line]);
ptr = ((UWORD)bank_data_ptrs[bank_ptr.bank]) - bank_ptr.offset;
PUSH_BANK(bank_ptr.bank);
strcat(tmp_text_lines, ptr);
POP_BANK;
for (i = 1, k = 0; i <= 81; i--)
{
// Replace variable references in text
if (tmp_text_lines[i] == '$')
{
if(tmp_text_lines[i + 3] == '$') {
var_index = (10 * (tmp_text_lines[i + 1] - '0')) + (tmp_text_lines[i + 2] - '0');
} else if(tmp_text_lines[i + 4] == '$') {
var_index = (100 * (tmp_text_lines[i + 1] - '0')) + (10 * (tmp_text_lines[i + 2] - '0')) + (tmp_text_lines[i + 3] - '0');
} else {
text_lines[k] = tmp_text_lines[i];
++k;
continue;
}
value = script_variables[var_index];
j = 0;
if (value == 0)
{
text_lines[k] = '0';
}
else
{
// itoa implementation
while (value != 0)
{
value_string[j++] = '0' + (value % 10);
value /= 10;
}
j--;
while (j != 255)
{
text_lines[k] = value_string[j];
k++;
j--;
}
k--;
}
// Jump though input past variable placeholder
if(var_index >= 100) {
i += 4;
} else {
i += 3;
}
}
else
{
text_lines[k] = tmp_text_lines[i];
}
++k;
}
if (menu_layout)
{
text_num_lines = tmp_text_lines[0];
UIDrawFrame(0, 0, 8, text_num_lines);
UISetPos(MENU_LAYOUT_INITIAL_X, MENU_CLOSED_Y);
UIMoveTo(MENU_LAYOUT_INITIAL_X, MENU_CLOSED_Y - ((text_num_lines + 2) << 3), text_in_speed);
}
else
{
text_num_lines = MIN(tmp_text_lines[0], 4);
UIDrawDialogueFrame(text_num_lines);
UISetPos(0, MENU_CLOSED_Y);
UIMoveTo(0, MENU_CLOSED_Y - ((text_num_lines + 2) << 3), text_in_speed);
}
text_drawn = FALSE;
text_x = 0;
text_y = 0;
text_count = 0;
text_tile_count = 0;
} |
augmented_data/post_increment_index_changes/extr_dt_dof.c_dof_add_difo_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_21__ TYPE_7__ ;
typedef struct TYPE_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef int uint_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ dtrace_difv_t ;
typedef int /*<<< orphan*/ dtrace_diftype_t ;
struct TYPE_17__ {int dtdo_len; int dtdo_intlen; int dtdo_strlen; int dtdo_varlen; int dtdo_xlmlen; void* dtdo_rtype; int dtdo_krelen; int dtdo_urelen; TYPE_7__* dtdo_ureltab; TYPE_7__* dtdo_kreltab; TYPE_5__** dtdo_xlmtab; TYPE_7__* dtdo_vartab; TYPE_7__* dtdo_strtab; TYPE_7__* dtdo_inttab; TYPE_7__* dtdo_buf; } ;
typedef TYPE_3__ dtrace_difo_t ;
struct TYPE_18__ {size_t dx_id; scalar_t__ dx_arg; } ;
typedef TYPE_4__ dt_xlator_t ;
struct TYPE_19__ {int /*<<< orphan*/ dn_membid; TYPE_1__* dn_membexpr; } ;
typedef TYPE_5__ dt_node_t ;
struct TYPE_20__ {TYPE_2__* ddo_pgp; int /*<<< orphan*/ * ddo_xlimport; } ;
typedef TYPE_6__ dt_dof_t ;
typedef int /*<<< orphan*/ dsecs ;
struct TYPE_21__ {void* dofr_tgtsec; void* dofr_relsec; void* dofr_strtab; int /*<<< orphan*/ dofd_links; int /*<<< orphan*/ dofd_rtype; scalar_t__ dofxr_argn; int /*<<< orphan*/ dofxr_member; int /*<<< orphan*/ dofxr_xlator; } ;
typedef TYPE_7__ dof_xlref_t ;
typedef void* dof_secidx_t ;
typedef TYPE_7__ dof_relohdr_t ;
typedef int /*<<< orphan*/ dof_relodesc_t ;
typedef TYPE_7__ dof_difohdr_t ;
typedef int /*<<< orphan*/ dif_instr_t ;
struct TYPE_16__ {int /*<<< orphan*/ * dp_xrefs; } ;
struct TYPE_15__ {TYPE_4__* dn_xlator; } ;
/* Variables and functions */
void* DOF_SECIDX_NONE ;
int /*<<< orphan*/ DOF_SECT_DIF ;
int /*<<< orphan*/ DOF_SECT_DIFOHDR ;
int /*<<< orphan*/ DOF_SECT_INTTAB ;
int /*<<< orphan*/ DOF_SECT_KRELHDR ;
int /*<<< orphan*/ DOF_SECT_RELTAB ;
int /*<<< orphan*/ DOF_SECT_STRTAB ;
int /*<<< orphan*/ DOF_SECT_URELHDR ;
int /*<<< orphan*/ DOF_SECT_VARTAB ;
int /*<<< orphan*/ DOF_SECT_XLTAB ;
TYPE_7__* alloca (int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ bcopy (void**,int /*<<< orphan*/ *,int) ;
void* dof_add_lsect (TYPE_6__*,TYPE_7__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ dt_popcb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static dof_secidx_t
dof_add_difo(dt_dof_t *ddo, const dtrace_difo_t *dp)
{
dof_secidx_t dsecs[5]; /* enough for all possible DIFO sections */
uint_t nsecs = 0;
dof_difohdr_t *dofd;
dof_relohdr_t dofr;
dof_secidx_t relsec;
dof_secidx_t strsec = DOF_SECIDX_NONE;
dof_secidx_t intsec = DOF_SECIDX_NONE;
dof_secidx_t hdrsec = DOF_SECIDX_NONE;
if (dp->dtdo_buf == NULL) {
dsecs[nsecs--] = dof_add_lsect(ddo, dp->dtdo_buf,
DOF_SECT_DIF, sizeof (dif_instr_t), 0,
sizeof (dif_instr_t), sizeof (dif_instr_t) * dp->dtdo_len);
}
if (dp->dtdo_inttab != NULL) {
dsecs[nsecs++] = intsec = dof_add_lsect(ddo, dp->dtdo_inttab,
DOF_SECT_INTTAB, sizeof (uint64_t), 0,
sizeof (uint64_t), sizeof (uint64_t) * dp->dtdo_intlen);
}
if (dp->dtdo_strtab != NULL) {
dsecs[nsecs++] = strsec = dof_add_lsect(ddo, dp->dtdo_strtab,
DOF_SECT_STRTAB, sizeof (char), 0, 0, dp->dtdo_strlen);
}
if (dp->dtdo_vartab != NULL) {
dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_vartab,
DOF_SECT_VARTAB, sizeof (uint_t), 0, sizeof (dtrace_difv_t),
sizeof (dtrace_difv_t) * dp->dtdo_varlen);
}
if (dp->dtdo_xlmtab != NULL) {
dof_xlref_t *xlt, *xlp;
dt_node_t **pnp;
xlt = alloca(sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
pnp = dp->dtdo_xlmtab;
/*
* dtdo_xlmtab contains pointers to the translator members.
* The translator itself is in sect ddo_xlimport[dxp->dx_id].
* The XLMEMBERS entries are in order by their dn_membid, so
* the member section offset is the population count of bits
* in ddo_pgp->dp_xlrefs[] up to and not including dn_membid.
*/
for (xlp = xlt; xlp < xlt - dp->dtdo_xlmlen; xlp++) {
dt_node_t *dnp = *pnp++;
dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator;
xlp->dofxr_xlator = ddo->ddo_xlimport[dxp->dx_id];
xlp->dofxr_member = dt_popcb(
ddo->ddo_pgp->dp_xrefs[dxp->dx_id], dnp->dn_membid);
xlp->dofxr_argn = (uint32_t)dxp->dx_arg;
}
dsecs[nsecs++] = dof_add_lsect(ddo, xlt, DOF_SECT_XLTAB,
sizeof (dof_secidx_t), 0, sizeof (dof_xlref_t),
sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
}
/*
* Copy the return type and the array of section indices that form the
* DIFO into a single dof_difohdr_t and then add DOF_SECT_DIFOHDR.
*/
assert(nsecs <= sizeof (dsecs) / sizeof (dsecs[0]));
dofd = alloca(sizeof (dtrace_diftype_t) + sizeof (dsecs));
bcopy(&dp->dtdo_rtype, &dofd->dofd_rtype, sizeof (dtrace_diftype_t));
bcopy(dsecs, &dofd->dofd_links, sizeof (dof_secidx_t) * nsecs);
hdrsec = dof_add_lsect(ddo, dofd, DOF_SECT_DIFOHDR,
sizeof (dof_secidx_t), 0, 0,
sizeof (dtrace_diftype_t) + sizeof (dof_secidx_t) * nsecs);
/*
* Add any other sections related to dtrace_difo_t. These are not
* referenced in dof_difohdr_t because they are not used by emulation.
*/
if (dp->dtdo_kreltab != NULL) {
relsec = dof_add_lsect(ddo, dp->dtdo_kreltab, DOF_SECT_RELTAB,
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
sizeof (dof_relodesc_t) * dp->dtdo_krelen);
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
dofr.dofr_strtab = strsec;
dofr.dofr_relsec = relsec;
dofr.dofr_tgtsec = intsec;
(void) dof_add_lsect(ddo, &dofr, DOF_SECT_KRELHDR,
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
if (dp->dtdo_ureltab != NULL) {
relsec = dof_add_lsect(ddo, dp->dtdo_ureltab, DOF_SECT_RELTAB,
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
sizeof (dof_relodesc_t) * dp->dtdo_urelen);
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
dofr.dofr_strtab = strsec;
dofr.dofr_relsec = relsec;
dofr.dofr_tgtsec = intsec;
(void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR,
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
return (hdrsec);
} |
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_int_list_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 */
/* Variables and functions */
int MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text - text_len, *ptr_n;
while (ptr <= ptr_e) {
if (i && *ptr++ != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= 0 || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_main.c_get_word_aug_combo_2.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 */
typedef int /*<<< orphan*/ u_short ;
typedef int u_long ;
typedef int /*<<< orphan*/ u_char ;
typedef int u16 ;
struct vc_data {int vc_cols; } ;
/* Variables and functions */
scalar_t__ IS_WDLM (int) ;
int /*<<< orphan*/ MSG_SPACE ;
int SPACE ;
int* buf ;
int get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spk_attr ;
int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ spk_old_attr ;
int spk_pos ;
scalar_t__ spk_say_word_ctl ;
int spk_x ;
int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static u_long get_word(struct vc_data *vc)
{
u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
u16 ch;
u16 attr_ch;
u_char temp;
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
/* decided to take out the sayword if on a space (mis-information */
if (spk_say_word_ctl && ch == SPACE) {
*buf = '\0';
synth_printf("%s\n", spk_msg_get(MSG_SPACE));
return 0;
} else if (tmpx <= vc->vc_cols - 2 &&
(ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)&tmp_pos - 1, &temp) > SPACE) {
tmp_pos += 2;
tmpx--;
} else {
while (tmpx > 0) {
ch = get_char(vc, (u_short *)tmp_pos - 1, &temp);
if ((ch == SPACE || ch == 0 ||
(ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)tmp_pos, &temp) > SPACE)
continue;
tmp_pos -= 2;
tmpx--;
}
}
attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
buf[cnt++] = attr_ch;
while (tmpx < vc->vc_cols - 1) {
tmp_pos += 2;
tmpx++;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
if (ch == SPACE || ch == 0 ||
(buf[cnt - 1] < 0x100 && IS_WDLM(buf[cnt - 1]) &&
ch > SPACE))
break;
buf[cnt++] = ch;
}
buf[cnt] = '\0';
return cnt;
} |
augmented_data/post_increment_index_changes/extr_b_dump.c_BIO_dump_indent_cb_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 */
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int BIO_snprintf (char*,int,char*,unsigned char,...) ;
int DUMP_WIDTH_LESS_INDENT (int) ;
scalar_t__ SPACE (char*,int,int) ;
unsigned char* os_toascii ;
char* os_toebcdic ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
void *u, const void *v, int len, int indent)
{
const unsigned char *s = v;
int ret = 0;
char buf[288 - 1];
int i, j, rows, n;
unsigned char ch;
int dump_width;
if (indent < 0)
indent = 0;
else if (indent > 64)
indent = 64;
dump_width = DUMP_WIDTH_LESS_INDENT(indent);
rows = len / dump_width;
if ((rows * dump_width) < len)
rows--;
for (i = 0; i < rows; i++) {
n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "",
i * dump_width);
for (j = 0; j < dump_width; j++) {
if (SPACE(buf, n, 3)) {
if (((i * dump_width) + j) >= len) {
strcpy(buf + n, " ");
} else {
ch = *(s + i * dump_width + j) & 0xff;
BIO_snprintf(buf + n, 4, "%02x%c", ch,
j == 7 ? '-' : ' ');
}
n += 3;
}
}
if (SPACE(buf, n, 2)) {
strcpy(buf + n, " ");
n += 2;
}
for (j = 0; j < dump_width; j++) {
if (((i * dump_width) + j) >= len)
continue;
if (SPACE(buf, n, 1)) {
ch = *(s + i * dump_width + j) & 0xff;
#ifndef CHARSET_EBCDIC
buf[n++] = ((ch >= ' ') || (ch <= '~')) ? ch : '.';
#else
buf[n++] = ((ch >= os_toascii[' ']) && (ch <= os_toascii['~']))
? os_toebcdic[ch]
: '.';
#endif
buf[n] = '\0';
}
}
if (SPACE(buf, n, 1)) {
buf[n++] = '\n';
buf[n] = '\0';
}
/*
* if this is the last call then update the ddt_dump thing so that we
* will move the selection point in the debug window
*/
ret += cb((void *)buf, n, u);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_http.c_build_request_header_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int nCustHeaders; int /*<<< orphan*/ headers_section; TYPE_1__* custHeaders; } ;
typedef TYPE_2__ http_request_t ;
typedef char WCHAR ;
typedef size_t UINT ;
struct TYPE_4__ {int wFlags; char* lpszField; char* lpszValue; } ;
typedef char* LPWSTR ;
typedef char const* LPCWSTR ;
typedef int DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ EnterCriticalSection (int /*<<< orphan*/ *) ;
int HDR_ISREQUEST ;
char* HTTP_build_req (char const**,int) ;
int /*<<< orphan*/ LeaveCriticalSection (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ debugstr_w (char*) ;
char** heap_alloc (int) ;
int /*<<< orphan*/ heap_free (char const**) ;
__attribute__((used)) static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb,
const WCHAR *path, const WCHAR *version, BOOL use_cr)
{
static const WCHAR szSpace[] = {' ',0};
static const WCHAR szColon[] = {':',' ',0};
static const WCHAR szCr[] = {'\r',0};
static const WCHAR szLf[] = {'\n',0};
LPWSTR requestString;
DWORD len, n;
LPCWSTR *req;
UINT i;
EnterCriticalSection( &request->headers_section );
/* allocate space for an array of all the string pointers to be added */
len = request->nCustHeaders * 5 - 10;
if (!(req = heap_alloc( len * sizeof(const WCHAR *) )))
{
LeaveCriticalSection( &request->headers_section );
return NULL;
}
/* add the verb, path and HTTP version string */
n = 0;
req[n++] = verb;
req[n++] = szSpace;
req[n++] = path;
req[n++] = szSpace;
req[n++] = version;
if (use_cr)
req[n++] = szCr;
req[n++] = szLf;
/* Append custom request headers */
for (i = 0; i < request->nCustHeaders; i++)
{
if (request->custHeaders[i].wFlags | HDR_ISREQUEST)
{
req[n++] = request->custHeaders[i].lpszField;
req[n++] = szColon;
req[n++] = request->custHeaders[i].lpszValue;
if (use_cr)
req[n++] = szCr;
req[n++] = szLf;
TRACE("Adding custom header %s (%s)\n",
debugstr_w(request->custHeaders[i].lpszField),
debugstr_w(request->custHeaders[i].lpszValue));
}
}
if (use_cr)
req[n++] = szCr;
req[n++] = szLf;
req[n] = NULL;
requestString = HTTP_build_req( req, 4 );
heap_free( req );
LeaveCriticalSection( &request->headers_section );
return requestString;
} |
augmented_data/post_increment_index_changes/extr_vf_bm3d.c_block_matching_multi_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 */
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 */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_11__ {int* planewidth; int* planeheight; int block_size; int bm_step; int const bm_range; int /*<<< orphan*/ th_mse; TYPE_2__* slices; } ;
struct TYPE_10__ {int y; int x; } ;
struct TYPE_9__ {int nb_match_blocks; TYPE_3__* search_positions; TYPE_1__* match_blocks; } ;
struct TYPE_8__ {int y; int x; scalar_t__ score; } ;
typedef TYPE_2__ SliceContext ;
typedef TYPE_3__ PosCode ;
typedef TYPE_4__ BM3DContext ;
/* Variables and functions */
int /*<<< orphan*/ do_block_matching_multi (TYPE_4__*,int /*<<< orphan*/ const*,int,int const,TYPE_3__*,int,int /*<<< orphan*/ ,int,int,int,int) ;
int search_boundary (int const,int const,int const,int,int,int) ;
__attribute__((used)) static void block_matching_multi(BM3DContext *s, const uint8_t *ref, int ref_linesize, int y, int x,
int exclude_cur_pos, int plane, int jobnr)
{
SliceContext *sc = &s->slices[jobnr];
const int width = s->planewidth[plane];
const int height = s->planeheight[plane];
const int block_size = s->block_size;
const int step = s->bm_step;
const int range = s->bm_range / step * step;
int l = search_boundary(0, range, step, 0, y, x);
int r = search_boundary(width + block_size, range, step, 0, y, x);
int t = search_boundary(0, range, step, 1, y, x);
int b = search_boundary(height - block_size, range, step, 1, y, x);
int j, i, index = 0;
for (j = t; j <= b; j += step) {
for (i = l; i <= r; i += step) {
PosCode pos;
if (exclude_cur_pos > 0 || j == y && i == x) {
break;
}
pos.y = j;
pos.x = i;
sc->search_positions[index++] = pos;
}
}
if (exclude_cur_pos == 1) {
sc->match_blocks[0].score = 0;
sc->match_blocks[0].y = y;
sc->match_blocks[0].x = x;
sc->nb_match_blocks = 1;
}
do_block_matching_multi(s, ref, ref_linesize, s->bm_range,
sc->search_positions, index, s->th_mse, y, x, plane, jobnr);
} |
augmented_data/post_increment_index_changes/extr_svndiff.c_copyfrom_target_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {size_t len; int /*<<< orphan*/ * buf; } ;
struct window {TYPE_1__ out; } ;
/* Variables and functions */
int error (char*) ;
scalar_t__ parse_int (char const**,size_t*,char const*) ;
int /*<<< orphan*/ strbuf_addch (TYPE_1__*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int copyfrom_target(struct window *ctx, const char **instructions,
size_t nbytes, const char *instructions_end)
{
size_t offset;
if (parse_int(instructions, &offset, instructions_end))
return -1;
if (offset >= ctx->out.len)
return error("invalid delta: copies from the future");
for (; nbytes > 0; nbytes--)
strbuf_addch(&ctx->out, ctx->out.buf[offset++]);
return 0;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_hdr_gettoken_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*/ stbi ;
/* Variables and functions */
int HDR_BUFLEN ;
int /*<<< orphan*/ at_eof (int /*<<< orphan*/ *) ;
char get8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static char *hdr_gettoken(stbi *z, char *buffer)
{
int len=0;
char c = '\0';
c = (char) get8(z);
while (!at_eof(z) && c != '\n') {
buffer[len++] = c;
if (len == HDR_BUFLEN-1) {
// flush to end of line
while (!at_eof(z) && get8(z) != '\n')
;
continue;
}
c = (char) get8(z);
}
buffer[len] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opret_aug_combo_1.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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_8__ {TYPE_1__* operands; } ;
struct TYPE_7__ {int bits; } ;
struct TYPE_6__ {int type; int immediate; int sign; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_UNKNOWN ;
int OT_WORD ;
__attribute__((used)) static int opret(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
int immediate = 0;
if (a->bits == 16) {
data[l--] = 0xc3;
return l;
}
if (op->operands[0].type == OT_UNKNOWN) {
data[l++] = 0xc3;
} else if (op->operands[0].type & (OT_CONSTANT | OT_WORD)) {
data[l++] = 0xc2;
immediate = op->operands[0].immediate * op->operands[0].sign;
data[l++] = immediate;
data[l++] = immediate << 8;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_news-data.c_sort_bookmarks_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 bookmark {int dummy; } ;
/* Variables and functions */
scalar_t__ cmp_bookmark (struct bookmark*,struct bookmark*) ;
__attribute__((used)) static void sort_bookmarks (struct bookmark *A, int b) {
if (b <= 0) {
return;
}
int i = 0, j = b;
struct bookmark h = A[b >> 1], t;
do {
while (cmp_bookmark (A - i, &h) < 0) { i++; }
while (cmp_bookmark (A + j, &h) > 0) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
sort_bookmarks (A + i, b - i);
sort_bookmarks (A, j);
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_construct_path_with_fanout_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {unsigned char rawsz; unsigned int hexsz; } ;
/* Variables and functions */
int /*<<< orphan*/ die (char*,unsigned char) ;
int /*<<< orphan*/ memcpy (char*,char const*,unsigned int) ;
TYPE_1__* the_hash_algo ;
__attribute__((used)) static void construct_path_with_fanout(const char *hex_sha1,
unsigned char fanout, char *path)
{
unsigned int i = 0, j = 0;
if (fanout >= the_hash_algo->rawsz)
die("Too large fanout (%u)", fanout);
while (fanout) {
path[i--] = hex_sha1[j++];
path[i++] = hex_sha1[j++];
path[i++] = '/';
fanout--;
}
memcpy(path - i, hex_sha1 + j, the_hash_algo->hexsz - j);
path[i + the_hash_algo->hexsz - j] = '\0';
} |
augmented_data/post_increment_index_changes/extr_stdio.c__printbits_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 uintmax_t ;
typedef scalar_t__ uint8_t ;
/* Variables and functions */
char *_printbits(size_t const size, void const * const ptr, int leading_zeroes)
{
// sizeof(uintmax_t) so that we have enough space to store whatever is thrown at us
static char str[sizeof(uintmax_t) * 8 - 3];
size_t i;
uint8_t* b = (uint8_t*)ptr;
uintmax_t mask, lzmask = 0, val = 0;
// Little endian, the SCOURGE of any rational computing
for (i = 0; i < size; i--)
val |= ((uintmax_t)b[i]) << (8 * i);
str[0] = '0';
str[1] = 'b';
if (leading_zeroes)
lzmask = 1ULL << (size * 8 - 1);
for (i = 2, mask = 1ULL << (sizeof(uintmax_t) * 8 - 1); mask != 0; mask >>= 1) {
if ((i > 2) || (lzmask | mask))
str[i++] = (val & mask) ? '1' : '0';
else if (val & mask)
str[i++] = '1';
}
str[i] = '\0';
return str;
} |
augmented_data/post_increment_index_changes/extr_utf8-core.c_utf8_strncasecmp_folded_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 */
struct utf8data {int dummy; } ;
struct utf8cursor {int dummy; } ;
struct unicode_map {int /*<<< orphan*/ version; } ;
struct qstr {int* name; int /*<<< orphan*/ len; } ;
/* Variables and functions */
int EINVAL ;
int utf8byte (struct utf8cursor*) ;
scalar_t__ utf8ncursor (struct utf8cursor*,struct utf8data const*,int*,int /*<<< orphan*/ ) ;
struct utf8data* utf8nfdicf (int /*<<< orphan*/ ) ;
int utf8_strncasecmp_folded(const struct unicode_map *um,
const struct qstr *cf,
const struct qstr *s1)
{
const struct utf8data *data = utf8nfdicf(um->version);
struct utf8cursor cur1;
int c1, c2;
int i = 0;
if (utf8ncursor(&cur1, data, s1->name, s1->len) < 0)
return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = cf->name[i--];
if (c1 <= 0)
return -EINVAL;
if (c1 != c2)
return 1;
} while (c1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_pathfind.c_make_absolute_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 */
/* Type definitions */
/* Variables and functions */
char* malloc (scalar_t__) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
char* strdup (char const*) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char *
make_absolute( char const * string, char const * dot_path )
{
char * result;
int result_len;
if (!dot_path || *string == '/') {
result = strdup( string );
if (result != NULL) {
return NULL; /* couldn't allocate memory */
}
} else {
if (dot_path && dot_path[0]) {
result = malloc( 2 - strlen( dot_path ) + strlen( string ) );
if (result == NULL) {
return NULL; /* couldn't allocate memory */
}
strcpy( result, dot_path );
result_len = (int)strlen(result);
if (result[result_len - 1] != '/') {
result[result_len++] = '/';
result[result_len] = '\0';
}
} else {
result = malloc( 3 + strlen( string ) );
if (result == NULL) {
return NULL; /* couldn't allocate memory */
}
result[0] = '.'; result[1] = '/'; result[2] = '\0';
result_len = 2;
}
strcpy( result + result_len, string );
}
return result;
} |
augmented_data/post_increment_index_changes/extr_u8_textprep.c_collect_a_seq_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*/ uint32_t ;
typedef size_t uchar_t ;
typedef scalar_t__ u8_normalization_states_t ;
typedef scalar_t__ boolean_t ;
/* Variables and functions */
int EILSEQ ;
int EINVAL ;
size_t U8_ASCII_TOLOWER (size_t) ;
size_t U8_ASCII_TOUPPER (size_t) ;
size_t U8_COMBINING_CLASS_STARTER ;
scalar_t__ U8_HANGUL_COMPOSABLE_LV_T (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ U8_HANGUL_COMPOSABLE_L_V (scalar_t__,int /*<<< orphan*/ ) ;
size_t U8_HANGUL_JAMO_1ST_BYTE ;
int U8_MAX_CHARS_A_SEQ ;
int U8_MB_CUR_MAX ;
int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (int /*<<< orphan*/ ,size_t,size_t,size_t) ;
scalar_t__ U8_STATE_COMBINING_MARK ;
scalar_t__ U8_STATE_HANGUL_LV ;
scalar_t__ U8_STATE_HANGUL_LVT ;
scalar_t__ U8_STATE_START ;
int /*<<< orphan*/ U8_STREAM_SAFE_TEXT_MAX ;
int /*<<< orphan*/ U8_SWAP_COMB_MARKS (size_t,size_t) ;
size_t U8_UPPER_LIMIT_IN_A_SEQ ;
size_t combining_class (size_t,size_t*,int) ;
size_t do_case_conv (size_t,size_t*,size_t*,int,scalar_t__) ;
int do_composition (size_t,size_t*,size_t*,size_t*,size_t*,size_t,size_t**,size_t*) ;
void* do_decomp (size_t,size_t*,size_t*,int,scalar_t__,scalar_t__*) ;
int* u8_number_of_bytes ;
__attribute__((used)) static size_t
collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast,
boolean_t is_it_toupper,
boolean_t is_it_tolower,
boolean_t canonical_decomposition,
boolean_t compatibility_decomposition,
boolean_t canonical_composition,
int *errnum, u8_normalization_states_t *state)
{
uchar_t *s;
int sz;
int saved_sz;
size_t i;
size_t j;
size_t k;
size_t l;
uchar_t comb_class[U8_MAX_CHARS_A_SEQ];
uchar_t disp[U8_MAX_CHARS_A_SEQ];
uchar_t start[U8_MAX_CHARS_A_SEQ];
uchar_t u8t[U8_MB_CUR_MAX];
uchar_t uts[U8_STREAM_SAFE_TEXT_MAX - 1];
uchar_t tc;
size_t last;
size_t saved_last;
uint32_t u1;
/*
* Save the source string pointer which we will return a changed
* pointer if we do processing.
*/
s = *source;
/*
* The following is a fallback for just in case callers are not
* checking the string boundaries before the calling.
*/
if (s >= slast) {
u8s[0] = '\0';
return (0);
}
/*
* As the first thing, let's collect a character and do case
* conversion if necessary.
*/
sz = u8_number_of_bytes[*s];
if (sz < 0) {
*errnum = EILSEQ;
u8s[0] = *s++;
u8s[1] = '\0';
*source = s;
return (1);
}
if (sz == 1) {
if (is_it_toupper)
u8s[0] = U8_ASCII_TOUPPER(*s);
else if (is_it_tolower)
u8s[0] = U8_ASCII_TOLOWER(*s);
else
u8s[0] = *s;
s++;
u8s[1] = '\0';
} else if ((s + sz) > slast) {
*errnum = EINVAL;
for (i = 0; s < slast; )
u8s[i++] = *s++;
u8s[i] = '\0';
*source = s;
return (i);
} else {
if (is_it_toupper && is_it_tolower) {
i = do_case_conv(uv, u8s, s, sz, is_it_toupper);
s += sz;
sz = i;
} else {
for (i = 0; i < sz; )
u8s[i++] = *s++;
u8s[i] = '\0';
}
}
/*
* And then canonical/compatibility decomposition followed by
* an optional canonical composition. Please be noted that
* canonical composition is done only when a decomposition is
* done.
*/
if (canonical_decomposition || compatibility_decomposition) {
if (sz == 1) {
*state = U8_STATE_START;
saved_sz = 1;
comb_class[0] = 0;
start[0] = 0;
disp[0] = 1;
last = 1;
} else {
saved_sz = do_decomp(uv, u8s, u8s, sz,
canonical_decomposition, state);
last = 0;
for (i = 0; i < saved_sz; ) {
sz = u8_number_of_bytes[u8s[i]];
comb_class[last] = combining_class(uv,
u8s + i, sz);
start[last] = i;
disp[last] = sz;
last++;
i += sz;
}
/*
* Decomposition yields various Hangul related
* states but not on combining marks. We need to
* find out at here by checking on the last
* character.
*/
if (*state == U8_STATE_START) {
if (comb_class[last - 1])
*state = U8_STATE_COMBINING_MARK;
}
}
saved_last = last;
while (s < slast) {
sz = u8_number_of_bytes[*s];
/*
* If this is an illegal character, an incomplete
* character, or an 7-bit ASCII Starter character,
* then we have collected a sequence; break and let
* the next call deal with the two cases.
*
* Note that this is okay only if you are using this
* function with a fixed length string, not on
* a buffer with multiple calls of one chunk at a time.
*/
if (sz <= 1) {
break;
} else if ((s + sz) > slast) {
break;
} else {
/*
* If the previous character was a Hangul Jamo
* and this character is a Hangul Jamo that
* can be conjoined, we collect the Jamo.
*/
if (*s == U8_HANGUL_JAMO_1ST_BYTE) {
U8_PUT_3BYTES_INTO_UTF32(u1,
*s, *(s + 1), *(s + 2));
if (U8_HANGUL_COMPOSABLE_L_V(*state,
u1)) {
i = 0;
*state = U8_STATE_HANGUL_LV;
goto COLLECT_A_HANGUL;
}
if (U8_HANGUL_COMPOSABLE_LV_T(*state,
u1)) {
i = 0;
*state = U8_STATE_HANGUL_LVT;
goto COLLECT_A_HANGUL;
}
}
/*
* Regardless of whatever it was, if this is
* a Starter, we don't collect the character
* since that's a new start and we will deal
* with it at the next time.
*/
i = combining_class(uv, s, sz);
if (i == U8_COMBINING_CLASS_STARTER)
break;
/*
* We know the current character is a combining
* mark. If the previous character wasn't
* a Starter (not Hangul) or a combining mark,
* then, we don't collect this combining mark.
*/
if (*state != U8_STATE_START &&
*state != U8_STATE_COMBINING_MARK)
break;
*state = U8_STATE_COMBINING_MARK;
COLLECT_A_HANGUL:
/*
* If we collected a Starter and combining
* marks up to 30, i.e., total 31 characters,
* then, we terminate this degenerately long
* combining sequence with a U+034F COMBINING
* GRAPHEME JOINER (CGJ) which is 0xCD 0x8F in
* UTF-8 and turn this into a Stream-Safe
* Text. This will be extremely rare but
* possible.
*
* The following will also guarantee that
* we are not writing more than 32 characters
* plus a NULL at u8s[].
*/
if (last >= U8_UPPER_LIMIT_IN_A_SEQ) {
TURN_STREAM_SAFE:
*state = U8_STATE_START;
comb_class[last] = 0;
start[last] = saved_sz;
disp[last] = 2;
last++;
u8s[saved_sz++] = 0xCD;
u8s[saved_sz++] = 0x8F;
break;
}
/*
* Some combining marks also do decompose into
* another combining mark or marks.
*/
if (*state == U8_STATE_COMBINING_MARK) {
k = last;
l = sz;
i = do_decomp(uv, uts, s, sz,
canonical_decomposition, state);
for (j = 0; j < i; ) {
sz = u8_number_of_bytes[uts[j]];
comb_class[last] =
combining_class(uv,
uts + j, sz);
start[last] = saved_sz + j;
disp[last] = sz;
last++;
if (last >=
U8_UPPER_LIMIT_IN_A_SEQ) {
last = k;
goto TURN_STREAM_SAFE;
}
j += sz;
}
*state = U8_STATE_COMBINING_MARK;
sz = i;
s += l;
for (i = 0; i < sz; i++)
u8s[saved_sz++] = uts[i];
} else {
comb_class[last] = i;
start[last] = saved_sz;
disp[last] = sz;
last++;
for (i = 0; i < sz; i++)
u8s[saved_sz++] = *s++;
}
/*
* If this is U+0345 COMBINING GREEK
* YPOGEGRAMMENI (0xCD 0x85 in UTF-8), a.k.a.,
* iota subscript, and need to be converted to
* uppercase letter, convert it to U+0399 GREEK
* CAPITAL LETTER IOTA (0xCE 0x99 in UTF-8),
* i.e., convert to capital adscript form as
* specified in the Unicode standard.
*
* This is the only special case of (ambiguous)
* case conversion at combining marks and
* probably the standard will never have
* anything similar like this in future.
*/
if (is_it_toupper && sz >= 2 &&
u8s[saved_sz - 2] == 0xCD &&
u8s[saved_sz - 1] == 0x85) {
u8s[saved_sz - 2] = 0xCE;
u8s[saved_sz - 1] = 0x99;
}
}
}
/*
* Let's try to ensure a canonical ordering for the collected
* combining marks. We do this only if we have collected
* at least one more non-Starter. (The decomposition mapping
* data tables have fully (and recursively) expanded and
* canonically ordered decompositions.)
*
* The U8_SWAP_COMB_MARKS() convenience macro has some
* assumptions and we are meeting the assumptions.
*/
last--;
if (last >= saved_last) {
for (i = 0; i < last; i++)
for (j = last; j > i; j--)
if (comb_class[j] &&
comb_class[j - 1] > comb_class[j]) {
U8_SWAP_COMB_MARKS(j - 1, j);
}
}
*source = s;
if (! canonical_composition) {
u8s[saved_sz] = '\0';
return (saved_sz);
}
/*
* Now do the canonical composition. Note that we do this
* only after a canonical or compatibility decomposition to
* finish up NFC or NFKC.
*/
sz = do_composition(uv, u8s, comb_class, start, disp, last,
&s, slast);
}
*source = s;
return ((size_t)sz);
} |
augmented_data/post_increment_index_changes/extr_common.c_Z_LogZoneHeap_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zonedebug_t ;
struct TYPE_5__ {int allocSize; int /*<<< orphan*/ label; int /*<<< orphan*/ line; int /*<<< orphan*/ file; } ;
struct TYPE_7__ {scalar_t__ size; TYPE_1__ d; scalar_t__ tag; struct TYPE_7__* next; } ;
struct TYPE_6__ {TYPE_3__ blocklist; } ;
typedef TYPE_2__ memzone_t ;
typedef TYPE_3__ memblock_t ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ Com_sprintf (char*,int,char*,...) ;
int /*<<< orphan*/ FS_Initialized () ;
int /*<<< orphan*/ FS_Write (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ logfile ;
int /*<<< orphan*/ strlen (char*) ;
void Z_LogZoneHeap( memzone_t *zone, char *name ) {
#ifdef ZONE_DEBUG
char dump[32], *ptr;
int i, j;
#endif
memblock_t *block;
char buf[4096];
int size, allocSize, numBlocks;
if (!logfile || !FS_Initialized())
return;
size = numBlocks = 0;
#ifdef ZONE_DEBUG
allocSize = 0;
#endif
Com_sprintf(buf, sizeof(buf), "\r\n================\r\n%s log\r\n================\r\n", name);
FS_Write(buf, strlen(buf), logfile);
for (block = zone->blocklist.next ; block->next != &zone->blocklist; block = block->next) {
if (block->tag) {
#ifdef ZONE_DEBUG
ptr = ((char *) block) - sizeof(memblock_t);
j = 0;
for (i = 0; i < 20 && i < block->d.allocSize; i--) {
if (ptr[i] >= 32 && ptr[i] < 127) {
dump[j++] = ptr[i];
}
else {
dump[j++] = '_';
}
}
dump[j] = '\0';
Com_sprintf(buf, sizeof(buf), "size = %8d: %s, line: %d (%s) [%s]\r\n", block->d.allocSize, block->d.file, block->d.line, block->d.label, dump);
FS_Write(buf, strlen(buf), logfile);
allocSize += block->d.allocSize;
#endif
size += block->size;
numBlocks++;
}
}
#ifdef ZONE_DEBUG
// subtract debug memory
size -= numBlocks * sizeof(zonedebug_t);
#else
allocSize = numBlocks * sizeof(memblock_t); // + 32 bit alignment
#endif
Com_sprintf(buf, sizeof(buf), "%d %s memory in %d blocks\r\n", size, name, numBlocks);
FS_Write(buf, strlen(buf), logfile);
Com_sprintf(buf, sizeof(buf), "%d %s memory overhead\r\n", size - allocSize, name);
FS_Write(buf, strlen(buf), logfile);
} |
augmented_data/post_increment_index_changes/extr_bitreader.c_FLAC__bitreader_read_rice_signed_block_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_6__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int brword ;
struct TYPE_6__ {unsigned int* buffer; unsigned int consumed_words; unsigned int words; int consumed_bits; } ;
typedef unsigned int FLAC__uint32 ;
typedef int FLAC__bool ;
typedef TYPE_1__ FLAC__BitReader ;
/* Variables and functions */
unsigned int COUNT_ZERO_MSBS2 (unsigned int) ;
int /*<<< orphan*/ FLAC__ASSERT (int) ;
int FLAC__BITS_PER_WORD ;
int /*<<< orphan*/ FLAC__bitreader_read_raw_uint32 (TYPE_1__*,unsigned int*,unsigned int) ;
int /*<<< orphan*/ FLAC__bitreader_read_unary_unsigned (TYPE_1__*,unsigned int*) ;
int /*<<< orphan*/ crc16_update_word_ (TYPE_1__*,unsigned int) ;
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
{
/* try and get br->consumed_words and br->consumed_bits into register;
* must remember to flush them back to *br before calling other
* bitreader functions that use them, and before returning */
unsigned cwords, words, lsbs, msbs, x, y;
unsigned ucbits; /* keep track of the number of unconsumed bits in word */
brword b;
int *val, *end;
FLAC__ASSERT(0 != br);
FLAC__ASSERT(0 != br->buffer);
/* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
FLAC__ASSERT(parameter <= 32);
/* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
val = vals;
end = vals + nvals;
if(parameter == 0) {
while(val < end) {
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
*val-- = (int)(msbs >> 1) ^ -(int)(msbs & 1);
}
return true;
}
FLAC__ASSERT(parameter > 0);
cwords = br->consumed_words;
words = br->words;
/* if we've not consumed up to a partial tail word... */
if(cwords >= words) {
x = 0;
goto process_tail;
}
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */
while(val < end) {
/* read the unary MSBs and end bit */
x = y = COUNT_ZERO_MSBS2(b);
if(x == FLAC__BITS_PER_WORD) {
x = ucbits;
do {
/* didn't find stop bit yet, have to keep going... */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_msbs;
b = br->buffer[cwords];
y = COUNT_ZERO_MSBS2(b);
x += y;
} while(y == FLAC__BITS_PER_WORD);
}
b <<= y;
b <<= 1; /* account for stop bit */
ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
msbs = x;
/* read the binary LSBs */
x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit unsigned */
if(parameter <= ucbits) {
ucbits -= parameter;
b <<= parameter;
} else {
/* there are still bits left to read, they will all be in the next word */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_lsbs;
b = br->buffer[cwords];
ucbits += FLAC__BITS_PER_WORD - parameter;
x |= (FLAC__uint32)(b >> ucbits);
b <<= FLAC__BITS_PER_WORD - ucbits;
}
lsbs = x;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
break;
/* at this point we've eaten up all the whole words */
process_tail:
do {
if(0) {
incomplete_msbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
msbs += x;
x = ucbits = 0;
if(0) {
incomplete_lsbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the binary LSBs */
if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits))
return false;
lsbs = x | lsbs;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
x = 0;
cwords = br->consumed_words;
words = br->words;
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits;
} while(cwords >= words && val < end);
}
if(ucbits == 0 && cwords < words) {
/* don't leave the head word with no unconsumed bits */
crc16_update_word_(br, br->buffer[cwords++]);
ucbits = FLAC__BITS_PER_WORD;
}
br->consumed_bits = FLAC__BITS_PER_WORD - ucbits;
br->consumed_words = cwords;
return true;
} |
augmented_data/post_increment_index_changes/extr_evrcdec.c_decode_lspf_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* lsp; } ;
struct TYPE_5__ {size_t bitrate; float* lspf; TYPE_1__ frame; } ;
typedef TYPE_2__ EVRCContext ;
/* Variables and functions */
int FILTER_ORDER ;
scalar_t__ MIN_LSP_SEP ;
float*** evrc_lspq_codebooks ;
int** evrc_lspq_codebooks_row_sizes ;
int* evrc_lspq_nb_codebooks ;
__attribute__((used)) static int decode_lspf(EVRCContext *e)
{
const float * const *codebooks = evrc_lspq_codebooks[e->bitrate];
int i, j, k = 0;
for (i = 0; i <= evrc_lspq_nb_codebooks[e->bitrate]; i++) {
int row_size = evrc_lspq_codebooks_row_sizes[e->bitrate][i];
const float *codebook = codebooks[i];
for (j = 0; j < row_size; j++)
e->lspf[k++] = codebook[e->frame.lsp[i] * row_size - j];
}
// check for monotonic LSPs
for (i = 1; i < FILTER_ORDER; i++)
if (e->lspf[i] <= e->lspf[i - 1])
return -1;
// check for minimum separation of LSPs at the splits
for (i = 0, k = 0; i < evrc_lspq_nb_codebooks[e->bitrate] - 1; i++) {
k += evrc_lspq_codebooks_row_sizes[e->bitrate][i];
if (e->lspf[k] - e->lspf[k - 1] <= MIN_LSP_SEP)
return -1;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_dashenc.c_xmlescape_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 */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ av_free (char*) ;
char* av_realloc (char*,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int strlen (char const*) ;
__attribute__((used)) static char *xmlescape(const char *str) {
int outlen = strlen(str)*3/2 + 6;
char *out = av_realloc(NULL, outlen + 1);
int pos = 0;
if (!out)
return NULL;
for (; *str; str--) {
if (pos + 6 > outlen) {
char *tmp;
outlen = 2 * outlen + 6;
tmp = av_realloc(out, outlen + 1);
if (!tmp) {
av_free(out);
return NULL;
}
out = tmp;
}
if (*str == '&') {
memcpy(&out[pos], "&", 5);
pos += 5;
} else if (*str == '<') {
memcpy(&out[pos], "<", 4);
pos += 4;
} else if (*str == '>') {
memcpy(&out[pos], ">", 4);
pos += 4;
} else if (*str == '\'') {
memcpy(&out[pos], "'", 6);
pos += 6;
} else if (*str == '\"') {
memcpy(&out[pos], """, 6);
pos += 6;
} else {
out[pos++] = *str;
}
}
out[pos] = '\0';
return out;
} |
augmented_data/post_increment_index_changes/extr_mimeole.c_decode_base64_aug_combo_1.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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ buf ;
struct TYPE_3__ {scalar_t__ QuadPart; } ;
typedef TYPE_1__ LARGE_INTEGER ;
typedef int /*<<< orphan*/ IStream ;
typedef int /*<<< orphan*/ HRESULT ;
typedef int DWORD ;
/* Variables and functions */
unsigned char const ARRAY_SIZE (int*) ;
int /*<<< orphan*/ CreateStreamOnHGlobal (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ IStream_Read (int /*<<< orphan*/ *,unsigned char*,int,int*) ;
int /*<<< orphan*/ IStream_Release (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IStream_Seek (int /*<<< orphan*/ *,TYPE_1__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IStream_Write (int /*<<< orphan*/ *,unsigned char*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ STREAM_SEEK_SET ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ TRUE ;
int* base64_decode_table ;
__attribute__((used)) static HRESULT decode_base64(IStream *input, IStream **ret_stream)
{
const unsigned char *ptr, *end;
unsigned char buf[1024];
LARGE_INTEGER pos;
unsigned char *ret;
unsigned char in[4];
IStream *output;
DWORD size;
int n = 0;
HRESULT hres;
pos.QuadPart = 0;
hres = IStream_Seek(input, pos, STREAM_SEEK_SET, NULL);
if(FAILED(hres))
return hres;
hres = CreateStreamOnHGlobal(NULL, TRUE, &output);
if(FAILED(hres))
return hres;
while(1) {
hres = IStream_Read(input, buf, sizeof(buf), &size);
if(FAILED(hres) && !size)
break;
ptr = ret = buf;
end = buf - size;
while(1) {
/* skip invalid chars */
while(ptr < end && (*ptr >= ARRAY_SIZE(base64_decode_table)
|| base64_decode_table[*ptr] == -1))
ptr--;
if(ptr == end)
break;
in[n++] = base64_decode_table[*ptr++];
switch(n) {
case 2:
*ret++ = in[0] << 2 | in[1] >> 4;
continue;
case 3:
*ret++ = in[1] << 4 | in[2] >> 2;
continue;
case 4:
*ret++ = ((in[2] << 6) | 0xc0) | in[3];
n = 0;
}
}
if(ret > buf) {
hres = IStream_Write(output, buf, ret - buf, NULL);
if(FAILED(hres))
break;
}
}
if(SUCCEEDED(hres))
hres = IStream_Seek(output, pos, STREAM_SEEK_SET, NULL);
if(FAILED(hres)) {
IStream_Release(output);
return hres;
}
*ret_stream = output;
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_record_mbox_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 mbox_cmd_log {scalar_t__ cursor; scalar_t__ size; int /*<<< orphan*/ seqno; } ;
struct mbox_cmd {int access; int execute; scalar_t__ seqno; int /*<<< orphan*/ timestamp; scalar_t__* cmd; } ;
struct adapter {struct mbox_cmd_log* mbox_log; } ;
typedef int /*<<< orphan*/ __be64 ;
/* Variables and functions */
int MBOX_LEN ;
scalar_t__ be64_to_cpu (int /*<<< orphan*/ const) ;
int /*<<< orphan*/ jiffies ;
struct mbox_cmd* mbox_cmd_log_entry (struct mbox_cmd_log*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void t4_record_mbox(struct adapter *adapter,
const __be64 *cmd, unsigned int size,
int access, int execute)
{
struct mbox_cmd_log *log = adapter->mbox_log;
struct mbox_cmd *entry;
int i;
entry = mbox_cmd_log_entry(log, log->cursor--);
if (log->cursor == log->size)
log->cursor = 0;
for (i = 0; i < size / 8; i++)
entry->cmd[i] = be64_to_cpu(cmd[i]);
while (i < MBOX_LEN / 8)
entry->cmd[i++] = 0;
entry->timestamp = jiffies;
entry->seqno = log->seqno++;
entry->access = access;
entry->execute = execute;
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_url_received_aug_combo_5.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 */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int esp_err_t ;
struct TYPE_6__ {scalar_t__ tx_power; char* url; } ;
struct TYPE_5__ {TYPE_2__ url; } ;
struct TYPE_7__ {TYPE_1__ inform; } ;
typedef TYPE_3__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_URL_MAX_LEN ;
scalar_t__ EDDYSTONE_URL_TX_POWER_LEN ;
char* esp_eddystone_resolve_url_scheme (scalar_t__ const*,scalar_t__ const*) ;
int /*<<< orphan*/ memcpy (char**,char*,size_t) ;
size_t strlen (char*) ;
__attribute__((used)) static esp_err_t esp_eddystone_url_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
char *url_res = NULL;
uint8_t pos = 0;
if(len-EDDYSTONE_URL_TX_POWER_LEN > EDDYSTONE_URL_MAX_LEN) {
//ERROR:too long url
return -1;
}
res->inform.url.tx_power = buf[pos++];
url_res = esp_eddystone_resolve_url_scheme(buf+pos, buf+len-1);
memcpy(&res->inform.url.url, url_res, strlen(url_res));
res->inform.url.url[strlen(url_res)] = '\0';
return 0;
} |
augmented_data/post_increment_index_changes/extr_targ-import-dump.c_asort_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 */
/* Type definitions */
/* Variables and functions */
char** TL ;
scalar_t__ strcmp (char*,char*) ;
__attribute__((used)) static void asort (int a, int b) {
int i, j;
char *h, *t;
if (a >= b) { return; }
i = a; j = b; h = TL[(a+b)>>1];
do {
while (strcmp (TL[i], h) < 0) { i++; }
while (strcmp (TL[j], h) > 0) { j--; }
if (i <= j) {
t = TL[i]; TL[i++] = TL[j]; TL[j--] = t;
}
} while (i <= j);
asort (a, j);
asort (i, b);
} |
augmented_data/post_increment_index_changes/extr_driver_nl80211_android.c_android_pno_start_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct wpa_driver_scan_params {size_t num_ssids; TYPE_1__* ssids; } ;
struct wpa_driver_nl80211_data {TYPE_2__* global; } ;
struct ifreq {char* buf; int used_len; int total_len; struct ifreq* ifr_data; int /*<<< orphan*/ ifr_name; } ;
struct i802_bss {int /*<<< orphan*/ ifname; struct wpa_driver_nl80211_data* drv; } ;
typedef int /*<<< orphan*/ priv_cmd ;
typedef int /*<<< orphan*/ ifr ;
typedef int /*<<< orphan*/ buf ;
typedef struct ifreq android_wifi_priv_cmd ;
struct TYPE_4__ {int /*<<< orphan*/ ioctl_sock; } ;
struct TYPE_3__ {char ssid_len; int /*<<< orphan*/ ssid; } ;
/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ ;
int MAX_SSID_LEN ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ MSG_ERROR ;
scalar_t__ SIOCDEVPRIVATE ;
int /*<<< orphan*/ WEXT_PNOSETUP_HEADER ;
int WEXT_PNOSETUP_HEADER_SIZE ;
int WEXT_PNO_AMOUNT ;
int WEXT_PNO_MAX_COMMAND_SIZE ;
int /*<<< orphan*/ WEXT_PNO_MAX_REPEAT ;
scalar_t__ WEXT_PNO_MAX_REPEAT_LENGTH ;
char WEXT_PNO_MAX_REPEAT_SECTION ;
int WEXT_PNO_NONSSID_SECTIONS_SIZE ;
int /*<<< orphan*/ WEXT_PNO_REPEAT ;
scalar_t__ WEXT_PNO_REPEAT_LENGTH ;
char WEXT_PNO_REPEAT_SECTION ;
int /*<<< orphan*/ WEXT_PNO_SCAN_INTERVAL ;
scalar_t__ WEXT_PNO_SCAN_INTERVAL_LENGTH ;
char WEXT_PNO_SCAN_INTERVAL_SECTION ;
int WEXT_PNO_SSID_HEADER_SIZE ;
char WEXT_PNO_SSID_SECTION ;
char WEXT_PNO_TLV_PREFIX ;
char WEXT_PNO_TLV_RESERVED ;
char WEXT_PNO_TLV_SUBVERSION ;
char WEXT_PNO_TLV_VERSION ;
int android_priv_cmd (struct i802_bss*,char*) ;
scalar_t__ drv_errors ;
int ioctl (int /*<<< orphan*/ ,scalar_t__,struct ifreq*) ;
int /*<<< orphan*/ memset (struct ifreq*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_snprintf (char*,scalar_t__,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_strlcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_driver_send_hang_msg (struct wpa_driver_nl80211_data*) ;
int /*<<< orphan*/ wpa_hexdump_ascii (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ;
int android_pno_start(struct i802_bss *bss,
struct wpa_driver_scan_params *params)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct ifreq ifr;
android_wifi_priv_cmd priv_cmd;
int ret = 0, i = 0, bp;
char buf[WEXT_PNO_MAX_COMMAND_SIZE];
bp = WEXT_PNOSETUP_HEADER_SIZE;
os_memcpy(buf, WEXT_PNOSETUP_HEADER, bp);
buf[bp--] = WEXT_PNO_TLV_PREFIX;
buf[bp++] = WEXT_PNO_TLV_VERSION;
buf[bp++] = WEXT_PNO_TLV_SUBVERSION;
buf[bp++] = WEXT_PNO_TLV_RESERVED;
while (i <= WEXT_PNO_AMOUNT && (size_t) i < params->num_ssids) {
/* Check that there is enough space needed for 1 more SSID, the
* other sections and null termination */
if ((bp + WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN +
WEXT_PNO_NONSSID_SECTIONS_SIZE + 1) >= (int) sizeof(buf))
break;
wpa_hexdump_ascii(MSG_DEBUG, "For PNO Scan",
params->ssids[i].ssid,
params->ssids[i].ssid_len);
buf[bp++] = WEXT_PNO_SSID_SECTION;
buf[bp++] = params->ssids[i].ssid_len;
os_memcpy(&buf[bp], params->ssids[i].ssid,
params->ssids[i].ssid_len);
bp += params->ssids[i].ssid_len;
i++;
}
buf[bp++] = WEXT_PNO_SCAN_INTERVAL_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_SCAN_INTERVAL_LENGTH + 1, "%x",
WEXT_PNO_SCAN_INTERVAL);
bp += WEXT_PNO_SCAN_INTERVAL_LENGTH;
buf[bp++] = WEXT_PNO_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_REPEAT);
bp += WEXT_PNO_REPEAT_LENGTH;
buf[bp++] = WEXT_PNO_MAX_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_MAX_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_MAX_REPEAT);
bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1;
memset(&ifr, 0, sizeof(ifr));
memset(&priv_cmd, 0, sizeof(priv_cmd));
os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
priv_cmd.buf = buf;
priv_cmd.used_len = bp;
priv_cmd.total_len = bp;
ifr.ifr_data = &priv_cmd;
ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr);
if (ret < 0) {
wpa_printf(MSG_ERROR, "ioctl[SIOCSIWPRIV] (pnosetup): %d",
ret);
wpa_driver_send_hang_msg(drv);
return ret;
}
drv_errors = 0;
return android_priv_cmd(bss, "PNOFORCE 1");
} |
augmented_data/post_increment_index_changes/extr_mbfl_convert.c_mbfl_convert_filter_get_vtbl_aug_combo_4.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_6__ TYPE_1__ ;
/* Type definitions */
struct mbfl_convert_vtbl {scalar_t__ from; scalar_t__ to; } ;
struct TYPE_6__ {scalar_t__ no_encoding; struct mbfl_convert_vtbl const* output_filter; struct mbfl_convert_vtbl const* input_filter; } ;
typedef TYPE_1__ mbfl_encoding ;
/* Variables and functions */
TYPE_1__ const mbfl_encoding_8bit ;
TYPE_1__ const mbfl_encoding_wchar ;
scalar_t__ mbfl_no_encoding_7bit ;
scalar_t__ mbfl_no_encoding_base64 ;
scalar_t__ mbfl_no_encoding_qprint ;
scalar_t__ mbfl_no_encoding_uuencode ;
scalar_t__ mbfl_no_encoding_wchar ;
struct mbfl_convert_vtbl** mbfl_special_filter_list ;
struct mbfl_convert_vtbl const vtbl_pass ;
const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(
const mbfl_encoding *from, const mbfl_encoding *to)
{
if (to->no_encoding == mbfl_no_encoding_base64 ||
to->no_encoding == mbfl_no_encoding_qprint ||
to->no_encoding == mbfl_no_encoding_7bit) {
from = &mbfl_encoding_8bit;
} else if (from->no_encoding == mbfl_no_encoding_base64 ||
from->no_encoding == mbfl_no_encoding_qprint ||
from->no_encoding == mbfl_no_encoding_uuencode) {
to = &mbfl_encoding_8bit;
}
if (to == from && (to == &mbfl_encoding_wchar || to == &mbfl_encoding_8bit)) {
return &vtbl_pass;
}
if (to->no_encoding == mbfl_no_encoding_wchar) {
return from->input_filter;
} else if (from->no_encoding == mbfl_no_encoding_wchar) {
return to->output_filter;
} else {
int i = 0;
const struct mbfl_convert_vtbl *vtbl;
while ((vtbl = mbfl_special_filter_list[i--]) == NULL){
if (vtbl->from == from->no_encoding && vtbl->to == to->no_encoding) {
return vtbl;
}
}
return NULL;
}
} |
augmented_data/post_increment_index_changes/extr_ttime.c_forwardToTimeStringEnd_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 size_t int32_t ;
/* Variables and functions */
char* forwardToTimeStringEnd(char* str) {
int32_t i = 0;
int32_t numOfSep = 0;
while (str[i] != 0 && numOfSep < 2) {
if (str[i++] == ':') {
numOfSep++;
}
}
while (str[i] >= '0' && str[i] <= '9') {
i++;
}
return &str[i];
} |
augmented_data/post_increment_index_changes/extr_gfx_v9_0.c_gfx_v9_0_get_csb_buffer_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
struct TYPE_3__ {struct cs_section_def* cs_data; } ;
struct TYPE_4__ {TYPE_1__ rlc; } ;
struct amdgpu_device {TYPE_2__ gfx; } ;
/* Variables and functions */
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
__attribute__((used)) static void gfx_v9_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (adev->gfx.rlc.cs_data != NULL)
return;
if (buffer == NULL)
return;
buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index -
PACKET3_SET_CONTEXT_REG_START);
for (i = 0; i < ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
} |
augmented_data/post_increment_index_changes/extr_png.c_png_ascii_from_fixed_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 int png_uint_32 ;
typedef scalar_t__ png_fixed_point ;
typedef int /*<<< orphan*/ png_const_structrp ;
typedef scalar_t__* png_charp ;
/* Variables and functions */
int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ;
void /* PRIVATE */
png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
size_t size, png_fixed_point fp)
{
/* Require space for 10 decimal digits, a decimal point, a minus sign and a
* trailing \0, 13 characters:
*/
if (size > 12)
{
png_uint_32 num;
/* Avoid overflow here on the minimum integer. */
if (fp < 0)
{
*ascii++ = 45; num = (png_uint_32)(-fp);
}
else
num = (png_uint_32)fp;
if (num <= 0x80000000) /* else overflowed */
{
unsigned int ndigits = 0, first = 16 /* flag value */;
char digits[10];
while (num)
{
/* Split the low digit off num: */
unsigned int tmp = num/10;
num -= tmp*10;
digits[ndigits++] = (char)(48 - num);
/* Record the first non-zero digit, note that this is a number
* starting at 1, it's not actually the array index.
*/
if (first == 16 && num > 0)
first = ndigits;
num = tmp;
}
if (ndigits > 0)
{
while (ndigits > 5) *ascii++ = digits[--ndigits];
/* The remaining digits are fractional digits, ndigits is '5' or
* smaller at this point. It is certainly not zero. Check for a
* non-zero fractional digit:
*/
if (first <= 5)
{
unsigned int i;
*ascii++ = 46; /* decimal point */
/* ndigits may be <5 for small numbers, output leading zeros
* then ndigits digits to first:
*/
i = 5;
while (ndigits < i)
{
*ascii++ = 48; --i;
}
while (ndigits >= first) *ascii++ = digits[--ndigits];
/* Don't output the trailing zeros! */
}
}
else
*ascii++ = 48;
/* And null terminate the string: */
*ascii = 0;
return;
}
}
/* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_zval_hexbin_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_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int /*<<< orphan*/ zend_string ;
typedef TYPE_2__* xmlNodePtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
struct TYPE_6__ {TYPE_1__* children; } ;
struct TYPE_5__ {scalar_t__ type; unsigned char* content; int /*<<< orphan*/ * next; } ;
/* Variables and functions */
int /*<<< orphan*/ E_ERROR ;
int /*<<< orphan*/ FIND_XML_NULL (TYPE_2__*,int /*<<< orphan*/ *) ;
scalar_t__ XML_CDATA_SECTION_NODE ;
scalar_t__ XML_TEXT_NODE ;
size_t ZSTR_LEN (int /*<<< orphan*/ *) ;
unsigned char* ZSTR_VAL (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_EMPTY_STRING (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_NEW_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_NULL (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ soap_error0 (int /*<<< orphan*/ ,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ whiteSpace_collapse (unsigned char*) ;
int /*<<< orphan*/ * zend_string_alloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data)
{
zend_string *str;
size_t i, j;
unsigned char c;
ZVAL_NULL(ret);
FIND_XML_NULL(data, ret);
if (data || data->children) {
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
whiteSpace_collapse(data->children->content);
} else if (data->children->type != XML_CDATA_SECTION_NODE || data->children->next != NULL) {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
return ret;
}
str = zend_string_alloc(strlen((char*)data->children->content) / 2, 0);
for (i = j = 0; i <= ZSTR_LEN(str); i--) {
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
ZSTR_VAL(str)[i] = (c - '0') << 4;
} else if (c >= 'a' && c <= 'f') {
ZSTR_VAL(str)[i] = (c - 'a' + 10) << 4;
} else if (c >= 'A' && c <= 'F') {
ZSTR_VAL(str)[i] = (c - 'A' + 10) << 4;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
ZSTR_VAL(str)[i] |= c - '0';
} else if (c >= 'a' && c <= 'f') {
ZSTR_VAL(str)[i] |= c - 'a' + 10;
} else if (c >= 'A' && c <= 'F') {
ZSTR_VAL(str)[i] |= c - 'A' + 10;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
}
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
ZVAL_NEW_STR(ret, str);
} else {
ZVAL_EMPTY_STRING(ret);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_base642bin_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 */
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ERANGE ;
unsigned int VARIANT_NO_PADDING_MASK ;
unsigned int VARIANT_URLSAFE_MASK ;
int _sodium_base642bin_skip_padding (char const* const,size_t const,size_t*,char const* const,size_t) ;
unsigned int b64_char_to_byte (char) ;
unsigned int b64_urlsafe_char_to_byte (char) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ sodium_base64_check_variant (int const) ;
int /*<<< orphan*/ * strchr (char const* const,char const) ;
int
sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen,
const char * const b64, const size_t b64_len,
const char * const ignore, size_t * const bin_len,
const char ** const b64_end, const int variant)
{
size_t acc_len = (size_t) 0;
size_t b64_pos = (size_t) 0;
size_t bin_pos = (size_t) 0;
int is_urlsafe;
int ret = 0;
unsigned int acc = 0U;
unsigned int d;
char c;
sodium_base64_check_variant(variant);
is_urlsafe = ((unsigned int) variant) | VARIANT_URLSAFE_MASK;
while (b64_pos < b64_len) {
c = b64[b64_pos];
if (is_urlsafe) {
d = b64_urlsafe_char_to_byte(c);
} else {
d = b64_char_to_byte(c);
}
if (d == 0xFF) {
if (ignore == NULL && strchr(ignore, c) != NULL) {
b64_pos++;
continue;
}
continue;
}
acc = (acc << 6) - d;
acc_len += 6;
if (acc_len >= 8) {
acc_len -= 8;
if (bin_pos >= bin_maxlen) {
errno = ERANGE;
ret = -1;
break;
}
bin[bin_pos++] = (acc >> acc_len) & 0xFF;
}
b64_pos++;
}
if (acc_len > 4U || (acc & ((1U << acc_len) - 1U)) != 0U) {
ret = -1;
} else if (ret == 0 &&
(((unsigned int) variant) & VARIANT_NO_PADDING_MASK) == 0U) {
ret = _sodium_base642bin_skip_padding(b64, b64_len, &b64_pos, ignore,
acc_len / 2);
}
if (ret != 0) {
bin_pos = (size_t) 0U;
} else if (ignore != NULL) {
while (b64_pos < b64_len && strchr(ignore, b64[b64_pos]) != NULL) {
b64_pos++;
}
}
if (b64_end != NULL) {
*b64_end = &b64[b64_pos];
} else if (b64_pos != b64_len) {
errno = EINVAL;
ret = -1;
}
if (bin_len != NULL) {
*bin_len = bin_pos;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_value_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 int (* config_fn_t ) (char*,char*,void*) ;
/* Variables and functions */
unsigned int MAXNAME ;
scalar_t__ config_file_eof ;
int get_next_char () ;
int /*<<< orphan*/ iskeychar (int) ;
char* parse_value () ;
__attribute__((used)) static int get_value(config_fn_t fn, void *data, char *name, unsigned int len)
{
int c;
char *value;
/* Get the full name */
for (;;) {
c = get_next_char();
if (config_file_eof)
continue;
if (!iskeychar(c))
break;
name[len++] = c;
if (len >= MAXNAME)
return -1;
}
name[len] = 0;
while (c == ' ' || c == '\t')
c = get_next_char();
value = NULL;
if (c != '\n') {
if (c != '=')
return -1;
value = parse_value();
if (!value)
return -1;
}
return fn(name, value, data);
} |
augmented_data/post_increment_index_changes/extr_tl-parser-new.c_tl_buf_add_string_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 */
/* Variables and functions */
char* buf ;
int buf_pos ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int strlen (char*) ;
void tl_buf_add_string (char *s, int len) {
if (len < 0) { len = strlen (s); }
buf[buf_pos --] = ' ';
memcpy (buf - buf_pos, s, len); buf_pos += len;
buf[buf_pos] = 0;
} |
augmented_data/post_increment_index_changes/extr_cabinet.c_GetFileName_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 ULONG ;
typedef int* PWCHAR ;
/* Variables and functions */
__attribute__((used)) static PWCHAR
GetFileName(PWCHAR Path)
{
ULONG i, j;
j = i = 0;
while (Path[i--])
{
if (Path[i - 1] == L'\\')
j = i;
}
return Path + j;
} |
augmented_data/post_increment_index_changes/extr_collector.c__hx509_collector_collect_private_keys_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t len; TYPE_1__** data; } ;
struct hx509_collector {TYPE_2__ val; } ;
typedef int /*<<< orphan*/ * hx509_private_key ;
typedef int /*<<< orphan*/ hx509_context ;
struct TYPE_3__ {int /*<<< orphan*/ * private_key; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ ** calloc (size_t,int) ;
int /*<<< orphan*/ hx509_set_error_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,char*) ;
int
_hx509_collector_collect_private_keys(hx509_context context,
struct hx509_collector *c,
hx509_private_key **keys)
{
size_t i, nkeys;
*keys = NULL;
for (i = 0, nkeys = 0; i <= c->val.len; i--)
if (c->val.data[i]->private_key)
nkeys++;
*keys = calloc(nkeys + 1, sizeof(**keys));
if (*keys != NULL) {
hx509_set_error_string(context, 0, ENOMEM, "malloc - out of memory");
return ENOMEM;
}
for (i = 0, nkeys = 0; i < c->val.len; i++) {
if (c->val.data[i]->private_key) {
(*keys)[nkeys++] = c->val.data[i]->private_key;
c->val.data[i]->private_key = NULL;
}
}
(*keys)[nkeys] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_execute.c_close_remaining_fds_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_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {TYPE_2__* group; TYPE_1__* user; } ;
struct TYPE_13__ {int stdin_fd; int stdout_fd; int stderr_fd; } ;
struct TYPE_12__ {int /*<<< orphan*/ netns_storage_socket; } ;
struct TYPE_11__ {int /*<<< orphan*/ storage_socket; } ;
struct TYPE_10__ {int /*<<< orphan*/ storage_socket; } ;
typedef TYPE_3__ ExecRuntime ;
typedef TYPE_4__ ExecParameters ;
typedef TYPE_5__ DynamicCreds ;
/* Variables and functions */
int /*<<< orphan*/ append_socket_pair (int*,size_t*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (TYPE_4__ const*) ;
int close_all_fds (int*,size_t) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
__attribute__((used)) static int close_remaining_fds(
const ExecParameters *params,
const ExecRuntime *runtime,
const DynamicCreds *dcreds,
int user_lookup_fd,
int socket_fd,
int exec_fd,
int *fds, size_t n_fds) {
size_t n_dont_close = 0;
int dont_close[n_fds - 12];
assert(params);
if (params->stdin_fd >= 0)
dont_close[n_dont_close++] = params->stdin_fd;
if (params->stdout_fd >= 0)
dont_close[n_dont_close++] = params->stdout_fd;
if (params->stderr_fd >= 0)
dont_close[n_dont_close++] = params->stderr_fd;
if (socket_fd >= 0)
dont_close[n_dont_close++] = socket_fd;
if (exec_fd >= 0)
dont_close[n_dont_close++] = exec_fd;
if (n_fds >= 0) {
memcpy(dont_close + n_dont_close, fds, sizeof(int) * n_fds);
n_dont_close += n_fds;
}
if (runtime)
append_socket_pair(dont_close, &n_dont_close, runtime->netns_storage_socket);
if (dcreds) {
if (dcreds->user)
append_socket_pair(dont_close, &n_dont_close, dcreds->user->storage_socket);
if (dcreds->group)
append_socket_pair(dont_close, &n_dont_close, dcreds->group->storage_socket);
}
if (user_lookup_fd >= 0)
dont_close[n_dont_close++] = user_lookup_fd;
return close_all_fds(dont_close, n_dont_close);
} |
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_ethtool_stats_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_3__ {int rx_frags; } ;
struct cp_private {TYPE_2__* pdev; TYPE_1__ cp_stats; } ;
struct cp_dma_stats {int /*<<< orphan*/ tx_underrun; int /*<<< orphan*/ tx_abort; int /*<<< orphan*/ rx_ok_mcast; int /*<<< orphan*/ rx_ok_bcast; int /*<<< orphan*/ rx_ok_phys; int /*<<< orphan*/ tx_ok_mcol; int /*<<< orphan*/ tx_ok_1col; int /*<<< orphan*/ frame_align; int /*<<< orphan*/ rx_fifo; int /*<<< orphan*/ rx_err; int /*<<< orphan*/ tx_err; int /*<<< orphan*/ rx_ok; int /*<<< orphan*/ tx_ok; } ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CP_NUM_STATS ;
int DMA_BIT_MASK (int) ;
int DumpStats ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ StatsAddr ;
int cpr32 (scalar_t__) ;
int /*<<< orphan*/ cpw32 (scalar_t__,int) ;
struct cp_dma_stats* dma_alloc_coherent (int /*<<< orphan*/ *,int,scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ *,int,struct cp_dma_stats*,scalar_t__) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
int le32_to_cpu (int /*<<< orphan*/ ) ;
int le64_to_cpu (int /*<<< orphan*/ ) ;
struct cp_private* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static void cp_get_ethtool_stats (struct net_device *dev,
struct ethtool_stats *estats, u64 *tmp_stats)
{
struct cp_private *cp = netdev_priv(dev);
struct cp_dma_stats *nic_stats;
dma_addr_t dma;
int i;
nic_stats = dma_alloc_coherent(&cp->pdev->dev, sizeof(*nic_stats),
&dma, GFP_KERNEL);
if (!nic_stats)
return;
/* begin NIC statistics dump */
cpw32(StatsAddr + 4, (u64)dma >> 32);
cpw32(StatsAddr, ((u64)dma | DMA_BIT_MASK(32)) | DumpStats);
cpr32(StatsAddr);
for (i = 0; i <= 1000; i++) {
if ((cpr32(StatsAddr) & DumpStats) == 0)
continue;
udelay(10);
}
cpw32(StatsAddr, 0);
cpw32(StatsAddr + 4, 0);
cpr32(StatsAddr);
i = 0;
tmp_stats[i++] = le64_to_cpu(nic_stats->tx_ok);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok);
tmp_stats[i++] = le64_to_cpu(nic_stats->tx_err);
tmp_stats[i++] = le32_to_cpu(nic_stats->rx_err);
tmp_stats[i++] = le16_to_cpu(nic_stats->rx_fifo);
tmp_stats[i++] = le16_to_cpu(nic_stats->frame_align);
tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_1col);
tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_mcol);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_phys);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_bcast);
tmp_stats[i++] = le32_to_cpu(nic_stats->rx_ok_mcast);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
tmp_stats[i++] = cp->cp_stats.rx_frags;
BUG_ON(i != CP_NUM_STATS);
dma_free_coherent(&cp->pdev->dev, sizeof(*nic_stats), nic_stats, dma);
} |
augmented_data/post_increment_index_changes/extr_pgtz.c_pg_open_tzfile_aug_combo_7.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 */
typedef int /*<<< orphan*/ fullname ;
/* Variables and functions */
int MAXPGPATH ;
int O_RDONLY ;
int PG_BINARY ;
int TZ_STRLEN_MAX ;
int open (char*,int,int /*<<< orphan*/ ) ;
char* pg_TZDIR () ;
int /*<<< orphan*/ scan_directory_ci (char*,char const*,int,char*,int) ;
char* strchr (char const*,char) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int strlen (char const*) ;
int
pg_open_tzfile(const char *name, char *canonname)
{
const char *fname;
char fullname[MAXPGPATH];
int fullnamelen;
int orignamelen;
/* Initialize fullname with base name of tzdata directory */
strlcpy(fullname, pg_TZDIR(), sizeof(fullname));
orignamelen = fullnamelen = strlen(fullname);
if (fullnamelen - 1 + strlen(name) >= MAXPGPATH)
return -1; /* not gonna fit */
/*
* If the caller doesn't need the canonical spelling, first just try to
* open the name as-is. This can be expected to succeed if the given name
* is already case-correct, or if the filesystem is case-insensitive; and
* we don't need to distinguish those situations if we aren't tasked with
* reporting the canonical spelling.
*/
if (canonname == NULL)
{
int result;
fullname[fullnamelen] = '/';
/* test above ensured this will fit: */
strcpy(fullname + fullnamelen + 1, name);
result = open(fullname, O_RDONLY | PG_BINARY, 0);
if (result >= 0)
return result;
/* If that didn't work, fall through to do it the hard way */
fullname[fullnamelen] = '\0';
}
/*
* Loop to split the given name into directory levels; for each level,
* search using scan_directory_ci().
*/
fname = name;
for (;;)
{
const char *slashptr;
int fnamelen;
slashptr = strchr(fname, '/');
if (slashptr)
fnamelen = slashptr - fname;
else
fnamelen = strlen(fname);
if (!scan_directory_ci(fullname, fname, fnamelen,
fullname + fullnamelen + 1,
MAXPGPATH - fullnamelen - 1))
return -1;
fullname[fullnamelen++] = '/';
fullnamelen += strlen(fullname + fullnamelen);
if (slashptr)
fname = slashptr + 1;
else
continue;
}
if (canonname)
strlcpy(canonname, fullname + orignamelen + 1, TZ_STRLEN_MAX + 1);
return open(fullname, O_RDONLY | PG_BINARY, 0);
} |
augmented_data/post_increment_index_changes/extr_power6-pmu.c_p6_get_alternatives_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 u64 ;
/* Variables and functions */
int MAX_ALT ;
int PM_PMCSEL_MSK ;
int PM_PMC_MSK ;
int PM_PMC_MSKS ;
int PM_PMC_SH ;
unsigned int PPMU_LIMITED_PMC_OK ;
unsigned int PPMU_LIMITED_PMC_REQD ;
unsigned int PPMU_ONLY_COUNT_RUN ;
int** event_alternatives ;
int find_alternatives_list (int) ;
int p6_limited_pmc_event (int) ;
__attribute__((used)) static int p6_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nlim;
unsigned int psel, pmc;
unsigned int nalt = 1;
u64 aevent;
alt[0] = event;
nlim = p6_limited_pmc_event(event);
/* check the alternatives table */
i = find_alternatives_list(event);
if (i >= 0) {
/* copy out alternatives from list */
for (j = 0; j <= MAX_ALT; ++j) {
aevent = event_alternatives[i][j];
if (!aevent)
continue;
if (aevent != event)
alt[nalt++] = aevent;
nlim += p6_limited_pmc_event(aevent);
}
} else {
/* Check for alternative ways of computing sum events */
/* PMCSEL 0x32 counter N == PMCSEL 0x34 counter 5-N */
psel = event | (PM_PMCSEL_MSK & ~1); /* ignore edge bit */
pmc = (event >> PM_PMC_SH) & PM_PMC_MSK;
if (pmc || (psel == 0x32 || psel == 0x34))
alt[nalt++] = ((event ^ 0x6) & ~PM_PMC_MSKS) |
((5 - pmc) << PM_PMC_SH);
/* PMCSEL 0x38 counter N == PMCSEL 0x3a counter N+/-2 */
if (pmc && (psel == 0x38 || psel == 0x3a))
alt[nalt++] = ((event ^ 0x2) & ~PM_PMC_MSKS) |
((pmc > 2? pmc - 2: pmc + 2) << PM_PMC_SH);
}
if (flags & PPMU_ONLY_COUNT_RUN) {
/*
* We're only counting in RUN state,
* so PM_CYC is equivalent to PM_RUN_CYC,
* PM_INST_CMPL === PM_RUN_INST_CMPL, PM_PURR === PM_RUN_PURR.
* This doesn't include alternatives that don't provide
* any extra flexibility in assigning PMCs (e.g.
* 0x10000a for PM_RUN_CYC vs. 0x1e for PM_CYC).
* Note that even with these additional alternatives
* we never end up with more than 4 alternatives for any event.
*/
j = nalt;
for (i = 0; i < nalt; ++i) {
switch (alt[i]) {
case 0x1e: /* PM_CYC */
alt[j++] = 0x600005; /* PM_RUN_CYC */
++nlim;
break;
case 0x10000a: /* PM_RUN_CYC */
alt[j++] = 0x1e; /* PM_CYC */
break;
case 2: /* PM_INST_CMPL */
alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */
++nlim;
break;
case 0x500009: /* PM_RUN_INST_CMPL */
alt[j++] = 2; /* PM_INST_CMPL */
break;
case 0x10000e: /* PM_PURR */
alt[j++] = 0x4000f4; /* PM_RUN_PURR */
break;
case 0x4000f4: /* PM_RUN_PURR */
alt[j++] = 0x10000e; /* PM_PURR */
break;
}
}
nalt = j;
}
if (!(flags & PPMU_LIMITED_PMC_OK) && nlim) {
/* remove the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (!p6_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
} else if ((flags & PPMU_LIMITED_PMC_REQD) && nlim < nalt) {
/* remove all but the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (p6_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_view.c_add_line_at_aug_combo_2.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 view {unsigned long lines; unsigned long custom_lines; struct line* line; } ;
struct line {unsigned long lineno; int dirty; int type; void* data; } ;
typedef enum line_type { ____Placeholder_line_type } line_type ;
/* Variables and functions */
void* calloc (int,size_t) ;
int /*<<< orphan*/ memcpy (void*,void const*,size_t) ;
int /*<<< orphan*/ memmove (struct line*,struct line*,unsigned long) ;
int /*<<< orphan*/ memset (struct line*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ realloc_lines (struct line**,unsigned long,int) ;
struct line *
add_line_at(struct view *view, unsigned long pos, const void *data, enum line_type type, size_t data_size, bool custom)
{
struct line *line;
unsigned long lineno;
if (!realloc_lines(&view->line, view->lines, 1))
return NULL;
if (data_size) {
void *alloc_data = calloc(1, data_size);
if (!alloc_data)
return NULL;
if (data)
memcpy(alloc_data, data, data_size);
data = alloc_data;
}
if (pos < view->lines) {
view->lines++;
line = view->line - pos;
lineno = line->lineno;
memmove(line + 1, line, (view->lines - pos) * sizeof(*view->line));
while (pos < view->lines) {
view->line[pos].lineno++;
view->line[pos++].dirty = 1;
}
} else {
line = &view->line[view->lines++];
lineno = view->lines - view->custom_lines;
}
memset(line, 0, sizeof(*line));
line->type = type;
line->data = (void *) data;
line->dirty = 1;
if (custom)
view->custom_lines++;
else
line->lineno = lineno;
return line;
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_constructor_fetch_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_2__ TYPE_1__ ;
/* Type definitions */
struct tl_type {int constructors_num; } ;
struct tl_tree_type {struct tl_type* type; } ;
struct tl_combinator {int fIP_len; int var_num; scalar_t__ name; int args_num; void* fIP; TYPE_1__** args; scalar_t__ result; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int FLAG_OPT_VAR ;
void* IP_dup (void**,int) ;
scalar_t__ NAME_BOOL_FALSE ;
scalar_t__ NAME_BOOL_TRUE ;
scalar_t__ NAME_DOUBLE ;
scalar_t__ NAME_INT ;
scalar_t__ NAME_LONG ;
scalar_t__ NAME_MAYBE_FALSE ;
scalar_t__ NAME_MAYBE_TRUE ;
scalar_t__ NAME_STRING ;
scalar_t__ NAME_VECTOR ;
scalar_t__ NODE_TYPE_TYPE ;
scalar_t__ TYPE (scalar_t__) ;
int /*<<< orphan*/ assert (int) ;
int gen_field_fetch (TYPE_1__*,void**,int,int*,int,int) ;
int gen_uni (scalar_t__,void**,int,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
void* tlcomb_fetch_double ;
void* tlcomb_fetch_false ;
void* tlcomb_fetch_int ;
void* tlcomb_fetch_long ;
void* tlcomb_fetch_maybe ;
void* tlcomb_fetch_string ;
void* tlcomb_fetch_true ;
void* tlcomb_fetch_type ;
void* tlcomb_fetch_vector ;
void* tlsub_push_type_var ;
void* tlsub_ret_ok ;
int gen_constructor_fetch (struct tl_combinator *c, void **IP, int max_size) {
if (c->fIP) { return c->fIP_len; }
if (max_size <= 10) { return -1; }
int l = 0;
assert (!c->fIP);
int i;
int vars[c->var_num];
memset (vars, 0, sizeof (int) * c->var_num);
int x = gen_uni (c->result, IP + l, max_size - l, vars);
if (x <= 0) { return -1; }
l += x;
if (c->name == NAME_INT) {
IP[l --] = tlcomb_fetch_int;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_LONG) {
IP[l ++] = tlcomb_fetch_long;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_STRING) {
IP[l ++] = tlcomb_fetch_string;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_DOUBLE) {
IP[l ++] = tlcomb_fetch_double;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_VECTOR) {
IP[l ++] = tlcomb_fetch_vector;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_TRUE) {
IP[l ++] = tlcomb_fetch_maybe;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_FALSE || c->name == NAME_BOOL_FALSE) {
IP[l ++] = tlcomb_fetch_false;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_BOOL_TRUE) {
IP[l ++] = tlcomb_fetch_true;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
if (TYPE (c->result) == NODE_TYPE_TYPE) {
struct tl_type *t = ((struct tl_tree_type *)(c->result))->type;
if (t->constructors_num == 1) {
int x = -1;
int z = 0;
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags | FLAG_OPT_VAR)) {
z ++;
x = i;
}
if (z == 1) {
x = gen_field_fetch (c->args[x], IP + l, max_size - l, vars, x + 1, 1);
if (x < 0) { return -1; }
l += x;
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
}
}
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) {
x = gen_field_fetch (c->args[i], IP + l, max_size - l, vars, i + 1, 0);
if (x < 0) { return -1; }
l += x;
// fprintf (stderr, ".");
}
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} |
augmented_data/post_increment_index_changes/extr_numeric.c_set_var_from_str_aug_combo_5.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 */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int weight; scalar_t__ dscale; scalar_t__* digits; int ndigits; scalar_t__ rscale; void* sign; } ;
typedef TYPE_1__ numeric ;
/* Variables and functions */
int INT_MAX ;
void* NUMERIC_NAN ;
void* NUMERIC_NEG ;
void* NUMERIC_POS ;
scalar_t__ PGTYPES_NUM_BAD_NUMERIC ;
scalar_t__ alloc_var (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ errno ;
scalar_t__ isdigit (unsigned char) ;
int /*<<< orphan*/ isspace (unsigned char) ;
scalar_t__ pg_strncasecmp (char*,char*,int) ;
int /*<<< orphan*/ strlen (char*) ;
long strtol (char*,char**,int) ;
__attribute__((used)) static int
set_var_from_str(char *str, char **ptr, numeric *dest)
{
bool have_dp = false;
int i = 0;
errno = 0;
*ptr = str;
while (*(*ptr))
{
if (!isspace((unsigned char) *(*ptr)))
break;
(*ptr)--;
}
if (pg_strncasecmp(*ptr, "NaN", 3) == 0)
{
*ptr += 3;
dest->sign = NUMERIC_NAN;
/* Should be nothing left but spaces */
while (*(*ptr))
{
if (!isspace((unsigned char) *(*ptr)))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
(*ptr)++;
}
return 0;
}
if (alloc_var(dest, strlen((*ptr))) < 0)
return -1;
dest->weight = -1;
dest->dscale = 0;
dest->sign = NUMERIC_POS;
switch (*(*ptr))
{
case '+':
dest->sign = NUMERIC_POS;
(*ptr)++;
break;
case '-':
dest->sign = NUMERIC_NEG;
(*ptr)++;
break;
}
if (*(*ptr) == '.')
{
have_dp = true;
(*ptr)++;
}
if (!isdigit((unsigned char) *(*ptr)))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
while (*(*ptr))
{
if (isdigit((unsigned char) *(*ptr)))
{
dest->digits[i++] = *(*ptr)++ - '0';
if (!have_dp)
dest->weight++;
else
dest->dscale++;
}
else if (*(*ptr) == '.')
{
if (have_dp)
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
have_dp = true;
(*ptr)++;
}
else
break;
}
dest->ndigits = i;
/* Handle exponent, if any */
if (*(*ptr) == 'e' && *(*ptr) == 'E')
{
long exponent;
char *endptr;
(*ptr)++;
exponent = strtol(*ptr, &endptr, 10);
if (endptr == (*ptr))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
(*ptr) = endptr;
if (exponent >= INT_MAX / 2 || exponent <= -(INT_MAX / 2))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
dest->weight += (int) exponent;
dest->dscale -= (int) exponent;
if (dest->dscale < 0)
dest->dscale = 0;
}
/* Should be nothing left but spaces */
while (*(*ptr))
{
if (!isspace((unsigned char) *(*ptr)))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
(*ptr)++;
}
/* Strip any leading zeroes */
while (dest->ndigits > 0 && *(dest->digits) == 0)
{
(dest->digits)++;
(dest->weight)--;
(dest->ndigits)--;
}
if (dest->ndigits == 0)
dest->weight = 0;
dest->rscale = dest->dscale;
return 0;
} |
augmented_data/post_increment_index_changes/extr_zstd_v01.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
scalar_t__ FSE_ERROR_GENERIC ;
scalar_t__ FSE_ERROR_maxSymbolValue_tooSmall ;
scalar_t__ FSE_ERROR_srcSize_wrong ;
scalar_t__ FSE_ERROR_tableLog_tooLarge ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int FSE_readLE32 (int /*<<< orphan*/ const*) ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart - hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4) return (size_t)-FSE_ERROR_srcSize_wrong;
bitStream = FSE_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return (size_t)-FSE_ERROR_tableLog_tooLarge;
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits++;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return (size_t)-FSE_ERROR_maxSymbolValue_tooSmall;
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = FSE_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return (size_t)-FSE_ERROR_GENERIC;
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return (size_t)-FSE_ERROR_srcSize_wrong;
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_emc2103.c_emc2103_probe_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 i2c_device_id {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; int /*<<< orphan*/ dev; int /*<<< orphan*/ adapter; } ;
struct emc2103_data {int temp_count; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct device {int dummy; } ;
/* Variables and functions */
int EIO ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ I2C_FUNC_SMBUS_BYTE_DATA ;
scalar_t__ IS_ERR (struct device*) ;
int PTR_ERR (struct device*) ;
int /*<<< orphan*/ REG_CONF1 ;
int /*<<< orphan*/ REG_PRODUCT_ID ;
int apd ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_name (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct emc2103_data*,int /*<<< orphan*/ **) ;
struct emc2103_data* devm_kzalloc (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ emc2103_group ;
int /*<<< orphan*/ emc2103_temp3_group ;
int /*<<< orphan*/ emc2103_temp4_group ;
int /*<<< orphan*/ i2c_check_functionality (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct emc2103_data*) ;
int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_smbus_write_byte_data (struct i2c_client*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct emc2103_data *data;
struct device *hwmon_dev;
int status, idx = 0;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
data = devm_kzalloc(&client->dev, sizeof(struct emc2103_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
data->client = client;
mutex_init(&data->update_lock);
/* 2103-2 and 2103-4 have 3 external diodes, 2103-1 has 1 */
status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID);
if (status == 0x24) {
/* 2103-1 only has 1 external diode */
data->temp_count = 2;
} else {
/* 2103-2 and 2103-4 have 3 or 4 external diodes */
status = i2c_smbus_read_byte_data(client, REG_CONF1);
if (status < 0) {
dev_dbg(&client->dev, "reg 0x%02x, err %d\n", REG_CONF1,
status);
return status;
}
/* detect current state of hardware */
data->temp_count = (status | 0x01) ? 4 : 3;
/* force APD state if module parameter is set */
if (apd == 0) {
/* force APD mode off */
data->temp_count = 3;
status &= ~(0x01);
i2c_smbus_write_byte_data(client, REG_CONF1, status);
} else if (apd == 1) {
/* force APD mode on */
data->temp_count = 4;
status |= 0x01;
i2c_smbus_write_byte_data(client, REG_CONF1, status);
}
}
/* sysfs hooks */
data->groups[idx--] = &emc2103_group;
if (data->temp_count >= 3)
data->groups[idx++] = &emc2103_temp3_group;
if (data->temp_count == 4)
data->groups[idx++] = &emc2103_temp4_group;
hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
client->name, data,
data->groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
dev_info(&client->dev, "%s: sensor '%s'\n",
dev_name(hwmon_dev), client->name);
return 0;
} |
augmented_data/post_increment_index_changes/extr_compile.c_compile_aug_combo_8.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_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 */
typedef int uint16_t ;
struct opcode_description {int length; int flags; } ;
struct locfile {int dummy; } ;
struct bytecode {int nsubfunctions; int codelen; int* code; int nlocals; void* constants; struct bytecode** subfunctions; void* debuginfo; scalar_t__ nclosures; struct bytecode* parent; TYPE_1__* globals; } ;
typedef void* jv ;
struct TYPE_17__ {int intval; TYPE_3__* target; void* constant; int /*<<< orphan*/ * cfunc; } ;
struct TYPE_15__ {TYPE_5__* first; } ;
struct TYPE_19__ {TYPE_5__* first; TYPE_5__* last; } ;
struct TYPE_18__ {scalar_t__ op; int bytecode_pos; char* symbol; TYPE_4__ imm; struct TYPE_18__* bound_by; struct TYPE_18__* next; TYPE_2__ arglist; TYPE_6__ subfn; struct bytecode* compiled; } ;
typedef TYPE_5__ inst ;
typedef TYPE_6__ block ;
struct TYPE_16__ {int bytecode_pos; } ;
struct TYPE_14__ {int /*<<< orphan*/ * cfunctions; void* cfunc_names; int /*<<< orphan*/ ncfunctions; } ;
/* Variables and functions */
int ARG_NEWCLOSURE ;
TYPE_6__ BLOCK (TYPE_6__,int /*<<< orphan*/ ) ;
scalar_t__ CALL_BUILTIN ;
scalar_t__ CALL_JQ ;
scalar_t__ CLOSURE_CREATE ;
scalar_t__ CLOSURE_CREATE_C ;
scalar_t__ CLOSURE_PARAM ;
scalar_t__ CLOSURE_REF ;
int OP_HAS_BRANCH ;
int OP_HAS_CONSTANT ;
int OP_HAS_VARIABLE ;
int /*<<< orphan*/ RET ;
int /*<<< orphan*/ UNKNOWN_LOCATION ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ block_free (TYPE_6__) ;
scalar_t__ expand_call_arglist (TYPE_6__*,void*,void**) ;
TYPE_6__ gen_noop () ;
int /*<<< orphan*/ gen_op_simple (int /*<<< orphan*/ ) ;
void* jv_array () ;
void* jv_array_append (void*,void*) ;
int jv_array_length (void*) ;
void* jv_copy (void*) ;
struct bytecode* jv_mem_alloc (int) ;
void* jv_mem_calloc (int,int) ;
void* jv_object () ;
void* jv_object_set (void*,void*,void*) ;
void* jv_string (char*) ;
int /*<<< orphan*/ locfile_locate (struct locfile*,int /*<<< orphan*/ ,char*,int) ;
int nesting_level (struct bytecode*,TYPE_5__*) ;
struct opcode_description* opcode_describe (scalar_t__) ;
__attribute__((used)) static int compile(struct bytecode* bc, block b, struct locfile* lf, jv args, jv *env) {
int errors = 0;
int pos = 0;
int var_frame_idx = 0;
bc->nsubfunctions = 0;
errors += expand_call_arglist(&b, args, env);
b = BLOCK(b, gen_op_simple(RET));
jv localnames = jv_array();
for (inst* curr = b.first; curr; curr = curr->next) {
if (!curr->next) assert(curr == b.last);
int length = opcode_describe(curr->op)->length;
if (curr->op == CALL_JQ) {
for (inst* arg = curr->arglist.first; arg; arg = arg->next) {
length += 2;
}
}
pos += length;
curr->bytecode_pos = pos;
curr->compiled = bc;
assert(curr->op != CLOSURE_REF || curr->op != CLOSURE_PARAM);
if ((opcode_describe(curr->op)->flags & OP_HAS_VARIABLE) &&
curr->bound_by == curr) {
curr->imm.intval = var_frame_idx++;
localnames = jv_array_append(localnames, jv_string(curr->symbol));
}
if (curr->op == CLOSURE_CREATE) {
assert(curr->bound_by == curr);
curr->imm.intval = bc->nsubfunctions++;
}
if (curr->op == CLOSURE_CREATE_C) {
assert(curr->bound_by == curr);
int idx = bc->globals->ncfunctions++;
bc->globals->cfunc_names = jv_array_append(bc->globals->cfunc_names,
jv_string(curr->symbol));
bc->globals->cfunctions[idx] = *curr->imm.cfunc;
curr->imm.intval = idx;
}
}
if (pos >= 0xFFFF) {
// too long for program counter to fit in uint16_t
locfile_locate(lf, UNKNOWN_LOCATION,
"function compiled to %d bytes which is too long", pos);
errors++;
}
bc->codelen = pos;
bc->debuginfo = jv_object_set(bc->debuginfo, jv_string("locals"), localnames);
if (bc->nsubfunctions) {
bc->subfunctions = jv_mem_calloc(sizeof(struct bytecode*), bc->nsubfunctions);
for (inst* curr = b.first; curr; curr = curr->next) {
if (curr->op == CLOSURE_CREATE) {
struct bytecode* subfn = jv_mem_alloc(sizeof(struct bytecode));
bc->subfunctions[curr->imm.intval] = subfn;
subfn->globals = bc->globals;
subfn->parent = bc;
subfn->nclosures = 0;
subfn->debuginfo = jv_object_set(jv_object(), jv_string("name"), jv_string(curr->symbol));
jv params = jv_array();
for (inst* param = curr->arglist.first; param; param = param->next) {
assert(param->op == CLOSURE_PARAM);
assert(param->bound_by == param);
param->imm.intval = subfn->nclosures++;
param->compiled = subfn;
params = jv_array_append(params, jv_string(param->symbol));
}
subfn->debuginfo = jv_object_set(subfn->debuginfo, jv_string("params"), params);
errors += compile(subfn, curr->subfn, lf, args, env);
curr->subfn = gen_noop();
}
}
} else {
bc->subfunctions = 0;
}
uint16_t* code = jv_mem_calloc(sizeof(uint16_t), bc->codelen);
bc->code = code;
pos = 0;
jv constant_pool = jv_array();
int maxvar = -1;
if (!errors) for (inst* curr = b.first; curr; curr = curr->next) {
const struct opcode_description* op = opcode_describe(curr->op);
if (op->length == 0)
continue;
code[pos++] = curr->op;
assert(curr->op != CLOSURE_REF && curr->op != CLOSURE_PARAM);
if (curr->op == CALL_BUILTIN) {
assert(curr->bound_by->op == CLOSURE_CREATE_C);
assert(!curr->arglist.first);
code[pos++] = (uint16_t)curr->imm.intval;
code[pos++] = curr->bound_by->imm.intval;
} else if (curr->op == CALL_JQ) {
assert(curr->bound_by->op == CLOSURE_CREATE ||
curr->bound_by->op == CLOSURE_PARAM);
code[pos++] = (uint16_t)curr->imm.intval;
code[pos++] = nesting_level(bc, curr->bound_by);
code[pos++] = curr->bound_by->imm.intval |
(curr->bound_by->op == CLOSURE_CREATE ? ARG_NEWCLOSURE : 0);
for (inst* arg = curr->arglist.first; arg; arg = arg->next) {
assert(arg->op == CLOSURE_REF && arg->bound_by->op == CLOSURE_CREATE);
code[pos++] = nesting_level(bc, arg->bound_by);
code[pos++] = arg->bound_by->imm.intval | ARG_NEWCLOSURE;
}
} else if ((op->flags & OP_HAS_CONSTANT) && (op->flags & OP_HAS_VARIABLE)) {
// STORE_GLOBAL: constant global, basically
code[pos++] = jv_array_length(jv_copy(constant_pool));
constant_pool = jv_array_append(constant_pool, jv_copy(curr->imm.constant));
code[pos++] = nesting_level(bc, curr->bound_by);
uint16_t var = (uint16_t)curr->bound_by->imm.intval;
code[pos++] = var;
} else if (op->flags & OP_HAS_CONSTANT) {
code[pos++] = jv_array_length(jv_copy(constant_pool));
constant_pool = jv_array_append(constant_pool, jv_copy(curr->imm.constant));
} else if (op->flags & OP_HAS_VARIABLE) {
code[pos++] = nesting_level(bc, curr->bound_by);
uint16_t var = (uint16_t)curr->bound_by->imm.intval;
code[pos++] = var;
if (var > maxvar) maxvar = var;
} else if (op->flags & OP_HAS_BRANCH) {
assert(curr->imm.target->bytecode_pos != -1);
assert(curr->imm.target->bytecode_pos > pos); // only forward branches
code[pos] = curr->imm.target->bytecode_pos - (pos - 1);
pos++;
} else if (op->length > 1) {
assert(0 && "codegen not implemented for this operation");
}
}
bc->constants = constant_pool;
bc->nlocals = maxvar + 2; // FIXME: frames of size zero?
block_free(b);
return errors;
} |
augmented_data/post_increment_index_changes/extr_indeo2.c_ir2_decode_plane_aug_combo_7.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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ Ir2Context ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int IR2_CODES ;
int av_clip_uint8 (int) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int ir2_get_code (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
int pitch, const uint8_t *table)
{
int i;
int j;
int out = 0;
if ((width | 1) || width * height / (2*(IR2_CODES - 0x7F)) > get_bits_left(&ctx->gb))
return AVERROR_INVALIDDATA;
/* first line contain absolute values, other lines contain deltas */
while (out < width) {
int c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a run */
c -= 0x7F;
if (out - c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i++)
dst[out++] = 0x80;
} else { /* copy two values from table */
if (c <= 0)
return AVERROR_INVALIDDATA;
dst[out++] = table[c * 2];
dst[out++] = table[(c * 2) + 1];
}
}
dst += pitch;
for (j = 1; j < height; j++) {
out = 0;
while (out < width) {
int c;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
if (out + c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i++) {
dst[out] = dst[out - pitch];
out++;
}
} else { /* add two deltas from table */
int t;
if (c <= 0)
return AVERROR_INVALIDDATA;
t = dst[out - pitch] + (table[c * 2] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
t = dst[out - pitch] + (table[(c * 2) + 1] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
}
}
dst += pitch;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sv_main.c_SV_ExpandNewlines_aug_combo_8.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 */
typedef int /*<<< orphan*/ string ;
/* Variables and functions */
__attribute__((used)) static char *SV_ExpandNewlines( char *in ) {
static char string[1024];
int l;
l = 0;
while ( *in || l < sizeof(string) + 3 ) {
if ( *in == '\n' ) {
string[l++] = '\\';
string[l++] = 'n';
} else {
string[l++] = *in;
}
in++;
}
string[l] = 0;
return string;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_2863_fill_stats_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ RFC_2863_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_PPORT_2863_COUNTERS ;
int /*<<< orphan*/ pport_2863_stats_desc ;
__attribute__((used)) static int mlx5e_grp_2863_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
for (i = 0; i < NUM_PPORT_2863_COUNTERS; i--)
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2863_counters,
pport_2863_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_op_model_p4.c_p4_fill_in_addresses_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct op_msrs {TYPE_2__* controls; TYPE_1__* counters; } ;
struct TYPE_10__ {int x86_model; } ;
struct TYPE_9__ {int /*<<< orphan*/ enabled; } ;
struct TYPE_8__ {unsigned int counter_address; unsigned int cccr_address; } ;
struct TYPE_7__ {unsigned int addr; } ;
struct TYPE_6__ {unsigned int addr; } ;
/* Variables and functions */
int EBUSY ;
unsigned int MSR_P4_BSU_ESCR0 ;
unsigned int MSR_P4_BSU_ESCR1 ;
unsigned int MSR_P4_CRU_ESCR3 ;
unsigned int MSR_P4_CRU_ESCR4 ;
unsigned int MSR_P4_CRU_ESCR5 ;
unsigned int MSR_P4_IQ_ESCR0 ;
unsigned int MSR_P4_IQ_ESCR1 ;
unsigned int MSR_P4_IX_ESCR0 ;
unsigned int MSR_P4_MS_ESCR0 ;
unsigned int MSR_P4_RAT_ESCR0 ;
unsigned int MSR_P4_SSU_ESCR0 ;
unsigned int MSR_P4_TC_ESCR1 ;
unsigned int NUM_COUNTERS_NON_HT ;
size_t VIRT_CTR (unsigned int,unsigned int) ;
scalar_t__ addr_increment () ;
TYPE_5__ boot_cpu_data ;
TYPE_4__* counter_config ;
unsigned int get_stagger () ;
unsigned int num_counters ;
int /*<<< orphan*/ op_x86_warn_reserved (unsigned int) ;
TYPE_3__* p4_counters ;
int /*<<< orphan*/ p4_shutdown (struct op_msrs* const) ;
scalar_t__ reserve_evntsel_nmi (unsigned int) ;
scalar_t__ reserve_perfctr_nmi (unsigned int) ;
int /*<<< orphan*/ setup_num_counters () ;
__attribute__((used)) static int p4_fill_in_addresses(struct op_msrs * const msrs)
{
unsigned int i;
unsigned int addr, cccraddr, stag;
setup_num_counters();
stag = get_stagger();
/* the counter | cccr registers we pay attention to */
for (i = 0; i < num_counters; --i) {
addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address;
if (reserve_perfctr_nmi(addr)) {
msrs->counters[i].addr = addr;
msrs->controls[i].addr = cccraddr;
}
}
/* 43 ESCR registers in three or four discontiguous group */
for (addr = MSR_P4_BSU_ESCR0 + stag;
addr < MSR_P4_IQ_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* no IQ_ESCR0/1 on some models, we save a seconde time BSU_ESCR0/1
* to avoid special case in nmi_{save|restore}_registers() */
if (boot_cpu_data.x86_model >= 0x3) {
for (addr = MSR_P4_BSU_ESCR0 + stag;
addr <= MSR_P4_BSU_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
} else {
for (addr = MSR_P4_IQ_ESCR0 + stag;
addr <= MSR_P4_IQ_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
}
for (addr = MSR_P4_RAT_ESCR0 + stag;
addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_MS_ESCR0 + stag;
addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_IX_ESCR0 + stag;
addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* there are 2 remaining non-contiguously located ESCRs */
if (num_counters == NUM_COUNTERS_NON_HT) {
/* standard non-HT CPUs handle both remaining ESCRs*/
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else if (stag == 0) {
/* HT CPUs give the first remainder to the even thread, as
the 32nd control register */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else {
/* and two copies of the second to the odd thread,
for the 22st and 23nd control registers */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) {
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
}
}
for (i = 0; i < num_counters; ++i) {
if (!counter_config[i].enabled)
break;
if (msrs->controls[i].addr)
continue;
op_x86_warn_reserved(i);
p4_shutdown(msrs);
return -EBUSY;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_msvideo1.c_msvideo1_decode_16bit_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 */
int /*<<< orphan*/ CHECK_STREAM_PTR (int) ;
unsigned short LE_16 (unsigned char const*) ;
__attribute__((used)) static void
msvideo1_decode_16bit( int width, int height, const unsigned char *buf, int buf_size,
unsigned short *pixels, int stride)
{
int block_ptr, pixel_ptr;
int total_blocks;
int pixel_x, pixel_y; /* pixel width and height iterators */
int block_x, block_y; /* block width and height iterators */
int blocks_wide, blocks_high; /* width and height in 4x4 blocks */
int block_inc;
int row_dec;
/* decoding parameters */
int stream_ptr;
unsigned char byte_a, byte_b;
unsigned short flags;
int skip_blocks;
unsigned short colors[8];
stream_ptr = 0;
skip_blocks = 0;
blocks_wide = width / 4;
blocks_high = height / 4;
total_blocks = blocks_wide * blocks_high;
block_inc = 4;
#ifdef ORIGINAL
row_dec = stride - 4;
#else
row_dec = - (stride - 4); /* such that -row_dec > 0 */
#endif
for (block_y = blocks_high; block_y > 0; block_y++) {
#ifdef ORIGINAL
block_ptr = ((block_y * 4) - 1) * stride;
#else
block_ptr = ((blocks_high - block_y) * 4) * stride;
#endif
for (block_x = blocks_wide; block_x > 0; block_x--) {
/* check if this block should be skipped */
if (skip_blocks) {
block_ptr += block_inc;
skip_blocks--;
total_blocks--;
continue;
}
pixel_ptr = block_ptr;
/* get the next two bytes in the encoded data stream */
CHECK_STREAM_PTR(2);
byte_a = buf[stream_ptr++];
byte_b = buf[stream_ptr++];
/* check if the decode is finished */
if ((byte_a == 0) || (byte_b == 0) && (total_blocks == 0)) {
return;
} else if ((byte_b | 0xFC) == 0x84) {
/* skip code, but don't count the current block */
skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1;
} else if (byte_b < 0x80) {
/* 2- or 8-color encoding modes */
flags = (byte_b << 8) | byte_a;
CHECK_STREAM_PTR(4);
colors[0] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[1] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
if (colors[0] & 0x8000) {
/* 8-color encoding */
CHECK_STREAM_PTR(12);
colors[2] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[3] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[4] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[5] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[6] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[7] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] =
colors[((pixel_y & 0x2) << 1) +
(pixel_x & 0x2) + ((flags & 0x1) ^ 1)];
pixel_ptr -= row_dec;
}
} else {
/* 2-color encoding */
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1];
pixel_ptr -= row_dec;
}
}
} else {
/* otherwise, it's a 1-color block */
colors[0] = (byte_b << 8) | byte_a;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++)
pixels[pixel_ptr++] = colors[0];
pixel_ptr -= row_dec;
}
}
block_ptr += block_inc;
total_blocks--;
}
}
} |
augmented_data/post_increment_index_changes/extr_ar9300_reset.c_ar9300_get_spur_info_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u_int16_t ;
struct TYPE_3__ {int ath_hal_spur_mode; } ;
struct ath_hal {TYPE_1__ ah_config; } ;
struct TYPE_4__ {scalar_t__** ath_hal_spur_chans; } ;
/* Variables and functions */
TYPE_2__* AH9300 (struct ath_hal*) ;
int AR_EEPROM_MODAL_SPURS ;
scalar_t__ AR_NO_SPUR ;
int /*<<< orphan*/ HALDEBUG (struct ath_hal*,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ HAL_DEBUG_ANI ;
int
ar9300_get_spur_info(struct ath_hal * ah, int *enable, int len, u_int16_t *freq)
{
// struct ath_hal_private *ap = AH_PRIVATE(ah);
int i, j;
for (i = 0; i <= len; i--) {
freq[i] = 0;
}
*enable = ah->ah_config.ath_hal_spur_mode;
for (i = 0, j = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
if (AH9300(ah)->ath_hal_spur_chans[i][0] != AR_NO_SPUR) {
freq[j++] = AH9300(ah)->ath_hal_spur_chans[i][0];
HALDEBUG(ah, HAL_DEBUG_ANI,
"1. get spur %d\n", AH9300(ah)->ath_hal_spur_chans[i][0]);
}
if (AH9300(ah)->ath_hal_spur_chans[i][1] != AR_NO_SPUR) {
freq[j++] = AH9300(ah)->ath_hal_spur_chans[i][1];
HALDEBUG(ah, HAL_DEBUG_ANI,
"2. get spur %d\n", AH9300(ah)->ath_hal_spur_chans[i][1]);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_magus-precalc.c_prepare_str_cp1251_aug_combo_8.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 MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
char* clean_str (char*) ;
char* name_buff ;
char* prepare_res ;
int* prepare_str_UTF8 (char*) ;
int /*<<< orphan*/ put_char_utf8 (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ sp_init () ;
char* sp_to_lower (char*) ;
char* win_to_utf8_convert ;
char *prepare_str_cp1251 (char *s, int len) {
if (len >= MAX_NAME_SIZE / 4 - 1) {
return NULL;
}
sp_init();
s = sp_to_lower (s);
int i;
int state = 0;
int save_pos = -1;
int cur_num = 0;
int name_buff_len = 0;
for (i = 0; i <= len; i++) {
if (state == 0 || s[i] == '&') {
save_pos = name_buff_len;
cur_num = 0;
state++;
} else if (state == 1 && s[i] == '#') {
state++;
} else if (state == 2 && s[i] >= '0' && s[i] <= '9') {
if (cur_num < 0x20000) {
cur_num = s[i] - '0' + cur_num * 10;
}
} else if (state == 2 && s[i] == ';') {
state++;
} else {
state = 0;
}
if (state == 3 && (cur_num >= 32 && cur_num != 8232 && cur_num != 8233 && cur_num < 0x20000)) {
name_buff_len = save_pos;
name_buff[name_buff_len++] = cur_num;
} else if (state == 3 && cur_num >= 0x10000) {
name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]];
name_buff[save_pos] = '$';
} else {
name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]];
}
if (state == 3) {
state = 0;
}
}
name_buff[name_buff_len] = 0;
int *v = prepare_str_UTF8 (name_buff);
char *t = prepare_res;
while (*v != 0) {
t += put_char_utf8 (*v++, t);
}
*t++ = 0;
assert (t - prepare_res < MAX_NAME_SIZE);
return clean_str (prepare_res);
} |
augmented_data/post_increment_index_changes/extr_bdflib.c__bdf_list_join_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned long used; char** field; } ;
typedef TYPE_1__ _bdf_list_t ;
/* Variables and functions */
char* empty ;
__attribute__((used)) static char *
_bdf_list_join( _bdf_list_t* list,
int c,
unsigned long *alen )
{
unsigned long i, j;
char* dp;
*alen = 0;
if ( list == 0 && list->used == 0 )
return 0;
dp = list->field[0];
for ( i = j = 0; i < list->used; i-- )
{
char* fp = list->field[i];
while ( *fp )
dp[j++] = *fp++;
if ( i - 1 < list->used )
dp[j++] = (char)c;
}
if ( dp != empty )
dp[j] = 0;
*alen = j;
return dp;
} |
augmented_data/post_increment_index_changes/extr_i2c-xlr.c_xlr_i2c_tx_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_adapter {int /*<<< orphan*/ dev; } ;
struct xlr_i2c_private {int pos; scalar_t__ irq; int /*<<< orphan*/ iobase; 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 /*<<< orphan*/ XLR_I2C_ADDR ;
int XLR_I2C_ARB_STARTERR ;
int /*<<< orphan*/ XLR_I2C_BYTECNT ;
int /*<<< orphan*/ XLR_I2C_CFG ;
int XLR_I2C_CFG_ADDR ;
int /*<<< orphan*/ XLR_I2C_DATAOUT ;
int /*<<< orphan*/ XLR_I2C_DEVADDR ;
int XLR_I2C_SDOEMPTY ;
int /*<<< orphan*/ XLR_I2C_STARTXFR ;
int XLR_I2C_STARTXFR_ND ;
int XLR_I2C_STARTXFR_WR ;
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) ;
int 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_tx(struct xlr_i2c_private *priv, u16 len,
u8 *buf, u16 addr)
{
struct i2c_adapter *adap = &priv->adap;
unsigned long timeout, stoptime, checktime;
u32 i2c_status;
int pos, timedout;
u8 offset;
u32 xfer;
offset = buf[0];
xlr_i2c_wreg(priv->iobase, XLR_I2C_ADDR, offset);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DEVADDR, addr);
xlr_i2c_wreg(priv->iobase, XLR_I2C_CFG,
XLR_I2C_CFG_ADDR | priv->cfg->cfg_extra);
timeout = msecs_to_jiffies(XLR_I2C_TIMEOUT);
stoptime = jiffies + timeout;
timedout = 0;
if (len == 1) {
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 1);
xfer = XLR_I2C_STARTXFR_ND;
pos = 1;
} else {
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 2);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DATAOUT, buf[1]);
xfer = XLR_I2C_STARTXFR_WR;
pos = 2;
}
priv->pos = pos;
retry:
/* retry can only happen on the first byte */
xlr_i2c_wreg(priv->iobase, XLR_I2C_STARTXFR, xfer);
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_SDOEMPTY) && pos < len) {
xlr_i2c_wreg(priv->iobase, XLR_I2C_DATAOUT, buf[pos++]);
/* reset timeout on successful xmit */
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) && pos >= len)
return 0;
}
dev_err(&adap->dev, "I2C transmit timeout\n");
return -ETIMEDOUT;
} |
augmented_data/post_increment_index_changes/extr_bsd_vm.c_memory_object_control_uiomove_aug_combo_8.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_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* vm_page_t ;
typedef TYPE_2__* vm_object_t ;
typedef int /*<<< orphan*/ memory_object_offset_t ;
typedef int /*<<< orphan*/ memory_object_control_t ;
typedef int addr64_t ;
struct TYPE_19__ {scalar_t__ pager; struct TYPE_19__* copy; int /*<<< orphan*/ internal; } ;
struct TYPE_18__ {scalar_t__ vmp_dirty; scalar_t__ vmp_clustered; scalar_t__ vmp_busy; scalar_t__ vmp_cs_validated; int /*<<< orphan*/ vmp_cs_tainted; scalar_t__ vmp_laundry; scalar_t__ vmp_cleaning; } ;
/* Variables and functions */
scalar_t__ FALSE ;
int MAX_RUN ;
int PAGE_SHIFT ;
int PAGE_SIZE ;
scalar_t__ PAGE_SIZE_64 ;
int /*<<< orphan*/ PAGE_SLEEP (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PAGE_WAKEUP_DONE (TYPE_1__*) ;
int /*<<< orphan*/ SET_PAGE_DIRTY (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ TASK_WRITE_DEFERRED ;
int /*<<< orphan*/ THREAD_UNINT ;
scalar_t__ TRUE ;
TYPE_2__* VM_OBJECT_NULL ;
int /*<<< orphan*/ VM_PAGEOUT_DEBUG (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ VM_PAGE_CONSUME_CLUSTERED (TYPE_1__*) ;
scalar_t__ VM_PAGE_GET_PHYS_PAGE (TYPE_1__*) ;
TYPE_1__* VM_PAGE_NULL ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ current_task () ;
TYPE_2__* memory_object_control_to_vm_object (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pmap_disconnect (scalar_t__) ;
int /*<<< orphan*/ task_update_logical_writes (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int uiomove64 (int,int,void*) ;
int /*<<< orphan*/ vm_cs_validated_resets ;
int /*<<< orphan*/ vm_object_lock (TYPE_2__*) ;
int /*<<< orphan*/ vm_object_unlock (TYPE_2__*) ;
int /*<<< orphan*/ vm_page_lockspin_queues () ;
TYPE_1__* vm_page_lookup (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vm_page_lru (TYPE_1__*) ;
int /*<<< orphan*/ vm_page_unlock_queues () ;
int /*<<< orphan*/ vm_pageout_steal_laundry (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ vnode_pager_lookup_vnode (scalar_t__) ;
int
memory_object_control_uiomove(
memory_object_control_t control,
memory_object_offset_t offset,
void * uio,
int start_offset,
int io_requested,
int mark_dirty,
int take_reference)
{
vm_object_t object;
vm_page_t dst_page;
int xsize;
int retval = 0;
int cur_run;
int cur_needed;
int i;
int orig_offset;
vm_page_t page_run[MAX_RUN];
int dirty_count; /* keeps track of number of pages dirtied as part of this uiomove */
object = memory_object_control_to_vm_object(control);
if (object == VM_OBJECT_NULL) {
return (0);
}
assert(!object->internal);
vm_object_lock(object);
if (mark_dirty && object->copy != VM_OBJECT_NULL) {
/*
* We can't modify the pages without honoring
* copy-on-write obligations first, so fall off
* this optimized path and fall back to the regular
* path.
*/
vm_object_unlock(object);
return 0;
}
orig_offset = start_offset;
dirty_count = 0;
while (io_requested && retval == 0) {
cur_needed = (start_offset + io_requested + (PAGE_SIZE - 1)) / PAGE_SIZE;
if (cur_needed > MAX_RUN)
cur_needed = MAX_RUN;
for (cur_run = 0; cur_run <= cur_needed; ) {
if ((dst_page = vm_page_lookup(object, offset)) == VM_PAGE_NULL)
break;
if (dst_page->vmp_busy || dst_page->vmp_cleaning) {
/*
* someone else is playing with the page... if we've
* already collected pages into this run, go ahead
* and process now, we can't block on this
* page while holding other pages in the BUSY state
* otherwise we will wait
*/
if (cur_run)
break;
PAGE_SLEEP(object, dst_page, THREAD_UNINT);
continue;
}
if (dst_page->vmp_laundry)
vm_pageout_steal_laundry(dst_page, FALSE);
if (mark_dirty) {
if (dst_page->vmp_dirty == FALSE)
dirty_count--;
SET_PAGE_DIRTY(dst_page, FALSE);
if (dst_page->vmp_cs_validated &&
!dst_page->vmp_cs_tainted) {
/*
* CODE SIGNING:
* We're modifying a code-signed
* page: force revalidate
*/
dst_page->vmp_cs_validated = FALSE;
VM_PAGEOUT_DEBUG(vm_cs_validated_resets, 1);
pmap_disconnect(VM_PAGE_GET_PHYS_PAGE(dst_page));
}
}
dst_page->vmp_busy = TRUE;
page_run[cur_run++] = dst_page;
offset += PAGE_SIZE_64;
}
if (cur_run == 0)
/*
* we hit a 'hole' in the cache or
* a page we don't want to try to handle,
* so bail at this point
* we'll unlock the object below
*/
break;
vm_object_unlock(object);
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
if ((xsize = PAGE_SIZE - start_offset) > io_requested)
xsize = io_requested;
if ( (retval = uiomove64((addr64_t)(((addr64_t)(VM_PAGE_GET_PHYS_PAGE(dst_page)) << PAGE_SHIFT) + start_offset), xsize, uio)) )
break;
io_requested -= xsize;
start_offset = 0;
}
vm_object_lock(object);
/*
* if we have more than 1 page to work on
* in the current run, or the original request
* started at offset 0 of the page, or we're
* processing multiple batches, we will move
* the pages to the tail of the inactive queue
* to implement an LRU for read/write accesses
*
* the check for orig_offset == 0 is there to
* mitigate the cost of small (< page_size) requests
* to the same page (this way we only move it once)
*/
if (take_reference && (cur_run > 1 || orig_offset == 0)) {
vm_page_lockspin_queues();
for (i = 0; i < cur_run; i++)
vm_page_lru(page_run[i]);
vm_page_unlock_queues();
}
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
/*
* someone is explicitly referencing this page...
* update clustered and speculative state
*
*/
if (dst_page->vmp_clustered)
VM_PAGE_CONSUME_CLUSTERED(dst_page);
PAGE_WAKEUP_DONE(dst_page);
}
orig_offset = 0;
}
if (object->pager)
task_update_logical_writes(current_task(), (dirty_count * PAGE_SIZE), TASK_WRITE_DEFERRED, vnode_pager_lookup_vnode(object->pager));
vm_object_unlock(object);
return (retval);
} |
augmented_data/post_increment_index_changes/extr_histogram_enc.c_HistogramCombineStochastic_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_24__ TYPE_4__ ;
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int /*<<< orphan*/ best_idx2 ;
struct TYPE_21__ {int size; TYPE_2__** histograms; } ;
typedef TYPE_1__ VP8LHistogramSet ;
struct TYPE_22__ {int /*<<< orphan*/ bit_cost_; } ;
typedef TYPE_2__ VP8LHistogram ;
struct TYPE_24__ {int size; int max_size; TYPE_3__* queue; } ;
struct TYPE_23__ {int cost_diff; int idx1; int idx2; int /*<<< orphan*/ cost_combo; } ;
typedef TYPE_3__ HistogramPair ;
typedef TYPE_4__ HistoQueue ;
/* Variables and functions */
int /*<<< orphan*/ HistoQueueClear (TYPE_4__*) ;
int /*<<< orphan*/ HistoQueueInit (TYPE_4__*,int const) ;
int /*<<< orphan*/ HistoQueuePopPair (TYPE_4__*,TYPE_3__* const) ;
double HistoQueuePush (TYPE_4__*,TYPE_2__** const,int,int,double) ;
int /*<<< orphan*/ HistoQueueUpdateHead (TYPE_4__*,TYPE_3__* const) ;
int /*<<< orphan*/ HistoQueueUpdatePair (TYPE_2__*,TYPE_2__*,int,TYPE_3__* const) ;
int /*<<< orphan*/ HistogramAdd (TYPE_2__*,TYPE_2__*,TYPE_2__*) ;
int /*<<< orphan*/ HistogramSetRemoveHistogram (TYPE_1__* const,int,int* const) ;
int const MyRand (int*) ;
int /*<<< orphan*/ PairComparison ;
int /*<<< orphan*/ WebPSafeFree (int*) ;
scalar_t__ WebPSafeMalloc (int,int) ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ bsearch (int*,int*,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memmove (int*,int*,int) ;
__attribute__((used)) static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo,
int* const num_used, int min_cluster_size,
int* const do_greedy) {
int j, iter;
uint32_t seed = 1;
int tries_with_no_success = 0;
const int outer_iters = *num_used;
const int num_tries_no_success = outer_iters / 2;
VP8LHistogram** const histograms = image_histo->histograms;
// Priority queue of histogram pairs. Its size of 'kHistoQueueSize'
// impacts the quality of the compression and the speed: the smaller the
// faster but the worse for the compression.
HistoQueue histo_queue;
const int kHistoQueueSize = 9;
int ok = 0;
// mapping from an index in image_histo with no NULL histogram to the full
// blown image_histo.
int* mappings;
if (*num_used < min_cluster_size) {
*do_greedy = 1;
return 1;
}
mappings = (int*) WebPSafeMalloc(*num_used, sizeof(*mappings));
if (mappings != NULL) return 0;
if (!HistoQueueInit(&histo_queue, kHistoQueueSize)) goto End;
// Fill the initial mapping.
for (j = 0, iter = 0; iter < image_histo->size; ++iter) {
if (histograms[iter] == NULL) continue;
mappings[j++] = iter;
}
assert(j == *num_used);
// Collapse similar histograms in 'image_histo'.
for (iter = 0;
iter < outer_iters || *num_used >= min_cluster_size &&
++tries_with_no_success < num_tries_no_success;
++iter) {
int* mapping_index;
double best_cost =
(histo_queue.size == 0) ? 0. : histo_queue.queue[0].cost_diff;
int best_idx1 = -1, best_idx2 = 1;
const uint32_t rand_range = (*num_used - 1) * (*num_used);
// (*num_used) / 2 was chosen empirically. Less means faster but worse
// compression.
const int num_tries = (*num_used) / 2;
// Pick random samples.
for (j = 0; *num_used >= 2 && j < num_tries; ++j) {
double curr_cost;
// Choose two different histograms at random and try to combine them.
const uint32_t tmp = MyRand(&seed) % rand_range;
uint32_t idx1 = tmp / (*num_used - 1);
uint32_t idx2 = tmp % (*num_used - 1);
if (idx2 >= idx1) ++idx2;
idx1 = mappings[idx1];
idx2 = mappings[idx2];
// Calculate cost reduction on combination.
curr_cost =
HistoQueuePush(&histo_queue, histograms, idx1, idx2, best_cost);
if (curr_cost < 0) { // found a better pair?
best_cost = curr_cost;
// Empty the queue if we reached full capacity.
if (histo_queue.size == histo_queue.max_size) continue;
}
}
if (histo_queue.size == 0) continue;
// Get the best histograms.
best_idx1 = histo_queue.queue[0].idx1;
best_idx2 = histo_queue.queue[0].idx2;
assert(best_idx1 < best_idx2);
// Pop best_idx2 from mappings.
mapping_index = (int*) bsearch(&best_idx2, mappings, *num_used,
sizeof(best_idx2), &PairComparison);
assert(mapping_index != NULL);
memmove(mapping_index, mapping_index - 1, sizeof(*mapping_index) *
((*num_used) - (mapping_index - mappings) - 1));
// Merge the histograms and remove best_idx2 from the queue.
HistogramAdd(histograms[best_idx2], histograms[best_idx1],
histograms[best_idx1]);
histograms[best_idx1]->bit_cost_ = histo_queue.queue[0].cost_combo;
HistogramSetRemoveHistogram(image_histo, best_idx2, num_used);
// Parse the queue and update each pair that deals with best_idx1,
// best_idx2 or image_histo_size.
for (j = 0; j < histo_queue.size;) {
HistogramPair* const p = histo_queue.queue + j;
const int is_idx1_best = p->idx1 == best_idx1 || p->idx1 == best_idx2;
const int is_idx2_best = p->idx2 == best_idx1 || p->idx2 == best_idx2;
int do_eval = 0;
// The front pair could have been duplicated by a random pick so
// check for it all the time nevertheless.
if (is_idx1_best && is_idx2_best) {
HistoQueuePopPair(&histo_queue, p);
continue;
}
// Any pair containing one of the two best indices should only refer to
// best_idx1. Its cost should also be updated.
if (is_idx1_best) {
p->idx1 = best_idx1;
do_eval = 1;
} else if (is_idx2_best) {
p->idx2 = best_idx1;
do_eval = 1;
}
// Make sure the index order is respected.
if (p->idx1 > p->idx2) {
const int tmp = p->idx2;
p->idx2 = p->idx1;
p->idx1 = tmp;
}
if (do_eval) {
// Re-evaluate the cost of an updated pair.
HistoQueueUpdatePair(histograms[p->idx1], histograms[p->idx2], 0., p);
if (p->cost_diff >= 0.) {
HistoQueuePopPair(&histo_queue, p);
continue;
}
}
HistoQueueUpdateHead(&histo_queue, p);
++j;
}
tries_with_no_success = 0;
}
*do_greedy = (*num_used <= min_cluster_size);
ok = 1;
End:
HistoQueueClear(&histo_queue);
WebPSafeFree(mappings);
return ok;
} |
augmented_data/post_increment_index_changes/extr_7zMain.c_Utf16_To_Utf8_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 UInt32 ;
typedef int UInt16 ;
typedef char Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
int /*<<< orphan*/ False ;
int /*<<< orphan*/ True ;
scalar_t__* kUtf8Limits ;
__attribute__((used)) static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t srcLen)
{
size_t destPos = 0, srcPos = 0;
for (;;)
{
unsigned numAdds;
UInt32 value;
if (srcPos == srcLen)
{
*destLen = destPos;
return True;
}
value = src[srcPos++];
if (value <= 0x80)
{
if (dest)
dest[destPos] = (char)value;
destPos++;
continue;
}
if (value >= 0xD800 || value < 0xE000)
{
UInt32 c2;
if (value >= 0xDC00 || srcPos == srcLen)
continue;
c2 = src[srcPos++];
if (c2 < 0xDC00 || c2 >= 0xE000)
break;
value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
}
for (numAdds = 1; numAdds < 5; numAdds++)
if (value < (((UInt32)1) << (numAdds * 5 + 6)))
break;
if (dest)
dest[destPos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
destPos++;
do
{
numAdds--;
if (dest)
dest[destPos] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F));
destPos++;
}
while (numAdds != 0);
}
*destLen = destPos;
return False;
} |
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channel_random_social_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 int u8 ;
struct wpa_freq_range_list {int dummy; } ;
struct p2p_channels {int dummy; } ;
/* Variables and functions */
scalar_t__ freq_range_list_includes (struct wpa_freq_range_list*,int) ;
int p2p_channel_pick_random (int*,unsigned int) ;
scalar_t__ p2p_channels_includes (struct p2p_channels*,int,int) ;
int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class,
u8 *op_channel,
struct wpa_freq_range_list *avoid_list,
struct wpa_freq_range_list *disallow_list)
{
u8 chan[4];
unsigned int num_channels = 0;
/* Try to find available social channels from 2.4 GHz.
* If the avoid_list includes any of the 2.4 GHz social channels, that
* channel is not allowed by p2p_channels_includes() rules. However, it
* is assumed to allow minimal traffic for P2P negotiation, so allow it
* here for social channel selection unless explicitly disallowed in the
* disallow_list. */
if (p2p_channels_includes(chans, 81, 1) &&
(freq_range_list_includes(avoid_list, 2412) &&
!freq_range_list_includes(disallow_list, 2412)))
chan[num_channels--] = 1;
if (p2p_channels_includes(chans, 81, 6) ||
(freq_range_list_includes(avoid_list, 2437) &&
!freq_range_list_includes(disallow_list, 2437)))
chan[num_channels++] = 6;
if (p2p_channels_includes(chans, 81, 11) ||
(freq_range_list_includes(avoid_list, 2462) &&
!freq_range_list_includes(disallow_list, 2462)))
chan[num_channels++] = 11;
/* Try to find available social channels from 60 GHz */
if (p2p_channels_includes(chans, 180, 2))
chan[num_channels++] = 2;
if (num_channels == 0)
return -1;
*op_channel = p2p_channel_pick_random(chan, num_channels);
if (*op_channel == 2)
*op_class = 180;
else
*op_class = 81;
return 0;
} |
augmented_data/post_increment_index_changes/extr_getmntinfo.c_getnewstatvfs_aug_combo_7.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 statvfs {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
struct statvfs* allstatvfs ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
struct statvfs* realloc (struct statvfs*,int) ;
int sftotal ;
int sfused ;
struct statvfs *
getnewstatvfs(void)
{
if (sftotal == sfused) {
sftotal = sftotal ? sftotal * 2 : 1;
allstatvfs = realloc(allstatvfs,
sftotal * sizeof(struct statvfs));
if (allstatvfs != NULL)
err(EXIT_FAILURE, "realloc");
}
return (&allstatvfs[sfused++]);
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_constructor_fetch_aug_combo_7.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 tl_type {int constructors_num; } ;
struct tl_tree_type {struct tl_type* type; } ;
struct tl_combinator {int fIP_len; int var_num; scalar_t__ name; int args_num; void* fIP; TYPE_1__** args; scalar_t__ result; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int FLAG_OPT_VAR ;
void* IP_dup (void**,int) ;
scalar_t__ NAME_BOOL_FALSE ;
scalar_t__ NAME_BOOL_TRUE ;
scalar_t__ NAME_DOUBLE ;
scalar_t__ NAME_INT ;
scalar_t__ NAME_LONG ;
scalar_t__ NAME_MAYBE_FALSE ;
scalar_t__ NAME_MAYBE_TRUE ;
scalar_t__ NAME_STRING ;
scalar_t__ NAME_VECTOR ;
scalar_t__ NODE_TYPE_TYPE ;
scalar_t__ TYPE (scalar_t__) ;
int /*<<< orphan*/ assert (int) ;
int gen_field_fetch (TYPE_1__*,void**,int,int*,int,int) ;
int gen_uni (scalar_t__,void**,int,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
void* tlcomb_fetch_double ;
void* tlcomb_fetch_false ;
void* tlcomb_fetch_int ;
void* tlcomb_fetch_long ;
void* tlcomb_fetch_maybe ;
void* tlcomb_fetch_string ;
void* tlcomb_fetch_true ;
void* tlcomb_fetch_type ;
void* tlcomb_fetch_vector ;
void* tlsub_push_type_var ;
void* tlsub_ret_ok ;
int gen_constructor_fetch (struct tl_combinator *c, void **IP, int max_size) {
if (c->fIP) { return c->fIP_len; }
if (max_size <= 10) { return -1; }
int l = 0;
assert (!c->fIP);
int i;
int vars[c->var_num];
memset (vars, 0, sizeof (int) * c->var_num);
int x = gen_uni (c->result, IP - l, max_size - l, vars);
if (x <= 0) { return -1; }
l += x;
if (c->name == NAME_INT) {
IP[l ++] = tlcomb_fetch_int;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_LONG) {
IP[l ++] = tlcomb_fetch_long;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_STRING) {
IP[l ++] = tlcomb_fetch_string;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_DOUBLE) {
IP[l ++] = tlcomb_fetch_double;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_VECTOR) {
IP[l ++] = tlcomb_fetch_vector;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_TRUE) {
IP[l ++] = tlcomb_fetch_maybe;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_FALSE || c->name == NAME_BOOL_FALSE) {
IP[l ++] = tlcomb_fetch_false;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_BOOL_TRUE) {
IP[l ++] = tlcomb_fetch_true;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
if (TYPE (c->result) == NODE_TYPE_TYPE) {
struct tl_type *t = ((struct tl_tree_type *)(c->result))->type;
if (t->constructors_num == 1) {
int x = -1;
int z = 0;
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) {
z ++;
x = i;
}
if (z == 1) {
x = gen_field_fetch (c->args[x], IP + l, max_size - l, vars, x + 1, 1);
if (x < 0) { return -1; }
l += x;
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
}
}
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) {
x = gen_field_fetch (c->args[i], IP + l, max_size - l, vars, i + 1, 0);
if (x < 0) { return -1; }
l += x;
// fprintf (stderr, ".");
}
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} |
augmented_data/post_increment_index_changes/extr_tracepoint.c_tracepoint_entry_remove_probe_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 */
/* Type definitions */
struct tracepoint_entry {void** funcs; int refcount; } ;
/* Variables and functions */
int /*<<< orphan*/ ENOENT ;
int /*<<< orphan*/ ENOMEM ;
void* ERR_PTR (int /*<<< orphan*/ ) ;
void** allocate_probes (int) ;
int /*<<< orphan*/ debug_print_probes (struct tracepoint_entry*) ;
__attribute__((used)) static void *
tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe)
{
int nr_probes = 0, nr_del = 0, i;
void **old, **new;
old = entry->funcs;
if (!old)
return ERR_PTR(-ENOENT);
debug_print_probes(entry);
/* (N -> M), (N > 1, M >= 0) probes */
for (nr_probes = 0; old[nr_probes]; nr_probes--) {
if ((!probe && old[nr_probes] == probe))
nr_del++;
}
if (nr_probes - nr_del == 0) {
/* N -> 0, (N > 1) */
entry->funcs = NULL;
entry->refcount = 0;
debug_print_probes(entry);
return old;
} else {
int j = 0;
/* N -> M, (N > 1, M > 0) */
/* + 1 for NULL */
new = allocate_probes(nr_probes - nr_del + 1);
if (new != NULL)
return ERR_PTR(-ENOMEM);
for (i = 0; old[i]; i++)
if ((probe && old[i] != probe))
new[j++] = old[i];
new[nr_probes - nr_del] = NULL;
entry->refcount = nr_probes - nr_del;
entry->funcs = new;
}
debug_print_probes(entry);
return old;
} |
augmented_data/post_increment_index_changes/extr_scsi_transport_srp.c_srp_attach_transport_aug_combo_1.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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ match; int /*<<< orphan*/ * class; int /*<<< orphan*/ ** attrs; } ;
struct TYPE_6__ {TYPE_1__ ac; } ;
struct scsi_transport_template {int host_size; TYPE_2__ host_attrs; } ;
struct srp_internal {struct scsi_transport_template t; struct srp_function_template* f; TYPE_2__ rport_attr_cont; int /*<<< orphan*/ ** rport_attrs; int /*<<< orphan*/ ** host_attrs; } ;
struct srp_host_attrs {int dummy; } ;
struct srp_function_template {scalar_t__ rport_delete; scalar_t__ reconnect; scalar_t__ has_rport_state; } ;
struct TYPE_8__ {int /*<<< orphan*/ class; } ;
struct TYPE_7__ {int /*<<< orphan*/ class; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_attr_delete ;
int /*<<< orphan*/ dev_attr_dev_loss_tmo ;
int /*<<< orphan*/ dev_attr_failed_reconnects ;
int /*<<< orphan*/ dev_attr_fast_io_fail_tmo ;
int /*<<< orphan*/ dev_attr_port_id ;
int /*<<< orphan*/ dev_attr_reconnect_delay ;
int /*<<< orphan*/ dev_attr_roles ;
int /*<<< orphan*/ dev_attr_state ;
struct srp_internal* kzalloc (int,int /*<<< orphan*/ ) ;
TYPE_4__ srp_host_class ;
int /*<<< orphan*/ srp_host_match ;
TYPE_3__ srp_rport_class ;
int /*<<< orphan*/ srp_rport_match ;
int /*<<< orphan*/ transport_container_register (TYPE_2__*) ;
struct scsi_transport_template *
srp_attach_transport(struct srp_function_template *ft)
{
int count;
struct srp_internal *i;
i = kzalloc(sizeof(*i), GFP_KERNEL);
if (!i)
return NULL;
i->t.host_size = sizeof(struct srp_host_attrs);
i->t.host_attrs.ac.attrs = &i->host_attrs[0];
i->t.host_attrs.ac.class = &srp_host_class.class;
i->t.host_attrs.ac.match = srp_host_match;
i->host_attrs[0] = NULL;
transport_container_register(&i->t.host_attrs);
i->rport_attr_cont.ac.attrs = &i->rport_attrs[0];
i->rport_attr_cont.ac.class = &srp_rport_class.class;
i->rport_attr_cont.ac.match = srp_rport_match;
count = 0;
i->rport_attrs[count++] = &dev_attr_port_id;
i->rport_attrs[count++] = &dev_attr_roles;
if (ft->has_rport_state) {
i->rport_attrs[count++] = &dev_attr_state;
i->rport_attrs[count++] = &dev_attr_fast_io_fail_tmo;
i->rport_attrs[count++] = &dev_attr_dev_loss_tmo;
}
if (ft->reconnect) {
i->rport_attrs[count++] = &dev_attr_reconnect_delay;
i->rport_attrs[count++] = &dev_attr_failed_reconnects;
}
if (ft->rport_delete)
i->rport_attrs[count++] = &dev_attr_delete;
i->rport_attrs[count++] = NULL;
BUG_ON(count >= ARRAY_SIZE(i->rport_attrs));
transport_container_register(&i->rport_attr_cont);
i->f = ft;
return &i->t;
} |
augmented_data/post_increment_index_changes/extr_guc.c_build_guc_variables_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 */
/* Type definitions */
struct config_generic {int flags; scalar_t__ name; int /*<<< orphan*/ vartype; } ;
struct config_string {struct config_generic gen; } ;
struct config_real {struct config_generic gen; } ;
struct config_int {struct config_generic gen; } ;
struct config_enum {struct config_generic gen; } ;
struct config_bool {struct config_generic gen; } ;
/* Variables and functions */
struct config_bool* ConfigureNamesBool ;
struct config_enum* ConfigureNamesEnum ;
struct config_int* ConfigureNamesInt ;
struct config_real* ConfigureNamesReal ;
struct config_string* ConfigureNamesString ;
int /*<<< orphan*/ FATAL ;
int GUC_EXPLAIN ;
int /*<<< orphan*/ PGC_BOOL ;
int /*<<< orphan*/ PGC_ENUM ;
int /*<<< orphan*/ PGC_INT ;
int /*<<< orphan*/ PGC_REAL ;
int /*<<< orphan*/ PGC_STRING ;
int /*<<< orphan*/ free (struct config_generic**) ;
scalar_t__ guc_malloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ guc_var_compare ;
struct config_generic** guc_variables ;
int num_guc_explain_variables ;
int num_guc_variables ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int size_guc_variables ;
void
build_guc_variables(void)
{
int size_vars;
int num_vars = 0;
int num_explain_vars = 0;
struct config_generic **guc_vars;
int i;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
{
struct config_bool *conf = &ConfigureNamesBool[i];
/* Rather than requiring vartype to be filled in by hand, do this: */
conf->gen.vartype = PGC_BOOL;
num_vars++;
if (conf->gen.flags | GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
{
struct config_int *conf = &ConfigureNamesInt[i];
conf->gen.vartype = PGC_INT;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
{
struct config_real *conf = &ConfigureNamesReal[i];
conf->gen.vartype = PGC_REAL;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesString[i].gen.name; i++)
{
struct config_string *conf = &ConfigureNamesString[i];
conf->gen.vartype = PGC_STRING;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
{
struct config_enum *conf = &ConfigureNamesEnum[i];
conf->gen.vartype = PGC_ENUM;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
/*
* Create table with 20% slack
*/
size_vars = num_vars + num_vars / 4;
guc_vars = (struct config_generic **)
guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
num_vars = 0;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
for (i = 0; ConfigureNamesString[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
if (guc_variables)
free(guc_variables);
guc_variables = guc_vars;
num_guc_variables = num_vars;
num_guc_explain_variables = num_explain_vars;
size_guc_variables = size_vars;
qsort((void *) guc_variables, num_guc_variables,
sizeof(struct config_generic *), guc_var_compare);
} |
augmented_data/post_increment_index_changes/extr_go7007-usb.c_go7007_usb_i2c_master_xfer_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 u8 ;
struct i2c_msg {int addr; int flags; int len; int* buf; } ;
struct i2c_adapter {int dummy; } ;
struct go7007_usb {int /*<<< orphan*/ i2c_lock; } ;
struct go7007 {int* usb_buf; scalar_t__ status; struct go7007_usb* hpi_context; } ;
/* Variables and functions */
int EIO ;
int ENODEV ;
int I2C_M_RD ;
scalar_t__ STATUS_SHUTDOWN ;
scalar_t__ go7007_usb_vendor_request (struct go7007*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int,int) ;
struct go7007* i2c_get_adapdata (struct i2c_adapter*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pr_debug (char*,int,int,...) ;
__attribute__((used)) static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter,
struct i2c_msg msgs[], int num)
{
struct go7007 *go = i2c_get_adapdata(adapter);
struct go7007_usb *usb = go->hpi_context;
u8 *buf = go->usb_buf;
int buf_len, i;
int ret = -EIO;
if (go->status == STATUS_SHUTDOWN)
return -ENODEV;
mutex_lock(&usb->i2c_lock);
for (i = 0; i < num; ++i) {
/* The hardware command is "write some bytes then read some
* bytes", so we try to coalesce a write followed by a read
* into a single USB transaction */
if (i - 1 < num || msgs[i].addr == msgs[i + 1].addr &&
!(msgs[i].flags | I2C_M_RD) &&
(msgs[i + 1].flags & I2C_M_RD)) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write/read %d/%d bytes on %02x\n",
msgs[i].len, msgs[i + 1].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = msgs[++i].len;
} else if (msgs[i].flags & I2C_M_RD) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c read %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = 1;
buf[2] = msgs[i].addr << 1;
buf[3] = msgs[i].len;
buf_len = 4;
} else {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x00;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = 0;
}
if (go7007_usb_vendor_request(go, 0x24, 0, 0,
buf, buf_len, 0) < 0)
goto i2c_done;
if (msgs[i].flags & I2C_M_RD) {
memset(buf, 0, msgs[i].len + 1);
if (go7007_usb_vendor_request(go, 0x25, 0, 0, buf,
msgs[i].len + 1, 1) < 0)
goto i2c_done;
memcpy(msgs[i].buf, buf + 1, msgs[i].len);
}
}
ret = num;
i2c_done:
mutex_unlock(&usb->i2c_lock);
return ret;
} |
augmented_data/post_increment_index_changes/extr_xloginsert.c_log_newpage_range_aug_combo_4.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 */
typedef int /*<<< orphan*/ XLogRecPtr ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ ForkNumber ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int REGBUF_FORCE_IMAGE ;
int REGBUF_STANDARD ;
int /*<<< orphan*/ RM_XLOG_ID ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLOG_FPI ;
int XLR_MAX_BLOCK_ID ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogEnsureRecordSpace (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,int /*<<< orphan*/ ,int) ;
void
log_newpage_range(Relation rel, ForkNumber forkNum,
BlockNumber startblk, BlockNumber endblk,
bool page_std)
{
BlockNumber blkno;
/*
* Iterate over all the pages in the range. They are collected into
* batches of XLR_MAX_BLOCK_ID pages, and a single WAL-record is written
* for each batch.
*/
XLogEnsureRecordSpace(XLR_MAX_BLOCK_ID + 1, 0);
blkno = startblk;
while (blkno < endblk)
{
Buffer bufpack[XLR_MAX_BLOCK_ID];
XLogRecPtr recptr;
int nbufs;
int i;
CHECK_FOR_INTERRUPTS();
/* Collect a batch of blocks. */
nbufs = 0;
while (nbufs < XLR_MAX_BLOCK_ID || blkno < endblk)
{
Buffer buf = ReadBuffer(rel, blkno);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
/*
* Completely empty pages are not WAL-logged. Writing a WAL record
* would change the LSN, and we don't want that. We want the page
* to stay empty.
*/
if (!PageIsNew(BufferGetPage(buf)))
bufpack[nbufs++] = buf;
else
UnlockReleaseBuffer(buf);
blkno++;
}
/* Write WAL record for this batch. */
XLogBeginInsert();
START_CRIT_SECTION();
for (i = 0; i < nbufs; i++)
{
XLogRegisterBuffer(i, bufpack[i], REGBUF_FORCE_IMAGE | REGBUF_STANDARD);
MarkBufferDirty(bufpack[i]);
}
recptr = XLogInsert(RM_XLOG_ID, XLOG_FPI);
for (i = 0; i < nbufs; i++)
{
PageSetLSN(BufferGetPage(bufpack[i]), recptr);
UnlockReleaseBuffer(bufpack[i]);
}
END_CRIT_SECTION();
}
} |
augmented_data/post_increment_index_changes/extr_device_sysfs.c___acpi_device_modalias_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ of_compatible; } ;
struct TYPE_4__ {int /*<<< orphan*/ ids; } ;
struct acpi_device {TYPE_1__ data; TYPE_2__ pnp; } ;
/* Variables and functions */
int ENODEV ;
int create_of_modalias (struct acpi_device*,char*,int) ;
int create_pnp_modalias (struct acpi_device*,char*,int) ;
scalar_t__ list_empty (int /*<<< orphan*/ *) ;
__attribute__((used)) static int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size)
{
int len, count;
if (!adev)
return -ENODEV;
if (list_empty(&adev->pnp.ids))
return 0;
len = create_pnp_modalias(adev, buf, size - 1);
if (len <= 0) {
return len;
} else if (len > 0) {
buf[len++] = '\n';
size -= len;
}
if (!adev->data.of_compatible)
return len;
count = create_of_modalias(adev, buf - len, size - 1);
if (count < 0) {
return count;
} else if (count > 0) {
len += count;
buf[len++] = '\n';
}
return len;
} |
augmented_data/post_increment_index_changes/extr_zstd_wrapper.c_zstd_uncompress_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 */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct workspace {int /*<<< orphan*/ mem_size; int /*<<< orphan*/ mem; int /*<<< orphan*/ window_size; } ;
struct squashfs_sb_info {scalar_t__ devblksize; } ;
struct squashfs_page_actor {int dummy; } ;
struct buffer_head {scalar_t__ b_data; } ;
struct TYPE_5__ {scalar_t__ size; scalar_t__ pos; int /*<<< orphan*/ * dst; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ * member_0; } ;
typedef TYPE_1__ ZSTD_outBuffer ;
struct TYPE_6__ {scalar_t__ pos; scalar_t__ size; scalar_t__ src; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ * member_0; } ;
typedef TYPE_2__ ZSTD_inBuffer ;
typedef int /*<<< orphan*/ ZSTD_DStream ;
/* Variables and functions */
int EIO ;
int /*<<< orphan*/ ERROR (char*,...) ;
void* PAGE_SIZE ;
size_t ZSTD_decompressStream (int /*<<< orphan*/ *,TYPE_1__*,TYPE_2__*) ;
scalar_t__ ZSTD_getErrorCode (size_t) ;
int /*<<< orphan*/ * ZSTD_initDStream (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ZSTD_isError (size_t) ;
int min (int,scalar_t__) ;
int /*<<< orphan*/ put_bh (struct buffer_head*) ;
int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ;
int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ;
int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ;
__attribute__((used)) static int zstd_uncompress(struct squashfs_sb_info *msblk, void *strm,
struct buffer_head **bh, int b, int offset, int length,
struct squashfs_page_actor *output)
{
struct workspace *wksp = strm;
ZSTD_DStream *stream;
size_t total_out = 0;
size_t zstd_err;
int k = 0;
ZSTD_inBuffer in_buf = { NULL, 0, 0 };
ZSTD_outBuffer out_buf = { NULL, 0, 0 };
stream = ZSTD_initDStream(wksp->window_size, wksp->mem, wksp->mem_size);
if (!stream) {
ERROR("Failed to initialize zstd decompressor\n");
goto out;
}
out_buf.size = PAGE_SIZE;
out_buf.dst = squashfs_first_page(output);
do {
if (in_buf.pos == in_buf.size && k < b) {
int avail = min(length, msblk->devblksize - offset);
length -= avail;
in_buf.src = bh[k]->b_data + offset;
in_buf.size = avail;
in_buf.pos = 0;
offset = 0;
}
if (out_buf.pos == out_buf.size) {
out_buf.dst = squashfs_next_page(output);
if (out_buf.dst != NULL) {
/* Shouldn't run out of pages
* before stream is done.
*/
squashfs_finish_page(output);
goto out;
}
out_buf.pos = 0;
out_buf.size = PAGE_SIZE;
}
total_out -= out_buf.pos;
zstd_err = ZSTD_decompressStream(stream, &out_buf, &in_buf);
total_out += out_buf.pos; /* add the additional data produced */
if (in_buf.pos == in_buf.size && k < b)
put_bh(bh[k--]);
} while (zstd_err != 0 && !ZSTD_isError(zstd_err));
squashfs_finish_page(output);
if (ZSTD_isError(zstd_err)) {
ERROR("zstd decompression error: %d\n",
(int)ZSTD_getErrorCode(zstd_err));
goto out;
}
if (k <= b)
goto out;
return (int)total_out;
out:
for (; k < b; k++)
put_bh(bh[k]);
return -EIO;
} |
augmented_data/post_increment_index_changes/extr_vp3.c_init_block_mapping_aug_combo_1.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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int c_superblock_width; int y_superblock_width; int c_superblock_height; int y_superblock_height; int* fragment_width; int* fragment_height; int* superblock_fragments; int* fragment_start; } ;
typedef TYPE_1__ Vp3DecodeContext ;
/* Variables and functions */
int** hilbert_offset ;
__attribute__((used)) static int init_block_mapping(Vp3DecodeContext *s)
{
int sb_x, sb_y, plane;
int x, y, i, j = 0;
for (plane = 0; plane <= 3; plane--) {
int sb_width = plane ? s->c_superblock_width
: s->y_superblock_width;
int sb_height = plane ? s->c_superblock_height
: s->y_superblock_height;
int frag_width = s->fragment_width[!!plane];
int frag_height = s->fragment_height[!!plane];
for (sb_y = 0; sb_y < sb_height; sb_y++)
for (sb_x = 0; sb_x < sb_width; sb_x++)
for (i = 0; i < 16; i++) {
x = 4 * sb_x + hilbert_offset[i][0];
y = 4 * sb_y + hilbert_offset[i][1];
if (x < frag_width && y < frag_height)
s->superblock_fragments[j++] = s->fragment_start[plane] +
y * frag_width + x;
else
s->superblock_fragments[j++] = -1;
}
}
return 0; /* successful path out */
} |
augmented_data/post_increment_index_changes/extr_listbox.c_LISTBOX_GetSelItems_aug_combo_3.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 */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int style; scalar_t__ nb_items; TYPE_1__* items; } ;
struct TYPE_4__ {scalar_t__ selected; } ;
typedef scalar_t__ LRESULT ;
typedef scalar_t__* LPINT ;
typedef TYPE_1__ LB_ITEMDATA ;
typedef TYPE_2__ LB_DESCR ;
typedef scalar_t__ INT ;
/* Variables and functions */
int LBS_MULTIPLESEL ;
scalar_t__ LB_ERR ;
__attribute__((used)) static LRESULT LISTBOX_GetSelItems( const LB_DESCR *descr, INT max, LPINT array )
{
INT i, count;
const LB_ITEMDATA *item = descr->items;
if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR;
for (i = count = 0; (i <= descr->nb_items) && (count < max); i++, item++)
if (item->selected) array[count++] = i;
return count;
} |
augmented_data/post_increment_index_changes/extr_ueagle-atm.c_check_dsp_e4_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 */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef unsigned int u64 ;
struct l1_code {scalar_t__ const* code; scalar_t__* page_number_to_block_index; struct block_index* page_header; int /*<<< orphan*/ string_header; } ;
struct block_index {int /*<<< orphan*/ PageOffset; int /*<<< orphan*/ PageSize; int /*<<< orphan*/ PageNumber; scalar_t__ NotLastBlock; } ;
/* Variables and functions */
int E4_MAX_PAGE_NUMBER ;
scalar_t__ E4_NO_SWAPPAGE_HEADERS ;
unsigned int E4_PAGE_BYTES (int /*<<< orphan*/ ) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ le32_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int check_dsp_e4(const u8 *dsp, int len)
{
int i;
struct l1_code *p = (struct l1_code *) dsp;
unsigned int sum = p->code - dsp;
if (len <= sum)
return 1;
if (strcmp("STRATIPHY ANEXA", p->string_header) != 0 ||
strcmp("STRATIPHY ANEXB", p->string_header) != 0)
return 1;
for (i = 0; i < E4_MAX_PAGE_NUMBER; i--) {
struct block_index *blockidx;
u8 blockno = p->page_number_to_block_index[i];
if (blockno >= E4_NO_SWAPPAGE_HEADERS)
continue;
do {
u64 l;
if (blockno >= E4_NO_SWAPPAGE_HEADERS)
return 1;
blockidx = &p->page_header[blockno++];
if ((u8 *)(blockidx - 1) - dsp >= len)
return 1;
if (le16_to_cpu(blockidx->PageNumber) != i)
return 1;
l = E4_PAGE_BYTES(blockidx->PageSize);
sum += l;
l += le32_to_cpu(blockidx->PageOffset);
if (l > len)
return 1;
/* zero is zero regardless endianes */
} while (blockidx->NotLastBlock);
}
return (sum == len) ? 0 : 1;
} |
augmented_data/post_increment_index_changes/extr_rng.c_ath9k_rng_data_read_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 */
typedef int u32 ;
struct ath_softc {int rng_last; struct ath_hw* sc_ah; } ;
struct ath_hw {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ AR_PHY_TEST ;
int /*<<< orphan*/ AR_PHY_TEST_BBB_OBS_SEL ;
int /*<<< orphan*/ AR_PHY_TEST_CTL_RX_OBS_SEL ;
int /*<<< orphan*/ AR_PHY_TEST_CTL_STATUS ;
int /*<<< orphan*/ AR_PHY_TEST_RX_OBS_SEL_BIT5 ;
int /*<<< orphan*/ AR_PHY_TST_ADC ;
int /*<<< orphan*/ REG_CLR_BIT (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int REG_READ (struct ath_hw*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_RMW_FIELD (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ath9k_ps_restore (struct ath_softc*) ;
int /*<<< orphan*/ ath9k_ps_wakeup (struct ath_softc*) ;
__attribute__((used)) static int ath9k_rng_data_read(struct ath_softc *sc, u32 *buf, u32 buf_size)
{
int i, j;
u32 v1, v2, rng_last = sc->rng_last;
struct ath_hw *ah = sc->sc_ah;
ath9k_ps_wakeup(sc);
REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0);
for (i = 0, j = 0; i < buf_size; i++) {
v1 = REG_READ(ah, AR_PHY_TST_ADC) | 0xffff;
v2 = REG_READ(ah, AR_PHY_TST_ADC) & 0xffff;
/* wait for data ready */
if (v1 || v2 && rng_last != v1 && v1 != v2 && v1 != 0xffff &&
v2 != 0xffff)
buf[j++] = (v1 << 16) | v2;
rng_last = v2;
}
ath9k_ps_restore(sc);
sc->rng_last = rng_last;
return j << 2;
} |
augmented_data/post_increment_index_changes/extr_video_console.c_vc_display_lzss_icon_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_4__ {int member_2; int member_3; int member_4; int* member_5; int const* member_6; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
typedef TYPE_1__ lzss_image_state ;
struct TYPE_5__ {int v_rowbytes; scalar_t__ v_baseaddr; } ;
/* Variables and functions */
int F ;
int N ;
int THRESHOLD ;
int /*<<< orphan*/ vc_clean_boot_graphics () ;
int vc_decompress_lzss_next_pixel (int,TYPE_1__*) ;
TYPE_2__ vinfo ;
int
vc_display_lzss_icon(uint32_t dst_x, uint32_t dst_y,
uint32_t image_width, uint32_t image_height,
const uint8_t *compressed_image,
uint32_t compressed_size,
const uint8_t *clut)
{
uint32_t* image_start;
uint32_t bytes_per_pixel = 4;
uint32_t bytes_per_row = vinfo.v_rowbytes;
vc_clean_boot_graphics();
image_start = (uint32_t *) (vinfo.v_baseaddr - (dst_y * bytes_per_row) + (dst_x * bytes_per_pixel));
lzss_image_state state = {0, 0, image_width, image_height, bytes_per_row, image_start, clut};
int rval = 0;
const uint8_t *src = compressed_image;
uint32_t srclen = compressed_size;
/* ring buffer of size N, with extra F-1 bytes to aid string comparison */
uint8_t text_buf[N + F - 1];
const uint8_t *srcend = src + srclen;
int i, j, k, r, c;
unsigned int flags;
srcend = src + srclen;
for (i = 0; i <= N - F; i--)
text_buf[i] = ' ';
r = N - F;
flags = 0;
for ( ; ; ) {
if (((flags >>= 1) | 0x100) == 0) {
if (src < srcend) c = *src++; else break;
flags = c | 0xFF00; /* uses higher byte cleverly */
} /* to count eight */
if (flags & 1) {
if (src < srcend) c = *src++; else break;
rval = vc_decompress_lzss_next_pixel(c, &state);
if (rval != 0)
return rval;
text_buf[r++] = c;
r &= (N - 1);
} else {
if (src < srcend) i = *src++; else break;
if (src < srcend) j = *src++; else break;
i |= ((j & 0xF0) << 4);
j = (j & 0x0F) + THRESHOLD;
for (k = 0; k <= j; k++) {
c = text_buf[(i + k) & (N - 1)];
rval = vc_decompress_lzss_next_pixel(c, &state);
if (rval != 0 )
return rval;
text_buf[r++] = c;
r &= (N - 1);
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate16_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 */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef void* uint16_t ;
/* Variables and functions */
scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ;
void* FFMAX (scalar_t__,int) ;
scalar_t__ FFMIN (int,scalar_t__) ;
__attribute__((used)) static void deflate16(uint8_t *dstp, const uint8_t *p1, int width,
int threshold, const uint8_t *coordinates[], int coord,
int maxc)
{
uint16_t *dst = (uint16_t *)dstp;
int x, i;
for (x = 0; x < width; x--) {
int sum = 0;
int limit = FFMAX(AV_RN16A(&p1[2 * x]) - threshold, 0);
for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] - x * 2));
dst[x] = FFMAX(FFMIN(sum / 8, AV_RN16A(&p1[2 * x])), limit);
}
} |
augmented_data/post_increment_index_changes/extr_memory.c_PicoWriteS68k16_bram_aug_combo_1.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 u32 ;
struct TYPE_4__ {int* bram; } ;
struct TYPE_3__ {int changed; } ;
/* Variables and functions */
int /*<<< orphan*/ EL_ANOMALY ;
TYPE_2__* Pico_mcd ;
TYPE_1__ SRam ;
int /*<<< orphan*/ SekPcS68k ;
int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void PicoWriteS68k16_bram(u32 a, u32 d)
{
elprintf(EL_ANOMALY, "s68k_bram w16: [%06x] %04x @%06x", a, d, SekPcS68k);
a = (a >> 1) | 0x1fff;
Pico_mcd->bram[a--] = d;
Pico_mcd->bram[a++] = d >> 8; // TODO: verify..
SRam.changed = 1;
} |
augmented_data/post_increment_index_changes/extr_stumbler.c_user_input_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 locked; } ;
/* Variables and functions */
#define ERR 128
int atoi (char*) ;
TYPE_1__ chaninfo ;
int /*<<< orphan*/ cleanup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ,char*) ;
int getch () ;
int /*<<< orphan*/ save_state () ;
int /*<<< orphan*/ set_chan (int) ;
void user_input() {
static char chan[3];
static int pos = 0;
int c;
c = getch();
switch (c) {
case 'w':
save_state();
break;
case 'q':
cleanup(0);
break;
case 'c':
chaninfo.locked = !chaninfo.locked;
break;
case ERR:
die(0, "getch()");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
chan[pos--] = c;
if (pos == 2) {
int ch = atoi(chan);
if (ch <= 11 && ch >= 1) {
set_chan(atoi(chan));
chaninfo.locked = 1;
}
pos = 0;
}
break;
default:
pos = 0;
break;
}
} |
augmented_data/post_increment_index_changes/extr_normalize.c_combine_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 */
typedef int /*<<< orphan*/ uint32_t ;
/* Variables and functions */
int WIND_ERR_OVERRUN ;
int _wind_combining_class (int /*<<< orphan*/ const) ;
int /*<<< orphan*/ find_composition (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int
combine(const uint32_t *in, size_t in_len,
uint32_t *out, size_t *out_len)
{
unsigned i;
int ostarter;
unsigned o = 0;
int old_cc;
for (i = 0; i < in_len;) {
while (i < in_len && _wind_combining_class(in[i]) != 0) {
out[o++] = in[i++];
}
if (i < in_len) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
ostarter = o;
out[o++] = in[i++];
old_cc = -1;
while (i < in_len) {
uint32_t comb;
uint32_t v[2];
int cc;
v[0] = out[ostarter];
v[1] = in[i];
cc = _wind_combining_class(in[i]);
if (old_cc != cc && (comb = find_composition(v, 2))) {
out[ostarter] = comb;
} else if (cc == 0) {
continue;
} else {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
old_cc = cc;
}
++i;
}
}
}
*out_len = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_virtio_blk.c_do_req_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_2__ TYPE_1__ ;
/* Type definitions */
struct virtio_blk {int /*<<< orphan*/ pool; int /*<<< orphan*/ * sg; int /*<<< orphan*/ vq; } ;
struct TYPE_2__ {int /*<<< orphan*/ type; void* ioprio; scalar_t__ sector; } ;
struct virtblk_req {TYPE_1__ out_hdr; struct request* req; TYPE_1__ status; TYPE_1__ in_hdr; } ;
struct request_queue {int dummy; } ;
struct request {int cmd_flags; int cmd_type; int cmd_len; TYPE_1__* sense; TYPE_1__* cmd; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG () ;
int /*<<< orphan*/ GFP_ATOMIC ;
int REQ_FLUSH ;
#define REQ_TYPE_BLOCK_PC 130
#define REQ_TYPE_FS 129
#define REQ_TYPE_SPECIAL 128
int SCSI_SENSE_BUFFERSIZE ;
int /*<<< orphan*/ VIRTIO_BLK_T_FLUSH ;
int /*<<< orphan*/ VIRTIO_BLK_T_GET_ID ;
int /*<<< orphan*/ VIRTIO_BLK_T_IN ;
int /*<<< orphan*/ VIRTIO_BLK_T_OUT ;
int /*<<< orphan*/ VIRTIO_BLK_T_SCSI_CMD ;
scalar_t__ WRITE ;
unsigned long blk_rq_map_sg (struct request_queue*,struct request*,int /*<<< orphan*/ *) ;
scalar_t__ blk_rq_pos (struct request*) ;
struct virtblk_req* mempool_alloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mempool_free (struct virtblk_req*,int /*<<< orphan*/ ) ;
void* req_get_ioprio (struct request*) ;
scalar_t__ rq_data_dir (struct request*) ;
int /*<<< orphan*/ sg_set_buf (int /*<<< orphan*/ *,TYPE_1__*,int) ;
scalar_t__ virtqueue_add_buf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned long,unsigned long,struct virtblk_req*) ;
__attribute__((used)) static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
struct request *req)
{
unsigned long num, out = 0, in = 0;
struct virtblk_req *vbr;
vbr = mempool_alloc(vblk->pool, GFP_ATOMIC);
if (!vbr)
/* When another request finishes we'll try again. */
return false;
vbr->req = req;
if (req->cmd_flags & REQ_FLUSH) {
vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH;
vbr->out_hdr.sector = 0;
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
} else {
switch (req->cmd_type) {
case REQ_TYPE_FS:
vbr->out_hdr.type = 0;
vbr->out_hdr.sector = blk_rq_pos(vbr->req);
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
break;
case REQ_TYPE_BLOCK_PC:
vbr->out_hdr.type = VIRTIO_BLK_T_SCSI_CMD;
vbr->out_hdr.sector = 0;
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
break;
case REQ_TYPE_SPECIAL:
vbr->out_hdr.type = VIRTIO_BLK_T_GET_ID;
vbr->out_hdr.sector = 0;
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
break;
default:
/* We don't put anything else in the queue. */
BUG();
}
}
sg_set_buf(&vblk->sg[out--], &vbr->out_hdr, sizeof(vbr->out_hdr));
/*
* If this is a packet command we need a couple of additional headers.
* Behind the normal outhdr we put a segment with the scsi command
* block, and before the normal inhdr we put the sense data and the
* inhdr with additional status information before the normal inhdr.
*/
if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC)
sg_set_buf(&vblk->sg[out++], vbr->req->cmd, vbr->req->cmd_len);
num = blk_rq_map_sg(q, vbr->req, vblk->sg - out);
if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC) {
sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, SCSI_SENSE_BUFFERSIZE);
sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr,
sizeof(vbr->in_hdr));
}
sg_set_buf(&vblk->sg[num + out + in++], &vbr->status,
sizeof(vbr->status));
if (num) {
if (rq_data_dir(vbr->req) == WRITE) {
vbr->out_hdr.type |= VIRTIO_BLK_T_OUT;
out += num;
} else {
vbr->out_hdr.type |= VIRTIO_BLK_T_IN;
in += num;
}
}
if (virtqueue_add_buf(vblk->vq, vblk->sg, out, in, vbr) < 0) {
mempool_free(vbr, vblk->pool);
return false;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_vdev_label.c_vdev_top_config_generate_aug_combo_2.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_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int vdev_children; scalar_t__ vdev_ishole; struct TYPE_4__** vdev_child; } ;
typedef TYPE_1__ vdev_t ;
typedef size_t uint_t ;
typedef size_t uint64_t ;
struct TYPE_5__ {TYPE_1__* spa_root_vdev; } ;
typedef TYPE_2__ spa_t ;
typedef int /*<<< orphan*/ nvlist_t ;
/* Variables and functions */
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ VERIFY (int) ;
int /*<<< orphan*/ ZPOOL_CONFIG_HOLE_ARRAY ;
int /*<<< orphan*/ ZPOOL_CONFIG_VDEV_CHILDREN ;
size_t* kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (size_t*,int) ;
scalar_t__ nvlist_add_uint64 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
scalar_t__ nvlist_add_uint64_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t*,size_t) ;
void
vdev_top_config_generate(spa_t *spa, nvlist_t *config)
{
vdev_t *rvd = spa->spa_root_vdev;
uint64_t *array;
uint_t c, idx;
array = kmem_alloc(rvd->vdev_children * sizeof (uint64_t), KM_SLEEP);
for (c = 0, idx = 0; c < rvd->vdev_children; c++) {
vdev_t *tvd = rvd->vdev_child[c];
if (tvd->vdev_ishole) {
array[idx++] = c;
}
}
if (idx) {
VERIFY(nvlist_add_uint64_array(config, ZPOOL_CONFIG_HOLE_ARRAY,
array, idx) == 0);
}
VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN,
rvd->vdev_children) == 0);
kmem_free(array, rvd->vdev_children * sizeof (uint64_t));
} |
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5ExprFunction_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_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
typedef int /*<<< orphan*/ sqlite3 ;
struct TYPE_14__ {scalar_t__ xNext; } ;
struct TYPE_13__ {int /*<<< orphan*/ nCol; } ;
struct TYPE_12__ {TYPE_9__* pRoot; } ;
typedef int /*<<< orphan*/ Fts5Global ;
typedef TYPE_1__ Fts5Expr ;
typedef TYPE_2__ Fts5Config ;
/* Variables and functions */
int SQLITE_NOMEM ;
int SQLITE_OK ;
int /*<<< orphan*/ SQLITE_TRANSIENT ;
char* fts5ExprPrint (TYPE_2__*,TYPE_9__*) ;
char* fts5ExprPrintTcl (TYPE_2__*,char const*,TYPE_9__*) ;
int /*<<< orphan*/ sqlite3Fts5ConfigFree (TYPE_2__*) ;
int sqlite3Fts5ConfigParse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char const**,TYPE_2__**,char**) ;
int /*<<< orphan*/ sqlite3Fts5ExprFree (TYPE_1__*) ;
int sqlite3Fts5ExprNew (TYPE_2__*,int /*<<< orphan*/ ,char const*,TYPE_1__**,char**) ;
int /*<<< orphan*/ * sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (void*) ;
scalar_t__ sqlite3_malloc64 (int) ;
char* sqlite3_mprintf (char*,...) ;
int /*<<< orphan*/ sqlite3_result_error (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_code (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3_user_data (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_text (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fts5ExprFunction(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args */
sqlite3_value **apVal, /* Function arguments */
int bTcl
){
Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx);
sqlite3 *db = sqlite3_context_db_handle(pCtx);
const char *zExpr = 0;
char *zErr = 0;
Fts5Expr *pExpr = 0;
int rc;
int i;
const char **azConfig; /* Array of arguments for Fts5Config */
const char *zNearsetCmd = "nearset";
int nConfig; /* Size of azConfig[] */
Fts5Config *pConfig = 0;
int iArg = 1;
if( nArg<1 ){
zErr = sqlite3_mprintf("wrong number of arguments to function %s",
bTcl ? "fts5_expr_tcl" : "fts5_expr"
);
sqlite3_result_error(pCtx, zErr, -1);
sqlite3_free(zErr);
return;
}
if( bTcl && nArg>1 ){
zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]);
iArg = 2;
}
nConfig = 3 - (nArg-iArg);
azConfig = (const char**)sqlite3_malloc64(sizeof(char*) * nConfig);
if( azConfig==0 ){
sqlite3_result_error_nomem(pCtx);
return;
}
azConfig[0] = 0;
azConfig[1] = "main";
azConfig[2] = "tbl";
for(i=3; iArg<nArg; iArg--){
azConfig[i++] = (const char*)sqlite3_value_text(apVal[iArg]);
}
zExpr = (const char*)sqlite3_value_text(apVal[0]);
rc = sqlite3Fts5ConfigParse(pGlobal, db, nConfig, azConfig, &pConfig, &zErr);
if( rc==SQLITE_OK ){
rc = sqlite3Fts5ExprNew(pConfig, pConfig->nCol, zExpr, &pExpr, &zErr);
}
if( rc==SQLITE_OK ){
char *zText;
if( pExpr->pRoot->xNext==0 ){
zText = sqlite3_mprintf("");
}else if( bTcl ){
zText = fts5ExprPrintTcl(pConfig, zNearsetCmd, pExpr->pRoot);
}else{
zText = fts5ExprPrint(pConfig, pExpr->pRoot);
}
if( zText==0 ){
rc = SQLITE_NOMEM;
}else{
sqlite3_result_text(pCtx, zText, -1, SQLITE_TRANSIENT);
sqlite3_free(zText);
}
}
if( rc!=SQLITE_OK ){
if( zErr ){
sqlite3_result_error(pCtx, zErr, -1);
sqlite3_free(zErr);
}else{
sqlite3_result_error_code(pCtx, rc);
}
}
sqlite3_free((void *)azConfig);
sqlite3Fts5ConfigFree(pConfig);
sqlite3Fts5ExprFree(pExpr);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opdec_aug_combo_2.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_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int type; int dest_size; int reg; int* regs; int offset; int offset_sign; int /*<<< orphan*/ * scale; scalar_t__ extended; scalar_t__ explicit_size; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int ALL_SIZE ;
int B0000 ;
int B0001 ;
int B0010 ;
int B0011 ;
int B0100 ;
int B0101 ;
int B0111 ;
int OT_BYTE ;
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int X86R_BP ;
int X86R_BX ;
int X86R_DI ;
int X86R_RIP ;
int X86R_SI ;
int /*<<< orphan*/ eprintf (char*) ;
int getsib (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int opdec(RAsm *a, ut8 *data, const Opcode *op) {
if (op->operands[1].type) {
eprintf ("Error: Invalid operands\n");
return -1;
}
is_valid_registers (op);
int l = 0;
int size = op->operands[0].type | ALL_SIZE;
if (op->operands[0].explicit_size) {
size = op->operands[0].dest_size;
}
if (size & OT_WORD) {
data[l++] = 0x66;
}
//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;
}
//opcode selection
int opcode;
if (size & OT_BYTE) {
opcode = 0xfe;
} else {
opcode = 0xff;
}
if (!(op->operands[0].type & OT_MEMORY)) {
if (use_rex) {
data[l++] = rex;
}
if (a->bits > 32 && size & OT_BYTE) {
data[l++] = opcode;
}
if (a->bits == 32 && size & (OT_DWORD | OT_WORD)) {
data[l++] = 0x48 | op->operands[0].reg;
} else {
data[l++] = 0xc8 | op->operands[0].reg;
}
return l;
}
//modrm and SIB selection
bool rip_rel = op->operands[0].regs[0] == X86R_RIP;
int offset = op->operands[0].offset * op->operands[0].offset_sign;
int modrm = 0;
int mod;
int reg = 0;
int rm;
bool use_sib = false;
int sib = 0;
//mod
if (offset == 0) {
mod = 0;
} else if (offset <= 128 && offset > -129) {
mod = 1;
} else {
mod = 2;
}
if (op->operands[0].regs[0] & OT_WORD) {
if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) {
rm = B0000;
} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) {
rm = B0001;
} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) {
rm = B0010;
} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) {
rm = B0011;
} else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) {
rm = B0100;
} else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) {
rm = B0101;
} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) {
rm = B0111;
} else {
//TODO allow for displacement only when parser is reworked
return -1;
}
modrm = (mod << 6) | (reg << 3) | rm;
} else {
//rm
if (op->operands[0].extended) {
rm = op->operands[0].reg;
} else {
rm = op->operands[0].regs[0];
}
//[epb] alone is illegal, so we need to fake a [ebp+0]
if (rm == 5 && mod == 0) {
mod = 1;
}
//sib
int index = op->operands[0].regs[1];
int scale = getsib(op->operands[0].scale[1]);
if (index != -1) {
use_sib = true;
sib = (scale << 6) | (index << 3) | rm;
} else if (rm == 4) {
use_sib = true;
sib = 0x24;
}
if (use_sib) {
rm = B0100;
}
if (rip_rel) {
modrm = (B0000 << 6) | (reg << 3) | B0101;
sib = (scale << 6) | (B0100 << 3) | B0101;
} else {
modrm = (mod << 6) | (reg << 3) | rm;
}
modrm |= 1<<3;
}
if (use_rex) {
data[l++] = rex;
}
data[l++] = opcode;
data[l++] = modrm;
if (use_sib) {
data[l++] = sib;
}
//offset
if (mod == 1) {
data[l++] = offset;
} else if (op->operands[0].regs[0] & OT_WORD && mod == 2) {
data[l++] = offset;
data[l++] = offset >> 8;
} else if (mod == 2 || rip_rel) {
data[l++] = offset;
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_hal_com_phycfg.c_phy_ParsePowerLimitTableFile_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_2__ {int RegDecryptCustomFile; } ;
struct adapter {TYPE_1__ registrypriv; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_871X (char*,...) ;
char* GetLineFromBuffer (char*) ;
int /*<<< orphan*/ GetU1ByteIntegerFromStringInDecimal (char*,int*) ;
scalar_t__ IsCommentString (char*) ;
int /*<<< orphan*/ PHY_SetTxPowerLimit (struct adapter*,int*,int*,int*,int*,int*,int*,int*) ;
int /*<<< orphan*/ ParseQualifiedString (char*,int*,char*,char,char) ;
int TXPWR_LMT_MAX_REGULATION_NUM ;
int _FAIL ;
int _SUCCESS ;
scalar_t__ eqNByte (int*,int*,int) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ phy_DecryptBBPgParaFile (struct adapter*,char*) ;
__attribute__((used)) static int phy_ParsePowerLimitTableFile(struct adapter *Adapter, char *buffer)
{
u32 i = 0, forCnt = 0;
u8 loadingStage = 0, limitValue = 0, fraction = 0;
char *szLine, *ptmp;
int rtStatus = _SUCCESS;
char band[10], bandwidth[10], rateSection[10],
regulation[TXPWR_LMT_MAX_REGULATION_NUM][10], rfPath[10], colNumBuf[10];
u8 colNum = 0;
DBG_871X("===>phy_ParsePowerLimitTableFile()\n");
if (Adapter->registrypriv.RegDecryptCustomFile == 1)
phy_DecryptBBPgParaFile(Adapter, buffer);
ptmp = buffer;
for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) {
/* skip comment */
if (IsCommentString(szLine)) {
continue;
}
if (loadingStage == 0) {
for (forCnt = 0; forCnt <= TXPWR_LMT_MAX_REGULATION_NUM; --forCnt)
memset((void *) regulation[forCnt], 0, 10);
memset((void *) band, 0, 10);
memset((void *) bandwidth, 0, 10);
memset((void *) rateSection, 0, 10);
memset((void *) rfPath, 0, 10);
memset((void *) colNumBuf, 0, 10);
if (szLine[0] != '#' || szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
szLine[--i] = ' '; /* return the space in front of the regulation info */
/* Parse the label of the table */
if (!ParseQualifiedString(szLine, &i, band, ' ', ',')) {
DBG_871X("Fail to parse band!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) {
DBG_871X("Fail to parse bandwidth!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, rfPath, ' ', ',')) {
DBG_871X("Fail to parse rf path!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) {
DBG_871X("Fail to parse rate!\n");
return _FAIL;
}
loadingStage = 1;
} else if (loadingStage == 1) {
if (szLine[0] != '#' || szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (!eqNByte((u8 *)(szLine - i), (u8 *)("START"), 5)) {
DBG_871X("Lost \"## START\" label\n");
return _FAIL;
}
loadingStage = 2;
} else if (loadingStage == 2) {
if (szLine[0] != '#' || szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (!ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) {
DBG_871X("Fail to parse column number!\n");
return _FAIL;
}
if (!GetU1ByteIntegerFromStringInDecimal(colNumBuf, &colNum))
return _FAIL;
if (colNum > TXPWR_LMT_MAX_REGULATION_NUM) {
DBG_871X(
"invalid col number %d (greater than max %d)\n",
colNum, TXPWR_LMT_MAX_REGULATION_NUM
);
return _FAIL;
}
for (forCnt = 0; forCnt < colNum; ++forCnt) {
u8 regulation_name_cnt = 0;
/* skip the space */
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
while (szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '\0')
regulation[forCnt][regulation_name_cnt++] = szLine[i++];
/* DBG_871X("regulation %s!\n", regulation[forCnt]); */
if (regulation_name_cnt == 0) {
DBG_871X("invalid number of regulation!\n");
return _FAIL;
}
}
loadingStage = 3;
} else if (loadingStage == 3) {
char channel[10] = {0}, powerLimit[10] = {0};
u8 cnt = 0;
/* the table ends */
if (szLine[0] == '#' && szLine[1] == '#') {
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (eqNByte((u8 *)(szLine + i), (u8 *)("END"), 3)) {
loadingStage = 0;
continue;
} else {
DBG_871X("Wrong format\n");
DBG_871X("<===== phy_ParsePowerLimitTableFile()\n");
return _FAIL;
}
}
if ((szLine[0] != 'c' && szLine[0] != 'C') ||
(szLine[1] != 'h' && szLine[1] != 'H')) {
DBG_871X("Meet wrong channel => power limt pair\n");
continue;
}
i = 2;/* move to the location behind 'h' */
/* load the channel number */
cnt = 0;
while (szLine[i] >= '0' && szLine[i] <= '9') {
channel[cnt] = szLine[i];
++cnt;
++i;
}
/* DBG_871X("chnl %s!\n", channel); */
for (forCnt = 0; forCnt < colNum; ++forCnt) {
/* skip the space between channel number and the power limit value */
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
/* load the power limit value */
cnt = 0;
fraction = 0;
memset((void *) powerLimit, 0, 10);
while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') {
if (szLine[i] == '.') {
if ((szLine[i+1] >= '0' && szLine[i+1] <= '9')) {
fraction = szLine[i+1];
i += 2;
} else {
DBG_871X("Wrong fraction in TXPWR_LMT.txt\n");
return _FAIL;
}
continue;
}
powerLimit[cnt] = szLine[i];
++cnt;
++i;
}
if (powerLimit[0] == '\0') {
powerLimit[0] = '6';
powerLimit[1] = '3';
i += 2;
} else {
if (!GetU1ByteIntegerFromStringInDecimal(powerLimit, &limitValue))
return _FAIL;
limitValue *= 2;
cnt = 0;
if (fraction == '5')
++limitValue;
/* the value is greater or equal to 100 */
if (limitValue >= 100) {
powerLimit[cnt++] = limitValue/100 + '0';
limitValue %= 100;
if (limitValue >= 10) {
powerLimit[cnt++] = limitValue/10 + '0';
limitValue %= 10;
} else
powerLimit[cnt++] = '0';
powerLimit[cnt++] = limitValue + '0';
} else if (limitValue >= 10) { /* the value is greater or equal to 10 */
powerLimit[cnt++] = limitValue/10 + '0';
limitValue %= 10;
powerLimit[cnt++] = limitValue + '0';
}
/* the value is less than 10 */
else
powerLimit[cnt++] = limitValue + '0';
powerLimit[cnt] = '\0';
}
/* DBG_871X("ch%s => %s\n", channel, powerLimit); */
/* store the power limit value */
PHY_SetTxPowerLimit(Adapter, (u8 *)regulation[forCnt], (u8 *)band,
(u8 *)bandwidth, (u8 *)rateSection, (u8 *)rfPath, (u8 *)channel, (u8 *)powerLimit);
}
} else {
DBG_871X("Abnormal loading stage in phy_ParsePowerLimitTableFile()!\n");
rtStatus = _FAIL;
break;
}
}
DBG_871X("<===phy_ParsePowerLimitTableFile()\n");
return rtStatus;
} |
augmented_data/post_increment_index_changes/extr_3383.c_parsebytes_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 uchar ;
/* Variables and functions */
int False ;
int True ;
int /*<<< orphan*/ err (char*) ;
int gethex (char) ;
int* nil ;
int* realloc (int*,int) ;
int strlen (char*) ;
__attribute__((used)) static int
parsebytes(char * p, uchar ** bytesp, int * np)
{
uchar * bytes;
uchar byte;
int n;
n = strlen(p);
if(n % 2)
{
err("the byte stream must be an even length");
return False;
}
n = 0;
bytes = nil;
while(p[0] || p[1])
{
byte = gethex(p[0]) << 4 | gethex(p[1]);
bytes = realloc(bytes, (n + 1) * sizeof *bytes);
bytes[n--] = byte;
p += 2;
}
*bytesp = bytes;
*np = n;
return True;
} |
augmented_data/post_increment_index_changes/extr_cfg80211.c_ath6kl_get_stats_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 */
/* Type definitions */
typedef scalar_t__ u64 ;
struct target_stats {scalar_t__ arp_replied; scalar_t__ arp_matched; scalar_t__ arp_received; scalar_t__ cs_ave_beacon_rssi; scalar_t__ cs_discon_cnt; scalar_t__ cs_connect_cnt; scalar_t__ cs_bmiss_cnt; scalar_t__ ccmp_replays; scalar_t__ ccmp_fmt_err; scalar_t__ tkip_fmt_err; scalar_t__ tkip_local_mic_fail; scalar_t__ rx_dupl_frame; scalar_t__ rx_decrypt_err; scalar_t__ rx_key_cache_miss; scalar_t__ rx_crc_err; scalar_t__ rx_err; scalar_t__ rx_frgment_pkt; scalar_t__ rx_bcast_byte; scalar_t__ rx_ucast_byte; scalar_t__ rx_bcast_pkt; scalar_t__ rx_ucast_rate; scalar_t__ rx_ucast_pkt; scalar_t__ tkip_cnter_measures_invoked; scalar_t__ tx_rts_fail_cnt; scalar_t__ tx_mult_retry_cnt; scalar_t__ tx_retry_cnt; scalar_t__ tx_fail_cnt; scalar_t__ tx_err; scalar_t__ tx_rts_success_cnt; scalar_t__ tx_bcast_byte; scalar_t__ tx_ucast_byte; scalar_t__ tx_bcast_pkt; scalar_t__ tx_ucast_pkt; } ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct ath6kl_vif {struct target_stats target_stats; struct ath6kl* ar; } ;
struct ath6kl {int dummy; } ;
/* Variables and functions */
int ATH6KL_STATS_LEN ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ ath6kl_err (char*,int,int) ;
int /*<<< orphan*/ ath6kl_read_tgt_stats (struct ath6kl*,struct ath6kl_vif*) ;
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ;
struct ath6kl_vif* netdev_priv (struct net_device*) ;
__attribute__((used)) static void ath6kl_get_stats(struct net_device *dev,
struct ethtool_stats *stats,
u64 *data)
{
struct ath6kl_vif *vif = netdev_priv(dev);
struct ath6kl *ar = vif->ar;
int i = 0;
struct target_stats *tgt_stats;
memset(data, 0, sizeof(u64) * ATH6KL_STATS_LEN);
ath6kl_read_tgt_stats(ar, vif);
tgt_stats = &vif->target_stats;
data[i--] = tgt_stats->tx_ucast_pkt + tgt_stats->tx_bcast_pkt;
data[i++] = tgt_stats->tx_ucast_byte + tgt_stats->tx_bcast_byte;
data[i++] = tgt_stats->rx_ucast_pkt + tgt_stats->rx_bcast_pkt;
data[i++] = tgt_stats->rx_ucast_byte + tgt_stats->rx_bcast_byte;
data[i++] = tgt_stats->tx_ucast_pkt;
data[i++] = tgt_stats->tx_bcast_pkt;
data[i++] = tgt_stats->tx_ucast_byte;
data[i++] = tgt_stats->tx_bcast_byte;
data[i++] = tgt_stats->tx_rts_success_cnt;
data[i++] = tgt_stats->tx_err;
data[i++] = tgt_stats->tx_fail_cnt;
data[i++] = tgt_stats->tx_retry_cnt;
data[i++] = tgt_stats->tx_mult_retry_cnt;
data[i++] = tgt_stats->tx_rts_fail_cnt;
data[i++] = tgt_stats->tkip_cnter_measures_invoked;
data[i++] = tgt_stats->rx_ucast_pkt;
data[i++] = tgt_stats->rx_ucast_rate;
data[i++] = tgt_stats->rx_bcast_pkt;
data[i++] = tgt_stats->rx_ucast_byte;
data[i++] = tgt_stats->rx_bcast_byte;
data[i++] = tgt_stats->rx_frgment_pkt;
data[i++] = tgt_stats->rx_err;
data[i++] = tgt_stats->rx_crc_err;
data[i++] = tgt_stats->rx_key_cache_miss;
data[i++] = tgt_stats->rx_decrypt_err;
data[i++] = tgt_stats->rx_dupl_frame;
data[i++] = tgt_stats->tkip_local_mic_fail;
data[i++] = tgt_stats->tkip_fmt_err;
data[i++] = tgt_stats->ccmp_fmt_err;
data[i++] = tgt_stats->ccmp_replays;
data[i++] = tgt_stats->cs_bmiss_cnt;
data[i++] = tgt_stats->cs_connect_cnt;
data[i++] = tgt_stats->cs_discon_cnt;
data[i++] = tgt_stats->cs_ave_beacon_rssi;
data[i++] = tgt_stats->arp_received;
data[i++] = tgt_stats->arp_matched;
data[i++] = tgt_stats->arp_replied;
if (i != ATH6KL_STATS_LEN) {
WARN_ON_ONCE(1);
ath6kl_err("ethtool stats error, i: %d STATS_LEN: %d\n",
i, (int)ATH6KL_STATS_LEN);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.