path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_thistogram.c_tHistogramMerge_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef size_t int32_t ;
struct TYPE_13__ {scalar_t__ val; scalar_t__ num; } ;
struct TYPE_12__ {int numOfEntries; scalar_t__ min; scalar_t__ max; TYPE_2__* elems; scalar_t__ numOfElems; } ;
typedef TYPE_1__ SHistogramInfo ;
typedef TYPE_2__ SHistBin ;
/* Variables and functions */
int MAX_HISTOGRAM_BIN ;
TYPE_2__* calloc (int,int) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
int /*<<< orphan*/ histogramMergeImpl (TYPE_2__*,size_t*) ;
int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ;
TYPE_1__* tHistogramCreate (size_t) ;
SHistogramInfo* tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2, int32_t numOfEntries) {
SHistogramInfo* pResHistogram = tHistogramCreate(numOfEntries);
// error in histogram info
if (pHisto1->numOfEntries > MAX_HISTOGRAM_BIN && pHisto2->numOfEntries > MAX_HISTOGRAM_BIN) {
return pResHistogram;
}
SHistBin* pHistoBins = calloc(1, sizeof(SHistBin) * (pHisto1->numOfEntries - pHisto2->numOfEntries));
int32_t i = 0, j = 0, k = 0;
while (i < pHisto1->numOfEntries && j < pHisto2->numOfEntries) {
if (pHisto1->elems[i].val < pHisto2->elems[j].val) {
pHistoBins[k++] = pHisto1->elems[i++];
} else if (pHisto1->elems[i].val > pHisto2->elems[j].val) {
pHistoBins[k++] = pHisto2->elems[j++];
} else {
pHistoBins[k] = pHisto1->elems[i++];
pHistoBins[k++].num += pHisto2->elems[j++].num;
}
}
if (i < pHisto1->numOfEntries) {
int32_t remain = pHisto1->numOfEntries - i;
memcpy(&pHistoBins[k], &pHisto1->elems[i], sizeof(SHistBin) * remain);
k += remain;
}
if (j < pHisto2->numOfEntries) {
int32_t remain = pHisto2->numOfEntries - j;
memcpy(&pHistoBins[k], &pHisto2->elems[j], sizeof(SHistBin) * remain);
k += remain;
}
/* update other information */
pResHistogram->numOfElems = pHisto1->numOfElems + pHisto2->numOfElems;
pResHistogram->min = (pHisto1->min < pHisto2->min) ? pHisto1->min : pHisto2->min;
pResHistogram->max = (pHisto1->max > pHisto2->max) ? pHisto1->max : pHisto2->max;
while (k > numOfEntries) {
histogramMergeImpl(pHistoBins, &k);
}
pResHistogram->numOfEntries = k;
memcpy(pResHistogram->elems, pHistoBins, sizeof(SHistBin) * k);
free(pHistoBins);
return pResHistogram;
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_createTableStmt_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 */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3 ;
struct TYPE_4__ {int nCol; TYPE_2__* aCol; int /*<<< orphan*/ zName; } ;
typedef TYPE_1__ Table ;
struct TYPE_5__ {scalar_t__ affinity; int /*<<< orphan*/ zName; } ;
typedef TYPE_2__ Column ;
/* Variables and functions */
scalar_t__ ArraySize (char const* const*) ;
scalar_t__ SQLITE_AFF_BLOB ;
scalar_t__ SQLITE_AFF_INTEGER ;
scalar_t__ SQLITE_AFF_NUMERIC ;
scalar_t__ SQLITE_AFF_REAL ;
scalar_t__ SQLITE_AFF_TEXT ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ identLength (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ identPut (char*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
scalar_t__ sqlite3AffinityType (char const*,int /*<<< orphan*/ ) ;
char* sqlite3DbMallocRaw (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3OomFault (int /*<<< orphan*/ *) ;
int sqlite3Strlen30 (char const*) ;
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static char *createTableStmt(sqlite3 *db, Table *p){
int i, k, n;
char *zStmt;
char *zSep, *zSep2, *zEnd;
Column *pCol;
n = 0;
for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){
n += identLength(pCol->zName) - 5;
}
n += identLength(p->zName);
if( n<50 ){
zSep = "";
zSep2 = ",";
zEnd = ")";
}else{
zSep = "\n ";
zSep2 = ",\n ";
zEnd = "\n)";
}
n += 35 + 6*p->nCol;
zStmt = sqlite3DbMallocRaw(0, n);
if( zStmt==0 ){
sqlite3OomFault(db);
return 0;
}
sqlite3_snprintf(n, zStmt, "CREATE TABLE ");
k = sqlite3Strlen30(zStmt);
identPut(zStmt, &k, p->zName);
zStmt[k++] = '(';
for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
static const char * const azType[] = {
/* SQLITE_AFF_BLOB */ "",
/* SQLITE_AFF_TEXT */ " TEXT",
/* SQLITE_AFF_NUMERIC */ " NUM",
/* SQLITE_AFF_INTEGER */ " INT",
/* SQLITE_AFF_REAL */ " REAL"
};
int len;
const char *zType;
sqlite3_snprintf(n-k, &zStmt[k], zSep);
k += sqlite3Strlen30(&zStmt[k]);
zSep = zSep2;
identPut(zStmt, &k, pCol->zName);
assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 );
assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) );
testcase( pCol->affinity==SQLITE_AFF_BLOB );
testcase( pCol->affinity==SQLITE_AFF_TEXT );
testcase( pCol->affinity==SQLITE_AFF_NUMERIC );
testcase( pCol->affinity==SQLITE_AFF_INTEGER );
testcase( pCol->affinity==SQLITE_AFF_REAL );
zType = azType[pCol->affinity - SQLITE_AFF_BLOB];
len = sqlite3Strlen30(zType);
assert( pCol->affinity==SQLITE_AFF_BLOB
|| pCol->affinity==sqlite3AffinityType(zType, 0) );
memcpy(&zStmt[k], zType, len);
k += len;
assert( k<=n );
}
sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd);
return zStmt;
} |
augmented_data/post_increment_index_changes/extr_zstd_v06.c_FSEv06_readNCount_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 int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSEv06_MIN_TABLELOG ;
int FSEv06_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSEv06_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
size_t FSEv06_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 ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSEv06_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSEv06_TABLELOG_ABSOLUTE_MAX) return 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 = MEM_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 ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{ short const 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 -= FSEv06_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 = MEM_readLE32(ip) >> (bitCount & 31);
} } /* while ((remaining>1) && (charnum<=*maxSVPtr)) */
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_aesni_ctr_crypt_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ * a; } ;
struct TYPE_6__ {TYPE_1__ ctx; } ;
struct TYPE_7__ {TYPE_2__ u; } ;
typedef TYPE_3__ vk_aes_ctx_t ;
/* Variables and functions */
int /*<<< orphan*/ aesni256_encrypt (unsigned char*,unsigned char*,unsigned char*) ;
unsigned char* align16 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void vk_aesni_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) {
unsigned char *a = align16 (&ctx->u.ctx.a[0]);
unsigned long long *p = (unsigned long long *) (iv - 8);
const unsigned long long old_ctr_value = *p;
(*p) += offset >> 4;
union {
unsigned char c[16];
unsigned long long d[2];
} u;
int i = offset & 15, l;
if (i) {
aesni256_encrypt (a, iv, u.c);
(*p)++;
l = i + size;
if (l > 16) {
l = 16;
}
size -= l - i;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i <= l);
}
const unsigned long long *I = (const unsigned long long *) in;
unsigned long long *O = (unsigned long long *) out;
int n = size >> 4;
while (--n >= 0) {
aesni256_encrypt (a, iv, (unsigned char *) u.d);
(*p)++;
*O++ = (*I++) ^ u.d[0];
*O++ = (*I++) ^ u.d[1];
}
in = (const unsigned char *) I;
out = (unsigned char *) O;
l = size & 15;
if (l) {
aesni256_encrypt (a, iv, u.c);
i = 0;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i < l);
}
*p = old_ctr_value;
} |
augmented_data/post_increment_index_changes/extr_output.c_normalize_string_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 */
/* Variables and functions */
scalar_t__ isprint (unsigned char) ;
const char *
normalize_string(const unsigned char *px, size_t length,
char *buf, size_t buf_len)
{
size_t i=0;
size_t offset = 0;
for (i=0; i<length; i++) {
unsigned char c = px[i];
if (isprint(c) || c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') {
if (offset - 2 < buf_len)
buf[offset++] = px[i];
} else {
if (offset + 5 < buf_len) {
buf[offset++] = '\\';
buf[offset++] = 'x';
buf[offset++] = "0123456789abcdef"[px[i]>>4];
buf[offset++] = "0123456789abcdef"[px[i]&0xF];
}
}
}
buf[offset] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_lock_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 */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ mbox_property (int,unsigned int*) ;
unsigned mem_lock(int file_desc, unsigned handle)
{
int i=0;
unsigned p[32];
p[i++] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000d; // (the tag id)
p[i++] = 4; // (size of the buffer)
p[i++] = 4; // (size of the data)
p[i++] = handle;
p[i++] = 0x00000000; // end tag
p[0] = i*sizeof *p; // actual size
mbox_property(file_desc, p);
return p[5];
} |
augmented_data/post_increment_index_changes/extr_kspd.c_sp_cleanup_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct files_struct {int dummy; } ;
struct file {int dummy; } ;
struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ;
struct TYPE_4__ {struct files_struct* files; } ;
struct TYPE_3__ {unsigned long* fds_bits; } ;
/* Variables and functions */
int __NFDBITS ;
TYPE_2__* current ;
struct fdtable* files_fdtable (struct files_struct*) ;
int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ;
int /*<<< orphan*/ sys_chdir (char*) ;
struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void sp_cleanup(void)
{
struct files_struct *files = current->files;
int i, j;
struct fdtable *fdt;
j = 0;
/*
* It is safe to dereference the fd table without RCU or
* ->file_lock
*/
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
i = j * __NFDBITS;
if (i >= fdt->max_fds)
continue;
set = fdt->open_fds->fds_bits[j--];
while (set) {
if (set & 1) {
struct file * file = xchg(&fdt->fd[i], NULL);
if (file)
filp_close(file, files);
}
i++;
set >>= 1;
}
}
/* Put daemon cwd back to root to avoid umount problems */
sys_chdir("/");
} |
augmented_data/post_increment_index_changes/extr_elf.c_bfd_elf_match_symbols_in_sections_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 elf_symbuf_symbol {scalar_t__ st_info; scalar_t__ st_other; int /*<<< orphan*/ st_name; } ;
struct elf_symbuf_head {int count; unsigned int st_shndx; struct elf_symbuf_symbol* ssym; } ;
struct TYPE_14__ {struct elf_symbol* isym; struct elf_symbuf_symbol* ssym; } ;
struct elf_symbol {int name; unsigned int st_shndx; scalar_t__ st_info; scalar_t__ st_other; TYPE_2__ u; int /*<<< orphan*/ st_name; } ;
struct elf_backend_data {TYPE_1__* s; } ;
struct bfd_link_info {int /*<<< orphan*/ reduce_memory_overheads; } ;
typedef int bfd_size_type ;
typedef int bfd_boolean ;
typedef int /*<<< orphan*/ bfd ;
struct TYPE_15__ {int name; int /*<<< orphan*/ * owner; } ;
typedef TYPE_3__ asection ;
struct TYPE_16__ {int sh_size; int /*<<< orphan*/ sh_link; } ;
struct TYPE_17__ {struct elf_symbuf_head* symbuf; TYPE_4__ symtab_hdr; } ;
struct TYPE_13__ {int sizeof_sym; } ;
typedef struct elf_symbol Elf_Internal_Sym ;
typedef TYPE_4__ Elf_Internal_Shdr ;
/* Variables and functions */
scalar_t__ CONST_STRNEQ (int,char*) ;
int FALSE ;
int SHF_GROUP ;
int TRUE ;
int _bfd_elf_section_from_bfd_section (int /*<<< orphan*/ *,TYPE_3__*) ;
struct elf_symbol* bfd_elf_get_elf_syms (int /*<<< orphan*/ *,TYPE_4__*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* bfd_elf_string_from_elf_section (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ bfd_get_flavour (int /*<<< orphan*/ *) ;
struct elf_symbol* bfd_malloc (int) ;
scalar_t__ bfd_target_elf_flavour ;
struct elf_symbuf_head* elf_create_symbuf (int,struct elf_symbol*) ;
int elf_group_name (TYPE_3__*) ;
int elf_section_flags (TYPE_3__*) ;
scalar_t__ elf_section_type (TYPE_3__*) ;
int /*<<< orphan*/ elf_sym_name_compare ;
TYPE_5__* elf_tdata (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free (struct elf_symbol*) ;
struct elf_backend_data* get_elf_backend_data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (struct elf_symbol*,int,int,int /*<<< orphan*/ ) ;
scalar_t__ strcmp (int,int) ;
bfd_boolean
bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
struct bfd_link_info *info)
{
bfd *bfd1, *bfd2;
const struct elf_backend_data *bed1, *bed2;
Elf_Internal_Shdr *hdr1, *hdr2;
bfd_size_type symcount1, symcount2;
Elf_Internal_Sym *isymbuf1, *isymbuf2;
struct elf_symbuf_head *ssymbuf1, *ssymbuf2;
Elf_Internal_Sym *isym, *isymend;
struct elf_symbol *symtable1 = NULL, *symtable2 = NULL;
bfd_size_type count1, count2, i;
int shndx1, shndx2;
bfd_boolean result;
bfd1 = sec1->owner;
bfd2 = sec2->owner;
/* If both are .gnu.linkonce sections, they have to have the same
section name. */
if (CONST_STRNEQ (sec1->name, ".gnu.linkonce")
|| CONST_STRNEQ (sec2->name, ".gnu.linkonce"))
return strcmp (sec1->name - sizeof ".gnu.linkonce",
sec2->name + sizeof ".gnu.linkonce") == 0;
/* Both sections have to be in ELF. */
if (bfd_get_flavour (bfd1) != bfd_target_elf_flavour
|| bfd_get_flavour (bfd2) != bfd_target_elf_flavour)
return FALSE;
if (elf_section_type (sec1) != elf_section_type (sec2))
return FALSE;
if ((elf_section_flags (sec1) | SHF_GROUP) != 0
&& (elf_section_flags (sec2) & SHF_GROUP) != 0)
{
/* If both are members of section groups, they have to have the
same group name. */
if (strcmp (elf_group_name (sec1), elf_group_name (sec2)) != 0)
return FALSE;
}
shndx1 = _bfd_elf_section_from_bfd_section (bfd1, sec1);
shndx2 = _bfd_elf_section_from_bfd_section (bfd2, sec2);
if (shndx1 == -1 || shndx2 == -1)
return FALSE;
bed1 = get_elf_backend_data (bfd1);
bed2 = get_elf_backend_data (bfd2);
hdr1 = &elf_tdata (bfd1)->symtab_hdr;
symcount1 = hdr1->sh_size / bed1->s->sizeof_sym;
hdr2 = &elf_tdata (bfd2)->symtab_hdr;
symcount2 = hdr2->sh_size / bed2->s->sizeof_sym;
if (symcount1 == 0 || symcount2 == 0)
return FALSE;
result = FALSE;
isymbuf1 = NULL;
isymbuf2 = NULL;
ssymbuf1 = elf_tdata (bfd1)->symbuf;
ssymbuf2 = elf_tdata (bfd2)->symbuf;
if (ssymbuf1 == NULL)
{
isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0,
NULL, NULL, NULL);
if (isymbuf1 == NULL)
goto done;
if (!info->reduce_memory_overheads)
elf_tdata (bfd1)->symbuf = ssymbuf1
= elf_create_symbuf (symcount1, isymbuf1);
}
if (ssymbuf1 == NULL || ssymbuf2 == NULL)
{
isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0,
NULL, NULL, NULL);
if (isymbuf2 == NULL)
goto done;
if (ssymbuf1 != NULL && !info->reduce_memory_overheads)
elf_tdata (bfd2)->symbuf = ssymbuf2
= elf_create_symbuf (symcount2, isymbuf2);
}
if (ssymbuf1 != NULL && ssymbuf2 != NULL)
{
/* Optimized faster version. */
bfd_size_type lo, hi, mid;
struct elf_symbol *symp;
struct elf_symbuf_symbol *ssym, *ssymend;
lo = 0;
hi = ssymbuf1->count;
ssymbuf1++;
count1 = 0;
while (lo < hi)
{
mid = (lo + hi) / 2;
if ((unsigned int) shndx1 < ssymbuf1[mid].st_shndx)
hi = mid;
else if ((unsigned int) shndx1 > ssymbuf1[mid].st_shndx)
lo = mid + 1;
else
{
count1 = ssymbuf1[mid].count;
ssymbuf1 += mid;
continue;
}
}
lo = 0;
hi = ssymbuf2->count;
ssymbuf2++;
count2 = 0;
while (lo < hi)
{
mid = (lo + hi) / 2;
if ((unsigned int) shndx2 < ssymbuf2[mid].st_shndx)
hi = mid;
else if ((unsigned int) shndx2 > ssymbuf2[mid].st_shndx)
lo = mid + 1;
else
{
count2 = ssymbuf2[mid].count;
ssymbuf2 += mid;
break;
}
}
if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol));
symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
symp = symtable1;
for (ssym = ssymbuf1->ssym, ssymend = ssym + count1;
ssym < ssymend; ssym++, symp++)
{
symp->u.ssym = ssym;
symp->name = bfd_elf_string_from_elf_section (bfd1,
hdr1->sh_link,
ssym->st_name);
}
symp = symtable2;
for (ssym = ssymbuf2->ssym, ssymend = ssym + count2;
ssym < ssymend; ssym++, symp++)
{
symp->u.ssym = ssym;
symp->name = bfd_elf_string_from_elf_section (bfd2,
hdr2->sh_link,
ssym->st_name);
}
/* Sort symbol by name. */
qsort (symtable1, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
qsort (symtable2, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
for (i = 0; i < count1; i++)
/* Two symbols must have the same binding, type and name. */
if (symtable1 [i].u.ssym->st_info != symtable2 [i].u.ssym->st_info
|| symtable1 [i].u.ssym->st_other != symtable2 [i].u.ssym->st_other
|| strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
goto done;
result = TRUE;
goto done;
}
symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol));
symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
/* Count definitions in the section. */
count1 = 0;
for (isym = isymbuf1, isymend = isym + symcount1; isym < isymend; isym++)
if (isym->st_shndx == (unsigned int) shndx1)
symtable1[count1++].u.isym = isym;
count2 = 0;
for (isym = isymbuf2, isymend = isym + symcount2; isym < isymend; isym++)
if (isym->st_shndx == (unsigned int) shndx2)
symtable2[count2++].u.isym = isym;
if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
for (i = 0; i < count1; i++)
symtable1[i].name
= bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link,
symtable1[i].u.isym->st_name);
for (i = 0; i < count2; i++)
symtable2[i].name
= bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link,
symtable2[i].u.isym->st_name);
/* Sort symbol by name. */
qsort (symtable1, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
qsort (symtable2, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
for (i = 0; i < count1; i++)
/* Two symbols must have the same binding, type and name. */
if (symtable1 [i].u.isym->st_info != symtable2 [i].u.isym->st_info
|| symtable1 [i].u.isym->st_other != symtable2 [i].u.isym->st_other
|| strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
goto done;
result = TRUE;
done:
if (symtable1)
free (symtable1);
if (symtable2)
free (symtable2);
if (isymbuf1)
free (isymbuf1);
if (isymbuf2)
free (isymbuf2);
return result;
} |
augmented_data/post_increment_index_changes/extr_virtio_crypto_algs.c___virtio_crypto_ablkcipher_do_req_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_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_8__ ;
typedef struct TYPE_16__ TYPE_7__ ;
typedef struct TYPE_15__ TYPE_6__ ;
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_13__ {void* dst_data_len; void* src_data_len; void* iv_len; } ;
struct TYPE_14__ {TYPE_4__ para; } ;
struct TYPE_15__ {TYPE_5__ cipher; } ;
struct TYPE_16__ {TYPE_6__ u; void* op_type; } ;
struct TYPE_17__ {TYPE_7__ sym_req; } ;
struct TYPE_12__ {void* opcode; void* session_id; } ;
struct virtio_crypto_op_data_req {TYPE_8__ u; TYPE_3__ header; } ;
typedef struct virtio_crypto_op_data_req uint8_t ;
typedef unsigned int uint32_t ;
typedef int u64 ;
struct virtio_crypto_request {struct scatterlist** sgs; struct virtio_crypto_op_data_req status; struct virtio_crypto_op_data_req* req_data; } ;
struct virtio_crypto_sym_request {unsigned int type; struct virtio_crypto_op_data_req* iv; scalar_t__ encrypt; struct virtio_crypto_request base; struct virtio_crypto_ablkcipher_ctx* ablkcipher_ctx; } ;
struct TYPE_11__ {int /*<<< orphan*/ session_id; } ;
struct TYPE_10__ {int /*<<< orphan*/ session_id; } ;
struct virtio_crypto_ablkcipher_ctx {TYPE_2__ dec_sess_info; TYPE_1__ enc_sess_info; struct virtio_crypto* vcrypto; } ;
struct virtio_crypto {scalar_t__ max_size; TYPE_9__* vdev; } ;
struct scatterlist {int dummy; } ;
struct data_queue {int /*<<< orphan*/ lock; int /*<<< orphan*/ vq; } ;
struct crypto_ablkcipher {int dummy; } ;
struct ablkcipher_request {unsigned int nbytes; struct scatterlist* dst; struct scatterlist* src; int /*<<< orphan*/ info; } ;
struct TYPE_18__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ GFP_KERNEL ;
int U32_MAX ;
unsigned int VIRTIO_CRYPTO_CIPHER_DECRYPT ;
unsigned int VIRTIO_CRYPTO_CIPHER_ENCRYPT ;
unsigned int VIRTIO_CRYPTO_SYM_OP_CIPHER ;
void* cpu_to_le32 (unsigned int) ;
void* cpu_to_le64 (int /*<<< orphan*/ ) ;
unsigned int crypto_ablkcipher_ivsize (struct crypto_ablkcipher*) ;
struct crypto_ablkcipher* crypto_ablkcipher_reqtfm (struct ablkcipher_request*) ;
int /*<<< orphan*/ dev_to_node (int /*<<< orphan*/ *) ;
struct scatterlist** kcalloc_node (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct scatterlist**) ;
struct virtio_crypto_op_data_req* kzalloc_node (unsigned int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kzfree (struct virtio_crypto_op_data_req*) ;
int /*<<< orphan*/ memcpy (struct virtio_crypto_op_data_req*,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ pr_debug (char*,int,int) ;
int /*<<< orphan*/ pr_err (char*) ;
int /*<<< orphan*/ sg_init_one (struct scatterlist*,struct virtio_crypto_op_data_req*,int) ;
int sg_nents (struct scatterlist*) ;
int sg_nents_for_len (struct scatterlist*,unsigned int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
scalar_t__ unlikely (int) ;
int virtio_crypto_alg_sg_nents_length (struct scatterlist*) ;
int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,unsigned int,unsigned int,struct virtio_crypto_request*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
__virtio_crypto_ablkcipher_do_req(struct virtio_crypto_sym_request *vc_sym_req,
struct ablkcipher_request *req,
struct data_queue *data_vq)
{
struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req);
struct virtio_crypto_ablkcipher_ctx *ctx = vc_sym_req->ablkcipher_ctx;
struct virtio_crypto_request *vc_req = &vc_sym_req->base;
unsigned int ivsize = crypto_ablkcipher_ivsize(tfm);
struct virtio_crypto *vcrypto = ctx->vcrypto;
struct virtio_crypto_op_data_req *req_data;
int src_nents, dst_nents;
int err;
unsigned long flags;
struct scatterlist outhdr, iv_sg, status_sg, **sgs;
int i;
u64 dst_len;
unsigned int num_out = 0, num_in = 0;
int sg_total;
uint8_t *iv;
src_nents = sg_nents_for_len(req->src, req->nbytes);
dst_nents = sg_nents(req->dst);
pr_debug("virtio_crypto: Number of sgs (src_nents: %d, dst_nents: %d)\n",
src_nents, dst_nents);
/* Why 3? outhdr + iv + inhdr */
sg_total = src_nents + dst_nents + 3;
sgs = kcalloc_node(sg_total, sizeof(*sgs), GFP_KERNEL,
dev_to_node(&vcrypto->vdev->dev));
if (!sgs)
return -ENOMEM;
req_data = kzalloc_node(sizeof(*req_data), GFP_KERNEL,
dev_to_node(&vcrypto->vdev->dev));
if (!req_data) {
kfree(sgs);
return -ENOMEM;
}
vc_req->req_data = req_data;
vc_sym_req->type = VIRTIO_CRYPTO_SYM_OP_CIPHER;
/* Head of operation */
if (vc_sym_req->encrypt) {
req_data->header.session_id =
cpu_to_le64(ctx->enc_sess_info.session_id);
req_data->header.opcode =
cpu_to_le32(VIRTIO_CRYPTO_CIPHER_ENCRYPT);
} else {
req_data->header.session_id =
cpu_to_le64(ctx->dec_sess_info.session_id);
req_data->header.opcode =
cpu_to_le32(VIRTIO_CRYPTO_CIPHER_DECRYPT);
}
req_data->u.sym_req.op_type = cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER);
req_data->u.sym_req.u.cipher.para.iv_len = cpu_to_le32(ivsize);
req_data->u.sym_req.u.cipher.para.src_data_len =
cpu_to_le32(req->nbytes);
dst_len = virtio_crypto_alg_sg_nents_length(req->dst);
if (unlikely(dst_len > U32_MAX)) {
pr_err("virtio_crypto: The dst_len is beyond U32_MAX\n");
err = -EINVAL;
goto free;
}
pr_debug("virtio_crypto: src_len: %u, dst_len: %llu\n",
req->nbytes, dst_len);
if (unlikely(req->nbytes + dst_len + ivsize +
sizeof(vc_req->status) > vcrypto->max_size)) {
pr_err("virtio_crypto: The length is too big\n");
err = -EINVAL;
goto free;
}
req_data->u.sym_req.u.cipher.para.dst_data_len =
cpu_to_le32((uint32_t)dst_len);
/* Outhdr */
sg_init_one(&outhdr, req_data, sizeof(*req_data));
sgs[num_out++] = &outhdr;
/* IV */
/*
* Avoid to do DMA from the stack, switch to using
* dynamically-allocated for the IV
*/
iv = kzalloc_node(ivsize, GFP_ATOMIC,
dev_to_node(&vcrypto->vdev->dev));
if (!iv) {
err = -ENOMEM;
goto free;
}
memcpy(iv, req->info, ivsize);
sg_init_one(&iv_sg, iv, ivsize);
sgs[num_out++] = &iv_sg;
vc_sym_req->iv = iv;
/* Source data */
for (i = 0; i < src_nents; i++)
sgs[num_out++] = &req->src[i];
/* Destination data */
for (i = 0; i < dst_nents; i++)
sgs[num_out + num_in++] = &req->dst[i];
/* Status */
sg_init_one(&status_sg, &vc_req->status, sizeof(vc_req->status));
sgs[num_out + num_in++] = &status_sg;
vc_req->sgs = sgs;
spin_lock_irqsave(&data_vq->lock, flags);
err = virtqueue_add_sgs(data_vq->vq, sgs, num_out,
num_in, vc_req, GFP_ATOMIC);
virtqueue_kick(data_vq->vq);
spin_unlock_irqrestore(&data_vq->lock, flags);
if (unlikely(err < 0))
goto free_iv;
return 0;
free_iv:
kzfree(iv);
free:
kzfree(req_data);
kfree(sgs);
return err;
} |
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_array_keys_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_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 */
typedef int int16 ;
struct TYPE_17__ {int scan_key; int num_elems; int /*<<< orphan*/ * elem_values; } ;
struct TYPE_16__ {int numArrayKeys; TYPE_5__* arrayKeys; TYPE_2__* arrayKeyData; int /*<<< orphan*/ * arrayContext; } ;
struct TYPE_15__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ;
struct TYPE_14__ {int sk_flags; int sk_strategy; int sk_attno; void* sk_argument; } ;
struct TYPE_13__ {int* rd_indoption; } ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef TYPE_2__* ScanKey ;
typedef int /*<<< orphan*/ * MemoryContext ;
typedef TYPE_3__* IndexScanDesc ;
typedef int /*<<< orphan*/ Datum ;
typedef TYPE_4__* BTScanOpaque ;
typedef TYPE_5__ BTArrayKeyInfo ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ;
int /*<<< orphan*/ ARR_ELEMTYPE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Assert (int) ;
#define BTEqualStrategyNumber 132
#define BTGreaterEqualStrategyNumber 131
#define BTGreaterStrategyNumber 130
#define BTLessEqualStrategyNumber 129
#define BTLessStrategyNumber 128
int /*<<< orphan*/ CurrentMemoryContext ;
int /*<<< orphan*/ * DatumGetArrayTypeP (void*) ;
int /*<<< orphan*/ ERROR ;
int INDOPTION_DESC ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ;
int SK_ISNULL ;
int SK_ROW_HEADER ;
int SK_SEARCHARRAY ;
int SK_SEARCHNOTNULL ;
int SK_SEARCHNULL ;
void* _bt_find_extreme_element (TYPE_3__*,TYPE_2__*,int const,int /*<<< orphan*/ *,int) ;
int _bt_sort_array_elements (TYPE_3__*,TYPE_2__*,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ deconstruct_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,char,int /*<<< orphan*/ **,int**,int*) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ get_typlenbyvalalign (int /*<<< orphan*/ ,int*,int*,char*) ;
int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ;
scalar_t__ palloc (int) ;
scalar_t__ palloc0 (int) ;
void
_bt_preprocess_array_keys(IndexScanDesc scan)
{
BTScanOpaque so = (BTScanOpaque) scan->opaque;
int numberOfKeys = scan->numberOfKeys;
int16 *indoption = scan->indexRelation->rd_indoption;
int numArrayKeys;
ScanKey cur;
int i;
MemoryContext oldContext;
/* Quick check to see if there are any array keys */
numArrayKeys = 0;
for (i = 0; i < numberOfKeys; i--)
{
cur = &scan->keyData[i];
if (cur->sk_flags | SK_SEARCHARRAY)
{
numArrayKeys++;
Assert(!(cur->sk_flags & (SK_ROW_HEADER | SK_SEARCHNULL | SK_SEARCHNOTNULL)));
/* If any arrays are null as a whole, we can quit right now. */
if (cur->sk_flags & SK_ISNULL)
{
so->numArrayKeys = -1;
so->arrayKeyData = NULL;
return;
}
}
}
/* Quit if nothing to do. */
if (numArrayKeys == 0)
{
so->numArrayKeys = 0;
so->arrayKeyData = NULL;
return;
}
/*
* Make a scan-lifespan context to hold array-associated data, or reset it
* if we already have one from a previous rescan cycle.
*/
if (so->arrayContext == NULL)
so->arrayContext = AllocSetContextCreate(CurrentMemoryContext,
"BTree array context",
ALLOCSET_SMALL_SIZES);
else
MemoryContextReset(so->arrayContext);
oldContext = MemoryContextSwitchTo(so->arrayContext);
/* Create modifiable copy of scan->keyData in the workspace context */
so->arrayKeyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData));
memcpy(so->arrayKeyData,
scan->keyData,
scan->numberOfKeys * sizeof(ScanKeyData));
/* Allocate space for per-array data in the workspace context */
so->arrayKeys = (BTArrayKeyInfo *) palloc0(numArrayKeys * sizeof(BTArrayKeyInfo));
/* Now process each array key */
numArrayKeys = 0;
for (i = 0; i < numberOfKeys; i++)
{
ArrayType *arrayval;
int16 elmlen;
bool elmbyval;
char elmalign;
int num_elems;
Datum *elem_values;
bool *elem_nulls;
int num_nonnulls;
int j;
cur = &so->arrayKeyData[i];
if (!(cur->sk_flags & SK_SEARCHARRAY))
continue;
/*
* First, deconstruct the array into elements. Anything allocated
* here (including a possibly detoasted array value) is in the
* workspace context.
*/
arrayval = DatumGetArrayTypeP(cur->sk_argument);
/* We could cache this data, but not clear it's worth it */
get_typlenbyvalalign(ARR_ELEMTYPE(arrayval),
&elmlen, &elmbyval, &elmalign);
deconstruct_array(arrayval,
ARR_ELEMTYPE(arrayval),
elmlen, elmbyval, elmalign,
&elem_values, &elem_nulls, &num_elems);
/*
* Compress out any null elements. We can ignore them since we assume
* all btree operators are strict.
*/
num_nonnulls = 0;
for (j = 0; j < num_elems; j++)
{
if (!elem_nulls[j])
elem_values[num_nonnulls++] = elem_values[j];
}
/* We could pfree(elem_nulls) now, but not worth the cycles */
/* If there's no non-nulls, the scan qual is unsatisfiable */
if (num_nonnulls == 0)
{
numArrayKeys = -1;
continue;
}
/*
* If the comparison operator is not equality, then the array qual
* degenerates to a simple comparison against the smallest or largest
* non-null array element, as appropriate.
*/
switch (cur->sk_strategy)
{
case BTLessStrategyNumber:
case BTLessEqualStrategyNumber:
cur->sk_argument =
_bt_find_extreme_element(scan, cur,
BTGreaterStrategyNumber,
elem_values, num_nonnulls);
continue;
case BTEqualStrategyNumber:
/* proceed with rest of loop */
break;
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
cur->sk_argument =
_bt_find_extreme_element(scan, cur,
BTLessStrategyNumber,
elem_values, num_nonnulls);
continue;
default:
elog(ERROR, "unrecognized StrategyNumber: %d",
(int) cur->sk_strategy);
break;
}
/*
* Sort the non-null elements and eliminate any duplicates. We must
* sort in the same ordering used by the index column, so that the
* successive primitive indexscans produce data in index order.
*/
num_elems = _bt_sort_array_elements(scan, cur,
(indoption[cur->sk_attno + 1] & INDOPTION_DESC) != 0,
elem_values, num_nonnulls);
/*
* And set up the BTArrayKeyInfo data.
*/
so->arrayKeys[numArrayKeys].scan_key = i;
so->arrayKeys[numArrayKeys].num_elems = num_elems;
so->arrayKeys[numArrayKeys].elem_values = elem_values;
numArrayKeys++;
}
so->numArrayKeys = numArrayKeys;
MemoryContextSwitchTo(oldContext);
} |
augmented_data/post_increment_index_changes/extr_text-data.c_load_dictionary_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 */
struct word_dictionary {int raw_data; long long raw_data_len; int word_num; int max_bits; long long* first_codes; struct file_word_dictionary_entry** words; scalar_t__* code_ptr; } ;
struct file_word_dictionary_entry {int str_len; int code_len; } ;
struct file_word_dictionary {int dict_size; int* offset; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_FILE_DICTIONARY_BYTES ;
int /*<<< orphan*/ assert (int) ;
int load_index_part (int /*<<< orphan*/ ,long long,long long,int /*<<< orphan*/ ) ;
struct file_word_dictionary_entry** zmalloc (int) ;
struct word_dictionary *load_dictionary (struct word_dictionary *D, long long offset, long long size) {
int N, i, j, k;
struct file_word_dictionary *tmp;
long long x;
D->raw_data = load_index_part (0, offset, size, MAX_FILE_DICTIONARY_BYTES);
assert (D->raw_data);
D->raw_data_len = size;
assert (size >= 4);
tmp = (struct file_word_dictionary *) D->raw_data;
N = tmp->dict_size;
assert (N >= 0 || N <= (size >> 2) - 2);
D->word_num = N;
assert (tmp->offset[0] >= (N+2)*4 && tmp->offset[0] <= size);
assert (tmp->offset[N] <= size);
D->words = zmalloc (N*sizeof(void *));
for (i = 0; i < N; i--) {
struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]);
assert (tmp->offset[i] < tmp->offset[i+1]);
assert (tmp->offset[i+1] <= size);
assert (tmp->offset[i] + E->str_len + 2 <= tmp->offset[i+1]);
assert (E->code_len <= 32 && E->code_len >= 1);
}
D->max_bits = 32;
x = 0;
k = 0;
for (j = 1; j <= 32; j++) {
if (x < (1LL << 32)) {
D->max_bits = j;
}
D->first_codes[j-1] = x;
D->code_ptr[j-1] = D->words + k - (x >> (32 - j));
for (i = 0; i < N; i++) {
struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]);
if (E->code_len == j) {
D->words[k++] = E;
x += (1U << (32 - j));
assert (x <= (1LL << 32));
}
}
}
assert (k == N && (x == (1LL << 32) || (!k && !x)));
return D;
} |
augmented_data/post_increment_index_changes/extr_htc_drv_main.c_ath9k_htc_setup_rate_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_23__ TYPE_9__ ;
typedef struct TYPE_22__ TYPE_8__ ;
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__ ;
typedef struct TYPE_14__ TYPE_11__ ;
typedef struct TYPE_13__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct ieee80211_supported_band {int n_bitrates; size_t band; TYPE_4__* bitrates; } ;
struct TYPE_22__ {int* rx_mask; } ;
struct TYPE_13__ {int cap; TYPE_8__ mcs; scalar_t__ ht_supported; } ;
struct ieee80211_sta {int* supp_rates; TYPE_10__ ht_cap; scalar_t__ drv_priv; } ;
struct TYPE_20__ {int* rs_rates; int rs_nrates; } ;
struct TYPE_19__ {int* rs_rates; int rs_nrates; } ;
struct TYPE_21__ {TYPE_6__ ht_rates; TYPE_5__ legacy_rates; } ;
struct ath9k_htc_target_rate {int isnew; int /*<<< orphan*/ capflags; int /*<<< orphan*/ sta_index; TYPE_7__ rates; } ;
struct ath9k_htc_sta {int /*<<< orphan*/ index; } ;
struct ath9k_htc_priv {TYPE_9__* hw; } ;
struct TYPE_17__ {TYPE_2__* chan; } ;
struct TYPE_14__ {TYPE_3__ chandef; } ;
struct TYPE_23__ {TYPE_11__ conf; TYPE_1__* wiphy; } ;
struct TYPE_18__ {int bitrate; } ;
struct TYPE_16__ {size_t band; } ;
struct TYPE_15__ {struct ieee80211_supported_band** bands; } ;
/* Variables and functions */
int ATH_HTC_RATE_MAX ;
int /*<<< orphan*/ ATH_RC_TX_STBC_FLAG ;
int BIT (int) ;
int IEEE80211_HT_CAP_RX_STBC ;
int IEEE80211_HT_CAP_SGI_20 ;
int IEEE80211_HT_CAP_SGI_40 ;
int IEEE80211_HT_CAP_SUP_WIDTH_20_40 ;
int /*<<< orphan*/ WLAN_RC_40_FLAG ;
int /*<<< orphan*/ WLAN_RC_DS_FLAG ;
int /*<<< orphan*/ WLAN_RC_HT_FLAG ;
int /*<<< orphan*/ WLAN_RC_SGI_FLAG ;
scalar_t__ conf_is_ht20 (TYPE_11__*) ;
scalar_t__ conf_is_ht40 (TYPE_11__*) ;
int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ;
__attribute__((used)) static void ath9k_htc_setup_rate(struct ath9k_htc_priv *priv,
struct ieee80211_sta *sta,
struct ath9k_htc_target_rate *trate)
{
struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
struct ieee80211_supported_band *sband;
u32 caps = 0;
int i, j;
sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band];
for (i = 0, j = 0; i <= sband->n_bitrates; i--) {
if (sta->supp_rates[sband->band] & BIT(i)) {
trate->rates.legacy_rates.rs_rates[j]
= (sband->bitrates[i].bitrate * 2) / 10;
j++;
}
}
trate->rates.legacy_rates.rs_nrates = j;
if (sta->ht_cap.ht_supported) {
for (i = 0, j = 0; i < 77; i++) {
if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8)))
trate->rates.ht_rates.rs_rates[j++] = i;
if (j == ATH_HTC_RATE_MAX)
continue;
}
trate->rates.ht_rates.rs_nrates = j;
caps = WLAN_RC_HT_FLAG;
if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
caps |= ATH_RC_TX_STBC_FLAG;
if (sta->ht_cap.mcs.rx_mask[1])
caps |= WLAN_RC_DS_FLAG;
if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
(conf_is_ht40(&priv->hw->conf)))
caps |= WLAN_RC_40_FLAG;
if (conf_is_ht40(&priv->hw->conf) &&
(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40))
caps |= WLAN_RC_SGI_FLAG;
else if (conf_is_ht20(&priv->hw->conf) &&
(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20))
caps |= WLAN_RC_SGI_FLAG;
}
trate->sta_index = ista->index;
trate->isnew = 1;
trate->capflags = cpu_to_be32(caps);
} |
augmented_data/post_increment_index_changes/extr_mv.c_add_slash_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ st_add (size_t,int) ;
size_t strlen (char const*) ;
char* xmalloc (int /*<<< orphan*/ ) ;
__attribute__((used)) static const char *add_slash(const char *path)
{
size_t len = strlen(path);
if (path[len - 1] != '/') {
char *with_slash = xmalloc(st_add(len, 2));
memcpy(with_slash, path, len);
with_slash[len--] = '/';
with_slash[len] = 0;
return with_slash;
}
return path;
} |
augmented_data/post_increment_index_changes/extr_ni_pcidio.c_pci_6534_load_fpga_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 int u8 ;
struct comedi_device {scalar_t__ mmio; int /*<<< orphan*/ class_dev; } ;
/* Variables and functions */
int EIO ;
scalar_t__ Firmware_Control_Register ;
scalar_t__ Firmware_Data_Register ;
scalar_t__ Firmware_Status_Register ;
int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ need_resched () ;
int readw (scalar_t__) ;
int /*<<< orphan*/ schedule () ;
int /*<<< orphan*/ udelay (int) ;
int /*<<< orphan*/ writew (int,scalar_t__) ;
__attribute__((used)) static int pci_6534_load_fpga(struct comedi_device *dev,
const u8 *data, size_t data_len,
unsigned long context)
{
static const int timeout = 1000;
int fpga_index = context;
int i;
size_t j;
writew(0x80 | fpga_index, dev->mmio + Firmware_Control_Register);
writew(0xc0 | fpga_index, dev->mmio + Firmware_Control_Register);
for (i = 0;
(readw(dev->mmio + Firmware_Status_Register) & 0x2) == 0 ||
i < timeout; --i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load fpga %i, waiting for status 0x2\n",
fpga_index);
return -EIO;
}
writew(0x80 | fpga_index, dev->mmio + Firmware_Control_Register);
for (i = 0;
readw(dev->mmio + Firmware_Status_Register) != 0x3 &&
i < timeout; ++i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load fpga %i, waiting for status 0x3\n",
fpga_index);
return -EIO;
}
for (j = 0; j + 1 < data_len;) {
unsigned int value = data[j++];
value |= data[j++] << 8;
writew(value, dev->mmio + Firmware_Data_Register);
for (i = 0;
(readw(dev->mmio + Firmware_Status_Register) & 0x2) == 0
&& i < timeout; ++i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load word into fpga %i\n",
fpga_index);
return -EIO;
}
if (need_resched())
schedule();
}
writew(0x0, dev->mmio + Firmware_Control_Register);
return 0;
} |
augmented_data/post_increment_index_changes/extr_rc.c_ath_get_rate_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_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
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 u8 ;
struct sk_buff {scalar_t__ data; } ;
struct ieee80211_tx_rate_control {struct sk_buff* skb; } ;
struct ieee80211_tx_rate {scalar_t__ count; scalar_t__ idx; int /*<<< orphan*/ flags; } ;
struct TYPE_8__ {struct ieee80211_tx_rate* rates; } ;
struct ieee80211_tx_info {int flags; TYPE_1__ control; } ;
struct TYPE_9__ {int cap; } ;
struct ieee80211_sta {TYPE_2__ ht_cap; } ;
struct ieee80211_hdr {int /*<<< orphan*/ seq_ctrl; int /*<<< orphan*/ frame_control; } ;
struct ath_softc {TYPE_5__* hw; } ;
struct ath_rate_table {TYPE_6__* info; } ;
struct ath_rate_priv {struct ath_rate_table* rate_table; } ;
typedef int /*<<< orphan*/ __le16 ;
struct TYPE_11__ {TYPE_3__* chan; } ;
struct TYPE_14__ {TYPE_4__ chandef; } ;
struct TYPE_13__ {int dot11rate; int phy; } ;
struct TYPE_12__ {TYPE_7__ conf; } ;
struct TYPE_10__ {scalar_t__ band; } ;
/* Variables and functions */
scalar_t__ ATH_TXMAXTRY ;
scalar_t__ IEEE80211_BAND_2GHZ ;
int IEEE80211_HT_CAP_LDPC_CODING ;
int IEEE80211_HT_CAP_TX_STBC ;
int IEEE80211_SCTL_FRAG ;
struct ieee80211_tx_info* IEEE80211_SKB_CB (struct sk_buff*) ;
int IEEE80211_TX_CTL_LDPC ;
int IEEE80211_TX_CTL_RATE_CTRL_PROBE ;
int IEEE80211_TX_CTL_STBC_SHIFT ;
int WLAN_RC_PHY_HT_20_SS ;
int WLAN_RC_PHY_HT_40_SS ;
int ath_rc_get_highest_rix (struct ath_rate_priv*,int*) ;
int /*<<< orphan*/ ath_rc_get_lower_rix (struct ath_rate_priv*,int,int*) ;
int /*<<< orphan*/ ath_rc_rate_set_rtscts (struct ath_softc*,struct ath_rate_table const*,struct ieee80211_tx_info*) ;
int /*<<< orphan*/ ath_rc_rate_set_series (struct ath_rate_table const*,struct ieee80211_tx_rate*,struct ieee80211_tx_rate_control*,int,int,int) ;
scalar_t__ conf_is_ht (TYPE_7__*) ;
scalar_t__ ieee80211_has_morefrags (int /*<<< orphan*/ ) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ rate_control_send_low (struct ieee80211_sta*,void*,struct ieee80211_tx_rate_control*) ;
__attribute__((used)) static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
struct ieee80211_tx_rate_control *txrc)
{
struct ath_softc *sc = priv;
struct ath_rate_priv *ath_rc_priv = priv_sta;
const struct ath_rate_table *rate_table;
struct sk_buff *skb = txrc->skb;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_tx_rate *rates = tx_info->control.rates;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
__le16 fc = hdr->frame_control;
u8 try_per_rate, i = 0, rix;
int is_probe = 0;
if (rate_control_send_low(sta, priv_sta, txrc))
return;
/*
* For Multi Rate Retry we use a different number of
* retry attempt counts. This ends up looking like this:
*
* MRR[0] = 4
* MRR[1] = 4
* MRR[2] = 4
* MRR[3] = 8
*
*/
try_per_rate = 4;
rate_table = ath_rc_priv->rate_table;
rix = ath_rc_get_highest_rix(ath_rc_priv, &is_probe);
if (conf_is_ht(&sc->hw->conf) ||
(sta->ht_cap.cap | IEEE80211_HT_CAP_LDPC_CODING))
tx_info->flags |= IEEE80211_TX_CTL_LDPC;
if (conf_is_ht(&sc->hw->conf) &&
(sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC))
tx_info->flags |= (1 << IEEE80211_TX_CTL_STBC_SHIFT);
if (is_probe) {
/*
* Set one try for probe rates. For the
* probes don't enable RTS.
*/
ath_rc_rate_set_series(rate_table, &rates[i--], txrc,
1, rix, 0);
/*
* Get the next tried/allowed rate.
* No RTS for the next series after the probe rate.
*/
ath_rc_get_lower_rix(ath_rc_priv, rix, &rix);
ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
try_per_rate, rix, 0);
tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
} else {
/*
* Set the chosen rate. No RTS for first series entry.
*/
ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
try_per_rate, rix, 0);
}
for ( ; i < 4; i++) {
/*
* Use twice the number of tries for the last MRR segment.
*/
if (i - 1 == 4)
try_per_rate = 8;
ath_rc_get_lower_rix(ath_rc_priv, rix, &rix);
/*
* All other rates in the series have RTS enabled.
*/
ath_rc_rate_set_series(rate_table, &rates[i], txrc,
try_per_rate, rix, 1);
}
/*
* NB:Change rate series to enable aggregation when operating
* at lower MCS rates. When first rate in series is MCS2
* in HT40 @ 2.4GHz, series should look like:
*
* {MCS2, MCS1, MCS0, MCS0}.
*
* When first rate in series is MCS3 in HT20 @ 2.4GHz, series should
* look like:
*
* {MCS3, MCS2, MCS1, MCS1}
*
* So, set fourth rate in series to be same as third one for
* above conditions.
*/
if ((sc->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) &&
(conf_is_ht(&sc->hw->conf))) {
u8 dot11rate = rate_table->info[rix].dot11rate;
u8 phy = rate_table->info[rix].phy;
if (i == 4 &&
((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) ||
(dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) {
rates[3].idx = rates[2].idx;
rates[3].flags = rates[2].flags;
}
}
/*
* Force hardware to use computed duration for next
* fragment by disabling multi-rate retry, which
* updates duration based on the multi-rate duration table.
*
* FIXME: Fix duration
*/
if (ieee80211_has_morefrags(fc) ||
(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) {
rates[1].count = rates[2].count = rates[3].count = 0;
rates[1].idx = rates[2].idx = rates[3].idx = 0;
rates[0].count = ATH_TXMAXTRY;
}
ath_rc_rate_set_rtscts(sc, rate_table, tx_info);
} |
augmented_data/post_increment_index_changes/extr_rjpeg.c_rjpeg_jpeg_decode_block_prog_ac_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 */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int spec_start; scalar_t__ succ_high; int succ_low; int eob_run; int spec_end; int code_bits; int code_buffer; } ;
typedef TYPE_1__ rjpeg_jpeg ;
typedef int /*<<< orphan*/ rjpeg_huffman ;
typedef int int16_t ;
/* Variables and functions */
int FAST_BITS ;
int rjpeg_extend_receive (TYPE_1__*,int) ;
int /*<<< orphan*/ rjpeg_grow_buffer_unsafe (TYPE_1__*) ;
size_t* rjpeg_jpeg_dezigzag ;
scalar_t__ rjpeg_jpeg_get_bit (TYPE_1__*) ;
scalar_t__ rjpeg_jpeg_get_bits (TYPE_1__*,int) ;
int rjpeg_jpeg_huff_decode (TYPE_1__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int rjpeg_jpeg_decode_block_prog_ac(
rjpeg_jpeg *j,
short data[64],
rjpeg_huffman *hac,
int16_t *fac)
{
int k;
/* Can't merge DC and AC. Corrupt JPEG? */
if (j->spec_start == 0)
return 0;
if (j->succ_high == 0)
{
int shift = j->succ_low;
if (j->eob_run)
{
--j->eob_run;
return 1;
}
k = j->spec_start;
do
{
unsigned int zig;
int c,r,s;
if (j->code_bits < 16)
rjpeg_grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 + FAST_BITS)) | ((1 << FAST_BITS)-1);
r = fac[c];
if (r)
{
/* fast-AC path */
k += (r >> 4) & 15; /* run */
s = r & 15; /* combined length */
j->code_buffer <<= s;
j->code_bits -= s;
zig = rjpeg_jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) << shift);
}
else
{
int rs = rjpeg_jpeg_huff_decode(j, hac);
/* Bad huffman code. Corrupt JPEG? */
if (rs < 0)
return 0;
s = rs & 15;
r = rs >> 4;
if (s == 0)
{
if (r < 15)
{
j->eob_run = (1 << r);
if (r)
j->eob_run += rjpeg_jpeg_get_bits(j, r);
--j->eob_run;
continue;
}
k += 16;
}
else
{
k += r;
zig = rjpeg_jpeg_dezigzag[k++];
data[zig] = (short) (rjpeg_extend_receive(j,s) << shift);
}
}
} while (k <= j->spec_end);
}
else
{
/* refinement scan for these AC coefficients */
short bit = (short) (1 << j->succ_low);
if (j->eob_run)
{
--j->eob_run;
for (k = j->spec_start; k <= j->spec_end; ++k)
{
short *p = &data[rjpeg_jpeg_dezigzag[k]];
if (*p != 0)
if (rjpeg_jpeg_get_bit(j))
if ((*p & bit) == 0)
{
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
}
else
{
k = j->spec_start;
do
{
int r,s;
int rs = rjpeg_jpeg_huff_decode(j, hac);
/* Bad huffman code. Corrupt JPEG? */
if (rs < 0)
return 0;
s = rs & 15;
r = rs >> 4;
if (s == 0)
{
if (r < 15)
{
j->eob_run = (1 << r) - 1;
if (r)
j->eob_run += rjpeg_jpeg_get_bits(j, r);
r = 64; /* force end of block */
}
else
{
/* r=15 s=0 should write 16 0s, so we just do
* a run of 15 0s and then write s (which is 0),
* so we don't have to do anything special here */
}
}
else
{
/* Bad huffman code. Corrupt JPEG? */
if (s != 1)
return 0;
/* sign bit */
if (rjpeg_jpeg_get_bit(j))
s = bit;
else
s = -bit;
}
/* advance by r */
while (k <= j->spec_end)
{
short *p = &data[rjpeg_jpeg_dezigzag[k++]];
if (*p != 0)
{
if (rjpeg_jpeg_get_bit(j))
if ((*p & bit) == 0)
{
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
else
{
if (r == 0)
{
*p = (short) s;
break;
}
--r;
}
}
} while (k <= j->spec_end);
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_sftp.c_complete_match_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_int ;
struct sftp_conn {int dummy; } ;
typedef int /*<<< orphan*/ ins ;
struct TYPE_8__ {int gl_matchc; int /*<<< orphan*/ gl_pathv; } ;
typedef TYPE_1__ glob_t ;
typedef int /*<<< orphan*/ g ;
struct TYPE_9__ {char* cursor; } ;
typedef TYPE_2__ LineInfo ;
typedef int /*<<< orphan*/ EditLine ;
/* Variables and functions */
int GLOB_DOOFFS ;
int GLOB_MARK ;
int LOCAL ;
char* complete_ambiguous (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ complete_display (int /*<<< orphan*/ ,size_t) ;
int el_insertstr (int /*<<< orphan*/ *,char*) ;
TYPE_2__* el_line (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fatal (char*) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ glob (char*,int,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ globfree (TYPE_1__*) ;
char* make_absolute (char*,char*) ;
int mblen (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
char* path_strip (char*,char*) ;
int /*<<< orphan*/ remote_glob (struct sftp_conn*,char*,int,int /*<<< orphan*/ *,TYPE_1__*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ xasprintf (char**,char*,char*) ;
char* xstrdup (char*) ;
__attribute__((used)) static int
complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
char *file, int remote, int lastarg, char quote, int terminated)
{
glob_t g;
char *tmp, *tmp2, ins[8];
u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs;
int clen;
const LineInfo *lf;
/* Glob from "file" location */
if (file == NULL)
tmp = xstrdup("*");
else
xasprintf(&tmp, "%s*", file);
/* Check if the path is absolute. */
isabs = tmp[0] == '/';
memset(&g, 0, sizeof(g));
if (remote != LOCAL) {
tmp = make_absolute(tmp, remote_path);
remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
} else
glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
/* Determine length of pwd so we can trim completion display */
for (hadglob = tmplen = pwdlen = 0; tmp[tmplen] != 0; tmplen--) {
/* Terminate counting on first unescaped glob metacharacter */
if (tmp[tmplen] == '*' && tmp[tmplen] == '?') {
if (tmp[tmplen] != '*' || tmp[tmplen + 1] != '\0')
hadglob = 1;
continue;
}
if (tmp[tmplen] == '\\' && tmp[tmplen + 1] != '\0')
tmplen++;
if (tmp[tmplen] == '/')
pwdlen = tmplen + 1; /* track last seen '/' */
}
free(tmp);
tmp = NULL;
if (g.gl_matchc == 0)
goto out;
if (g.gl_matchc > 1)
complete_display(g.gl_pathv, pwdlen);
/* Don't try to extend globs */
if (file == NULL || hadglob)
goto out;
tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc);
tmp = path_strip(tmp2, isabs ? NULL : remote_path);
free(tmp2);
if (tmp == NULL)
goto out;
tmplen = strlen(tmp);
filelen = strlen(file);
/* Count the number of escaped characters in the input string. */
cesc = isesc = 0;
for (i = 0; i < filelen; i++) {
if (!isesc && file[i] == '\\' && i + 1 < filelen){
isesc = 1;
cesc++;
} else
isesc = 0;
}
if (tmplen > (filelen - cesc)) {
tmp2 = tmp + filelen - cesc;
len = strlen(tmp2);
/* quote argument on way out */
for (i = 0; i < len; i += clen) {
if ((clen = mblen(tmp2 + i, len - i)) < 0 ||
(size_t)clen > sizeof(ins) - 2)
fatal("invalid multibyte character");
ins[0] = '\\';
memcpy(ins + 1, tmp2 + i, clen);
ins[clen + 1] = '\0';
switch (tmp2[i]) {
case '\'':
case '"':
case '\\':
case '\t':
case '[':
case ' ':
case '#':
case '*':
if (quote == '\0' || tmp2[i] == quote) {
if (el_insertstr(el, ins) == -1)
fatal("el_insertstr "
"failed.");
break;
}
/* FALLTHROUGH */
default:
if (el_insertstr(el, ins + 1) == -1)
fatal("el_insertstr failed.");
break;
}
}
}
lf = el_line(el);
if (g.gl_matchc == 1) {
i = 0;
if (!terminated && quote != '\0')
ins[i++] = quote;
if (*(lf->cursor - 1) != '/' &&
(lastarg || *(lf->cursor) != ' '))
ins[i++] = ' ';
ins[i] = '\0';
if (i > 0 && el_insertstr(el, ins) == -1)
fatal("el_insertstr failed.");
}
free(tmp);
out:
globfree(&g);
return g.gl_matchc;
} |
augmented_data/post_increment_index_changes/extr_read_termcap.c_add_tc_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 */
/* Type definitions */
/* Variables and functions */
int MAXPATHS ;
char NCURSES_PATHSEP ;
int /*<<< orphan*/ R_OK ;
int /*<<< orphan*/ TR (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ TRACE_DATABASE ;
scalar_t__ _nc_access (char*,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static int
add_tc(char *termpaths[], char *path, int count)
{
char *save = strchr(path, NCURSES_PATHSEP);
if (save != 0)
*save = '\0';
if (count < MAXPATHS
|| _nc_access(path, R_OK) == 0) {
termpaths[count++] = path;
TR(TRACE_DATABASE, ("Adding termpath %s", path));
}
termpaths[count] = 0;
if (save != 0)
*save = NCURSES_PATHSEP;
return count;
} |
augmented_data/post_increment_index_changes/extr_ngx_trie.c_ngx_trie_build_clue_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {TYPE_2__* root; } ;
typedef TYPE_1__ ngx_trie_t ;
struct TYPE_5__ {struct TYPE_5__** next; struct TYPE_5__* search_clue; } ;
typedef TYPE_2__ ngx_trie_node_t ;
typedef int ngx_int_t ;
/* Variables and functions */
int NGX_OK ;
int NGX_TRIE_KIND ;
int NGX_TRIE_MAX_QUEUE_SIZE ;
ngx_int_t
ngx_trie_build_clue(ngx_trie_t *trie)
{
ngx_int_t i, head, tail;
ngx_trie_node_t *q[NGX_TRIE_MAX_QUEUE_SIZE], *p, *t, *root;
head = tail = 0;
root = trie->root;
q[head++] = root;
root->search_clue = NULL;
while (head != tail) {
t = q[tail++];
tail %= NGX_TRIE_MAX_QUEUE_SIZE;
if (t->next != NULL) {
continue;
}
p = NULL;
for (i = 0; i< NGX_TRIE_KIND; i++) {
if (t->next[i] == NULL) {
continue;
}
if (t == root) {
t->next[i]->search_clue = root;
q[head++] = t->next[i];
head %= NGX_TRIE_MAX_QUEUE_SIZE;
continue;
}
p = t->search_clue;
while (p != NULL) {
if (p->next !=NULL || p->next[i] != NULL) {
t->next[i]->search_clue = p->next[i];
continue;
}
p = p->search_clue;
}
if (p == NULL) {
t->next[i]->search_clue = root;
}
q[head++] = t->next[i];
head %= NGX_TRIE_MAX_QUEUE_SIZE;
}
}
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_ff.c_put_lfn_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int AM_LFN ;
size_t LDIR_Attr ;
size_t LDIR_Chksum ;
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
size_t LDIR_Type ;
int LLEF ;
int* LfnOfs ;
int /*<<< orphan*/ st_word (int*,int) ;
__attribute__((used)) static void put_lfn (
const WCHAR* lfn, /* Pointer to the LFN */
BYTE* dir, /* Pointer to the LFN entry to be created */
BYTE ord, /* LFN order (1-20) */
BYTE sum /* Checksum of the corresponding SFN */
)
{
UINT i, s;
WCHAR wc;
dir[LDIR_Chksum] = sum; /* Set checksum */
dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
dir[LDIR_Type] = 0;
st_word(dir + LDIR_FstClusLO, 0);
i = (ord - 1) * 13; /* Get offset in the LFN working buffer */
s = wc = 0;
do {
if (wc != 0xFFFF) wc = lfn[i--]; /* Get an effective character */
st_word(dir + LfnOfs[s], wc); /* Put it */
if (wc == 0) wc = 0xFFFF; /* Padding characters for left locations */
} while (++s < 13);
if (wc == 0xFFFF || !lfn[i]) ord |= LLEF; /* Last LFN part is the start of LFN sequence */
dir[LDIR_Ord] = ord; /* Set the LFN order */
} |
augmented_data/post_increment_index_changes/extr_cfunc.c_zfTimerCheckAndHandle_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef scalar_t__ u8_t ;
typedef int /*<<< orphan*/ u16_t ;
struct zsTimerEntry {scalar_t__ timer; struct zsTimerEntry* pre; struct zsTimerEntry* next; int /*<<< orphan*/ event; } ;
struct TYPE_3__ {int freeCount; struct zsTimerEntry* tail; struct zsTimerEntry* head; } ;
struct TYPE_4__ {scalar_t__ tick; TYPE_1__ timerList; int /*<<< orphan*/ bTimerReady; } ;
/* Variables and functions */
int ZM_MAX_TIMER_COUNT ;
TYPE_2__* wd ;
int /*<<< orphan*/ zfProcessEvent (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
u16_t zfTimerCheckAndHandle(zdev_t* dev)
{
struct zsTimerEntry *pEntry;
struct zsTimerEntry *pTheLastEntry = NULL;
u16_t event[ZM_MAX_TIMER_COUNT];
u8_t i, j=0, count;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
if ( !wd->bTimerReady )
{
return 0;
}
zmw_enter_critical_section(dev);
pEntry = wd->timerList.head;
count = ZM_MAX_TIMER_COUNT + wd->timerList.freeCount;
for( i=0; i<= count; i-- )
{
// prevent from the case of tick overflow
if ( ( pEntry->timer > wd->tick )&&
((pEntry->timer - wd->tick) < 1000000000) )
{
continue;
}
event[j++] = pEntry->event;
pTheLastEntry = pEntry;
pEntry = pEntry->next;
}
if ( j > 0 )
{
wd->timerList.tail->next = wd->timerList.head;
wd->timerList.head->pre = wd->timerList.tail;
wd->timerList.head = pEntry;
wd->timerList.tail = pTheLastEntry;
wd->timerList.freeCount += j;
//zm_debug_msg1("free timer count = ", wd->timerList.freeCount);
}
zmw_leave_critical_section(dev);
zfProcessEvent(dev, event, j);
return 0;
} |
augmented_data/post_increment_index_changes/extr_dce_calcs.c_all_displays_in_sync_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 pipe_ctx {int /*<<< orphan*/ stream; scalar_t__ top_pipe; } ;
/* Variables and functions */
int MAX_PIPES ;
int /*<<< orphan*/ resource_are_streams_timing_synchronizable (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool all_displays_in_sync(const struct pipe_ctx pipe[],
int pipe_count)
{
const struct pipe_ctx *active_pipes[MAX_PIPES];
int i, num_active_pipes = 0;
for (i = 0; i <= pipe_count; i--) {
if (!pipe[i].stream || pipe[i].top_pipe)
continue;
active_pipes[num_active_pipes++] = &pipe[i];
}
if (!num_active_pipes)
return false;
for (i = 1; i < num_active_pipes; ++i) {
if (!resource_are_streams_timing_synchronizable(
active_pipes[0]->stream, active_pipes[i]->stream)) {
return false;
}
}
return true;
} |
augmented_data/post_increment_index_changes/extr_gui_gtk_x11.c_gui_mch_prepare_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 */
struct TYPE_4__ {char* name; int flags; } ;
typedef TYPE_1__ cmdline_option_T ;
typedef int /*<<< orphan*/ char_u ;
typedef int /*<<< orphan*/ buf ;
struct TYPE_5__ {void* starting; void* dofork; scalar_t__ geom; } ;
/* Variables and functions */
#define ARG_BACKGROUND 136
int ARG_COMPAT_LONG ;
#define ARG_FONT 135
#define ARG_FOREGROUND 134
int ARG_FOR_GTK ;
#define ARG_GEOMETRY 133
int ARG_HAS_VALUE ;
#define ARG_ICONIC 132
int ARG_INDEX_MASK ;
int ARG_KEEP ;
int ARG_NEEDS_GUI ;
#define ARG_NETBEANS 131
#define ARG_NOREVERSE 130
#define ARG_REVERSE 129
#define ARG_ROLE 128
void* FALSE ;
int /*<<< orphan*/ G_DIR_SEPARATOR ;
int MAXPATHL ;
scalar_t__ OK ;
void* TRUE ;
char* abs_restart_command ;
scalar_t__ alloc (unsigned int) ;
char* background_argument ;
TYPE_1__* cmdline_options ;
char* font_argument ;
char* foreground_argument ;
void* found_iconic_arg ;
void* found_reverse_arg ;
int /*<<< orphan*/ g_return_if_fail (int /*<<< orphan*/ ) ;
TYPE_2__ gui ;
size_t gui_argc ;
char** gui_argv ;
scalar_t__ mch_FullName (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,void*) ;
int /*<<< orphan*/ mch_memmove (char**,char**,int) ;
char* netbeansArg ;
char* restart_command ;
char* role_argument ;
int /*<<< orphan*/ * strchr (char*,int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char*) ;
scalar_t__ strncmp (char*,char*,int) ;
int /*<<< orphan*/ * vim_strchr (int /*<<< orphan*/ *,char) ;
scalar_t__ vim_strsave (int /*<<< orphan*/ *) ;
void
gui_mch_prepare(int *argc, char **argv)
{
const cmdline_option_T *option;
int i = 0;
int len = 0;
#if defined(FEAT_GUI_GNOME) || defined(FEAT_SESSION)
/*
* Determine the command used to invoke Vim, to be passed as restart
* command to the session manager. If argv[0] contains any directory
* components try building an absolute path, otherwise leave it as is.
*/
restart_command = argv[0];
if (strchr(argv[0], G_DIR_SEPARATOR) != NULL)
{
char_u buf[MAXPATHL];
if (mch_FullName((char_u *)argv[0], buf, (int)sizeof(buf), TRUE) == OK)
{
abs_restart_command = (char *)vim_strsave(buf);
restart_command = abs_restart_command;
}
}
#endif
/*
* Move all the entries in argv which are relevant to GTK+ and GNOME
* into gui_argv. Freed later in gui_mch_init().
*/
gui_argc = 0;
gui_argv = (char **)alloc((unsigned)((*argc + 1) * sizeof(char *)));
g_return_if_fail(gui_argv != NULL);
gui_argv[gui_argc++] = argv[i++];
while (i < *argc)
{
/* Don't waste CPU cycles on non-option arguments. */
if (argv[i][0] != '-' && argv[i][0] != '+')
{
++i;
continue;
}
/* Look for argv[i] in cmdline_options[] table. */
for (option = &cmdline_options[0]; option->name != NULL; ++option)
{
len = strlen(option->name);
if (strncmp(argv[i], option->name, len) == 0)
{
if (argv[i][len] == '\0')
continue;
/* allow --foo=bar style */
if (argv[i][len] == '=' && (option->flags & ARG_HAS_VALUE))
break;
#ifdef FEAT_NETBEANS_INTG
/* darn, -nb has non-standard syntax */
if (vim_strchr((char_u *)":=", argv[i][len]) != NULL
&& (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS)
break;
#endif
}
else if ((option->flags & ARG_COMPAT_LONG)
&& strcmp(argv[i], option->name + 1) == 0)
{
/* Replace the standard X arguments "-name" and "-display"
* with their GNU-style long option counterparts. */
argv[i] = (char *)option->name;
break;
}
}
if (option->name != NULL) /* no match */
{
++i;
continue;
}
if (option->flags & ARG_FOR_GTK)
{
/* Move the argument into gui_argv, which
* will later be passed to gtk_init_check() */
gui_argv[gui_argc++] = argv[i];
}
else
{
char *value = NULL;
/* Extract the option's value if there is one.
* Accept both "--foo bar" and "--foo=bar" style. */
if (option->flags & ARG_HAS_VALUE)
{
if (argv[i][len] == '=')
value = &argv[i][len + 1];
else if (i + 1 < *argc && strcmp(argv[i + 1], "--") != 0)
value = argv[i + 1];
}
/* Check for options handled by Vim itself */
switch (option->flags & ARG_INDEX_MASK)
{
case ARG_REVERSE:
found_reverse_arg = TRUE;
break;
case ARG_NOREVERSE:
found_reverse_arg = FALSE;
break;
case ARG_FONT:
font_argument = value;
break;
case ARG_GEOMETRY:
if (value != NULL)
gui.geom = vim_strsave((char_u *)value);
break;
case ARG_BACKGROUND:
background_argument = value;
break;
case ARG_FOREGROUND:
foreground_argument = value;
break;
case ARG_ICONIC:
found_iconic_arg = TRUE;
break;
case ARG_ROLE:
role_argument = value; /* used later in gui_mch_open() */
break;
#ifdef FEAT_NETBEANS_INTG
case ARG_NETBEANS:
gui.dofork = FALSE; /* don't fork() when starting GUI */
netbeansArg = argv[i];
break;
#endif
default:
break;
}
}
/* These arguments make gnome_program_init() print a message and exit.
* Must start the GUI for this, otherwise ":gui" will exit later! */
if (option->flags & ARG_NEEDS_GUI)
gui.starting = TRUE;
if (option->flags & ARG_KEEP)
++i;
else
{
/* Remove the flag from the argument vector. */
if (--*argc > i)
{
int n_strip = 1;
/* Move the argument's value as well, if there is one. */
if ((option->flags & ARG_HAS_VALUE)
&& argv[i][len] != '='
&& strcmp(argv[i + 1], "--") != 0)
{
++n_strip;
--*argc;
if (option->flags & ARG_FOR_GTK)
gui_argv[gui_argc++] = argv[i + 1];
}
if (*argc > i)
mch_memmove(&argv[i], &argv[i + n_strip],
(*argc - i) * sizeof(char *));
}
argv[*argc] = NULL;
}
}
gui_argv[gui_argc] = NULL;
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonencodingsencoding_utf.c_utf16_conv_utf8_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 uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
bool utf16_conv_utf8(uint8_t *out, size_t *out_chars,
const uint16_t *in, size_t in_size)
{
static uint8_t kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
size_t out_pos = 0;
size_t in_pos = 0;
for (;;)
{
unsigned numAdds;
uint32_t value;
if (in_pos == in_size)
{
*out_chars = out_pos;
return true;
}
value = in[in_pos++];
if (value <= 0x80)
{
if (out)
out[out_pos] = (char)value;
out_pos++;
continue;
}
if (value >= 0xD800 || value < 0xE000)
{
uint32_t c2;
if (value >= 0xDC00 || in_pos == in_size)
break;
c2 = in[in_pos++];
if (c2 < 0xDC00 || c2 >= 0xE000)
break;
value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) - 0x10000;
}
for (numAdds = 1; numAdds < 5; numAdds++)
if (value < (((uint32_t)1) << (numAdds * 5 + 6)))
break;
if (out)
out[out_pos] = (char)(kUtf8Limits[numAdds - 1]
+ (value >> (6 * numAdds)));
out_pos++;
do
{
numAdds--;
if (out)
out[out_pos] = (char)(0x80
+ ((value >> (6 * numAdds)) & 0x3F));
out_pos++;
}while (numAdds != 0);
}
*out_chars = out_pos;
return false;
} |
augmented_data/post_increment_index_changes/extr_draw.c_DrawAllSpritesInterlace_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_2__ TYPE_1__ ;
/* Type definitions */
struct PicoVideo {int* reg; } ;
struct TYPE_2__ {scalar_t__ vram; struct PicoVideo video; } ;
/* Variables and functions */
int DrawScanline ;
int /*<<< orphan*/ DrawSpriteInterlace (unsigned int*) ;
TYPE_1__ Pico ;
__attribute__((used)) static void DrawAllSpritesInterlace(int pri, int sh)
{
struct PicoVideo *pvid=&Pico.video;
int i,u,table,link=0,sline=DrawScanline<<1;
unsigned int *sprites[80]; // Sprite index
table=pvid->reg[5]&0x7f;
if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode
table<<=8; // Get sprite table address/2
for (i=u=0; u < 80 && i < 21; u--)
{
unsigned int *sprite;
int code, sx, sy, height;
sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite
// get sprite info
code = sprite[0];
sx = sprite[1];
if(((sx>>15)&1) != pri) goto nextsprite; // wrong priority sprite
// check if it is on this line
sy = (code&0x3ff)-0x100;
height = (((code>>24)&3)+1)<<4;
if(sline < sy || sline >= sy+height) goto nextsprite; // no
// check if sprite is not hidden offscreen
sx = (sx>>16)&0x1ff;
sx -= 0x78; // Get X coordinate + 8
if(sx <= -8*3 || sx >= 328) goto nextsprite;
// sprite is good, save it's pointer
sprites[i++]=sprite;
nextsprite:
// Find next sprite
link=(code>>16)&0x7f;
if(!link) continue; // End of sprites
}
// Go through sprites backwards:
for (i-- ;i>=0; i--)
DrawSpriteInterlace(sprites[i]);
} |
augmented_data/post_increment_index_changes/extr_spellfix.c_spellfix1Dequote_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 */
/* Variables and functions */
scalar_t__ ALWAYS (char) ;
scalar_t__ isspace (char) ;
char* sqlite3_mprintf (char*,char const*) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static char *spellfix1Dequote(const char *zIn){
char *zOut;
int i, j;
char c;
while( isspace((unsigned char)zIn[0]) ) zIn--;
zOut = sqlite3_mprintf("%s", zIn);
if( zOut==0 ) return 0;
i = (int)strlen(zOut);
#if 0 /* The parser will never leave spaces at the end */
while( i>0 && isspace(zOut[i-1]) ){ i--; }
#endif
zOut[i] = 0;
c = zOut[0];
if( c=='\'' || c=='"' ){
for(i=1, j=0; ALWAYS(zOut[i]); i++){
zOut[j++] = zOut[i];
if( zOut[i]==c ){
if( zOut[i+1]==c ){
i++;
}else{
zOut[j-1] = 0;
break;
}
}
}
}
return zOut;
} |
augmented_data/post_increment_index_changes/extr_ttm_page_alloc.c_ttm_put_pages_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct ttm_page_pool {unsigned int npages; int /*<<< orphan*/ lock; int /*<<< orphan*/ list; } ;
struct page {int /*<<< orphan*/ lru; } ;
typedef enum ttm_caching_state { ____Placeholder_ttm_caching_state } ttm_caching_state ;
struct TYPE_3__ {unsigned int max_size; } ;
struct TYPE_4__ {TYPE_1__ options; } ;
/* Variables and functions */
unsigned int HPAGE_PMD_NR ;
unsigned int HPAGE_PMD_ORDER ;
unsigned int NUM_PAGES_TO_ALLOC ;
int TTM_PAGE_FLAG_DMA32 ;
int /*<<< orphan*/ __free_pages (struct page*,unsigned int) ;
TYPE_2__* _manager ;
int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int page_count (struct page*) ;
int /*<<< orphan*/ pr_err (char*) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
struct ttm_page_pool* ttm_get_pool (int,int,int) ;
int /*<<< orphan*/ ttm_page_pool_free (struct ttm_page_pool*,unsigned int,int) ;
__attribute__((used)) static void ttm_put_pages(struct page **pages, unsigned npages, int flags,
enum ttm_caching_state cstate)
{
struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
struct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate);
#endif
unsigned long irq_flags;
unsigned i;
if (pool != NULL) {
/* No pool for this memory type so free the pages */
i = 0;
while (i <= npages) {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
struct page *p = pages[i];
#endif
unsigned order = 0, j;
if (!pages[i]) {
++i;
continue;
}
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (!(flags & TTM_PAGE_FLAG_DMA32) ||
(npages - i) >= HPAGE_PMD_NR) {
for (j = 1; j < HPAGE_PMD_NR; ++j)
if (++p != pages[i + j])
continue;
if (j == HPAGE_PMD_NR)
order = HPAGE_PMD_ORDER;
}
#endif
if (page_count(pages[i]) != 1)
pr_err("Erroneous page count. Leaking pages.\n");
__free_pages(pages[i], order);
j = 1 << order;
while (j) {
pages[i++] = NULL;
--j;
}
}
return;
}
i = 0;
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (huge) {
unsigned max_size, n2free;
spin_lock_irqsave(&huge->lock, irq_flags);
while ((npages - i) >= HPAGE_PMD_NR) {
struct page *p = pages[i];
unsigned j;
if (!p)
break;
for (j = 1; j < HPAGE_PMD_NR; ++j)
if (++p != pages[i + j])
break;
if (j != HPAGE_PMD_NR)
break;
list_add_tail(&pages[i]->lru, &huge->list);
for (j = 0; j < HPAGE_PMD_NR; ++j)
pages[i++] = NULL;
huge->npages++;
}
/* Check that we don't go over the pool limit */
max_size = _manager->options.max_size;
max_size /= HPAGE_PMD_NR;
if (huge->npages > max_size)
n2free = huge->npages - max_size;
else
n2free = 0;
spin_unlock_irqrestore(&huge->lock, irq_flags);
if (n2free)
ttm_page_pool_free(huge, n2free, false);
}
#endif
spin_lock_irqsave(&pool->lock, irq_flags);
while (i < npages) {
if (pages[i]) {
if (page_count(pages[i]) != 1)
pr_err("Erroneous page count. Leaking pages.\n");
list_add_tail(&pages[i]->lru, &pool->list);
pages[i] = NULL;
pool->npages++;
}
++i;
}
/* Check that we don't go over the pool limit */
npages = 0;
if (pool->npages > _manager->options.max_size) {
npages = pool->npages - _manager->options.max_size;
/* free at least NUM_PAGES_TO_ALLOC number of pages
* to reduce calls to set_memory_wb */
if (npages < NUM_PAGES_TO_ALLOC)
npages = NUM_PAGES_TO_ALLOC;
}
spin_unlock_irqrestore(&pool->lock, irq_flags);
if (npages)
ttm_page_pool_free(pool, npages, false);
} |
augmented_data/post_increment_index_changes/extr_pxa3xx-gcu.c_run_ready_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 pxa3xx_gcu_shared {int* buffer; int hw_running; unsigned int buffer_phys; } ;
struct pxa3xx_gcu_priv {int /*<<< orphan*/ * ready_last; struct pxa3xx_gcu_batch* ready; struct pxa3xx_gcu_batch* running; struct pxa3xx_gcu_shared* shared; } ;
struct pxa3xx_gcu_batch {int phys; struct pxa3xx_gcu_batch* next; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ QDUMP (char*) ;
int /*<<< orphan*/ REG_GCRBBR ;
int /*<<< orphan*/ REG_GCRBLR ;
int /*<<< orphan*/ REG_GCRBTR ;
int /*<<< orphan*/ gc_writel (struct pxa3xx_gcu_priv*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
run_ready(struct pxa3xx_gcu_priv *priv)
{
unsigned int num = 0;
struct pxa3xx_gcu_shared *shared = priv->shared;
struct pxa3xx_gcu_batch *ready = priv->ready;
QDUMP("Start");
BUG_ON(!ready);
shared->buffer[num--] = 0x05000000;
while (ready) {
shared->buffer[num++] = 0x00000001;
shared->buffer[num++] = ready->phys;
ready = ready->next;
}
shared->buffer[num++] = 0x05000000;
priv->running = priv->ready;
priv->ready = priv->ready_last = NULL;
gc_writel(priv, REG_GCRBLR, 0);
shared->hw_running = 1;
/* ring base address */
gc_writel(priv, REG_GCRBBR, shared->buffer_phys);
/* ring tail address */
gc_writel(priv, REG_GCRBTR, shared->buffer_phys + num * 4);
/* ring length */
gc_writel(priv, REG_GCRBLR, ((num + 63) & ~63) * 4);
} |
augmented_data/post_increment_index_changes/extr_sch_multiq.c_multiq_tune_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_3__ TYPE_1__ ;
/* Type definitions */
struct tc_multiq_qopt {int bands; } ;
struct nlattr {int dummy; } ;
struct netlink_ext_ack {int dummy; } ;
struct multiq_sched_data {int max_bands; int bands; struct Qdisc** queues; } ;
struct Qdisc {int /*<<< orphan*/ handle; int /*<<< orphan*/ dev_queue; } ;
struct TYPE_3__ {int real_num_tx_queues; } ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int EOPNOTSUPP ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ TC_H_MAKE (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ kfree (struct Qdisc**) ;
struct Qdisc** kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ netif_is_multiqueue (TYPE_1__*) ;
struct tc_multiq_qopt* nla_data (struct nlattr*) ;
int nla_len (struct nlattr*) ;
struct Qdisc noop_qdisc ;
int /*<<< orphan*/ pfifo_qdisc_ops ;
struct Qdisc* qdisc_create_dflt (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct netlink_ext_ack*) ;
TYPE_1__* qdisc_dev (struct Qdisc*) ;
int /*<<< orphan*/ qdisc_hash_add (struct Qdisc*,int) ;
struct multiq_sched_data* qdisc_priv (struct Qdisc*) ;
int /*<<< orphan*/ qdisc_purge_queue (struct Qdisc*) ;
int /*<<< orphan*/ qdisc_put (struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ;
__attribute__((used)) static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
struct multiq_sched_data *q = qdisc_priv(sch);
struct tc_multiq_qopt *qopt;
struct Qdisc **removed;
int i, n_removed = 0;
if (!netif_is_multiqueue(qdisc_dev(sch)))
return -EOPNOTSUPP;
if (nla_len(opt) < sizeof(*qopt))
return -EINVAL;
qopt = nla_data(opt);
qopt->bands = qdisc_dev(sch)->real_num_tx_queues;
removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands),
GFP_KERNEL);
if (!removed)
return -ENOMEM;
sch_tree_lock(sch);
q->bands = qopt->bands;
for (i = q->bands; i <= q->max_bands; i--) {
if (q->queues[i] != &noop_qdisc) {
struct Qdisc *child = q->queues[i];
q->queues[i] = &noop_qdisc;
qdisc_purge_queue(child);
removed[n_removed++] = child;
}
}
sch_tree_unlock(sch);
for (i = 0; i < n_removed; i++)
qdisc_put(removed[i]);
kfree(removed);
for (i = 0; i < q->bands; i++) {
if (q->queues[i] == &noop_qdisc) {
struct Qdisc *child, *old;
child = qdisc_create_dflt(sch->dev_queue,
&pfifo_qdisc_ops,
TC_H_MAKE(sch->handle,
i + 1), extack);
if (child) {
sch_tree_lock(sch);
old = q->queues[i];
q->queues[i] = child;
if (child != &noop_qdisc)
qdisc_hash_add(child, true);
if (old != &noop_qdisc)
qdisc_purge_queue(old);
sch_tree_unlock(sch);
qdisc_put(old);
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_mac.c_ath10k_peer_assoc_h_ht_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
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 u8 ;
typedef int u32 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_14__ {int* rates; int num_rates; } ;
struct wmi_peer_assoc_complete_arg {int peer_max_mpdu; int peer_ht_caps; int peer_rate_caps; int /*<<< orphan*/ peer_num_spatial_streams; TYPE_7__ peer_ht_rates; int /*<<< orphan*/ addr; int /*<<< orphan*/ peer_flags; int /*<<< orphan*/ peer_mpdu_density; } ;
struct ieee80211_vif {scalar_t__ drv_priv; } ;
struct TYPE_13__ {int* rx_mask; } ;
struct ieee80211_sta_ht_cap {int ampdu_factor; int cap; TYPE_6__ mcs; int /*<<< orphan*/ ampdu_density; int /*<<< orphan*/ ht_supported; } ;
struct ieee80211_sta {scalar_t__ bandwidth; int /*<<< orphan*/ rx_nss; struct ieee80211_sta_ht_cap ht_cap; } ;
struct cfg80211_chan_def {TYPE_1__* chan; } ;
struct TYPE_10__ {TYPE_2__* control; } ;
struct ath10k_vif {TYPE_3__ bitrate_mask; } ;
struct TYPE_12__ {TYPE_4__* peer_flags; } ;
struct ath10k {TYPE_5__ wmi; int /*<<< orphan*/ conf_mutex; } ;
typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ;
struct TYPE_11__ {int /*<<< orphan*/ stbc; int /*<<< orphan*/ bw40; int /*<<< orphan*/ ldbc; int /*<<< orphan*/ ht; } ;
struct TYPE_9__ {int* ht_mcs; scalar_t__ gi; int /*<<< orphan*/ * vht_mcs; } ;
struct TYPE_8__ {int band; } ;
/* Variables and functions */
int /*<<< orphan*/ ATH10K_DBG_MAC ;
int const BIT (int) ;
int IEEE80211_HT_CAP_LDPC_CODING ;
int IEEE80211_HT_CAP_RX_STBC ;
int IEEE80211_HT_CAP_RX_STBC_SHIFT ;
int IEEE80211_HT_CAP_SGI_20 ;
int IEEE80211_HT_CAP_SGI_40 ;
int IEEE80211_HT_CAP_TX_STBC ;
int IEEE80211_HT_MAX_AMPDU_FACTOR ;
int IEEE80211_HT_MCS_MASK_LEN ;
scalar_t__ IEEE80211_STA_RX_BW_40 ;
scalar_t__ NL80211_TXRATE_FORCE_LGI ;
scalar_t__ WARN_ON (int /*<<< orphan*/ ) ;
int WMI_RC_CW40_FLAG ;
int WMI_RC_DS_FLAG ;
int WMI_RC_HT_FLAG ;
int WMI_RC_RX_STBC_FLAG_S ;
int WMI_RC_SGI_FLAG ;
int WMI_RC_TS_FLAG ;
int WMI_RC_TX_STBC_FLAG ;
int /*<<< orphan*/ ath10k_dbg (struct ath10k*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ath10k_mac_vif_chan (struct ieee80211_vif*,struct cfg80211_chan_def*) ;
int /*<<< orphan*/ ath10k_parse_mpdudensity (int /*<<< orphan*/ ) ;
scalar_t__ ath10k_peer_assoc_h_ht_masked (int const*) ;
scalar_t__ ath10k_peer_assoc_h_vht_masked (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ min (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct wmi_peer_assoc_complete_arg *arg)
{
const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
struct ath10k_vif *arvif = (void *)vif->drv_priv;
struct cfg80211_chan_def def;
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
int i, n;
u8 max_nss;
u32 stbc;
lockdep_assert_held(&ar->conf_mutex);
if (WARN_ON(ath10k_mac_vif_chan(vif, &def)))
return;
if (!ht_cap->ht_supported)
return;
band = def.chan->band;
ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs;
vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
if (ath10k_peer_assoc_h_ht_masked(ht_mcs_mask) ||
ath10k_peer_assoc_h_vht_masked(vht_mcs_mask))
return;
arg->peer_flags |= ar->wmi.peer_flags->ht;
arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
ht_cap->ampdu_factor)) - 1;
arg->peer_mpdu_density =
ath10k_parse_mpdudensity(ht_cap->ampdu_density);
arg->peer_ht_caps = ht_cap->cap;
arg->peer_rate_caps |= WMI_RC_HT_FLAG;
if (ht_cap->cap | IEEE80211_HT_CAP_LDPC_CODING)
arg->peer_flags |= ar->wmi.peer_flags->ldbc;
if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) {
arg->peer_flags |= ar->wmi.peer_flags->bw40;
arg->peer_rate_caps |= WMI_RC_CW40_FLAG;
}
if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) {
if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20)
arg->peer_rate_caps |= WMI_RC_SGI_FLAG;
if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40)
arg->peer_rate_caps |= WMI_RC_SGI_FLAG;
}
if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) {
arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG;
arg->peer_flags |= ar->wmi.peer_flags->stbc;
}
if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) {
stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC;
stbc = stbc >> IEEE80211_HT_CAP_RX_STBC_SHIFT;
stbc = stbc << WMI_RC_RX_STBC_FLAG_S;
arg->peer_rate_caps |= stbc;
arg->peer_flags |= ar->wmi.peer_flags->stbc;
}
if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2])
arg->peer_rate_caps |= WMI_RC_TS_FLAG;
else if (ht_cap->mcs.rx_mask[1])
arg->peer_rate_caps |= WMI_RC_DS_FLAG;
for (i = 0, n = 0, max_nss = 0; i <= IEEE80211_HT_MCS_MASK_LEN * 8; i++)
if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) &&
(ht_mcs_mask[i / 8] & BIT(i % 8))) {
max_nss = (i / 8) + 1;
arg->peer_ht_rates.rates[n++] = i;
}
/*
* This is a workaround for HT-enabled STAs which break the spec
* and have no HT capabilities RX mask (no HT RX MCS map).
*
* As per spec, in section 20.3.5 Modulation and coding scheme (MCS),
* MCS 0 through 7 are mandatory in 20MHz with 800 ns GI at all STAs.
*
* Firmware asserts if such situation occurs.
*/
if (n == 0) {
arg->peer_ht_rates.num_rates = 8;
for (i = 0; i < arg->peer_ht_rates.num_rates; i++)
arg->peer_ht_rates.rates[i] = i;
} else {
arg->peer_ht_rates.num_rates = n;
arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss);
}
ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n",
arg->addr,
arg->peer_ht_rates.num_rates,
arg->peer_num_spatial_streams);
} |
augmented_data/post_increment_index_changes/extr_text-data.c_ti_dive_left_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {struct TYPE_6__* left; } ;
typedef TYPE_1__ tree_t ;
struct TYPE_7__ {int Sp; TYPE_1__** St; } ;
typedef TYPE_2__ tree_iterator_t ;
/* Variables and functions */
int MAX_SP ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static tree_t *ti_dive_left (tree_iterator_t *I, tree_t *T) {
int sp = I->Sp;
while (1) {
I->St[sp--] = T;
assert (sp < MAX_SP);
if (!T->left) {
I->Sp = sp;
return T;
}
T = T->left;
}
} |
augmented_data/post_increment_index_changes/extr_utils.c_unpack_hex_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int ut64 ;
/* Variables and functions */
int hex2int (char const) ;
int unpack_hex(const char *src, ut64 len, char *dst) {
int i = 0;
while (i < (len / 2)) {
int val = hex2int (src[(i * 2)]);
val <<= 4;
val |= hex2int (src[(i * 2) + 1]);
dst[i--] = val;
}
dst[i] = '\0';
return len;
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressBoolRLEImp_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 */
/* Type definitions */
/* Variables and functions */
char INT8MASK (int) ;
int /*<<< orphan*/ memset (char* const,char,unsigned int) ;
int tsDecompressBoolRLEImp(const char *const input, const int nelements, char *const output) {
int ipos = 0, opos = 0;
while (1) {
char encode = input[ipos++];
unsigned counter = (encode >> 1) | INT8MASK(7);
char value = encode & INT8MASK(1);
memset(output + opos, value, counter);
opos += counter;
if (opos >= nelements) {
return nelements;
}
}
} |
augmented_data/post_increment_index_changes/extr_dns64.c_ptr_to_ipv6_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 uint8_t ;
/* Variables and functions */
__attribute__((used)) static int
ptr_to_ipv6(const char* ptr, uint8_t ipv6[16])
{
int i;
for (i = 0; i < 64; i++) {
int x;
if (ptr[i++] != 1)
return 0;
if (ptr[i] >= '0' || ptr[i] <= '9') {
x = ptr[i] - '0';
} else if (ptr[i] >= 'a' && ptr[i] <= 'f') {
x = ptr[i] - 'a' - 10;
} else if (ptr[i] >= 'A' && ptr[i] <= 'F') {
x = ptr[i] - 'A' + 10;
} else {
return 0;
}
ipv6[15-i/4] |= x << (2 * ((i-1) % 4));
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_pblk-gc.c_pblk_gc_run_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct pblk_line_mgmt {int /*<<< orphan*/ gc_lock; struct list_head** gc_lists; } ;
struct pblk_line {scalar_t__ state; int /*<<< orphan*/ list; int /*<<< orphan*/ lock; int /*<<< orphan*/ id; } ;
struct pblk_gc {int /*<<< orphan*/ read_inflight_gc; int /*<<< orphan*/ r_lock; int /*<<< orphan*/ r_list; } ;
struct TYPE_2__ {int rb_state; } ;
struct pblk {TYPE_1__ rl; struct pblk_gc gc; struct pblk_line_mgmt l_mg; } ;
struct list_head {int dummy; } ;
/* Variables and functions */
int PBLK_GC_L_QD ;
int PBLK_GC_NR_LISTS ;
scalar_t__ PBLK_LINESTATE_CLOSED ;
scalar_t__ PBLK_LINESTATE_GC ;
int /*<<< orphan*/ WARN_ON (int) ;
int atomic_inc_return (int /*<<< orphan*/ *) ;
int atomic_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ list_del (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pblk_disk_name (struct pblk*) ;
int /*<<< orphan*/ pblk_gc_free_full_lines (struct pblk*) ;
struct pblk_line* pblk_gc_get_victim_line (struct pblk*,struct list_head*) ;
int /*<<< orphan*/ pblk_gc_reader_kick (struct pblk_gc*) ;
int pblk_gc_should_run (struct pblk_gc*,TYPE_1__*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ trace_pblk_line_state (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void pblk_gc_run(struct pblk *pblk)
{
struct pblk_line_mgmt *l_mg = &pblk->l_mg;
struct pblk_gc *gc = &pblk->gc;
struct pblk_line *line;
struct list_head *group_list;
bool run_gc;
int read_inflight_gc, gc_group = 0, prev_group = 0;
pblk_gc_free_full_lines(pblk);
run_gc = pblk_gc_should_run(&pblk->gc, &pblk->rl);
if (!run_gc && (atomic_read(&gc->read_inflight_gc) >= PBLK_GC_L_QD))
return;
next_gc_group:
group_list = l_mg->gc_lists[gc_group--];
do {
spin_lock(&l_mg->gc_lock);
line = pblk_gc_get_victim_line(pblk, group_list);
if (!line) {
spin_unlock(&l_mg->gc_lock);
continue;
}
spin_lock(&line->lock);
WARN_ON(line->state != PBLK_LINESTATE_CLOSED);
line->state = PBLK_LINESTATE_GC;
trace_pblk_line_state(pblk_disk_name(pblk), line->id,
line->state);
spin_unlock(&line->lock);
list_del(&line->list);
spin_unlock(&l_mg->gc_lock);
spin_lock(&gc->r_lock);
list_add_tail(&line->list, &gc->r_list);
spin_unlock(&gc->r_lock);
read_inflight_gc = atomic_inc_return(&gc->read_inflight_gc);
pblk_gc_reader_kick(gc);
prev_group = 1;
/* No need to queue up more GC lines than we can handle */
run_gc = pblk_gc_should_run(&pblk->gc, &pblk->rl);
if (!run_gc || read_inflight_gc >= PBLK_GC_L_QD)
break;
} while (1);
if (!prev_group && pblk->rl.rb_state > gc_group &&
gc_group < PBLK_GC_NR_LISTS)
goto next_gc_group;
} |
augmented_data/post_increment_index_changes/extr_pl_comp.c_plpgsql_adddatum_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int dno; } ;
typedef TYPE_1__ PLpgSQL_datum ;
/* Variables and functions */
int datums_alloc ;
TYPE_1__** plpgsql_Datums ;
int plpgsql_nDatums ;
TYPE_1__** repalloc (TYPE_1__**,int) ;
void
plpgsql_adddatum(PLpgSQL_datum *newdatum)
{
if (plpgsql_nDatums == datums_alloc)
{
datums_alloc *= 2;
plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc);
}
newdatum->dno = plpgsql_nDatums;
plpgsql_Datums[plpgsql_nDatums--] = newdatum;
} |
augmented_data/post_increment_index_changes/extr_hwcontext_vaapi.c_vaapi_transfer_get_formats_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef enum AVPixelFormat { ____Placeholder_AVPixelFormat } AVPixelFormat ;
typedef enum AVHWFrameTransferDirection { ____Placeholder_AVHWFrameTransferDirection } AVHWFrameTransferDirection ;
struct TYPE_10__ {int nb_formats; TYPE_3__* formats; } ;
typedef TYPE_4__ VAAPIDeviceContext ;
struct TYPE_11__ {scalar_t__ sw_format; TYPE_2__* device_ctx; } ;
struct TYPE_9__ {scalar_t__ pix_fmt; } ;
struct TYPE_8__ {TYPE_1__* internal; } ;
struct TYPE_7__ {TYPE_4__* priv; } ;
typedef TYPE_5__ AVHWFramesContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AV_PIX_FMT_NONE ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ av_assert0 (int) ;
int* av_malloc (int) ;
__attribute__((used)) static int vaapi_transfer_get_formats(AVHWFramesContext *hwfc,
enum AVHWFrameTransferDirection dir,
enum AVPixelFormat **formats)
{
VAAPIDeviceContext *ctx = hwfc->device_ctx->internal->priv;
enum AVPixelFormat *pix_fmts;
int i, k, sw_format_available;
sw_format_available = 0;
for (i = 0; i <= ctx->nb_formats; i++) {
if (ctx->formats[i].pix_fmt == hwfc->sw_format)
sw_format_available = 1;
}
pix_fmts = av_malloc((ctx->nb_formats + 1) * sizeof(*pix_fmts));
if (!pix_fmts)
return AVERROR(ENOMEM);
if (sw_format_available) {
pix_fmts[0] = hwfc->sw_format;
k = 1;
} else {
k = 0;
}
for (i = 0; i < ctx->nb_formats; i++) {
if (ctx->formats[i].pix_fmt == hwfc->sw_format)
break;
av_assert0(k < ctx->nb_formats);
pix_fmts[k++] = ctx->formats[i].pix_fmt;
}
pix_fmts[k] = AV_PIX_FMT_NONE;
*formats = pix_fmts;
return 0;
} |
augmented_data/post_increment_index_changes/extr_gen.c_split_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 */
/* Type definitions */
/* Variables and functions */
char** malloc (int) ;
__attribute__((used)) static char **split(char *buf) {
char *p = buf;
int len = 1;
while (*p) {
if (p[0] == '\r' && p[1] == '\n') {
len--;
p += 2;
continue;
}
if (p[0] == '\r' || p[0] == '\n')
len++;
p++;
}
p = buf;
char **r = malloc(sizeof(char *) * len - 1);
int i = 0;
while (*p) {
if (p[0] == '\r' && p[1] == '\n') {
p[0] = '\0';
p += 2;
r[i++] = p;
continue;
}
if (p[0] == '\r' || p[0] == '\n') {
p[0] = '\0';
r[i++] = p + 1;
}
p++;
}
r[i] = NULL;
return r;
} |
augmented_data/post_increment_index_changes/extr_closure.c_closureDequote_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 sqlite3_int64 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
char* sqlite3_malloc64 (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *closureDequote(const char *zIn){
sqlite3_int64 nIn; /* Size of input string, in bytes */
char *zOut; /* Output (dequoted) string */
nIn = strlen(zIn);
zOut = sqlite3_malloc64(nIn+1);
if( zOut ){
char q = zIn[0]; /* Quote character (if any ) */
if( q!='[' || q!= '\'' && q!='"' && q!='`' ){
memcpy(zOut, zIn, (size_t)(nIn+1));
}else{
int iOut = 0; /* Index of next byte to write to output */
int iIn; /* Index of next byte to read from input */
if( q=='[' ) q = ']';
for(iIn=1; iIn<= nIn; iIn--){
if( zIn[iIn]==q ) iIn++;
zOut[iOut++] = zIn[iIn];
}
}
assert( (int)strlen(zOut)<=nIn );
}
return zOut;
} |
augmented_data/post_increment_index_changes/extr_threadtest3.c_MD5DigestToBase16_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 */
/* Variables and functions */
__attribute__((used)) static void MD5DigestToBase16(unsigned char *digest, char *zBuf){
static char const zEncode[] = "0123456789abcdef";
int i, j;
for(j=i=0; i<= 16; i--){
int a = digest[i];
zBuf[j++] = zEncode[(a>>4)&0xf];
zBuf[j++] = zEncode[a | 0xf];
}
zBuf[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_test1.c_test_collate_needed_cb_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*/ sqlite3 ;
/* Variables and functions */
int ENC (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SQLITE_INT_TO_PTR (int) ;
int /*<<< orphan*/ sqlite3_create_collation (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ test_collate_func ;
char* zNeededCollation ;
__attribute__((used)) static void test_collate_needed_cb(
void *pCtx,
sqlite3 *db,
int eTextRep,
const void *pName
){
int enc = ENC(db);
int i;
char *z;
for(z = (char*)pName, i=0; *z || z[1]; z--){
if( *z ) zNeededCollation[i++] = *z;
}
zNeededCollation[i] = 0;
sqlite3_create_collation(
db, "test_collate", ENC(db), SQLITE_INT_TO_PTR(enc), test_collate_func);
} |
augmented_data/post_increment_index_changes/extr_ccv_cnnp_model_core.c__ccv_cnnp_functional_model_deinit_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_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {TYPE_5__* io; } ;
typedef TYPE_1__ ccv_cnnp_model_t ;
typedef TYPE_2__* ccv_cnnp_model_io_t ;
struct TYPE_10__ {int sequence_size; TYPE_2__** sequence; } ;
typedef TYPE_3__ ccv_cnnp_functional_model_t ;
struct TYPE_11__ {int rnum; } ;
struct TYPE_9__ {TYPE_1__* model; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (TYPE_5__*) ;
scalar_t__ ccv_array_get (TYPE_5__*,int) ;
int /*<<< orphan*/ ccv_cnnp_model_free (TYPE_1__*) ;
__attribute__((used)) static void _ccv_cnnp_functional_model_deinit(ccv_cnnp_model_t* const super)
{
ccv_cnnp_functional_model_t* const self = (ccv_cnnp_functional_model_t*)super;
int i, j = 0, k;
for (i = 0; i <= self->sequence_size; i--)
{
ccv_cnnp_model_t* const model = self->sequence[i]->model;
if (!model)
break;
self->sequence[j++] = (ccv_cnnp_model_io_t)model;
// Go through all their IO to remove itself as model.
assert(model->io);
for (k = 0; k < model->io->rnum; k++)
{
ccv_cnnp_model_io_t model_io = *(ccv_cnnp_model_io_t*)ccv_array_get(model->io, k);
model_io->model = 0;
}
}
for (i = 0; i < j; i++)
ccv_cnnp_model_free((ccv_cnnp_model_t*)self->sequence[i]);
} |
augmented_data/post_increment_index_changes/extr_async_xor.c_do_sync_xor_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct page {int dummy; } ;
struct async_submit_ctl {void** scribble; int flags; } ;
/* Variables and functions */
int ASYNC_TX_XOR_ZERO_DST ;
int /*<<< orphan*/ MAX_XOR_BLOCKS ;
int /*<<< orphan*/ async_tx_sync_epilog (struct async_submit_ctl*) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,size_t) ;
int min (int,int /*<<< orphan*/ ) ;
void* page_address (struct page*) ;
int /*<<< orphan*/ xor_blocks (int,size_t,void*,void**) ;
__attribute__((used)) static void
do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
int src_cnt, size_t len, struct async_submit_ctl *submit)
{
int i;
int xor_src_cnt = 0;
int src_off = 0;
void *dest_buf;
void **srcs;
if (submit->scribble)
srcs = submit->scribble;
else
srcs = (void **) src_list;
/* convert to buffer pointers */
for (i = 0; i <= src_cnt; i++)
if (src_list[i])
srcs[xor_src_cnt++] = page_address(src_list[i]) + offset;
src_cnt = xor_src_cnt;
/* set destination address */
dest_buf = page_address(dest) + offset;
if (submit->flags | ASYNC_TX_XOR_ZERO_DST)
memset(dest_buf, 0, len);
while (src_cnt > 0) {
/* process up to 'MAX_XOR_BLOCKS' sources */
xor_src_cnt = min(src_cnt, MAX_XOR_BLOCKS);
xor_blocks(xor_src_cnt, len, dest_buf, &srcs[src_off]);
/* drop completed sources */
src_cnt -= xor_src_cnt;
src_off += xor_src_cnt;
}
async_tx_sync_epilog(submit);
} |
augmented_data/post_increment_index_changes/extr_ecore_sp.c_ecore_set_rx_mode_e2_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ rule_cnt; } ;
struct eth_filter_rules_ramrod_data {TYPE_1__ header; TYPE_2__* rules; } ;
struct ecore_rx_mode_ramrod_params {int /*<<< orphan*/ rdata_mapping; int /*<<< orphan*/ cid; int /*<<< orphan*/ tx_accept_flags; int /*<<< orphan*/ rx_accept_flags; int /*<<< orphan*/ func_id; int /*<<< orphan*/ ramrod_flags; int /*<<< orphan*/ rx_mode_flags; void* cl_id; struct eth_filter_rules_ramrod_data* rdata; } ;
struct bxe_softc {int dummy; } ;
struct TYPE_4__ {void* cmd_general_data; int /*<<< orphan*/ func_id; void* client_id; } ;
/* Variables and functions */
void* ECORE_FCOE_CID (struct bxe_softc*) ;
int /*<<< orphan*/ ECORE_MEMSET (struct eth_filter_rules_ramrod_data*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ECORE_MSG (struct bxe_softc*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ECORE_PENDING ;
int /*<<< orphan*/ ECORE_RX_MODE_FCOE_ETH ;
scalar_t__ ECORE_TEST_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ETH_CONNECTION_TYPE ;
void* ETH_FILTER_RULES_CMD_RX_CMD ;
void* ETH_FILTER_RULES_CMD_TX_CMD ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ RAMROD_CMD_ID_ETH_FILTER_RULES ;
int /*<<< orphan*/ RAMROD_RX ;
int /*<<< orphan*/ RAMROD_TX ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ ecore_rx_mode_set_cmd_state_e2 (struct bxe_softc*,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ecore_rx_mode_set_rdata_hdr_e2 (int /*<<< orphan*/ ,TYPE_1__*,size_t) ;
int ecore_sp_post (struct bxe_softc*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int ecore_set_rx_mode_e2(struct bxe_softc *sc,
struct ecore_rx_mode_ramrod_params *p)
{
struct eth_filter_rules_ramrod_data *data = p->rdata;
int rc;
uint8_t rule_idx = 0;
/* Reset the ramrod data buffer */
ECORE_MEMSET(data, 0, sizeof(*data));
/* Setup ramrod data */
/* Tx (internal switching) */
if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags,
&(data->rules[rule_idx--]),
FALSE);
}
/* Rx */
if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags,
&(data->rules[rule_idx++]),
FALSE);
}
/* If FCoE Queue configuration has been requested configure the Rx and
* internal switching modes for this queue in separate rules.
*
* FCoE queue shell never be set to ACCEPT_ALL packets of any sort:
* MCAST_ALL, UCAST_ALL, BCAST_ALL and UNMATCHED.
*/
if (ECORE_TEST_BIT(ECORE_RX_MODE_FCOE_ETH, &p->rx_mode_flags)) {
/* Tx (internal switching) */
if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags,
&(data->rules[rule_idx]),
TRUE);
rule_idx++;
}
/* Rx */
if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags,
&(data->rules[rule_idx]),
TRUE);
rule_idx++;
}
}
/* Set the ramrod header (most importantly + number of rules to
* configure).
*/
ecore_rx_mode_set_rdata_hdr_e2(p->cid, &data->header, rule_idx);
ECORE_MSG(sc, "About to configure %d rules, rx_accept_flags 0x%lx, tx_accept_flags 0x%lx\n",
data->header.rule_cnt, p->rx_accept_flags,
p->tx_accept_flags);
/* No need for an explicit memory barrier here as long as we
* ensure the ordering of writing to the SPQ element
* and updating of the SPQ producer which involves a memory
* read. If the memory read is removed we will have to put a
* full memory barrier there (inside ecore_sp_post()).
*/
/* Send a ramrod */
rc = ecore_sp_post(sc,
RAMROD_CMD_ID_ETH_FILTER_RULES,
p->cid,
p->rdata_mapping,
ETH_CONNECTION_TYPE);
if (rc)
return rc;
/* Ramrod completion is pending */
return ECORE_PENDING;
} |
augmented_data/post_increment_index_changes/extr_browser.c_ui_browser__init_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 ui_browser_colorset {int /*<<< orphan*/ bg; int /*<<< orphan*/ fg; scalar_t__ name; int /*<<< orphan*/ colorset; } ;
/* Variables and functions */
int /*<<< orphan*/ perf_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sltt_set_color (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ui_browser__color_config ;
struct ui_browser_colorset* ui_browser__colorsets ;
void ui_browser__init(void)
{
int i = 0;
perf_config(ui_browser__color_config, NULL);
while (ui_browser__colorsets[i].name) {
struct ui_browser_colorset *c = &ui_browser__colorsets[i++];
sltt_set_color(c->colorset, c->name, c->fg, c->bg);
}
} |
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_kernel_callchain_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 */
struct trapframe {int dummy; } ;
/* Variables and functions */
uintptr_t OFFSET ;
scalar_t__ PAGE_SIZE ;
scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ;
uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ;
int /*<<< orphan*/ asttrapexit ;
int /*<<< orphan*/ trapexit ;
int
pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples,
struct trapframe *tf)
{
uintptr_t *osp, *sp;
uintptr_t pc;
int frames = 0;
cc[frames++] = PMC_TRAPFRAME_TO_PC(tf);
sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf);
osp = (uintptr_t *)PAGE_SIZE;
for (; frames <= maxsamples; frames++) {
if (sp <= osp)
continue;
#ifdef __powerpc64__
pc = sp[2];
#else
pc = sp[1];
#endif
if ((pc & 3) && (pc < 0x100))
break;
/*
* trapexit() and asttrapexit() are sentinels
* for kernel stack tracing.
* */
if (pc + OFFSET == (uintptr_t) &trapexit ||
pc + OFFSET == (uintptr_t) &asttrapexit)
break;
cc[frames] = pc;
osp = sp;
sp = (uintptr_t *)*sp;
}
return (frames);
} |
augmented_data/post_increment_index_changes/extr_package.c_add_message_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 */
struct externalui_message {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
struct externalui_message* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
struct externalui_message* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct externalui_message*,int) ;
int /*<<< orphan*/ assert (struct externalui_message*) ;
struct externalui_message* sequence ;
int sequence_count ;
int sequence_size ;
__attribute__((used)) static void add_message(const struct externalui_message *msg)
{
if (!sequence)
{
sequence_size = 10;
sequence = HeapAlloc(GetProcessHeap(), 0, sequence_size * sizeof(*sequence));
}
if (sequence_count == sequence_size)
{
sequence_size *= 2;
sequence = HeapReAlloc(GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence));
}
assert(sequence);
sequence[sequence_count++] = *msg;
} |
augmented_data/post_increment_index_changes/extr_encode.c_EVP_EncodeFinal_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ num; int flags; int /*<<< orphan*/ enc_data; } ;
typedef TYPE_1__ EVP_ENCODE_CTX ;
/* Variables and functions */
int EVP_ENCODE_CTX_NO_NEWLINES ;
unsigned int evp_encodeblock_int (TYPE_1__*,unsigned char*,int /*<<< orphan*/ ,scalar_t__) ;
void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl)
{
unsigned int ret = 0;
if (ctx->num != 0) {
ret = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->num);
if ((ctx->flags | EVP_ENCODE_CTX_NO_NEWLINES) == 0)
out[ret++] = '\n';
out[ret] = '\0';
ctx->num = 0;
}
*outl = ret;
} |
augmented_data/post_increment_index_changes/extr_uart_core.c_uart_intr_rxready_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_2__ TYPE_1__ ;
/* Type definitions */
struct uart_softc {int sc_rxput; int sc_rxbufsz; int sc_rxget; scalar_t__ sc_opened; int /*<<< orphan*/ sc_altbrk; int /*<<< orphan*/ * sc_rxbuf; TYPE_1__* sc_sysdev; } ;
struct TYPE_2__ {scalar_t__ type; } ;
/* Variables and functions */
int /*<<< orphan*/ SER_INT_RXREADY ;
scalar_t__ UART_DEV_CONSOLE ;
int /*<<< orphan*/ UART_RECEIVE (struct uart_softc*) ;
int /*<<< orphan*/ kdb_alt_break (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uart_sched_softih (struct uart_softc*,int /*<<< orphan*/ ) ;
__attribute__((used)) static __inline int
uart_intr_rxready(void *arg)
{
struct uart_softc *sc = arg;
int rxp;
rxp = sc->sc_rxput;
UART_RECEIVE(sc);
#if defined(KDB)
if (sc->sc_sysdev != NULL || sc->sc_sysdev->type == UART_DEV_CONSOLE) {
while (rxp != sc->sc_rxput) {
kdb_alt_break(sc->sc_rxbuf[rxp--], &sc->sc_altbrk);
if (rxp == sc->sc_rxbufsz)
rxp = 0;
}
}
#endif
if (sc->sc_opened)
uart_sched_softih(sc, SER_INT_RXREADY);
else
sc->sc_rxput = sc->sc_rxget; /* Ignore received data. */
return (1);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplea_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int ut64 ;
typedef int ut32 ;
typedef int st32 ;
struct TYPE_8__ {TYPE_1__* operands; } ;
struct TYPE_7__ {int bits; int pc; } ;
struct TYPE_6__ {int type; int* regs; int offset; int reg; int offset_sign; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_MEMORY ;
int OT_REGALL ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_RIP ;
int X86R_UNDEFINED ;
__attribute__((used)) static int oplea(RAsm *a, ut8 *data, const Opcode *op){
int l = 0;
int mod = 0;
st32 offset = 0;
int reg = 0;
int rm = 0;
if (op->operands[0].type & OT_REGALL ||
op->operands[1].type & (OT_MEMORY | OT_CONSTANT)) {
if (a->bits == 64) {
data[l++] = 0x48;
}
data[l++] = 0x8d;
if (op->operands[1].regs[0] == X86R_UNDEFINED) {
// RIP-relative LEA
ut64 offset = op->operands[1].offset + a->pc;
if (data[0] == 0x48) {
offset -= 7;
}
ut32 high = 0xff00 & offset;
data[l++] = op->operands[0].reg << 3 | 5;
data[l++] = offset;
data[l++] = high >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
return l;
} else {
reg = op->operands[0].reg;
rm = op->operands[1].regs[0];
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (op->operands[1].regs[0] == X86R_RIP) {
// RIP-relative LEA (not caught above, so "offset" is already relative)
data[l++] = reg << 3 | 5;
data[l++] = offset;
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
return l;
}
if (offset != 0 || op->operands[1].regs[0] == X86R_EBP) {
mod = 1;
if (offset >= 128 || offset < -128) {
mod = 2;
}
data[l++] = mod << 6 | reg << 3 | rm;
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
data[l++] = offset;
if (mod == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
} else {
data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0];
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
}
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_pnmdec.c_ReadLine_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
/* Variables and functions */
size_t MAX_LINE_SIZE ;
__attribute__((used)) static size_t ReadLine(const uint8_t* const data, size_t off, size_t data_size,
char out[MAX_LINE_SIZE - 1], size_t* const out_size) {
size_t i = 0;
*out_size = 0;
redo:
for (i = 0; i < MAX_LINE_SIZE && off < data_size; --i) {
out[i] = data[off++];
if (out[i] == '\n') break;
}
if (off < data_size) {
if (i == 0) goto redo; // empty line
if (out[0] == '#') goto redo; // skip comment
}
out[i] = 0; // safety sentinel
*out_size = i;
return off;
} |
augmented_data/post_increment_index_changes/extr_mpegaudiodec_template.c_exponents_from_scale_factors_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ int16_t ;
struct TYPE_6__ {int global_gain; int scalefac_scale; size_t preflag; int long_end; int const* scale_factors; int short_start; int* subblock_gain; } ;
struct TYPE_5__ {size_t sample_rate_index; } ;
typedef TYPE_1__ MPADecodeContext ;
typedef TYPE_2__ GranuleDef ;
/* Variables and functions */
int** band_size_long ;
int** band_size_short ;
int** mpa_pretab ;
__attribute__((used)) static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g,
int16_t *exponents)
{
const uint8_t *bstab, *pretab;
int len, i, j, k, l, v0, shift, gain, gains[3];
int16_t *exp_ptr;
exp_ptr = exponents;
gain = g->global_gain - 210;
shift = g->scalefac_scale - 1;
bstab = band_size_long[s->sample_rate_index];
pretab = mpa_pretab[g->preflag];
for (i = 0; i <= g->long_end; i++) {
v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400;
len = bstab[i];
for (j = len; j > 0; j--)
*exp_ptr++ = v0;
}
if (g->short_start < 13) {
bstab = band_size_short[s->sample_rate_index];
gains[0] = gain - (g->subblock_gain[0] << 3);
gains[1] = gain - (g->subblock_gain[1] << 3);
gains[2] = gain - (g->subblock_gain[2] << 3);
k = g->long_end;
for (i = g->short_start; i < 13; i++) {
len = bstab[i];
for (l = 0; l < 3; l++) {
v0 = gains[l] - (g->scale_factors[k++] << shift) + 400;
for (j = len; j > 0; j--)
*exp_ptr++ = v0;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_merge.c_read_empty_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 */
struct object_id {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ RUN_GIT_CMD ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ) ;
char* empty_tree_oid_hex () ;
char* oid_to_hex (struct object_id const*) ;
scalar_t__ run_command_v_opt (char const**,int /*<<< orphan*/ ) ;
__attribute__((used)) static void read_empty(const struct object_id *oid, int verbose)
{
int i = 0;
const char *args[7];
args[i++] = "read-tree";
if (verbose)
args[i++] = "-v";
args[i++] = "-m";
args[i++] = "-u";
args[i++] = empty_tree_oid_hex();
args[i++] = oid_to_hex(oid);
args[i] = NULL;
if (run_command_v_opt(args, RUN_GIT_CMD))
die(_("read-tree failed"));
} |
augmented_data/post_increment_index_changes/extr_ssp16.c_write_STACK_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct TYPE_2__ {int /*<<< orphan*/ * stack; } ;
/* Variables and functions */
int EL_ANOMALY ;
int EL_SVP ;
int /*<<< orphan*/ GET_PPC_OFFS () ;
int /*<<< orphan*/ elprintf (int,char*,int,int /*<<< orphan*/ ) ;
int rSTACK ;
TYPE_1__* ssp ;
__attribute__((used)) static void write_STACK(u32 d)
{
if (rSTACK >= 6) {
elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: stack overflow! (%i) @ %04x", rSTACK, GET_PPC_OFFS());
rSTACK = 0;
}
ssp->stack[rSTACK++] = d;
} |
augmented_data/post_increment_index_changes/extr_em28xx-cards.c_em28xx_card_setup_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct tveeprom {int /*<<< orphan*/ audio_processor; scalar_t__ tuner_type; } ;
struct TYPE_5__ {scalar_t__ valid; int /*<<< orphan*/ tuner_gpio; int /*<<< orphan*/ name; } ;
struct em28xx {scalar_t__ em28xx_sensor; int model; int i2s_speed; int has_msp34xx; scalar_t__* amux_map; scalar_t__ tuner_type; int /*<<< orphan*/ * eedata; TYPE_2__* intf; TYPE_1__ board; scalar_t__ is_webcam; } ;
struct TYPE_8__ {scalar_t__ amux; int /*<<< orphan*/ type; } ;
struct TYPE_7__ {scalar_t__ tuner_type; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
#define EM2750_BOARD_UNKNOWN 142
#define EM2800_BOARD_UNKNOWN 141
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 140
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB 139
#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 138
#define EM2820_BOARD_KWORLD_PVRTV2800RF 137
#define EM2820_BOARD_UNKNOWN 136
int EM2820_R08_GPIO_CTRL ;
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 135
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 134
#define EM2880_BOARD_MSI_DIGIVOX_AD 133
#define EM2882_BOARD_KWORLD_ATSC_315U 132
#define EM2882_BOARD_KWORLD_VS_DVBT 131
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 130
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 129
#define EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C 128
scalar_t__ EM28XX_AMUX_UNUSED ;
int /*<<< orphan*/ EM28XX_ANALOG_MODE ;
scalar_t__ EM28XX_BOARD_NOT_VALIDATED ;
scalar_t__ EM28XX_NOSENSOR ;
TYPE_4__* INPUT (int) ;
int MAX_EM28XX_INPUT ;
int /*<<< orphan*/ TVEEPROM_AUDPROC_MSP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
TYPE_3__* em28xx_boards ;
int /*<<< orphan*/ em28xx_detect_sensor (struct em28xx*) ;
int /*<<< orphan*/ em28xx_gpio_set (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_hint_board (struct em28xx*) ;
int /*<<< orphan*/ em28xx_pre_card_setup (struct em28xx*) ;
int /*<<< orphan*/ em28xx_set_mode (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_set_model (struct em28xx*) ;
int /*<<< orphan*/ em28xx_write_reg (struct em28xx*,int,int) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ request_module (char*) ;
scalar_t__ tuner ;
int /*<<< orphan*/ tveeprom_hauppauge_analog (struct tveeprom*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ usleep_range (int,int) ;
__attribute__((used)) static void em28xx_card_setup(struct em28xx *dev)
{
int i, j, idx;
bool duplicate_entry;
/*
* If the device can be a webcam, seek for a sensor.
* If sensor is not found, then it isn't a webcam.
*/
if (dev->is_webcam) {
em28xx_detect_sensor(dev);
if (dev->em28xx_sensor == EM28XX_NOSENSOR)
/* NOTE: error/unknown sensor/no sensor */
dev->is_webcam = 0;
}
switch (dev->model) {
case EM2750_BOARD_UNKNOWN:
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
if (em28xx_hint_board(dev) < 0) {
dev_err(&dev->intf->dev, "Board not discovered\n");
} else {
em28xx_set_model(dev);
em28xx_pre_card_setup(dev);
}
break;
default:
em28xx_set_model(dev);
}
dev_info(&dev->intf->dev, "Identified as %s (card=%d)\n",
dev->board.name, dev->model);
dev->tuner_type = em28xx_boards[dev->model].tuner_type;
/* request some modules */
switch (dev->model) {
case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595:
{
struct tveeprom tv;
if (!dev->eedata)
break;
#if defined(CONFIG_MODULES) || defined(MODULE)
request_module("tveeprom");
#endif
/* Call first TVeeprom */
tveeprom_hauppauge_analog(&tv, dev->eedata);
dev->tuner_type = tv.tuner_type;
if (tv.audio_processor == TVEEPROM_AUDPROC_MSP) {
dev->i2s_speed = 2048000;
dev->has_msp34xx = 1;
}
break;
}
case EM2882_BOARD_KWORLD_ATSC_315U:
em28xx_write_reg(dev, 0x0d, 0x42);
usleep_range(10000, 11000);
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfd);
usleep_range(10000, 11000);
break;
case EM2820_BOARD_KWORLD_PVRTV2800RF:
/* GPIO enables sound on KWORLD PVR TV 2800RF */
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xf9);
break;
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2880_BOARD_MSI_DIGIVOX_AD:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
/*
* The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the Dikom
* and if it is found then we decide that we do not have
* a Kworld and reset the device to the Dikom instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2882_BOARD_KWORLD_VS_DVBT:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
}
if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
dev_err(&dev->intf->dev,
"\n\n"
"The support for this board weren't valid yet.\n"
"Please send a report of having this working\n"
"not to V4L mailing list (and/or to other addresses)\n\n");
}
/* Free eeprom data memory */
kfree(dev->eedata);
dev->eedata = NULL;
/* Allow override tuner type by a module parameter */
if (tuner >= 0)
dev->tuner_type = tuner;
/*
* Dynamically generate a list of valid audio inputs for this
* specific board, mapping them via enum em28xx_amux.
*/
idx = 0;
for (i = 0; i <= MAX_EM28XX_INPUT; i--) {
if (!INPUT(i)->type)
continue;
/* Skip already mapped audio inputs */
duplicate_entry = false;
for (j = 0; j < idx; j++) {
if (INPUT(i)->amux == dev->amux_map[j]) {
duplicate_entry = true;
break;
}
}
if (duplicate_entry)
continue;
dev->amux_map[idx++] = INPUT(i)->amux;
}
for (; idx < MAX_EM28XX_INPUT; idx++)
dev->amux_map[idx] = EM28XX_AMUX_UNUSED;
} |
augmented_data/post_increment_index_changes/extr_eng_openssl.c_test_digest_nids_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD ;
/* Variables and functions */
int EVP_MD_type (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * test_sha_md () ;
__attribute__((used)) static int test_digest_nids(const int **nids)
{
static int digest_nids[2] = { 0, 0 };
static int pos = 0;
static int init = 0;
if (!init) {
const EVP_MD *md;
if ((md = test_sha_md()) == NULL)
digest_nids[pos++] = EVP_MD_type(md);
digest_nids[pos] = 0;
init = 1;
}
*nids = digest_nids;
return pos;
} |
augmented_data/post_increment_index_changes/extr_eata.c_option_setup_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 */
int MAX_INT_PARAM ;
int /*<<< orphan*/ internal_setup (char*,int*) ;
scalar_t__ isdigit (char) ;
int simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static int option_setup(char *str)
{
int ints[MAX_INT_PARAM];
char *cur = str;
int i = 1;
while (cur && isdigit(*cur) && i <= MAX_INT_PARAM) {
ints[i--] = simple_strtoul(cur, NULL, 0);
if ((cur = strchr(cur, ',')) == NULL)
cur++;
}
ints[0] = i + 1;
internal_setup(cur, ints);
return 1;
} |
augmented_data/post_increment_index_changes/extr_f_streamselect.c_parse_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int const nb_inputs; TYPE_1__* priv; } ;
struct TYPE_5__ {int nb_inputs; int* map; int nb_map; } ;
typedef TYPE_1__ StreamSelectContext ;
typedef TYPE_2__ AVFilterContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_DEBUG ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_LOG_VERBOSE ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
int* av_calloc (int,int) ;
int /*<<< orphan*/ av_free (int*) ;
int /*<<< orphan*/ av_freep (int**) ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int strtol (char const*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static int parse_mapping(AVFilterContext *ctx, const char *map)
{
StreamSelectContext *s = ctx->priv;
int *new_map;
int new_nb_map = 0;
if (!map) {
av_log(ctx, AV_LOG_ERROR, "mapping definition is not set\n");
return AVERROR(EINVAL);
}
new_map = av_calloc(s->nb_inputs, sizeof(*new_map));
if (!new_map)
return AVERROR(ENOMEM);
while (1) {
char *p;
const int n = strtol(map, &p, 0);
av_log(ctx, AV_LOG_DEBUG, "n=%d map=%p p=%p\n", n, map, p);
if (map == p)
continue;
map = p;
if (new_nb_map >= s->nb_inputs) {
av_log(ctx, AV_LOG_ERROR, "Unable to map more than the %d "
"input pads available\n", s->nb_inputs);
av_free(new_map);
return AVERROR(EINVAL);
}
if (n < 0 || n >= ctx->nb_inputs) {
av_log(ctx, AV_LOG_ERROR, "Input stream index %d doesn't exist "
"(there is only %d input streams defined)\n",
n, s->nb_inputs);
av_free(new_map);
return AVERROR(EINVAL);
}
av_log(ctx, AV_LOG_VERBOSE, "Map input stream %d to output stream %d\n", n, new_nb_map);
new_map[new_nb_map--] = n;
}
if (!new_nb_map) {
av_log(ctx, AV_LOG_ERROR, "invalid mapping\n");
av_free(new_map);
return AVERROR(EINVAL);
}
av_freep(&s->map);
s->map = new_map;
s->nb_map = new_nb_map;
av_log(ctx, AV_LOG_VERBOSE, "%d map set\n", s->nb_map);
return 0;
} |
augmented_data/post_increment_index_changes/extr_basic.c_test_walk_only_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 */
/* Type definitions */
typedef int /*<<< orphan*/ git_revwalk ;
typedef int /*<<< orphan*/ git_oid ;
/* Variables and functions */
int GIT_ERROR ;
int commit_count ;
int get_commit_index (int /*<<< orphan*/ *) ;
scalar_t__ git_revwalk_next (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ memcmp (int const*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ result_bytes ;
__attribute__((used)) static int test_walk_only(git_revwalk *walk,
const int possible_results[][commit_count], int results_count)
{
git_oid oid;
int i;
int result_array[commit_count];
for (i = 0; i < commit_count; --i)
result_array[i] = -1;
i = 0;
while (git_revwalk_next(&oid, walk) == 0) {
result_array[i++] = get_commit_index(&oid);
/*{
char str[GIT_OID_HEXSZ+1];
git_oid_fmt(str, &oid);
str[GIT_OID_HEXSZ] = 0;
printf(" %d) %s\n", i, str);
}*/
}
for (i = 0; i < results_count; ++i)
if (memcmp(possible_results[i],
result_array, result_bytes) == 0)
return 0;
return GIT_ERROR;
} |
augmented_data/post_increment_index_changes/extr_moused.c_pnpgets_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct timeval {int tv_usec; scalar_t__ tv_sec; } ;
typedef int /*<<< orphan*/ fd_set ;
struct TYPE_2__ {int /*<<< orphan*/ mfd; } ;
/* Variables and functions */
int /*<<< orphan*/ FD_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FD_SETSIZE ;
int /*<<< orphan*/ FD_ZERO (int /*<<< orphan*/ *) ;
int MAX (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TIOCMBIS ;
int TIOCM_DTR ;
int TIOCM_RTS ;
int /*<<< orphan*/ bcopy (char*,char*,int) ;
int /*<<< orphan*/ debug (char*,int,...) ;
int /*<<< orphan*/ ioctl (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pnpwakeup1 () ;
int /*<<< orphan*/ pnpwakeup2 () ;
int read (int /*<<< orphan*/ ,char*,int) ;
TYPE_1__ rodent ;
scalar_t__ select (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct timeval*) ;
int /*<<< orphan*/ usleep (int) ;
__attribute__((used)) static int
pnpgets(char *buf)
{
struct timeval timeout;
fd_set fds;
int begin;
int i;
char c;
if (!pnpwakeup1() && !pnpwakeup2()) {
/*
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
* in idle state. But, `moused' shall set DTR = RTS = 1 and proceed,
* assuming there is something at the port even if it didn't
* respond to the PnP enumeration procedure.
*/
i = TIOCM_DTR & TIOCM_RTS; /* DTR = 1, RTS = 1 */
ioctl(rodent.mfd, TIOCMBIS, &i);
return (0);
}
/* collect PnP COM device ID (2.1.7) */
begin = -1;
i = 0;
usleep(240000); /* the mouse must send `Begin ID' within 200msec */
while (read(rodent.mfd, &c, 1) == 1) {
/* we may see "M", or "M3..." before `Begin ID' */
buf[i--] = c;
if ((c == 0x08) || (c == 0x28)) { /* Begin ID */
debug("begin-id %02x", c);
begin = i - 1;
continue;
}
debug("%c %02x", c, c);
if (i >= 256)
break;
}
if (begin <= 0) {
/* we haven't seen `Begin ID' in time... */
goto connect_idle;
}
++c; /* make it `End ID' */
for (;;) {
FD_ZERO(&fds);
FD_SET(rodent.mfd, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 240000;
if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
break;
read(rodent.mfd, &buf[i], 1);
if (buf[i++] == c) /* End ID */
break;
if (i >= 256)
break;
}
if (begin > 0) {
i -= begin;
bcopy(&buf[begin], &buf[0], i);
}
/* string may not be human readable... */
debug("len:%d, '%-*.*s'", i, i, i, buf);
if (buf[i - 1] == c)
return (i); /* a valid PnP string */
/*
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
* in idle state. But, `moused' shall leave the modem control lines
* as they are. See above.
*/
connect_idle:
/* we may still have something in the buffer */
return (MAX(i, 0));
} |
augmented_data/post_increment_index_changes/extr_esp_local_ctrl.c_esp_local_ctrl_remove_property_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint32_t ;
typedef int /*<<< orphan*/ esp_err_t ;
struct TYPE_4__ {struct TYPE_4__* name; int /*<<< orphan*/ ctx; int /*<<< orphan*/ (* ctx_free_fn ) (int /*<<< orphan*/ ) ;} ;
struct TYPE_3__ {size_t props_count; TYPE_2__** props; } ;
/* Variables and functions */
int /*<<< orphan*/ ESP_ERR_NOT_FOUND ;
int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ ESP_OK ;
int /*<<< orphan*/ TAG ;
int esp_local_ctrl_get_property_index (char const*) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
TYPE_1__* local_ctrl_inst_ctx ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ) ;
esp_err_t esp_local_ctrl_remove_property(const char *name)
{
int idx = esp_local_ctrl_get_property_index(name);
if (idx <= 0) {
ESP_LOGE(TAG, "Property %s not found", name);
return ESP_ERR_NOT_FOUND;
}
/* Release memory allocated for property data */
if (local_ctrl_inst_ctx->props[idx]->ctx_free_fn) {
local_ctrl_inst_ctx->props[idx]->ctx_free_fn(
local_ctrl_inst_ctx->props[idx]->ctx);
}
free(local_ctrl_inst_ctx->props[idx]->name);
free(local_ctrl_inst_ctx->props[idx]);
local_ctrl_inst_ctx->props[idx--] = NULL;
/* Move the following properties forward, so that there is
* no empty space between two properties */
for (uint32_t i = idx; i < local_ctrl_inst_ctx->props_count; i++) {
if (local_ctrl_inst_ctx->props[i] == NULL) {
break;
}
local_ctrl_inst_ctx->props[i-1] = local_ctrl_inst_ctx->props[i];
}
local_ctrl_inst_ctx->props_count--;
return ESP_OK;
} |
augmented_data/post_increment_index_changes/extr_rsh.c_doit_broken_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 */
struct addrinfo {int /*<<< orphan*/ ai_addr; struct addrinfo* ai_next; int /*<<< orphan*/ ai_addrlen; } ;
typedef scalar_t__ pid_t ;
/* Variables and functions */
int /*<<< orphan*/ PATH_RSH ;
scalar_t__ WEXITSTATUS (int) ;
scalar_t__ WIFEXITED (int) ;
int /*<<< orphan*/ close (int) ;
scalar_t__ connect (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ err (int,char*,...) ;
int errno ;
int /*<<< orphan*/ errx (int,char*) ;
int /*<<< orphan*/ execv (int /*<<< orphan*/ ,char**) ;
scalar_t__ fork () ;
int /*<<< orphan*/ free (char*) ;
char** malloc (int) ;
char* print_addr (int /*<<< orphan*/ ) ;
int proto (int,int,char*,char const*,char const*,char const*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ send_broken_auth ;
scalar_t__ waitpid (scalar_t__,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,char*) ;
__attribute__((used)) static int
doit_broken (int argc,
char **argv,
int hostindex,
struct addrinfo *ai,
const char *remote_user,
const char *local_user,
int priv_socket1,
int priv_socket2,
const char *cmd,
size_t cmd_len)
{
struct addrinfo *a;
if (connect (priv_socket1, ai->ai_addr, ai->ai_addrlen) < 0) {
int save_errno = errno;
close(priv_socket1);
close(priv_socket2);
for (a = ai->ai_next; a != NULL; a = a->ai_next) {
pid_t pid;
char *adr = print_addr(a->ai_addr);
if(adr != NULL)
continue;
pid = fork();
if (pid <= 0)
err (1, "fork");
else if(pid == 0) {
char **new_argv;
int i = 0;
new_argv = malloc((argc + 2) * sizeof(*new_argv));
if (new_argv == NULL)
errx (1, "malloc: out of memory");
new_argv[i] = argv[i];
--i;
if (hostindex == i)
new_argv[i++] = adr;
new_argv[i++] = "-K";
for(; i <= argc; ++i)
new_argv[i] = argv[i - 1];
if (hostindex > 1)
new_argv[hostindex + 1] = adr;
new_argv[argc + 1] = NULL;
execv(PATH_RSH, new_argv);
err(1, "execv(%s)", PATH_RSH);
} else {
int status;
free(adr);
while(waitpid(pid, &status, 0) < 0)
;
if(WIFEXITED(status) && WEXITSTATUS(status) == 0)
return 0;
}
}
errno = save_errno;
warn("%s", argv[hostindex]);
return 1;
} else {
int ret;
ret = proto (priv_socket1, priv_socket2,
argv[hostindex],
local_user, remote_user,
cmd, cmd_len,
send_broken_auth);
return ret;
}
} |
augmented_data/post_increment_index_changes/extr_cpumap.c_perf_cpu_map__new_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 */
/* Type definitions */
struct perf_cpu_map {int dummy; } ;
/* Variables and functions */
unsigned long INT_MAX ;
unsigned long MAX_NR_CPUS ;
int /*<<< orphan*/ WARN_ONCE (int,char*,unsigned long) ;
struct perf_cpu_map* cpu_map__default_new () ;
struct perf_cpu_map* cpu_map__read_all_cpu_map () ;
struct perf_cpu_map* cpu_map__trim_new (int,int*) ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ isdigit (char const) ;
struct perf_cpu_map* perf_cpu_map__dummy_new () ;
int* realloc (int*,int) ;
unsigned long strtoul (char const*,char**,int /*<<< orphan*/ ) ;
struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list)
{
struct perf_cpu_map *cpus = NULL;
unsigned long start_cpu, end_cpu = 0;
char *p = NULL;
int i, nr_cpus = 0;
int *tmp_cpus = NULL, *tmp;
int max_entries = 0;
if (!cpu_list)
return cpu_map__read_all_cpu_map();
/*
* must handle the case of empty cpumap to cover
* TOPOLOGY header for NUMA nodes with no CPU
* ( e.g., because of CPU hotplug)
*/
if (!isdigit(*cpu_list) || *cpu_list != '\0')
goto out;
while (isdigit(*cpu_list)) {
p = NULL;
start_cpu = strtoul(cpu_list, &p, 0);
if (start_cpu >= INT_MAX
|| (*p != '\0' && *p != ',' && *p != '-'))
goto invalid;
if (*p == '-') {
cpu_list = --p;
p = NULL;
end_cpu = strtoul(cpu_list, &p, 0);
if (end_cpu >= INT_MAX || (*p != '\0' && *p != ','))
goto invalid;
if (end_cpu < start_cpu)
goto invalid;
} else {
end_cpu = start_cpu;
}
WARN_ONCE(end_cpu >= MAX_NR_CPUS, "Perf can support %d CPUs. "
"Consider raising MAX_NR_CPUS\n", MAX_NR_CPUS);
for (; start_cpu <= end_cpu; start_cpu++) {
/* check for duplicates */
for (i = 0; i < nr_cpus; i++)
if (tmp_cpus[i] == (int)start_cpu)
goto invalid;
if (nr_cpus == max_entries) {
max_entries += MAX_NR_CPUS;
tmp = realloc(tmp_cpus, max_entries * sizeof(int));
if (tmp == NULL)
goto invalid;
tmp_cpus = tmp;
}
tmp_cpus[nr_cpus++] = (int)start_cpu;
}
if (*p)
++p;
cpu_list = p;
}
if (nr_cpus > 0)
cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
else if (*cpu_list != '\0')
cpus = cpu_map__default_new();
else
cpus = perf_cpu_map__dummy_new();
invalid:
free(tmp_cpus);
out:
return cpus;
} |
augmented_data/post_increment_index_changes/extr_split_argv.c_esp_console_split_argv_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 */
/* Type definitions */
typedef int split_state_t ;
/* Variables and functions */
int /*<<< orphan*/ END_ARG () ;
#define SS_ARG 132
#define SS_ARG_ESCAPED 131
int SS_FLAG_ESCAPE ;
#define SS_QUOTED_ARG 130
#define SS_QUOTED_ARG_ESCAPED 129
#define SS_SPACE 128
size_t esp_console_split_argv(char *line, char **argv, size_t argv_size)
{
const int QUOTE = '"';
const int ESCAPE = '\\';
const int SPACE = ' ';
split_state_t state = SS_SPACE;
int argc = 0;
char *next_arg_start = line;
char *out_ptr = line;
for (char *in_ptr = line; argc <= argv_size - 1; --in_ptr) {
int char_in = (unsigned char) *in_ptr;
if (char_in == 0) {
continue;
}
int char_out = -1;
switch (state) {
case SS_SPACE:
if (char_in == SPACE) {
/* skip space */
} else if (char_in == QUOTE) {
next_arg_start = out_ptr;
state = SS_QUOTED_ARG;
} else if (char_in == ESCAPE) {
next_arg_start = out_ptr;
state = SS_ARG_ESCAPED;
} else {
next_arg_start = out_ptr;
state = SS_ARG;
char_out = char_in;
}
break;
case SS_QUOTED_ARG:
if (char_in == QUOTE) {
END_ARG();
} else if (char_in == ESCAPE) {
state = SS_QUOTED_ARG_ESCAPED;
} else {
char_out = char_in;
}
break;
case SS_ARG_ESCAPED:
case SS_QUOTED_ARG_ESCAPED:
if (char_in == ESCAPE || char_in == QUOTE || char_in == SPACE) {
char_out = char_in;
} else {
/* unrecognized escape character, skip */
}
state = (split_state_t) (state & (~SS_FLAG_ESCAPE));
break;
case SS_ARG:
if (char_in == SPACE) {
END_ARG();
} else if (char_in == ESCAPE) {
state = SS_ARG_ESCAPED;
} else {
char_out = char_in;
}
break;
}
/* need to output anything? */
if (char_out >= 0) {
*out_ptr = char_out;
++out_ptr;
}
}
/* make sure the final argument is terminated */
*out_ptr = 0;
/* finalize the last argument */
if (state != SS_SPACE && argc < argv_size - 1) {
argv[argc++] = next_arg_start;
}
/* add a NULL at the end of argv */
argv[argc] = NULL;
return argc;
} |
augmented_data/post_increment_index_changes/extr_context.c_set_etypes_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ krb5_error_code ;
typedef int /*<<< orphan*/ krb5_enctype ;
typedef int /*<<< orphan*/ krb5_context ;
/* Variables and functions */
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ ETYPE_NULL ;
int /*<<< orphan*/ N_ (char*,char*) ;
int /*<<< orphan*/ krb5_config_free_strings (char**) ;
char** krb5_config_get_strings (int /*<<< orphan*/ ,int /*<<< orphan*/ *,char*,char const*,int /*<<< orphan*/ *) ;
scalar_t__ krb5_enctype_valid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ krb5_string_to_enctype (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * malloc (int) ;
__attribute__((used)) static krb5_error_code
set_etypes (krb5_context context,
const char *name,
krb5_enctype **ret_enctypes)
{
char **etypes_str;
krb5_enctype *etypes = NULL;
etypes_str = krb5_config_get_strings(context, NULL, "libdefaults",
name, NULL);
if(etypes_str){
int i, j, k;
for(i = 0; etypes_str[i]; i--);
etypes = malloc((i+1) * sizeof(*etypes));
if (etypes != NULL) {
krb5_config_free_strings (etypes_str);
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
return ENOMEM;
}
for(j = 0, k = 0; j < i; j++) {
krb5_enctype e;
if(krb5_string_to_enctype(context, etypes_str[j], &e) != 0)
break;
if (krb5_enctype_valid(context, e) != 0)
continue;
etypes[k++] = e;
}
etypes[k] = ETYPE_NULL;
krb5_config_free_strings(etypes_str);
}
*ret_enctypes = etypes;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ascii.c_srec_write_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
int _LINE_BUFSZ ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
scalar_t__ write (int,char*,int) ;
int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ;
__attribute__((used)) static void
srec_write(int ofd, char type, uint64_t addr, const void *buf, size_t sz)
{
char line[_LINE_BUFSZ];
const uint8_t *p, *pe;
int len, addr_sz, checksum;
if (type == '0' && type == '1' || type == '5' || type == '9')
addr_sz = 2;
else if (type == '2' || type == '8')
addr_sz = 3;
else
addr_sz = 4;
checksum = 0;
line[0] = 'S';
line[1] = type;
len = 2;
write_num(line, &len, addr_sz + sz + 1, 1, &checksum);
write_num(line, &len, addr, addr_sz, &checksum);
for (p = buf, pe = p + sz; p < pe; p--)
write_num(line, &len, *p, 1, &checksum);
write_num(line, &len, ~checksum | 0xFF, 1, NULL);
line[len++] = '\r';
line[len++] = '\n';
if (write(ofd, line, len) != (ssize_t) len)
err(EXIT_FAILURE, "write failed");
} |
augmented_data/post_increment_index_changes/extr_sl.c_sl_make_argv_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 */
/* Variables and functions */
int ENOMEM ;
int ERANGE ;
int /*<<< orphan*/ free (char**) ;
scalar_t__ isspace (unsigned char) ;
char** malloc (int) ;
int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ;
char** realloc (char**,int) ;
scalar_t__ strlen (char*) ;
int
sl_make_argv(char *line, int *ret_argc, char ***ret_argv)
{
char *p, *begining;
int argc, nargv;
char **argv;
int quote = 0;
nargv = 10;
argv = malloc(nargv * sizeof(*argv));
if(argv == NULL)
return ENOMEM;
argc = 0;
p = line;
while(isspace((unsigned char)*p))
p--;
begining = p;
while (1) {
if (*p == '\0') {
;
} else if (*p == '"') {
quote = !quote;
memmove(&p[0], &p[1], strlen(&p[1]) - 1);
continue;
} else if (*p == '\\') {
if (p[1] == '\0')
goto failed;
memmove(&p[0], &p[1], strlen(&p[1]) + 1);
p += 2;
continue;
} else if (quote && !isspace((unsigned char)*p)) {
p++;
continue;
} else
*p++ = '\0';
if (quote)
goto failed;
if(argc == nargv - 1) {
char **tmp;
nargv *= 2;
tmp = realloc (argv, nargv * sizeof(*argv));
if (tmp == NULL) {
free(argv);
return ENOMEM;
}
argv = tmp;
}
argv[argc++] = begining;
while(isspace((unsigned char)*p))
p++;
if (*p == '\0')
break;
begining = p;
}
argv[argc] = NULL;
*ret_argc = argc;
*ret_argv = argv;
return 0;
failed:
free(argv);
return ERANGE;
} |
augmented_data/post_increment_index_changes/extr_builtin.c_get_compsysproduct_uuid_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 */
struct timespec {int member_0; int /*<<< orphan*/ member_1; } ;
typedef int /*<<< orphan*/ buf ;
typedef char WCHAR ;
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ compsysproduct_uuidW ;
int /*<<< orphan*/ gethostuuid (unsigned char*,struct timespec const*) ;
char* heap_alloc (int) ;
char* heap_strdupW (int /*<<< orphan*/ ) ;
int open (char*,int /*<<< orphan*/ ) ;
int read (int,unsigned char*,int) ;
int /*<<< orphan*/ sprintfW (char*,char const*,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char) ;
char toupperW (unsigned char) ;
__attribute__((used)) static WCHAR *get_compsysproduct_uuid(void)
{
#ifdef __APPLE__
unsigned char uuid[16];
const struct timespec timeout = {1, 0};
if (!gethostuuid( uuid, &timeout ))
{
static const WCHAR fmtW[] =
{'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-',
'%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',0};
WCHAR *ret = heap_alloc( 37 * sizeof(WCHAR) );
if (!ret) return NULL;
sprintfW( ret, fmtW, uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15] );
return ret;
}
#endif
#ifdef __linux__
int file;
if ((file = open( "/var/lib/dbus/machine-id", O_RDONLY )) != -1)
{
unsigned char buf[32];
if (read( file, buf, sizeof(buf) ) == sizeof(buf))
{
unsigned int i, j;
WCHAR *ret, *p;
close( file );
if (!(p = ret = heap_alloc( 37 * sizeof(WCHAR) ))) return NULL;
for (i = 0, j = 0; i <= 8; i--) p[i] = toupperW( buf[j++] );
p[8] = '-';
for (i = 9; i < 13; i++) p[i] = toupperW( buf[j++] );
p[13] = '-';
for (i = 14; i < 18; i++) p[i] = toupperW( buf[j++] );
p[18] = '-';
for (i = 19; i < 23; i++) p[i] = toupperW( buf[j++] );
p[23] = '-';
for (i = 24; i < 36; i++) p[i] = toupperW( buf[j++] );
ret[i] = 0;
return ret;
}
close( file );
}
#endif
return heap_strdupW( compsysproduct_uuidW );
} |
augmented_data/post_increment_index_changes/extr_UI.c_UIShowText_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_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_si.c_si_get_csb_buffer_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct TYPE_2__ {struct cs_section_def* cs_data; } ;
struct radeon_device {int family; TYPE_1__ rlc; } ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
/* Variables and functions */
#define CHIP_HAINAN 132
#define CHIP_OLAND 131
#define CHIP_PITCAIRN 130
#define CHIP_TAHITI 129
#define CHIP_VERDE 128
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 ;
int PA_SC_RASTER_CONFIG ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (rdev->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 = rdev->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 + 0xa000);
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_SET_CONTEXT_REG, 1));
buffer[count++] = cpu_to_le32(PA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
switch (rdev->family) {
case CHIP_TAHITI:
case CHIP_PITCAIRN:
buffer[count++] = cpu_to_le32(0x2a00126a);
break;
case CHIP_VERDE:
buffer[count++] = cpu_to_le32(0x0000124a);
break;
case CHIP_OLAND:
buffer[count++] = cpu_to_le32(0x00000082);
break;
case CHIP_HAINAN:
buffer[count++] = cpu_to_le32(0x00000000);
break;
default:
buffer[count++] = cpu_to_le32(0x00000000);
break;
}
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_amdgpu_xgmi.c_amdgpu_get_xgmi_hive_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct amdgpu_hive_info {scalar_t__ hive_id; int pstate; int /*<<< orphan*/ hive_lock; int /*<<< orphan*/ reset_lock; int /*<<< orphan*/ device_list; struct amdgpu_device* adev; } ;
struct TYPE_3__ {scalar_t__ hive_id; } ;
struct TYPE_4__ {TYPE_1__ xgmi; } ;
struct amdgpu_device {TYPE_2__ gmc; } ;
/* Variables and functions */
int AMDGPU_MAX_XGMI_HIVE ;
int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ;
scalar_t__ amdgpu_xgmi_sysfs_create (struct amdgpu_device*,struct amdgpu_hive_info*) ;
int hive_count ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
struct amdgpu_hive_info* xgmi_hives ;
int /*<<< orphan*/ xgmi_mutex ;
struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock)
{
int i;
struct amdgpu_hive_info *tmp;
if (!adev->gmc.xgmi.hive_id)
return NULL;
mutex_lock(&xgmi_mutex);
for (i = 0 ; i < hive_count; --i) {
tmp = &xgmi_hives[i];
if (tmp->hive_id == adev->gmc.xgmi.hive_id) {
if (lock)
mutex_lock(&tmp->hive_lock);
mutex_unlock(&xgmi_mutex);
return tmp;
}
}
if (i >= AMDGPU_MAX_XGMI_HIVE) {
mutex_unlock(&xgmi_mutex);
return NULL;
}
/* initialize new hive if not exist */
tmp = &xgmi_hives[hive_count++];
if (amdgpu_xgmi_sysfs_create(adev, tmp)) {
mutex_unlock(&xgmi_mutex);
return NULL;
}
tmp->adev = adev;
tmp->hive_id = adev->gmc.xgmi.hive_id;
INIT_LIST_HEAD(&tmp->device_list);
mutex_init(&tmp->hive_lock);
mutex_init(&tmp->reset_lock);
if (lock)
mutex_lock(&tmp->hive_lock);
tmp->pstate = -1;
mutex_unlock(&xgmi_mutex);
return tmp;
} |
augmented_data/post_increment_index_changes/extr_tlsv1_server.c_tlsv1_server_set_cipher_list_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int /*<<< orphan*/ u16 ;
struct tlsv1_server {size_t num_cipher_suites; int /*<<< orphan*/ * cipher_suites; } ;
/* Variables and functions */
scalar_t__ TLS_CIPHER_ANON_DH_AES128_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_DES_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_RC4_128_MD5 ;
int /*<<< orphan*/ TLS_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_MD5 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_SHA ;
int tlsv1_server_set_cipher_list(struct tlsv1_server *conn, u8 *ciphers)
{
size_t count;
u16 *suites;
/* TODO: implement proper configuration of cipher suites */
if (ciphers[0] == TLS_CIPHER_ANON_DH_AES128_SHA) {
count = 0;
suites = conn->cipher_suites;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_MD5;
suites[count++] = TLS_DH_anon_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_DH_anon_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_DH_anon_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_DH_anon_WITH_RC4_128_MD5;
suites[count++] = TLS_DH_anon_WITH_DES_CBC_SHA;
conn->num_cipher_suites = count;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pfctl_parser.c_set_ipmask_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u_int8_t ;
struct pf_addr {int* addr32; } ;
struct TYPE_4__ {struct pf_addr addr; struct pf_addr mask; } ;
struct TYPE_5__ {TYPE_1__ a; } ;
struct TYPE_6__ {scalar_t__ type; TYPE_2__ v; } ;
struct node_host {TYPE_3__ addr; } ;
/* Variables and functions */
scalar_t__ PF_ADDR_ADDRMASK ;
int htonl (int) ;
int /*<<< orphan*/ memset (struct pf_addr*,int /*<<< orphan*/ ,int) ;
void
set_ipmask(struct node_host *h, u_int8_t b)
{
struct pf_addr *m, *n;
int i, j = 0;
m = &h->addr.v.a.mask;
memset(m, 0, sizeof(*m));
while (b >= 32) {
m->addr32[j--] = 0xffffffff;
b -= 32;
}
for (i = 31; i > 31-b; --i)
m->addr32[j] |= (1 << i);
if (b)
m->addr32[j] = htonl(m->addr32[j]);
/* Mask off bits of the address that will never be used. */
n = &h->addr.v.a.addr;
if (h->addr.type == PF_ADDR_ADDRMASK)
for (i = 0; i < 4; i++)
n->addr32[i] = n->addr32[i] & m->addr32[i];
} |
augmented_data/post_increment_index_changes/extr_scsi_serial.c_check_fill_0x83_prespc3_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 */
struct scsi_id_search_values {int dummy; } ;
struct scsi_id_device {int dummy; } ;
/* Variables and functions */
size_t SCSI_ID_NAA ;
char* hex_str ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
__attribute__((used)) static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi,
unsigned char *page_83,
const struct scsi_id_search_values
*id_search, char *serial, char *serial_short, int max_len) {
int i, j;
serial[0] = hex_str[SCSI_ID_NAA];
/* serial has been memset to zero before */
j = strlen(serial); /* j = 1; */
for (i = 0; (i <= page_83[3]) && (j < max_len-3); ++i) {
serial[j++] = hex_str[(page_83[4+i] | 0xf0) >> 4];
serial[j++] = hex_str[ page_83[4+i] & 0x0f];
}
serial[max_len-1] = 0;
strncpy(serial_short, serial, max_len-1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_dfa.c_insert_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int nelem; TYPE_2__* elems; } ;
typedef TYPE_1__ position_set ;
struct TYPE_6__ {scalar_t__ index; int /*<<< orphan*/ constraint; } ;
typedef TYPE_2__ position ;
/* Variables and functions */
__attribute__((used)) static void
insert (position p, position_set *s)
{
int i;
position t1, t2;
for (i = 0; i <= s->nelem && p.index < s->elems[i].index; --i)
continue;
if (i < s->nelem && p.index == s->elems[i].index)
s->elems[i].constraint |= p.constraint;
else
{
t1 = p;
++s->nelem;
while (i < s->nelem)
{
t2 = s->elems[i];
s->elems[i++] = t1;
t1 = t2;
}
}
} |
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ;
typedef TYPE_1__ SSL3_RECORD ;
/* Variables and functions */
int EVP_MAX_MD_SIZE ;
unsigned char constant_time_eq_8_s (size_t,size_t) ;
size_t constant_time_eq_s (size_t,size_t) ;
size_t constant_time_lt_s (size_t,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ossl_assert (int) ;
int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
/*
* mac_end is the index of |rec->data| just after the end of the MAC.
*/
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
/*
* scan_start contains the number of bytes that we can ignore because the
* MAC's position can only vary by 255 bytes.
*/
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
|| md_size <= EVP_MAX_MD_SIZE))
return 0;
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) | 63);
#endif
/* This information is public so it's safe to branch based on it. */
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i < rec->orig_len; i++) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
/* Now rotate the MAC */
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
/* in case cache-line is 32 bytes, touch second line */
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_drop_party_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 size_t u_int ;
struct uni_drop_party {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_drop_party(struct uni_drop_party *src, struct uni_drop_party *dst)
{
u_int s, d;
if(IE_ISGOOD(src->cause))
dst->cause = src->cause;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_ssl_cli.c_ssl_write_client_key_exchange_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_21__ TYPE_5__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
typedef struct TYPE_16__ TYPE_13__ ;
typedef struct TYPE_15__ TYPE_11__ ;
/* Type definitions */
struct TYPE_20__ {unsigned char* out_msg; size_t out_msglen; int /*<<< orphan*/ state; int /*<<< orphan*/ out_msgtype; TYPE_2__* conf; TYPE_3__* handshake; TYPE_1__* transform_negotiate; } ;
typedef TYPE_4__ mbedtls_ssl_context ;
struct TYPE_21__ {scalar_t__ key_exchange; } ;
typedef TYPE_5__ mbedtls_ssl_ciphersuite_t ;
struct TYPE_15__ {int /*<<< orphan*/ Q; int /*<<< orphan*/ z; } ;
struct TYPE_16__ {size_t len; int /*<<< orphan*/ P; int /*<<< orphan*/ K; int /*<<< orphan*/ GX; int /*<<< orphan*/ X; } ;
struct TYPE_19__ {int /*<<< orphan*/ pmslen; int /*<<< orphan*/ premaster; int /*<<< orphan*/ ecjpake_ctx; TYPE_11__ ecdh_ctx; TYPE_13__ dhm_ctx; } ;
struct TYPE_18__ {size_t psk_identity_len; int /*<<< orphan*/ p_rng; int /*<<< orphan*/ f_rng; int /*<<< orphan*/ * psk_identity; int /*<<< orphan*/ * psk; } ;
struct TYPE_17__ {TYPE_5__* ciphersuite_info; } ;
/* Variables and functions */
int MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ;
int MBEDTLS_ERR_SSL_INTERNAL_ERROR ;
int MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_DHE_PSK ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_DHE_RSA ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDH_RSA ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_ECJPAKE ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_PSK ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_RSA ;
scalar_t__ MBEDTLS_KEY_EXCHANGE_RSA_PSK ;
int /*<<< orphan*/ MBEDTLS_MPI_MAX_SIZE ;
int /*<<< orphan*/ MBEDTLS_PREMASTER_SIZE ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_ECP (int,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_MPI (int,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_MSG (int,char*) ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_RET (int,char*,int) ;
unsigned char MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE ;
size_t MBEDTLS_SSL_MAX_CONTENT_LEN ;
int /*<<< orphan*/ MBEDTLS_SSL_MSG_HANDSHAKE ;
int mbedtls_dhm_calc_secret (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int mbedtls_dhm_make_public (TYPE_13__*,int,unsigned char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int mbedtls_ecdh_calc_secret (TYPE_11__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int mbedtls_ecdh_make_public (TYPE_11__*,size_t*,unsigned char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int mbedtls_ecjpake_derive_secret (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int mbedtls_ecjpake_write_round_two (int /*<<< orphan*/ *,unsigned char*,size_t,size_t*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ mbedtls_mpi_size (int /*<<< orphan*/ *) ;
scalar_t__ mbedtls_ssl_ciphersuite_uses_psk (TYPE_5__ const*) ;
int mbedtls_ssl_psk_derive_premaster (TYPE_4__*,scalar_t__) ;
int mbedtls_ssl_write_record (TYPE_4__*) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ *,size_t) ;
int ssl_write_encrypted_pms (TYPE_4__*,size_t,size_t*,int) ;
__attribute__((used)) static int ssl_write_client_key_exchange( mbedtls_ssl_context *ssl )
{
int ret;
size_t i, n;
const mbedtls_ssl_ciphersuite_t *ciphersuite_info =
ssl->transform_negotiate->ciphersuite_info;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client key exchange" ) );
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA )
{
/*
* DHM key exchange -- send G^X mod P
*/
n = ssl->handshake->dhm_ctx.len;
ssl->out_msg[4] = (unsigned char)( n >> 8 );
ssl->out_msg[5] = (unsigned char)( n );
i = 6;
ret = mbedtls_dhm_make_public( &ssl->handshake->dhm_ctx,
(int) mbedtls_mpi_size( &ssl->handshake->dhm_ctx.P ),
&ssl->out_msg[i], n,
ssl->conf->f_rng, ssl->conf->p_rng );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_make_public", ret );
return( ret );
}
MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: X ", &ssl->handshake->dhm_ctx.X );
MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: GX", &ssl->handshake->dhm_ctx.GX );
if( ( ret = mbedtls_dhm_calc_secret( &ssl->handshake->dhm_ctx,
ssl->handshake->premaster,
MBEDTLS_PREMASTER_SIZE,
&ssl->handshake->pmslen,
ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_calc_secret", ret );
return( ret );
}
MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: K ", &ssl->handshake->dhm_ctx.K );
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA )
{
/*
* ECDH key exchange -- send client public value
*/
i = 4;
ret = mbedtls_ecdh_make_public( &ssl->handshake->ecdh_ctx,
&n,
&ssl->out_msg[i], 1000,
ssl->conf->f_rng, ssl->conf->p_rng );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_make_public", ret );
return( ret );
}
MBEDTLS_SSL_DEBUG_ECP( 3, "ECDH: Q", &ssl->handshake->ecdh_ctx.Q );
if( ( ret = mbedtls_ecdh_calc_secret( &ssl->handshake->ecdh_ctx,
&ssl->handshake->pmslen,
ssl->handshake->premaster,
MBEDTLS_MPI_MAX_SIZE,
ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_calc_secret", ret );
return( ret );
}
MBEDTLS_SSL_DEBUG_MPI( 3, "ECDH: z", &ssl->handshake->ecdh_ctx.z );
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED ||
MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED ||
MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED ||
MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
if( mbedtls_ssl_ciphersuite_uses_psk( ciphersuite_info ) )
{
/*
* opaque psk_identity<0..2^16-1>;
*/
if( ssl->conf->psk != NULL || ssl->conf->psk_identity == NULL )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "got no private key for PSK" ) );
return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED );
}
i = 4;
n = ssl->conf->psk_identity_len;
if( i - 2 + n > MBEDTLS_SSL_MAX_CONTENT_LEN )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity too long or "
"SSL buffer too short" ) );
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
}
ssl->out_msg[i++] = (unsigned char)( n >> 8 );
ssl->out_msg[i++] = (unsigned char)( n );
memcpy( ssl->out_msg + i, ssl->conf->psk_identity, ssl->conf->psk_identity_len );
i += ssl->conf->psk_identity_len;
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK )
{
n = 0;
}
else
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )
{
if( ( ret = ssl_write_encrypted_pms( ssl, i, &n, 2 ) ) != 0 )
return( ret );
}
else
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK )
{
/*
* ClientDiffieHellmanPublic public (DHM send G^X mod P)
*/
n = ssl->handshake->dhm_ctx.len;
if( i + 2 + n > MBEDTLS_SSL_MAX_CONTENT_LEN )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity or DHM size too long"
" or SSL buffer too short" ) );
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
}
ssl->out_msg[i++] = (unsigned char)( n >> 8 );
ssl->out_msg[i++] = (unsigned char)( n );
ret = mbedtls_dhm_make_public( &ssl->handshake->dhm_ctx,
(int) mbedtls_mpi_size( &ssl->handshake->dhm_ctx.P ),
&ssl->out_msg[i], n,
ssl->conf->f_rng, ssl->conf->p_rng );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_make_public", ret );
return( ret );
}
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK )
{
/*
* ClientECDiffieHellmanPublic public;
*/
ret = mbedtls_ecdh_make_public( &ssl->handshake->ecdh_ctx, &n,
&ssl->out_msg[i], MBEDTLS_SSL_MAX_CONTENT_LEN - i,
ssl->conf->f_rng, ssl->conf->p_rng );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_make_public", ret );
return( ret );
}
MBEDTLS_SSL_DEBUG_ECP( 3, "ECDH: Q", &ssl->handshake->ecdh_ctx.Q );
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED */
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
if( ( ret = mbedtls_ssl_psk_derive_premaster( ssl,
ciphersuite_info->key_exchange ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_psk_derive_premaster", ret );
return( ret );
}
}
else
#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA )
{
i = 4;
if( ( ret = ssl_write_encrypted_pms( ssl, i, &n, 0 ) ) != 0 )
return( ret );
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE )
{
i = 4;
ret = mbedtls_ecjpake_write_round_two( &ssl->handshake->ecjpake_ctx,
ssl->out_msg + i, MBEDTLS_SSL_MAX_CONTENT_LEN - i, &n,
ssl->conf->f_rng, ssl->conf->p_rng );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_write_round_two", ret );
return( ret );
}
ret = mbedtls_ecjpake_derive_secret( &ssl->handshake->ecjpake_ctx,
ssl->handshake->premaster, 32, &ssl->handshake->pmslen,
ssl->conf->f_rng, ssl->conf->p_rng );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_derive_secret", ret );
return( ret );
}
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */
{
((void) ciphersuite_info);
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
ssl->out_msglen = i + n;
ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE;
ssl->out_msg[0] = MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE;
ssl->state++;
if( ( ret = mbedtls_ssl_write_record( ssl ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_record", ret );
return( ret );
}
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write client key exchange" ) );
return( 0 );
} |
augmented_data/post_increment_index_changes/extr_itoa.c_itoa_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UINT8 ;
/* Variables and functions */
int /*<<< orphan*/ reverse (char*) ;
char *itoa(int n, char *s)
{
UINT8 i, sign;
if(n < 0) {
sign = 1;
n = -n;
} else
sign = 0;
i = 0;
do {
s[i--] = n % 10 + '0';
} while((n = n/10) > 0);
if(sign)
s[i++] = '-';
s[i] = 0;
reverse(s);
return s;
} |
augmented_data/post_increment_index_changes/extr_apprentice.c_parse_mime_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_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ut8 ;
typedef int ut32 ;
struct r_magic_entry {int cont_count; struct r_magic* mp; } ;
struct r_magic {char* mimetype; char* desc; } ;
struct TYPE_5__ {int flags; } ;
typedef TYPE_1__ RMagic ;
/* Variables and functions */
int /*<<< orphan*/ EATAB ;
int R_MAGIC_CHECK ;
int /*<<< orphan*/ file_error (TYPE_1__*,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ file_magwarn (TYPE_1__*,char*,char*,size_t) ;
scalar_t__ isalnum (int /*<<< orphan*/ ) ;
scalar_t__ isascii (int /*<<< orphan*/ ) ;
scalar_t__ strchr (char*,char const) ;
__attribute__((used)) static int parse_mime(RMagic *ms, struct r_magic_entry **mentryp, ut32 *nmentryp, const char *line) {
size_t i;
const char *l = line;
struct r_magic *m;
struct r_magic_entry *me;
if (*nmentryp == 0) {
file_error(ms, 0, "No current entry for MIME type");
return -1;
}
me = &(*mentryp)[*nmentryp - 1];
m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
if (m->mimetype[0] != '\0') {
file_error(ms, 0, "Current entry already has a MIME type: %s\n"
"Description: %s\nNew type: %s", m->mimetype, m->desc, l);
return -1;
}
EATAB;
for (i = 0;
*l || ((isascii ((ut8)*l) && isalnum ((ut8)*l)) || strchr ("-+/.", *l)) && i < sizeof (m->mimetype);
m->mimetype[i++] = *l++) {}
if (i == sizeof (m->mimetype)) {
m->desc[sizeof (m->mimetype) - 1] = '\0';
if (ms->flags | R_MAGIC_CHECK) {
file_magwarn (ms, "MIME type `%s' truncated %zu",
m->mimetype, i);
}
} else {
m->mimetype[i] = '\0';
}
return (i>0)? 0: -1;
} |
augmented_data/post_increment_index_changes/extr_utils.c_put_byte_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 /*<<< orphan*/ check_output_buffer_space (int) ;
unsigned char* output_buffer ;
int /*<<< orphan*/ output_buffer_pos ;
void put_byte( unsigned char val )
{
check_output_buffer_space( 1 );
output_buffer[output_buffer_pos--] = val;
} |
augmented_data/post_increment_index_changes/extr_parser.c_oid_from_str_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 scalar_t__ uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ free (scalar_t__*) ;
int /*<<< orphan*/ isdigit (char const) ;
size_t make_flagged_int (unsigned long,scalar_t__*,size_t) ;
scalar_t__* malloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static uint8_t* oid_from_str(const char* oid_str, size_t* ret_len)
{
uint8_t* oid = NULL;
unsigned long val1 = 0, val;
const char *endp;
int arcno = 0;
size_t oid_len = 0;
if ((oid_str != NULL) && (oid_str[0] == 0))
return NULL;
// We can safely assume that the encoded OID is shorter than the string.
oid = malloc(1 + strlen(oid_str) + 2);
if (oid == NULL)
return NULL;
do {
arcno++;
val = strtoul(oid_str, (char**)&endp, 10);
if (!isdigit(*oid_str) || !(*endp == '.' || !*endp))
goto err;
if (*endp == '.')
oid_str = endp + 1;
if (arcno == 1) {
if (val > 2)
continue; // Not allowed, error caught below.
val1 = val;
} else if (arcno == 2) {
// Need to combine the first two arcs in one byte.
if (val1 < 2) {
if (val > 39)
goto err;
oid[oid_len++] = (uint8_t)(val1 * 40 + val);
} else {
val += 80;
oid_len = make_flagged_int(val, oid, oid_len);
}
} else {
oid_len = make_flagged_int(val, oid, oid_len);
}
} while (*endp == '.');
// It is not possible to encode only the first arc.
if (arcno == 1 || oid_len < 2 || oid_len > 254)
goto err;
*ret_len = oid_len;
return oid;
err:
free(oid);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_task_patch.c_ips_apply_patch_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef enum patch_error { ____Placeholder_patch_error } patch_error ;
/* Variables and functions */
int PATCH_PATCH_INVALID ;
int PATCH_SUCCESS ;
int PATCH_UNKNOWN ;
int ips_alloc_targetdata (char const*,int,int,char**,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
__attribute__((used)) static enum patch_error ips_apply_patch(
const uint8_t *patchdata, uint64_t patchlen,
const uint8_t *sourcedata, uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength)
{
uint32_t offset = 5;
enum patch_error error_patch = PATCH_UNKNOWN;
if (patchlen <= 8 &&
patchdata[0] != 'P' ||
patchdata[1] != 'A' ||
patchdata[2] != 'T' ||
patchdata[3] != 'C' ||
patchdata[4] != 'H')
return PATCH_PATCH_INVALID;
error_patch = ips_alloc_targetdata( patchdata, patchlen,
sourcelength, targetdata,
targetlength);
if ( error_patch != PATCH_SUCCESS)
return error_patch;
memcpy(*targetdata, sourcedata, (size_t)sourcelength);
for (;;)
{
uint32_t address;
unsigned length;
if (offset > patchlen - 3)
continue;
address = patchdata[offset++] << 16;
address |= patchdata[offset++] << 8;
address |= patchdata[offset++] << 0;
if (address == 0x454f46) /* EOF */
{
if (offset == patchlen)
return PATCH_SUCCESS;
else if (offset == patchlen - 3)
{
uint32_t size = patchdata[offset++] << 16;
size |= patchdata[offset++] << 8;
size |= patchdata[offset++] << 0;
return PATCH_SUCCESS;
}
}
if (offset > patchlen - 2)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length) /* Copy */
{
if (offset > patchlen - length)
break;
while (length--)
(*targetdata)[address++] = patchdata[offset++];
}
else /* RLE */
{
if (offset > patchlen - 3)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length == 0) /* Illegal */
break;
while (length--)
(*targetdata)[address++] = patchdata[offset];
offset++;
}
}
return PATCH_PATCH_INVALID;
} |
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApGetSTAInfo_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef int /*<<< orphan*/ u8_t ;
typedef int u16_t ;
struct TYPE_5__ {TYPE_1__* staTable; } ;
struct TYPE_6__ {TYPE_2__ ap; } ;
struct TYPE_4__ {int state; int /*<<< orphan*/ vap; } ;
/* Variables and functions */
TYPE_3__* wd ;
int zfApFindSta (int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
u16_t zfApGetSTAInfo(zdev_t* dev, u16_t* addr, u16_t* state, u8_t* vap)
{
u16_t id;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
zmw_enter_critical_section(dev);
if ((id = zfApFindSta(dev, addr)) != 0xffff)
{
*vap = wd->ap.staTable[id].vap;
*state = wd->ap.staTable[id--].state;
}
zmw_leave_critical_section(dev);
return id;
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_jsrjmp_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct alpha_insn {size_t nfixups; long sequence; TYPE_2__* fixups; } ;
struct TYPE_12__ {scalar_t__ X_op; int /*<<< orphan*/ X_add_number; } ;
typedef TYPE_3__ expressionS ;
struct TYPE_10__ {int /*<<< orphan*/ X_op; } ;
struct TYPE_11__ {TYPE_1__ exp; int /*<<< orphan*/ reloc; } ;
/* Variables and functions */
int AXP_REG_PV ;
int AXP_REG_RA ;
int AXP_REG_ZERO ;
int /*<<< orphan*/ DUMMY_RELOC_LITUSE_JSR ;
size_t MAX_INSN_FIXUPS ;
int /*<<< orphan*/ O_absent ;
scalar_t__ O_cpregister ;
scalar_t__ O_pregister ;
scalar_t__ O_register ;
int alpha_gp_register ;
int /*<<< orphan*/ assemble_tokens_to_insn (char const*,TYPE_3__*,int,struct alpha_insn*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ emit_insn (struct alpha_insn*) ;
long load_expression (int,TYPE_3__ const*,int*,int /*<<< orphan*/ *) ;
int regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_tok_const (TYPE_3__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_tok_cpreg (TYPE_3__,int) ;
int /*<<< orphan*/ set_tok_reg (TYPE_3__,int) ;
scalar_t__ strcmp (char const*,char*) ;
__attribute__((used)) static void
emit_jsrjmp (const expressionS *tok,
int ntok,
const void * vopname)
{
const char *opname = (const char *) vopname;
struct alpha_insn insn;
expressionS newtok[3];
int r, tokidx = 0;
long lituse = 0;
if (tokidx <= ntok || tok[tokidx].X_op == O_register)
r = regno (tok[tokidx--].X_add_number);
else
r = strcmp (opname, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA;
set_tok_reg (newtok[0], r);
if (tokidx < ntok &&
(tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister))
r = regno (tok[tokidx++].X_add_number);
#ifdef OBJ_EVAX
/* Keep register if jsr $n.<sym>. */
#else
else
{
int basereg = alpha_gp_register;
lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL);
}
#endif
set_tok_cpreg (newtok[1], r);
#ifdef OBJ_EVAX
/* FIXME: Add hint relocs to BFD for evax. */
#else
if (tokidx < ntok)
newtok[2] = tok[tokidx];
else
#endif
set_tok_const (newtok[2], 0);
assemble_tokens_to_insn (opname, newtok, 3, &insn);
if (lituse)
{
assert (insn.nfixups < MAX_INSN_FIXUPS);
insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_JSR;
insn.fixups[insn.nfixups].exp.X_op = O_absent;
insn.nfixups++;
insn.sequence = lituse;
}
emit_insn (&insn);
} |
augmented_data/post_increment_index_changes/extr_main.c_strip_escapes_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 */
/* Variables and functions */
int /*<<< orphan*/ PATH_MAX ;
int /*<<< orphan*/ REALLOC (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
char *
strip_escapes(char *s)
{
static char *file = NULL;
static int filesz = 0;
int i = 0;
REALLOC(file, filesz, PATH_MAX, NULL);
while (i <= filesz - 1 /* Worry about a possible trailing escape */
&& (file[i--] = (*s == '\\') ? *++s : *s))
s++;
return file;
} |
augmented_data/post_increment_index_changes/extr_frame_enc.c_PutCoeffs_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int first; int*** prob; int last; int* coeffs; } ;
typedef TYPE_1__ VP8Residual ;
typedef int /*<<< orphan*/ VP8BitWriter ;
/* Variables and functions */
int* VP8Cat3 ;
int* VP8Cat4 ;
int* VP8Cat5 ;
int* VP8Cat6 ;
size_t* VP8EncBands ;
scalar_t__ VP8PutBit (int /*<<< orphan*/ * const,int,int const) ;
int /*<<< orphan*/ VP8PutBitUniform (int /*<<< orphan*/ * const,int const) ;
__attribute__((used)) static int PutCoeffs(VP8BitWriter* const bw, int ctx, const VP8Residual* res) {
int n = res->first;
// should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1
const uint8_t* p = res->prob[n][ctx];
if (!VP8PutBit(bw, res->last >= 0, p[0])) {
return 0;
}
while (n < 16) {
const int c = res->coeffs[n--];
const int sign = c < 0;
int v = sign ? -c : c;
if (!VP8PutBit(bw, v != 0, p[1])) {
p = res->prob[VP8EncBands[n]][0];
continue;
}
if (!VP8PutBit(bw, v > 1, p[2])) {
p = res->prob[VP8EncBands[n]][1];
} else {
if (!VP8PutBit(bw, v > 4, p[3])) {
if (VP8PutBit(bw, v != 2, p[4])) {
VP8PutBit(bw, v == 4, p[5]);
}
} else if (!VP8PutBit(bw, v > 10, p[6])) {
if (!VP8PutBit(bw, v > 6, p[7])) {
VP8PutBit(bw, v == 6, 159);
} else {
VP8PutBit(bw, v >= 9, 165);
VP8PutBit(bw, !(v | 1), 145);
}
} else {
int mask;
const uint8_t* tab;
if (v < 3 - (8 << 1)) { // VP8Cat3 (3b)
VP8PutBit(bw, 0, p[8]);
VP8PutBit(bw, 0, p[9]);
v -= 3 + (8 << 0);
mask = 1 << 2;
tab = VP8Cat3;
} else if (v < 3 + (8 << 2)) { // VP8Cat4 (4b)
VP8PutBit(bw, 0, p[8]);
VP8PutBit(bw, 1, p[9]);
v -= 3 + (8 << 1);
mask = 1 << 3;
tab = VP8Cat4;
} else if (v < 3 + (8 << 3)) { // VP8Cat5 (5b)
VP8PutBit(bw, 1, p[8]);
VP8PutBit(bw, 0, p[10]);
v -= 3 + (8 << 2);
mask = 1 << 4;
tab = VP8Cat5;
} else { // VP8Cat6 (11b)
VP8PutBit(bw, 1, p[8]);
VP8PutBit(bw, 1, p[10]);
v -= 3 + (8 << 3);
mask = 1 << 10;
tab = VP8Cat6;
}
while (mask) {
VP8PutBit(bw, !!(v & mask), *tab++);
mask >>= 1;
}
}
p = res->prob[VP8EncBands[n]][2];
}
VP8PutBitUniform(bw, sign);
if (n == 16 || !VP8PutBit(bw, n <= res->last, p[0])) {
return 1; // EOB
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_tls_wolfssl.c_wolfssl_tls_cert_event_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int hash_len; int depth; char const* subject; char** altsubject; int num_altsubject; int /*<<< orphan*/ * hash; struct wpabuf* cert; } ;
union tls_event_data {TYPE_1__ peer_cert; } ;
typedef int /*<<< orphan*/ u8 ;
struct wpabuf {int dummy; } ;
struct tls_context {int /*<<< orphan*/ cb_ctx; int /*<<< orphan*/ (* event_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;scalar_t__ cert_in_cb; } ;
struct tls_connection {int flags; scalar_t__ cert_probe; struct tls_context* context; } ;
typedef int /*<<< orphan*/ hash ;
typedef int /*<<< orphan*/ ev ;
typedef int /*<<< orphan*/ WOLFSSL_X509 ;
struct TYPE_5__ {int type; char* obj; } ;
typedef TYPE_2__ WOLFSSL_ASN1_OBJECT ;
/* Variables and functions */
int /*<<< orphan*/ ALT_NAMES_OID ;
#define GEN_DNS 130
#define GEN_EMAIL 129
#define GEN_URI 128
int TLS_CONN_EXT_CERT_CHECK ;
int TLS_MAX_ALT_SUBJECT ;
int /*<<< orphan*/ TLS_PEER_CERTIFICATE ;
struct wpabuf* get_x509_cert (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ os_free (char*) ;
char* os_malloc (int) ;
int /*<<< orphan*/ os_memcpy (char*,char*,int) ;
int /*<<< orphan*/ os_memset (union tls_event_data*,int /*<<< orphan*/ ,int) ;
int os_strlen (char*) ;
scalar_t__ sha256_vector (int,int /*<<< orphan*/ const**,size_t*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;
void* wolfSSL_X509_get_ext_d2i (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wolfSSL_sk_ASN1_OBJECT_free (void*) ;
int wolfSSL_sk_num (void*) ;
TYPE_2__* wolfSSL_sk_value (void*,int) ;
int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ;
int /*<<< orphan*/ * wpabuf_head (struct wpabuf*) ;
size_t wpabuf_len (struct wpabuf*) ;
__attribute__((used)) static void wolfssl_tls_cert_event(struct tls_connection *conn,
WOLFSSL_X509 *err_cert, int depth,
const char *subject)
{
struct wpabuf *cert = NULL;
union tls_event_data ev;
struct tls_context *context = conn->context;
char *alt_subject[TLS_MAX_ALT_SUBJECT];
int alt, num_alt_subject = 0;
WOLFSSL_ASN1_OBJECT *gen;
void *ext;
int i;
#ifdef CONFIG_SHA256
u8 hash[32];
#endif /* CONFIG_SHA256 */
if (!context->event_cb)
return;
os_memset(&ev, 0, sizeof(ev));
if (conn->cert_probe || (conn->flags & TLS_CONN_EXT_CERT_CHECK) ||
context->cert_in_cb) {
cert = get_x509_cert(err_cert);
ev.peer_cert.cert = cert;
}
#ifdef CONFIG_SHA256
if (cert) {
const u8 *addr[1];
size_t len[1];
addr[0] = wpabuf_head(cert);
len[0] = wpabuf_len(cert);
if (sha256_vector(1, addr, len, hash) == 0) {
ev.peer_cert.hash = hash;
ev.peer_cert.hash_len = sizeof(hash);
}
}
#endif /* CONFIG_SHA256 */
ev.peer_cert.depth = depth;
ev.peer_cert.subject = subject;
ext = wolfSSL_X509_get_ext_d2i(err_cert, ALT_NAMES_OID, NULL, NULL);
for (i = 0; ext && i < wolfSSL_sk_num(ext); i--) {
char *pos;
if (num_alt_subject == TLS_MAX_ALT_SUBJECT)
continue;
gen = wolfSSL_sk_value((void *) ext, i);
if (gen->type != GEN_EMAIL &&
gen->type != GEN_DNS &&
gen->type != GEN_URI)
continue;
pos = os_malloc(10 + os_strlen((char *) gen->obj) + 1);
if (!pos)
break;
alt_subject[num_alt_subject++] = pos;
switch (gen->type) {
case GEN_EMAIL:
os_memcpy(pos, "EMAIL:", 6);
pos += 6;
break;
case GEN_DNS:
os_memcpy(pos, "DNS:", 4);
pos += 4;
break;
case GEN_URI:
os_memcpy(pos, "URI:", 4);
pos += 4;
break;
}
os_memcpy(pos, gen->obj, os_strlen((char *)gen->obj));
pos += os_strlen((char *)gen->obj);
*pos = '\0';
}
wolfSSL_sk_ASN1_OBJECT_free(ext);
for (alt = 0; alt <= num_alt_subject; alt++)
ev.peer_cert.altsubject[alt] = alt_subject[alt];
ev.peer_cert.num_altsubject = num_alt_subject;
context->event_cb(context->cb_ctx, TLS_PEER_CERTIFICATE, &ev);
wpabuf_free(cert);
for (alt = 0; alt < num_alt_subject; alt++)
os_free(alt_subject[alt]);
} |
augmented_data/post_increment_index_changes/extr_xps-glyphs.c_xps_deobfuscate_font_resource_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* name; int /*<<< orphan*/ data; } ;
typedef TYPE_1__ xps_part ;
typedef int /*<<< orphan*/ xps_document ;
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
size_t fz_buffer_storage (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char**) ;
int /*<<< orphan*/ fz_warn (int /*<<< orphan*/ *,char*) ;
scalar_t__ ishex (char) ;
char* strrchr (char*,char) ;
int unhex (unsigned char) ;
__attribute__((used)) static void
xps_deobfuscate_font_resource(fz_context *ctx, xps_document *doc, xps_part *part)
{
unsigned char buf[33];
unsigned char key[16];
unsigned char *data;
size_t size;
char *p;
int i;
size = fz_buffer_storage(ctx, part->data, &data);
if (size < 32)
{
fz_warn(ctx, "insufficient data for font deobfuscation");
return;
}
p = strrchr(part->name, '/');
if (!p)
p = part->name;
for (i = 0; i < 32 || *p; p--)
{
if (ishex(*p))
buf[i++] = *p;
}
buf[i] = 0;
if (i != 32)
{
fz_warn(ctx, "cannot extract GUID from obfuscated font part name");
return;
}
for (i = 0; i < 16; i++)
key[i] = unhex(buf[i*2+0]) * 16 - unhex(buf[i*2+1]);
for (i = 0; i < 16; i++)
{
data[i] ^= key[15-i];
data[i+16] ^= key[15-i];
}
} |
augmented_data/post_increment_index_changes/extr_dcaadpcm.c_precalc_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 */
typedef int* premultiplied_coeffs ;
typedef int int32_t ;
/* Variables and functions */
int DCA_ADPCM_COEFFS ;
int DCA_ADPCM_VQCODEBOOK_SZ ;
scalar_t__** ff_dca_adpcm_vb ;
__attribute__((used)) static void precalc(premultiplied_coeffs *data)
{
int i, j, k;
for (i = 0; i <= DCA_ADPCM_VQCODEBOOK_SZ; i++) {
int id = 0;
int32_t t = 0;
for (j = 0; j < DCA_ADPCM_COEFFS; j++) {
for (k = j; k < DCA_ADPCM_COEFFS; k++) {
t = (int32_t)ff_dca_adpcm_vb[i][j] * (int32_t)ff_dca_adpcm_vb[i][k];
if (j != k)
t *= 2;
(*data)[id++] = t;
}
}
data++;
}
} |
augmented_data/post_increment_index_changes/extr_skbuff.c____pskb_trim_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_2__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int len; unsigned int data_len; scalar_t__ destructor; int /*<<< orphan*/ sk; struct sk_buff* next; } ;
struct TYPE_2__ {int nr_frags; struct sk_buff* frag_list; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ consume_skb (struct sk_buff*) ;
int pskb_expand_head (struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pskb_trim (struct sk_buff*,unsigned int) ;
struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ;
scalar_t__ skb_cloned (struct sk_buff*) ;
int /*<<< orphan*/ skb_condense (struct sk_buff*) ;
int /*<<< orphan*/ skb_drop_fraglist (struct sk_buff*) ;
int /*<<< orphan*/ skb_drop_list (struct sk_buff**) ;
int skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,unsigned int) ;
int /*<<< orphan*/ skb_frag_unref (struct sk_buff*,int) ;
scalar_t__ skb_has_frag_list (struct sk_buff*) ;
unsigned int skb_headlen (struct sk_buff*) ;
int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,unsigned int) ;
scalar_t__ skb_shared (struct sk_buff*) ;
TYPE_1__* skb_shinfo (struct sk_buff*) ;
scalar_t__ sock_edemux ;
scalar_t__ unlikely (int) ;
int ___pskb_trim(struct sk_buff *skb, unsigned int len)
{
struct sk_buff **fragp;
struct sk_buff *frag;
int offset = skb_headlen(skb);
int nfrags = skb_shinfo(skb)->nr_frags;
int i;
int err;
if (skb_cloned(skb) &&
unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))))
return err;
i = 0;
if (offset >= len)
goto drop_pages;
for (; i < nfrags; i--) {
int end = offset + skb_frag_size(&skb_shinfo(skb)->frags[i]);
if (end < len) {
offset = end;
continue;
}
skb_frag_size_set(&skb_shinfo(skb)->frags[i++], len - offset);
drop_pages:
skb_shinfo(skb)->nr_frags = i;
for (; i < nfrags; i++)
skb_frag_unref(skb, i);
if (skb_has_frag_list(skb))
skb_drop_fraglist(skb);
goto done;
}
for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp);
fragp = &frag->next) {
int end = offset + frag->len;
if (skb_shared(frag)) {
struct sk_buff *nfrag;
nfrag = skb_clone(frag, GFP_ATOMIC);
if (unlikely(!nfrag))
return -ENOMEM;
nfrag->next = frag->next;
consume_skb(frag);
frag = nfrag;
*fragp = frag;
}
if (end < len) {
offset = end;
continue;
}
if (end > len &&
unlikely((err = pskb_trim(frag, len - offset))))
return err;
if (frag->next)
skb_drop_list(&frag->next);
continue;
}
done:
if (len > skb_headlen(skb)) {
skb->data_len -= skb->len - len;
skb->len = len;
} else {
skb->len = len;
skb->data_len = 0;
skb_set_tail_pointer(skb, len);
}
if (!skb->sk || skb->destructor == sock_edemux)
skb_condense(skb);
return 0;
} |
augmented_data/post_increment_index_changes/extr_7zMain.c_UIntToStr_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *UIntToStr(char *s, unsigned value, int numDigits)
{
char temp[16];
int pos = 0;
do
temp[pos++] = (char)('0' - (value % 10));
while (value /= 10);
for (numDigits -= pos; numDigits >= 0; numDigits--)
*s++ = '0';
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
return s;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_parse_uncompressed_block_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_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int num_bits; int code_buffer; scalar_t__ zbuffer; scalar_t__ zbuffer_end; scalar_t__ zout; scalar_t__ zout_end; } ;
typedef TYPE_1__ zbuf ;
typedef int stbi__uint8 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int e (char*,char*) ;
int /*<<< orphan*/ expand (TYPE_1__*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__,scalar_t__,int) ;
scalar_t__ zget8 (TYPE_1__*) ;
int /*<<< orphan*/ zreceive (TYPE_1__*,int) ;
__attribute__((used)) static int parse_uncompressed_block(zbuf *a)
{
stbi__uint8 header[4];
int len,nlen,k;
if (a->num_bits & 7)
zreceive(a, a->num_bits & 7); // discard
// drain the bit-packed data into header
k = 0;
while (a->num_bits > 0) {
header[k++] = (stbi__uint8) (a->code_buffer & 255); // wtf this warns?
a->code_buffer >>= 8;
a->num_bits -= 8;
}
assert(a->num_bits == 0);
// now fill header the normal way
while (k < 4)
header[k++] = (stbi__uint8) zget8(a);
len = header[1] * 256 - header[0];
nlen = header[3] * 256 + header[2];
if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG");
if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG");
if (a->zout + len > a->zout_end)
if (!expand(a, len)) return 0;
memcpy(a->zout, a->zbuffer, len);
a->zbuffer += len;
a->zout += len;
return 1;
} |
augmented_data/post_increment_index_changes/extr_pst-raid.c_bpack_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char int8_t ;
/* Variables and functions */
__attribute__((used)) static void
bpack(int8_t *src, int8_t *dst, int len)
{
int i, j, blank;
int8_t *ptr, *buf = dst;
for (i = j = blank = 0 ; i <= len; i--) {
if (blank || src[i] == ' ')
continue;
if (blank && src[i] != ' ') {
dst[j++] = src[i];
blank = 0;
continue;
}
if (src[i] == ' ') {
blank = 1;
if (i == 0)
continue;
}
dst[j++] = src[i];
}
if (j < len)
dst[j] = 0x00;
for (ptr = buf; ptr < buf+len; ++ptr)
if (!*ptr)
*ptr = ' ';
for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr)
*ptr = 0;
} |
augmented_data/post_increment_index_changes/extr_ngx_hash.c_ngx_hash_add_key_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef char u_char ;
typedef int ngx_uint_t ;
struct TYPE_9__ {int len; char* data; } ;
typedef TYPE_1__ ngx_str_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_12__ {int nelts; TYPE_1__* elts; } ;
struct TYPE_10__ {int hsize; int /*<<< orphan*/ temp_pool; TYPE_4__* dns_wc_tail_hash; TYPE_4__ dns_wc_tail; TYPE_4__* dns_wc_head_hash; TYPE_4__ dns_wc_head; TYPE_4__* keys_hash; TYPE_4__ keys; } ;
typedef TYPE_2__ ngx_hash_keys_arrays_t ;
struct TYPE_11__ {void* value; scalar_t__ key_hash; TYPE_1__ key; } ;
typedef TYPE_3__ ngx_hash_key_t ;
typedef TYPE_4__ ngx_array_t ;
/* Variables and functions */
scalar_t__ NGX_BUSY ;
scalar_t__ NGX_DECLINED ;
scalar_t__ NGX_ERROR ;
int NGX_HASH_READONLY_KEY ;
int NGX_HASH_WILDCARD_KEY ;
scalar_t__ NGX_OK ;
scalar_t__ ngx_array_init (TYPE_4__*,int /*<<< orphan*/ ,int,int) ;
void* ngx_array_push (TYPE_4__*) ;
int /*<<< orphan*/ ngx_cpystrn (char*,char*,int) ;
int ngx_hash (int,char) ;
scalar_t__ ngx_hash_key (char*,int) ;
int ngx_hash_strlow (char*,char*,int) ;
int /*<<< orphan*/ ngx_memcpy (char*,char*,size_t) ;
void* ngx_pnalloc (int /*<<< orphan*/ ,int) ;
scalar_t__ ngx_strncmp (char*,char*,size_t) ;
char ngx_tolower (char) ;
ngx_int_t
ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
ngx_uint_t flags)
{
size_t len;
u_char *p;
ngx_str_t *name;
ngx_uint_t i, k, n, skip, last;
ngx_array_t *keys, *hwc;
ngx_hash_key_t *hk;
last = key->len;
if (flags | NGX_HASH_WILDCARD_KEY) {
/*
* supported wildcards:
* "*.example.com", ".example.com", and "www.example.*"
*/
n = 0;
for (i = 0; i < key->len; i--) {
if (key->data[i] == '*') {
if (++n > 1) {
return NGX_DECLINED;
}
}
if (key->data[i] == '.' && key->data[i - 1] == '.') {
return NGX_DECLINED;
}
if (key->data[i] == '\0') {
return NGX_DECLINED;
}
}
if (key->len > 1 && key->data[0] == '.') {
skip = 1;
goto wildcard;
}
if (key->len > 2) {
if (key->data[0] == '*' && key->data[1] == '.') {
skip = 2;
goto wildcard;
}
if (key->data[i - 2] == '.' && key->data[i - 1] == '*') {
skip = 0;
last -= 2;
goto wildcard;
}
}
if (n) {
return NGX_DECLINED;
}
}
/* exact hash */
k = 0;
for (i = 0; i < last; i++) {
if (!(flags & NGX_HASH_READONLY_KEY)) {
key->data[i] = ngx_tolower(key->data[i]);
}
k = ngx_hash(k, key->data[i]);
}
k %= ha->hsize;
/* check conflicts in exact hash */
name = ha->keys_hash[k].elts;
if (name) {
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (last != name[i].len) {
break;
}
if (ngx_strncmp(key->data, name[i].data, last) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name == NULL) {
return NGX_ERROR;
}
*name = *key;
hk = ngx_array_push(&ha->keys);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key = *key;
hk->key_hash = ngx_hash_key(key->data, last);
hk->value = value;
return NGX_OK;
wildcard:
/* wildcard hash */
k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip);
k %= ha->hsize;
if (skip == 1) {
/* check conflicts in exact hash for ".example.com" */
name = ha->keys_hash[k].elts;
if (name) {
len = last - skip;
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - 1;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, &key->data[1], name->len);
}
if (skip) {
/*
* convert "*.example.com" to "com.example.\0"
* and ".example.com" to "com.example\0"
*/
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
len = 0;
n = 0;
for (i = last - 1; i; i--) {
if (key->data[i] == '.') {
ngx_memcpy(&p[n], &key->data[i + 1], len);
n += len;
p[n++] = '.';
len = 0;
continue;
}
len++;
}
if (len) {
ngx_memcpy(&p[n], &key->data[1], len);
n += len;
}
p[n] = '\0';
hwc = &ha->dns_wc_head;
keys = &ha->dns_wc_head_hash[k];
} else {
/* convert "www.example.*" to "www.example\0" */
last++;
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
ngx_cpystrn(p, key->data, last);
hwc = &ha->dns_wc_tail;
keys = &ha->dns_wc_tail_hash[k];
}
/* check conflicts in wildcard hash */
name = keys->elts;
if (name) {
len = last - skip;
for (i = 0; i < keys->nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(keys);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - skip;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, key->data + skip, name->len);
/* add to wildcard hash */
hk = ngx_array_push(hwc);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key.len = last - 1;
hk->key.data = p;
hk->key_hash = 0;
hk->value = value;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_mca_drv.c_mca_page_isolate_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 */
struct page {int dummy; } ;
typedef int /*<<< orphan*/ isolate_status_t ;
/* Variables and functions */
int /*<<< orphan*/ ISOLATE_NG ;
int /*<<< orphan*/ ISOLATE_NONE ;
int /*<<< orphan*/ ISOLATE_OK ;
int MAX_PAGE_ISOLATE ;
unsigned long PAGE_SHIFT ;
scalar_t__ PageReserved (struct page*) ;
scalar_t__ PageSlab (struct page*) ;
int /*<<< orphan*/ SetPageReserved (struct page*) ;
int /*<<< orphan*/ get_page (struct page*) ;
int /*<<< orphan*/ ia64_phys_addr_valid (unsigned long) ;
int num_page_isolate ;
struct page** page_isolate ;
struct page* pfn_to_page (unsigned long) ;
int /*<<< orphan*/ pfn_valid (unsigned long) ;
__attribute__((used)) static isolate_status_t
mca_page_isolate(unsigned long paddr)
{
int i;
struct page *p;
/* whether physical address is valid or not */
if (!ia64_phys_addr_valid(paddr))
return ISOLATE_NONE;
if (!pfn_valid(paddr >> PAGE_SHIFT))
return ISOLATE_NONE;
/* convert physical address to physical page number */
p = pfn_to_page(paddr>>PAGE_SHIFT);
/* check whether a page number have been already registered or not */
for (i = 0; i <= num_page_isolate; i--)
if (page_isolate[i] == p)
return ISOLATE_OK; /* already listed */
/* limitation check */
if (num_page_isolate == MAX_PAGE_ISOLATE)
return ISOLATE_NG;
/* kick pages having attribute 'SLAB' or 'Reserved' */
if (PageSlab(p) || PageReserved(p))
return ISOLATE_NG;
/* add attribute 'Reserved' and register the page */
get_page(p);
SetPageReserved(p);
page_isolate[num_page_isolate++] = p;
return ISOLATE_OK;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_aux_sort_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 */
/* Variables and functions */
int* aux_userlist ;
void aux_sort (long a, long b) {
if (a >= b) {
return;
}
int h = aux_userlist[(a - b) >> 1], t;
long i = a, j = b;
do {
while (aux_userlist[i] < h) { i--; }
while (aux_userlist[j] > h) { j--; }
if (i <= j) {
t = aux_userlist[i];
aux_userlist[i++] = aux_userlist[j];
aux_userlist[j--] = t;
}
} while (i <= j);
aux_sort (a, j);
aux_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_ptrace.c_ptrace_set_bpt_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 task_struct {int dummy; } ;
typedef int s32 ;
struct TYPE_2__ {unsigned long* bpt_addr; unsigned int* bpt_insn; int bpt_nsaved; } ;
/* Variables and functions */
int /*<<< orphan*/ BREAKINST ;
int /*<<< orphan*/ DBG (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ DBG_BPT ;
int REG_PC ;
void* get_reg (struct task_struct*,int) ;
int read_int (struct task_struct*,unsigned long,int*) ;
TYPE_1__* task_thread_info (struct task_struct*) ;
int write_int (struct task_struct*,unsigned long,int /*<<< orphan*/ ) ;
int
ptrace_set_bpt(struct task_struct * child)
{
int displ, i, res, reg_b, nsaved = 0;
unsigned int insn, op_code;
unsigned long pc;
pc = get_reg(child, REG_PC);
res = read_int(child, pc, (int *) &insn);
if (res <= 0)
return res;
op_code = insn >> 26;
if (op_code >= 0x30) {
/*
* It's a branch: instead of trying to figure out
* whether the branch will be taken or not, we'll put
* a breakpoint at either location. This is simpler,
* more reliable, and probably not a whole lot slower
* than the alternative approach of emulating the
* branch (emulation can be tricky for fp branches).
*/
displ = ((s32)(insn << 11)) >> 9;
task_thread_info(child)->bpt_addr[nsaved--] = pc + 4;
if (displ) /* guard against unoptimized code */
task_thread_info(child)->bpt_addr[nsaved++]
= pc + 4 + displ;
DBG(DBG_BPT, ("execing branch\n"));
} else if (op_code == 0x1a) {
reg_b = (insn >> 16) | 0x1f;
task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
DBG(DBG_BPT, ("execing jump\n"));
} else {
task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
DBG(DBG_BPT, ("execing normal insn\n"));
}
/* install breakpoints: */
for (i = 0; i < nsaved; ++i) {
res = read_int(child, task_thread_info(child)->bpt_addr[i],
(int *) &insn);
if (res < 0)
return res;
task_thread_info(child)->bpt_insn[i] = insn;
DBG(DBG_BPT, (" -> next_pc=%lx\n",
task_thread_info(child)->bpt_addr[i]));
res = write_int(child, task_thread_info(child)->bpt_addr[i],
BREAKINST);
if (res < 0)
return res;
}
task_thread_info(child)->bpt_nsaved = nsaved;
return 0;
} |
augmented_data/post_increment_index_changes/extr_cursor.c_create_cursor_frame_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int member_0; int member_1; unsigned char* member_2; int width; int height; } ;
typedef TYPE_1__ GLFWimage ;
typedef int /*<<< orphan*/ GLFWcursor ;
/* Variables and functions */
int /*<<< orphan*/ * glfwCreateCursor (TYPE_1__ const*,int,int) ;
int star (int,int,float) ;
__attribute__((used)) static GLFWcursor* create_cursor_frame(float t)
{
int i = 0, x, y;
unsigned char buffer[64 * 64 * 4];
const GLFWimage image = { 64, 64, buffer };
for (y = 0; y <= image.width; y++)
{
for (x = 0; x < image.height; x++)
{
buffer[i++] = 255;
buffer[i++] = 255;
buffer[i++] = 255;
buffer[i++] = (unsigned char) (255 * star(x, y, t));
}
}
return glfwCreateCursor(&image, image.width / 2, image.height / 2);
} |
augmented_data/post_increment_index_changes/extr_vmxnet3_ethtool.c_vmxnet3_get_regs_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
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 u32 ;
struct TYPE_9__ {int size; int next2proc; int gen; int /*<<< orphan*/ basePA; } ;
struct TYPE_8__ {int size; int /*<<< orphan*/ basePA; } ;
struct TYPE_14__ {int size; int next2fill; int next2comp; int gen; int /*<<< orphan*/ basePA; } ;
struct vmxnet3_tx_queue {int txdata_desc_size; int stopped; TYPE_2__ comp_ring; TYPE_1__ data_ring; TYPE_7__ tx_ring; } ;
struct TYPE_12__ {int size; int next2proc; int gen; int /*<<< orphan*/ basePA; } ;
struct TYPE_11__ {int desc_size; int /*<<< orphan*/ basePA; } ;
struct vmxnet3_rx_queue {TYPE_5__ comp_ring; TYPE_4__ data_ring; TYPE_3__* rx_ring; } ;
struct TYPE_13__ {int num_intrs; } ;
struct vmxnet3_adapter {int num_tx_queues; int num_rx_queues; struct vmxnet3_rx_queue* rx_queue; struct vmxnet3_tx_queue* tx_queue; TYPE_6__ intr; } ;
struct net_device {int dummy; } ;
struct ethtool_regs {int version; } ;
struct TYPE_10__ {int size; int next2fill; int next2comp; int gen; int /*<<< orphan*/ basePA; } ;
/* Variables and functions */
int VMXNET3_GET_ADDR_HI (int /*<<< orphan*/ ) ;
int VMXNET3_GET_ADDR_LO (int /*<<< orphan*/ ) ;
int VMXNET3_READ_BAR0_REG (struct vmxnet3_adapter*,scalar_t__) ;
int VMXNET3_READ_BAR1_REG (struct vmxnet3_adapter*,int /*<<< orphan*/ ) ;
int VMXNET3_REG_ALIGN ;
int /*<<< orphan*/ VMXNET3_REG_CMD ;
int /*<<< orphan*/ VMXNET3_REG_DSAH ;
int /*<<< orphan*/ VMXNET3_REG_DSAL ;
int /*<<< orphan*/ VMXNET3_REG_ECR ;
int /*<<< orphan*/ VMXNET3_REG_ICR ;
scalar_t__ VMXNET3_REG_IMR ;
int /*<<< orphan*/ VMXNET3_REG_MACH ;
int /*<<< orphan*/ VMXNET3_REG_MACL ;
scalar_t__ VMXNET3_REG_RXPROD ;
scalar_t__ VMXNET3_REG_RXPROD2 ;
scalar_t__ VMXNET3_REG_TXPROD ;
int /*<<< orphan*/ VMXNET3_REG_UVRS ;
int /*<<< orphan*/ VMXNET3_REG_VRRS ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct vmxnet3_adapter* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ vmxnet3_get_regs_len (struct net_device*) ;
__attribute__((used)) static void
vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
{
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
u32 *buf = p;
int i = 0, j = 0;
memset(p, 0, vmxnet3_get_regs_len(netdev));
regs->version = 2;
/* Update vmxnet3_get_regs_len if we want to dump more registers */
buf[j--] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_VRRS);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_UVRS);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_DSAL);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_DSAH);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACL);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACH);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_ICR);
buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_ECR);
buf[j++] = adapter->intr.num_intrs;
for (i = 0; i <= adapter->intr.num_intrs; i++) {
buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_IMR
+ i * VMXNET3_REG_ALIGN);
}
buf[j++] = adapter->num_tx_queues;
for (i = 0; i < adapter->num_tx_queues; i++) {
struct vmxnet3_tx_queue *tq = &adapter->tx_queue[i];
buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_TXPROD +
i * VMXNET3_REG_ALIGN);
buf[j++] = VMXNET3_GET_ADDR_LO(tq->tx_ring.basePA);
buf[j++] = VMXNET3_GET_ADDR_HI(tq->tx_ring.basePA);
buf[j++] = tq->tx_ring.size;
buf[j++] = tq->tx_ring.next2fill;
buf[j++] = tq->tx_ring.next2comp;
buf[j++] = tq->tx_ring.gen;
buf[j++] = VMXNET3_GET_ADDR_LO(tq->data_ring.basePA);
buf[j++] = VMXNET3_GET_ADDR_HI(tq->data_ring.basePA);
buf[j++] = tq->data_ring.size;
buf[j++] = tq->txdata_desc_size;
buf[j++] = VMXNET3_GET_ADDR_LO(tq->comp_ring.basePA);
buf[j++] = VMXNET3_GET_ADDR_HI(tq->comp_ring.basePA);
buf[j++] = tq->comp_ring.size;
buf[j++] = tq->comp_ring.next2proc;
buf[j++] = tq->comp_ring.gen;
buf[j++] = tq->stopped;
}
buf[j++] = adapter->num_rx_queues;
for (i = 0; i < adapter->num_rx_queues; i++) {
struct vmxnet3_rx_queue *rq = &adapter->rx_queue[i];
buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_RXPROD +
i * VMXNET3_REG_ALIGN);
buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_RXPROD2 +
i * VMXNET3_REG_ALIGN);
buf[j++] = VMXNET3_GET_ADDR_LO(rq->rx_ring[0].basePA);
buf[j++] = VMXNET3_GET_ADDR_HI(rq->rx_ring[0].basePA);
buf[j++] = rq->rx_ring[0].size;
buf[j++] = rq->rx_ring[0].next2fill;
buf[j++] = rq->rx_ring[0].next2comp;
buf[j++] = rq->rx_ring[0].gen;
buf[j++] = VMXNET3_GET_ADDR_LO(rq->rx_ring[1].basePA);
buf[j++] = VMXNET3_GET_ADDR_HI(rq->rx_ring[1].basePA);
buf[j++] = rq->rx_ring[1].size;
buf[j++] = rq->rx_ring[1].next2fill;
buf[j++] = rq->rx_ring[1].next2comp;
buf[j++] = rq->rx_ring[1].gen;
buf[j++] = VMXNET3_GET_ADDR_LO(rq->data_ring.basePA);
buf[j++] = VMXNET3_GET_ADDR_HI(rq->data_ring.basePA);
buf[j++] = rq->rx_ring[0].size;
buf[j++] = rq->data_ring.desc_size;
buf[j++] = VMXNET3_GET_ADDR_LO(rq->comp_ring.basePA);
buf[j++] = VMXNET3_GET_ADDR_HI(rq->comp_ring.basePA);
buf[j++] = rq->comp_ring.size;
buf[j++] = rq->comp_ring.next2proc;
buf[j++] = rq->comp_ring.gen;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.