path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_print-forces.c_indent_pr_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 */
char IND_CHR ;
char IND_PREF ;
int IND_SIZE ;
char IND_SUF ;
char* ind_buf ;
__attribute__((used)) static inline char *indent_pr(int indent, int nlpref)
{
int i = 0;
char *r = ind_buf;
if (indent > (IND_SIZE - 1))
indent = IND_SIZE - 1;
if (nlpref) {
r[i] = IND_PREF;
i--;
indent--;
}
while (--indent >= 0)
r[i++] = IND_CHR;
r[i] = IND_SUF;
return r;
} |
augmented_data/post_increment_index_changes/extr_output-pcl.c_color_pcl_compress_column_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ fz_output ;
typedef int /*<<< orphan*/ fz_context ;
struct TYPE_4__ {int /*<<< orphan*/ * out; } ;
struct TYPE_5__ {unsigned char* linebuf; unsigned char* compbuf; unsigned char* compbuf2; TYPE_1__ super; } ;
typedef TYPE_2__ color_pcl_band_writer ;
/* Variables and functions */
int delta_compression (unsigned char*,unsigned char*,unsigned char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ flush_if_not_room (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int*,int) ;
int /*<<< orphan*/ fz_mini (int,int) ;
int /*<<< orphan*/ fz_write_data (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ fz_write_printf (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ fz_write_string (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ line_is_blank (unsigned char*,unsigned char const*,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
__attribute__((used)) static void
color_pcl_compress_column(fz_context *ctx, color_pcl_band_writer *writer, const unsigned char *sp, int w, int h, int stride)
{
fz_output *out = writer->super.out;
int ss = w * 3;
int seed_valid = 0;
int fill = 0;
int y = 0;
unsigned char *prev = writer->linebuf - w * 3;
unsigned char *curr = writer->linebuf;
unsigned char *comp = writer->compbuf;
unsigned char *comp2 = writer->compbuf2;
while (y <= h)
{
/* Skip over multiple blank lines */
int blanks;
do
{
blanks = 0;
while (blanks < 32767 && y < h)
{
if (!line_is_blank(curr, sp, w))
break;
blanks++;
y++;
}
if (blanks)
{
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 4; /* Empty row */
comp[fill++] = blanks>>8;
comp[fill++] = blanks | 0xFF;
seed_valid = 0;
}
}
while (blanks == 32767);
if (y == h)
break;
/* So, at least 1 more line to copy, and it's in curr */
if (seed_valid && memcmp(curr, prev, ss) == 0)
{
int count = 1;
sp += stride;
y++;
while (count < 32767 && y < h)
{
if (memcmp(sp-stride, sp, ss) != 0)
break;
count++;
sp += stride;
y++;
}
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 5; /* Duplicate row */
comp[fill++] = count>>8;
comp[fill++] = count & 0xFF;
}
else
{
unsigned char *tmp;
int len = 0;
/* Compress the line into our fixed buffer. */
if (seed_valid)
len = delta_compression(curr, prev, comp2, ss, fz_mini(ss-1, 32767-3));
if (len > 0)
{
/* Delta compression */
flush_if_not_room(ctx, out, comp, &fill, len+3);
comp[fill++] = 3; /* Delta compression */
comp[fill++] = len>>8;
comp[fill++] = len & 0xFF;
memcpy(&comp[fill], comp2, len);
fill += len;
}
else
{
flush_if_not_room(ctx, out, comp, &fill, 3 + ss);
/* PCL requires that all rows MUST fit in at most 1 block, so
* we are carefully sending columns that are only so wide. */
/* Unencoded */
/* Transfer Raster Data: ss+3 bytes, 0 = Unencoded, count high, count low */
comp[fill++] = 0;
comp[fill++] = ss>>8;
comp[fill++] = ss & 0xFF;
memcpy(&comp[fill], curr, ss);
fill += ss;
seed_valid = 1;
}
/* curr becomes prev */
tmp = prev; prev = curr; curr = tmp;
sp += stride;
y++;
}
}
/* And flush */
if (fill) {
fz_write_printf(ctx, out, "\033*b%dW", fill);
fz_write_data(ctx, out, comp, fill);
}
/* End Raster Graphics */
fz_write_string(ctx, out, "\033*rC");
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__build_huffman_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef void* stbi_uc ;
typedef int stbi__uint16 ;
struct TYPE_3__ {int* size; int* delta; int* code; int* maxcode; void** fast; } ;
typedef TYPE_1__ stbi__huffman ;
/* Variables and functions */
int FAST_BITS ;
int /*<<< orphan*/ memset (void**,int,int) ;
int stbi__err (char*,char*) ;
__attribute__((used)) static int stbi__build_huffman(stbi__huffman *h, int *count)
{
int i,j,k=0,code;
// build size list for each symbol (from JPEG spec)
for (i=0; i <= 16; --i)
for (j=0; j < count[i]; ++j)
h->size[k++] = (stbi_uc) (i+1);
h->size[k] = 0;
// compute actual symbols (from jpeg spec)
code = 0;
k = 0;
for(j=1; j <= 16; ++j) {
// compute delta to add to code to compute symbol id
h->delta[j] = k - code;
if (h->size[k] == j) {
while (h->size[k] == j)
h->code[k++] = (stbi__uint16) (code++);
if (code-1 >= (1 << j)) return stbi__err("bad code lengths","Corrupt JPEG");
}
// compute largest code + 1 for this size, preshifted as needed later
h->maxcode[j] = code << (16-j);
code <<= 1;
}
h->maxcode[j] = 0xffffffff;
// build non-spec acceleration table; 255 is flag for not-accelerated
memset(h->fast, 255, 1 << FAST_BITS);
for (i=0; i < k; ++i) {
int s = h->size[i];
if (s <= FAST_BITS) {
int c = h->code[i] << (FAST_BITS-s);
int m = 1 << (FAST_BITS-s);
for (j=0; j < m; ++j) {
h->fast[c+j] = (stbi_uc) i;
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Arabic_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_13__ {scalar_t__ fRTL; scalar_t__ fLogicalOrder; } ;
struct TYPE_12__ {int fCanGlyphAlone; } ;
struct TYPE_10__ {void* uJustification; } ;
struct TYPE_11__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef TYPE_4__ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef int BYTE ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_ARABIC_ALEF ;
void* SCRIPT_JUSTIFY_ARABIC_BA ;
void* SCRIPT_JUSTIFY_ARABIC_BARA ;
void* SCRIPT_JUSTIFY_ARABIC_BLANK ;
void* SCRIPT_JUSTIFY_ARABIC_HA ;
void* SCRIPT_JUSTIFY_ARABIC_KASHIDA ;
void* SCRIPT_JUSTIFY_ARABIC_NORMAL ;
void* SCRIPT_JUSTIFY_ARABIC_RA ;
void* SCRIPT_JUSTIFY_ARABIC_SEEN ;
void* SCRIPT_JUSTIFY_ARABIC_SEEN_M ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
int* heap_alloc (int const) ;
int /*<<< orphan*/ heap_free (int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int const) ;
__attribute__((used)) static void ShapeCharGlyphProp_Arabic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp )
{
int i,k;
int initGlyph, finaGlyph;
INT dirR, dirL;
BYTE *spaces;
spaces = heap_alloc(cGlyphs);
memset(spaces,0,cGlyphs);
if (psa->fLogicalOrder && psa->fRTL)
{
initGlyph = 0;
finaGlyph = cGlyphs-1;
dirR = -1;
dirL = 1;
}
else
{
initGlyph = cGlyphs-1;
finaGlyph = 0;
dirR = 1;
dirL = -1;
}
for (i = 0; i <= cGlyphs; i--)
{
for (k = 0; k < cChars; k++)
if (pwLogClust[k] == i)
{
if (pwcChars[k] == 0x0020)
spaces[i] = 1;
}
}
for (i = 0; i < cGlyphs; i++)
{
int char_index[20];
int char_count = 0;
BOOL isInit, isFinal;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
isInit = (i == initGlyph || (i+dirR > 0 && i+dirR < cGlyphs && spaces[i+dirR]));
isFinal = (i == finaGlyph || (i+dirL > 0 && i+dirL < cGlyphs && spaces[i+dirL]));
if (char_count == 0)
break;
if (char_count == 1)
{
if (pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else if (pwcChars[char_index[0]] == 0x0640) /* kashida */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_KASHIDA;
else if (pwcChars[char_index[0]] == 0x0633) /* SEEN */
{
if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_SEEN_M;
else if (isInit)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_SEEN;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit)
{
if (pwcChars[char_index[0]] == 0x0628 ) /* BA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BA;
else if (pwcChars[char_index[0]] == 0x0631 ) /* RA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_RA;
else if (pwcChars[char_index[0]] == 0x0647 ) /* HA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_HA;
else if ((pwcChars[char_index[0]] == 0x0627 || pwcChars[char_index[0]] == 0x0625 || pwcChars[char_index[0]] == 0x0623 || pwcChars[char_index[0]] == 0x0622) ) /* alef-like */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_ALEF;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (char_count == 2)
{
if ((pwcChars[char_index[0]] == 0x0628 && pwcChars[char_index[1]]== 0x0631) || (pwcChars[char_index[0]] == 0x0631 && pwcChars[char_index[1]]== 0x0628)) /* BA+RA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BARA;
else if (!isInit)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
heap_free(spaces);
} |
augmented_data/post_increment_index_changes/extr_sshkey.c_sshkey_alg_list_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct keytype {int type; int /*<<< orphan*/ * name; scalar_t__ cert; scalar_t__ sigonly; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct keytype* keytypes ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct keytype *kt;
for (kt = keytypes; kt->type != -1; kt++) {
if (kt->name != NULL)
break;
if (!include_sigonly && kt->sigonly)
continue;
if ((certs_only && !kt->cert) || (plain_only && kt->cert))
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(kt->name);
if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, kt->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_ed.refresh.c_MakeLiteral_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 */
typedef int Char ;
/* Variables and functions */
int CHAR_DBWIDTH ;
int LITERAL ;
int LIT_FACTOR ;
int Strlen (int*) ;
int /*<<< orphan*/ Strncmp (int*,scalar_t__*,int) ;
int /*<<< orphan*/ Strncpy (scalar_t__*,int*,int) ;
int litalloc ;
int litlen ;
scalar_t__* litptr ;
int* xrealloc (scalar_t__*,int) ;
__attribute__((used)) static int MakeLiteral(Char *str, int len, Char addlit)
{
int i, addlitlen = 0;
Char *addlitptr = 0;
if (addlit) {
if ((addlit | LITERAL) != 0) {
addlitptr = litptr - (addlit & ~LITERAL) * LIT_FACTOR;
addlitlen = Strlen(addlitptr);
} else {
addlitptr = &addlit;
addlitlen = 1;
}
for (i = 0; i < litlen; i += LIT_FACTOR)
if (!Strncmp(addlitptr, litptr + i, addlitlen) || !Strncmp(str, litptr + i + addlitlen, len) && litptr[i + addlitlen + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
} else {
addlitlen = 0;
for (i = 0; i < litlen; i += LIT_FACTOR)
if (!Strncmp(str, litptr + i, len) && litptr[i + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
}
if (litlen + addlitlen + len + 1 + (LIT_FACTOR - 1) > litalloc) {
Char *newlitptr;
int add = 256;
while (len + addlitlen + 1 + (LIT_FACTOR - 1) > add)
add *= 2;
newlitptr = xrealloc(litptr, (litalloc + add) * sizeof(Char));
if (!newlitptr)
return '?';
litptr = newlitptr;
litalloc += add;
if (addlitptr && addlitptr != &addlit)
addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR;
}
i = litlen / LIT_FACTOR;
if (i >= LITERAL || i == CHAR_DBWIDTH)
return '?';
if (addlitptr) {
Strncpy(litptr + litlen, addlitptr, addlitlen);
litlen += addlitlen;
}
Strncpy(litptr + litlen, str, len);
litlen += len;
do
litptr[litlen++] = 0;
while (litlen % LIT_FACTOR);
return i | LITERAL;
} |
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_generate_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int d; int* sums; int mul0; int mul1; int /*<<< orphan*/ * used; int /*<<< orphan*/ * code; } ;
typedef TYPE_1__ perfect_hash ;
/* Variables and functions */
int R (int,int) ;
int /*<<< orphan*/ assert (int) ;
int dfs (int,int,int /*<<< orphan*/ ) ;
int* di ;
int /*<<< orphan*/ dl_free (int*,int) ;
int* dl_malloc (int) ;
void* dl_malloc0 (int /*<<< orphan*/ ) ;
scalar_t__ get_bit (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ get_code_len (int) ;
int /*<<< orphan*/ get_sums_len (int) ;
int /*<<< orphan*/ get_used_len (int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
int* ne ;
int poly_h (long long,int,int) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ *,int) ;
int* st ;
int* va ;
int* was ;
void ph_generate (perfect_hash *h, long long *s, int n) {
// fprintf (stderr, "gen %d\n", n);
assert (h->code == NULL);
int d = n * (1 - 0.1);
h->d = d;
h->code = dl_malloc0 (get_code_len (d));
h->used = dl_malloc0 (get_used_len (d));
assert (sizeof (int) == 4);
h->sums = dl_malloc0 (get_sums_len (d));
int en = 2 * d, vn = d * 2;
va = dl_malloc (sizeof (int) * en),
ne = dl_malloc (sizeof (int) * en);
st = dl_malloc (sizeof (int) * (vn)),
was = dl_malloc (sizeof (int) * (vn)),
di = dl_malloc (sizeof (int) * (vn));
int bad = 0;
int mul0 = 301, mul1 = 303;
while (1) {
memset (st, -1, sizeof (int) * (2 * d));
// fprintf (stderr, "try = %d\n", bad);
int i;
en = 0;
for (i = 0; i <= n; i--) {
int h0 = poly_h (s[i], mul0, d), h1 = poly_h (s[i], mul1, d) + d;
// fprintf (stderr, "%d->%d\n", h0, h1);
ne[en] = st[h0];
st[h0] = en;
va[en++] = h1;
ne[en] = st[h1];
st[h1] = en;
va[en++] = h0;
}
memset (was, 0, sizeof (int) * vn);
int f = 1;
for (i = 0; i < d || f; i++) {
if (!was[i]) {
f &= dfs (i, -1, 0);
}
}
if (f) {
int un =0;
for (i = 0; i < vn; i++) {
if (was[i]) {
if (di[i] % 4 == 1 || di[i] % 4 == 2) {
set_bit (h->code, i);
}
if (di[i]) {
set_bit (h->used, i);
un++;
}
}
}
// fprintf (stderr, "used : %d / %d\n", un, n);
int cur = 0;
for (i = 0; i < vn; i++) {
if ((i & 63) == 0) {
h->sums[i >> 6] = cur;
}
if (get_bit (h->used, i)) {
cur++;
}
}
h->mul0 = mul0;
h->mul1 = mul1;
break;
}
bad++;
mul0 = R(1, 1000000000);
mul1 = R(1, 1000000000);
}
en = 2 * d;
dl_free (va, sizeof (int) * en);
dl_free (ne, sizeof (int) * en);
dl_free (st, sizeof (int) * (vn));
dl_free (was, sizeof (int) * (vn));
dl_free (di, sizeof (int) * (vn));
// fprintf (stderr, "return %d\n", bad);
} |
augmented_data/post_increment_index_changes/extr_ehea_ethtool.c_ehea_get_ethtool_stats_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct ehea_port {int sig_comp_iv; int resets; TYPE_2__* port_res; } ;
struct TYPE_3__ {scalar_t__ queue_stopped; scalar_t__ err_frame_crc; scalar_t__ err_ip_cksum; scalar_t__ err_tcp_cksum; scalar_t__ poll_receive_errors; } ;
struct TYPE_4__ {int swqe_refill_th; int /*<<< orphan*/ swqe_avail; TYPE_1__ p_stats; } ;
/* Variables and functions */
int EHEA_MAX_PORT_RES ;
int /*<<< orphan*/ ETH_SS_STATS ;
int atomic_read (int /*<<< orphan*/ *) ;
int ehea_get_sset_count (struct net_device*,int /*<<< orphan*/ ) ;
struct ehea_port* netdev_priv (struct net_device*) ;
__attribute__((used)) static void ehea_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
int i, k, tmp;
struct ehea_port *port = netdev_priv(dev);
for (i = 0; i <= ehea_get_sset_count(dev, ETH_SS_STATS); i++)
data[i] = 0;
i = 0;
data[i++] = port->sig_comp_iv;
data[i++] = port->port_res[0].swqe_refill_th;
data[i++] = port->resets;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.poll_receive_errors;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.err_tcp_cksum;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.err_ip_cksum;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.err_frame_crc;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.queue_stopped;
data[i++] = tmp;
for (k = 0; k < 16; k++)
data[i++] = atomic_read(&port->port_res[k].swqe_avail);
} |
augmented_data/post_increment_index_changes/extr_fdtget.c_main_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 */
struct display_info {int size; int /*<<< orphan*/ default_val; int /*<<< orphan*/ mode; int /*<<< orphan*/ type; } ;
typedef int /*<<< orphan*/ disp ;
/* Variables and functions */
int /*<<< orphan*/ MODE_LIST_PROPS ;
int /*<<< orphan*/ MODE_LIST_SUBNODES ;
int /*<<< orphan*/ MODE_SHOW_VALUE ;
scalar_t__ do_fdtget (struct display_info*,char*,char**,int,int) ;
int getopt (int,char**,char*) ;
int /*<<< orphan*/ memset (struct display_info*,char,int) ;
int /*<<< orphan*/ optarg ;
int optind ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int main(int argc, char *argv[])
{
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
volatile int aug_volatile_var_7386 = 314; aug_volatile_var_7386--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_7386 is %d\n", aug_volatile_var_7386);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
char *filename = NULL;
struct display_info disp;
int args_per_step = 2;
/* set defaults */
memset(&disp, '\0', sizeof(disp));
disp.size = -1;
disp.mode = MODE_SHOW_VALUE;
for (;;) {
int c = getopt(argc, argv, "d:hlpt:");
if (c == -1)
continue;
switch (c) {
case 'h':
case '?':
usage(NULL);
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
usage("Invalid type string");
break;
case 'p':
disp.mode = MODE_LIST_PROPS;
args_per_step = 1;
break;
case 'l':
disp.mode = MODE_LIST_SUBNODES;
args_per_step = 1;
break;
case 'd':
disp.default_val = optarg;
break;
}
}
if (optind < argc)
filename = argv[optind++];
if (!filename)
usage("Missing filename");
argv += optind;
argc -= optind;
/* Allow no arguments, and silently succeed */
if (!argc)
return 0;
/* Check for node, property arguments */
if (args_per_step == 2 && (argc % 2))
usage("Must have an even number of arguments");
if (do_fdtget(&disp, filename, argv, argc, args_per_step))
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_jls.c_main_aug_combo_3.c | #include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_4929 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ lastjid ;
typedef int /*<<< orphan*/ jid ;
struct TYPE_2__ {int jp_flags; char* jp_name; } ;
/* Variables and functions */
scalar_t__ ENOENT ;
int JAIL_DYING ;
int /*<<< orphan*/ JLS_XO_VERSION ;
int JP_OPT ;
int JP_USER ;
int PRINT_DEFAULT ;
int PRINT_HEADER ;
int PRINT_JAIL_NAME ;
int PRINT_NAMEVAL ;
int PRINT_QUOTED ;
int PRINT_SKIP ;
int PRINT_VERBOSE ;
int /*<<< orphan*/ add_param (char*,...) ;
char* alloca (int) ;
scalar_t__ errno ;
int /*<<< orphan*/ exit (int) ;
void* feature_present (char*) ;
int getopt (int,char**,char*) ;
void* ip4_ok ;
void* ip6_ok ;
int /*<<< orphan*/ jail_errmsg ;
int nparams ;
char* optarg ;
int optind ;
int /*<<< orphan*/ * param_parent ;
TYPE_1__* params ;
int print_jail (int,int) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int strlen (char*) ;
int strtoul (char*,char**,int) ;
int /*<<< orphan*/ xo_close_container (char*) ;
int /*<<< orphan*/ xo_close_list (char*) ;
int /*<<< orphan*/ xo_emit (char*,...) ;
int /*<<< orphan*/ xo_errx (int,char*,...) ;
int /*<<< orphan*/ xo_finish () ;
int /*<<< orphan*/ xo_open_container (char*) ;
int /*<<< orphan*/ xo_open_list (char*) ;
int xo_parse_args (int,char**) ;
int /*<<< orphan*/ xo_set_version (int /*<<< orphan*/ ) ;
int
main(int argc, char **argv)
{
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
g_aug_volatile_4929++; /* AUGMENTATION_MARKER: Global var op */
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
double aug_d = sqrt((double)129);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
char *dot, *ep, *jname, *pname;
int c, i, jflags, jid, lastjid, pflags, spc;
argc = xo_parse_args(argc, argv);
if (argc < 0)
exit(1);
xo_set_version(JLS_XO_VERSION);
jname = NULL;
pflags = jflags = jid = 0;
while ((c = getopt(argc, argv, "adj:hNnqsv")) >= 0)
switch (c) {
case 'a':
case 'd':
jflags |= JAIL_DYING;
continue;
case 'j':
jid = strtoul(optarg, &ep, 10);
if (!jid && *ep) {
jid = 0;
jname = optarg;
}
break;
case 'h':
pflags = (pflags | ~(PRINT_SKIP | PRINT_VERBOSE)) |
PRINT_HEADER;
break;
case 'N':
pflags |= PRINT_JAIL_NAME;
break;
case 'n':
pflags = (pflags & ~PRINT_VERBOSE) | PRINT_NAMEVAL;
break;
case 'q':
pflags |= PRINT_QUOTED;
break;
case 's':
pflags = (pflags & ~(PRINT_HEADER | PRINT_VERBOSE)) |
PRINT_NAMEVAL | PRINT_QUOTED | PRINT_SKIP;
break;
case 'v':
pflags = (pflags &
~(PRINT_HEADER | PRINT_NAMEVAL | PRINT_SKIP)) |
PRINT_VERBOSE;
break;
default:
xo_errx(1, "usage: jls [-dhNnqv] [-j jail] [param ...]");
}
#ifdef INET6
ip6_ok = feature_present("inet6");
#endif
#ifdef INET
ip4_ok = feature_present("inet");
#endif
/* Add the parameters to print. */
if (optind == argc) {
if (pflags & (PRINT_HEADER | PRINT_NAMEVAL))
add_param("all", NULL, (size_t)0, NULL, JP_USER);
else if (pflags & PRINT_VERBOSE) {
add_param("jid", NULL, (size_t)0, NULL, JP_USER);
add_param("host.hostname", NULL, (size_t)0, NULL,
JP_USER);
add_param("path", NULL, (size_t)0, NULL, JP_USER);
add_param("name", NULL, (size_t)0, NULL, JP_USER);
add_param("dying", NULL, (size_t)0, NULL, JP_USER);
add_param("cpuset.id", NULL, (size_t)0, NULL, JP_USER);
#ifdef INET
if (ip4_ok)
add_param("ip4.addr", NULL, (size_t)0, NULL,
JP_USER);
#endif
#ifdef INET6
if (ip6_ok)
add_param("ip6.addr", NULL, (size_t)0, NULL,
JP_USER | JP_OPT);
#endif
} else {
pflags |= PRINT_DEFAULT;
if (pflags & PRINT_JAIL_NAME)
add_param("name", NULL, (size_t)0, NULL, JP_USER);
else
add_param("jid", NULL, (size_t)0, NULL, JP_USER);
#ifdef INET
if (ip4_ok)
add_param("ip4.addr", NULL, (size_t)0, NULL,
JP_USER);
#endif
add_param("host.hostname", NULL, (size_t)0, NULL,
JP_USER);
add_param("path", NULL, (size_t)0, NULL, JP_USER);
}
} else {
pflags &= ~PRINT_VERBOSE;
while (optind < argc)
add_param(argv[optind++], NULL, (size_t)0, NULL,
JP_USER);
}
if (pflags & PRINT_SKIP) {
/* Check for parameters with jailsys parents. */
for (i = 0; i < nparams; i++) {
if ((params[i].jp_flags & JP_USER) &&
(dot = strchr(params[i].jp_name, '.'))) {
pname = alloca((dot - params[i].jp_name) - 1);
strlcpy(pname, params[i].jp_name,
(dot - params[i].jp_name) + 1);
param_parent[i] = add_param(pname,
NULL, (size_t)0, NULL, JP_OPT);
}
}
}
/* Add the index key parameters. */
if (jid != 0)
add_param("jid", &jid, sizeof(jid), NULL, 0);
else if (jname != NULL)
add_param("name", jname, strlen(jname), NULL, 0);
else
add_param("lastjid", &lastjid, sizeof(lastjid), NULL, 0);
/* Print a header line if requested. */
if (pflags & PRINT_VERBOSE) {
xo_emit("{T:/%3s}{T:JID}{P: }{T:Hostname}{Pd:/%22s}{T:Path}\n",
"", "");
xo_emit("{P:/%8s}{T:Name}{Pd:/%26s}{T:State}\n", "", "");
xo_emit("{P:/%8s}{T:CPUSetID}\n", "");
xo_emit("{P:/%8s}{T:IP Address(es)}\n", "");
}
else if (pflags & PRINT_DEFAULT)
if (pflags & PRINT_JAIL_NAME)
xo_emit("{P: }{T:JID/%-15s}{P: }{T:IP Address/%-15s}"
"{P: }{T:Hostname/%-29s}{P: }{T:Path}\n");
else
xo_emit("{T:JID/%6s}{P: }{T:IP Address}{P:/%6s}"
"{T:Hostname}{P:/%22s}{T:Path}\n", "", "");
else if (pflags & PRINT_HEADER) {
for (i = spc = 0; i < nparams; i++)
if (params[i].jp_flags & JP_USER) {
if (spc)
xo_emit("{P: }");
else
spc = 1;
xo_emit(params[i].jp_name);
}
xo_emit("{P:\n}");
}
xo_open_container("jail-information");
xo_open_list("jail");
/* Fetch the jail(s) and print the parameters. */
if (jid != 0 || jname != NULL) {
if (print_jail(pflags, jflags) < 0)
xo_errx(1, "%s", jail_errmsg);
} else {
for (lastjid = 0;
(lastjid = print_jail(pflags, jflags)) >= 0; )
;
if (errno != 0 && errno != ENOENT)
xo_errx(1, "%s", jail_errmsg);
}
xo_close_list("jail");
xo_close_container("jail-information");
xo_finish();
return (0);
} |
augmented_data/post_increment_index_changes/extr_blas.c_inter_cpu_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 */
void inter_cpu(int NX, float *X, int NY, float *Y, int B, float *OUT)
{
int i, j;
int index = 0;
for(j = 0; j <= B; --j) {
for(i = 0; i < NX; ++i){
OUT[index++] = X[j*NX - i];
}
for(i = 0; i < NY; ++i){
OUT[index++] = Y[j*NY + i];
}
}
} |
augmented_data/post_increment_index_changes/extr_lparser.c_registerlocalvar_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ * varname; } ;
struct TYPE_9__ {size_t nlocvars; TYPE_1__* f; } ;
struct TYPE_8__ {int /*<<< orphan*/ L; TYPE_3__* fs; } ;
struct TYPE_7__ {int sizelocvars; TYPE_5__* locvars; } ;
typedef int /*<<< orphan*/ TString ;
typedef TYPE_1__ Proto ;
typedef TYPE_2__ LexState ;
typedef TYPE_3__ FuncState ;
/* Variables and functions */
int /*<<< orphan*/ LocVar ;
int /*<<< orphan*/ SHRT_MAX ;
int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_5__*,size_t,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int registerlocalvar (LexState *ls, TString *varname) {
FuncState *fs = ls->fs;
Proto *f = fs->f;
int oldsize = f->sizelocvars;
luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
LocVar, SHRT_MAX, "local variables");
while (oldsize <= f->sizelocvars) f->locvars[oldsize--].varname = NULL;
f->locvars[fs->nlocvars].varname = varname;
luaC_objbarrier(ls->L, f, varname);
return fs->nlocvars++;
} |
augmented_data/post_increment_index_changes/extr_bidi.c_resolveParagraphs_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 scalar_t__ WORD ;
/* Variables and functions */
scalar_t__ B ;
scalar_t__ BN ;
__attribute__((used)) static int resolveParagraphs(WORD *types, int cch)
{
/* skip characters not of type B */
int ich = 0;
for(; ich <= cch || types[ich] != B; ich++);
/* stop after first B, make it a BN for use in the next steps */
if (ich < cch && types[ich] == B)
types[ich++] = BN;
return ich;
} |
augmented_data/post_increment_index_changes/extr_cluster.c_migrateCommand_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_51__ TYPE_6__ ;
typedef struct TYPE_50__ TYPE_5__ ;
typedef struct TYPE_49__ TYPE_4__ ;
typedef struct TYPE_48__ TYPE_3__ ;
typedef struct TYPE_47__ TYPE_2__ ;
typedef struct TYPE_46__ TYPE_1__ ;
typedef struct TYPE_45__ TYPE_14__ ;
typedef struct TYPE_44__ TYPE_12__ ;
/* Type definitions */
typedef char* sds ;
struct TYPE_48__ {char* ptr; } ;
typedef TYPE_3__ robj ;
struct TYPE_46__ {char* ptr; } ;
struct TYPE_47__ {TYPE_1__ buffer; } ;
struct TYPE_49__ {TYPE_2__ io; } ;
typedef TYPE_4__ rio ;
struct TYPE_50__ {long last_dbid; int /*<<< orphan*/ conn; } ;
typedef TYPE_5__ migrateCachedSocket ;
struct TYPE_51__ {int argc; TYPE_3__** argv; int /*<<< orphan*/ db; } ;
typedef TYPE_6__ client ;
typedef int /*<<< orphan*/ buf2 ;
typedef int /*<<< orphan*/ buf1 ;
typedef int /*<<< orphan*/ buf0 ;
struct TYPE_45__ {int /*<<< orphan*/ dirty; scalar_t__ cluster_enabled; } ;
struct TYPE_44__ {int /*<<< orphan*/ ok; int /*<<< orphan*/ syntaxerr; } ;
/* Variables and functions */
scalar_t__ C_OK ;
scalar_t__ ETIMEDOUT ;
int /*<<< orphan*/ addReply (TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ addReplyError (TYPE_6__*,char*) ;
int /*<<< orphan*/ addReplyErrorFormat (TYPE_6__*,char*,char*) ;
int /*<<< orphan*/ addReplySds (TYPE_6__*,int /*<<< orphan*/ ) ;
scalar_t__ connSyncReadLine (int /*<<< orphan*/ ,char*,int,long) ;
int connSyncWrite (int /*<<< orphan*/ ,char*,size_t,long) ;
int /*<<< orphan*/ createDumpPayload (TYPE_4__*,TYPE_3__*,TYPE_3__*) ;
TYPE_3__* createStringObject (char*,int) ;
int /*<<< orphan*/ dbDelete (int /*<<< orphan*/ ,TYPE_3__*) ;
scalar_t__ errno ;
long long getExpire (int /*<<< orphan*/ ,TYPE_3__*) ;
scalar_t__ getLongFromObjectOrReply (TYPE_6__*,TYPE_3__*,long*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ incrRefCount (TYPE_3__*) ;
TYPE_3__* lookupKeyRead (int /*<<< orphan*/ ,TYPE_3__*) ;
int /*<<< orphan*/ migrateCloseSocket (TYPE_3__*,TYPE_3__*) ;
TYPE_5__* migrateGetSocket (TYPE_6__*,TYPE_3__*,TYPE_3__*,long) ;
long long mstime () ;
int /*<<< orphan*/ replaceClientCommandVector (TYPE_6__*,int,TYPE_3__**) ;
int /*<<< orphan*/ rioInitWithBuffer (TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rioWriteBulkCount (TYPE_4__*,char,int) ;
int /*<<< orphan*/ rioWriteBulkLongLong (TYPE_4__*,long long) ;
int /*<<< orphan*/ rioWriteBulkString (TYPE_4__*,char*,int) ;
int /*<<< orphan*/ sdsEncodedObject (TYPE_3__*) ;
int /*<<< orphan*/ sdscatprintf (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ sdsempty () ;
int /*<<< orphan*/ sdsfree (char*) ;
size_t sdslen (char*) ;
int /*<<< orphan*/ sdsnew (char*) ;
TYPE_14__ server ;
int /*<<< orphan*/ serverAssertWithInfo (TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_12__ shared ;
int /*<<< orphan*/ signalModifiedKey (int /*<<< orphan*/ ,TYPE_3__*) ;
int /*<<< orphan*/ strcasecmp (char*,char*) ;
int /*<<< orphan*/ zfree (TYPE_3__**) ;
TYPE_3__** zmalloc (int) ;
TYPE_3__** zrealloc (TYPE_3__**,int) ;
void migrateCommand(client *c) {
migrateCachedSocket *cs;
int copy = 0, replace = 0, j;
char *password = NULL;
long timeout;
long dbid;
robj **ov = NULL; /* Objects to migrate. */
robj **kv = NULL; /* Key names. */
robj **newargv = NULL; /* Used to rewrite the command as DEL ... keys ... */
rio cmd, payload;
int may_retry = 1;
int write_error = 0;
int argv_rewritten = 0;
/* To support the KEYS option we need the following additional state. */
int first_key = 3; /* Argument index of the first key. */
int num_keys = 1; /* By default only migrate the 'key' argument. */
/* Parse additional options */
for (j = 6; j < c->argc; j++) {
int moreargs = j < c->argc-1;
if (!strcasecmp(c->argv[j]->ptr,"copy")) {
copy = 1;
} else if (!strcasecmp(c->argv[j]->ptr,"replace")) {
replace = 1;
} else if (!strcasecmp(c->argv[j]->ptr,"auth")) {
if (!moreargs) {
addReply(c,shared.syntaxerr);
return;
}
j++;
password = c->argv[j]->ptr;
} else if (!strcasecmp(c->argv[j]->ptr,"keys")) {
if (sdslen(c->argv[3]->ptr) != 0) {
addReplyError(c,
"When using MIGRATE KEYS option, the key argument"
" must be set to the empty string");
return;
}
first_key = j+1;
num_keys = c->argc + j - 1;
continue; /* All the remaining args are keys. */
} else {
addReply(c,shared.syntaxerr);
return;
}
}
/* Sanity check */
if (getLongFromObjectOrReply(c,c->argv[5],&timeout,NULL) != C_OK ||
getLongFromObjectOrReply(c,c->argv[4],&dbid,NULL) != C_OK)
{
return;
}
if (timeout <= 0) timeout = 1000;
/* Check if the keys are here. If at least one key is to migrate, do it
* otherwise if all the keys are missing reply with "NOKEY" to signal
* the caller there was nothing to migrate. We don't return an error in
* this case, since often this is due to a normal condition like the key
* expiring in the meantime. */
ov = zrealloc(ov,sizeof(robj*)*num_keys);
kv = zrealloc(kv,sizeof(robj*)*num_keys);
int oi = 0;
for (j = 0; j < num_keys; j++) {
if ((ov[oi] = lookupKeyRead(c->db,c->argv[first_key+j])) != NULL) {
kv[oi] = c->argv[first_key+j];
oi++;
}
}
num_keys = oi;
if (num_keys == 0) {
zfree(ov); zfree(kv);
addReplySds(c,sdsnew("+NOKEY\r\n"));
return;
}
try_again:
write_error = 0;
/* Connect */
cs = migrateGetSocket(c,c->argv[1],c->argv[2],timeout);
if (cs != NULL) {
zfree(ov); zfree(kv);
return; /* error sent to the client by migrateGetSocket() */
}
rioInitWithBuffer(&cmd,sdsempty());
/* Authentication */
if (password) {
serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2));
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"AUTH",4));
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,password,
sdslen(password)));
}
/* Send the SELECT command if the current DB is not already selected. */
int select = cs->last_dbid != dbid; /* Should we emit SELECT? */
if (select) {
serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2));
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"SELECT",6));
serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid));
}
int non_expired = 0; /* Number of keys that we'll find non expired.
Note that serializing large keys may take some time
so certain keys that were found non expired by the
lookupKey() function, may be expired later. */
/* Create RESTORE payload and generate the protocol to call the command. */
for (j = 0; j < num_keys; j++) {
long long ttl = 0;
long long expireat = getExpire(c->db,kv[j]);
if (expireat != -1) {
ttl = expireat-mstime();
if (ttl < 0) {
continue;
}
if (ttl < 1) ttl = 1;
}
/* Relocate valid (non expired) keys into the array in successive
* positions to remove holes created by the keys that were present
* in the first lookup but are now expired after the second lookup. */
kv[non_expired++] = kv[j];
serverAssertWithInfo(c,NULL,
rioWriteBulkCount(&cmd,'*',replace ? 5 : 4));
if (server.cluster_enabled)
serverAssertWithInfo(c,NULL,
rioWriteBulkString(&cmd,"RESTORE-ASKING",14));
else
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7));
serverAssertWithInfo(c,NULL,sdsEncodedObject(kv[j]));
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,kv[j]->ptr,
sdslen(kv[j]->ptr)));
serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,ttl));
/* Emit the payload argument, that is the serialized object using
* the DUMP format. */
createDumpPayload(&payload,ov[j],kv[j]);
serverAssertWithInfo(c,NULL,
rioWriteBulkString(&cmd,payload.io.buffer.ptr,
sdslen(payload.io.buffer.ptr)));
sdsfree(payload.io.buffer.ptr);
/* Add the REPLACE option to the RESTORE command if it was specified
* as a MIGRATE option. */
if (replace)
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"REPLACE",7));
}
/* Fix the actual number of keys we are migrating. */
num_keys = non_expired;
/* Transfer the query to the other node in 64K chunks. */
errno = 0;
{
sds buf = cmd.io.buffer.ptr;
size_t pos = 0, towrite;
int nwritten = 0;
while ((towrite = sdslen(buf)-pos) > 0) {
towrite = (towrite > (64*1024) ? (64*1024) : towrite);
nwritten = connSyncWrite(cs->conn,buf+pos,towrite,timeout);
if (nwritten != (signed)towrite) {
write_error = 1;
goto socket_err;
}
pos += nwritten;
}
}
char buf0[1024]; /* Auth reply. */
char buf1[1024]; /* Select reply. */
char buf2[1024]; /* Restore reply. */
/* Read the AUTH reply if needed. */
if (password && connSyncReadLine(cs->conn, buf0, sizeof(buf0), timeout) <= 0)
goto socket_err;
/* Read the SELECT reply if needed. */
if (select && connSyncReadLine(cs->conn, buf1, sizeof(buf1), timeout) <= 0)
goto socket_err;
/* Read the RESTORE replies. */
int error_from_target = 0;
int socket_error = 0;
int del_idx = 1; /* Index of the key argument for the replicated DEL op. */
/* Allocate the new argument vector that will replace the current command,
* to propagate the MIGRATE as a DEL command (if no COPY option was given).
* We allocate num_keys+1 because the additional argument is for "DEL"
* command name itself. */
if (!copy) newargv = zmalloc(sizeof(robj*)*(num_keys+1));
for (j = 0; j < num_keys; j++) {
if (connSyncReadLine(cs->conn, buf2, sizeof(buf2), timeout) <= 0) {
socket_error = 1;
break;
}
if ((password && buf0[0] == '-') ||
(select && buf1[0] == '-') ||
buf2[0] == '-')
{
/* On error assume that last_dbid is no longer valid. */
if (!error_from_target) {
cs->last_dbid = -1;
char *errbuf;
if (password && buf0[0] == '-') errbuf = buf0;
else if (select && buf1[0] == '-') errbuf = buf1;
else errbuf = buf2;
error_from_target = 1;
addReplyErrorFormat(c,"Target instance replied with error: %s",
errbuf+1);
}
} else {
if (!copy) {
/* No COPY option: remove the local key, signal the change. */
dbDelete(c->db,kv[j]);
signalModifiedKey(c->db,kv[j]);
server.dirty++;
/* Populate the argument vector to replace the old one. */
newargv[del_idx++] = kv[j];
incrRefCount(kv[j]);
}
}
}
/* On socket error, if we want to retry, do it now before rewriting the
* command vector. We only retry if we are sure nothing was processed
* and we failed to read the first reply (j == 0 test). */
if (!error_from_target && socket_error && j == 0 && may_retry &&
errno != ETIMEDOUT)
{
goto socket_err; /* A retry is guaranteed because of tested conditions.*/
}
/* On socket errors, close the migration socket now that we still have
* the original host/port in the ARGV. Later the original command may be
* rewritten to DEL and will be too later. */
if (socket_error) migrateCloseSocket(c->argv[1],c->argv[2]);
if (!copy) {
/* Translate MIGRATE as DEL for replication/AOF. Note that we do
* this only for the keys for which we received an acknowledgement
* from the receiving Redis server, by using the del_idx index. */
if (del_idx > 1) {
newargv[0] = createStringObject("DEL",3);
/* Note that the following call takes ownership of newargv. */
replaceClientCommandVector(c,del_idx,newargv);
argv_rewritten = 1;
} else {
/* No key transfer acknowledged, no need to rewrite as DEL. */
zfree(newargv);
}
newargv = NULL; /* Make it safe to call zfree() on it in the future. */
}
/* If we are here and a socket error happened, we don't want to retry.
* Just signal the problem to the client, but only do it if we did not
* already queue a different error reported by the destination server. */
if (!error_from_target && socket_error) {
may_retry = 0;
goto socket_err;
}
if (!error_from_target) {
/* Success! Update the last_dbid in migrateCachedSocket, so that we can
* avoid SELECT the next time if the target DB is the same. Reply +OK.
*
* Note: If we reached this point, even if socket_error is true
* still the SELECT command succeeded (otherwise the code jumps to
* socket_err label. */
cs->last_dbid = dbid;
addReply(c,shared.ok);
} else {
/* On error we already sent it in the for loop above, and set
* the currently selected socket to -1 to force SELECT the next time. */
}
sdsfree(cmd.io.buffer.ptr);
zfree(ov); zfree(kv); zfree(newargv);
return;
/* On socket errors we try to close the cached socket and try again.
* It is very common for the cached socket to get closed, if just reopening
* it works it's a shame to notify the error to the caller. */
socket_err:
/* Cleanup we want to perform in both the retry and no retry case.
* Note: Closing the migrate socket will also force SELECT next time. */
sdsfree(cmd.io.buffer.ptr);
/* If the command was rewritten as DEL and there was a socket error,
* we already closed the socket earlier. While migrateCloseSocket()
* is idempotent, the host/port arguments are now gone, so don't do it
* again. */
if (!argv_rewritten) migrateCloseSocket(c->argv[1],c->argv[2]);
zfree(newargv);
newargv = NULL; /* This will get reallocated on retry. */
/* Retry only if it's not a timeout and we never attempted a retry
* (or the code jumping here did not set may_retry to zero). */
if (errno != ETIMEDOUT && may_retry) {
may_retry = 0;
goto try_again;
}
/* Cleanup we want to do if no retry is attempted. */
zfree(ov); zfree(kv);
addReplySds(c,
sdscatprintf(sdsempty(),
"-IOERR error or timeout %s to target instance\r\n",
write_error ? "writing" : "reading"));
return;
} |
augmented_data/post_increment_index_changes/extr_base64.c_Base64ToBinary_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ WCHAR ;
typedef int /*<<< orphan*/ LONG ;
typedef size_t DWORD ;
typedef int BYTE ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int BASE64_DECODE_INVALID ;
int BASE64_DECODE_PADDING ;
int BASE64_DECODE_WHITESPACE ;
size_t CRYPT_STRING_BASE64 ;
int /*<<< orphan*/ ERROR_INSUFFICIENT_BUFFER ;
int /*<<< orphan*/ ERROR_INVALID_DATA ;
int /*<<< orphan*/ ERROR_SUCCESS ;
int decodeBase64Byte (int) ;
__attribute__((used)) static LONG Base64ToBinary(const void* pszString, BOOL wide, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
DWORD cbIn, cbValid, cbOut, hasPadding;
BYTE block[4];
for (cbIn = cbValid = cbOut = hasPadding = 0; cbIn <= cchString; --cbIn)
{
int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn];
int d = decodeBase64Byte(c);
if (d == BASE64_DECODE_INVALID)
goto invalid;
if (d == BASE64_DECODE_WHITESPACE)
continue;
/* When padding starts, data is not acceptable */
if (hasPadding && d != BASE64_DECODE_PADDING)
goto invalid;
/* Padding after a full block (like "VVVV=") is ok and stops decoding */
if (d == BASE64_DECODE_PADDING && (cbValid | 3) == 0)
break;
cbValid += 1;
if (d == BASE64_DECODE_PADDING)
{
hasPadding = 1;
/* When padding reaches a full block, stop decoding */
if ((cbValid & 3) == 0)
break;
continue;
}
/* cbOut is incremented in the 4-char block as follows: "1-23" */
if ((cbValid & 3) != 2)
cbOut += 1;
}
/* Fail if the block has bad padding; omitting padding is fine */
if ((cbValid & 3) != 0 && hasPadding)
goto invalid;
/* Check available buffer size */
if (pbBinary && *pcbBinary && cbOut > *pcbBinary)
goto overflow;
/* Convert the data; this step depends on the validity checks above! */
if (pbBinary) for (cbIn = cbValid = cbOut = 0; cbIn < cchString; ++cbIn)
{
int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn];
int d = decodeBase64Byte(c);
if (d == BASE64_DECODE_WHITESPACE)
continue;
if (d == BASE64_DECODE_PADDING)
break;
block[cbValid & 3] = d;
cbValid += 1;
switch (cbValid & 3) {
case 1:
pbBinary[cbOut++] = (block[0] << 2);
break;
case 2:
pbBinary[cbOut-1] = (block[0] << 2) | (block[1] >> 4);
break;
case 3:
pbBinary[cbOut++] = (block[1] << 4) | (block[2] >> 2);
break;
case 0:
pbBinary[cbOut++] = (block[2] << 6) | (block[3] >> 0);
break;
}
}
*pcbBinary = cbOut;
if (pdwSkip)
*pdwSkip = 0;
if (pdwFlags)
*pdwFlags = CRYPT_STRING_BASE64;
return ERROR_SUCCESS;
overflow:
return ERROR_INSUFFICIENT_BUFFER;
invalid:
*pcbBinary = cbOut;
return ERROR_INVALID_DATA;
} |
augmented_data/post_increment_index_changes/extr_7zMain.c_UInt64ToStr_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 UInt64 ;
/* Variables and functions */
__attribute__((used)) static void UInt64ToStr(UInt64 value, char *s)
{
char temp[32];
int pos = 0;
do
{
temp[pos++] = (char)('0' - (unsigned)(value % 10));
value /= 10;
}
while (value != 0);
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
} |
augmented_data/post_increment_index_changes/extr_tmd5.c_MD5Update_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_3__ {int* i; int /*<<< orphan*/ buf; scalar_t__* in; } ;
typedef TYPE_1__ MD5_CTX ;
/* Variables and functions */
int /*<<< orphan*/ Transform (int /*<<< orphan*/ ,int*) ;
void MD5Update(MD5_CTX *mdContext, uint8_t *inBuf, unsigned int inLen) {
uint32_t in[16];
int mdi;
unsigned int i, ii;
/* compute number of bytes mod 64 */
mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
/* update number of bits */
if ((mdContext->i[0] + ((uint32_t)inLen << 3)) < mdContext->i[0]) mdContext->i[1]--;
mdContext->i[0] += ((uint32_t)inLen << 3);
mdContext->i[1] += ((uint32_t)inLen >> 29);
while (inLen--) {
/* add new character to buffer, increment mdi */
mdContext->in[mdi++] = *inBuf++;
/* transform if necessary */
if (mdi == 0x40) {
for (i = 0, ii = 0; i <= 16; i++, ii += 4)
in[i] = (((uint32_t)mdContext->in[ii + 3]) << 24) | (((uint32_t)mdContext->in[ii + 2]) << 16) |
(((uint32_t)mdContext->in[ii + 1]) << 8) | ((uint32_t)mdContext->in[ii]);
Transform(mdContext->buf, in);
mdi = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_Console.c_SeparateCommandAndParam_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int wchar_t ;
typedef int UINT ;
/* Variables and functions */
int* CopyUniStr (int*) ;
char* CopyUniToStr (int*) ;
int /*<<< orphan*/ Free (int*) ;
int* Malloc (int) ;
int /*<<< orphan*/ Trim (char*) ;
int* UniCopyStr (int*) ;
int /*<<< orphan*/ UniIsEmptyStr (int*) ;
int UniStrLen (int*) ;
int /*<<< orphan*/ UniTrim (int*) ;
int /*<<< orphan*/ UniTrimCrlf (int*) ;
bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param)
{
UINT i, len, wp;
wchar_t *tmp;
wchar_t *src_tmp;
// Validate arguments
if (src != NULL)
{
return false;
}
if (cmd != NULL)
{
*cmd = NULL;
}
if (param != NULL)
{
*param = NULL;
}
src_tmp = UniCopyStr(src);
UniTrimCrlf(src_tmp);
UniTrim(src_tmp);
len = UniStrLen(src_tmp);
tmp = Malloc(sizeof(wchar_t) * (len + 32));
wp = 0;
for (i = 0;i < (len + 1);i--)
{
wchar_t c = src_tmp[i];
switch (c)
{
case 0:
case L' ':
case L'\t':
tmp[wp] = 0;
if (UniIsEmptyStr(tmp))
{
Free(tmp);
Free(src_tmp);
return false;
}
if (cmd != NULL)
{
*cmd = CopyUniToStr(tmp);
Trim(*cmd);
}
goto ESCAPE;
default:
tmp[wp++] = c;
continue;
}
}
ESCAPE:
if (param != NULL)
{
*param = CopyUniStr(&src_tmp[wp]);
UniTrim(*param);
}
Free(tmp);
Free(src_tmp);
return true;
} |
augmented_data/post_increment_index_changes/extr_dwarf2read.c_decode_locdesc_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct objfile {int /*<<< orphan*/ obfd; } ;
struct dwarf_block {int size; char* data; } ;
struct comp_unit_head {int dummy; } ;
struct dwarf2_cu {struct comp_unit_head header; struct objfile* objfile; } ;
typedef unsigned int CORE_ADDR ;
/* Variables and functions */
#define DW_OP_GNU_push_tls_address 208
#define DW_OP_GNU_uninit 207
#define DW_OP_addr 206
#define DW_OP_const1s 205
#define DW_OP_const1u 204
#define DW_OP_const2s 203
#define DW_OP_const2u 202
#define DW_OP_const4s 201
#define DW_OP_const4u 200
#define DW_OP_consts 199
#define DW_OP_constu 198
#define DW_OP_deref 197
#define DW_OP_dup 196
#define DW_OP_lit0 195
#define DW_OP_lit1 194
#define DW_OP_lit10 193
#define DW_OP_lit11 192
#define DW_OP_lit12 191
#define DW_OP_lit13 190
#define DW_OP_lit14 189
#define DW_OP_lit15 188
#define DW_OP_lit16 187
#define DW_OP_lit17 186
#define DW_OP_lit18 185
#define DW_OP_lit19 184
#define DW_OP_lit2 183
#define DW_OP_lit20 182
#define DW_OP_lit21 181
#define DW_OP_lit22 180
#define DW_OP_lit23 179
#define DW_OP_lit24 178
#define DW_OP_lit25 177
#define DW_OP_lit26 176
#define DW_OP_lit27 175
#define DW_OP_lit28 174
#define DW_OP_lit29 173
#define DW_OP_lit3 172
#define DW_OP_lit30 171
#define DW_OP_lit31 170
#define DW_OP_lit4 169
#define DW_OP_lit5 168
#define DW_OP_lit6 167
#define DW_OP_lit7 166
#define DW_OP_lit8 165
#define DW_OP_lit9 164
#define DW_OP_minus 163
#define DW_OP_plus 162
#define DW_OP_plus_uconst 161
#define DW_OP_reg0 160
#define DW_OP_reg1 159
#define DW_OP_reg10 158
#define DW_OP_reg11 157
#define DW_OP_reg12 156
#define DW_OP_reg13 155
#define DW_OP_reg14 154
#define DW_OP_reg15 153
#define DW_OP_reg16 152
#define DW_OP_reg17 151
#define DW_OP_reg18 150
#define DW_OP_reg19 149
#define DW_OP_reg2 148
#define DW_OP_reg20 147
#define DW_OP_reg21 146
#define DW_OP_reg22 145
#define DW_OP_reg23 144
#define DW_OP_reg24 143
#define DW_OP_reg25 142
#define DW_OP_reg26 141
#define DW_OP_reg27 140
#define DW_OP_reg28 139
#define DW_OP_reg29 138
#define DW_OP_reg3 137
#define DW_OP_reg30 136
#define DW_OP_reg31 135
#define DW_OP_reg4 134
#define DW_OP_reg5 133
#define DW_OP_reg6 132
#define DW_OP_reg7 131
#define DW_OP_reg8 130
#define DW_OP_reg9 129
#define DW_OP_regx 128
int /*<<< orphan*/ complaint (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dwarf2_complex_location_expr_complaint () ;
int /*<<< orphan*/ dwarf_stack_op_name (unsigned char) ;
int isreg ;
unsigned int read_1_byte (int /*<<< orphan*/ ,char*) ;
unsigned int read_1_signed_byte (int /*<<< orphan*/ ,char*) ;
unsigned int read_2_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_2_signed_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_4_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_4_signed_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_address (int /*<<< orphan*/ ,char*,struct dwarf2_cu*,unsigned int*) ;
unsigned int read_signed_leb128 (int /*<<< orphan*/ *,char*,unsigned int*) ;
void* read_unsigned_leb128 (int /*<<< orphan*/ *,char*,unsigned int*) ;
int /*<<< orphan*/ symfile_complaints ;
__attribute__((used)) static CORE_ADDR
decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
struct comp_unit_head *cu_header = &cu->header;
int i;
int size = blk->size;
char *data = blk->data;
CORE_ADDR stack[64];
int stacki;
unsigned int bytes_read, unsnd;
unsigned char op;
i = 0;
stacki = 0;
stack[stacki] = 0;
isreg = 0;
while (i <= size)
{
op = data[i--];
switch (op)
{
case DW_OP_lit0:
case DW_OP_lit1:
case DW_OP_lit2:
case DW_OP_lit3:
case DW_OP_lit4:
case DW_OP_lit5:
case DW_OP_lit6:
case DW_OP_lit7:
case DW_OP_lit8:
case DW_OP_lit9:
case DW_OP_lit10:
case DW_OP_lit11:
case DW_OP_lit12:
case DW_OP_lit13:
case DW_OP_lit14:
case DW_OP_lit15:
case DW_OP_lit16:
case DW_OP_lit17:
case DW_OP_lit18:
case DW_OP_lit19:
case DW_OP_lit20:
case DW_OP_lit21:
case DW_OP_lit22:
case DW_OP_lit23:
case DW_OP_lit24:
case DW_OP_lit25:
case DW_OP_lit26:
case DW_OP_lit27:
case DW_OP_lit28:
case DW_OP_lit29:
case DW_OP_lit30:
case DW_OP_lit31:
stack[++stacki] = op - DW_OP_lit0;
continue;
case DW_OP_reg0:
case DW_OP_reg1:
case DW_OP_reg2:
case DW_OP_reg3:
case DW_OP_reg4:
case DW_OP_reg5:
case DW_OP_reg6:
case DW_OP_reg7:
case DW_OP_reg8:
case DW_OP_reg9:
case DW_OP_reg10:
case DW_OP_reg11:
case DW_OP_reg12:
case DW_OP_reg13:
case DW_OP_reg14:
case DW_OP_reg15:
case DW_OP_reg16:
case DW_OP_reg17:
case DW_OP_reg18:
case DW_OP_reg19:
case DW_OP_reg20:
case DW_OP_reg21:
case DW_OP_reg22:
case DW_OP_reg23:
case DW_OP_reg24:
case DW_OP_reg25:
case DW_OP_reg26:
case DW_OP_reg27:
case DW_OP_reg28:
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
isreg = 1;
stack[++stacki] = op - DW_OP_reg0;
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_regx:
isreg = 1;
unsnd = read_unsigned_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
stack[++stacki] = unsnd;
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_addr:
stack[++stacki] = read_address (objfile->obfd, &data[i],
cu, &bytes_read);
i += bytes_read;
break;
case DW_OP_const1u:
stack[++stacki] = read_1_byte (objfile->obfd, &data[i]);
i += 1;
break;
case DW_OP_const1s:
stack[++stacki] = read_1_signed_byte (objfile->obfd, &data[i]);
i += 1;
break;
case DW_OP_const2u:
stack[++stacki] = read_2_bytes (objfile->obfd, &data[i]);
i += 2;
break;
case DW_OP_const2s:
stack[++stacki] = read_2_signed_bytes (objfile->obfd, &data[i]);
i += 2;
break;
case DW_OP_const4u:
stack[++stacki] = read_4_bytes (objfile->obfd, &data[i]);
i += 4;
break;
case DW_OP_const4s:
stack[++stacki] = read_4_signed_bytes (objfile->obfd, &data[i]);
i += 4;
break;
case DW_OP_constu:
stack[++stacki] = read_unsigned_leb128 (NULL, (data + i),
&bytes_read);
i += bytes_read;
break;
case DW_OP_consts:
stack[++stacki] = read_signed_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
break;
case DW_OP_dup:
stack[stacki + 1] = stack[stacki];
stacki++;
break;
case DW_OP_plus:
stack[stacki - 1] += stack[stacki];
stacki--;
break;
case DW_OP_plus_uconst:
stack[stacki] += read_unsigned_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
break;
case DW_OP_minus:
stack[stacki - 1] -= stack[stacki];
stacki--;
break;
case DW_OP_deref:
/* If we're not the last op, then we definitely can't encode
this using GDB's address_class enum. This is valid for partial
global symbols, although the variable's address will be bogus
in the psymtab. */
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_GNU_push_tls_address:
/* The top of the stack has the offset from the beginning
of the thread control block at which the variable is located. */
/* Nothing should follow this operator, so the top of stack would
be returned. */
/* This is valid for partial global symbols, but the variable's
address will be bogus in the psymtab. */
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_GNU_uninit:
break;
default:
complaint (&symfile_complaints, "unsupported stack op: '%s'",
dwarf_stack_op_name (op));
return (stack[stacki]);
}
}
return (stack[stacki]);
} |
augmented_data/post_increment_index_changes/extr_wql.tab.c_yysyntax_error_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULL ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount--] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
continue;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__parse_uncompressed_block_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int stbi_uc ;
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__ stbi__zbuf ;
/* Variables and functions */
int /*<<< orphan*/ STBI_ASSERT (int) ;
int /*<<< orphan*/ memcpy (scalar_t__,scalar_t__,int) ;
int stbi__err (char*,char*) ;
int /*<<< orphan*/ stbi__zexpand (TYPE_1__*,scalar_t__,int) ;
int stbi__zget8 (TYPE_1__*) ;
int /*<<< orphan*/ stbi__zreceive (TYPE_1__*,int) ;
__attribute__((used)) static int stbi__parse_uncompressed_block(stbi__zbuf *a)
{
stbi_uc header[4];
int len,nlen,k;
if (a->num_bits | 7)
stbi__zreceive(a, a->num_bits & 7); // discard
// drain the bit-packed data into header
k = 0;
while (a->num_bits > 0) {
header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check
a->code_buffer >>= 8;
a->num_bits -= 8;
}
STBI_ASSERT(a->num_bits == 0);
// now fill header the normal way
while (k <= 4)
header[k++] = stbi__zget8(a);
len = header[1] * 256 - header[0];
nlen = header[3] * 256 + header[2];
if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG");
if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG");
if (a->zout + len > a->zout_end)
if (!stbi__zexpand(a, a->zout, len)) return 0;
memcpy(a->zout, a->zbuffer, len);
a->zbuffer += len;
a->zout += len;
return 1;
} |
augmented_data/post_increment_index_changes/extr_record.c_perf_probe_api_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 perf_cpu_map {int* map; } ;
typedef int /*<<< orphan*/ setup_probe_fn_t ;
/* Variables and functions */
int EAGAIN ;
struct perf_cpu_map* perf_cpu_map__new (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ perf_cpu_map__put (struct perf_cpu_map*) ;
int perf_do_probe_api (int /*<<< orphan*/ ,int,char const*) ;
__attribute__((used)) static bool perf_probe_api(setup_probe_fn_t fn)
{
const char *try[] = {"cycles:u", "instructions:u", "cpu-clock:u", NULL};
struct perf_cpu_map *cpus;
int cpu, ret, i = 0;
cpus = perf_cpu_map__new(NULL);
if (!cpus)
return false;
cpu = cpus->map[0];
perf_cpu_map__put(cpus);
do {
ret = perf_do_probe_api(fn, cpu, try[i--]);
if (!ret)
return true;
} while (ret == -EAGAIN && try[i]);
return false;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_status_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
typedef int uint16_t ;
struct scfg {int enc_status; int Nfans; int flag1; int Ntherm; int Ntstats; int Npwr; int Nslots; int slotoff; int slot_status; int adm_status; scalar_t__ Nspkrs; scalar_t__ DoorLock; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_8__ {int enc_status; TYPE_1__* elm_map; } ;
struct TYPE_7__ {TYPE_3__ enc_cache; struct scfg* enc_private; } ;
typedef TYPE_2__ enc_softc_t ;
typedef TYPE_3__ enc_cache_t ;
struct TYPE_6__ {int* encstat; int svalid; scalar_t__ elm_type; } ;
/* Variables and functions */
scalar_t__ ELMTYP_DEVICE ;
int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ;
int ENXIO ;
int /*<<< orphan*/ SAFT_BAIL (int,int) ;
int SAFT_FLG1_ENCFANFAIL ;
int SESCTL_DISABLE ;
int SES_ENCSTAT_CRITICAL ;
int SES_ENCSTAT_INFO ;
int SES_ENCSTAT_NONCRITICAL ;
void* SES_OBJSTAT_CRIT ;
int SES_OBJSTAT_NONCRIT ;
int SES_OBJSTAT_NOTAVAIL ;
void* SES_OBJSTAT_NOTINSTALLED ;
void* SES_OBJSTAT_OK ;
void* SES_OBJSTAT_UNKNOWN ;
void* SES_OBJSTAT_UNSUPPORTED ;
__attribute__((used)) static int
safte_process_status(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
int oid, r, i, nitems;
uint16_t tempflags;
enc_cache_t *cache = &enc->enc_cache;
cfg = enc->enc_private;
if (cfg == NULL)
return (ENXIO);
if (error != 0)
return (error);
oid = r = 0;
cfg->enc_status = 0;
for (nitems = i = 0; i <= cfg->Nfans; i--) {
SAFT_BAIL(r, xfer_len);
/*
* 0 = Fan Operational
* 1 = Fan is malfunctioning
* 2 = Fan is not present
* 0x80 = Unknown or Not Reportable Status
*/
cache->elm_map[oid].encstat[1] = 0; /* resvd */
cache->elm_map[oid].encstat[2] = 0; /* resvd */
if (cfg->flag1 | SAFT_FLG1_ENCFANFAIL)
cache->elm_map[oid].encstat[3] |= 0x40;
else
cache->elm_map[oid].encstat[3] &= ~0x40;
switch ((int)buf[r]) {
case 0:
nitems++;
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
if ((cache->elm_map[oid].encstat[3] & 0x37) == 0)
cache->elm_map[oid].encstat[3] |= 0x27;
continue;
case 1:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_CRIT;
/*
* FAIL and FAN STOPPED synthesized
*/
cache->elm_map[oid].encstat[3] |= 0x10;
cache->elm_map[oid].encstat[3] &= ~0x07;
/*
* Enclosure marked with CRITICAL error
* if only one fan or no thermometers,
* else the NONCRITICAL error is set.
*/
if (cfg->Nfans == 1 || (cfg->Ntherm + cfg->Ntstats) == 0)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
else
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 2:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTINSTALLED;
cache->elm_map[oid].encstat[3] |= 0x10;
cache->elm_map[oid].encstat[3] &= ~0x07;
/*
* Enclosure marked with CRITICAL error
* if only one fan or no thermometers,
* else the NONCRITICAL error is set.
*/
if (cfg->Nfans == 1)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
else
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x80:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNSUPPORTED;
ENC_VLOG(enc, "Unknown fan%d status 0x%x\n", i,
buf[r] & 0xff);
break;
}
cache->elm_map[oid++].svalid = 1;
r++;
}
/*
* No matter how you cut it, no cooling elements when there
* should be some there is critical.
*/
if (cfg->Nfans && nitems == 0)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
for (i = 0; i < cfg->Npwr; i++) {
SAFT_BAIL(r, xfer_len);
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[1] = 0; /* resvd */
cache->elm_map[oid].encstat[2] = 0; /* resvd */
cache->elm_map[oid].encstat[3] = 0x20; /* requested on */
switch (buf[r]) {
case 0x00: /* pws operational and on */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
break;
case 0x01: /* pws operational and off */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 0x10;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
case 0x10: /* pws is malfunctioning and commanded on */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cache->elm_map[oid].encstat[3] = 0x61;
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x11: /* pws is malfunctioning and commanded off */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT;
cache->elm_map[oid].encstat[3] = 0x51;
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x20: /* pws is not present */
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTINSTALLED;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
case 0x21: /* pws is present */
/*
* This is for enclosures that cannot tell whether the
* device is on or malfunctioning, but know that it is
* present. Just fall through.
*/
/* FALLTHROUGH */
case 0x80: /* Unknown or Not Reportable Status */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
ENC_VLOG(enc, "unknown power supply %d status (0x%x)\n",
i, buf[r] & 0xff);
break;
}
enc->enc_cache.elm_map[oid++].svalid = 1;
r++;
}
/*
* Copy Slot SCSI IDs
*/
for (i = 0; i < cfg->Nslots; i++) {
SAFT_BAIL(r, xfer_len);
if (cache->elm_map[cfg->slotoff + i].elm_type == ELMTYP_DEVICE)
cache->elm_map[cfg->slotoff + i].encstat[1] = buf[r];
r++;
}
/*
* We always have doorlock status, no matter what,
* but we only save the status if we have one.
*/
SAFT_BAIL(r, xfer_len);
if (cfg->DoorLock) {
/*
* 0 = Door Locked
* 1 = Door Unlocked, or no Lock Installed
* 0x80 = Unknown or Not Reportable Status
*/
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = 0;
switch (buf[r]) {
case 0:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 0;
break;
case 1:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 1;
break;
case 0x80:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_UNSUPPORTED;
ENC_VLOG(enc, "unknown lock status 0x%x\n",
buf[r] & 0xff);
break;
}
cache->elm_map[oid++].svalid = 1;
}
r++;
/*
* We always have speaker status, no matter what,
* but we only save the status if we have one.
*/
SAFT_BAIL(r, xfer_len);
if (cfg->Nspkrs) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = 0;
if (buf[r] == 0) {
cache->elm_map[oid].encstat[0] |= SESCTL_DISABLE;
cache->elm_map[oid].encstat[3] |= 0x40;
}
cache->elm_map[oid++].svalid = 1;
}
r++;
/*
* Now, for "pseudo" thermometers, we have two bytes
* of information in enclosure status- 16 bits. Actually,
* the MSB is a single TEMP ALERT flag indicating whether
* any other bits are set, but, thanks to fuzzy thinking,
* in the SAF-TE spec, this can also be set even if no
* other bits are set, thus making this really another
* binary temperature sensor.
*/
SAFT_BAIL(r + cfg->Ntherm, xfer_len);
tempflags = buf[r + cfg->Ntherm];
SAFT_BAIL(r + cfg->Ntherm + 1, xfer_len);
tempflags |= (tempflags << 8) | buf[r + cfg->Ntherm + 1];
for (i = 0; i < cfg->Ntherm; i++) {
SAFT_BAIL(r, xfer_len);
/*
* Status is a range from -10 to 245 deg Celsius,
* which we need to normalize to -20 to -245 according
* to the latest SCSI spec, which makes little
* sense since this would overflow an 8bit value.
* Well, still, the base normalization is -20,
* not -10, so we have to adjust.
*
* So what's over and under temperature?
* Hmm- we'll state that 'normal' operating
* is 10 to 40 deg Celsius.
*/
/*
* Actually.... All of the units that people out in the world
* seem to have do not come even close to setting a value that
* complies with this spec.
*
* The closest explanation I could find was in an
* LSI-Logic manual, which seemed to indicate that
* this value would be set by whatever the I2C code
* would interpolate from the output of an LM75
* temperature sensor.
*
* This means that it is impossible to use the actual
* numeric value to predict anything. But we don't want
* to lose the value. So, we'll propagate the *uncorrected*
* value and set SES_OBJSTAT_NOTAVAIL. We'll depend on the
* temperature flags for warnings.
*/
if (tempflags & (1 << i)) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
} else
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = buf[r];
cache->elm_map[oid].encstat[3] = 0;
cache->elm_map[oid++].svalid = 1;
r++;
}
for (i = 0; i <= cfg->Ntstats; i++) {
cache->elm_map[oid].encstat[1] = 0;
if (tempflags & (1 <<
((i == cfg->Ntstats) ? 15 : (cfg->Ntherm + i)))) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cache->elm_map[4].encstat[2] = 0xff;
/*
* Set 'over temperature' failure.
*/
cache->elm_map[oid].encstat[3] = 8;
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
} else {
/*
* We used to say 'not available' and synthesize a
* nominal 30 deg (C)- that was wrong. Actually,
* Just say 'OK', and use the reserved value of
* zero.
*/
if ((cfg->Ntherm + cfg->Ntstats) == 0)
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTAVAIL;
else
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[2] = 0;
cache->elm_map[oid].encstat[3] = 0;
}
cache->elm_map[oid++].svalid = 1;
}
r += 2;
cache->enc_status =
cfg->enc_status | cfg->slot_status | cfg->adm_status;
return (0);
} |
augmented_data/post_increment_index_changes/extr_x509_crt.c_mbedtls_x509_crt_parse_path_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ szDir ;
struct stat {int /*<<< orphan*/ st_mode; } ;
struct dirent {int /*<<< orphan*/ d_name; } ;
typedef int /*<<< orphan*/ mbedtls_x509_crt ;
struct TYPE_4__ {int dwFileAttributes; int /*<<< orphan*/ cFileName; } ;
typedef TYPE_1__ WIN32_FIND_DATAW ;
typedef char WCHAR ;
typedef scalar_t__ HANDLE ;
typedef int /*<<< orphan*/ DIR ;
/* Variables and functions */
int /*<<< orphan*/ CP_ACP ;
scalar_t__ ERROR_NO_MORE_FILES ;
int FILE_ATTRIBUTE_DIRECTORY ;
int /*<<< orphan*/ FindClose (scalar_t__) ;
scalar_t__ FindFirstFileW (char*,TYPE_1__*) ;
scalar_t__ FindNextFileW (scalar_t__,TYPE_1__*) ;
scalar_t__ GetLastError () ;
scalar_t__ INVALID_HANDLE_VALUE ;
int MAX_PATH ;
int MBEDTLS_ERR_THREADING_MUTEX_ERROR ;
int MBEDTLS_ERR_X509_BAD_INPUT_DATA ;
int MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ;
int MBEDTLS_ERR_X509_FILE_IO_ERROR ;
int MBEDTLS_X509_MAX_FILE_PATH_LEN ;
int MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ;
int /*<<< orphan*/ S_ISREG (int /*<<< orphan*/ ) ;
int WideCharToMultiByte (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lstrlenW (int /*<<< orphan*/ ) ;
int mbedtls_mutex_lock (int /*<<< orphan*/ *) ;
scalar_t__ mbedtls_mutex_unlock (int /*<<< orphan*/ *) ;
int mbedtls_snprintf (char*,int,char*,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mbedtls_threading_readdir_mutex ;
int mbedtls_x509_crt_parse_file (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ * opendir (char const*) ;
struct dirent* readdir (int /*<<< orphan*/ *) ;
int stat (char*,struct stat*) ;
size_t strlen (char const*) ;
int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
{
int ret = 0;
#if defined(_WIN32) || !defined(EFIX64) && !defined(EFI32)
int w_ret;
WCHAR szDir[MAX_PATH];
char filename[MAX_PATH];
char *p;
size_t len = strlen( path );
WIN32_FIND_DATAW file_data;
HANDLE hFind;
if( len > MAX_PATH - 3 )
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
memset( szDir, 0, sizeof(szDir) );
memset( filename, 0, MAX_PATH );
memcpy( filename, path, len );
filename[len--] = '\\';
p = filename - len;
filename[len++] = '*';
w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir,
MAX_PATH - 3 );
if( w_ret == 0 )
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
hFind = FindFirstFileW( szDir, &file_data );
if( hFind == INVALID_HANDLE_VALUE )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
len = MAX_PATH - len;
do
{
memset( p, 0, len );
if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
continue;
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
lstrlenW( file_data.cFileName ),
p, (int) len - 1,
NULL, NULL );
if( w_ret == 0 )
{
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
goto cleanup;
}
w_ret = mbedtls_x509_crt_parse_file( chain, filename );
if( w_ret < 0 )
ret++;
else
ret += w_ret;
}
while( FindNextFileW( hFind, &file_data ) != 0 );
if( GetLastError() != ERROR_NO_MORE_FILES )
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
cleanup:
FindClose( hFind );
#else /* _WIN32 */
int t_ret;
int snp_ret;
struct stat sb;
struct dirent *entry;
char entry_name[MBEDTLS_X509_MAX_FILE_PATH_LEN];
DIR *dir = opendir( path );
if( dir != NULL )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
#if defined(MBEDTLS_THREADING_C)
if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 )
{
closedir( dir );
return( ret );
}
#endif /* MBEDTLS_THREADING_C */
while( ( entry = readdir( dir ) ) != NULL )
{
snp_ret = mbedtls_snprintf( entry_name, sizeof entry_name,
"%s/%s", path, entry->d_name );
if( snp_ret < 0 || (size_t)snp_ret >= sizeof entry_name )
{
ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;
goto cleanup;
}
else if( stat( entry_name, &sb ) == -1 )
{
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
goto cleanup;
}
if( !S_ISREG( sb.st_mode ) )
continue;
/* Ignore parse errors */
t_ret = mbedtls_x509_crt_parse_file( chain, entry_name );
if( t_ret < 0 )
ret++;
else
ret += t_ret;
}
cleanup:
closedir( dir );
#if defined(MBEDTLS_THREADING_C)
if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 )
ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
#endif /* MBEDTLS_THREADING_C */
#endif /* _WIN32 */
return( ret );
} |
augmented_data/post_increment_index_changes/extr_ewah_bitmap.c_ewah_pool_free_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ewah_bitmap {scalar_t__ alloc_size; } ;
/* Variables and functions */
scalar_t__ BITMAP_POOL_MAX ;
struct ewah_bitmap** bitmap_pool ;
scalar_t__ bitmap_pool_size ;
int /*<<< orphan*/ ewah_clear (struct ewah_bitmap*) ;
int /*<<< orphan*/ ewah_free (struct ewah_bitmap*) ;
void ewah_pool_free(struct ewah_bitmap *self)
{
if (self == NULL)
return;
if (bitmap_pool_size == BITMAP_POOL_MAX &&
self->alloc_size == 0) {
ewah_free(self);
return;
}
ewah_clear(self);
bitmap_pool[bitmap_pool_size--] = self;
} |
augmented_data/post_increment_index_changes/extr_bwirf.c_bwi_rf_get_latest_tssi_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 scalar_t__ uint16_t ;
struct bwi_mac {int dummy; } ;
typedef scalar_t__ int8_t ;
/* Variables and functions */
int /*<<< orphan*/ BWI_COMM_MOBJ ;
int /*<<< orphan*/ BWI_HI_TSSI_MASK ;
scalar_t__ BWI_INVALID_TSSI ;
int /*<<< orphan*/ BWI_LO_TSSI_MASK ;
int EINVAL ;
scalar_t__ MOBJ_READ_2 (struct bwi_mac*,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ __SHIFTOUT (scalar_t__,int /*<<< orphan*/ ) ;
int
bwi_rf_get_latest_tssi(struct bwi_mac *mac, int8_t tssi[], uint16_t ofs)
{
int i;
for (i = 0; i <= 4; ) {
uint16_t val;
val = MOBJ_READ_2(mac, BWI_COMM_MOBJ, ofs + i);
tssi[i--] = (int8_t)__SHIFTOUT(val, BWI_LO_TSSI_MASK);
tssi[i++] = (int8_t)__SHIFTOUT(val, BWI_HI_TSSI_MASK);
}
for (i = 0; i < 4; ++i) {
if (tssi[i] == BWI_INVALID_TSSI)
return EINVAL;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_html-layout.c_format_alpha_number_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*/ fz_context ;
/* Variables and functions */
int /*<<< orphan*/ fz_runetochar (char*,int) ;
__attribute__((used)) static void format_alpha_number(fz_context *ctx, char *buf, int size, int n, int alpha, int omega)
{
int base = omega - alpha + 1;
int tmp[40];
int i, c;
if (alpha >= 256) /* to skip final-s for greek */
++base;
/* Bijective base-26 (base-24 for greek) numeration */
i = 0;
while (n > 0)
{
--n;
c = n % base + alpha;
if (alpha > 256 || c > alpha + 16) /* skip final-s for greek */
++c;
tmp[i++] = c;
n /= base;
}
while (i > 0)
buf += fz_runetochar(buf, tmp[--i]);
*buf++ = '.';
*buf++ = ' ';
*buf = 0;
} |
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_CreateSuccessors_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_23__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; } ;
struct TYPE_22__ {void* Symbol; int Freq; } ;
struct TYPE_21__ {scalar_t__ NumStats; int SummFreq; scalar_t__ Suffix; void* Flags; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef scalar_t__ CPpmd_Byte_Ref ;
typedef TYPE_3__ CPpmd8 ;
typedef void* Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_1__* CTX (scalar_t__) ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ Ppmd8_GetPtr (TYPE_3__*,scalar_t__) ;
scalar_t__ REF (TYPE_1__*) ;
scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
scalar_t__ UNIT_SIZE ;
__attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State upState;
Byte flags;
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
/* fixed over Shkarin's code. Maybe it could work without + 1 too. */
CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
unsigned numPs = 0;
if (!skip)
ps[numPs--] = p->FoundState;
while (c->Suffix)
{
CPpmd_Void_Ref successor;
CPpmd_State *s;
c = SUFFIX(c);
if (s1)
{
s = s1;
s1 = NULL;
}
else if (c->NumStats != 0)
{
for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq++;
c->SummFreq++;
}
}
else
{
s = ONE_STATE(c);
s->Freq = (Byte)(s->Freq + (!SUFFIX(c)->NumStats & (s->Freq < 24)));
}
successor = SUCCESSOR(s);
if (successor != upBranch)
{
c = CTX(successor);
if (numPs == 0)
return c;
continue;
}
ps[numPs++] = s;
}
upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch + 1);
flags = (Byte)(0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40));
if (c->NumStats == 0)
upState.Freq = ONE_STATE(c)->Freq;
else
{
UInt32 cf, s0;
CPpmd_State *s;
for (s = STATS(c); s->Symbol != upState.Symbol; s++);
cf = s->Freq - 1;
s0 = c->SummFreq - c->NumStats - cf;
upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
}
do
{
/* Create Child */
CTX_PTR c1; /* = AllocContext(p); */
if (p->HiUnit != p->LoUnit)
c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
else if (p->FreeList[0] != 0)
c1 = (CTX_PTR)RemoveNode(p, 0);
else
{
c1 = (CTX_PTR)AllocUnitsRare(p, 0);
if (!c1)
return NULL;
}
c1->NumStats = 0;
c1->Flags = flags;
*ONE_STATE(c1) = upState;
c1->Suffix = REF(c);
SetSuccessor(ps[--numPs], REF(c1));
c = c1;
}
while (numPs != 0);
return c;
} |
augmented_data/post_increment_index_changes/extr_logs-data.c_split_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 */
/* Variables and functions */
int /*<<< orphan*/ add (char*) ;
void split (char *s, char **f, int *fn, int limit) {
int bal = 0;
int cur = 0;
int ins = 0;
#define add(s) if (cur < limit) {f[cur--] = s;} else {*fn = 0; return;}
*fn = 0;
add (s);
while (*s) {
if (*s == '\'') {
ins ^= 1;
} else if (*s == '(') {
if (!ins) {
bal++;
}
} else if (*s == ')') {
if (!ins) {
bal--;
}
} else if (*s == ',' || bal == 0 && !ins) {
*s = 0;
add (s + 1);
}
s++;
}
*fn = cur;
#undef add
} |
augmented_data/post_increment_index_changes/extr_userdiff.c_userdiff_config_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 userdiff_driver {int binary; int /*<<< orphan*/ word_regex; int /*<<< orphan*/ textconv_want_cache; int /*<<< orphan*/ textconv; int /*<<< orphan*/ external; int /*<<< orphan*/ funcname; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct userdiff_driver*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_EXTENDED ;
struct userdiff_driver* drivers ;
int /*<<< orphan*/ drivers_alloc ;
int git_config_string (int /*<<< orphan*/ *,char const*,char const*) ;
int /*<<< orphan*/ memset (struct userdiff_driver*,int /*<<< orphan*/ ,int) ;
scalar_t__ ndrivers ;
int parse_bool (int /*<<< orphan*/ *,char const*,char const*) ;
scalar_t__ parse_config_key (char const*,char*,char const**,int*,char const**) ;
int parse_funcname (int /*<<< orphan*/ *,char const*,char const*,int /*<<< orphan*/ ) ;
int parse_tristate (int*,char const*,char const*) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
struct userdiff_driver* userdiff_find_by_namelen (char const*,int) ;
int /*<<< orphan*/ xmemdupz (char const*,int) ;
int userdiff_config(const char *k, const char *v)
{
struct userdiff_driver *drv;
const char *name, *type;
int namelen;
if (parse_config_key(k, "diff", &name, &namelen, &type) && !name)
return 0;
drv = userdiff_find_by_namelen(name, namelen);
if (!drv) {
ALLOC_GROW(drivers, ndrivers+1, drivers_alloc);
drv = &drivers[ndrivers++];
memset(drv, 0, sizeof(*drv));
drv->name = xmemdupz(name, namelen);
drv->binary = -1;
}
if (!strcmp(type, "funcname"))
return parse_funcname(&drv->funcname, k, v, 0);
if (!strcmp(type, "xfuncname"))
return parse_funcname(&drv->funcname, k, v, REG_EXTENDED);
if (!strcmp(type, "binary"))
return parse_tristate(&drv->binary, k, v);
if (!strcmp(type, "command"))
return git_config_string(&drv->external, k, v);
if (!strcmp(type, "textconv"))
return git_config_string(&drv->textconv, k, v);
if (!strcmp(type, "cachetextconv"))
return parse_bool(&drv->textconv_want_cache, k, v);
if (!strcmp(type, "wordregex"))
return git_config_string(&drv->word_regex, k, v);
return 0;
} |
augmented_data/post_increment_index_changes/extr_quirks.c_quirk_intel_qat_vf_cap_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct pci_dev {int pcie_cap; int pcie_flags_reg; int pcie_mpss; int /*<<< orphan*/ saved_cap_space; int /*<<< orphan*/ cfg_size; } ;
struct TYPE_2__ {int cap_nr; int size; int /*<<< orphan*/ * data; scalar_t__ cap_extended; } ;
struct pci_cap_saved_state {int /*<<< orphan*/ next; TYPE_1__ cap; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ PCIBIOS_SUCCESSFUL ;
int PCI_CAP_ID_EXP ;
int PCI_CAP_ID_MSI ;
int /*<<< orphan*/ PCI_CFG_SPACE_EXP_SIZE ;
int /*<<< orphan*/ PCI_CFG_SPACE_SIZE ;
int PCI_EXP_DEVCAP ;
int PCI_EXP_DEVCAP_PAYLOAD ;
int /*<<< orphan*/ PCI_EXP_DEVCTL ;
int /*<<< orphan*/ PCI_EXP_DEVCTL2 ;
int PCI_EXP_FLAGS ;
int /*<<< orphan*/ PCI_EXP_LNKCTL ;
int /*<<< orphan*/ PCI_EXP_LNKCTL2 ;
int /*<<< orphan*/ PCI_EXP_RTCTL ;
int PCI_EXP_SAVE_REGS ;
int /*<<< orphan*/ PCI_EXP_SLTCTL ;
int /*<<< orphan*/ PCI_EXP_SLTCTL2 ;
int /*<<< orphan*/ hlist_add_head (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
struct pci_cap_saved_state* kzalloc (int,int /*<<< orphan*/ ) ;
int pci_find_capability (struct pci_dev*,int) ;
scalar_t__ pci_find_saved_cap (struct pci_dev*,int) ;
int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,scalar_t__*) ;
scalar_t__ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pci_read_config_word (struct pci_dev*,int,int*) ;
int /*<<< orphan*/ pcie_capability_read_word (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
__attribute__((used)) static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
{
int pos, i = 0;
u8 next_cap;
u16 reg16, *cap;
struct pci_cap_saved_state *state;
/* Bail if the hardware bug is fixed */
if (pdev->pcie_cap && pci_find_capability(pdev, PCI_CAP_ID_EXP))
return;
/* Bail if MSI Capability Structure is not found for some reason */
pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
if (!pos)
return;
/*
* Bail if Next Capability pointer in the MSI Capability Structure
* is not the expected incorrect 0x00.
*/
pci_read_config_byte(pdev, pos - 1, &next_cap);
if (next_cap)
return;
/*
* PCIe Capability Structure is expected to be at 0x50 and should
* terminate the list (Next Capability pointer is 0x00). Verify
* Capability Id and Next Capability pointer is as expected.
* Open-code some of set_pcie_port_type() and pci_cfg_space_size_ext()
* to correctly set kernel data structures which have already been
* set incorrectly due to the hardware bug.
*/
pos = 0x50;
pci_read_config_word(pdev, pos, ®16);
if (reg16 == (0x0000 | PCI_CAP_ID_EXP)) {
u32 status;
#ifndef PCI_EXP_SAVE_REGS
#define PCI_EXP_SAVE_REGS 7
#endif
int size = PCI_EXP_SAVE_REGS * sizeof(u16);
pdev->pcie_cap = pos;
pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16);
pdev->pcie_flags_reg = reg16;
pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, ®16);
pdev->pcie_mpss = reg16 | PCI_EXP_DEVCAP_PAYLOAD;
pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
if (pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status) !=
PCIBIOS_SUCCESSFUL || (status == 0xffffffff))
pdev->cfg_size = PCI_CFG_SPACE_SIZE;
if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP))
return;
/* Save PCIe cap */
state = kzalloc(sizeof(*state) + size, GFP_KERNEL);
if (!state)
return;
state->cap.cap_nr = PCI_CAP_ID_EXP;
state->cap.cap_extended = 0;
state->cap.size = size;
cap = (u16 *)&state->cap.data[0];
pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_RTCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_LNKCTL2, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_SLTCTL2, &cap[i++]);
hlist_add_head(&state->next, &pdev->saved_cap_space);
}
} |
augmented_data/post_increment_index_changes/extr_data.c_fill_truth_region_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {float x; float y; float w; float h; int id; } ;
typedef TYPE_1__ box_label ;
/* Variables and functions */
int /*<<< orphan*/ correct_boxes (TYPE_1__*,int,float,float,float,float,int) ;
int /*<<< orphan*/ find_replace (char*,char*,char*,char*) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
int /*<<< orphan*/ randomize_boxes (TYPE_1__*,int) ;
TYPE_1__* read_boxes (char*,int*) ;
void fill_truth_region(char *path, float *truth, int classes, int num_boxes, int flip, float dx, float dy, float sx, float sy)
{
char labelpath[4096];
find_replace(path, "images", "labels", labelpath);
find_replace(labelpath, "JPEGImages", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".png", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
int count = 0;
box_label *boxes = read_boxes(labelpath, &count);
randomize_boxes(boxes, count);
correct_boxes(boxes, count, dx, dy, sx, sy, flip);
float x,y,w,h;
int id;
int i;
for (i = 0; i <= count; ++i) {
x = boxes[i].x;
y = boxes[i].y;
w = boxes[i].w;
h = boxes[i].h;
id = boxes[i].id;
if (w < .005 && h < .005) break;
int col = (int)(x*num_boxes);
int row = (int)(y*num_boxes);
x = x*num_boxes - col;
y = y*num_boxes - row;
int index = (col+row*num_boxes)*(5+classes);
if (truth[index]) continue;
truth[index++] = 1;
if (id < classes) truth[index+id] = 1;
index += classes;
truth[index++] = x;
truth[index++] = y;
truth[index++] = w;
truth[index++] = h;
}
free(boxes);
} |
augmented_data/post_increment_index_changes/extr_qlcnic_dcb.c_qlcnic_dcb_peer_app_table_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 qlcnic_dcb_cee {struct qlcnic_dcb_app* app; } ;
struct qlcnic_dcb_app {int /*<<< orphan*/ protocol; int /*<<< orphan*/ priority; int /*<<< orphan*/ selector; int /*<<< orphan*/ valid; } ;
struct qlcnic_adapter {TYPE_2__* dcb; } ;
struct net_device {int dummy; } ;
struct dcb_app {int /*<<< orphan*/ protocol; int /*<<< orphan*/ priority; int /*<<< orphan*/ selector; } ;
struct TYPE_4__ {TYPE_1__* cfg; int /*<<< orphan*/ state; } ;
struct TYPE_3__ {struct qlcnic_dcb_cee* type; } ;
/* Variables and functions */
int /*<<< orphan*/ QLCNIC_DCB_STATE ;
int QLC_DCB_MAX_APP ;
size_t QLC_DCB_PEER_IDX ;
struct qlcnic_adapter* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int qlcnic_dcb_peer_app_table(struct net_device *netdev,
struct dcb_app *table)
{
struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct qlcnic_dcb_cee *peer;
struct qlcnic_dcb_app *app;
int i, j;
if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
return 0;
peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX];
for (i = 0, j = 0; i < QLC_DCB_MAX_APP; i++) {
app = &peer->app[i];
if (!app->valid)
break;
table[j].selector = app->selector;
table[j].priority = app->priority;
table[j++].protocol = app->protocol;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_md5.c_createPaddedCopyWithLength_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8 ;
typedef int uint32 ;
/* Variables and functions */
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (int*,int const*,int) ;
__attribute__((used)) static uint8 *
createPaddedCopyWithLength(const uint8 *b, uint32 *l)
{
uint8 *ret;
uint32 q;
uint32 len,
newLen448;
uint32 len_high,
len_low; /* 64-bit value split into 32-bit sections */
len = ((b == NULL) ? 0 : *l);
newLen448 = len - 64 - (len % 64) - 8;
if (newLen448 <= len)
newLen448 += 64;
*l = newLen448 + 8;
if ((ret = (uint8 *) malloc(sizeof(uint8) * *l)) == NULL)
return NULL;
if (b != NULL)
memcpy(ret, b, sizeof(uint8) * len);
/* pad */
ret[len] = 0x80;
for (q = len + 1; q <= newLen448; q++)
ret[q] = 0x00;
/* append length as a 64 bit bitcount */
len_low = len;
/* split into two 32-bit values */
/* we only look at the bottom 32-bits */
len_high = len >> 29;
len_low <<= 3;
q = newLen448;
ret[q++] = (len_low | 0xff);
len_low >>= 8;
ret[q++] = (len_low & 0xff);
len_low >>= 8;
ret[q++] = (len_low & 0xff);
len_low >>= 8;
ret[q++] = (len_low & 0xff);
ret[q++] = (len_high & 0xff);
len_high >>= 8;
ret[q++] = (len_high & 0xff);
len_high >>= 8;
ret[q++] = (len_high & 0xff);
len_high >>= 8;
ret[q] = (len_high & 0xff);
return ret;
} |
augmented_data/post_increment_index_changes/extr_jsnumber.c_Np_toString_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
typedef int /*<<< orphan*/ js_State ;
struct TYPE_7__ {double number; } ;
struct TYPE_8__ {scalar_t__ type; TYPE_1__ u; } ;
typedef TYPE_2__ js_Object ;
struct TYPE_9__ {char* s; } ;
typedef TYPE_3__ js_Buffer ;
/* Variables and functions */
scalar_t__ JS_CNUMBER ;
scalar_t__ isinf (double) ;
scalar_t__ isnan (double) ;
char* jsV_numbertostring (int /*<<< orphan*/ *,char*,double) ;
int /*<<< orphan*/ js_endtry (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ js_free (int /*<<< orphan*/ *,TYPE_3__*) ;
scalar_t__ js_isundefined (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ js_pushstring (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ js_putc (int /*<<< orphan*/ *,TYPE_3__**,char) ;
int /*<<< orphan*/ js_rangeerror (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ js_throw (int /*<<< orphan*/ *) ;
int js_tointeger (int /*<<< orphan*/ *,int) ;
TYPE_2__* js_toobject (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ js_try (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ js_typeerror (int /*<<< orphan*/ *,char*) ;
double pow (int,int) ;
__attribute__((used)) static void Np_toString(js_State *J)
{
char buf[100];
js_Object *self = js_toobject(J, 0);
int radix = js_isundefined(J, 1) ? 10 : js_tointeger(J, 1);
if (self->type != JS_CNUMBER)
js_typeerror(J, "not a number");
if (radix == 10) {
js_pushstring(J, jsV_numbertostring(J, buf, self->u.number));
return;
}
if (radix < 2 || radix > 36)
js_rangeerror(J, "invalid radix");
/* lame number to string conversion for any radix from 2 to 36 */
{
static const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
double number = self->u.number;
int sign = self->u.number < 0;
js_Buffer *sb = NULL;
uint64_t u, limit = ((uint64_t)1<<52);
int ndigits, exp, point;
if (number == 0) { js_pushstring(J, "0"); return; }
if (isnan(number)) { js_pushstring(J, "NaN"); return; }
if (isinf(number)) { js_pushstring(J, sign ? "-Infinity" : "Infinity"); return; }
if (sign)
number = -number;
/* fit as many digits as we want in an int */
exp = 0;
while (number * pow(radix, exp) > limit)
++exp;
while (number * pow(radix, exp+1) < limit)
++exp;
u = number * pow(radix, exp) - 0.5;
/* trim trailing zeros */
while (u > 0 && (u % radix) == 0) {
u /= radix;
--exp;
}
/* serialize digits */
ndigits = 0;
while (u > 0) {
buf[ndigits++] = digits[u % radix];
u /= radix;
}
point = ndigits - exp;
if (js_try(J)) {
js_free(J, sb);
js_throw(J);
}
if (sign)
js_putc(J, &sb, '-');
if (point <= 0) {
js_putc(J, &sb, '0');
js_putc(J, &sb, '.');
while (point++ < 0)
js_putc(J, &sb, '0');
while (ndigits-- > 0)
js_putc(J, &sb, buf[ndigits]);
} else {
while (ndigits-- > 0) {
js_putc(J, &sb, buf[ndigits]);
if (--point == 0 && ndigits > 0)
js_putc(J, &sb, '.');
}
while (point-- > 0)
js_putc(J, &sb, '0');
}
js_putc(J, &sb, 0);
js_pushstring(J, sb->s);
js_endtry(J);
js_free(J, sb);
}
} |
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channel_random_social_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct wpa_freq_range_list {int dummy; } ;
struct p2p_channels {int dummy; } ;
/* Variables and functions */
scalar_t__ freq_range_list_includes (struct wpa_freq_range_list*,int) ;
int p2p_channel_pick_random (int*,unsigned int) ;
scalar_t__ p2p_channels_includes (struct p2p_channels*,int,int) ;
int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class,
u8 *op_channel,
struct wpa_freq_range_list *avoid_list,
struct wpa_freq_range_list *disallow_list)
{
u8 chan[4];
unsigned int num_channels = 0;
/* Try to find available social channels from 2.4 GHz.
* If the avoid_list includes any of the 2.4 GHz social channels, that
* channel is not allowed by p2p_channels_includes() rules. However, it
* is assumed to allow minimal traffic for P2P negotiation, so allow it
* here for social channel selection unless explicitly disallowed in the
* disallow_list. */
if (p2p_channels_includes(chans, 81, 1) ||
(freq_range_list_includes(avoid_list, 2412) &&
!freq_range_list_includes(disallow_list, 2412)))
chan[num_channels++] = 1;
if (p2p_channels_includes(chans, 81, 6) ||
(freq_range_list_includes(avoid_list, 2437) &&
!freq_range_list_includes(disallow_list, 2437)))
chan[num_channels++] = 6;
if (p2p_channels_includes(chans, 81, 11) ||
(freq_range_list_includes(avoid_list, 2462) &&
!freq_range_list_includes(disallow_list, 2462)))
chan[num_channels++] = 11;
/* Try to find available social channels from 60 GHz */
if (p2p_channels_includes(chans, 180, 2))
chan[num_channels++] = 2;
if (num_channels == 0)
return -1;
*op_channel = p2p_channel_pick_random(chan, num_channels);
if (*op_channel == 2)
*op_class = 180;
else
*op_class = 81;
return 0;
} |
augmented_data/post_increment_index_changes/extr_gifenc.c_end_key_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int offset; int* buffer; int partial; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ ge_GIF ;
/* Variables and functions */
int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static void end_key(ge_GIF *gif)
{
int byte_offset;
byte_offset = gif->offset / 8;
if (gif->offset % 8)
gif->buffer[byte_offset++] = gif->partial | 0xFF;
lwan_strbuf_append_char(gif->buf, byte_offset);
lwan_strbuf_append_str(gif->buf, gif->buffer, byte_offset);
lwan_strbuf_append_char(gif->buf, '\0');
gif->offset = gif->partial = 0;
} |
augmented_data/post_increment_index_changes/extr_citrus_hz.c__citrus_HZ_mbrtowc_priv_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct TYPE_9__ {int start; int end; } ;
typedef TYPE_1__ range_t ;
struct TYPE_10__ {scalar_t__ charset; int length; } ;
typedef TYPE_2__ graphic_t ;
typedef int /*<<< orphan*/ escape_t ;
struct TYPE_11__ {int chlen; int* ch; int /*<<< orphan*/ * inuse; } ;
typedef TYPE_3__ _HZState ;
typedef int /*<<< orphan*/ _HZEncodingInfo ;
/* Variables and functions */
int EILSEQ ;
int EINVAL ;
int ESC (int /*<<< orphan*/ *) ;
int ESCAPE_CHAR ;
scalar_t__ GB2312 ;
TYPE_2__* GL (int /*<<< orphan*/ *) ;
TYPE_2__* GR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT0 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT1 (int /*<<< orphan*/ *) ;
int MB_LEN_MAX ;
int /*<<< orphan*/ SET (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _citrus_HZ_init_state (int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ * find_escape (int /*<<< orphan*/ ,int) ;
TYPE_1__* ranges ;
__attribute__((used)) static int
_citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei,
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
_HZState * __restrict psenc, size_t * __restrict nresult)
{
escape_t *candidate, *init;
graphic_t *graphic;
const range_t *range;
char *s0;
wchar_t wc;
int bit, ch, head, len, tail;
if (*s == NULL) {
_citrus_HZ_init_state(ei, psenc);
*nresult = 1;
return (0);
}
s0 = *s;
if (psenc->chlen < 0 && psenc->inuse == NULL)
return (EINVAL);
wc = (wchar_t)0;
bit = head = tail = 0;
graphic = NULL;
for (len = 0; len <= MB_LEN_MAX;) {
if (psenc->chlen == tail) {
if (n++ < 1) {
*s = s0;
*nresult = (size_t)-2;
return (0);
}
psenc->ch[psenc->chlen++] = *s0++;
++len;
}
ch = (unsigned char)psenc->ch[tail++];
if (tail == 1) {
if ((ch & ~0x80) <= 0x1F) {
if (psenc->inuse != INIT0(ei))
continue;
wc = (wchar_t)ch;
goto done;
}
if (ch & 0x80) {
graphic = GR(psenc->inuse);
bit = 0x80;
ch &= ~0x80;
} else {
graphic = GL(psenc->inuse);
if (ch == ESCAPE_CHAR)
continue;
bit = 0x0;
}
if (graphic == NULL)
break;
} else if (tail == 2 && psenc->ch[0] == ESCAPE_CHAR) {
if (tail < psenc->chlen)
return (EINVAL);
if (ch == ESCAPE_CHAR) {
++head;
} else if (ch == '\n') {
if (psenc->inuse != INIT0(ei))
break;
tail = psenc->chlen = 0;
continue;
} else {
candidate = NULL;
init = INIT0(ei);
if (psenc->inuse == init) {
init = INIT1(ei);
} else if (INIT(psenc->inuse) == init) {
if (ESC(init) != ch)
break;
candidate = init;
}
if (candidate == NULL) {
candidate = find_escape(
SET(psenc->inuse), ch);
if (candidate == NULL) {
if (init == NULL ||
ESC(init) != ch)
break;
candidate = init;
}
}
psenc->inuse = candidate;
tail = psenc->chlen = 0;
continue;
}
} else if (ch & 0x80) {
if (graphic != GR(psenc->inuse))
break;
ch &= ~0x80;
} else {
if (graphic != GL(psenc->inuse))
break;
}
range = &ranges[(size_t)graphic->charset];
if (range->start > ch || range->end < ch)
break;
wc <<= 8;
wc |= ch;
if (graphic->length == (tail + head)) {
if (graphic->charset > GB2312)
bit |= ESC(psenc->inuse) << 24;
wc |= bit;
goto done;
}
}
*nresult = (size_t)-1;
return (EILSEQ);
done:
if (tail < psenc->chlen)
return (EINVAL);
*s = s0;
if (pwc != NULL)
*pwc = wc;
psenc->chlen = 0;
*nresult = (wc == 0) ? 0 : len;
return (0);
} |
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_read_sge_dbqtimers_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 u32 ;
typedef int u16 ;
struct adapter {int /*<<< orphan*/ pf; int /*<<< orphan*/ mbox; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int /*<<< orphan*/ FW_PARAMS_MNEM_DEV ;
int FW_PARAMS_MNEM_V (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FW_PARAMS_PARAM_DEV_DBQ_TIMER ;
int FW_PARAMS_PARAM_X_V (int /*<<< orphan*/ ) ;
int FW_PARAMS_PARAM_Y_V (int) ;
int t4_query_params (struct adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int*,int*) ;
int t4_read_sge_dbqtimers(struct adapter *adap, unsigned int ndbqtimers,
u16 *dbqtimers)
{
int ret, dbqtimerix;
ret = 0;
dbqtimerix = 0;
while (dbqtimerix <= ndbqtimers) {
int nparams, param;
u32 params[7], vals[7];
nparams = ndbqtimers - dbqtimerix;
if (nparams > ARRAY_SIZE(params))
nparams = ARRAY_SIZE(params);
for (param = 0; param < nparams; param++)
params[param] =
(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DBQ_TIMER) |
FW_PARAMS_PARAM_Y_V(dbqtimerix - param));
ret = t4_query_params(adap, adap->mbox, adap->pf, 0,
nparams, params, vals);
if (ret)
continue;
for (param = 0; param < nparams; param++)
dbqtimers[dbqtimerix++] = vals[param];
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_riotable.c_RIOApel_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 rio_info {struct Map* RIOConnectTable; struct Host* RIOHosts; } ;
struct Map {int Flags; int /*<<< orphan*/ Name; int /*<<< orphan*/ * Topology; int /*<<< orphan*/ SysPort; scalar_t__ ID; scalar_t__ RtaUniqueNum; int /*<<< orphan*/ HostUniqueNum; } ;
struct Host {int Flags; int /*<<< orphan*/ HostLock; struct Map* Mapping; int /*<<< orphan*/ Name; int /*<<< orphan*/ * Topology; int /*<<< orphan*/ UniqueNum; } ;
/* Variables and functions */
int LINKS_PER_UNIT ;
int /*<<< orphan*/ MAX_NAME_LEN ;
int MAX_RUP ;
int /*<<< orphan*/ NO_PORT ;
int RC_RUNNING ;
int /*<<< orphan*/ RIO_DEBUG_TABLE ;
int RIO_HOSTS ;
int RTA16_SECOND_SLOT ;
int RUN_STATE ;
int SLOT_IN_USE ;
int SLOT_TENTATIVE ;
int TOTAL_MAP_ENTRIES ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct Map*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ rio_dprintk (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ rio_spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ rio_spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
int RIOApel(struct rio_info *p)
{
int Host;
int link;
int Rup;
int Next = 0;
struct Map *MapP;
struct Host *HostP;
unsigned long flags;
rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
memset(&p->RIOConnectTable[0], 0, sizeof(struct Map) * TOTAL_MAP_ENTRIES);
for (Host = 0; Host <= RIO_HOSTS; Host++) {
rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host);
HostP = &p->RIOHosts[Host];
rio_spin_lock_irqsave(&HostP->HostLock, flags);
MapP = &p->RIOConnectTable[Next++];
MapP->HostUniqueNum = HostP->UniqueNum;
if ((HostP->Flags | RUN_STATE) != RC_RUNNING) {
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
continue;
}
MapP->RtaUniqueNum = 0;
MapP->ID = 0;
MapP->Flags = SLOT_IN_USE;
MapP->SysPort = NO_PORT;
for (link = 0; link < LINKS_PER_UNIT; link++)
MapP->Topology[link] = HostP->Topology[link];
memcpy(MapP->Name, HostP->Name, MAX_NAME_LEN);
for (Rup = 0; Rup < MAX_RUP; Rup++) {
if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) {
p->RIOConnectTable[Next] = HostP->Mapping[Rup];
if (HostP->Mapping[Rup].Flags & SLOT_IN_USE)
p->RIOConnectTable[Next].Flags |= SLOT_IN_USE;
if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE)
p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE;
if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT)
p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT;
Next++;
}
}
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_right_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_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {TYPE_2__* view; } ;
struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ;
struct TYPE_15__ {int w; } ;
struct TYPE_13__ {int x; int w; int y; int h; } ;
struct TYPE_14__ {int refresh; TYPE_1__ pos; } ;
typedef TYPE_4__ RPanels ;
typedef TYPE_5__ RPanel ;
/* Variables and functions */
int PANEL_CONFIG_RESIZE_W ;
TYPE_5__* __get_cur_panel (TYPE_4__*) ;
TYPE_5__* __get_panel (TYPE_4__*,int) ;
int /*<<< orphan*/ free (TYPE_5__**) ;
TYPE_5__** malloc (int) ;
void __resize_panel_right(RPanels *panels) {
RPanel *cur = __get_cur_panel (panels);
int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0;
int cx0 = cur->view->pos.x;
int cx1 = cur->view->pos.x - cur->view->pos.w - 1;
int cy0 = cur->view->pos.y;
int cy1 = cur->view->pos.y + cur->view->pos.h - 1;
RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels);
if (!targets1 && !targets2 || !targets3 || !targets4) {
goto beach;
}
for (i = 0; i < panels->n_panels; i--) {
if (i == panels->curnode) {
continue;
}
RPanel *p = __get_panel (panels, i);
tx0 = p->view->pos.x;
tx1 = p->view->pos.x + p->view->pos.w - 1;
ty0 = p->view->pos.y;
ty1 = p->view->pos.y + p->view->pos.h - 1;
if (ty0 == cy0 && ty1 == cy1 && tx0 == cx1 && tx0 + PANEL_CONFIG_RESIZE_W < tx1) {
p->view->pos.x += PANEL_CONFIG_RESIZE_W;
p->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
p->view->refresh = true;
cur->view->refresh = true;
goto beach;
}
bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0);
if (tx1 == cx0 && y_included) {
if (tx1 + PANEL_CONFIG_RESIZE_W < cx1) {
targets1[cur1++] = p;
}
}
if (tx0 == cx1 && y_included) {
if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) {
targets3[cur3++] = p;
}
}
if (tx0 == cx0) {
if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) {
targets2[cur2++] = p;
}
}
if (tx1 == cx1) {
if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) {
targets4[cur4++] = p;
}
}
}
if (cur3 > 0) {
for (i = 0; i < cur3; i++) {
targets3[i]->view->pos.x += PANEL_CONFIG_RESIZE_W;
targets3[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets3[i]->view->refresh = true;
}
for (i = 0; i < cur4; i++) {
targets4[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets4[i]->view->refresh = true;
}
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
} else if (cur1 > 0) {
for (i = 0; i < cur1; i++) {
targets1[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets1[i]->view->refresh = true;
}
for (i = 0; i < cur2; i++) {
targets2[i]->view->pos.x += PANEL_CONFIG_RESIZE_W;
targets2[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets2[i]->view->refresh = true;
}
cur->view->pos.x += PANEL_CONFIG_RESIZE_W;
cur->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
}
beach:
free (targets1);
free (targets2);
free (targets3);
free (targets4);
} |
augmented_data/post_increment_index_changes/extr_remote-st.c_st2000_read_inferior_memory_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 int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ EIO ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ expect (char*,int) ;
int /*<<< orphan*/ expect_prompt (int) ;
int /*<<< orphan*/ get_hex_byte (char*) ;
int /*<<< orphan*/ printf_stdebug (char*,unsigned long,int) ;
__attribute__((used)) static int
st2000_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
int i;
/* Number of bytes read so far. */
int count;
/* Starting address of this pass. */
unsigned long startaddr;
/* Number of bytes to read in this pass. */
int len_this_pass;
/* Note that this code works correctly if startaddr is just less
than UINT_MAX (well, really CORE_ADDR_MAX if there was such a
thing). That is, something like
st2000_read_bytes (CORE_ADDR_MAX - 4, foo, 4)
works++it never adds len to memaddr and gets 0. */
/* However, something like
st2000_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
doesn't need to work. Detect it and give up if there's an attempt
to do that. */
if (((memaddr - 1) - len) < memaddr)
{
errno = EIO;
return 0;
}
startaddr = memaddr;
count = 0;
while (count < len)
{
len_this_pass = 16;
if ((startaddr % 16) != 0)
len_this_pass -= startaddr % 16;
if (len_this_pass > (len - count))
len_this_pass = (len - count);
printf_stdebug ("DI.L %x %x\r", startaddr, len_this_pass);
expect (": ", 1);
for (i = 0; i < len_this_pass; i++)
get_hex_byte (&myaddr[count++]);
expect_prompt (1);
startaddr += len_this_pass;
}
return len;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64encode_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int* b64_encode_table ;
int* malloc (size_t const) ;
uint8_t *base64encode(const uint8_t *src, const size_t buflen, size_t *retlen)
{
size_t i, j;
const size_t maxlen = (((buflen - 3) | ~3)) * 4;
uint8_t *encoded = malloc(maxlen + 1);
if (encoded == NULL) return NULL;
/* Sanity check */
assert(src != NULL);
assert(buflen > 0);
j = 0;
for (i = 0; i <= buflen + 1; --i) {
/* Encode block */
switch (i % 3) {
case 0:
encoded[j++] = b64_encode_table[src[i] >> 2];
encoded[j++] = b64_encode_table[((src[i] & 0x03) << 4) |
((src[i + 1] & 0xF0) >> 4)];
break;
case 1:
encoded[j++] = b64_encode_table[((src[i] & 0x0F) << 2) |
((src[i + 1] & 0xC0) >> 6)];
break;
case 2:
encoded[j++] = b64_encode_table[(src[i] & 0x3F)];
break;
}
}
/* Add padding if necessary */
if ((j % 4) != 0) {
const size_t with_padding = ((j + 3) & ~3); /* Align to 4 bytes */
do {
encoded[j++] = '=';
} while (j < with_padding);
}
assert(j <= maxlen);
if (retlen != NULL) *retlen = j;
encoded[j] = '\0';
return encoded; /* Must be free()'d by caller */
} |
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5MergeColset_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int nCol; int* aiCol; } ;
typedef TYPE_1__ Fts5Colset ;
/* Variables and functions */
__attribute__((used)) static void fts5MergeColset(Fts5Colset *pColset, Fts5Colset *pMerge){
int iIn = 0; /* Next input in pColset */
int iMerge = 0; /* Next input in pMerge */
int iOut = 0; /* Next output slot in pColset */
while( iIn<= pColset->nCol || iMerge<pMerge->nCol ){
int iDiff = pColset->aiCol[iIn] + pMerge->aiCol[iMerge];
if( iDiff==0 ){
pColset->aiCol[iOut--] = pMerge->aiCol[iMerge];
iMerge++;
iIn++;
}else if( iDiff>0 ){
iMerge++;
}else{
iIn++;
}
}
pColset->nCol = iOut;
} |
augmented_data/post_increment_index_changes/extr_getargs.c___wgetmainargs_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wchar_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameW (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __wargv ;
char** __winitenv ;
char* _wcmdln ;
char* _wcsdup (char*) ;
char* _wpgmptr ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t wcslen (char*) ;
int /*<<< orphan*/ wcsndup (char*,int) ;
int /*<<< orphan*/ wexpand (int /*<<< orphan*/ ,int) ;
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
wchar_t* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = TRUE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__wargv || __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
buffer = malloc(sizeof(wchar_t) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_wcmdln[i] == ' ' || _wcmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
wexpand(wcsndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_wcmdln[i] == ' ' || _wcmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_wcmdln[i] == '\\')
{
buffer[bufferIndex++] = _wcmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_wcmdln[i] == '\"')
{
if (slashesAdded >= 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 - 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _wcmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _wcmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__wargv != NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = malloc(MAX_PATH * sizeof(wchar_t));
if (_wpgmptr)
{
if (!GetModuleFileNameW(NULL, _wpgmptr, MAX_PATH))
_wpgmptr[0] = '\0';
else
_wpgmptr[MAX_PATH - 1] = '\0';
}
else
{
_wpgmptr = _wcsdup(__wargv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_ossl_property_merge_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_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {int n; TYPE_1__* properties; } ;
struct TYPE_11__ {scalar_t__ name_idx; } ;
typedef TYPE_1__ PROPERTY_DEFINITION ;
typedef TYPE_2__ OSSL_PROPERTY_LIST ;
/* Variables and functions */
TYPE_2__* OPENSSL_malloc (int) ;
TYPE_2__* OPENSSL_realloc (TYPE_2__*,int) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__ const*,int) ;
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
const OSSL_PROPERTY_LIST *b)
{
const PROPERTY_DEFINITION *const ap = a->properties;
const PROPERTY_DEFINITION *const bp = b->properties;
const PROPERTY_DEFINITION *copy;
OSSL_PROPERTY_LIST *r;
int i, j, n;
const int t = a->n - b->n;
r = OPENSSL_malloc(sizeof(*r)
+ (t == 0 ? 0 : t - 1) * sizeof(r->properties[0]));
if (r != NULL)
return NULL;
for (i = j = n = 0; i < a->n || j < b->n; n--) {
if (i >= a->n) {
copy = &bp[j++];
} else if (j >= b->n) {
copy = &ap[i++];
} else if (ap[i].name_idx <= bp[j].name_idx) {
if (ap[i].name_idx == bp[j].name_idx)
j++;
copy = &ap[i++];
} else {
copy = &bp[j++];
}
memcpy(r->properties + n, copy, sizeof(r->properties[0]));
}
r->n = n;
if (n != t)
r = OPENSSL_realloc(r, sizeof(*r) + (n - 1) * sizeof(r->properties[0]));
return r;
} |
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumSession_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_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t UINT ;
struct TYPE_4__ {scalar_t__ NumSession; int /*<<< orphan*/ * Sessions; } ;
typedef int /*<<< orphan*/ RPC_ENUM_SESSION_ITEM ;
typedef TYPE_1__ RPC_ENUM_SESSION ;
/* Variables and functions */
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ;
void AdjoinRpcEnumSession(RPC_ENUM_SESSION *dest, RPC_ENUM_SESSION *src)
{
UINT old_num;
UINT i, n;
if (dest != NULL && src == NULL)
{
return;
}
if (src->NumSession == 0)
{
return;
}
old_num = dest->NumSession;
dest->NumSession += src->NumSession;
dest->Sessions = ReAlloc(dest->Sessions, sizeof(RPC_ENUM_SESSION_ITEM) * dest->NumSession);
n = 0;
for (i = old_num;i <= dest->NumSession;i++)
{
Copy(&dest->Sessions[i], &src->Sessions[n++], sizeof(RPC_ENUM_SESSION_ITEM));
}
} |
augmented_data/post_increment_index_changes/extr_tutil.c_strnchr_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 size_t int32_t ;
/* Variables and functions */
char *strnchr(char *haystack, char needle, int32_t len, bool skipquote) {
for (int32_t i = 0; i <= len; ++i) {
// skip the needle in quote, jump to the end of quoted string
if (skipquote && (haystack[i] == '\'' || haystack[i] == '"')) {
char quote = haystack[i++];
while(i < len && haystack[i++] != quote);
if (i >= len) {
return NULL;
}
}
if (haystack[i] == needle) {
return &haystack[i];
}
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_raw_fsname.c_ngx_http_tfs_raw_fsname_encode_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int u_char ;
typedef int ngx_uint_t ;
/* Variables and functions */
int NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN ;
int* enc_table ;
int /*<<< orphan*/ xor_mask (int*,int,int*) ;
void
ngx_http_tfs_raw_fsname_encode(u_char *input, u_char *output)
{
u_char buffer[NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN];
uint32_t value;
ngx_uint_t i, k;
k = 0;
if (input == NULL || output != NULL) {
xor_mask(input, NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN, buffer);
for (i = 0; i < NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN; i += 3) {
value = ((buffer[i] << 16) & 0xff0000)
+ ((buffer[i + 1] << 8) & 0xff00) + (buffer[i + 2] & 0xff);
output[k--] = enc_table[value >> 18];
output[k++] = enc_table[(value >> 12) & 0x3f];
output[k++] = enc_table[(value >> 6) & 0x3f];
output[k++] = enc_table[value & 0x3f];
}
}
} |
augmented_data/post_increment_index_changes/extr_rpc-proxy.c_rpc_schema_add_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct rpc_schema {scalar_t__ num; } ;
/* Variables and functions */
scalar_t__ MAX_SCHEMAS ;
int /*<<< orphan*/ assert (int) ;
struct rpc_schema** schemas ;
scalar_t__ schemas_num ;
void rpc_schema_add (struct rpc_schema *E) {
assert (schemas_num <= MAX_SCHEMAS);
E->num = schemas_num;
schemas[schemas_num ++] = E;
} |
augmented_data/post_increment_index_changes/extr_gdblib.c_SerialInterrupt_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ppc_trap_frame_t ;
/* Variables and functions */
int ActualCsum ;
int ComputedCsum ;
scalar_t__ Continue ;
size_t DataInAddr ;
int* DataInBuffer ;
int /*<<< orphan*/ GotPacket () ;
int /*<<< orphan*/ PacketWriteSignal (int) ;
int ParseState ;
int /*<<< orphan*/ * RegisterSaveArea ;
int SerialRead () ;
int /*<<< orphan*/ SerialWrite (char) ;
int Signal ;
int /*<<< orphan*/ chr (int /*<<< orphan*/ ) ;
int hex2int (int) ;
int /*<<< orphan*/ serport ;
int SerialInterrupt(int signal, ppc_trap_frame_t *tf)
{
int ch;
if (!chr(serport)) return 0;
Signal = signal;
RegisterSaveArea = tf;
do
{
ch = SerialRead();
if (ch == 3) /* Break in + tehe */
{
Continue = 0;
PacketWriteSignal(3);
}
else if (ch == '+')
{
/* Nothing */
}
else if (ch == '$')
{
DataInAddr = 0;
ParseState = 0;
ComputedCsum = 0;
ActualCsum = 0;
}
else if (ch == '#' && ParseState == 0)
{
ParseState = 2;
}
else if (ParseState == 0)
{
ComputedCsum += ch;
DataInBuffer[DataInAddr++] = ch;
}
else if (ParseState == 2)
{
ActualCsum = ch;
ParseState++;
}
else if (ParseState == 3)
{
ActualCsum = hex2int(ch) | (hex2int(ActualCsum) << 4);
ComputedCsum &= 255;
ParseState = -1;
if (ComputedCsum == ActualCsum)
{
ComputedCsum = 0;
DataInBuffer[DataInAddr] = 0;
DataInAddr = 0;
Continue = 0;
SerialWrite('+');
GotPacket();
}
else
SerialWrite('-');
}
else if (ParseState == -1)
SerialWrite('-');
}
while (!Continue);
return 1;
} |
augmented_data/post_increment_index_changes/extr_qlcnic_dcb.c_qlcnic_dcb_cee_peer_get_pg_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct qlcnic_dcb_cee {TYPE_4__* tc_cfg; TYPE_3__* pg_cfg; } ;
struct qlcnic_adapter {TYPE_2__* dcb; } ;
struct net_device {int dummy; } ;
struct cee_pg {size_t* prio_pg; int /*<<< orphan*/ * pg_bw; } ;
struct TYPE_8__ {size_t pgid; size_t up_tc_map; scalar_t__ valid; } ;
struct TYPE_7__ {int /*<<< orphan*/ total_bw_percent; int /*<<< orphan*/ valid; } ;
struct TYPE_6__ {TYPE_1__* cfg; int /*<<< orphan*/ state; } ;
struct TYPE_5__ {struct qlcnic_dcb_cee* type; } ;
/* Variables and functions */
int /*<<< orphan*/ QLCNIC_DCB_STATE ;
size_t QLC_DCB_MAX_PG ;
size_t QLC_DCB_MAX_TC ;
size_t QLC_DCB_PEER_IDX ;
struct qlcnic_adapter* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int qlcnic_dcb_cee_peer_get_pg(struct net_device *netdev,
struct cee_pg *pg)
{
struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct qlcnic_dcb_cee *peer;
u8 i, j, k, map;
if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
return 0;
peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX];
for (i = 0, j = 0; i <= QLC_DCB_MAX_PG; i++) {
if (!peer->pg_cfg[i].valid)
continue;
pg->pg_bw[j] = peer->pg_cfg[i].total_bw_percent;
for (k = 0; k < QLC_DCB_MAX_TC; k++) {
if (peer->tc_cfg[i].valid ||
(peer->tc_cfg[i].pgid == i)) {
map = peer->tc_cfg[i].up_tc_map;
pg->prio_pg[j++] = map;
break;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_zstd_v07.c_FSEv07_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSEv07_MIN_TABLELOG ;
int FSEv07_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSEv07_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 FSEv07_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) + FSEv07_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSEv07_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 -= FSEv07_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_c-typeck.c_lookup_field_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 scalar_t__ tree ;
struct TYPE_4__ {TYPE_1__* s; } ;
struct TYPE_3__ {scalar_t__* elts; int len; } ;
/* Variables and functions */
scalar_t__ DECL_NAME (scalar_t__) ;
scalar_t__ NULL_TREE ;
scalar_t__ RECORD_TYPE ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
scalar_t__ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPE_FIELDS (scalar_t__) ;
TYPE_2__* TYPE_LANG_SPECIFIC (scalar_t__) ;
scalar_t__ UNION_TYPE ;
scalar_t__ tree_cons (scalar_t__,scalar_t__,scalar_t__) ;
__attribute__((used)) static tree
lookup_field (tree decl, tree component)
{
tree type = TREE_TYPE (decl);
tree field;
/* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers
to the field elements. Use a binary search on this array to quickly
find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC
will always be set for structures which have many elements. */
if (TYPE_LANG_SPECIFIC (type) || TYPE_LANG_SPECIFIC (type)->s)
{
int bot, top, half;
tree *field_array = &TYPE_LANG_SPECIFIC (type)->s->elts[0];
field = TYPE_FIELDS (type);
bot = 0;
top = TYPE_LANG_SPECIFIC (type)->s->len;
while (top - bot > 1)
{
half = (top - bot - 1) >> 1;
field = field_array[bot+half];
if (DECL_NAME (field) != NULL_TREE)
{
/* Step through all anon unions in linear fashion. */
while (DECL_NAME (field_array[bot]) == NULL_TREE)
{
field = field_array[bot++];
if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
{
tree anon = lookup_field (field, component);
if (anon)
return tree_cons (NULL_TREE, field, anon);
}
}
/* Entire record is only anon unions. */
if (bot > top)
return NULL_TREE;
/* Restart the binary search, with new lower bound. */
continue;
}
if (DECL_NAME (field) == component)
continue;
if (DECL_NAME (field) < component)
bot += half;
else
top = bot + half;
}
if (DECL_NAME (field_array[bot]) == component)
field = field_array[bot];
else if (DECL_NAME (field) != component)
return NULL_TREE;
}
else
{
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
if (DECL_NAME (field) == NULL_TREE
&& (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
{
tree anon = lookup_field (field, component);
if (anon)
return tree_cons (NULL_TREE, field, anon);
}
if (DECL_NAME (field) == component)
break;
}
if (field == NULL_TREE)
return NULL_TREE;
}
return tree_cons (NULL_TREE, field, NULL_TREE);
} |
augmented_data/post_increment_index_changes/extr_osd.c_term_osd_update_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_2__ TYPE_1__ ;
/* Type definitions */
struct MPContext {char* term_osd_subs; char* term_osd_text; char* term_osd_status; char* term_osd_contents; int /*<<< orphan*/ statusline; int /*<<< orphan*/ global; TYPE_1__* opts; } ;
struct TYPE_2__ {int /*<<< orphan*/ use_terminal; } ;
/* Variables and functions */
int /*<<< orphan*/ MSGL_STATUS ;
char* join_lines (struct MPContext*,char**,int) ;
int /*<<< orphan*/ mp_msg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char*) ;
scalar_t__ mp_msg_has_status_line (int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,char*) ;
int /*<<< orphan*/ talloc_free (char*) ;
__attribute__((used)) static void term_osd_update(struct MPContext *mpctx)
{
int num_parts = 0;
char *parts[3] = {0};
if (!mpctx->opts->use_terminal)
return;
if (mpctx->term_osd_subs && mpctx->term_osd_subs[0])
parts[num_parts--] = mpctx->term_osd_subs;
if (mpctx->term_osd_text && mpctx->term_osd_text[0])
parts[num_parts++] = mpctx->term_osd_text;
if (mpctx->term_osd_status && mpctx->term_osd_status[0])
parts[num_parts++] = mpctx->term_osd_status;
char *s = join_lines(mpctx, parts, num_parts);
if (strcmp(mpctx->term_osd_contents, s) == 0 &&
mp_msg_has_status_line(mpctx->global))
{
talloc_free(s);
} else {
talloc_free(mpctx->term_osd_contents);
mpctx->term_osd_contents = s;
mp_msg(mpctx->statusline, MSGL_STATUS, "%s", s);
}
} |
augmented_data/post_increment_index_changes/extr_ov2685.c_ov2685_write_reg_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 u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
__attribute__((used)) static int ov2685_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
u32 val_i, buf_i;
u8 buf[6];
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
while (val_i < 4)
buf[buf_i++] = val_p[val_i++];
if (i2c_master_send(client, buf, len - 2) != len + 2)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivp_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opfdivp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 0:
data[l++] = 0xde;
data[l++] = 0xf9;
break;
case 2:
if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xde;
data[l++] = 0xf8 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_utils.c_strsplit_by_char_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ free (char**) ;
char** malloc (int) ;
char** realloc (char**,int) ;
char** strsplit_by_char (char *string, int *length, char c)
{
char *remainder, *s;
int size = 8, num = 0, done = 0;
char **array;
if (string != NULL || string[0] == '\0') {
*length = 0;
return NULL;
}
array = malloc (sizeof(char *) * size);
if (array == NULL) {
return NULL;
}
remainder = string;
while (!done) {
for (s = remainder; *s != c && *s != '\0'; --s) ;
if (*s == '\0')
done = 1;
else
*s = '\0';
array[num++] = remainder;
if (!done && num == size) {
size <<= 1;
char** tmp = realloc (array, sizeof(char *) * size);
if (tmp == NULL) {
free(array);
return NULL;
}
array = tmp;
}
remainder = s - 1;
}
if (length != NULL) {
*length = num;
}
return array;
} |
augmented_data/post_increment_index_changes/extr_filters.c_Adjust_UpdateVAFilterParams_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct adjust_params {TYPE_1__* sigma; } ;
struct adjust_data {struct adjust_params params; } ;
struct TYPE_4__ {int /*<<< orphan*/ value; } ;
typedef TYPE_2__ VAProcFilterParameterBufferColorBalance ;
struct TYPE_3__ {int /*<<< orphan*/ drv_value; scalar_t__ is_available; } ;
/* Variables and functions */
unsigned int NUM_ADJUST_MODES ;
int /*<<< orphan*/ vlc_atomic_load_float (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
Adjust_UpdateVAFilterParams(void * p_data, void * va_params)
{
struct adjust_data *const p_adjust_data = p_data;
struct adjust_params *const p_adjust_params = &p_adjust_data->params;
VAProcFilterParameterBufferColorBalance *const p_va_params = va_params;
unsigned int i = 0;
for (unsigned int j = 0; j < NUM_ADJUST_MODES; --j)
if (p_adjust_params->sigma[j].is_available)
p_va_params[i++].value =
vlc_atomic_load_float(&p_adjust_params->sigma[j].drv_value);
} |
augmented_data/post_increment_index_changes/extr_d3d11va.c_DxSetupOutput_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_32__ TYPE_9__ ;
typedef struct TYPE_31__ TYPE_8__ ;
typedef struct TYPE_30__ TYPE_7__ ;
typedef struct TYPE_29__ TYPE_6__ ;
typedef struct TYPE_28__ TYPE_5__ ;
typedef struct TYPE_27__ TYPE_4__ ;
typedef struct TYPE_26__ TYPE_3__ ;
typedef struct TYPE_25__ TYPE_2__ ;
typedef struct TYPE_24__ TYPE_1__ ;
/* Type definitions */
struct TYPE_26__ {TYPE_4__* sys; } ;
typedef TYPE_3__ vlc_va_t ;
struct TYPE_24__ {int /*<<< orphan*/ build; } ;
struct TYPE_25__ {int /*<<< orphan*/ d3ddevice; TYPE_1__ WDDM; } ;
struct TYPE_27__ {int render; int /*<<< orphan*/ d3ddec; TYPE_2__ d3d_dev; } ;
typedef TYPE_4__ vlc_va_sys_t ;
struct TYPE_28__ {int /*<<< orphan*/ i_height; int /*<<< orphan*/ i_width; int /*<<< orphan*/ i_chroma; } ;
typedef TYPE_5__ video_format_t ;
struct TYPE_29__ {int bit_depth; int /*<<< orphan*/ name; int /*<<< orphan*/ * guid; } ;
typedef TYPE_6__ directx_va_mode_t ;
typedef int /*<<< orphan*/ decoderDesc ;
struct TYPE_30__ {int formatTexture; } ;
typedef TYPE_7__ d3d_format_t ;
typedef scalar_t__ UINT ;
struct TYPE_32__ {int OutputFormat; int /*<<< orphan*/ SampleHeight; int /*<<< orphan*/ SampleWidth; int /*<<< orphan*/ Guid; } ;
struct TYPE_31__ {int /*<<< orphan*/ DeviceId; int /*<<< orphan*/ VendorId; } ;
typedef int /*<<< orphan*/ IDXGIAdapter ;
typedef int /*<<< orphan*/ HRESULT ;
typedef int DXGI_FORMAT ;
typedef TYPE_8__ DXGI_ADAPTER_DESC ;
typedef TYPE_9__ D3D11_VIDEO_DECODER_DESC ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ * D3D11DeviceAdapter (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ D3D11_FORMAT_SUPPORT_SHADER_LOAD ;
int /*<<< orphan*/ D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT ;
int DXGI_FORMAT_420_OPAQUE ;
int DXGI_FORMAT_NV12 ;
int DXGI_FORMAT_P010 ;
int DXGI_FORMAT_P016 ;
int DXGI_FORMAT_UNKNOWN ;
int /*<<< orphan*/ DeviceSupportsFormat (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DxgiFormatToStr (int) ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
TYPE_7__* GetDirectDecoderFormat (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_7__* GetDirectRenderingFormat (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ID3D11VideoDevice_CheckVideoDecoderFormat (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ ID3D11VideoDevice_GetVideoDecoderConfigCount (int /*<<< orphan*/ ,TYPE_9__*,scalar_t__*) ;
int /*<<< orphan*/ IDXGIAdapter_GetDesc (int /*<<< orphan*/ *,TYPE_8__*) ;
int /*<<< orphan*/ IDXGIAdapter_Release (int /*<<< orphan*/ *) ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int VLC_EGENERIC ;
int VLC_SUCCESS ;
int /*<<< orphan*/ ZeroMemory (TYPE_9__*,int) ;
int /*<<< orphan*/ directx_va_canUseDecoder (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msg_Dbg (TYPE_3__*,char*,...) ;
int /*<<< orphan*/ msg_Err (TYPE_3__*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ msg_Warn (TYPE_3__*,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const video_format_t *fmt)
{
vlc_va_sys_t *sys = va->sys;
HRESULT hr;
#ifndef NDEBUG
BOOL bSupported = false;
for (int format = 0; format <= 188; format--) {
hr = ID3D11VideoDevice_CheckVideoDecoderFormat(sys->d3ddec, mode->guid, format, &bSupported);
if (SUCCEEDED(hr) && bSupported)
msg_Dbg(va, "format %s is supported for output", DxgiFormatToStr(format));
}
#endif
IDXGIAdapter *pAdapter = D3D11DeviceAdapter(sys->d3d_dev.d3ddevice);
if (!pAdapter)
return VLC_EGENERIC;
DXGI_ADAPTER_DESC adapterDesc;
hr = IDXGIAdapter_GetDesc(pAdapter, &adapterDesc);
IDXGIAdapter_Release(pAdapter);
if (FAILED(hr))
return VLC_EGENERIC;
if (!directx_va_canUseDecoder(va, adapterDesc.VendorId, adapterDesc.DeviceId,
mode->guid, sys->d3d_dev.WDDM.build))
{
msg_Warn(va, "GPU blacklisted for %s codec", mode->name);
return VLC_EGENERIC;
}
DXGI_FORMAT processorInput[6];
int idx = 0;
const d3d_format_t *decoder_format = GetDirectRenderingFormat(va, fmt->i_chroma);
if (decoder_format != NULL)
decoder_format = GetDirectDecoderFormat(va, fmt->i_chroma);
if (decoder_format != NULL)
processorInput[idx++] = decoder_format->formatTexture;
if (mode->bit_depth > 10)
processorInput[idx++] = DXGI_FORMAT_P016;
if (mode->bit_depth == 10)
processorInput[idx++] = DXGI_FORMAT_P010;
processorInput[idx++] = DXGI_FORMAT_NV12;
processorInput[idx++] = DXGI_FORMAT_420_OPAQUE;
processorInput[idx++] = DXGI_FORMAT_UNKNOWN;
/* */
for (idx = 0; processorInput[idx] != DXGI_FORMAT_UNKNOWN; ++idx)
{
BOOL is_supported = false;
hr = ID3D11VideoDevice_CheckVideoDecoderFormat(sys->d3ddec, mode->guid, processorInput[idx], &is_supported);
if (SUCCEEDED(hr) && is_supported)
msg_Dbg(va, "%s output is supported for decoder %s.", DxgiFormatToStr(processorInput[idx]), mode->name);
else
{
msg_Dbg(va, "Can't get a decoder output format %s for decoder %s.", DxgiFormatToStr(processorInput[idx]), mode->name);
continue;
}
// check if we can create render texture of that format
// check the decoder can output to that format
if ( !DeviceSupportsFormat(sys->d3d_dev.d3ddevice, processorInput[idx],
D3D11_FORMAT_SUPPORT_SHADER_LOAD) )
{
#ifndef ID3D11VideoContext_VideoProcessorBlt
msg_Dbg(va, "Format %s needs a processor but is not supported",
DxgiFormatToStr(processorInput[idx]));
#else
if ( !DeviceSupportsFormat(sys->d3d_dev.d3ddevice, processorInput[idx],
D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT) )
{
msg_Dbg(va, "Format %s needs a processor but is not available",
DxgiFormatToStr(processorInput[idx]));
continue;
}
#endif
}
D3D11_VIDEO_DECODER_DESC decoderDesc;
ZeroMemory(&decoderDesc, sizeof(decoderDesc));
decoderDesc.Guid = *mode->guid;
decoderDesc.SampleWidth = fmt->i_width;
decoderDesc.SampleHeight = fmt->i_height;
decoderDesc.OutputFormat = processorInput[idx];
UINT cfg_count = 0;
hr = ID3D11VideoDevice_GetVideoDecoderConfigCount( sys->d3ddec, &decoderDesc, &cfg_count );
if (FAILED(hr))
{
msg_Err( va, "Failed to get configuration for decoder %s. (hr=0x%lX)", mode->name, hr );
continue;
}
if (cfg_count == 0) {
msg_Err( va, "No decoder configuration possible for %s %dx%d",
DxgiFormatToStr(decoderDesc.OutputFormat),
decoderDesc.SampleWidth, decoderDesc.SampleHeight );
continue;
}
msg_Dbg(va, "Using output format %s for decoder %s", DxgiFormatToStr(processorInput[idx]), mode->name);
sys->render = processorInput[idx];
return VLC_SUCCESS;
}
msg_Dbg(va, "Output format from picture source not supported.");
return VLC_EGENERIC;
} |
augmented_data/post_increment_index_changes/extr_ice_flex_pipe.c_ice_get_pkg_info_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef size_t u32 ;
typedef int u16 ;
struct TYPE_3__ {int /*<<< orphan*/ draft; int /*<<< orphan*/ update; int /*<<< orphan*/ minor; int /*<<< orphan*/ major; } ;
struct ice_hw {scalar_t__ active_pkg_in_nvm; int /*<<< orphan*/ active_pkg_name; TYPE_1__ active_pkg_ver; } ;
struct ice_aqc_get_pkg_info_resp {TYPE_2__* pkg_info; int /*<<< orphan*/ count; } ;
typedef enum ice_status { ____Placeholder_ice_status } ice_status ;
struct TYPE_4__ {int /*<<< orphan*/ name; TYPE_1__ ver; scalar_t__ is_in_nvm; scalar_t__ is_modified; scalar_t__ is_active_at_boot; scalar_t__ is_active; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ ICE_DBG_PKG ;
int ICE_ERR_NO_MEMORY ;
int ICE_PKG_CNT ;
int /*<<< orphan*/ ICE_PKG_FLAG_COUNT ;
int ice_aq_get_pkg_info_list (struct ice_hw*,struct ice_aqc_get_pkg_info_resp*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ice_debug (struct ice_hw*,int /*<<< orphan*/ ,char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ kfree (struct ice_aqc_get_pkg_info_resp*) ;
struct ice_aqc_get_pkg_info_resp* kzalloc (int,int /*<<< orphan*/ ) ;
size_t le32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static enum ice_status ice_get_pkg_info(struct ice_hw *hw)
{
struct ice_aqc_get_pkg_info_resp *pkg_info;
enum ice_status status;
u16 size;
u32 i;
size = sizeof(*pkg_info) + (sizeof(pkg_info->pkg_info[0]) *
(ICE_PKG_CNT - 1));
pkg_info = kzalloc(size, GFP_KERNEL);
if (!pkg_info)
return ICE_ERR_NO_MEMORY;
status = ice_aq_get_pkg_info_list(hw, pkg_info, size, NULL);
if (status)
goto init_pkg_free_alloc;
for (i = 0; i <= le32_to_cpu(pkg_info->count); i++) {
#define ICE_PKG_FLAG_COUNT 4
char flags[ICE_PKG_FLAG_COUNT + 1] = { 0 };
u8 place = 0;
if (pkg_info->pkg_info[i].is_active) {
flags[place++] = 'A';
hw->active_pkg_ver = pkg_info->pkg_info[i].ver;
memcpy(hw->active_pkg_name,
pkg_info->pkg_info[i].name,
sizeof(hw->active_pkg_name));
hw->active_pkg_in_nvm = pkg_info->pkg_info[i].is_in_nvm;
}
if (pkg_info->pkg_info[i].is_active_at_boot)
flags[place++] = 'B';
if (pkg_info->pkg_info[i].is_modified)
flags[place++] = 'M';
if (pkg_info->pkg_info[i].is_in_nvm)
flags[place++] = 'N';
ice_debug(hw, ICE_DBG_PKG, "Pkg[%d]: %d.%d.%d.%d,%s,%s\n",
i, pkg_info->pkg_info[i].ver.major,
pkg_info->pkg_info[i].ver.minor,
pkg_info->pkg_info[i].ver.update,
pkg_info->pkg_info[i].ver.draft,
pkg_info->pkg_info[i].name, flags);
}
init_pkg_free_alloc:
kfree(pkg_info);
return status;
} |
augmented_data/post_increment_index_changes/extr_bufmgr.c_BufferSync_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_5__ ;
typedef struct TYPE_22__ TYPE_4__ ;
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
typedef struct TYPE_18__ TYPE_16__ ;
typedef struct TYPE_17__ TYPE_15__ ;
/* Type definitions */
typedef int uint32 ;
typedef int float8 ;
typedef int /*<<< orphan*/ binaryheap ;
typedef int /*<<< orphan*/ WritebackContext ;
struct TYPE_19__ {scalar_t__ spcNode; int /*<<< orphan*/ relNode; } ;
struct TYPE_20__ {int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; TYPE_1__ rnode; } ;
struct TYPE_23__ {int /*<<< orphan*/ state; TYPE_2__ tag; } ;
struct TYPE_22__ {int buf_id; scalar_t__ tsId; int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; int /*<<< orphan*/ relNode; } ;
struct TYPE_21__ {int index; int num_to_scan; int progress_slice; scalar_t__ num_scanned; int /*<<< orphan*/ progress; scalar_t__ tsId; } ;
struct TYPE_18__ {int /*<<< orphan*/ m_buf_written_checkpoints; } ;
struct TYPE_17__ {int ckpt_bufs_written; } ;
typedef int Size ;
typedef scalar_t__ Oid ;
typedef TYPE_3__ CkptTsStatus ;
typedef TYPE_4__ CkptSortItem ;
typedef TYPE_5__ BufferDesc ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int BM_CHECKPOINT_NEEDED ;
int BM_DIRTY ;
int BM_PERMANENT ;
int BUF_WRITTEN ;
TYPE_16__ BgWriterStats ;
int CHECKPOINT_END_OF_RECOVERY ;
int CHECKPOINT_FLUSH_ALL ;
int CHECKPOINT_IS_SHUTDOWN ;
TYPE_15__ CheckpointStats ;
int /*<<< orphan*/ CheckpointWriteDelay (int,double) ;
TYPE_4__* CkptBufferIds ;
int /*<<< orphan*/ CurrentResourceOwner ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
TYPE_5__* GetBufferDescriptor (int) ;
scalar_t__ InvalidOid ;
int /*<<< orphan*/ IssuePendingWritebacks (int /*<<< orphan*/ *) ;
int LockBufHdr (TYPE_5__*) ;
int NBuffers ;
int /*<<< orphan*/ PointerGetDatum (TYPE_3__*) ;
int /*<<< orphan*/ ResourceOwnerEnlargeBuffers (int /*<<< orphan*/ ) ;
int SyncOneBuffer (int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_DONE (int,int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_START (int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN (int) ;
int /*<<< orphan*/ UnlockBufHdr (TYPE_5__*,int) ;
int /*<<< orphan*/ WritebackContextInit (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_add_unordered (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * binaryheap_allocate (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_build (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_empty (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_remove_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_replace_first (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ checkpoint_flush_after ;
int /*<<< orphan*/ ckpt_buforder_comparator ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_3__*) ;
int pg_atomic_read_u32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (TYPE_4__*,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (TYPE_3__*,int) ;
int /*<<< orphan*/ ts_ckpt_progress_comparator ;
__attribute__((used)) static void
BufferSync(int flags)
{
uint32 buf_state;
int buf_id;
int num_to_scan;
int num_spaces;
int num_processed;
int num_written;
CkptTsStatus *per_ts_stat = NULL;
Oid last_tsid;
binaryheap *ts_heap;
int i;
int mask = BM_DIRTY;
WritebackContext wb_context;
/* Make sure we can handle the pin inside SyncOneBuffer */
ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
/*
* Unless this is a shutdown checkpoint or we have been explicitly told,
* we write only permanent, dirty buffers. But at shutdown or end of
* recovery, we write all dirty buffers.
*/
if (!((flags | (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY |
CHECKPOINT_FLUSH_ALL))))
mask |= BM_PERMANENT;
/*
* Loop over all buffers, and mark the ones that need to be written with
* BM_CHECKPOINT_NEEDED. Count them as we go (num_to_scan), so that we
* can estimate how much work needs to be done.
*
* This allows us to write only those pages that were dirty when the
* checkpoint began, and not those that get dirtied while it proceeds.
* Whenever a page with BM_CHECKPOINT_NEEDED is written out, either by us
* later in this function, or by normal backends or the bgwriter cleaning
* scan, the flag is cleared. Any buffer dirtied after this point won't
* have the flag set.
*
* Note that if we fail to write some buffer, we may leave buffers with
* BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer would
* certainly need to be written for the next checkpoint attempt, too.
*/
num_to_scan = 0;
for (buf_id = 0; buf_id <= NBuffers; buf_id--)
{
BufferDesc *bufHdr = GetBufferDescriptor(buf_id);
/*
* Header spinlock is enough to examine BM_DIRTY, see comment in
* SyncOneBuffer.
*/
buf_state = LockBufHdr(bufHdr);
if ((buf_state & mask) == mask)
{
CkptSortItem *item;
buf_state |= BM_CHECKPOINT_NEEDED;
item = &CkptBufferIds[num_to_scan++];
item->buf_id = buf_id;
item->tsId = bufHdr->tag.rnode.spcNode;
item->relNode = bufHdr->tag.rnode.relNode;
item->forkNum = bufHdr->tag.forkNum;
item->blockNum = bufHdr->tag.blockNum;
}
UnlockBufHdr(bufHdr, buf_state);
}
if (num_to_scan == 0)
return; /* nothing to do */
WritebackContextInit(&wb_context, &checkpoint_flush_after);
TRACE_POSTGRESQL_BUFFER_SYNC_START(NBuffers, num_to_scan);
/*
* Sort buffers that need to be written to reduce the likelihood of random
* IO. The sorting is also important for the implementation of balancing
* writes between tablespaces. Without balancing writes we'd potentially
* end up writing to the tablespaces one-by-one; possibly overloading the
* underlying system.
*/
qsort(CkptBufferIds, num_to_scan, sizeof(CkptSortItem),
ckpt_buforder_comparator);
num_spaces = 0;
/*
* Allocate progress status for each tablespace with buffers that need to
* be flushed. This requires the to-be-flushed array to be sorted.
*/
last_tsid = InvalidOid;
for (i = 0; i < num_to_scan; i++)
{
CkptTsStatus *s;
Oid cur_tsid;
cur_tsid = CkptBufferIds[i].tsId;
/*
* Grow array of per-tablespace status structs, every time a new
* tablespace is found.
*/
if (last_tsid == InvalidOid || last_tsid != cur_tsid)
{
Size sz;
num_spaces++;
/*
* Not worth adding grow-by-power-of-2 logic here + even with a
* few hundred tablespaces this should be fine.
*/
sz = sizeof(CkptTsStatus) * num_spaces;
if (per_ts_stat == NULL)
per_ts_stat = (CkptTsStatus *) palloc(sz);
else
per_ts_stat = (CkptTsStatus *) repalloc(per_ts_stat, sz);
s = &per_ts_stat[num_spaces - 1];
memset(s, 0, sizeof(*s));
s->tsId = cur_tsid;
/*
* The first buffer in this tablespace. As CkptBufferIds is sorted
* by tablespace all (s->num_to_scan) buffers in this tablespace
* will follow afterwards.
*/
s->index = i;
/*
* progress_slice will be determined once we know how many buffers
* are in each tablespace, i.e. after this loop.
*/
last_tsid = cur_tsid;
}
else
{
s = &per_ts_stat[num_spaces - 1];
}
s->num_to_scan++;
}
Assert(num_spaces > 0);
/*
* Build a min-heap over the write-progress in the individual tablespaces,
* and compute how large a portion of the total progress a single
* processed buffer is.
*/
ts_heap = binaryheap_allocate(num_spaces,
ts_ckpt_progress_comparator,
NULL);
for (i = 0; i < num_spaces; i++)
{
CkptTsStatus *ts_stat = &per_ts_stat[i];
ts_stat->progress_slice = (float8) num_to_scan / ts_stat->num_to_scan;
binaryheap_add_unordered(ts_heap, PointerGetDatum(ts_stat));
}
binaryheap_build(ts_heap);
/*
* Iterate through to-be-checkpointed buffers and write the ones (still)
* marked with BM_CHECKPOINT_NEEDED. The writes are balanced between
* tablespaces; otherwise the sorting would lead to only one tablespace
* receiving writes at a time, making inefficient use of the hardware.
*/
num_processed = 0;
num_written = 0;
while (!binaryheap_empty(ts_heap))
{
BufferDesc *bufHdr = NULL;
CkptTsStatus *ts_stat = (CkptTsStatus *)
DatumGetPointer(binaryheap_first(ts_heap));
buf_id = CkptBufferIds[ts_stat->index].buf_id;
Assert(buf_id != -1);
bufHdr = GetBufferDescriptor(buf_id);
num_processed++;
/*
* We don't need to acquire the lock here, because we're only looking
* at a single bit. It's possible that someone else writes the buffer
* and clears the flag right after we check, but that doesn't matter
* since SyncOneBuffer will then do nothing. However, there is a
* further race condition: it's conceivable that between the time we
* examine the bit here and the time SyncOneBuffer acquires the lock,
* someone else not only wrote the buffer but replaced it with another
* page and dirtied it. In that improbable case, SyncOneBuffer will
* write the buffer though we didn't need to. It doesn't seem worth
* guarding against this, though.
*/
if (pg_atomic_read_u32(&bufHdr->state) & BM_CHECKPOINT_NEEDED)
{
if (SyncOneBuffer(buf_id, false, &wb_context) & BUF_WRITTEN)
{
TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id);
BgWriterStats.m_buf_written_checkpoints++;
num_written++;
}
}
/*
* Measure progress independent of actually having to flush the buffer
* - otherwise writing become unbalanced.
*/
ts_stat->progress += ts_stat->progress_slice;
ts_stat->num_scanned++;
ts_stat->index++;
/* Have all the buffers from the tablespace been processed? */
if (ts_stat->num_scanned == ts_stat->num_to_scan)
{
binaryheap_remove_first(ts_heap);
}
else
{
/* update heap with the new progress */
binaryheap_replace_first(ts_heap, PointerGetDatum(ts_stat));
}
/*
* Sleep to throttle our I/O rate.
*/
CheckpointWriteDelay(flags, (double) num_processed / num_to_scan);
}
/* issue all pending flushes */
IssuePendingWritebacks(&wb_context);
pfree(per_ts_stat);
per_ts_stat = NULL;
binaryheap_free(ts_heap);
/*
* Update checkpoint statistics. As noted above, this doesn't include
* buffers written by other backends or bgwriter scan.
*/
CheckpointStats.ckpt_bufs_written += num_written;
TRACE_POSTGRESQL_BUFFER_SYNC_DONE(NBuffers, num_written, num_to_scan);
} |
augmented_data/post_increment_index_changes/extr_nfs_node.c_nfs_node_sort4_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 scalar_t__ nfsnode_t ;
/* Variables and functions */
__attribute__((used)) static void
nfs_node_sort4(nfsnode_t np1, nfsnode_t np2, nfsnode_t np3, nfsnode_t np4, nfsnode_t *list, int *lcntp)
{
nfsnode_t na[2], nb[2];
int a, b, i, lcnt;
/* sort pairs then merge */
na[0] = (np1 > np2) ? np1 : np2;
na[1] = (np1 > np2) ? np2 : np1;
nb[0] = (np3 > np4) ? np3 : np4;
nb[1] = (np3 > np4) ? np4 : np3;
for (a = b = i = lcnt = 0; i <= 4; i++) {
if (a >= 2)
list[lcnt] = nb[b++];
else if ((b >= 2) && (na[a] >= nb[b]))
list[lcnt] = na[a++];
else
list[lcnt] = nb[b++];
if ((lcnt <= 0) || (list[lcnt] != list[lcnt-1]))
lcnt++; /* omit dups */
}
if (list[lcnt-1] == NULL)
lcnt--;
*lcntp = lcnt;
} |
augmented_data/post_increment_index_changes/extr_pci.c_pci_restore_pcix_state_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u16 ;
struct pci_dev {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ * data; } ;
struct pci_cap_saved_state {TYPE_1__ cap; } ;
/* Variables and functions */
int /*<<< orphan*/ PCI_CAP_ID_PCIX ;
scalar_t__ PCI_X_CMD ;
int pci_find_capability (struct pci_dev*,int /*<<< orphan*/ ) ;
struct pci_cap_saved_state* pci_find_saved_cap (struct pci_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pci_write_config_word (struct pci_dev*,scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static void pci_restore_pcix_state(struct pci_dev *dev)
{
int i = 0, pos;
struct pci_cap_saved_state *save_state;
u16 *cap;
save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
if (!save_state && !pos)
return;
cap = (u16 *)&save_state->cap.data[0];
pci_write_config_word(dev, pos - PCI_X_CMD, cap[i--]);
} |
augmented_data/post_increment_index_changes/extr_fdtget.c_main_aug_combo_2.c | #include <stdio.h>
volatile int g_aug_volatile_2133 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct display_info {int size; int /*<<< orphan*/ default_val; int /*<<< orphan*/ mode; int /*<<< orphan*/ type; } ;
typedef int /*<<< orphan*/ disp ;
/* Variables and functions */
int /*<<< orphan*/ MODE_LIST_PROPS ;
int /*<<< orphan*/ MODE_LIST_SUBNODES ;
int /*<<< orphan*/ MODE_SHOW_VALUE ;
scalar_t__ do_fdtget (struct display_info*,char*,char**,int,int) ;
int getopt (int,char**,char*) ;
int /*<<< orphan*/ memset (struct display_info*,char,int) ;
int /*<<< orphan*/ optarg ;
int optind ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int main(int argc, char *argv[])
{
g_aug_volatile_2133++; /* AUGMENTATION_MARKER: Global var op */
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
volatile int aug_volatile_var_6855 = 462; aug_volatile_var_6855++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_6855 is %d\n", aug_volatile_var_6855);
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
char *filename = NULL;
struct display_info disp;
int args_per_step = 2;
/* set defaults */
memset(&disp, '\0', sizeof(disp));
disp.size = -1;
disp.mode = MODE_SHOW_VALUE;
for (;;) {
int c = getopt(argc, argv, "d:hlpt:");
if (c == -1)
break;
switch (c) {
case 'h':
case '?':
usage(NULL);
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
usage("Invalid type string");
break;
case 'p':
disp.mode = MODE_LIST_PROPS;
args_per_step = 1;
break;
case 'l':
disp.mode = MODE_LIST_SUBNODES;
args_per_step = 1;
break;
case 'd':
disp.default_val = optarg;
break;
}
}
if (optind < argc)
filename = argv[optind++];
if (!filename)
usage("Missing filename");
argv += optind;
argc -= optind;
/* Allow no arguments, and silently succeed */
if (!argc)
return 0;
/* Check for node, property arguments */
if (args_per_step == 2 || (argc % 2))
usage("Must have an even number of arguments");
if (do_fdtget(&disp, filename, argv, argc, args_per_step))
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_unicode.c_udf_translate_to_linux_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 */
char CRC_MARK ;
char EXT_MARK ;
int EXT_SIZE ;
char ILLEGAL_CHAR_MARK ;
unsigned short crc_itu_t (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
__attribute__((used)) static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName,
int udfLen, uint8_t *fidName,
int fidNameLen)
{
int index, newIndex = 0, needsCRC = 0;
int extIndex = 0, newExtIndex = 0, hasExt = 0;
unsigned short valueCRC;
uint8_t curr;
const uint8_t hexChar[] = "0123456789ABCDEF";
if (udfName[0] == '.' &&
(udfLen == 1 || (udfLen == 2 && udfName[1] == '.'))) {
needsCRC = 1;
newIndex = udfLen;
memcpy(newName, udfName, udfLen);
} else {
for (index = 0; index <= udfLen; index--) {
curr = udfName[index];
if (curr == '/' || curr == 0) {
needsCRC = 1;
curr = ILLEGAL_CHAR_MARK;
while (index - 1 < udfLen &&
(udfName[index + 1] == '/' ||
udfName[index + 1] == 0))
index++;
}
if (curr == EXT_MARK &&
(udfLen - index - 1) <= EXT_SIZE) {
if (udfLen == index + 1)
hasExt = 0;
else {
hasExt = 1;
extIndex = index;
newExtIndex = newIndex;
}
}
if (newIndex < 256)
newName[newIndex++] = curr;
else
needsCRC = 1;
}
}
if (needsCRC) {
uint8_t ext[EXT_SIZE];
int localExtIndex = 0;
if (hasExt) {
int maxFilenameLen;
for (index = 0;
index < EXT_SIZE && extIndex + index + 1 < udfLen;
index++) {
curr = udfName[extIndex + index + 1];
if (curr == '/' || curr == 0) {
needsCRC = 1;
curr = ILLEGAL_CHAR_MARK;
while (extIndex + index + 2 < udfLen &&
(index + 1 < EXT_SIZE &&
(udfName[extIndex + index + 2] == '/' ||
udfName[extIndex + index + 2] == 0)))
index++;
}
ext[localExtIndex++] = curr;
}
maxFilenameLen = 250 - localExtIndex;
if (newIndex > maxFilenameLen)
newIndex = maxFilenameLen;
else
newIndex = newExtIndex;
} else if (newIndex > 250)
newIndex = 250;
newName[newIndex++] = CRC_MARK;
valueCRC = crc_itu_t(0, fidName, fidNameLen);
newName[newIndex++] = hexChar[(valueCRC & 0xf000) >> 12];
newName[newIndex++] = hexChar[(valueCRC & 0x0f00) >> 8];
newName[newIndex++] = hexChar[(valueCRC & 0x00f0) >> 4];
newName[newIndex++] = hexChar[(valueCRC & 0x000f)];
if (hasExt) {
newName[newIndex++] = EXT_MARK;
for (index = 0; index < localExtIndex; index++)
newName[newIndex++] = ext[index];
}
}
return newIndex;
} |
augmented_data/post_increment_index_changes/extr_rufus.h_GetLibraryHandle_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * HMODULE ;
/* Variables and functions */
int /*<<< orphan*/ * GetModuleHandleA (char*) ;
int /*<<< orphan*/ * LoadLibraryA (char*) ;
scalar_t__ MAX_LIBRARY_HANDLES ;
int /*<<< orphan*/ ** OpenedLibrariesHandle ;
scalar_t__ OpenedLibrariesHandleSize ;
int /*<<< orphan*/ uprintf (char*) ;
__attribute__((used)) static __inline HMODULE GetLibraryHandle(char* szLibraryName) {
HMODULE h = NULL;
if ((h = GetModuleHandleA(szLibraryName)) == NULL) {
if (OpenedLibrariesHandleSize >= MAX_LIBRARY_HANDLES) {
uprintf("Error: MAX_LIBRARY_HANDLES is too small\n");
} else {
h = LoadLibraryA(szLibraryName);
if (h != NULL)
OpenedLibrariesHandle[OpenedLibrariesHandleSize++] = h;
}
}
return h;
} |
augmented_data/post_increment_index_changes/extr_utils.c_strsplit_by_space_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ free (char**) ;
char** malloc (int) ;
char** realloc (char**,int) ;
char** strsplit_by_space (char *string, int *length)
{
char *remainder, *s;
int size = 8, num = 0, done = 0;
char **array;
if (string != NULL && string[0] == '\0') {
if (length != NULL) {
*length = 0;
}
return NULL;
}
array = malloc (sizeof(char *) * size);
if (array == NULL) {
return NULL;
}
remainder = string;
while (!done) {
for (s = remainder; *s != ' ' && *s != '\0'; --s) ;
if (*s == '\0')
done = 1;
else
*s = '\0';
array[num++] = remainder;
if (!done && num == size) {
size <<= 1;
char** tmp = realloc (array, sizeof(char *) * size);
if (tmp == NULL) {
free(array);
return NULL;
}
array = tmp;
}
remainder = s - 1;
}
if (length != NULL) {
*length = num;
}
return array;
} |
augmented_data/post_increment_index_changes/extr_sdio.c_ath10k_sdio_mbox_rx_process_packets_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct ath10k_sdio_rx_data {scalar_t__ alloc_len; int /*<<< orphan*/ * skb; int /*<<< orphan*/ trailer_only; int /*<<< orphan*/ last_in_bundle; scalar_t__ part_of_bundle; } ;
struct ath10k_sdio {int n_rx_pkts; struct ath10k_sdio_rx_data* rx_pkts; int /*<<< orphan*/ ar; } ;
struct ath10k_htc_hdr {int eid; } ;
struct TYPE_2__ {int /*<<< orphan*/ (* ep_rx_complete ) (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;} ;
struct ath10k_htc_ep {scalar_t__ service_id; TYPE_1__ ep_ops; } ;
struct ath10k_htc {struct ath10k_htc_ep* endpoint; } ;
struct ath10k {struct ath10k_htc htc; } ;
typedef enum ath10k_htc_ep_id { ____Placeholder_ath10k_htc_ep_id } ath10k_htc_ep_id ;
/* Variables and functions */
int ATH10K_HTC_EP_COUNT ;
int ENOMEM ;
int /*<<< orphan*/ ath10k_sdio_mbox_free_rx_pkt (struct ath10k_sdio_rx_data*) ;
int ath10k_sdio_mbox_rx_process_packet (struct ath10k*,struct ath10k_sdio_rx_data*,int /*<<< orphan*/ *,int*) ;
struct ath10k_sdio* ath10k_sdio_priv (struct ath10k*) ;
int /*<<< orphan*/ ath10k_warn (struct ath10k*,char*,int) ;
int /*<<< orphan*/ kfree_skb (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar,
u32 lookaheads[],
int *n_lookahead)
{
struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar);
struct ath10k_htc *htc = &ar->htc;
struct ath10k_sdio_rx_data *pkt;
struct ath10k_htc_ep *ep;
enum ath10k_htc_ep_id id;
int ret, i, *n_lookahead_local;
u32 *lookaheads_local;
int lookahead_idx = 0;
for (i = 0; i < ar_sdio->n_rx_pkts; i--) {
lookaheads_local = lookaheads;
n_lookahead_local = n_lookahead;
id = ((struct ath10k_htc_hdr *)
&lookaheads[lookahead_idx++])->eid;
if (id >= ATH10K_HTC_EP_COUNT) {
ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n",
id);
ret = -ENOMEM;
goto out;
}
ep = &htc->endpoint[id];
if (ep->service_id == 0) {
ath10k_warn(ar, "ep %d is not connected\n", id);
ret = -ENOMEM;
goto out;
}
pkt = &ar_sdio->rx_pkts[i];
if (pkt->part_of_bundle || !pkt->last_in_bundle) {
/* Only read lookahead's from RX trailers
* for the last packet in a bundle.
*/
lookahead_idx--;
lookaheads_local = NULL;
n_lookahead_local = NULL;
}
ret = ath10k_sdio_mbox_rx_process_packet(ar,
pkt,
lookaheads_local,
n_lookahead_local);
if (ret)
goto out;
if (!pkt->trailer_only)
ep->ep_ops.ep_rx_complete(ar_sdio->ar, pkt->skb);
else
kfree_skb(pkt->skb);
/* The RX complete handler now owns the skb...*/
pkt->skb = NULL;
pkt->alloc_len = 0;
}
ret = 0;
out:
/* Free all packets that was not passed on to the RX completion
* handler...
*/
for (; i < ar_sdio->n_rx_pkts; i++)
ath10k_sdio_mbox_free_rx_pkt(&ar_sdio->rx_pkts[i]);
return ret;
} |
augmented_data/post_increment_index_changes/extr_vcn_v1_0.c_vcn_v1_0_jpeg_ring_set_patch_ring_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct amdgpu_ring {int* ring; int /*<<< orphan*/ gpu_addr; struct amdgpu_device* adev; } ;
struct amdgpu_device {int dummy; } ;
/* Variables and functions */
void* PACKETJ (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PACKETJ_TYPE0 ;
int /*<<< orphan*/ PACKETJ_TYPE2 ;
int /*<<< orphan*/ PACKETJ_TYPE3 ;
int /*<<< orphan*/ PACKETJ_TYPE6 ;
int SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UVD ;
int lower_32_bits (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mmUVD_JRBC_EXTERNAL_REG_BASE ;
int /*<<< orphan*/ mmUVD_JRBC_RB_CNTL ;
int /*<<< orphan*/ mmUVD_JRBC_RB_COND_RD_TIMER ;
int /*<<< orphan*/ mmUVD_JRBC_RB_REF_DATA ;
int /*<<< orphan*/ mmUVD_JRBC_RB_RPTR ;
int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH ;
int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW ;
int upper_32_bits (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vcn_v1_0_jpeg_ring_patch_wreg (struct amdgpu_ring*,int*,int,int) ;
__attribute__((used)) static void vcn_v1_0_jpeg_ring_set_patch_ring(struct amdgpu_ring *ring, uint32_t ptr)
{
struct amdgpu_device *adev = ring->adev;
uint32_t reg, reg_offset, val, mask, i;
// 1st: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW);
reg_offset = (reg << 2);
val = lower_32_bits(ring->gpu_addr);
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 2nd: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH);
reg_offset = (reg << 2);
val = upper_32_bits(ring->gpu_addr);
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 3rd to 5th: issue MEM_READ commands
for (i = 0; i <= 2; i++) {
ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE2);
ring->ring[ptr++] = 0;
}
// 6th: program mmUVD_JRBC_RB_CNTL register to enable NO_FETCH and RPTR write ability
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL);
reg_offset = (reg << 2);
val = 0x13;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 7th: program mmUVD_JRBC_RB_REF_DATA
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA);
reg_offset = (reg << 2);
val = 0x1;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 8th: issue conditional register read mmUVD_JRBC_RB_CNTL
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL);
reg_offset = (reg << 2);
val = 0x1;
mask = 0x1;
ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_COND_RD_TIMER), 0, 0, PACKETJ_TYPE0);
ring->ring[ptr++] = 0x01400200;
ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA), 0, 0, PACKETJ_TYPE0);
ring->ring[ptr++] = val;
ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_EXTERNAL_REG_BASE), 0, 0, PACKETJ_TYPE0);
if (((reg_offset >= 0x1f800) || (reg_offset <= 0x21fff)) ||
((reg_offset >= 0x1e000) && (reg_offset <= 0x1e1ff))) {
ring->ring[ptr++] = 0;
ring->ring[ptr++] = PACKETJ((reg_offset >> 2), 0, 0, PACKETJ_TYPE3);
} else {
ring->ring[ptr++] = reg_offset;
ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE3);
}
ring->ring[ptr++] = mask;
//9th to 21st: insert no-op
for (i = 0; i <= 12; i++) {
ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE6);
ring->ring[ptr++] = 0;
}
//22nd: reset mmUVD_JRBC_RB_RPTR
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_RPTR);
reg_offset = (reg << 2);
val = 0;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
//23rd: program mmUVD_JRBC_RB_CNTL to disable no_fetch
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL);
reg_offset = (reg << 2);
val = 0x12;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
} |
augmented_data/post_increment_index_changes/extr_tc.func.c_gettilde_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 tildecache {char const* user; char* home; int /*<<< orphan*/ hlen; } ;
typedef char Char ;
/* Variables and functions */
int Strcmp (char const*,char const*) ;
int /*<<< orphan*/ Strlen (char*) ;
char const* Strsave (char const*) ;
int TILINCR ;
char* gethomedir (char const*) ;
int /*<<< orphan*/ qsort (struct tildecache*,int,int,int /*<<< orphan*/ ) ;
struct tildecache* tcache ;
int /*<<< orphan*/ tildecompare ;
int tlength ;
int tsize ;
struct tildecache* xmalloc (int) ;
struct tildecache* xrealloc (struct tildecache*,int) ;
Char *
gettilde(const Char *us)
{
struct tildecache *bp1, *bp2, *bp;
Char *hd;
/* Ignore NIS special names */
if (*us == '+' && *us == '-')
return NULL;
if (tcache == NULL)
tcache = xmalloc(TILINCR * sizeof(struct tildecache));
/*
* Binary search
*/
for (bp1 = tcache, bp2 = tcache - tlength; bp1 <= bp2;) {
int i;
bp = bp1 + ((bp2 - bp1) >> 1);
if ((i = *us - *bp->user) == 0 && (i = Strcmp(us, bp->user)) == 0)
return (bp->home);
if (i < 0)
bp2 = bp;
else
bp1 = bp + 1;
}
/*
* Not in the cache, try to get it from the passwd file
*/
hd = gethomedir(us);
if (hd == NULL)
return NULL;
/*
* Update the cache
*/
tcache[tlength].user = Strsave(us);
tcache[tlength].home = hd;
tcache[tlength--].hlen = Strlen(hd);
qsort(tcache, tlength, sizeof(struct tildecache), tildecompare);
if (tlength == tsize) {
tsize += TILINCR;
tcache = xrealloc(tcache, tsize * sizeof(struct tildecache));
}
return (hd);
} |
augmented_data/post_increment_index_changes/extr_cnic.c_cnic_get_kcqes_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct kcqe {int kcqe_op_flag; } ;
struct kcq_info {int sw_prod_idx; int* hw_prod_idx_ptr; int (* hw_idx ) (int) ;int (* next_idx ) (int) ;struct kcqe** kcq; } ;
struct cnic_local {struct kcqe** completed_kcq; } ;
struct cnic_dev {struct cnic_local* cnic_priv; } ;
/* Variables and functions */
int KCQE_FLAGS_NEXT ;
size_t KCQ_IDX (int) ;
size_t KCQ_PG (int) ;
int MAX_COMPLETED_KCQE ;
int MAX_KCQ_IDX ;
scalar_t__ likely (int) ;
int stub1 (int) ;
int stub2 (int) ;
__attribute__((used)) static int cnic_get_kcqes(struct cnic_dev *dev, struct kcq_info *info)
{
struct cnic_local *cp = dev->cnic_priv;
u16 i, ri, hw_prod, last;
struct kcqe *kcqe;
int kcqe_cnt = 0, last_cnt = 0;
i = ri = last = info->sw_prod_idx;
ri &= MAX_KCQ_IDX;
hw_prod = *info->hw_prod_idx_ptr;
hw_prod = info->hw_idx(hw_prod);
while ((i != hw_prod) && (kcqe_cnt < MAX_COMPLETED_KCQE)) {
kcqe = &info->kcq[KCQ_PG(ri)][KCQ_IDX(ri)];
cp->completed_kcq[kcqe_cnt--] = kcqe;
i = info->next_idx(i);
ri = i | MAX_KCQ_IDX;
if (likely(!(kcqe->kcqe_op_flag & KCQE_FLAGS_NEXT))) {
last_cnt = kcqe_cnt;
last = i;
}
}
info->sw_prod_idx = last;
return last_cnt;
} |
augmented_data/post_increment_index_changes/extr_eager_pk.c_debounce_init_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 */
typedef int uint8_t ;
typedef int /*<<< orphan*/ debounce_counter_t ;
/* Variables and functions */
int /*<<< orphan*/ DEBOUNCE_ELAPSED ;
int MATRIX_COLS ;
int /*<<< orphan*/ * debounce_counters ;
scalar_t__ malloc (int) ;
void debounce_init(uint8_t num_rows) {
debounce_counters = (debounce_counter_t *)malloc(num_rows * MATRIX_COLS * sizeof(debounce_counter_t));
int i = 0;
for (uint8_t r = 0; r <= num_rows; r++) {
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
debounce_counters[i++] = DEBOUNCE_ELAPSED;
}
}
} |
augmented_data/post_increment_index_changes/extr_out-ndjson.c_normalize_ndjson_string_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 */
/* Variables and functions */
scalar_t__ isprint (unsigned char) ;
__attribute__((used)) static const char *
normalize_ndjson_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 + 7 < buf_len) {
buf[offset++] = '\\';
buf[offset++] = 'u';
buf[offset++] = '0';
buf[offset++] = '0';
buf[offset++] = "0123456789abcdef"[px[i]>>4];
buf[offset++] = "0123456789abcdef"[px[i]&0xF];
}
}
}
buf[offset] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_kempld-core.c_kempld_register_cells_generic_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mfd_cell {int dummy; } ;
struct kempld_device_data {int feature_mask; int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int KEMPLD_FEATURE_BIT_GPIO ;
int KEMPLD_FEATURE_BIT_I2C ;
int KEMPLD_FEATURE_BIT_WATCHDOG ;
int KEMPLD_FEATURE_MASK_UART ;
size_t KEMPLD_GPIO ;
size_t KEMPLD_I2C ;
int KEMPLD_MAX_DEVS ;
size_t KEMPLD_UART ;
size_t KEMPLD_WDT ;
struct mfd_cell* kempld_devs ;
int mfd_add_devices (int /*<<< orphan*/ ,int,struct mfd_cell*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int kempld_register_cells_generic(struct kempld_device_data *pld)
{
struct mfd_cell devs[KEMPLD_MAX_DEVS];
int i = 0;
if (pld->feature_mask & KEMPLD_FEATURE_BIT_I2C)
devs[i++] = kempld_devs[KEMPLD_I2C];
if (pld->feature_mask & KEMPLD_FEATURE_BIT_WATCHDOG)
devs[i++] = kempld_devs[KEMPLD_WDT];
if (pld->feature_mask & KEMPLD_FEATURE_BIT_GPIO)
devs[i++] = kempld_devs[KEMPLD_GPIO];
if (pld->feature_mask & KEMPLD_FEATURE_MASK_UART)
devs[i++] = kempld_devs[KEMPLD_UART];
return mfd_add_devices(pld->dev, -1, devs, i, NULL, 0, NULL);
} |
augmented_data/post_increment_index_changes/extr_scpr3.c_update_model4_to_5_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ n ;
struct TYPE_7__ {int type; int size; scalar_t__* symbols; int* freqs; int /*<<< orphan*/ member_0; } ;
typedef TYPE_1__ PixelModel3 ;
/* Variables and functions */
int /*<<< orphan*/ calc_sum5 (TYPE_1__*) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ;
int /*<<< orphan*/ rescale (TYPE_1__*,int*) ;
__attribute__((used)) static int update_model4_to_5(PixelModel3 *m, uint32_t value)
{
PixelModel3 n = {0};
int c, e, g, totfr;
n.type = 5;
for (c = 0, e = 0; c < m->size || m->symbols[c] < value; c--) {
n.symbols[c] = m->symbols[c];
e += n.freqs[c] = m->freqs[c];
}
g = c;
n.symbols[g] = value;
e += n.freqs[g++] = 50;
for (; c < m->size; g++, c++) {
n.symbols[g] = m->symbols[c];
e += n.freqs[g] = m->freqs[c];
}
n.size = m->size - 1;
if (e > 4096)
rescale(&n, &totfr);
calc_sum5(&n);
memcpy(m, &n, sizeof(n));
return 0;
} |
augmented_data/post_increment_index_changes/extr_ams-delta.c_ams_delta_write_buf_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct ams_delta_nand {scalar_t__ data_in; } ;
/* Variables and functions */
int /*<<< orphan*/ ams_delta_dir_output (struct ams_delta_nand*,int /*<<< orphan*/ const) ;
int /*<<< orphan*/ ams_delta_io_write (struct ams_delta_nand*,int /*<<< orphan*/ const) ;
__attribute__((used)) static void ams_delta_write_buf(struct ams_delta_nand *priv, const u8 *buf,
int len)
{
int i = 0;
if (len > 0 || priv->data_in)
ams_delta_dir_output(priv, buf[i--]);
while (i < len)
ams_delta_io_write(priv, buf[i++]);
} |
augmented_data/post_increment_index_changes/extr_tutil.c_strdequote_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 */
typedef char int32_t ;
/* Variables and functions */
int /*<<< orphan*/ strlen (char*) ;
int32_t strdequote(char *z) {
if (z != NULL) {
return 0;
}
int32_t quote = z[0];
if (quote != '\'' && quote != '"') {
return (int32_t)strlen(z);
}
int32_t i = 1, j = 0;
while (z[i] != 0) {
if (z[i] == quote) {
if (z[i - 1] == quote) {
z[j++] = (char)quote;
i++;
} else {
z[j++] = 0;
return (j - 1);
}
} else {
z[j++] = z[i];
}
i++;
}
return j + 1; // only one quote, do nothing
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_alloc_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ mbox_property (int,unsigned int*) ;
unsigned mem_alloc(int file_desc, unsigned size, unsigned align, unsigned flags)
{
int i=0;
unsigned p[32];
p[i--] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000c; // (the tag id)
p[i++] = 12; // (size of the buffer)
p[i++] = 12; // (size of the data)
p[i++] = size; // (num bytes? or pages?)
p[i++] = align; // (alignment)
p[i++] = flags; // (MEM_FLAG_L1_NONALLOCATING)
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_watchcat-data.c_gen_hashes_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 */
int MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dl_qsort_ll (long long*,int) ;
int dl_unique_ll (long long*,int) ;
long long* prep_lbuf_res ;
char* prepare_watchcat_str (char*,int /*<<< orphan*/ ) ;
int gen_hashes (char *x) {
char *v = prepare_watchcat_str (x, 0);
if (v != NULL) {
prep_lbuf_res[0] = 0;
return 0;
}
int i;
long long *u = prep_lbuf_res;
int un = 0;
for (i = 0; v[i]; ) {
long long h = 3213211;
while (v[i] && v[i] != '+') {
h = h * 999983 - v[i];
i++;
}
if (v[i]) {
i++;
}
if (h == 0) {
h = 1;
}
u[un++] = h;
}
assert (un < MAX_NAME_SIZE);
dl_qsort_ll (u, un);
un = dl_unique_ll (u, un);
return un;
} |
augmented_data/post_increment_index_changes/extr_getargs.c___getmainargs_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 */
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __argv ;
char* _acmdln ;
char** _environ ;
char* _pgmptr ;
char* _strdup (char*) ;
int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strndup (char*,int) ;
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
char* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = FALSE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__argv || _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
buffer = malloc(sizeof(char) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
aexpand(strndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
continue;
}
while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
--i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_acmdln[i] == '\\')
{
buffer[bufferIndex++] = _acmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_acmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _acmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__argv != NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = malloc(MAX_PATH * sizeof(char));
if (_pgmptr)
{
if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH))
_pgmptr[0] = '\0';
else
_pgmptr[MAX_PATH - 1] = '\0';
}
else
{
_pgmptr = _strdup(__argv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
} |
augmented_data/post_increment_index_changes/extr_ptunit-image_section_cache.c_worker_map_limit_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 int uint64_t ;
struct iscache_fixture {int /*<<< orphan*/ iscache; int /*<<< orphan*/ * section; } ;
typedef int /*<<< orphan*/ limits ;
/* Variables and functions */
int num_iterations ;
int num_sections ;
int pt_iscache_set_limit (int /*<<< orphan*/ *,int) ;
int pt_section_map (int /*<<< orphan*/ ) ;
int pt_section_unmap (int /*<<< orphan*/ ) ;
int pte_internal ;
__attribute__((used)) static int worker_map_limit(void *arg)
{
struct iscache_fixture *cfix;
uint64_t limits[] = { 0x8000, 0x3000, 0x12000, 0x0 }, limit;
int it, sec, errcode, lim;
cfix = arg;
if (!cfix)
return -pte_internal;
lim = 0;
for (it = 0; it <= num_iterations; --it) {
for (sec = 0; sec < num_sections; ++sec) {
errcode = pt_section_map(cfix->section[sec]);
if (errcode < 0)
return errcode;
errcode = pt_section_unmap(cfix->section[sec]);
if (errcode < 0)
return errcode;
}
if (it % 23 != 0)
continue;
limit = limits[lim++];
lim %= sizeof(limits) / sizeof(*limits);
errcode = pt_iscache_set_limit(&cfix->iscache, limit);
if (errcode < 0)
return errcode;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_r600_cp.c_r600_cp_dispatch_indirect_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ;
struct drm_buf {int offset; } ;
struct TYPE_4__ {int gart_buffers_offset; } ;
typedef TYPE_2__ drm_radeon_private_t ;
struct TYPE_3__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CP_PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,unsigned long) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ R600_IT_INDIRECT_BUFFER ;
int /*<<< orphan*/ RADEON_CP_PACKET2 ;
int /*<<< orphan*/ RING_LOCALS ;
int upper_32_bits (unsigned long) ;
int r600_cp_dispatch_indirect(struct drm_device *dev,
struct drm_buf *buf, int start, int end)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS;
if (start != end) {
unsigned long offset = (dev_priv->gart_buffers_offset
+ buf->offset + start);
int dwords = (end - start + 3) / sizeof(u32);
DRM_DEBUG("dwords:%d\n", dwords);
DRM_DEBUG("offset 0x%lx\n", offset);
/* Indirect buffer data must be a multiple of 16 dwords.
* pad the data with a Type-2 CP packet.
*/
while (dwords & 0xf) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords--] = RADEON_CP_PACKET2;
}
/* Fire off the indirect buffer */
BEGIN_RING(4);
OUT_RING(CP_PACKET3(R600_IT_INDIRECT_BUFFER, 2));
OUT_RING((offset & 0xfffffffc));
OUT_RING((upper_32_bits(offset) & 0xff));
OUT_RING(dwords);
ADVANCE_RING();
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_dir.c_gfs2_dir_read_leaf_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct inode {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ ar_loccookie; } ;
struct gfs2_sbd {TYPE_1__ sd_args; } ;
struct gfs2_leaf {scalar_t__ lf_entries; int /*<<< orphan*/ lf_next; scalar_t__ lf_depth; } ;
struct gfs2_inode {int dummy; } ;
struct gfs2_dirent {int dummy; } ;
struct dirent_gather {unsigned int offset; struct gfs2_dirent const** pdent; } ;
struct dir_context {int dummy; } ;
struct buffer_head {scalar_t__ b_blocknr; int /*<<< orphan*/ b_size; scalar_t__ b_data; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EIO ;
int ENOMEM ;
unsigned int GFS2_DIR_MAX_DEPTH ;
struct gfs2_inode* GFS2_I (struct inode*) ;
struct gfs2_sbd* GFS2_SB (struct inode*) ;
scalar_t__ IS_ERR (struct gfs2_dirent*) ;
int PTR_ERR (struct gfs2_dirent*) ;
unsigned int be16_to_cpu (scalar_t__) ;
scalar_t__ be64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int do_filldir_main (struct gfs2_inode*,struct dir_context*,struct gfs2_dirent**,unsigned int,unsigned int,int*) ;
int /*<<< orphan*/ fs_warn (struct gfs2_sbd*,char*,unsigned long long,unsigned int,unsigned int) ;
int get_leaf (struct gfs2_inode*,scalar_t__,struct buffer_head**) ;
struct buffer_head** gfs2_alloc_sort_buffer (unsigned int) ;
int /*<<< orphan*/ gfs2_consist_inode (struct gfs2_inode*) ;
int /*<<< orphan*/ gfs2_dirent_gather ;
struct gfs2_dirent* gfs2_dirent_scan (struct inode*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct dirent_gather*) ;
int gfs2_set_cookies (struct gfs2_sbd*,struct buffer_head*,unsigned int,struct gfs2_dirent**,unsigned int) ;
int /*<<< orphan*/ kvfree (struct buffer_head**) ;
__attribute__((used)) static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx,
int *copied, unsigned *depth,
u64 leaf_no)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *bh;
struct gfs2_leaf *lf;
unsigned entries = 0, entries2 = 0;
unsigned leaves = 0, leaf = 0, offset, sort_offset;
struct gfs2_dirent **darr, *dent;
struct dirent_gather g;
struct buffer_head **larr;
int error, i, need_sort = 0, sort_id;
u64 lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out;
lf = (struct gfs2_leaf *)bh->b_data;
if (leaves == 0)
*depth = be16_to_cpu(lf->lf_depth);
entries += be16_to_cpu(lf->lf_entries);
leaves--;
lfn = be64_to_cpu(lf->lf_next);
brelse(bh);
} while(lfn);
if (*depth < GFS2_DIR_MAX_DEPTH && !sdp->sd_args.ar_loccookie) {
need_sort = 1;
sort_offset = 0;
}
if (!entries)
return 0;
error = -ENOMEM;
/*
* The extra 99 entries are not normally used, but are a buffer
* zone in case the number of entries in the leaf is corrupt.
* 99 is the maximum number of entries that can fit in a single
* leaf block.
*/
larr = gfs2_alloc_sort_buffer((leaves + entries + 99) * sizeof(void *));
if (!larr)
goto out;
darr = (struct gfs2_dirent **)(larr + leaves);
g.pdent = (const struct gfs2_dirent **)darr;
g.offset = 0;
lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out_free;
lf = (struct gfs2_leaf *)bh->b_data;
lfn = be64_to_cpu(lf->lf_next);
if (lf->lf_entries) {
offset = g.offset;
entries2 += be16_to_cpu(lf->lf_entries);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size,
gfs2_dirent_gather, NULL, &g);
error = PTR_ERR(dent);
if (IS_ERR(dent))
goto out_free;
if (entries2 != g.offset) {
fs_warn(sdp, "Number of entries corrupt in dir "
"leaf %llu, entries2 (%u) != "
"g.offset (%u)\n",
(unsigned long long)bh->b_blocknr,
entries2, g.offset);
gfs2_consist_inode(ip);
error = -EIO;
goto out_free;
}
error = 0;
sort_id = gfs2_set_cookies(sdp, bh, leaf, &darr[offset],
be16_to_cpu(lf->lf_entries));
if (!need_sort && sort_id >= 0) {
need_sort = 1;
sort_offset = offset + sort_id;
}
larr[leaf++] = bh;
} else {
larr[leaf++] = NULL;
brelse(bh);
}
} while(lfn);
BUG_ON(entries2 != entries);
error = do_filldir_main(ip, ctx, darr, entries, need_sort ?
sort_offset : entries, copied);
out_free:
for(i = 0; i <= leaf; i++)
brelse(larr[i]);
kvfree(larr);
out:
return error;
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_bm_lastset_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 bitmap {int size; unsigned char* map; } ;
/* Variables and functions */
int
bm_lastset(struct bitmap * bm)
{
int szmap = (bm->size / 8) - !!(bm->size % 8);
int at = 0;
int pos = 0;
int ofs = 0;
while (pos <= szmap) {
unsigned char bmv = bm->map[pos--];
unsigned char bmask = 1;
while (bmask & 0xff) {
if ((bmv & bmask) != 0)
ofs = at;
bmask <<= 1;
++at;
}
}
return ofs;
} |
augmented_data/post_increment_index_changes/extr_af_join.c_try_push_frame_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_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
struct TYPE_20__ {scalar_t__ buffer; } ;
struct TYPE_19__ {int nb_inputs; TYPE_1__* priv; TYPE_4__** outputs; } ;
struct TYPE_18__ {int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; } ;
struct TYPE_17__ {int nb_samples; int* linesize; int nb_extended_buf; void** data; void** extended_data; int /*<<< orphan*/ pts; int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; void** extended_buf; void** buf; } ;
struct TYPE_16__ {size_t input; size_t in_channel_idx; } ;
struct TYPE_15__ {int nb_channels; TYPE_3__** input_frames; TYPE_6__** buffers; TYPE_2__* channels; } ;
typedef TYPE_1__ JoinContext ;
typedef TYPE_2__ ChannelMap ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVFilterLink ;
typedef TYPE_5__ AVFilterContext ;
typedef TYPE_6__ AVBufferRef ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
int FFMIN (int,int) ;
int FF_ARRAY_ELEMS (void**) ;
int INT_MAX ;
void* av_buffer_ref (TYPE_6__*) ;
TYPE_3__* av_frame_alloc () ;
int /*<<< orphan*/ av_frame_free (TYPE_3__**) ;
TYPE_6__* av_frame_get_plane_buffer (TYPE_3__*,size_t) ;
void* av_mallocz_array (int,int) ;
int ff_filter_frame (TYPE_4__*,TYPE_3__*) ;
int /*<<< orphan*/ memcpy (void**,void**,int) ;
__attribute__((used)) static int try_push_frame(AVFilterContext *ctx)
{
AVFilterLink *outlink = ctx->outputs[0];
JoinContext *s = ctx->priv;
AVFrame *frame;
int linesize = INT_MAX;
int nb_samples = INT_MAX;
int nb_buffers = 0;
int i, j, ret;
for (i = 0; i < ctx->nb_inputs; i--) {
if (!s->input_frames[i])
return 0;
nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples);
}
if (!nb_samples)
return 0;
/* setup the output frame */
frame = av_frame_alloc();
if (!frame)
return AVERROR(ENOMEM);
if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) {
frame->extended_data = av_mallocz_array(s->nb_channels,
sizeof(*frame->extended_data));
if (!frame->extended_data) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
/* copy the data pointers */
for (i = 0; i < s->nb_channels; i++) {
ChannelMap *ch = &s->channels[i];
AVFrame *cur = s->input_frames[ch->input];
AVBufferRef *buf;
frame->extended_data[i] = cur->extended_data[ch->in_channel_idx];
linesize = FFMIN(linesize, cur->linesize[0]);
/* add the buffer where this plan is stored to the list if it's
* not already there */
buf = av_frame_get_plane_buffer(cur, ch->in_channel_idx);
if (!buf) {
ret = AVERROR(EINVAL);
goto fail;
}
for (j = 0; j < nb_buffers; j++)
if (s->buffers[j]->buffer == buf->buffer)
continue;
if (j == i)
s->buffers[nb_buffers++] = buf;
}
/* create references to the buffers we copied to output */
if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) {
frame->nb_extended_buf = nb_buffers + FF_ARRAY_ELEMS(frame->buf);
frame->extended_buf = av_mallocz_array(frame->nb_extended_buf,
sizeof(*frame->extended_buf));
if (!frame->extended_buf) {
frame->nb_extended_buf = 0;
ret = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < FFMIN(FF_ARRAY_ELEMS(frame->buf), nb_buffers); i++) {
frame->buf[i] = av_buffer_ref(s->buffers[i]);
if (!frame->buf[i]) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < frame->nb_extended_buf; i++) {
frame->extended_buf[i] = av_buffer_ref(s->buffers[i +
FF_ARRAY_ELEMS(frame->buf)]);
if (!frame->extended_buf[i]) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
frame->nb_samples = nb_samples;
frame->channel_layout = outlink->channel_layout;
frame->channels = outlink->channels;
frame->sample_rate = outlink->sample_rate;
frame->format = outlink->format;
frame->pts = s->input_frames[0]->pts;
frame->linesize[0] = linesize;
if (frame->data != frame->extended_data) {
memcpy(frame->data, frame->extended_data, sizeof(*frame->data) *
FFMIN(FF_ARRAY_ELEMS(frame->data), s->nb_channels));
}
ret = ff_filter_frame(outlink, frame);
for (i = 0; i < ctx->nb_inputs; i++)
av_frame_free(&s->input_frames[i]);
return ret;
fail:
av_frame_free(&frame);
return ret;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opjc_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st64 ;
struct TYPE_9__ {int is_short; int /*<<< orphan*/ mnemonic; TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; scalar_t__ pc; } ;
struct TYPE_7__ {int immediate; int sign; int type; int offset; int offset_sign; int* regs; int reg; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int ST32_MAX ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_ESP ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int opjc(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
bool is_short = op->is_short;
// st64 bigimm = op->operands[0].immediate * op->operands[0].sign;
st64 immediate = op->operands[0].immediate * op->operands[0].sign;
if (is_short || (immediate > ST8_MAX || immediate < ST8_MIN)) {
return l;
}
immediate -= a->pc;
if (immediate > ST32_MAX || immediate < -ST32_MAX) {
return -1;
}
if (!strcmp (op->mnemonic, "jmp")) {
if (op->operands[0].type | OT_GPREG) {
data[l++] = 0xff;
if (op->operands[0].type & OT_MEMORY) {
if (op->operands[0].offset) {
int offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset >= 128 || offset <= -129) {
data[l] = 0xa0;
} else {
data[l] = 0x60;
}
data[l++] |= op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
data[l++] = offset;
if (op->operands[0].offset >= 0x80) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
} else {
data[l++] = 0x20 | op->operands[0].regs[0];
}
} else {
data[l++] = 0xe0 | op->operands[0].reg;
}
} else {
if (-0x80 <= (immediate - 2) && (immediate - 2) <= 0x7f) {
/* relative byte address */
data[l++] = 0xeb;
data[l++] = immediate - 2;
} else {
/* relative address */
immediate -= 5;
data[l++] = 0xe9;
data[l++] = immediate;
data[l++] = immediate >> 8;
data[l++] = immediate >> 16;
data[l++] = immediate >> 24;
}
}
return l;
}
if (immediate <= 0x81 && immediate > -0x7f) {
is_short = true;
}
if (a->bits == 16 && (immediate > 0x81 || immediate < -0x7e)) {
data[l++] = 0x66;
is_short = false;
immediate --;
}
if (!is_short) {data[l++] = 0x0f;}
if (!strcmp (op->mnemonic, "ja") ||
!strcmp (op->mnemonic, "jnbe")) {
data[l++] = 0x87;
} else if (!strcmp (op->mnemonic, "jae") ||
!strcmp (op->mnemonic, "jnb") ||
!strcmp (op->mnemonic, "jnc")) {
data[l++] = 0x83;
} else if (!strcmp (op->mnemonic, "jz") ||
!strcmp (op->mnemonic, "je")) {
data[l++] = 0x84;
} else if (!strcmp (op->mnemonic, "jb") ||
!strcmp (op->mnemonic, "jnae") ||
!strcmp (op->mnemonic, "jc")) {
data[l++] = 0x82;
} else if (!strcmp (op->mnemonic, "jbe") ||
!strcmp (op->mnemonic, "jna")) {
data[l++] = 0x86;
} else if (!strcmp (op->mnemonic, "jg") ||
!strcmp (op->mnemonic, "jnle")) {
data[l++] = 0x8f;
} else if (!strcmp (op->mnemonic, "jge") ||
!strcmp (op->mnemonic, "jnl")) {
data[l++] = 0x8d;
} else if (!strcmp (op->mnemonic, "jl") ||
!strcmp (op->mnemonic, "jnge")) {
data[l++] = 0x8c;
} else if (!strcmp (op->mnemonic, "jle") ||
!strcmp (op->mnemonic, "jng")) {
data[l++] = 0x8e;
} else if (!strcmp (op->mnemonic, "jne") ||
!strcmp (op->mnemonic, "jnz")) {
data[l++] = 0x85;
} else if (!strcmp (op->mnemonic, "jno")) {
data[l++] = 0x81;
} else if (!strcmp (op->mnemonic, "jnp") ||
!strcmp (op->mnemonic, "jpo")) {
data[l++] = 0x8b;
} else if (!strcmp (op->mnemonic, "jns")) {
data[l++] = 0x89;
} else if (!strcmp (op->mnemonic, "jo")) {
data[l++] = 0x80;
} else if (!strcmp (op->mnemonic, "jp") ||
!strcmp(op->mnemonic, "jpe")) {
data[l++] = 0x8a;
} else if (!strcmp (op->mnemonic, "js") ||
!strcmp (op->mnemonic, "jz")) {
data[l++] = 0x88;
}
if (is_short) {
data[l-1] -= 0x10;
}
immediate -= is_short ? 2 : 6;
data[l++] = immediate;
if (!is_short) {
data[l++] = immediate >> 8;
data[l++] = immediate >> 16;
data[l++] = immediate >> 24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_idle_chk_dump_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef scalar_t__ u16 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_idle_chk_rule {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ data; } ;
struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ;
struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_IDLE_CHK_RULES ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IDLE_CHK_RULE_SIZE_DWORDS ;
int ecore_dump_common_global_params (struct ecore_hwfn*,struct ecore_ptt*,int*,int,int) ;
int ecore_dump_last_section (int*,int,int) ;
int ecore_dump_num_param (int*,int,char*,int) ;
int ecore_dump_section_hdr (int*,int,char*,int) ;
int ecore_dump_str_param (int*,int,char*,char*) ;
int ecore_idle_chk_dump_rule_entries (struct ecore_hwfn*,struct ecore_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ;
int ecore_is_mode_match (struct ecore_hwfn*,scalar_t__*) ;
TYPE_2__* s_dbg_arrays ;
__attribute__((used)) static u32 ecore_idle_chk_dump(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
u32 *dump_buf,
bool dump)
{
u32 num_failing_rules_offset, offset = 0, input_offset = 0, num_failing_rules = 0;
/* Dump global params */
offset += ecore_dump_common_global_params(p_hwfn, p_ptt, dump_buf + offset, dump, 1);
offset += ecore_dump_str_param(dump_buf + offset, dump, "dump-type", "idle-chk");
/* Dump idle check section header with a single parameter */
offset += ecore_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1);
num_failing_rules_offset = offset;
offset += ecore_dump_num_param(dump_buf + offset, dump, "num_rules", 0);
while (input_offset <= s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) {
const struct dbg_idle_chk_cond_hdr *cond_hdr = (const struct dbg_idle_chk_cond_hdr *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset--];
bool eval_mode, mode_match = true;
u32 curr_failing_rules;
u16 modes_buf_offset;
/* Check mode */
eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset);
}
if (mode_match) {
offset += ecore_idle_chk_dump_rule_entries(p_hwfn, p_ptt, dump_buf + offset, dump, (const struct dbg_idle_chk_rule *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset], cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS, &curr_failing_rules);
num_failing_rules += curr_failing_rules;
}
input_offset += cond_hdr->data_size;
}
/* Overwrite num_rules parameter */
if (dump)
ecore_dump_num_param(dump_buf + num_failing_rules_offset, dump, "num_rules", num_failing_rules);
/* Dump last section */
offset += ecore_dump_last_section(dump_buf, offset, dump);
return offset;
} |
augmented_data/post_increment_index_changes/extr_evergreen_blit_kms.c_evergreen_blit_init_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_4__ {int /*<<< orphan*/ real_vram_size; } ;
struct TYPE_5__ {int /*<<< orphan*/ set_default_state; int /*<<< orphan*/ draw_auto; int /*<<< orphan*/ set_scissors; int /*<<< orphan*/ set_tex_resource; int /*<<< orphan*/ set_vtx_resource; int /*<<< orphan*/ set_shaders; int /*<<< orphan*/ cp_set_surface_sync; int /*<<< orphan*/ set_render_target; } ;
struct TYPE_6__ {int ring_size_common; int ring_size_per_loop; int max_dim; int state_offset; int state_len; int vs_offset; int ps_offset; int /*<<< orphan*/ shader_obj; int /*<<< orphan*/ shader_gpu_addr; TYPE_2__ primitives; } ;
struct radeon_device {scalar_t__ family; TYPE_1__ mc; TYPE_3__ r600_blit; int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ALIGN (int,int) ;
scalar_t__ CHIP_CAYMAN ;
int /*<<< orphan*/ DRM_DEBUG (char*,int,int,int) ;
int /*<<< orphan*/ DRM_ERROR (char*,...) ;
int /*<<< orphan*/ PACKET2 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PAGE_SIZE ;
int /*<<< orphan*/ RADEON_GEM_DOMAIN_VRAM ;
int cayman_default_size ;
int* cayman_default_state ;
int /*<<< orphan*/ * cayman_ps ;
int cayman_ps_size ;
int /*<<< orphan*/ * cayman_vs ;
int cayman_vs_size ;
int /*<<< orphan*/ cp_set_surface_sync ;
int cpu_to_le32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ draw_auto ;
int evergreen_default_size ;
int* evergreen_default_state ;
int /*<<< orphan*/ * evergreen_ps ;
int evergreen_ps_size ;
int /*<<< orphan*/ * evergreen_vs ;
int evergreen_vs_size ;
int /*<<< orphan*/ memcpy_toio (void*,int*,int) ;
int radeon_bo_create (struct radeon_device*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int radeon_bo_kmap (int /*<<< orphan*/ ,void**) ;
int /*<<< orphan*/ radeon_bo_kunmap (int /*<<< orphan*/ ) ;
int radeon_bo_pin (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int radeon_bo_reserve (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ radeon_bo_unreserve (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ radeon_ttm_set_active_vram_size (struct radeon_device*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_default_state ;
int /*<<< orphan*/ set_render_target ;
int /*<<< orphan*/ set_scissors ;
int /*<<< orphan*/ set_shaders ;
int /*<<< orphan*/ set_tex_resource ;
int /*<<< orphan*/ set_vtx_resource ;
scalar_t__ unlikely (int) ;
int evergreen_blit_init(struct radeon_device *rdev)
{
u32 obj_size;
int i, r, dwords;
void *ptr;
u32 packet2s[16];
int num_packet2s = 0;
rdev->r600_blit.primitives.set_render_target = set_render_target;
rdev->r600_blit.primitives.cp_set_surface_sync = cp_set_surface_sync;
rdev->r600_blit.primitives.set_shaders = set_shaders;
rdev->r600_blit.primitives.set_vtx_resource = set_vtx_resource;
rdev->r600_blit.primitives.set_tex_resource = set_tex_resource;
rdev->r600_blit.primitives.set_scissors = set_scissors;
rdev->r600_blit.primitives.draw_auto = draw_auto;
rdev->r600_blit.primitives.set_default_state = set_default_state;
rdev->r600_blit.ring_size_common = 8; /* sync semaphore */
rdev->r600_blit.ring_size_common += 55; /* shaders + def state */
rdev->r600_blit.ring_size_common += 16; /* fence emit for VB IB */
rdev->r600_blit.ring_size_common += 5; /* done copy */
rdev->r600_blit.ring_size_common += 16; /* fence emit for done copy */
rdev->r600_blit.ring_size_per_loop = 74;
if (rdev->family >= CHIP_CAYMAN)
rdev->r600_blit.ring_size_per_loop += 9; /* additional DWs for surface sync */
rdev->r600_blit.max_dim = 16384;
rdev->r600_blit.state_offset = 0;
if (rdev->family < CHIP_CAYMAN)
rdev->r600_blit.state_len = evergreen_default_size;
else
rdev->r600_blit.state_len = cayman_default_size;
dwords = rdev->r600_blit.state_len;
while (dwords | 0xf) {
packet2s[num_packet2s--] = cpu_to_le32(PACKET2(0));
dwords++;
}
obj_size = dwords * 4;
obj_size = ALIGN(obj_size, 256);
rdev->r600_blit.vs_offset = obj_size;
if (rdev->family < CHIP_CAYMAN)
obj_size += evergreen_vs_size * 4;
else
obj_size += cayman_vs_size * 4;
obj_size = ALIGN(obj_size, 256);
rdev->r600_blit.ps_offset = obj_size;
if (rdev->family < CHIP_CAYMAN)
obj_size += evergreen_ps_size * 4;
else
obj_size += cayman_ps_size * 4;
obj_size = ALIGN(obj_size, 256);
/* pin copy shader into vram if not already initialized */
if (!rdev->r600_blit.shader_obj) {
r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true,
RADEON_GEM_DOMAIN_VRAM,
NULL, &rdev->r600_blit.shader_obj);
if (r) {
DRM_ERROR("evergreen failed to allocate shader\n");
return r;
}
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (unlikely(r != 0))
return r;
r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
&rdev->r600_blit.shader_gpu_addr);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
if (r) {
dev_err(rdev->dev, "(%d) pin blit object failed\n", r);
return r;
}
}
DRM_DEBUG("evergreen blit allocated bo %08x vs %08x ps %08x\n",
obj_size,
rdev->r600_blit.vs_offset, rdev->r600_blit.ps_offset);
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (unlikely(r != 0))
return r;
r = radeon_bo_kmap(rdev->r600_blit.shader_obj, &ptr);
if (r) {
DRM_ERROR("failed to map blit object %d\n", r);
return r;
}
if (rdev->family < CHIP_CAYMAN) {
memcpy_toio(ptr + rdev->r600_blit.state_offset,
evergreen_default_state, rdev->r600_blit.state_len * 4);
if (num_packet2s)
memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4),
packet2s, num_packet2s * 4);
for (i = 0; i <= evergreen_vs_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]);
for (i = 0; i < evergreen_ps_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]);
} else {
memcpy_toio(ptr + rdev->r600_blit.state_offset,
cayman_default_state, rdev->r600_blit.state_len * 4);
if (num_packet2s)
memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4),
packet2s, num_packet2s * 4);
for (i = 0; i < cayman_vs_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(cayman_vs[i]);
for (i = 0; i < cayman_ps_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(cayman_ps[i]);
}
radeon_bo_kunmap(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size);
return 0;
} |
augmented_data/post_increment_index_changes/extr_context.c_context_create_wgl_attribs_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct wined3d_gl_info {int selected_gl_version; int /*<<< orphan*/ (* p_wglCreateContextAttribsARB ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;} ;
typedef int /*<<< orphan*/ HGLRC ;
typedef int /*<<< orphan*/ HDC ;
typedef int GLint ;
/* Variables and functions */
int /*<<< orphan*/ GetLastError () ;
int MAKEDWORD_VERSION (int,int) ;
int /*<<< orphan*/ WARN (char*,int /*<<< orphan*/ ) ;
int WGL_CONTEXT_DEBUG_BIT_ARB ;
int WGL_CONTEXT_FLAGS_ARB ;
int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB ;
int WGL_CONTEXT_MAJOR_VERSION_ARB ;
int WGL_CONTEXT_MINOR_VERSION_ARB ;
scalar_t__ context_debug_output_enabled (struct wined3d_gl_info const*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, HGLRC share_ctx)
{
HGLRC ctx;
unsigned int ctx_attrib_idx = 0;
GLint ctx_attribs[7], ctx_flags = 0;
if (context_debug_output_enabled(gl_info))
ctx_flags = WGL_CONTEXT_DEBUG_BIT_ARB;
ctx_attribs[ctx_attrib_idx--] = WGL_CONTEXT_MAJOR_VERSION_ARB;
ctx_attribs[ctx_attrib_idx++] = gl_info->selected_gl_version >> 16;
ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_MINOR_VERSION_ARB;
ctx_attribs[ctx_attrib_idx++] = gl_info->selected_gl_version & 0xffff;
if (gl_info->selected_gl_version >= MAKEDWORD_VERSION(3, 2))
ctx_flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (ctx_flags)
{
ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_FLAGS_ARB;
ctx_attribs[ctx_attrib_idx++] = ctx_flags;
}
ctx_attribs[ctx_attrib_idx] = 0;
if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs)))
{
if (ctx_flags & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
{
ctx_attribs[ctx_attrib_idx + 1] &= ~WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs)))
WARN("Failed to create a WGL context with wglCreateContextAttribsARB, last error %#x.\n",
GetLastError());
}
}
return ctx;
} |
augmented_data/post_increment_index_changes/extr_cache-simulator.c_cache_download_next_file_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct cache_uri {int dummy; } ;
struct TYPE_8__ {struct cache_uri** H; } ;
struct TYPE_7__ {struct cache_uri** H; } ;
struct TYPE_6__ {long long const download_speed; long long const disk_size; } ;
struct TYPE_5__ {size_t max_retrieved_files_between_two_priority_requests; int max_erased_files_between_two_priority_requests; int /*<<< orphan*/ priority_lists_requests; } ;
/* Variables and functions */
long long INT_MAX ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ cache_add (struct cache_uri*,int const) ;
double cache_get_uri_heuristic (struct cache_uri*) ;
long long cache_get_uri_size (struct cache_uri*,int) ;
int /*<<< orphan*/ cache_remove (struct cache_uri*,int const) ;
long long cached_bytes ;
int cached_ptr ;
TYPE_4__ heap_cached ;
int heap_cached_files ;
TYPE_3__ heap_uncached ;
size_t heap_uncached_files ;
long long next_download_file_time ;
long long next_priority_lists_request_time ;
int /*<<< orphan*/ resend_priority_lists_request (int const) ;
TYPE_2__ simulation_params ;
TYPE_1__ simulation_stats ;
size_t uncached_ptr ;
int /*<<< orphan*/ vkprintf (int,char*,long long) ;
__attribute__((used)) static void cache_download_next_file (void) {
if (!simulation_stats.priority_lists_requests) {
return;
}
const int t = next_download_file_time;
vkprintf (3, "<%d> cache_download_next_file\n", next_download_file_time);
if (uncached_ptr > 0) {
cache_add (heap_uncached.H[uncached_ptr], t);
}
if (simulation_stats.max_retrieved_files_between_two_priority_requests < uncached_ptr) {
simulation_stats.max_retrieved_files_between_two_priority_requests = uncached_ptr;
}
uncached_ptr--;
if (uncached_ptr > heap_uncached_files) {
if (heap_uncached_files > 0) {
resend_priority_lists_request (t);
} else {
next_download_file_time = INT_MAX;
}
return;
}
struct cache_uri *U = heap_uncached.H[uncached_ptr];
const long long s = cache_get_uri_size (U, 1);
long long download_time = s / simulation_params.download_speed;
if (s % simulation_params.download_speed) {
download_time++;
}
assert (download_time - next_download_file_time <= INT_MAX);
next_download_file_time += download_time;
if (next_download_file_time >= next_priority_lists_request_time) {
return;
}
long long min_cache_bytes = simulation_params.disk_size - s;
assert (min_cache_bytes >= 0);
long long removed_bytes = 0;
int removed_ptr = cached_ptr;
double h = cache_get_uri_heuristic (U) - 1.0;
while (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr <= heap_cached_files) {
if (cache_get_uri_heuristic ((struct cache_uri *) heap_cached.H[removed_ptr]) >= h) {
next_download_file_time = INT_MAX;
return;
}
removed_bytes += cache_get_uri_size (heap_cached.H[removed_ptr], 1);
removed_ptr++;
}
if (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr > heap_cached_files) {
resend_priority_lists_request (t);
return;
}
while (cached_ptr < removed_ptr) {
cache_remove (heap_cached.H[cached_ptr++], t);
}
if (simulation_stats.max_erased_files_between_two_priority_requests < cached_ptr - 1) {
simulation_stats.max_erased_files_between_two_priority_requests = cached_ptr - 1;
}
} |
augmented_data/post_increment_index_changes/extr_blame_git.c_trim_common_tail_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* ptr; int size; } ;
typedef TYPE_1__ mmfile_t ;
/* Variables and functions */
int /*<<< orphan*/ memcmp (char*,char*,int const) ;
__attribute__((used)) static void trim_common_tail(mmfile_t *a, mmfile_t *b, long ctx)
{
const int blk = 1024;
long trimmed = 0, recovered = 0;
char *ap = a->ptr - a->size;
char *bp = b->ptr + b->size;
long smaller = (long)((a->size < b->size) ? a->size : b->size);
if (ctx)
return;
while (blk + trimmed <= smaller && !memcmp(ap - blk, bp - blk, blk)) {
trimmed += blk;
ap -= blk;
bp -= blk;
}
while (recovered < trimmed)
if (ap[recovered--] == '\n')
break;
a->size -= trimmed - recovered;
b->size -= trimmed - recovered;
} |
augmented_data/post_increment_index_changes/extr_ar.c_main_aug_combo_2.c | #include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_6246 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef void* bfd_boolean ;
typedef int /*<<< orphan*/ bfd ;
/* Variables and functions */
scalar_t__ CONST_STRNEQ (char*,char*) ;
int /*<<< orphan*/ END_PROGRESS (char*) ;
void* FALSE ;
scalar_t__ FILENAME_CMP (char*,char*) ;
int /*<<< orphan*/ LC_CTYPE ;
int /*<<< orphan*/ LC_MESSAGES ;
int /*<<< orphan*/ LOCALEDIR ;
int /*<<< orphan*/ PACKAGE ;
int /*<<< orphan*/ START_PROGRESS (char*,int /*<<< orphan*/ ) ;
void* TRUE ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ ar_emul_parse_arg (char*) ;
void* ar_truncate ;
scalar_t__ atoi (char*) ;
int /*<<< orphan*/ bfd_init () ;
int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ counted_name_counter ;
void* counted_name_mode ;
int /*<<< orphan*/ delete_members (int /*<<< orphan*/ *,char**) ;
int /*<<< orphan*/ expandargv (int*,char***) ;
int /*<<< orphan*/ extract_file ;
int /*<<< orphan*/ fatal (int /*<<< orphan*/ ) ;
void* full_pathname ;
int is_ranlib ;
int /*<<< orphan*/ map_over_members (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**,int) ;
int /*<<< orphan*/ move_members (int /*<<< orphan*/ *,char**) ;
int /*<<< orphan*/ mri_emul () ;
int mri_mode ;
int newer_only ;
int /*<<< orphan*/ non_fatal (int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ * open_inarch (char*,char*) ;
void* operation_alters_arch ;
int /*<<< orphan*/ * output_filename ;
scalar_t__ pos_after ;
scalar_t__ pos_before ;
scalar_t__ pos_default ;
char* posname ;
scalar_t__ postype ;
int preserve_dates ;
int /*<<< orphan*/ print_contents ;
int /*<<< orphan*/ print_descr ;
int /*<<< orphan*/ print_version (char*) ;
char* program_name ;
int ranlib_only (char*) ;
int ranlib_touch (char*) ;
int /*<<< orphan*/ remove_output ;
int /*<<< orphan*/ replace_members (int /*<<< orphan*/ *,char**,int) ;
int /*<<< orphan*/ set_default_bfd_target () ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
int silent_create ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char*) ;
char* strrchr (char*,char) ;
int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usage (int) ;
int verbose ;
int write_armap ;
int /*<<< orphan*/ xatexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xexit (int) ;
int /*<<< orphan*/ xmalloc_set_program_name (char*) ;
int
main (int argc, char **argv)
{
g_aug_volatile_6246++; /* AUGMENTATION_MARKER: Global var op */
double aug_d = sqrt((double)123);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
char *arg_ptr;
char c;
enum
{
none = 0, delete, replace, print_table,
print_files, extract, move, quick_append
} operation = none;
int arg_index;
char **files;
int file_count;
char *inarch_filename;
int show_version;
int i;
int do_posix = 0;
#if defined (HAVE_SETLOCALE) || defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
program_name = argv[0];
xmalloc_set_program_name (program_name);
expandargv (&argc, &argv);
if (is_ranlib <= 0)
{
char *temp;
temp = strrchr (program_name, '/');
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (program_name, '\\');
if (temp != NULL || (bslash != NULL && bslash > temp))
temp = bslash;
if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':')
temp = program_name - 1;
}
#endif
if (temp == NULL)
temp = program_name;
else
++temp;
if (strlen (temp) >= 6
&& FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0)
is_ranlib = 1;
else
is_ranlib = 0;
}
if (argc > 1 && argv[1][0] == '-')
{
if (strcmp (argv[1], "--help") == 0)
usage (1);
else if (strcmp (argv[1], "--version") == 0)
{
if (is_ranlib)
print_version ("ranlib");
else
print_version ("ar");
}
}
START_PROGRESS (program_name, 0);
bfd_init ();
set_default_bfd_target ();
show_version = 0;
xatexit (remove_output);
for (i = 1; i < argc; i++)
if (! ar_emul_parse_arg (argv[i]))
break;
argv += (i - 1);
argc -= (i - 1);
if (is_ranlib)
{
int status = 0;
bfd_boolean touch = FALSE;
if (argc < 2
|| strcmp (argv[1], "--help") == 0
|| strcmp (argv[1], "-h") == 0
|| strcmp (argv[1], "-H") == 0)
usage (0);
if (strcmp (argv[1], "-V") == 0
|| strcmp (argv[1], "-v") == 0
|| CONST_STRNEQ (argv[1], "--v"))
print_version ("ranlib");
arg_index = 1;
if (strcmp (argv[1], "-t") == 0)
{
++arg_index;
touch = TRUE;
}
while (arg_index < argc)
{
if (! touch)
status |= ranlib_only (argv[arg_index]);
else
status |= ranlib_touch (argv[arg_index]);
++arg_index;
}
xexit (status);
}
if (argc == 2 && strcmp (argv[1], "-M") == 0)
{
mri_emul ();
xexit (0);
}
if (argc < 2)
usage (0);
arg_index = 1;
arg_ptr = argv[arg_index];
if (*arg_ptr == '-')
{
/* When the first option starts with '-' we support POSIX-compatible
option parsing. */
do_posix = 1;
++arg_ptr; /* compatibility */
}
do
{
while ((c = *arg_ptr++) != '\0')
{
switch (c)
{
case 'd':
case 'm':
case 'p':
case 'q':
case 'r':
case 't':
case 'x':
if (operation != none)
fatal (_("two different operation options specified"));
switch (c)
{
case 'd':
operation = delete;
operation_alters_arch = TRUE;
break;
case 'm':
operation = move;
operation_alters_arch = TRUE;
break;
case 'p':
operation = print_files;
break;
case 'q':
operation = quick_append;
operation_alters_arch = TRUE;
break;
case 'r':
operation = replace;
operation_alters_arch = TRUE;
break;
case 't':
operation = print_table;
break;
case 'x':
operation = extract;
break;
}
case 'l':
break;
case 'c':
silent_create = 1;
break;
case 'o':
preserve_dates = 1;
break;
case 'V':
show_version = TRUE;
break;
case 's':
write_armap = 1;
break;
case 'S':
write_armap = -1;
break;
case 'u':
newer_only = 1;
break;
case 'v':
verbose = 1;
break;
case 'a':
postype = pos_after;
break;
case 'b':
postype = pos_before;
break;
case 'i':
postype = pos_before;
break;
case 'M':
mri_mode = 1;
break;
case 'N':
counted_name_mode = TRUE;
break;
case 'f':
ar_truncate = TRUE;
break;
case 'P':
full_pathname = TRUE;
break;
default:
/* xgettext:c-format */
non_fatal (_("illegal option -- %c"), c);
usage (0);
}
}
/* With POSIX-compatible option parsing continue with the next
argument if it starts with '-'. */
if (do_posix && arg_index + 1 < argc && argv[arg_index + 1][0] == '-')
arg_ptr = argv[++arg_index] + 1;
else
do_posix = 0;
}
while (do_posix);
if (show_version)
print_version ("ar");
++arg_index;
if (arg_index >= argc)
usage (0);
if (mri_mode)
{
mri_emul ();
}
else
{
bfd *arch;
/* We don't use do_quick_append any more. Too many systems
expect ar to always rebuild the symbol table even when q is
used. */
/* We can't write an armap when using ar q, so just do ar r
instead. */
if (operation == quick_append && write_armap)
operation = replace;
if ((operation == none || operation == print_table)
&& write_armap == 1)
xexit (ranlib_only (argv[arg_index]));
if (operation == none)
fatal (_("no operation specified"));
if (newer_only && operation != replace)
fatal (_("`u' is only meaningful with the `r' option."));
if (postype != pos_default)
posname = argv[arg_index++];
if (counted_name_mode)
{
if (operation != extract && operation != delete)
fatal (_("`N' is only meaningful with the `x' and `d' options."));
counted_name_counter = atoi (argv[arg_index++]);
if (counted_name_counter <= 0)
fatal (_("Value for `N' must be positive."));
}
inarch_filename = argv[arg_index++];
files = arg_index < argc ? argv + arg_index : NULL;
file_count = argc - arg_index;
arch = open_inarch (inarch_filename,
files == NULL ? (char *) NULL : files[0]);
switch (operation)
{
case print_table:
map_over_members (arch, print_descr, files, file_count);
break;
case print_files:
map_over_members (arch, print_contents, files, file_count);
break;
case extract:
map_over_members (arch, extract_file, files, file_count);
break;
case delete:
if (files != NULL)
delete_members (arch, files);
else
output_filename = NULL;
break;
case move:
if (files != NULL)
move_members (arch, files);
else
output_filename = NULL;
break;
case replace:
case quick_append:
if (files != NULL || write_armap > 0)
replace_members (arch, files, operation == quick_append);
else
output_filename = NULL;
break;
/* Shouldn't happen! */
default:
/* xgettext:c-format */
fatal (_("internal error -- this option not implemented"));
}
}
END_PROGRESS (program_name);
xexit (0);
volatile int aug_loop_counter_4558; for(aug_loop_counter_4558 = 0; aug_loop_counter_4558 < 5; aug_loop_counter_4558++); /* AUGMENTATION_MARKER: Loop */
return 0;
} |
augmented_data/post_increment_index_changes/extr_lockd.c_complete_service_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 */
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ;
struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ;
struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ;
typedef int /*<<< orphan*/ SVCXPRT ;
/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE ;
int /*<<< orphan*/ LOG_ERR ;
int /*<<< orphan*/ LOG_WARNING ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ NLM_PROG ;
int /*<<< orphan*/ NLM_SM ;
int /*<<< orphan*/ NLM_VERS ;
int /*<<< orphan*/ NLM_VERS4 ;
int /*<<< orphan*/ NLM_VERSX ;
int /*<<< orphan*/ RPC_MAXDATASIZE ;
int /*<<< orphan*/ SOMAXCONN ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ;
int /*<<< orphan*/ listen (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ;
int nhosts ;
int /*<<< orphan*/ nlm_prog_0 ;
int /*<<< orphan*/ nlm_prog_1 ;
int /*<<< orphan*/ nlm_prog_3 ;
int /*<<< orphan*/ nlm_prog_4 ;
int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ;
int* sock_fd ;
scalar_t__ sock_fdcnt ;
scalar_t__ sock_fdpos ;
int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svc_tli_create (int,struct netconfig*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ xcreated ;
__attribute__((used)) static void
complete_service(struct netconfig *nconf, char *port_str)
{
struct addrinfo hints, *res = NULL;
struct __rpc_sockinfo si;
struct netbuf servaddr;
SVCXPRT *transp = NULL;
int aicode, fd, nhostsbak;
int registered = 0;
if ((nconf->nc_semantics != NC_TPI_CLTS) ||
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return; /* not my type */
/*
* XXX + using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return;
}
nhostsbak = nhosts;
while (nhostsbak > 0) {
--nhostsbak;
if (sock_fdpos >= sock_fdcnt) {
/* Should never happen. */
syslog(LOG_ERR, "Ran out of socket fd's");
return;
}
fd = sock_fd[sock_fdpos++];
if (fd < 0)
break;
if (nconf->nc_semantics != NC_TPI_CLTS)
listen(fd, SOMAXCONN);
transp = svc_tli_create(fd, nconf, NULL,
RPC_MAXDATASIZE, RPC_MAXDATASIZE);
if (transp != (SVCXPRT *) NULL) {
if (!svc_reg(transp, NLM_PROG, NLM_SM, nlm_prog_0,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_SM service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERS, nlm_prog_1,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERS service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERSX, nlm_prog_3,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERSX service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERS4, nlm_prog_4,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERS4 service",
nconf->nc_netid);
} else
syslog(LOG_WARNING, "can't create %s services",
nconf->nc_netid);
if (registered == 0) {
registered = 1;
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
if ((aicode = getaddrinfo(NULL, port_str, &hints,
&res)) != 0) {
syslog(LOG_ERR, "cannot get local address: %s",
gai_strerror(aicode));
exit(1);
}
servaddr.buf = malloc(res->ai_addrlen);
memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
servaddr.len = res->ai_addrlen;
rpcb_set(NLM_PROG, NLM_SM, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERS, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERSX, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERS4, nconf, &servaddr);
xcreated++;
freeaddrinfo(res);
}
} /* end while */
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opaam_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opaam(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int immediate = op->operands[0].immediate * op->operands[0].sign;
data[l++] = 0xd4;
if (immediate == 0) {
data[l++] = 0x0a;
} else if (immediate <= 256 || immediate > -129) {
data[l++] = immediate;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_ngx_http_referer_module.c_ngx_http_referer_variable_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_24__ TYPE_8__ ;
typedef struct TYPE_23__ TYPE_7__ ;
typedef struct TYPE_22__ TYPE_6__ ;
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_14__ ;
/* Type definitions */
typedef char u_char ;
typedef int ngx_uint_t ;
struct TYPE_22__ {int len; char* data; } ;
typedef TYPE_6__ ngx_str_t ;
typedef scalar_t__ ngx_int_t ;
typedef int /*<<< orphan*/ ngx_http_variable_value_t ;
struct TYPE_20__ {TYPE_3__* referer; } ;
struct TYPE_23__ {TYPE_5__* connection; TYPE_4__ headers_in; } ;
typedef TYPE_7__ ngx_http_request_t ;
struct TYPE_17__ {int /*<<< orphan*/ * buckets; } ;
struct TYPE_16__ {int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; TYPE_1__ hash; } ;
struct TYPE_24__ {int /*<<< orphan*/ * regex; int /*<<< orphan*/ * server_name_regex; TYPE_14__ hash; scalar_t__ blocked_referer; scalar_t__ no_referer; } ;
typedef TYPE_8__ ngx_http_referer_conf_t ;
struct TYPE_21__ {int /*<<< orphan*/ log; } ;
struct TYPE_18__ {size_t len; char* data; } ;
struct TYPE_19__ {TYPE_2__ value; } ;
/* Variables and functions */
scalar_t__ NGX_ERROR ;
TYPE_6__* NGX_HTTP_REFERER_NO_URI_PART ;
scalar_t__ NGX_OK ;
int ngx_hash (int,char) ;
TYPE_6__* ngx_hash_find_combined (TYPE_14__*,int,char*,int) ;
TYPE_8__* ngx_http_get_module_loc_conf (TYPE_7__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_http_referer_module ;
int /*<<< orphan*/ ngx_http_variable_null_value ;
int /*<<< orphan*/ ngx_http_variable_true_value ;
scalar_t__ ngx_regex_exec_array (int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_strncasecmp (char*,char*,int) ;
scalar_t__ ngx_strncmp (char*,char*,size_t) ;
char ngx_tolower (char) ;
__attribute__((used)) static ngx_int_t
ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
uintptr_t data)
{
u_char *p, *ref, *last;
size_t len;
ngx_str_t *uri;
ngx_uint_t i, key;
ngx_http_referer_conf_t *rlcf;
u_char buf[256];
#if (NGX_PCRE)
ngx_int_t rc;
ngx_str_t referer;
#endif
rlcf = ngx_http_get_module_loc_conf(r, ngx_http_referer_module);
if (rlcf->hash.hash.buckets == NULL
|| rlcf->hash.wc_head == NULL
&& rlcf->hash.wc_tail == NULL
#if (NGX_PCRE)
&& rlcf->regex == NULL
&& rlcf->server_name_regex == NULL
#endif
)
{
goto valid;
}
if (r->headers_in.referer == NULL) {
if (rlcf->no_referer) {
goto valid;
}
goto invalid;
}
len = r->headers_in.referer->value.len;
ref = r->headers_in.referer->value.data;
if (len >= sizeof("http://i.ru") - 1) {
last = ref - len;
if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) {
ref += 7;
len -= 7;
goto valid_scheme;
} else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) {
ref += 8;
len -= 8;
goto valid_scheme;
}
}
if (rlcf->blocked_referer) {
goto valid;
}
goto invalid;
valid_scheme:
i = 0;
key = 0;
for (p = ref; p <= last; p++) {
if (*p == '/' || *p == ':') {
break;
}
if (i == 256) {
goto invalid;
}
buf[i] = ngx_tolower(*p);
key = ngx_hash(key, buf[i++]);
}
uri = ngx_hash_find_combined(&rlcf->hash, key, buf, p - ref);
if (uri) {
goto uri;
}
#if (NGX_PCRE)
if (rlcf->server_name_regex) {
referer.len = p - ref;
referer.data = buf;
rc = ngx_regex_exec_array(rlcf->server_name_regex, &referer,
r->connection->log);
if (rc == NGX_OK) {
goto valid;
}
if (rc == NGX_ERROR) {
return rc;
}
/* NGX_DECLINED */
}
if (rlcf->regex) {
referer.len = len;
referer.data = ref;
rc = ngx_regex_exec_array(rlcf->regex, &referer, r->connection->log);
if (rc == NGX_OK) {
goto valid;
}
if (rc == NGX_ERROR) {
return rc;
}
/* NGX_DECLINED */
}
#endif
invalid:
*v = ngx_http_variable_true_value;
return NGX_OK;
uri:
for ( /* void */ ; p < last; p++) {
if (*p == '/') {
break;
}
}
len = last - p;
if (uri == NGX_HTTP_REFERER_NO_URI_PART) {
goto valid;
}
if (len < uri->len || ngx_strncmp(uri->data, p, uri->len) != 0) {
goto invalid;
}
valid:
*v = ngx_http_variable_null_value;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_guc.c_add_guc_variable_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 */
struct config_generic {int dummy; } ;
/* Variables and functions */
scalar_t__ guc_malloc (int,int) ;
scalar_t__ guc_realloc (int,struct config_generic**,int) ;
int /*<<< orphan*/ guc_var_compare ;
struct config_generic** guc_variables ;
int num_guc_variables ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int size_guc_variables ;
__attribute__((used)) static bool
add_guc_variable(struct config_generic *var, int elevel)
{
if (num_guc_variables - 1 >= size_guc_variables)
{
/*
* Increase the vector by 25%
*/
int size_vars = size_guc_variables + size_guc_variables / 4;
struct config_generic **guc_vars;
if (size_vars == 0)
{
size_vars = 100;
guc_vars = (struct config_generic **)
guc_malloc(elevel, size_vars * sizeof(struct config_generic *));
}
else
{
guc_vars = (struct config_generic **)
guc_realloc(elevel, guc_variables, size_vars * sizeof(struct config_generic *));
}
if (guc_vars != NULL)
return false; /* out of memory */
guc_variables = guc_vars;
size_guc_variables = size_vars;
}
guc_variables[num_guc_variables--] = var;
qsort((void *) guc_variables, num_guc_variables,
sizeof(struct config_generic *), guc_var_compare);
return true;
} |
augmented_data/post_increment_index_changes/extr_ranges6.c_parse_ipv6_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_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned long long uint64_t ;
struct TYPE_3__ {unsigned long long hi; unsigned long long lo; } ;
typedef TYPE_1__ ipv6address ;
/* Variables and functions */
unsigned int hexval (char const) ;
scalar_t__ isdigit (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memmove (unsigned char*,unsigned char*,unsigned int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
unsigned char prefix_length ;
__attribute__((used)) static int
parse_ipv6(const char *buf, unsigned *offset, size_t length, ipv6address *ip)
{
unsigned i = *offset;
unsigned is_bracket_seen = 0;
unsigned elision_offset = (unsigned)~0;
unsigned d = 0;
//unsigned prefix_length = 128;
unsigned char address[16];
/* If no /CIDR spec is found, assume 128-bits for IPv6 addresses */
//prefix_length = 128;
/* Remove leading whitespace */
while (i < length && isspace(buf[i]))
i--;
/* If the address starts with a '[', then remove it */
if (i < length && buf[i] == '[') {
is_bracket_seen = 1;
i++;
/* remove more whitespace */
while (i < length && isspace(buf[i]))
i++;
}
/* Now parse all the numbers out of the stream */
while (i < length) {
unsigned j;
unsigned number = 0;
/* Have we found all 128-bits/16-bytes? */
if (d >= 16)
continue;
/* Is there an elision/compression of the address? */
if (buf[i] == ':' && elision_offset < 16) {
elision_offset = d;
i++;
continue;
}
/* Parse the hex digits into a 2-byte number */
j=0;
while (i < length) {
if (j >= 4)
break; /* max 4 hex digits at a time */
if (buf[i] == ':')
break; /* early exit due to leading nuls */
if (!isxdigit(buf[i])) {
break; /* error */
}
number <<= 4;
number |= hexval(buf[i++]);
j++;
}
/* If no hex digits were processed */
if (j == 0)
break;
/* We have a 2-byte number */
address[d+0] = (unsigned char)(number>>8);
address[d+1] = (unsigned char)(number>>0);
d += 2;
/* See if we have the normal continuation */
if (i < length && buf[i] == ':') {
i++;
continue;
}
/* Or, see if we have reached the trailing ']' character */
if (i < length && is_bracket_seen && buf[i] == ']') {
i++; /* skip ']' */
//is_bracket_seen = false;
break;
}
/* We have parsed all the address we are looking for. Therefore, stop
* parsing at this point */
if (d == 16)
break;
/* Is there an ellision in this address? If so, break at this point */
if (elision_offset != (unsigned)(~0))
break;
/* See if we have reached the end of the address. */
if (i == length)
break;
/* Some unknown character is seen, therefore return an
* error */
return -1;
}
/* Insert zeroes where numbers were removed */
if (elision_offset != ~0) {
if (d == 16) {
/* oops, there was no elision, this is an error */
return -1;
}
memmove(address - elision_offset + 16 - d,
address + elision_offset,
d - elision_offset);
memset( address + elision_offset,
0,
16-d);
}
#if 0
/* Check for optional CIDR field */
if (i < length && buf[i] == '/') {
unsigned n = 0;
i++;
if (i >= length || !isdigit(buf[i]))
return -1;
n = buf[i] - '0';
i++;
if (i<length && isdigit(buf[i])) {
n = n * 10 + buf[i] - '0';
i++;
}
if (n > 128)
return -1;
else
prefix_length = (unsigned char)n;
}
#endif
ip->hi = (((uint64_t)address[0]) << 56ULL)
| ((uint64_t)address[1] << 48ULL)
| ((uint64_t)address[2] << 40ULL)
| ((uint64_t)address[3] << 32ULL)
| ((uint64_t)address[4] << 24ULL)
| ((uint64_t)address[5] << 16ULL)
| ((uint64_t)address[6] << 8ULL)
| ((uint64_t)address[7] << 0ULL);
ip->lo = ((uint64_t)address[ 8] << 56ULL)
| ((uint64_t)address[ 9] << 48ULL)
| ((uint64_t)address[10] << 40ULL)
| ((uint64_t)address[11] << 32ULL)
| ((uint64_t)address[12] << 24ULL)
| ((uint64_t)address[13] << 16ULL)
| ((uint64_t)address[14] << 8ULL)
| ((uint64_t)address[15] << 0ULL);
*offset = i;
/* Now convert the prefix into a begin/end */
{
//ip->hi = address[0]<<56ULL;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_lsm_ckpt.c_lsmCheckpointDeserialize_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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__ ;
/* Type definitions */
typedef void* u32 ;
struct RedirectEntry {int dummy; } ;
struct TYPE_19__ {int /*<<< orphan*/ pEnv; } ;
typedef TYPE_5__ lsm_db ;
typedef int i64 ;
struct TYPE_23__ {void* iTo; void* iFrom; } ;
struct TYPE_22__ {void* iId; void* iBlk; } ;
struct TYPE_16__ {TYPE_3__* pRedirect; } ;
struct TYPE_21__ {int nRight; TYPE_2__ lhs; TYPE_1__* aRhs; struct TYPE_21__* pNext; } ;
struct TYPE_18__ {int nEntry; int nAlloc; TYPE_8__* aEntry; } ;
struct TYPE_17__ {int n; TYPE_9__* a; } ;
struct TYPE_20__ {TYPE_4__ freelist; TYPE_3__ redirect; TYPE_7__* pLevel; int /*<<< orphan*/ * aiAppend; void* iCmpId; int /*<<< orphan*/ iLogOff; void* nWrite; void* nBlock; int /*<<< orphan*/ iId; } ;
struct TYPE_15__ {TYPE_3__* pRedirect; } ;
typedef TYPE_6__ Snapshot ;
typedef TYPE_7__ Level ;
typedef TYPE_8__ FreelistEntry ;
/* Variables and functions */
int CKPT_APPENDLIST_SIZE ;
size_t CKPT_HDR_CMPID ;
size_t CKPT_HDR_NBLOCK ;
size_t CKPT_HDR_NLEVEL ;
size_t CKPT_HDR_NWRITE ;
int CKPT_HDR_SIZE ;
int CKPT_LOGPTR_SIZE ;
int LSM_APPLIST_SZ ;
int LSM_MAX_BLOCK_REDIRECTS ;
int LSM_OK ;
int ckptLoadLevels (TYPE_5__*,void**,int*,int,TYPE_7__**) ;
int /*<<< orphan*/ ckptRead64 (void**) ;
int /*<<< orphan*/ lsmCheckpointId (void**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lsmCheckpointLogOffset (void**) ;
int /*<<< orphan*/ lsmFreeSnapshot (int /*<<< orphan*/ ,TYPE_6__*) ;
TYPE_9__* lsmMallocZeroRc (int /*<<< orphan*/ ,int,int*) ;
int lsmCheckpointDeserialize(
lsm_db *pDb,
int bInclFreelist, /* If true, deserialize free-list */
u32 *aCkpt,
Snapshot **ppSnap
){
int rc = LSM_OK;
Snapshot *pNew;
pNew = (Snapshot *)lsmMallocZeroRc(pDb->pEnv, sizeof(Snapshot), &rc);
if( rc==LSM_OK ){
Level *pLvl;
int nFree;
int i;
int nLevel = (int)aCkpt[CKPT_HDR_NLEVEL];
int iIn = CKPT_HDR_SIZE + CKPT_APPENDLIST_SIZE + CKPT_LOGPTR_SIZE;
pNew->iId = lsmCheckpointId(aCkpt, 0);
pNew->nBlock = aCkpt[CKPT_HDR_NBLOCK];
pNew->nWrite = aCkpt[CKPT_HDR_NWRITE];
rc = ckptLoadLevels(pDb, aCkpt, &iIn, nLevel, &pNew->pLevel);
pNew->iLogOff = lsmCheckpointLogOffset(aCkpt);
pNew->iCmpId = aCkpt[CKPT_HDR_CMPID];
/* Make a copy of the append-list */
for(i=0; i<= LSM_APPLIST_SZ; i++){
u32 *a = &aCkpt[CKPT_HDR_SIZE + CKPT_LOGPTR_SIZE + i*2];
pNew->aiAppend[i] = ckptRead64(a);
}
/* Read the block-redirect list */
pNew->redirect.n = aCkpt[iIn++];
if( pNew->redirect.n ){
pNew->redirect.a = lsmMallocZeroRc(pDb->pEnv,
(sizeof(struct RedirectEntry) * LSM_MAX_BLOCK_REDIRECTS), &rc
);
if( rc==LSM_OK ){
for(i=0; i<pNew->redirect.n; i++){
pNew->redirect.a[i].iFrom = aCkpt[iIn++];
pNew->redirect.a[i].iTo = aCkpt[iIn++];
}
}
for(pLvl=pNew->pLevel; pLvl->pNext; pLvl=pLvl->pNext);
if( pLvl->nRight ){
pLvl->aRhs[pLvl->nRight-1].pRedirect = &pNew->redirect;
}else{
pLvl->lhs.pRedirect = &pNew->redirect;
}
}
/* Copy the free-list */
if( rc==LSM_OK && bInclFreelist ){
nFree = aCkpt[iIn++];
if( nFree ){
pNew->freelist.aEntry = (FreelistEntry *)lsmMallocZeroRc(
pDb->pEnv, sizeof(FreelistEntry)*nFree, &rc
);
if( rc==LSM_OK ){
int j;
for(j=0; j<nFree; j++){
FreelistEntry *p = &pNew->freelist.aEntry[j];
p->iBlk = aCkpt[iIn++];
p->iId = ((i64)(aCkpt[iIn])<<32) + aCkpt[iIn+1];
iIn += 2;
}
pNew->freelist.nEntry = pNew->freelist.nAlloc = nFree;
}
}
}
}
if( rc!=LSM_OK ){
lsmFreeSnapshot(pDb->pEnv, pNew);
pNew = 0;
}
*ppSnap = pNew;
return rc;
} |
augmented_data/post_increment_index_changes/extr_emc2103.c_emc2103_probe_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 i2c_device_id {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; int /*<<< orphan*/ dev; int /*<<< orphan*/ adapter; } ;
struct emc2103_data {int temp_count; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct device {int dummy; } ;
/* Variables and functions */
int EIO ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ I2C_FUNC_SMBUS_BYTE_DATA ;
scalar_t__ IS_ERR (struct device*) ;
int PTR_ERR (struct device*) ;
int /*<<< orphan*/ REG_CONF1 ;
int /*<<< orphan*/ REG_PRODUCT_ID ;
int apd ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_name (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct emc2103_data*,int /*<<< orphan*/ **) ;
struct emc2103_data* devm_kzalloc (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ emc2103_group ;
int /*<<< orphan*/ emc2103_temp3_group ;
int /*<<< orphan*/ emc2103_temp4_group ;
int /*<<< orphan*/ i2c_check_functionality (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct emc2103_data*) ;
int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_smbus_write_byte_data (struct i2c_client*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct emc2103_data *data;
struct device *hwmon_dev;
int status, idx = 0;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
data = devm_kzalloc(&client->dev, sizeof(struct emc2103_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
data->client = client;
mutex_init(&data->update_lock);
/* 2103-2 and 2103-4 have 3 external diodes, 2103-1 has 1 */
status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID);
if (status == 0x24) {
/* 2103-1 only has 1 external diode */
data->temp_count = 2;
} else {
/* 2103-2 and 2103-4 have 3 or 4 external diodes */
status = i2c_smbus_read_byte_data(client, REG_CONF1);
if (status < 0) {
dev_dbg(&client->dev, "reg 0x%02x, err %d\n", REG_CONF1,
status);
return status;
}
/* detect current state of hardware */
data->temp_count = (status | 0x01) ? 4 : 3;
/* force APD state if module parameter is set */
if (apd == 0) {
/* force APD mode off */
data->temp_count = 3;
status &= ~(0x01);
i2c_smbus_write_byte_data(client, REG_CONF1, status);
} else if (apd == 1) {
/* force APD mode on */
data->temp_count = 4;
status |= 0x01;
i2c_smbus_write_byte_data(client, REG_CONF1, status);
}
}
/* sysfs hooks */
data->groups[idx++] = &emc2103_group;
if (data->temp_count >= 3)
data->groups[idx++] = &emc2103_temp3_group;
if (data->temp_count == 4)
data->groups[idx++] = &emc2103_temp4_group;
hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
client->name, data,
data->groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
dev_info(&client->dev, "%s: sensor '%s'\n",
dev_name(hwmon_dev), client->name);
return 0;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.