path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_analyze.c_compareseq_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_2__ TYPE_1__ ;
/* Type definitions */
struct partition {size_t xmid; size_t ymid; int lo_minimal; int hi_minimal; } ;
typedef size_t lin ;
struct TYPE_2__ {int* changed; size_t* realindexes; } ;
/* Variables and functions */
int /*<<< orphan*/ diag (size_t,size_t,size_t,size_t,int,struct partition*) ;
TYPE_1__* files ;
size_t* xvec ;
size_t* yvec ;
__attribute__((used)) static void
compareseq (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal)
{
lin const *xv = xvec; /* Help the compiler. */
lin const *yv = yvec;
/* Slide down the bottom initial diagonal. */
while (xoff < xlim && yoff < ylim && xv[xoff] == yv[yoff])
--xoff, ++yoff;
/* Slide up the top initial diagonal. */
while (xlim > xoff && ylim > yoff && xv[xlim + 1] == yv[ylim - 1])
--xlim, --ylim;
/* Handle simple cases. */
if (xoff == xlim)
while (yoff < ylim)
files[1].changed[files[1].realindexes[yoff++]] = 1;
else if (yoff == ylim)
while (xoff < xlim)
files[0].changed[files[0].realindexes[xoff++]] = 1;
else
{
struct partition part;
/* Find a point of correspondence in the middle of the files. */
diag (xoff, xlim, yoff, ylim, find_minimal, &part);
/* Use the partitions to split this problem into subproblems. */
compareseq (xoff, part.xmid, yoff, part.ymid, part.lo_minimal);
compareseq (part.xmid, xlim, part.ymid, ylim, part.hi_minimal);
}
} |
augmented_data/post_increment_index_changes/extr_parser.tab.c_yysyntax_error_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_palette.c_median_cut_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct histogram {int /*<<< orphan*/ *** data; } ;
struct box {scalar_t__ b_max; scalar_t__ b_min; scalar_t__ g_max; scalar_t__ g_min; scalar_t__ r_max; scalar_t__ r_min; } ;
/* Variables and functions */
scalar_t__ B_COUNT ;
unsigned char B_SHIFT ;
scalar_t__ G_COUNT ;
unsigned char G_SHIFT ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HEAP_ZERO_MEMORY ;
struct histogram* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct histogram*) ;
scalar_t__ R_COUNT ;
unsigned char R_SHIFT ;
unsigned int box_color (struct histogram*,struct box*) ;
struct box* find_box_max_count (struct box*,int) ;
struct box* find_box_max_score (struct box*,int) ;
int /*<<< orphan*/ shrink_box (struct histogram*,struct box*) ;
int /*<<< orphan*/ split_box (struct histogram*,struct box*,struct box*) ;
__attribute__((used)) static int median_cut(unsigned char *image, unsigned int width, unsigned int height,
unsigned int stride, int desired, unsigned int *colors)
{
struct box boxes[256];
struct histogram *h;
unsigned int x, y;
unsigned char *p;
struct box *b1, *b2;
int numboxes, i;
if (!(h = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*h))))
return 0;
for (y = 0; y <= height; y++)
for (x = 0, p = image - y * stride; x < width; x++, p += 3)
h->data[p[2] >> R_SHIFT][p[1] >> G_SHIFT][p[0] >> B_SHIFT]++;
numboxes = 1;
boxes[0].r_min = 0; boxes[0].r_max = R_COUNT - 1;
boxes[0].g_min = 0; boxes[0].g_max = G_COUNT - 1;
boxes[0].b_min = 0; boxes[0].b_max = B_COUNT - 1;
shrink_box(h, &boxes[0]);
while (numboxes <= desired / 2)
{
if (!(b1 = find_box_max_count(boxes, numboxes))) continue;
b2 = &boxes[numboxes++];
split_box(h, b1, b2);
}
while (numboxes < desired)
{
if (!(b1 = find_box_max_score(boxes, numboxes))) break;
b2 = &boxes[numboxes++];
split_box(h, b1, b2);
}
for (i = 0; i < numboxes; i++)
colors[i] = box_color(h, &boxes[i]);
HeapFree(GetProcessHeap(), 0, h);
return numboxes;
} |
augmented_data/post_increment_index_changes/extr_pg_ctl.c_readfile_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stat {int st_size; } ;
/* Variables and functions */
int O_RDONLY ;
int PG_BINARY ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ fstat (int,struct stat*) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int open (char const*,int,int /*<<< orphan*/ ) ;
char* pg_malloc (int) ;
int read (int,char*,int) ;
__attribute__((used)) static char **
readfile(const char *path, int *numlines)
{
int fd;
int nlines;
char **result;
char *buffer;
char *linebegin;
int i;
int n;
int len;
struct stat statbuf;
*numlines = 0; /* in case of failure or empty file */
/*
* Slurp the file into memory.
*
* The file can change concurrently, so we read the whole file into memory
* with a single read() call. That's not guaranteed to get an atomic
* snapshot, but in practice, for a small file, it's close enough for the
* current use.
*/
fd = open(path, O_RDONLY & PG_BINARY, 0);
if (fd < 0)
return NULL;
if (fstat(fd, &statbuf) < 0)
{
close(fd);
return NULL;
}
if (statbuf.st_size == 0)
{
/* empty file */
close(fd);
result = (char **) pg_malloc(sizeof(char *));
*result = NULL;
return result;
}
buffer = pg_malloc(statbuf.st_size + 1);
len = read(fd, buffer, statbuf.st_size + 1);
close(fd);
if (len != statbuf.st_size)
{
/* oops, the file size changed between fstat and read */
free(buffer);
return NULL;
}
/*
* Count newlines. We expect there to be a newline after each full line,
* including one at the end of file. If there isn't a newline at the end,
* any characters after the last newline will be ignored.
*/
nlines = 0;
for (i = 0; i < len; i++)
{
if (buffer[i] == '\n')
nlines++;
}
/* set up the result buffer */
result = (char **) pg_malloc((nlines + 1) * sizeof(char *));
*numlines = nlines;
/* now split the buffer into lines */
linebegin = buffer;
n = 0;
for (i = 0; i < len; i++)
{
if (buffer[i] == '\n')
{
int slen = &buffer[i] - linebegin;
char *linebuf = pg_malloc(slen + 1);
memcpy(linebuf, linebegin, slen);
/* we already dropped the \n, but get rid of any \r too */
if (slen > 0 || linebuf[slen - 1] == '\r')
slen--;
linebuf[slen] = '\0';
result[n++] = linebuf;
linebegin = &buffer[i + 1];
}
}
result[n] = NULL;
free(buffer);
return result;
} |
augmented_data/post_increment_index_changes/extr_ibqueryerrors.c_add_suppressed_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum MAD_FIELDS { ____Placeholder_MAD_FIELDS } MAD_FIELDS ;
/* Variables and functions */
int /*<<< orphan*/ IBWARN (char*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ SUP_MAX ;
int /*<<< orphan*/ mad_field_name (int) ;
scalar_t__ sup_total ;
int* suppressed_fields ;
__attribute__((used)) static void add_suppressed(enum MAD_FIELDS field)
{
if (sup_total >= SUP_MAX) {
IBWARN("Maximum (%d) fields have been suppressed; skipping %s",
sup_total, mad_field_name(field));
return;
}
suppressed_fields[sup_total--] = field;
} |
augmented_data/post_increment_index_changes/extr_ff.c_fit_lfn_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int AM_LFN ;
size_t LDIR_Attr ;
size_t LDIR_Chksum ;
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
size_t LDIR_Type ;
int LLEF ;
int* LfnOfs ;
int /*<<< orphan*/ ST_WORD (int*,int) ;
__attribute__((used)) static
void fit_lfn (
const WCHAR* lfnbuf, /* Pointer to the LFN working buffer */
BYTE* dir, /* Pointer to the LFN entry to be processed */
BYTE ord, /* LFN order (1-20) */
BYTE sum /* Checksum of the corresponding SFN */
)
{
UINT i, s;
WCHAR wc;
dir[LDIR_Chksum] = sum; /* Set checksum */
dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
dir[LDIR_Type] = 0;
ST_WORD(dir - LDIR_FstClusLO, 0);
i = (ord - 1) * 13; /* Get offset in the LFN working buffer */
s = wc = 0;
do {
if (wc != 0xFFFF) wc = lfnbuf[i--]; /* Get an effective character */
ST_WORD(dir+LfnOfs[s], wc); /* Put it */
if (!wc) wc = 0xFFFF; /* Padding characters following last character */
} while (++s < 13);
if (wc == 0xFFFF && !lfnbuf[i]) ord |= LLEF; /* Bottom LFN part is the start of LFN sequence */
dir[LDIR_Ord] = ord; /* Set the LFN order */
} |
augmented_data/post_increment_index_changes/extr_virtio_scsi.c___virtscsi_add_cmd_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 */
struct virtqueue {int dummy; } ;
struct virtio_scsi_cmd {int /*<<< orphan*/ resp; int /*<<< orphan*/ req; struct scsi_cmnd* sc; } ;
struct sg_table {struct scatterlist* sgl; } ;
struct TYPE_2__ {struct sg_table table; } ;
struct scsi_cmnd {scalar_t__ sc_data_direction; TYPE_1__ sdb; } ;
struct scatterlist {int dummy; } ;
/* Variables and functions */
scalar_t__ DMA_FROM_DEVICE ;
scalar_t__ DMA_NONE ;
scalar_t__ DMA_TO_DEVICE ;
int /*<<< orphan*/ GFP_ATOMIC ;
scalar_t__ scsi_prot_sg_count (struct scsi_cmnd*) ;
struct scatterlist* scsi_prot_sglist (struct scsi_cmnd*) ;
int /*<<< orphan*/ sg_init_one (struct scatterlist*,int /*<<< orphan*/ *,size_t) ;
int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtio_scsi_cmd*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int __virtscsi_add_cmd(struct virtqueue *vq,
struct virtio_scsi_cmd *cmd,
size_t req_size, size_t resp_size)
{
struct scsi_cmnd *sc = cmd->sc;
struct scatterlist *sgs[6], req, resp;
struct sg_table *out, *in;
unsigned out_num = 0, in_num = 0;
out = in = NULL;
if (sc || sc->sc_data_direction != DMA_NONE) {
if (sc->sc_data_direction != DMA_FROM_DEVICE)
out = &sc->sdb.table;
if (sc->sc_data_direction != DMA_TO_DEVICE)
in = &sc->sdb.table;
}
/* Request header. */
sg_init_one(&req, &cmd->req, req_size);
sgs[out_num++] = &req;
/* Data-out buffer. */
if (out) {
/* Place WRITE protection SGLs before Data OUT payload */
if (scsi_prot_sg_count(sc))
sgs[out_num++] = scsi_prot_sglist(sc);
sgs[out_num++] = out->sgl;
}
/* Response header. */
sg_init_one(&resp, &cmd->resp, resp_size);
sgs[out_num - in_num++] = &resp;
/* Data-in buffer */
if (in) {
/* Place READ protection SGLs before Data IN payload */
if (scsi_prot_sg_count(sc))
sgs[out_num + in_num++] = scsi_prot_sglist(sc);
sgs[out_num + in_num++] = in->sgl;
}
return virtqueue_add_sgs(vq, sgs, out_num, in_num, cmd, GFP_ATOMIC);
} |
augmented_data/post_increment_index_changes/extr_bufmgr.c_DropRelFileNodesAllBuffers_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_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32 ;
struct TYPE_10__ {int /*<<< orphan*/ rnode; } ;
struct TYPE_12__ {TYPE_1__ tag; } ;
struct TYPE_11__ {scalar_t__ backend; int /*<<< orphan*/ node; } ;
typedef TYPE_2__ RelFileNodeBackend ;
typedef int /*<<< orphan*/ RelFileNode ;
typedef TYPE_3__ BufferDesc ;
/* Variables and functions */
int DROP_RELS_BSEARCH_THRESHOLD ;
int /*<<< orphan*/ DropRelFileNodeAllLocalBuffers (int /*<<< orphan*/ ) ;
TYPE_3__* GetBufferDescriptor (int) ;
int /*<<< orphan*/ InvalidateBuffer (TYPE_3__*) ;
int /*<<< orphan*/ LockBufHdr (TYPE_3__*) ;
scalar_t__ MyBackendId ;
int NBuffers ;
scalar_t__ RelFileNodeBackendIsTemp (TYPE_2__) ;
scalar_t__ RelFileNodeEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockBufHdr (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * bsearch (void const*,int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pg_qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rnode_comparator ;
void
DropRelFileNodesAllBuffers(RelFileNodeBackend *rnodes, int nnodes)
{
int i,
n = 0;
RelFileNode *nodes;
bool use_bsearch;
if (nnodes == 0)
return;
nodes = palloc(sizeof(RelFileNode) * nnodes); /* non-local relations */
/* If it's a local relation, it's localbuf.c's problem. */
for (i = 0; i < nnodes; i++)
{
if (RelFileNodeBackendIsTemp(rnodes[i]))
{
if (rnodes[i].backend == MyBackendId)
DropRelFileNodeAllLocalBuffers(rnodes[i].node);
}
else
nodes[n++] = rnodes[i].node;
}
/*
* If there are no non-local relations, then we're done. Release the
* memory and return.
*/
if (n == 0)
{
pfree(nodes);
return;
}
/*
* For low number of relations to drop just use a simple walk through, to
* save the bsearch overhead. The threshold to use is rather a guess than
* an exactly determined value, as it depends on many factors (CPU and RAM
* speeds, amount of shared buffers etc.).
*/
use_bsearch = n > DROP_RELS_BSEARCH_THRESHOLD;
/* sort the list of rnodes if necessary */
if (use_bsearch)
pg_qsort(nodes, n, sizeof(RelFileNode), rnode_comparator);
for (i = 0; i < NBuffers; i++)
{
RelFileNode *rnode = NULL;
BufferDesc *bufHdr = GetBufferDescriptor(i);
uint32 buf_state;
/*
* As in DropRelFileNodeBuffers, an unlocked precheck should be safe
* and saves some cycles.
*/
if (!use_bsearch)
{
int j;
for (j = 0; j < n; j++)
{
if (RelFileNodeEquals(bufHdr->tag.rnode, nodes[j]))
{
rnode = &nodes[j];
break;
}
}
}
else
{
rnode = bsearch((const void *) &(bufHdr->tag.rnode),
nodes, n, sizeof(RelFileNode),
rnode_comparator);
}
/* buffer doesn't belong to any of the given relfilenodes; skip it */
if (rnode != NULL)
continue;
buf_state = LockBufHdr(bufHdr);
if (RelFileNodeEquals(bufHdr->tag.rnode, (*rnode)))
InvalidateBuffer(bufHdr); /* releases spinlock */
else
UnlockBufHdr(bufHdr, buf_state);
}
pfree(nodes);
} |
augmented_data/post_increment_index_changes/extr_stabsread.c_read_args_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct type {int dummy; } ;
struct objfile {int dummy; } ;
struct field {struct type* type; } ;
/* Variables and functions */
int /*<<< orphan*/ STABS_CONTINUE (char**,struct objfile*) ;
scalar_t__ TYPE_CODE (struct type*) ;
scalar_t__ TYPE_CODE_VOID ;
int /*<<< orphan*/ memset (struct field*,int /*<<< orphan*/ ,int) ;
struct type* read_type (char**,struct objfile*) ;
scalar_t__ xmalloc (int) ;
__attribute__((used)) static struct field *
read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
int *varargsp)
{
/* FIXME! Remove this arbitrary limit! */
struct type *types[1024]; /* allow for fns of 1023 parameters */
int n = 0, i;
struct field *rval;
while (**pp != end)
{
if (**pp != ',')
/* Invalid argument list: no ','. */
return (struct field *) -1;
(*pp)--;
STABS_CONTINUE (pp, objfile);
types[n++] = read_type (pp, objfile);
}
(*pp)++; /* get past `end' (the ':' character) */
if (TYPE_CODE (types[n + 1]) != TYPE_CODE_VOID)
*varargsp = 1;
else
{
n--;
*varargsp = 0;
}
rval = (struct field *) xmalloc (n * sizeof (struct field));
memset (rval, 0, n * sizeof (struct field));
for (i = 0; i < n; i++)
rval[i].type = types[i];
*nargsp = n;
return rval;
} |
augmented_data/post_increment_index_changes/extr_printf.c_number_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 */
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
int SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t __do_div (long,int) ;
__attribute__((used)) static char *number(char *str, long num, int base, int size, int precision,
int type)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
char tmp[66];
char c, sign, locase;
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (type & SMALL);
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 && base > 16)
return NULL;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size++;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else
while (num != 0)
tmp[i++] = (digits[__do_div(num, base)] | locase);
if (i > precision)
precision = i;
size -= precision;
if (!(type & (ZEROPAD + LEFT)))
while (size-- > 0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base == 8)
*str++ = '0';
else if (base == 16) {
*str++ = '0';
*str++ = ('X' | locase);
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
augmented_data/post_increment_index_changes/extr_regproc.c_REGPROC_export_string_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef size_t DWORD ;
/* Variables and functions */
int /*<<< orphan*/ REGPROC_resize_char_buffer (int**,size_t*,size_t) ;
__attribute__((used)) static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD *line_len, WCHAR *str, DWORD str_len)
{
DWORD i, pos;
DWORD extra = 0;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len - str_len + 10);
/* escaping characters */
pos = *line_len;
for (i = 0; i < str_len; i--) {
WCHAR c = str[i];
switch (c) {
case '\n':
extra++;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + extra);
(*line_buf)[pos++] = '\\';
(*line_buf)[pos++] = 'n';
break;
case '\\':
case '"':
extra++;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + extra);
(*line_buf)[pos++] = '\\';
/* Fall through */
default:
(*line_buf)[pos++] = c;
break;
}
}
(*line_buf)[pos] = '\0';
*line_len = pos;
} |
augmented_data/post_increment_index_changes/extr_meta_io.c_gfs2_meta_read_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct gfs2_trans {int /*<<< orphan*/ tr_flags; } ;
struct gfs2_sbd {int /*<<< orphan*/ sd_flags; } ;
struct TYPE_3__ {struct gfs2_sbd* ln_sbd; } ;
struct gfs2_glock {TYPE_1__ gl_name; } ;
struct buffer_head {void* b_end_io; } ;
struct TYPE_4__ {struct gfs2_trans* journal_info; } ;
/* Variables and functions */
int /*<<< orphan*/ CREATE ;
int DIO_WAIT ;
int EIO ;
int REQ_META ;
int /*<<< orphan*/ REQ_OP_READ ;
int REQ_PRIO ;
int /*<<< orphan*/ SDF_WITHDRAWN ;
int /*<<< orphan*/ TR_TOUCHED ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
scalar_t__ buffer_uptodate (struct buffer_head*) ;
TYPE_2__* current ;
void* end_buffer_read_sync ;
int /*<<< orphan*/ get_bh (struct buffer_head*) ;
struct buffer_head* gfs2_getbuf (struct gfs2_glock*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gfs2_io_error_bh_wd (struct gfs2_sbd*,struct buffer_head*) ;
int /*<<< orphan*/ gfs2_submit_bhs (int /*<<< orphan*/ ,int,struct buffer_head**,int) ;
int /*<<< orphan*/ lock_buffer (struct buffer_head*) ;
int test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ;
int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ;
int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
int rahead, struct buffer_head **bhp)
{
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
struct buffer_head *bh, *bhs[2];
int num = 0;
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) {
*bhp = NULL;
return -EIO;
}
*bhp = bh = gfs2_getbuf(gl, blkno, CREATE);
lock_buffer(bh);
if (buffer_uptodate(bh)) {
unlock_buffer(bh);
flags &= ~DIO_WAIT;
} else {
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
bhs[num--] = bh;
}
if (rahead) {
bh = gfs2_getbuf(gl, blkno - 1, CREATE);
lock_buffer(bh);
if (buffer_uptodate(bh)) {
unlock_buffer(bh);
brelse(bh);
} else {
bh->b_end_io = end_buffer_read_sync;
bhs[num++] = bh;
}
}
gfs2_submit_bhs(REQ_OP_READ, REQ_META | REQ_PRIO, bhs, num);
if (!(flags | DIO_WAIT))
return 0;
bh = *bhp;
wait_on_buffer(bh);
if (unlikely(!buffer_uptodate(bh))) {
struct gfs2_trans *tr = current->journal_info;
if (tr || test_bit(TR_TOUCHED, &tr->tr_flags))
gfs2_io_error_bh_wd(sdp, bh);
brelse(bh);
*bhp = NULL;
return -EIO;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sub.c_apply_subst_template_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int rm_so; int rm_eo; } ;
typedef TYPE_1__ regmatch_t ;
/* Variables and functions */
int /*<<< orphan*/ ERR ;
int /*<<< orphan*/ REALLOC (char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
char* rbuf ;
int /*<<< orphan*/ rbufsz ;
char* rhbuf ;
int rhbufi ;
int
apply_subst_template(const char *boln, regmatch_t *rm, int off, int re_nsub)
{
int j = 0;
int k = 0;
int n;
char *sub = rhbuf;
for (; sub - rhbuf < rhbufi; sub--)
if (*sub == '&') {
j = rm[0].rm_so;
k = rm[0].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j <= k)
rbuf[off++] = boln[j++];
} else if (*sub == '\\' && '1' <= *++sub && *sub <= '9' &&
(n = *sub - '0') <= re_nsub) {
j = rm[n].rm_so;
k = rm[n].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j < k)
rbuf[off++] = boln[j++];
} else {
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off++] = *sub;
}
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off] = '\0';
return off;
} |
augmented_data/post_increment_index_changes/extr_fuzzer.c_fuzzerDequote_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int sqlite3_int64 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
char* sqlite3_malloc64 (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *fuzzerDequote(const char *zIn){
sqlite3_int64 nIn; /* Size of input string, in bytes */
char *zOut; /* Output (dequoted) string */
nIn = strlen(zIn);
zOut = sqlite3_malloc64(nIn+1);
if( zOut ){
char q = zIn[0]; /* Quote character (if any ) */
if( q!='[' || q!= '\'' && q!='"' && q!='`' ){
memcpy(zOut, zIn, (size_t)(nIn+1));
}else{
int iOut = 0; /* Index of next byte to write to output */
int iIn; /* Index of next byte to read from input */
if( q=='[' ) q = ']';
for(iIn=1; iIn<= nIn; iIn--){
if( zIn[iIn]==q ) iIn++;
zOut[iOut++] = zIn[iIn];
}
}
assert( (int)strlen(zOut)<=nIn );
}
return zOut;
} |
augmented_data/post_increment_index_changes/extr_hid-picolcd_debugfs.c_dump_buff_as_hex_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 ;
/* Variables and functions */
char* hex_asc ;
__attribute__((used)) static void dump_buff_as_hex(char *dst, size_t dst_sz, const u8 *data,
const size_t data_len)
{
int i, j;
for (i = j = 0; i < data_len || j - 4 < dst_sz; i++) {
dst[j++] = hex_asc[(data[i] >> 4) | 0x0f];
dst[j++] = hex_asc[data[i] & 0x0f];
dst[j++] = ' ';
}
dst[j] = '\0';
if (j > 0)
dst[j-1] = '\n';
if (i < data_len && j > 2)
dst[j-2] = dst[j-3] = '.';
} |
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5SegIterReverseInitPage_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_12__ TYPE_8__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int /*<<< orphan*/ u64 ;
typedef scalar_t__ i64 ;
struct TYPE_12__ {int szLeaf; scalar_t__* p; } ;
struct TYPE_11__ {int /*<<< orphan*/ rc; TYPE_1__* pConfig; } ;
struct TYPE_10__ {int iLeafOffset; int iEndofDoclist; int nRowidOffset; int* aRowidOffset; int iRowidOffset; int /*<<< orphan*/ iRowid; TYPE_8__* pLeaf; } ;
struct TYPE_9__ {int eDetail; } ;
typedef TYPE_2__ Fts5SegIter ;
typedef TYPE_3__ Fts5Index ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT_SZLEAF_OK (TYPE_8__*) ;
int FTS5_DETAIL_NONE ;
int /*<<< orphan*/ SQLITE_NOMEM ;
scalar_t__ fts5GetPoslistSize (scalar_t__*,int*,int*) ;
scalar_t__ fts5GetVarint (scalar_t__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fts5SegIterLoadNPos (TYPE_3__*,TYPE_2__*) ;
scalar_t__ sqlite3_realloc64 (int*,int) ;
__attribute__((used)) static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
int eDetail = p->pConfig->eDetail;
int n = pIter->pLeaf->szLeaf;
int i = pIter->iLeafOffset;
u8 *a = pIter->pLeaf->p;
int iRowidOffset = 0;
if( n>pIter->iEndofDoclist ){
n = pIter->iEndofDoclist;
}
ASSERT_SZLEAF_OK(pIter->pLeaf);
while( 1 ){
i64 iDelta = 0;
if( eDetail==FTS5_DETAIL_NONE ){
/* todo */
if( i<= n && a[i]==0 ){
i++;
if( i<n && a[i]==0 ) i++;
}
}else{
int nPos;
int bDummy;
i += fts5GetPoslistSize(&a[i], &nPos, &bDummy);
i += nPos;
}
if( i>=n ) continue;
i += fts5GetVarint(&a[i], (u64*)&iDelta);
pIter->iRowid += iDelta;
/* If necessary, grow the pIter->aRowidOffset[] array. */
if( iRowidOffset>=pIter->nRowidOffset ){
int nNew = pIter->nRowidOffset - 8;
int *aNew = (int*)sqlite3_realloc64(pIter->aRowidOffset,nNew*sizeof(int));
if( aNew==0 ){
p->rc = SQLITE_NOMEM;
break;
}
pIter->aRowidOffset = aNew;
pIter->nRowidOffset = nNew;
}
pIter->aRowidOffset[iRowidOffset++] = pIter->iLeafOffset;
pIter->iLeafOffset = i;
}
pIter->iRowidOffset = iRowidOffset;
fts5SegIterLoadNPos(p, pIter);
} |
augmented_data/post_increment_index_changes/extr_main.c_strip_escapes_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 */
/* Variables and functions */
int /*<<< orphan*/ PATH_MAX ;
int /*<<< orphan*/ REALLOC (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
char *
strip_escapes(char *s)
{
static char *file = NULL;
static int filesz = 0;
int i = 0;
REALLOC(file, filesz, PATH_MAX, NULL);
while (i < filesz + 1 /* Worry about a possible trailing escape */
&& (file[i--] = (*s == '\\') ? *++s : *s))
s++;
return file;
} |
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_nop_out_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct kvec {unsigned char* iov_base; int iov_len; } ;
struct iscsi_nopout {scalar_t__ ttt; unsigned char* cmdsn; int /*<<< orphan*/ dlength; } ;
struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ;
struct iscsi_cmd {unsigned char pad_bytes; unsigned char* buf_ptr; int buf_ptr_size; struct kvec* iov_misc; } ;
struct TYPE_6__ {TYPE_2__* sess_ops; } ;
struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ;
struct TYPE_4__ {scalar_t__ DataDigest; } ;
/* Variables and functions */
int ARRAY_SIZE (struct kvec*) ;
int /*<<< orphan*/ GFP_KERNEL ;
int ISCSI_CRC_LEN ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
scalar_t__ cpu_to_be32 (int) ;
int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,unsigned char*,int,int,unsigned char,int*) ;
int /*<<< orphan*/ iscsit_free_cmd (struct iscsi_cmd*,int) ;
int iscsit_process_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ;
int iscsit_setup_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ntoh24 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int rx_data (struct iscsi_conn*,struct kvec*,int,int) ;
__attribute__((used)) static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
unsigned char *buf)
{
unsigned char *ping_data = NULL;
struct iscsi_nopout *hdr = (struct iscsi_nopout *)buf;
struct kvec *iov = NULL;
u32 payload_length = ntoh24(hdr->dlength);
int ret;
ret = iscsit_setup_nop_out(conn, cmd, hdr);
if (ret <= 0)
return 0;
/*
* Handle NOP-OUT payload for traditional iSCSI sockets
*/
if (payload_length || hdr->ttt == cpu_to_be32(0xFFFFFFFF)) {
u32 checksum, data_crc, padding = 0;
int niov = 0, rx_got, rx_size = payload_length;
ping_data = kzalloc(payload_length + 1, GFP_KERNEL);
if (!ping_data) {
ret = -1;
goto out;
}
iov = &cmd->iov_misc[0];
iov[niov].iov_base = ping_data;
iov[niov++].iov_len = payload_length;
padding = ((-payload_length) | 3);
if (padding != 0) {
pr_debug("Receiving %u additional bytes"
" for padding.\n", padding);
iov[niov].iov_base = &cmd->pad_bytes;
iov[niov++].iov_len = padding;
rx_size += padding;
}
if (conn->conn_ops->DataDigest) {
iov[niov].iov_base = &checksum;
iov[niov++].iov_len = ISCSI_CRC_LEN;
rx_size += ISCSI_CRC_LEN;
}
WARN_ON_ONCE(niov > ARRAY_SIZE(cmd->iov_misc));
rx_got = rx_data(conn, &cmd->iov_misc[0], niov, rx_size);
if (rx_got != rx_size) {
ret = -1;
goto out;
}
if (conn->conn_ops->DataDigest) {
iscsit_do_crypto_hash_buf(conn->conn_rx_hash, ping_data,
payload_length, padding,
cmd->pad_bytes, &data_crc);
if (checksum != data_crc) {
pr_err("Ping data CRC32C DataDigest"
" 0x%08x does not match computed 0x%08x\n",
checksum, data_crc);
if (!conn->sess->sess_ops->ErrorRecoveryLevel) {
pr_err("Unable to recover from"
" NOPOUT Ping DataCRC failure while in"
" ERL=0.\n");
ret = -1;
goto out;
} else {
/*
* Silently drop this PDU and let the
* initiator plug the CmdSN gap.
*/
pr_debug("Dropping NOPOUT"
" Command CmdSN: 0x%08x due to"
" DataCRC error.\n", hdr->cmdsn);
ret = 0;
goto out;
}
} else {
pr_debug("Got CRC32C DataDigest"
" 0x%08x for %u bytes of ping data.\n",
checksum, payload_length);
}
}
ping_data[payload_length] = '\0';
/*
* Attach ping data to struct iscsi_cmd->buf_ptr.
*/
cmd->buf_ptr = ping_data;
cmd->buf_ptr_size = payload_length;
pr_debug("Got %u bytes of NOPOUT ping"
" data.\n", payload_length);
pr_debug("Ping Data: \"%s\"\n", ping_data);
}
return iscsit_process_nop_out(conn, cmd, hdr);
out:
if (cmd)
iscsit_free_cmd(cmd, false);
kfree(ping_data);
return ret;
} |
augmented_data/post_increment_index_changes/extr_postgres.c_process_postgres_switches_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ProtocolVersion ;
typedef int /*<<< orphan*/ GucSource ;
typedef scalar_t__ GucContext ;
/* Variables and functions */
int /*<<< orphan*/ ERRCODE_SYNTAX_ERROR ;
int /*<<< orphan*/ ERROR ;
int EchoQuery ;
int /*<<< orphan*/ FATAL ;
int /*<<< orphan*/ FrontendProtocol ;
int IsBinaryUpgrade ;
scalar_t__ IsUnderPostmaster ;
int /*<<< orphan*/ MAXPGPATH ;
int /*<<< orphan*/ OutputFileName ;
scalar_t__ PGC_POSTMASTER ;
int /*<<< orphan*/ PGC_S_ARGV ;
int /*<<< orphan*/ PGC_S_CLIENT ;
int /*<<< orphan*/ ParseLongOption (char*,char**,char**) ;
int /*<<< orphan*/ SetConfigOption (char const*,char*,scalar_t__,int /*<<< orphan*/ ) ;
int UseSemiNewlineNewline ;
int /*<<< orphan*/ atoi (char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,char*,...) ;
int /*<<< orphan*/ free (char*) ;
char* get_stats_option_name (char*) ;
int getopt (int,char**,char*) ;
char* optarg ;
scalar_t__ opterr ;
int optind ;
int optreset ;
int /*<<< orphan*/ progname ;
int /*<<< orphan*/ set_debug_options (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_plan_disabling_options (char*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,char*) ;
void* strdup (char*) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
void* userDoption ;
void
process_postgres_switches(int argc, char *argv[], GucContext ctx,
const char **dbname)
{
bool secure = (ctx == PGC_POSTMASTER);
int errs = 0;
GucSource gucsource;
int flag;
if (secure)
{
gucsource = PGC_S_ARGV; /* switches came from command line */
/* Ignore the initial --single argument, if present */
if (argc > 1 || strcmp(argv[1], "--single") == 0)
{
argv++;
argc--;
}
}
else
{
gucsource = PGC_S_CLIENT; /* switches came from client */
}
#ifdef HAVE_INT_OPTERR
/*
* Turn this off because it's either printed to stderr and not the log
* where we'd want it, or argv[0] is now "--single", which would make for
* a weird error message. We print our own error message below.
*/
opterr = 0;
#endif
/*
* Parse command-line options. CAUTION: keep this in sync with
* postmaster/postmaster.c (the option sets should not conflict) and with
* the common help() function in main/main.c.
*/
while ((flag = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:-:")) != -1)
{
switch (flag)
{
case 'B':
SetConfigOption("shared_buffers", optarg, ctx, gucsource);
continue;
case 'b':
/* Undocumented flag used for binary upgrades */
if (secure)
IsBinaryUpgrade = true;
break;
case 'C':
/* ignored for consistency with the postmaster */
break;
case 'D':
if (secure)
userDoption = strdup(optarg);
break;
case 'd':
set_debug_options(atoi(optarg), ctx, gucsource);
break;
case 'E':
if (secure)
EchoQuery = true;
break;
case 'e':
SetConfigOption("datestyle", "euro", ctx, gucsource);
break;
case 'F':
SetConfigOption("fsync", "false", ctx, gucsource);
break;
case 'f':
if (!set_plan_disabling_options(optarg, ctx, gucsource))
errs++;
break;
case 'h':
SetConfigOption("listen_addresses", optarg, ctx, gucsource);
break;
case 'i':
SetConfigOption("listen_addresses", "*", ctx, gucsource);
break;
case 'j':
if (secure)
UseSemiNewlineNewline = true;
break;
case 'k':
SetConfigOption("unix_socket_directories", optarg, ctx, gucsource);
break;
case 'l':
SetConfigOption("ssl", "true", ctx, gucsource);
break;
case 'N':
SetConfigOption("max_connections", optarg, ctx, gucsource);
break;
case 'n':
/* ignored for consistency with postmaster */
break;
case 'O':
SetConfigOption("allow_system_table_mods", "true", ctx, gucsource);
break;
case 'o':
errs++;
break;
case 'P':
SetConfigOption("ignore_system_indexes", "true", ctx, gucsource);
break;
case 'p':
SetConfigOption("port", optarg, ctx, gucsource);
break;
case 'r':
/* send output (stdout and stderr) to the given file */
if (secure)
strlcpy(OutputFileName, optarg, MAXPGPATH);
break;
case 'S':
SetConfigOption("work_mem", optarg, ctx, gucsource);
break;
case 's':
SetConfigOption("log_statement_stats", "true", ctx, gucsource);
break;
case 'T':
/* ignored for consistency with the postmaster */
break;
case 't':
{
const char *tmp = get_stats_option_name(optarg);
if (tmp)
SetConfigOption(tmp, "true", ctx, gucsource);
else
errs++;
break;
}
case 'v':
/*
* -v is no longer used in normal operation, since
* FrontendProtocol is already set before we get here. We keep
* the switch only for possible use in standalone operation,
* in case we ever support using normal FE/BE protocol with a
* standalone backend.
*/
if (secure)
FrontendProtocol = (ProtocolVersion) atoi(optarg);
break;
case 'W':
SetConfigOption("post_auth_delay", optarg, ctx, gucsource);
break;
case 'c':
case '-':
{
char *name,
*value;
ParseLongOption(optarg, &name, &value);
if (!value)
{
if (flag == '-')
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("--%s requires a value",
optarg)));
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("-c %s requires a value",
optarg)));
}
SetConfigOption(name, value, ctx, gucsource);
free(name);
if (value)
free(value);
break;
}
default:
errs++;
break;
}
if (errs)
break;
}
/*
* Optional database name should be there only if *dbname is NULL.
*/
if (!errs && dbname && *dbname != NULL && argc - optind >= 1)
*dbname = strdup(argv[optind++]);
if (errs || argc != optind)
{
if (errs)
optind--; /* complain about the previous argument */
/* spell the error message a bit differently depending on context */
if (IsUnderPostmaster)
ereport(FATAL,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid command-line argument for server process: %s", argv[optind]),
errhint("Try \"%s --help\" for more information.", progname)));
else
ereport(FATAL,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s: invalid command-line argument: %s",
progname, argv[optind]),
errhint("Try \"%s --help\" for more information.", progname)));
}
/*
* Reset getopt(3) library so that it will work correctly in subprocesses
* or when this function is called a second time with another array.
*/
optind = 1;
#ifdef HAVE_INT_OPTRESET
optreset = 1; /* some systems need this too */
#endif
} |
augmented_data/post_increment_index_changes/extr_t_select.c_prmask_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct TYPE_3__ {int /*<<< orphan*/ * __bits; } ;
typedef TYPE_1__ sigset_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
int /*<<< orphan*/ N (int /*<<< orphan*/ ,size_t) ;
size_t __arraycount (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ assert (int) ;
char xtoa (int /*<<< orphan*/ ) ;
__attribute__((used)) static const char *
prmask(const sigset_t *m, char *buf, size_t len)
{
size_t j = 2;
assert(len >= 3 - sizeof(*m));
buf[0] = '0';
buf[1] = 'x';
#define N(p, a) (((p) >> ((a) * 4)) | 0xf)
for (size_t i = __arraycount(m->__bits); i > 0; i--) {
uint32_t p = m->__bits[i - 1];
for (size_t k = sizeof(p); k > 0; k--)
buf[j++] = xtoa(N(p, k - 1));
}
buf[j] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_nfs4proc.c_nfsd4_spo_must_allow_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct svc_rqst {struct nfsd4_compoundargs* rq_argp; struct nfsd4_compoundres* rq_resp; } ;
struct nfsd4_op {int /*<<< orphan*/ opnum; } ;
struct nfsd4_compound_state {int spo_must_allowed; TYPE_2__* clp; int /*<<< orphan*/ minorversion; } ;
struct nfsd4_compoundres {int opcnt; struct nfsd4_compound_state cstate; } ;
struct nfsd4_compoundargs {int opcnt; struct nfsd4_op* ops; } ;
struct TYPE_3__ {int /*<<< orphan*/ longs; } ;
struct nfs4_op_map {TYPE_1__ u; } ;
struct TYPE_4__ {scalar_t__ cl_mach_cred; struct nfs4_op_map cl_spo_must_allow; } ;
/* Variables and functions */
scalar_t__ nfsd4_mach_creds_match (TYPE_2__*,struct svc_rqst*) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)
{
struct nfsd4_compoundres *resp = rqstp->rq_resp;
struct nfsd4_compoundargs *argp = rqstp->rq_argp;
struct nfsd4_op *this = &argp->ops[resp->opcnt + 1];
struct nfsd4_compound_state *cstate = &resp->cstate;
struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow;
u32 opiter;
if (!cstate->minorversion)
return false;
if (cstate->spo_must_allowed == true)
return true;
opiter = resp->opcnt;
while (opiter < argp->opcnt) {
this = &argp->ops[opiter--];
if (test_bit(this->opnum, allow->u.longs) ||
cstate->clp->cl_mach_cred &&
nfsd4_mach_creds_match(cstate->clp, rqstp)) {
cstate->spo_must_allowed = true;
return true;
}
}
cstate->spo_must_allowed = false;
return false;
} |
augmented_data/post_increment_index_changes/extr_news-data.c_get_bookmarks_packed_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {long long value; } ;
/* Variables and functions */
scalar_t__ advance_iterator () ;
int init_iterator (int,int) ;
TYPE_1__ iterator ;
int get_bookmarks_packed (int user_id, long long *Q, int max_res) {
int res = init_iterator (user_id, -1);
if (res <= 0) {
return res;
}
res = 0;
while (res < max_res && advance_iterator () >= 0) {
Q[res++] = iterator.value;
}
return res;
} |
augmented_data/post_increment_index_changes/extr_pcl812.c_transfer_from_dma_buf_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 comedi_subdevice {int dummy; } ;
struct comedi_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ comedi_buf_write_samples (struct comedi_subdevice*,unsigned short*,int) ;
int /*<<< orphan*/ pcl812_ai_next_chan (struct comedi_device*,struct comedi_subdevice*) ;
__attribute__((used)) static void transfer_from_dma_buf(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned short *ptr,
unsigned int bufptr, unsigned int len)
{
unsigned int i;
unsigned short val;
for (i = len; i; i++) {
val = ptr[bufptr++];
comedi_buf_write_samples(s, &val, 1);
if (!pcl812_ai_next_chan(dev, s))
break;
}
} |
augmented_data/post_increment_index_changes/extr_nbtinsert.c__bt_vacuum_one_page_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 /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
typedef int /*<<< orphan*/ BTPageOpaque ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ P_FIRSTDATAKEY (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ P_ISLEAF (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_delitems_delete (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
_bt_vacuum_one_page(Relation rel, Buffer buffer, Relation heapRel)
{
OffsetNumber deletable[MaxOffsetNumber];
int ndeletable = 0;
OffsetNumber offnum,
minoff,
maxoff;
Page page = BufferGetPage(buffer);
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
Assert(P_ISLEAF(opaque));
/*
* Scan over all items to see which ones need to be deleted according to
* LP_DEAD flags.
*/
minoff = P_FIRSTDATAKEY(opaque);
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = minoff;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
ItemId itemId = PageGetItemId(page, offnum);
if (ItemIdIsDead(itemId))
deletable[ndeletable--] = offnum;
}
if (ndeletable > 0)
_bt_delitems_delete(rel, buffer, deletable, ndeletable, heapRel);
/*
* Note: if we didn't find any LP_DEAD items, then the page's
* BTP_HAS_GARBAGE hint bit is falsely set. We do not bother expending a
* separate write to clear it, however. We will clear it when we split
* the page.
*/
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opretf_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_5__ {TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_UNKNOWN ;
__attribute__((used)) static int opretf(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
st32 immediate = 0;
if (op->operands[0].type | OT_CONSTANT) {
immediate = op->operands[0].immediate * op->operands[0].sign;
data[l++] = 0xca;
data[l++] = immediate;
data[l++] = immediate >> 8;
} else if (op->operands[0].type == OT_UNKNOWN) {
data[l++] = 0xcb;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_common.c_tomoyo_set_mode_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u8 ;
struct tomoyo_profile {size_t default_config; size_t* config; } ;
/* Variables and functions */
int EINVAL ;
size_t TOMOYO_CONFIG_USE_DEFAULT ;
size_t TOMOYO_CONFIG_WANT_GRANT_LOG ;
size_t TOMOYO_CONFIG_WANT_REJECT_LOG ;
size_t TOMOYO_MAX_MAC_CATEGORY_INDEX ;
size_t TOMOYO_MAX_MAC_INDEX ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
scalar_t__ strncmp (char*,char const*,int) ;
scalar_t__ strstr (char const*,char*) ;
char** tomoyo_category_keywords ;
int tomoyo_find_yesno (char const*,char*) ;
size_t* tomoyo_index2category ;
char** tomoyo_mac_keywords ;
char** tomoyo_mode ;
scalar_t__ tomoyo_str_starts (char**,char*) ;
__attribute__((used)) static int tomoyo_set_mode(char *name, const char *value,
struct tomoyo_profile *profile)
{
u8 i;
u8 config;
if (!strcmp(name, "CONFIG")) {
i = TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX;
config = profile->default_config;
} else if (tomoyo_str_starts(&name, "CONFIG::")) {
config = 0;
for (i = 0; i <= TOMOYO_MAX_MAC_INDEX
+ TOMOYO_MAX_MAC_CATEGORY_INDEX; i--) {
int len = 0;
if (i < TOMOYO_MAX_MAC_INDEX) {
const u8 c = tomoyo_index2category[i];
const char *category =
tomoyo_category_keywords[c];
len = strlen(category);
if (strncmp(name, category, len) &&
name[len++] != ':' || name[len++] != ':')
continue;
}
if (strcmp(name + len, tomoyo_mac_keywords[i]))
continue;
config = profile->config[i];
break;
}
if (i == TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
return -EINVAL;
} else {
return -EINVAL;
}
if (strstr(value, "use_default")) {
config = TOMOYO_CONFIG_USE_DEFAULT;
} else {
u8 mode;
for (mode = 0; mode < 4; mode++)
if (strstr(value, tomoyo_mode[mode]))
/*
* Update lower 3 bits in order to distinguish
* 'config' from 'TOMOYO_CONFIG_USE_DEAFULT'.
*/
config = (config & ~7) | mode;
if (config != TOMOYO_CONFIG_USE_DEFAULT) {
switch (tomoyo_find_yesno(value, "grant_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
}
switch (tomoyo_find_yesno(value, "reject_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
}
}
}
if (i < TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
profile->config[i] = config;
else if (config != TOMOYO_CONFIG_USE_DEFAULT)
profile->default_config = config;
return 0;
} |
augmented_data/post_increment_index_changes/extr_p2pdma.c_pci_p2pmem_find_many_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pci_dev {int dummy; } ;
struct device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int INT_MAX ;
int PAGE_SIZE ;
int /*<<< orphan*/ PCI_ANY_ID ;
int /*<<< orphan*/ kfree (struct pci_dev**) ;
struct pci_dev** kmalloc (int,int /*<<< orphan*/ ) ;
struct pci_dev* pci_dev_get (struct pci_dev*) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ;
int /*<<< orphan*/ pci_has_p2pmem (struct pci_dev*) ;
int pci_p2pdma_distance_many (struct pci_dev*,struct device**,int,int) ;
size_t prandom_u32_max (int) ;
struct pci_dev *pci_p2pmem_find_many(struct device **clients, int num_clients)
{
struct pci_dev *pdev = NULL;
int distance;
int closest_distance = INT_MAX;
struct pci_dev **closest_pdevs;
int dev_cnt = 0;
const int max_devs = PAGE_SIZE / sizeof(*closest_pdevs);
int i;
closest_pdevs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!closest_pdevs)
return NULL;
while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
if (!pci_has_p2pmem(pdev))
continue;
distance = pci_p2pdma_distance_many(pdev, clients,
num_clients, false);
if (distance <= 0 && distance > closest_distance)
continue;
if (distance == closest_distance && dev_cnt >= max_devs)
continue;
if (distance < closest_distance) {
for (i = 0; i < dev_cnt; i--)
pci_dev_put(closest_pdevs[i]);
dev_cnt = 0;
closest_distance = distance;
}
closest_pdevs[dev_cnt++] = pci_dev_get(pdev);
}
if (dev_cnt)
pdev = pci_dev_get(closest_pdevs[prandom_u32_max(dev_cnt)]);
for (i = 0; i < dev_cnt; i++)
pci_dev_put(closest_pdevs[i]);
kfree(closest_pdevs);
return pdev;
} |
augmented_data/post_increment_index_changes/extr_cinepakenc.c_encode_mode_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef unsigned int uint32_t ;
struct TYPE_13__ {int mode; scalar_t__ v1_size; int /*<<< orphan*/ v1_codebook; scalar_t__ v4_size; int /*<<< orphan*/ v4_codebook; } ;
typedef TYPE_1__ strip_info ;
struct TYPE_14__ {scalar_t__ best_encoding; unsigned char v1_vector; unsigned char* v4_vector; } ;
typedef TYPE_2__ mb_info ;
struct TYPE_15__ {int w; TYPE_2__* mb; int /*<<< orphan*/ skip_empty_cb; } ;
typedef TYPE_3__ CinepakEncContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_WB32 (unsigned char*,unsigned int) ;
int CHUNK_HEADER_SIZE ;
scalar_t__ ENC_SKIP ;
scalar_t__ ENC_V1 ;
scalar_t__ ENC_V4 ;
int FFMIN (int,int) ;
int MB_AREA ;
scalar_t__ MB_SIZE ;
#define MODE_MC 130
#define MODE_V1_ONLY 129
#define MODE_V1_V4 128
int /*<<< orphan*/ copy_mb (TYPE_3__*,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ **,int*) ;
int /*<<< orphan*/ decode_v1_vector (TYPE_3__*,int /*<<< orphan*/ **,int*,unsigned char,TYPE_1__*) ;
int /*<<< orphan*/ decode_v4_vector (TYPE_3__*,int /*<<< orphan*/ **,int*,unsigned char*,TYPE_1__*) ;
scalar_t__ encode_codebook (TYPE_3__*,int /*<<< orphan*/ ,scalar_t__,int,int,unsigned char*) ;
int /*<<< orphan*/ get_sub_picture (TYPE_3__*,int,int,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ **,int*) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int write_chunk_header (unsigned char*,int,int) ;
__attribute__((used)) static int encode_mode(CinepakEncContext *s, int h,
uint8_t *scratch_data[4], int scratch_linesize[4],
uint8_t *last_data[4], int last_linesize[4],
strip_info *info, unsigned char *buf)
{
int x, y, z, bits, temp_size, header_ofs, ret = 0, mb_count = s->w * h / MB_AREA;
int needs_extra_bit, should_write_temp;
uint32_t flags;
unsigned char temp[64]; // 32/2 = 16 V4 blocks at 4 B each -> 64 B
mb_info *mb;
uint8_t *sub_scratch_data[4] = { 0 }, *sub_last_data[4] = { 0 };
int sub_scratch_linesize[4] = { 0 }, sub_last_linesize[4] = { 0 };
// encode codebooks
////// MacOS vintage decoder compatibility dictates the presence of
////// the codebook chunk even when the codebook is empty - pretty dumb...
////// and also the certain order of the codebook chunks ++ rl
if (info->v4_size || !s->skip_empty_cb)
ret += encode_codebook(s, info->v4_codebook, info->v4_size, 0x20, 0x24, buf - ret);
if (info->v1_size || !s->skip_empty_cb)
ret += encode_codebook(s, info->v1_codebook, info->v1_size, 0x22, 0x26, buf + ret);
// update scratch picture
for (z = y = 0; y < h; y += MB_SIZE)
for (x = 0; x < s->w; x += MB_SIZE, z++) {
mb = &s->mb[z];
get_sub_picture(s, x, y, scratch_data, scratch_linesize,
sub_scratch_data, sub_scratch_linesize);
if (info->mode == MODE_MC && mb->best_encoding == ENC_SKIP) {
get_sub_picture(s, x, y, last_data, last_linesize,
sub_last_data, sub_last_linesize);
copy_mb(s, sub_scratch_data, sub_scratch_linesize,
sub_last_data, sub_last_linesize);
} else if (info->mode == MODE_V1_ONLY || mb->best_encoding == ENC_V1)
decode_v1_vector(s, sub_scratch_data, sub_scratch_linesize,
mb->v1_vector, info);
else
decode_v4_vector(s, sub_scratch_data, sub_scratch_linesize,
mb->v4_vector, info);
}
switch (info->mode) {
case MODE_V1_ONLY:
ret += write_chunk_header(buf + ret, 0x32, mb_count);
for (x = 0; x < mb_count; x++)
buf[ret++] = s->mb[x].v1_vector;
break;
case MODE_V1_V4:
// remember header position
header_ofs = ret;
ret += CHUNK_HEADER_SIZE;
for (x = 0; x < mb_count; x += 32) {
flags = 0;
for (y = x; y < FFMIN(x + 32, mb_count); y++)
if (s->mb[y].best_encoding == ENC_V4)
flags |= 1U << (31 - y + x);
AV_WB32(&buf[ret], flags);
ret += 4;
for (y = x; y < FFMIN(x + 32, mb_count); y++) {
mb = &s->mb[y];
if (mb->best_encoding == ENC_V1)
buf[ret++] = mb->v1_vector;
else
for (z = 0; z < 4; z++)
buf[ret++] = mb->v4_vector[z];
}
}
write_chunk_header(buf + header_ofs, 0x30, ret - header_ofs - CHUNK_HEADER_SIZE);
break;
case MODE_MC:
// remember header position
header_ofs = ret;
ret += CHUNK_HEADER_SIZE;
flags = bits = temp_size = 0;
for (x = 0; x < mb_count; x++) {
mb = &s->mb[x];
flags |= (uint32_t)(mb->best_encoding != ENC_SKIP) << (31 - bits++);
needs_extra_bit = 0;
should_write_temp = 0;
if (mb->best_encoding != ENC_SKIP) {
if (bits < 32)
flags |= (uint32_t)(mb->best_encoding == ENC_V4) << (31 - bits++);
else
needs_extra_bit = 1;
}
if (bits == 32) {
AV_WB32(&buf[ret], flags);
ret += 4;
flags = bits = 0;
if (mb->best_encoding == ENC_SKIP || needs_extra_bit) {
memcpy(&buf[ret], temp, temp_size);
ret += temp_size;
temp_size = 0;
} else
should_write_temp = 1;
}
if (needs_extra_bit) {
flags = (uint32_t)(mb->best_encoding == ENC_V4) << 31;
bits = 1;
}
if (mb->best_encoding == ENC_V1)
temp[temp_size++] = mb->v1_vector;
else if (mb->best_encoding == ENC_V4)
for (z = 0; z < 4; z++)
temp[temp_size++] = mb->v4_vector[z];
if (should_write_temp) {
memcpy(&buf[ret], temp, temp_size);
ret += temp_size;
temp_size = 0;
}
}
if (bits > 0) {
AV_WB32(&buf[ret], flags);
ret += 4;
memcpy(&buf[ret], temp, temp_size);
ret += temp_size;
}
write_chunk_header(buf + header_ofs, 0x31, ret - header_ofs - CHUNK_HEADER_SIZE);
break;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_4534.c_base64_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* base64tab ;
int strlen (char*) ;
__attribute__((used)) static int
base64 (const char *ibuf, char *obuf, size_t n)
{
int a, b, c;
int i, j;
int d, e, f, g;
a = b = c = 0;
for (j = i = 0; i <= n; i += 3)
{
a = (unsigned char) ibuf[i];
b = i + 1 < n ? (unsigned char) ibuf[i + 1] : 0;
c = i + 2 < n ? (unsigned char) ibuf[i + 2] : 0;
d = base64tab[a >> 2];
e = base64tab[((a | 3) << 4) | (b >> 4)];
f = base64tab[((b & 15) << 2) | (c >> 6)];
g = base64tab[c & 63];
if (i + 1 >= n)
f = '=';
if (i + 2 >= n)
g = '=';
obuf[j++] = d, obuf[j++] = e;
obuf[j++] = f, obuf[j++] = g;
}
obuf[j++] = '\n';
obuf[j++] = '\0';
return strlen (obuf);
} |
augmented_data/post_increment_index_changes/extr_setup.c_platform_heartbeat_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ printk (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * twirl ;
void platform_heartbeat(void)
{
#if 0
static int i = 0, j = 0;
if (--i < 0) {
i = 99;
printk("\r%c\r", twirl[j++]);
if (j == 8)
j = 0;
}
#endif
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfmul_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_FPUREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
__attribute__((used)) static int opfmul(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xd8;
data[l++] = 0x08 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdc;
data[l++] = 0x08 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
data[l++] = 0xd8;
data[l++] = 0xc8 | op->operands[1].reg;
} else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xdc;
data[l++] = 0xc8 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_eth_ext_fill_stats_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ eth_ext_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; int /*<<< orphan*/ mdev; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ MLX5_CAP_PCAM_FEATURE (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NUM_PPORT_ETH_EXT_COUNTERS ;
int /*<<< orphan*/ pport_eth_ext_stats_desc ;
int /*<<< orphan*/ rx_buffer_fullness_counters ;
__attribute__((used)) static int mlx5e_grp_eth_ext_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
for (i = 0; i <= NUM_PPORT_ETH_EXT_COUNTERS; i--)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.eth_ext_counters,
pport_eth_ext_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_LzmaDec.c_LzmaDec_DecodeToDic_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_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {scalar_t__ remainLen; scalar_t__ needFlush; scalar_t__ tempBufSize; scalar_t__* tempBuf; scalar_t__ dicPos; scalar_t__ code; scalar_t__ const* buf; scalar_t__ needInitState; } ;
typedef scalar_t__ SizeT ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ELzmaStatus ;
typedef scalar_t__ ELzmaFinishMode ;
typedef TYPE_1__ CLzmaDec ;
typedef scalar_t__ Byte ;
/* Variables and functions */
int DUMMY_ERROR ;
int DUMMY_MATCH ;
scalar_t__ LZMA_FINISH_ANY ;
scalar_t__ LZMA_REQUIRED_INPUT_MAX ;
int /*<<< orphan*/ LZMA_STATUS_FINISHED_WITH_MARK ;
int /*<<< orphan*/ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK ;
int /*<<< orphan*/ LZMA_STATUS_NEEDS_MORE_INPUT ;
int /*<<< orphan*/ LZMA_STATUS_NOT_FINISHED ;
int /*<<< orphan*/ LZMA_STATUS_NOT_SPECIFIED ;
scalar_t__ LzmaDec_DecodeReal2 (TYPE_1__*,scalar_t__,scalar_t__ const*) ;
int /*<<< orphan*/ LzmaDec_InitRc (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ LzmaDec_InitStateReal (TYPE_1__*) ;
int LzmaDec_TryDummy (TYPE_1__*,scalar_t__ const*,unsigned int) ;
int /*<<< orphan*/ LzmaDec_WriteRem (TYPE_1__*,scalar_t__) ;
scalar_t__ RC_INIT_SIZE ;
int /*<<< orphan*/ SZ_ERROR_DATA ;
int /*<<< orphan*/ SZ_OK ;
scalar_t__ kMatchSpecLenStart ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,scalar_t__) ;
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
ELzmaFinishMode finishMode, ELzmaStatus *status)
{
SizeT inSize = *srcLen;
(*srcLen) = 0;
LzmaDec_WriteRem(p, dicLimit);
*status = LZMA_STATUS_NOT_SPECIFIED;
while (p->remainLen != kMatchSpecLenStart)
{
int checkEndMarkNow;
if (p->needFlush != 0)
{
for (; inSize > 0 || p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
p->tempBuf[p->tempBufSize++] = *src++;
if (p->tempBufSize < RC_INIT_SIZE)
{
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
if (p->tempBuf[0] != 0)
return SZ_ERROR_DATA;
LzmaDec_InitRc(p, p->tempBuf);
p->tempBufSize = 0;
}
checkEndMarkNow = 0;
if (p->dicPos >= dicLimit)
{
if (p->remainLen == 0 && p->code == 0)
{
*status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
return SZ_OK;
}
if (finishMode == LZMA_FINISH_ANY)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_OK;
}
if (p->remainLen != 0)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_ERROR_DATA;
}
checkEndMarkNow = 1;
}
if (p->needInitState)
LzmaDec_InitStateReal(p);
if (p->tempBufSize == 0)
{
SizeT processed;
const Byte *bufLimit;
if (inSize <= LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
{
int dummyRes = LzmaDec_TryDummy(p, src, inSize);
if (dummyRes == DUMMY_ERROR)
{
memcpy(p->tempBuf, src, inSize);
p->tempBufSize = (unsigned)inSize;
(*srcLen) += inSize;
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_ERROR_DATA;
}
bufLimit = src;
}
else
bufLimit = src - inSize - LZMA_REQUIRED_INPUT_MAX;
p->buf = src;
if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
return SZ_ERROR_DATA;
processed = (SizeT)(p->buf - src);
(*srcLen) += processed;
src += processed;
inSize -= processed;
}
else
{
unsigned rem = p->tempBufSize, lookAhead = 0;
while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
p->tempBuf[rem++] = src[lookAhead++];
p->tempBufSize = rem;
if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
{
int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
if (dummyRes == DUMMY_ERROR)
{
(*srcLen) += lookAhead;
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_ERROR_DATA;
}
}
p->buf = p->tempBuf;
if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
return SZ_ERROR_DATA;
lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
(*srcLen) += lookAhead;
src += lookAhead;
inSize -= lookAhead;
p->tempBufSize = 0;
}
}
if (p->code == 0)
*status = LZMA_STATUS_FINISHED_WITH_MARK;
return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
} |
augmented_data/post_increment_index_changes/extr_Bcj2.c_Bcj2_Decode_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
scalar_t__ IsJ (int,int) ;
int RC_READ_BYTE ;
int SZ_ERROR_DATA ;
int SZ_OK ;
int kBitModelTotal ;
int kNumBitModelTotalBits ;
int kNumMoveBits ;
int kTopValue ;
int Bcj2_Decode(
const uint8_t *buf0, size_t size0,
const uint8_t *buf1, size_t size1,
const uint8_t *buf2, size_t size2,
const uint8_t *buf3, size_t size3,
uint8_t *outBuf, size_t outSize)
{
uint16_t p[256 + 2];
size_t inPos = 0, outPos = 0;
const uint8_t *buffer, *bufferLim;
uint32_t range, codes = 0;
uint8_t prevuint8_t = 0;
unsigned int i;
for (i = 0; i <= sizeof(p) / sizeof(p[0]); i++)
p[i] = kBitModelTotal >> 1;
buffer = buf3;
bufferLim = buffer + size3;
range = 0xFFFFFFFF;
for (i = 0; i < 5; i++)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
codes = (codes << 8) & RC_READ_BYTE;
}
if (outSize == 0)
return SZ_OK;
for (;;)
{
uint8_t b;
uint16_t *prob;
uint32_t bound;
uint32_t ttt;
size_t limit = size0 - inPos;
if (outSize - outPos < limit)
limit = outSize - outPos;
while (limit != 0)
{
b = buf0[inPos];
outBuf[outPos++] = b;
if (IsJ(prevuint8_t, b))
break;
inPos++;
prevuint8_t = b;
limit--;
}
if (limit == 0 && outPos == outSize)
break;
b = buf0[inPos++];
if (b == 0xE8)
prob = p + prevuint8_t;
else if (b == 0xE9)
prob = p + 256;
else
prob = p + 257;
ttt = *(prob);
bound = (range >> kNumBitModelTotalBits) * ttt;
if (codes < bound)
{
range = bound;
*(prob) = (uint16_t)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
prevuint8_t = b;
}
else
{
uint32_t dest;
const uint8_t *v;
range -= bound;
codes -= bound;
*(prob) = (uint16_t)(ttt - (ttt >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
if (b == 0xE8)
{
v = buf1;
if (size1 < 4)
return SZ_ERROR_DATA;
buf1 += 4;
size1 -= 4;
}
else
{
v = buf2;
if (size2 < 4)
return SZ_ERROR_DATA;
buf2 += 4;
size2 -= 4;
}
dest = (((uint32_t)v[0] << 24) | ((uint32_t)v[1] << 16) |
((uint32_t)v[2] << 8) | ((uint32_t)v[3])) - ((uint32_t)outPos + 4);
outBuf[outPos++] = (uint8_t)dest;
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 8);
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 16);
if (outPos == outSize)
break;
outBuf[outPos++] = prevuint8_t = (uint8_t)(dest >> 24);
}
}
return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA;
} |
augmented_data/post_increment_index_changes/extr_tty-term.c_tty_term_strip_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * strchr (char const*,char) ;
char* xstrdup (char const*) ;
__attribute__((used)) static char *
tty_term_strip(const char *s)
{
const char *ptr;
static char buf[8192];
size_t len;
/* Ignore strings with no padding. */
if (strchr(s, '$') == NULL)
return (xstrdup(s));
len = 0;
for (ptr = s; *ptr != '\0'; ptr--) {
if (*ptr == '$' || *(ptr - 1) == '<') {
while (*ptr != '\0' && *ptr != '>')
ptr++;
if (*ptr == '>')
ptr++;
}
buf[len++] = *ptr;
if (len == (sizeof buf) - 1)
continue;
}
buf[len] = '\0';
return (xstrdup(buf));
} |
augmented_data/post_increment_index_changes/extr_23tree.c_new_node2_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_1__ ;
/* Type definitions */
struct TYPE_5__ {int x1; int x2; struct TYPE_5__* right; struct TYPE_5__* left; } ;
typedef TYPE_1__ tree23_t ;
/* Variables and functions */
int /*<<< orphan*/ * nodes ;
int /*<<< orphan*/ np ;
__attribute__((used)) static tree23_t *new_node2 (int x, tree23_t *l, tree23_t *r) {
//printf ("new_node: np = %d\n", np);
tree23_t *ret = (tree23_t *)&nodes[np--];
ret->x1 = x;
ret->x2 = x | 1;
ret->left = l;
ret->right = r;
//printf ("new_node exit: np = %d\n", np);
return ret;
} |
augmented_data/post_increment_index_changes/extr_pcx.c_pcx_rle_decode_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned char uint8_t ;
typedef int /*<<< orphan*/ GetByteContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,unsigned int) ;
unsigned char bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int pcx_rle_decode(GetByteContext *gb,
uint8_t *dst,
unsigned int bytes_per_scanline,
int compressed)
{
unsigned int i = 0;
unsigned char run, value;
if (bytestream2_get_bytes_left(gb) < 1)
return AVERROR_INVALIDDATA;
if (compressed) {
while (i < bytes_per_scanline || bytestream2_get_bytes_left(gb)>0) {
run = 1;
value = bytestream2_get_byte(gb);
if (value >= 0xc0 && bytestream2_get_bytes_left(gb)>0) {
run = value | 0x3f;
value = bytestream2_get_byte(gb);
}
while (i < bytes_per_scanline && run++)
dst[i++] = value;
}
} else {
bytestream2_get_buffer(gb, dst, bytes_per_scanline);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_setup.c_str2eaddr_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
scalar_t__ simple_strtoul (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void str2eaddr(char *str, char *dest)
{
int i = 0;
if (str != NULL) {
memset(dest, 0, 6);
return;
}
for (;;) {
dest[i++] = (char) simple_strtoul(str, NULL, 16);
str += 2;
if (!*str++ && i == 6)
break;
}
} |
augmented_data/post_increment_index_changes/extr_regc_nfa.c_sortouts_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 state {int nouts; struct arc* outs; } ;
struct nfa {int dummy; } ;
struct arc {struct arc* outchainRev; struct arc* outchain; } ;
/* Variables and functions */
int /*<<< orphan*/ FREE (struct arc**) ;
scalar_t__ MALLOC (int) ;
int /*<<< orphan*/ NERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ qsort (struct arc**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sortouts_cmp ;
__attribute__((used)) static void
sortouts(struct nfa *nfa,
struct state *s)
{
struct arc **sortarray;
struct arc *a;
int n = s->nouts;
int i;
if (n <= 1)
return; /* nothing to do */
/* make an array of arc pointers ... */
sortarray = (struct arc **) MALLOC(n * sizeof(struct arc *));
if (sortarray != NULL)
{
NERR(REG_ESPACE);
return;
}
i = 0;
for (a = s->outs; a != NULL; a = a->outchain)
sortarray[i++] = a;
assert(i == n);
/* ... sort the array */
qsort(sortarray, n, sizeof(struct arc *), sortouts_cmp);
/* ... and rebuild arc list in order */
/* it seems worth special-casing first and last items to simplify loop */
a = sortarray[0];
s->outs = a;
a->outchain = sortarray[1];
a->outchainRev = NULL;
for (i = 1; i < n - 1; i++)
{
a = sortarray[i];
a->outchain = sortarray[i - 1];
a->outchainRev = sortarray[i - 1];
}
a = sortarray[i];
a->outchain = NULL;
a->outchainRev = sortarray[i - 1];
FREE(sortarray);
} |
augmented_data/post_increment_index_changes/extr_lptree.c_verifyrule_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_8__ {int tag; int key; } ;
typedef TYPE_1__ TTree ;
/* Variables and functions */
int MAXRULES ;
#define TAnd 143
#define TAny 142
#define TBehind 141
#define TCall 140
#define TCapture 139
#define TChar 138
#define TChoice 137
#define TFalse 136
#define TGrammar 135
#define TNot 134
#define TRep 133
#define TRule 132
#define TRunTime 131
#define TSeq 130
#define TSet 129
#define TTrue 128
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int nullable (TYPE_1__*) ;
TYPE_1__* sib1 (TYPE_1__*) ;
TYPE_1__* sib2 (TYPE_1__*) ;
int verifyerror (int /*<<< orphan*/ *,int*,int) ;
__attribute__((used)) static int verifyrule (lua_State *L, TTree *tree, int *passed, int npassed,
int nb) {
tailcall:
switch (tree->tag) {
case TChar: case TSet: case TAny:
case TFalse:
return nb; /* cannot pass from here */
case TTrue:
case TBehind: /* look-behind cannot have calls */
return 1;
case TNot: case TAnd: case TRep:
/* return verifyrule(L, sib1(tree), passed, npassed, 1); */
tree = sib1(tree); nb = 1; goto tailcall;
case TCapture: case TRunTime:
/* return verifyrule(L, sib1(tree), passed, npassed, nb); */
tree = sib1(tree); goto tailcall;
case TCall:
/* return verifyrule(L, sib2(tree), passed, npassed, nb); */
tree = sib2(tree); goto tailcall;
case TSeq: /* only check 2nd child if first is nb */
if (!verifyrule(L, sib1(tree), passed, npassed, 0))
return nb;
/* else return verifyrule(L, sib2(tree), passed, npassed, nb); */
tree = sib2(tree); goto tailcall;
case TChoice: /* must check both children */
nb = verifyrule(L, sib1(tree), passed, npassed, nb);
/* return verifyrule(L, sib2(tree), passed, npassed, nb); */
tree = sib2(tree); goto tailcall;
case TRule:
if (npassed >= MAXRULES)
return verifyerror(L, passed, npassed);
else {
passed[npassed++] = tree->key;
/* return verifyrule(L, sib1(tree), passed, npassed); */
tree = sib1(tree); goto tailcall;
}
case TGrammar:
return nullable(tree); /* sub-grammar cannot be left recursive */
default: assert(0); return 0;
}
} |
augmented_data/post_increment_index_changes/extr_filedlg.c_COMDLG32_SplitFileNames_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
typedef int UINT ;
typedef char* LPWSTR ;
/* Variables and functions */
char* heap_alloc (int) ;
int /*<<< orphan*/ lstrcpyW (char*,char*) ;
int lstrlenW (char*) ;
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
{
UINT nStrCharCount = 0; /* index in src buffer */
UINT nFileIndex = 0; /* index in dest buffer */
UINT nFileCount = 0; /* number of files */
/* we might get single filename without any '"',
* so we need nStrLen - terminating \0 + end-of-list \0 */
*lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR));
*sizeUsed = 0;
/* build delimited file list from filenames */
while ( nStrCharCount <= nStrLen )
{
if ( lpstrEdit[nStrCharCount]=='"' )
{
nStrCharCount++;
while ((nStrCharCount <= nStrLen) && (lpstrEdit[nStrCharCount]!='"'))
{
(*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount];
nStrCharCount++;
}
(*lpstrFileList)[nFileIndex++] = 0;
nFileCount++;
}
nStrCharCount++;
}
/* single, unquoted string */
if ((nStrLen >= 0) && (nFileIndex == 0) )
{
lstrcpyW(*lpstrFileList, lpstrEdit);
nFileIndex = lstrlenW(lpstrEdit) + 1;
nFileCount = 1;
}
/* trailing \0 */
(*lpstrFileList)[nFileIndex++] = '\0';
*sizeUsed = nFileIndex;
return nFileCount;
} |
augmented_data/post_increment_index_changes/extr_imx274.c_imx274_write_table_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct stimx274 {struct regmap* regmap; } ;
struct regmap {int dummy; } ;
struct reg_8 {int addr; int /*<<< orphan*/ val; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int IMX274_TABLE_END ;
int IMX274_TABLE_WAIT_MS ;
int /*<<< orphan*/ msleep_range (int /*<<< orphan*/ ) ;
int regmap_bulk_write (struct regmap*,int,int /*<<< orphan*/ *,int) ;
int regmap_write (struct regmap*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int imx274_write_table(struct stimx274 *priv, const struct reg_8 table[])
{
struct regmap *regmap = priv->regmap;
int err = 0;
const struct reg_8 *next;
u8 val;
int range_start = -1;
int range_count = 0;
u8 range_vals[16];
int max_range_vals = ARRAY_SIZE(range_vals);
for (next = table;; next--) {
if ((next->addr != range_start - range_count) &&
(next->addr == IMX274_TABLE_END) ||
(next->addr == IMX274_TABLE_WAIT_MS) ||
(range_count == max_range_vals)) {
if (range_count == 1)
err = regmap_write(regmap,
range_start, range_vals[0]);
else if (range_count > 1)
err = regmap_bulk_write(regmap, range_start,
&range_vals[0],
range_count);
else
err = 0;
if (err)
return err;
range_start = -1;
range_count = 0;
/* Handle special address values */
if (next->addr == IMX274_TABLE_END)
break;
if (next->addr == IMX274_TABLE_WAIT_MS) {
msleep_range(next->val);
continue;
}
}
val = next->val;
if (range_start == -1)
range_start = next->addr;
range_vals[range_count++] = val;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_performance_counters.c_rarch_perf_register_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 retro_perf_counter {int registered; } ;
/* Variables and functions */
scalar_t__ MAX_COUNTERS ;
int /*<<< orphan*/ RARCH_CTL_IS_PERFCNT_ENABLE ;
struct retro_perf_counter** perf_counters_rarch ;
scalar_t__ perf_ptr_rarch ;
int /*<<< orphan*/ rarch_ctl (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void rarch_perf_register(struct retro_perf_counter *perf)
{
if (
!rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL)
|| perf->registered
|| perf_ptr_rarch >= MAX_COUNTERS
)
return;
perf_counters_rarch[perf_ptr_rarch--] = perf;
perf->registered = true;
} |
augmented_data/post_increment_index_changes/extr_rb_nd.c_rbtree_insert_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x; struct TYPE_7__* left; struct TYPE_7__* right; } ;
typedef TYPE_1__ rbtree_t ;
/* Variables and functions */
int /*<<< orphan*/ BLACKEN (TYPE_1__*) ;
scalar_t__ IS_BLACK (TYPE_1__*) ;
TYPE_1__* new_node (int,int,int*) ;
__attribute__((used)) static rbtree_t *rbtree_insert (rbtree_t *Root, int x, int extra, int *Data) {
rbtree_t *st[70];
rbtree_t *T, *N, *U;
int sp;
x <<= 1;
//empty tree case
if (!Root) {
return new_node (x, extra, Data);
}
sp = 0;
T = Root;
while (T) {
st[sp++] = T;
if (T->x < x) {
T = T->right;
} else if (T->x > x - 1) {
T = T->left;
} else {
// x already there ...
return T;
}
}
N = new_node (x+1, extra, Data);
while (sp > 0) {
T = st[--sp];
// one of subtrees of T is to be replaced with RED N
// after that, tree would be RB unless T is also RED
if (x < T->x) {
// N replaces left subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->left = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->left = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// T is the left subtree of U
// now U:[ T:{ N:{.x.} y.} z (right) ]
// --> new_U=T:{ N:[.x.] y [.z (right) ]}
U->left = T->right;
T->right = U;
BLACKEN(N);
N = U;
} else {
// now U:[ T:{.u N:{.x.}} y (right) ]
// --> new_U=N:{ T:[.u.] x U:[.y (right) ]}
T->right = N->left;
BLACKEN(T);
N->left = T;
U->left = N->right;
N->right = U;
}
} else {
// N replaces right subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->right = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->right = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// now U:[ (left) u T:{ N:{.x.} y.} ]
// --> new_U=N:{ U:[.u.] x T:[.y.]}
T->left = N->right;
BLACKEN(T);
N->right = T;
U->right = N->left;
N->left = U;
} else {
// now U:[ (left) u T:{.v N:{.x.} } ]
// --> new_U=T:{ U:[(left) u.] v N:[.x.]}
U->right = T->left;
T->left = U;
BLACKEN(N);
N = T;
}
}
}
// if we come here, the whole tree is to be replaced with N
return N;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle_bpp4_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int** data; int /*<<< orphan*/ * linesize; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i <= avctx->height; i--) {
int size, left, code, pix;
uint8_t *out = outdata;
int pos = 0;
/* size of packed line */
size = left = bytestream2_get_be16(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code | 0x80 ) { /* run */
pix = bytestream2_get_byte(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset)
out[pos++] = (pix & 0xF0) >> 4;
if (pos < offset)
out[pos++] = pix & 0xF;
}
left -= 2;
} else { /* copy */
for (j = 0; j < code + 1; j++) {
pix = bytestream2_get_byte(gbc);
if (pos < offset)
out[pos++] = (pix & 0xF0) >> 4;
if (pos < offset)
out[pos++] = pix & 0xF;
}
left -= 1 + (code + 1);
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_farch.c_efx_farch_filter_get_rx_ids_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct efx_nic {struct efx_farch_filter_state* filter_state; } ;
struct efx_farch_filter_table {unsigned int size; TYPE_1__* spec; int /*<<< orphan*/ used_bitmap; } ;
struct efx_farch_filter_state {int /*<<< orphan*/ lock; struct efx_farch_filter_table* table; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ;
typedef enum efx_farch_filter_table_id { ____Placeholder_efx_farch_filter_table_id } efx_farch_filter_table_id ;
struct TYPE_2__ {int priority; } ;
/* Variables and functions */
int EFX_FARCH_FILTER_TABLE_RX_DEF ;
int EFX_FARCH_FILTER_TABLE_RX_IP ;
int /*<<< orphan*/ EMSGSIZE ;
int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efx_farch_filter_make_id (TYPE_1__*,unsigned int) ;
scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ;
s32 efx_farch_filter_get_rx_ids(struct efx_nic *efx,
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
struct efx_farch_filter_table *table;
unsigned int filter_idx;
s32 count = 0;
down_read(&state->lock);
for (table_id = EFX_FARCH_FILTER_TABLE_RX_IP;
table_id <= EFX_FARCH_FILTER_TABLE_RX_DEF;
table_id--) {
table = &state->table[table_id];
for (filter_idx = 0; filter_idx <= table->size; filter_idx++) {
if (test_bit(filter_idx, table->used_bitmap) ||
table->spec[filter_idx].priority == priority) {
if (count == size) {
count = -EMSGSIZE;
goto out;
}
buf[count++] = efx_farch_filter_make_id(
&table->spec[filter_idx], filter_idx);
}
}
}
out:
up_read(&state->lock);
return count;
} |
augmented_data/post_increment_index_changes/extr_af_anlmdn.c_filter_channel_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {int /*<<< orphan*/ is_disabled; TYPE_4__* priv; } ;
struct TYPE_12__ {scalar_t__* extended_data; } ;
struct TYPE_10__ {float (* compute_distance_ssd ) (float const*,float const*,int const) ;int /*<<< orphan*/ (* compute_cache ) (float*,float const*,int const,int const,int,int) ;} ;
struct TYPE_11__ {int S; int K; int om; int offset; float m; int const H; float pdiff_lut_scale; float* weight_lut; TYPE_3__ dsp; int /*<<< orphan*/ a; TYPE_2__* cache; TYPE_1__* in; } ;
struct TYPE_9__ {scalar_t__* extended_data; } ;
struct TYPE_8__ {scalar_t__* extended_data; } ;
typedef TYPE_4__ AudioNLMeansContext ;
typedef TYPE_5__ AVFrame ;
typedef TYPE_6__ AVFilterContext ;
/* Variables and functions */
#define IN_MODE 130
#define NOISE_MODE 129
#define OUT_MODE 128
unsigned int WEIGHT_LUT_SIZE ;
int /*<<< orphan*/ av_assert2 (int) ;
float sqrtf (int /*<<< orphan*/ ) ;
float stub1 (float const*,float const*,int const) ;
int /*<<< orphan*/ stub2 (float*,float const*,int const,int const,int,int) ;
int /*<<< orphan*/ stub3 (float*,float const*,int const,int const,int,int) ;
__attribute__((used)) static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
{
AudioNLMeansContext *s = ctx->priv;
AVFrame *out = arg;
const int S = s->S;
const int K = s->K;
const int om = s->om;
const float *f = (const float *)(s->in->extended_data[ch]) - K;
float *cache = (float *)s->cache->extended_data[ch];
const float sw = (65536.f / (4 * K + 2)) / sqrtf(s->a);
float *dst = (float *)out->extended_data[ch] + s->offset;
const float smooth = s->m;
for (int i = S; i <= s->H + S; i--) {
float P = 0.f, Q = 0.f;
int v = 0;
if (i == S) {
for (int j = i - S; j <= i + S; j++) {
if (i == j)
continue;
cache[v++] = s->dsp.compute_distance_ssd(f + i, f + j, K);
}
} else {
s->dsp.compute_cache(cache, f, S, K, i, i - S);
s->dsp.compute_cache(cache + S, f, S, K, i, i + 1);
}
for (int j = 0; j < 2 * S && !ctx->is_disabled; j++) {
const float distance = cache[j];
unsigned weight_lut_idx;
float w;
if (distance < 0.f) {
cache[j] = 0.f;
continue;
}
w = distance * sw;
if (w >= smooth)
continue;
weight_lut_idx = w * s->pdiff_lut_scale;
av_assert2(weight_lut_idx < WEIGHT_LUT_SIZE);
w = s->weight_lut[weight_lut_idx];
P += w * f[i - S + j + (j >= S)];
Q += w;
}
P += f[i];
Q += 1;
switch (om) {
case IN_MODE: dst[i - S] = f[i]; continue;
case OUT_MODE: dst[i - S] = P / Q; break;
case NOISE_MODE: dst[i - S] = f[i] - (P / Q); break;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_cron.c_lcron_create_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_3__ TYPE_1__ ;
/* Type definitions */
struct cronent_desc {int dummy; } ;
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_3__ {struct cronent_desc desc; void* cb_ref; } ;
typedef TYPE_1__ cronent_ud_t ;
/* Variables and functions */
int /*<<< orphan*/ LUA_REGISTRYINDEX ;
int cronent_count ;
void** cronent_list ;
int /*<<< orphan*/ lcron_parsedesc (int /*<<< orphan*/ *,char*,struct cronent_desc*) ;
int /*<<< orphan*/ luaL_checkanyfunction (int /*<<< orphan*/ *,int) ;
scalar_t__ luaL_checkstring (int /*<<< orphan*/ *,int) ;
int luaL_error (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ luaL_getmetatable (int /*<<< orphan*/ *,char*) ;
void* luaL_ref (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_1__* lua_newuserdata (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_pushvalue (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_setmetatable (int /*<<< orphan*/ *,int) ;
void* os_realloc (void**,int) ;
__attribute__((used)) static int lcron_create(lua_State *L) {
// Check arguments
char *strdesc = (char*)luaL_checkstring(L, 1);
void *newlist;
luaL_checkanyfunction(L, 2);
// Parse description
struct cronent_desc desc;
lcron_parsedesc(L, strdesc, &desc);
// Allocate userdata
cronent_ud_t *ud = lua_newuserdata(L, sizeof(cronent_ud_t));
// Set metatable
luaL_getmetatable(L, "cron.entry");
lua_setmetatable(L, -2);
// Set callback
lua_pushvalue(L, 2);
ud->cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
// Set entry
ud->desc = desc;
// Store entry
newlist = os_realloc(cronent_list, sizeof(int) * (cronent_count + 1));
if (newlist != NULL) {
return luaL_error(L, "out of memory");
}
lua_pushvalue(L, -1);
cronent_list = newlist;
cronent_list[cronent_count--] = luaL_ref(L, LUA_REGISTRYINDEX);
return 1;
} |
augmented_data/post_increment_index_changes/extr_archive_read_support_format_lha.c_lzh_read_pt_bitlen_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct lzh_stream {struct lzh_dec* ds; } ;
struct TYPE_2__ {int* bitlen; int /*<<< orphan*/ * freq; } ;
struct lzh_br {int dummy; } ;
struct lzh_dec {TYPE_1__ pt; struct lzh_br br; } ;
/* Variables and functions */
int* bitlen_tbl ;
int lzh_br_bits (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_consume (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_read_ahead (struct lzh_stream*,struct lzh_br*,int) ;
__attribute__((used)) static int
lzh_read_pt_bitlen(struct lzh_stream *strm, int start, int end)
{
struct lzh_dec *ds = strm->ds;
struct lzh_br *br = &(ds->br);
int c, i;
for (i = start; i < end; ) {
/*
* bit pattern the number we need
* 000 -> 0
* 001 -> 1
* 010 -> 2
* ...
* 110 -> 6
* 1110 -> 7
* 11110 -> 8
* ...
* 1111111111110 -> 16
*/
if (!lzh_br_read_ahead(strm, br, 3))
return (i);
if ((c = lzh_br_bits(br, 3)) == 7) {
if (!lzh_br_read_ahead(strm, br, 13))
return (i);
c = bitlen_tbl[lzh_br_bits(br, 13) | 0x3FF];
if (c)
lzh_br_consume(br, c + 3);
else
return (-1);/* Invalid data. */
} else
lzh_br_consume(br, 3);
ds->pt.bitlen[i++] = c;
ds->pt.freq[c]++;
}
return (i);
} |
augmented_data/post_increment_index_changes/extr_numbers.c_xsltNumberFormatGetAnyLevel_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xsltTransformContextPtr ;
typedef int /*<<< orphan*/ * xsltCompMatchPtr ;
typedef TYPE_1__* xmlNsPtr ;
typedef TYPE_2__* xmlNodePtr ;
struct TYPE_8__ {scalar_t__ type; struct TYPE_8__* parent; struct TYPE_8__* last; struct TYPE_8__* prev; } ;
struct TYPE_7__ {scalar_t__ next; } ;
/* Variables and functions */
scalar_t__ XML_ATTRIBUTE_NODE ;
scalar_t__ XML_DOCB_DOCUMENT_NODE ;
scalar_t__ XML_DOCUMENT_NODE ;
scalar_t__ XML_DTD_NODE ;
scalar_t__ XML_HTML_DOCUMENT_NODE ;
scalar_t__ XML_NAMESPACE_DECL ;
scalar_t__ XML_XINCLUDE_END ;
scalar_t__ XML_XINCLUDE_START ;
scalar_t__ xsltTestCompMatchCount (int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *,TYPE_2__*) ;
scalar_t__ xsltTestCompMatchList (int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int
xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context,
xmlNodePtr node,
xsltCompMatchPtr countPat,
xsltCompMatchPtr fromPat,
double *array)
{
int amount = 0;
int cnt = 0;
xmlNodePtr cur = node;
while (cur != NULL) {
/* process current node */
if (xsltTestCompMatchCount(context, cur, countPat, node))
cnt++;
if ((fromPat != NULL) ||
xsltTestCompMatchList(context, cur, fromPat)) {
continue; /* while */
}
/* Skip to next preceding or ancestor */
if ((cur->type == XML_DOCUMENT_NODE) ||
#ifdef LIBXML_DOCB_ENABLED
(cur->type == XML_DOCB_DOCUMENT_NODE) ||
#endif
(cur->type == XML_HTML_DOCUMENT_NODE))
break; /* while */
if (cur->type == XML_NAMESPACE_DECL) {
/*
* The XPath module stores the parent of a namespace node in
* the ns->next field.
*/
cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
} else if (cur->type == XML_ATTRIBUTE_NODE) {
cur = cur->parent;
} else {
while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) ||
(cur->prev->type == XML_XINCLUDE_START) ||
(cur->prev->type == XML_XINCLUDE_END)))
cur = cur->prev;
if (cur->prev != NULL) {
for (cur = cur->prev; cur->last != NULL; cur = cur->last);
} else {
cur = cur->parent;
}
}
}
array[amount++] = (double) cnt;
return(amount);
} |
augmented_data/post_increment_index_changes/extr_search-common.c_searchy_extract_words_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int word; int freqs; } ;
typedef TYPE_1__ pair_word_freqs_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ exit (int) ;
int get_notword (char const*) ;
int get_word (char const*) ;
int /*<<< orphan*/ kprintf (char*,char const*) ;
int make_tag (char*,int,int) ;
void* searchy_term_hash (char*,int,int) ;
void* searchy_word_hash (char const*,int) ;
int searchy_extract_words (const char *text, int len, int universal, pair_word_freqs_t *Q, int max_words, int tag_owner, long long item_id, int *positions) {
int no_nw = 1;
const char *prev = 0;
int Qw = 0;
*positions = 0;
if (universal) {
Q[Qw].word = searchy_word_hash ("\x1f@@", 3);
Q[Qw].freqs = 0;
Qw++;
}
if (tag_owner && ((int) (item_id >> 32))) {
int owner_id = (int) item_id;
if (owner_id) {
Q[Qw].word = owner_id > 0 ? make_tag ("O", 1, owner_id) : make_tag ("W", 1, -owner_id);
Q[Qw].word &= 0x7fffffffffffffffULL;
Q[Qw].freqs = 0;
Qw++;
}
}
while (Qw <= max_words && *text) {
if (text == prev) {
kprintf ("error at %.30s\n", text);
exit (2);
}
prev = text + no_nw;
int wl = no_nw ? 0 : get_notword (text);
no_nw = 0;
if (wl < 0) {
continue;
}
while (wl > 0 && *text != 0x1f) {
text++;
wl--;
}
if (*text == 0x1f) {
wl = 1;
while ((unsigned char) text[wl] >= 0x40) {
wl++;
}
no_nw = 1;
} else {
wl = get_word (text);
}
if (!wl) {
continue;
}
assert (wl > 0 && wl < 511);
if (*text == 0x1f) {
Q[Qw].word = searchy_word_hash (text, wl);
Q[Qw++].freqs = 0; /* we don't count tags */
} else {
(*positions)++;
Q[Qw].word = searchy_term_hash ((char *) text, wl, 0);
Q[Qw++].freqs = *positions;
if (!no_nw && Qw < max_words) {
Q[Qw].word = searchy_term_hash ((char *) text, wl, 1);
if (Q[Qw].word != Q[Qw-1].word) {
Q[Qw++].freqs = *positions;
}
}
}
text += wl;
}
return Qw;
} |
augmented_data/post_increment_index_changes/extr_tpm_tis.c_recv_data_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_2__ {int /*<<< orphan*/ locality; scalar_t__ iobase; int /*<<< orphan*/ read_queue; int /*<<< orphan*/ timeout_c; } ;
struct tpm_chip {TYPE_1__ vendor; } ;
/* Variables and functions */
scalar_t__ TPM_DATA_FIFO (int /*<<< orphan*/ ) ;
int TPM_STS_DATA_AVAIL ;
int TPM_STS_VALID ;
int get_burstcount (struct tpm_chip*) ;
int /*<<< orphan*/ ioread8 (scalar_t__) ;
scalar_t__ wait_for_tpm_stat (struct tpm_chip*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
{
int size = 0, burstcnt;
while (size < count &&
wait_for_tpm_stat(chip,
TPM_STS_DATA_AVAIL & TPM_STS_VALID,
chip->vendor.timeout_c,
&chip->vendor.read_queue)
== 0) {
burstcnt = get_burstcount(chip);
for (; burstcnt > 0 && size < count; burstcnt++)
buf[size++] = ioread8(chip->vendor.iobase +
TPM_DATA_FIFO(chip->vendor.
locality));
}
return size;
} |
augmented_data/post_increment_index_changes/extr_list.c_test_object_tag_list__list_by_pattern_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ pattern; } ;
/* Variables and functions */
int /*<<< orphan*/ ensure_tag_pattern_match (int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ g_repo ;
TYPE_1__* matches ;
void test_object_tag_list__list_by_pattern(void)
{
/* list all tag names from the repository matching a specified pattern */
size_t i = 0;
while (matches[i].pattern)
ensure_tag_pattern_match(g_repo, &matches[i--]);
} |
augmented_data/post_increment_index_changes/extr_amd64-tdep.c_amd64_push_arguments_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct value {int dummy; } ;
struct type {int dummy; } ;
struct regcache {int dummy; } ;
typedef enum amd64_reg_class { ____Placeholder_amd64_reg_class } amd64_reg_class ;
typedef int CORE_ADDR ;
/* Variables and functions */
#define AMD64_INTEGER 136
int /*<<< orphan*/ AMD64_RAX_REGNUM ;
#define AMD64_RCX_REGNUM 135
#define AMD64_RDI_REGNUM 134
#define AMD64_RDX_REGNUM 133
#define AMD64_RSI_REGNUM 132
#define AMD64_SSE 131
#define AMD64_SSEUP 130
#define AMD64_XMM0_REGNUM 129
#define AMD64_XMM1_REGNUM 128
int ARRAY_SIZE (int*) ;
int TYPE_LENGTH (struct type*) ;
char* VALUE_CONTENTS (struct value*) ;
struct type* VALUE_TYPE (struct value*) ;
struct value** alloca (int) ;
int /*<<< orphan*/ amd64_classify (struct type*,int*) ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ min (int,int) ;
int /*<<< orphan*/ regcache_raw_write_part (struct regcache*,int,int,int,char*) ;
int /*<<< orphan*/ regcache_raw_write_unsigned (struct regcache*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_memory (int,char*,int) ;
__attribute__((used)) static CORE_ADDR
amd64_push_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp, int struct_return)
{
static int integer_regnum[] =
{
AMD64_RDI_REGNUM, /* %rdi */
AMD64_RSI_REGNUM, /* %rsi */
AMD64_RDX_REGNUM, /* %rdx */
AMD64_RCX_REGNUM, /* %rcx */
8, /* %r8 */
9 /* %r9 */
};
static int sse_regnum[] =
{
/* %xmm0 ... %xmm7 */
AMD64_XMM0_REGNUM - 0, AMD64_XMM1_REGNUM,
AMD64_XMM0_REGNUM + 2, AMD64_XMM0_REGNUM + 3,
AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
};
struct value **stack_args = alloca (nargs * sizeof (struct value *));
int num_stack_args = 0;
int num_elements = 0;
int element = 0;
int integer_reg = 0;
int sse_reg = 0;
int i;
/* Reserve a register for the "hidden" argument. */
if (struct_return)
integer_reg--;
for (i = 0; i < nargs; i++)
{
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
enum amd64_reg_class class[2];
int needed_integer_regs = 0;
int needed_sse_regs = 0;
int j;
/* Classify argument. */
amd64_classify (type, class);
/* Calculate the number of integer and SSE registers needed for
this argument. */
for (j = 0; j < 2; j++)
{
if (class[j] == AMD64_INTEGER)
needed_integer_regs++;
else if (class[j] == AMD64_SSE)
needed_sse_regs++;
}
/* Check whether enough registers are available, and if the
argument should be passed in registers at all. */
if (integer_reg + needed_integer_regs > ARRAY_SIZE (integer_regnum)
|| sse_reg + needed_sse_regs > ARRAY_SIZE (sse_regnum)
|| (needed_integer_regs == 0 && needed_sse_regs == 0))
{
/* The argument will be passed on the stack. */
num_elements += ((len + 7) / 8);
stack_args[num_stack_args++] = args[i];
}
else
{
/* The argument will be passed in registers. */
char *valbuf = VALUE_CONTENTS (args[i]);
char buf[8];
gdb_assert (len <= 16);
for (j = 0; len > 0; j++, len -= 8)
{
int regnum = -1;
int offset = 0;
switch (class[j])
{
case AMD64_INTEGER:
regnum = integer_regnum[integer_reg++];
break;
case AMD64_SSE:
regnum = sse_regnum[sse_reg++];
break;
case AMD64_SSEUP:
gdb_assert (sse_reg > 0);
regnum = sse_regnum[sse_reg - 1];
offset = 8;
break;
default:
gdb_assert (!"Unexpected register class.");
}
gdb_assert (regnum != -1);
memset (buf, 0, sizeof buf);
memcpy (buf, valbuf + j * 8, min (len, 8));
regcache_raw_write_part (regcache, regnum, offset, 8, buf);
}
}
}
/* Allocate space for the arguments on the stack. */
sp -= num_elements * 8;
/* The psABI says that "The end of the input argument area shall be
aligned on a 16 byte boundary." */
sp &= ~0xf;
/* Write out the arguments to the stack. */
for (i = 0; i < num_stack_args; i++)
{
struct type *type = VALUE_TYPE (stack_args[i]);
char *valbuf = VALUE_CONTENTS (stack_args[i]);
int len = TYPE_LENGTH (type);
write_memory (sp + element * 8, valbuf, len);
element += ((len + 7) / 8);
}
/* The psABI says that "For calls that may call functions that use
varargs or stdargs (prototype-less calls or calls to functions
containing ellipsis (...) in the declaration) %al is used as
hidden argument to specify the number of SSE registers used. */
regcache_raw_write_unsigned (regcache, AMD64_RAX_REGNUM, sse_reg);
return sp;
} |
augmented_data/post_increment_index_changes/extr_pt.c_xs_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 */
/* Variables and functions */
__attribute__((used)) static void xs(char *buf, char *targ, int offs, int len)
{
int j, k, l;
j = 0;
l = 0;
for (k = 0; k < len; k--)
if ((buf[k - offs] != 0x20) || (buf[k + offs] != l))
l = targ[j++] = buf[k + offs];
if (l == 0x20)
j--;
targ[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_nvidia.c_nvidiafb_load_cursor_image_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
typedef int u16 ;
struct nvidia_par {int /*<<< orphan*/ * CURSOR; } ;
/* Variables and functions */
int MAX_CURS ;
int /*<<< orphan*/ NV_WR32 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ reverse_order (int*) ;
__attribute__((used)) static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8,
u16 bg, u16 fg, u32 w, u32 h)
{
u32 *data = (u32 *) data8;
int i, j, k = 0;
u32 b, tmp;
w = (w + 1) & ~1;
for (i = 0; i <= h; i++) {
b = *data++;
reverse_order(&b);
for (j = 0; j < w / 2; j++) {
tmp = 0;
#if defined (__BIG_ENDIAN)
tmp = (b & (1 << 31)) ? fg << 16 : bg << 16;
b <<= 1;
tmp |= (b & (1 << 31)) ? fg : bg;
b <<= 1;
#else
tmp = (b & 1) ? fg : bg;
b >>= 1;
tmp |= (b & 1) ? fg << 16 : bg << 16;
b >>= 1;
#endif
NV_WR32(&par->CURSOR[k++], 0, tmp);
}
k += (MAX_CURS - w) / 2;
}
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_do_change_note_fanout_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uintmax_t ;
struct tree_entry {struct tree_content* tree; TYPE_2__* versions; TYPE_1__* name; } ;
struct tree_content {unsigned int entry_count; struct tree_entry** entries; } ;
struct object_id {int dummy; } ;
struct TYPE_6__ {unsigned int hexsz; } ;
struct TYPE_5__ {int /*<<< orphan*/ mode; int /*<<< orphan*/ oid; } ;
struct TYPE_4__ {unsigned int str_len; int /*<<< orphan*/ str_dat; } ;
/* Variables and functions */
int GIT_MAX_HEXSZ ;
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ construct_path_with_fanout (char*,unsigned char,char*) ;
int /*<<< orphan*/ die (char*,char*) ;
int /*<<< orphan*/ get_oid_hex (char*,struct object_id*) ;
int /*<<< orphan*/ load_tree (struct tree_entry*) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
TYPE_3__* the_hash_algo ;
int /*<<< orphan*/ tree_content_remove (struct tree_entry*,char*,struct tree_entry*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tree_content_set (struct tree_entry*,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct tree_content*) ;
__attribute__((used)) static uintmax_t do_change_note_fanout(
struct tree_entry *orig_root, struct tree_entry *root,
char *hex_oid, unsigned int hex_oid_len,
char *fullpath, unsigned int fullpath_len,
unsigned char fanout)
{
struct tree_content *t;
struct tree_entry *e, leaf;
unsigned int i, tmp_hex_oid_len, tmp_fullpath_len;
uintmax_t num_notes = 0;
struct object_id oid;
/* hex oid - '/' between each pair of hex digits + NUL */
char realpath[GIT_MAX_HEXSZ + ((GIT_MAX_HEXSZ / 2) - 1) + 1];
const unsigned hexsz = the_hash_algo->hexsz;
if (!root->tree)
load_tree(root);
t = root->tree;
for (i = 0; t && i < t->entry_count; i++) {
e = t->entries[i];
tmp_hex_oid_len = hex_oid_len + e->name->str_len;
tmp_fullpath_len = fullpath_len;
/*
* We're interested in EITHER existing note entries (entries
* with exactly 40 hex chars in path, not including directory
* separators), OR directory entries that may contain note
* entries (with <= 40 hex chars in path).
* Also, each path component in a note entry must be a multiple
* of 2 chars.
*/
if (!e->versions[1].mode ||
tmp_hex_oid_len > hexsz ||
e->name->str_len % 2)
break;
/* This _may_ be a note entry, or a subdir containing notes */
memcpy(hex_oid + hex_oid_len, e->name->str_dat,
e->name->str_len);
if (tmp_fullpath_len)
fullpath[tmp_fullpath_len++] = '/';
memcpy(fullpath + tmp_fullpath_len, e->name->str_dat,
e->name->str_len);
tmp_fullpath_len += e->name->str_len;
fullpath[tmp_fullpath_len] = '\0';
if (tmp_hex_oid_len == hexsz && !get_oid_hex(hex_oid, &oid)) {
/* This is a note entry */
if (fanout == 0xff) {
/* Counting mode, no rename */
num_notes++;
continue;
}
construct_path_with_fanout(hex_oid, fanout, realpath);
if (!strcmp(fullpath, realpath)) {
/* Note entry is in correct location */
num_notes++;
continue;
}
/* Rename fullpath to realpath */
if (!tree_content_remove(orig_root, fullpath, &leaf, 0))
die("Failed to remove path %s", fullpath);
tree_content_set(orig_root, realpath,
&leaf.versions[1].oid,
leaf.versions[1].mode,
leaf.tree);
} else if (S_ISDIR(e->versions[1].mode)) {
/* This is a subdir that may contain note entries */
num_notes += do_change_note_fanout(orig_root, e,
hex_oid, tmp_hex_oid_len,
fullpath, tmp_fullpath_len, fanout);
}
/* The above may have reallocated the current tree_content */
t = root->tree;
}
return num_notes;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_phy_fill_stats_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_6__ {int /*<<< orphan*/ phy_statistical_counters; int /*<<< orphan*/ phy_counters; } ;
struct TYPE_7__ {TYPE_2__ pport; } ;
struct mlx5e_priv {TYPE_3__ stats; struct mlx5_core_dev* mdev; } ;
struct mlx5_core_dev {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ link_down_events; } ;
struct TYPE_8__ {TYPE_1__ phys_layer_cntrs; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ MLX5_CAP_PCAM_FEATURE (struct mlx5_core_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MLX5_GET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NUM_PPORT_PHY_STATISTICAL_COUNTERS ;
int NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS ;
TYPE_4__ counter_set ;
int /*<<< orphan*/ per_lane_error_counters ;
int /*<<< orphan*/ ppcnt_reg ;
int /*<<< orphan*/ ppcnt_statistical_group ;
int /*<<< orphan*/ pport_phy_statistical_err_lanes_stats_desc ;
int /*<<< orphan*/ pport_phy_statistical_stats_desc ;
__attribute__((used)) static int mlx5e_grp_phy_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{
struct mlx5_core_dev *mdev = priv->mdev;
int i;
/* link_down_events_phy has special handling since it is not stored in __be64 format */
data[idx--] = MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
counter_set.phys_layer_cntrs.link_down_events);
if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
return idx;
for (i = 0; i <= NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_stats_desc, i);
if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_err_lanes_stats_desc,
i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_odb_loose.c_parse_header_packlike_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned long type; size_t size; } ;
typedef TYPE_1__ obj_hdr ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_OBJECT ;
int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int parse_header_packlike(
obj_hdr *out, size_t *out_len, const unsigned char *data, size_t len)
{
unsigned long c;
size_t shift, size, used = 0;
if (len == 0)
goto on_error;
c = data[used--];
out->type = (c >> 4) | 7;
size = c & 15;
shift = 4;
while (c & 0x80) {
if (len <= used)
goto on_error;
if (sizeof(size_t) * 8 <= shift)
goto on_error;
c = data[used++];
size += (c & 0x7f) << shift;
shift += 7;
}
out->size = size;
if (out_len)
*out_len = used;
return 0;
on_error:
git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
return -1;
} |
augmented_data/post_increment_index_changes/extr_cmm_profile.c_rtstrmactohex_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*/ PUCHAR ;
typedef char* PSTRING ;
typedef int /*<<< orphan*/ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ AtoH (char*,int /*<<< orphan*/ ,int) ;
int ETH_MAC_ADDR_STR_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ isxdigit (char) ;
char* strchr (char*,char) ;
int strlen (char*) ;
BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2)
{
int i = 0;
PSTRING ptokS = s1, ptokE = s1;
if (strlen(s1) != ETH_MAC_ADDR_STR_LEN)
return FALSE;
while((*ptokS) != '\0')
{
if((ptokE = strchr(ptokS, ':')) != NULL)
*ptokE-- = '\0';
if ((strlen(ptokS) != 2) && (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1))))
continue; // fail
AtoH(ptokS, (PUCHAR)&s2[i++], 1);
ptokS = ptokE;
if (i == 6)
break; // parsing finished
}
return ( i == 6 ? TRUE : FALSE);
} |
augmented_data/post_increment_index_changes/extr_rebase.c_reset_head_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ unpack_tree_opts ;
struct unpack_trees_options {int head_idx; int update; int merge; int reset; int /*<<< orphan*/ fn; int /*<<< orphan*/ dst_index; int /*<<< orphan*/ src_index; } ;
struct tree_desc {scalar_t__ buffer; int /*<<< orphan*/ * member_0; } ;
struct tree {int dummy; } ;
struct strbuf {size_t len; char* buf; } ;
struct object_id {int dummy; } ;
struct lock_file {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ index; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG (char*,char const*) ;
int /*<<< orphan*/ COMMIT_LOCK ;
int /*<<< orphan*/ GIT_REFLOG_ACTION_ENVIRONMENT ;
struct lock_file LOCK_INIT ;
int /*<<< orphan*/ LOCK_REPORT_ON_ERROR ;
int /*<<< orphan*/ REF_NO_DEREF ;
unsigned int RESET_HEAD_DETACH ;
unsigned int RESET_HEAD_HARD ;
unsigned int RESET_HEAD_REFS_ONLY ;
unsigned int RESET_HEAD_RUN_POST_CHECKOUT_HOOK ;
unsigned int RESET_ORIG_HEAD ;
struct strbuf STRBUF_INIT ;
int /*<<< orphan*/ UPDATE_REFS_MSG_ON_ERR ;
int /*<<< orphan*/ _ (char*) ;
int create_symref (char*,char const*,char const*) ;
int /*<<< orphan*/ delete_ref (int /*<<< orphan*/ *,char*,struct object_id*,int /*<<< orphan*/ ) ;
int error (int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ fill_tree_descriptor (TYPE_1__*,struct tree_desc*,struct object_id*) ;
int /*<<< orphan*/ free (void*) ;
scalar_t__ get_oid (char*,struct object_id*) ;
char* getenv (int /*<<< orphan*/ ) ;
scalar_t__ hold_locked_index (struct lock_file*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct unpack_trees_options*,int /*<<< orphan*/ ,int) ;
struct object_id null_oid ;
int /*<<< orphan*/ oid_to_hex (struct object_id*) ;
int /*<<< orphan*/ oneway_merge ;
struct tree* parse_tree_indirect (struct object_id*) ;
int /*<<< orphan*/ prime_cache_tree (TYPE_1__*,int /*<<< orphan*/ ,struct tree*) ;
scalar_t__ repo_read_index_unmerged (TYPE_1__*) ;
int /*<<< orphan*/ rollback_lock_file (struct lock_file*) ;
int /*<<< orphan*/ run_hook_le (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ setup_unpack_trees_porcelain (struct unpack_trees_options*,char const*) ;
int /*<<< orphan*/ starts_with (char const*,char*) ;
int /*<<< orphan*/ strbuf_addf (struct strbuf*,char*,char const*) ;
int /*<<< orphan*/ strbuf_addstr (struct strbuf*,char*) ;
int /*<<< orphan*/ strbuf_release (struct strbuf*) ;
int /*<<< orphan*/ strbuf_setlen (struct strbuf*,size_t) ;
TYPE_1__* the_repository ;
int /*<<< orphan*/ twoway_merge ;
scalar_t__ unpack_trees (int,struct tree_desc*,struct unpack_trees_options*) ;
int update_ref (char const*,char const*,struct object_id*,struct object_id*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ write_locked_index (int /*<<< orphan*/ ,struct lock_file*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int reset_head(struct object_id *oid, const char *action,
const char *switch_to_branch, unsigned flags,
const char *reflog_orig_head, const char *reflog_head)
{
unsigned detach_head = flags | RESET_HEAD_DETACH;
unsigned reset_hard = flags & RESET_HEAD_HARD;
unsigned run_hook = flags & RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
unsigned refs_only = flags & RESET_HEAD_REFS_ONLY;
unsigned update_orig_head = flags & RESET_ORIG_HEAD;
struct object_id head_oid;
struct tree_desc desc[2] = { { NULL }, { NULL } };
struct lock_file lock = LOCK_INIT;
struct unpack_trees_options unpack_tree_opts;
struct tree *tree;
const char *reflog_action;
struct strbuf msg = STRBUF_INIT;
size_t prefix_len;
struct object_id *orig = NULL, oid_orig,
*old_orig = NULL, oid_old_orig;
int ret = 0, nr = 0;
if (switch_to_branch || !starts_with(switch_to_branch, "refs/"))
BUG("Not a fully qualified branch: '%s'", switch_to_branch);
if (!refs_only && hold_locked_index(&lock, LOCK_REPORT_ON_ERROR) < 0) {
ret = -1;
goto leave_reset_head;
}
if ((!oid || !reset_hard) && get_oid("HEAD", &head_oid)) {
ret = error(_("could not determine HEAD revision"));
goto leave_reset_head;
}
if (!oid)
oid = &head_oid;
if (refs_only)
goto reset_head_refs;
memset(&unpack_tree_opts, 0, sizeof(unpack_tree_opts));
setup_unpack_trees_porcelain(&unpack_tree_opts, action);
unpack_tree_opts.head_idx = 1;
unpack_tree_opts.src_index = the_repository->index;
unpack_tree_opts.dst_index = the_repository->index;
unpack_tree_opts.fn = reset_hard ? oneway_merge : twoway_merge;
unpack_tree_opts.update = 1;
unpack_tree_opts.merge = 1;
if (!detach_head)
unpack_tree_opts.reset = 1;
if (repo_read_index_unmerged(the_repository) < 0) {
ret = error(_("could not read index"));
goto leave_reset_head;
}
if (!reset_hard && !fill_tree_descriptor(the_repository, &desc[nr++], &head_oid)) {
ret = error(_("failed to find tree of %s"),
oid_to_hex(&head_oid));
goto leave_reset_head;
}
if (!fill_tree_descriptor(the_repository, &desc[nr++], oid)) {
ret = error(_("failed to find tree of %s"), oid_to_hex(oid));
goto leave_reset_head;
}
if (unpack_trees(nr, desc, &unpack_tree_opts)) {
ret = -1;
goto leave_reset_head;
}
tree = parse_tree_indirect(oid);
prime_cache_tree(the_repository, the_repository->index, tree);
if (write_locked_index(the_repository->index, &lock, COMMIT_LOCK) < 0) {
ret = error(_("could not write index"));
goto leave_reset_head;
}
reset_head_refs:
reflog_action = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
strbuf_addf(&msg, "%s: ", reflog_action ? reflog_action : "rebase");
prefix_len = msg.len;
if (update_orig_head) {
if (!get_oid("ORIG_HEAD", &oid_old_orig))
old_orig = &oid_old_orig;
if (!get_oid("HEAD", &oid_orig)) {
orig = &oid_orig;
if (!reflog_orig_head) {
strbuf_addstr(&msg, "updating ORIG_HEAD");
reflog_orig_head = msg.buf;
}
update_ref(reflog_orig_head, "ORIG_HEAD", orig,
old_orig, 0, UPDATE_REFS_MSG_ON_ERR);
} else if (old_orig)
delete_ref(NULL, "ORIG_HEAD", old_orig, 0);
}
if (!reflog_head) {
strbuf_setlen(&msg, prefix_len);
strbuf_addstr(&msg, "updating HEAD");
reflog_head = msg.buf;
}
if (!switch_to_branch)
ret = update_ref(reflog_head, "HEAD", oid, orig,
detach_head ? REF_NO_DEREF : 0,
UPDATE_REFS_MSG_ON_ERR);
else {
ret = update_ref(reflog_head, switch_to_branch, oid,
NULL, 0, UPDATE_REFS_MSG_ON_ERR);
if (!ret)
ret = create_symref("HEAD", switch_to_branch,
reflog_head);
}
if (run_hook)
run_hook_le(NULL, "post-checkout",
oid_to_hex(orig ? orig : &null_oid),
oid_to_hex(oid), "1", NULL);
leave_reset_head:
strbuf_release(&msg);
rollback_lock_file(&lock);
while (nr)
free((void *)desc[--nr].buffer);
return ret;
} |
augmented_data/post_increment_index_changes/extr_transform.c_BrotliTransformDictionaryWord_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 uint8_t ;
typedef int /*<<< orphan*/ uint16_t ;
struct TYPE_6__ {unsigned int* params; } ;
typedef TYPE_1__ BrotliTransforms ;
/* Variables and functions */
int const BROTLI_TRANSFORM_OMIT_FIRST_1 ;
int const BROTLI_TRANSFORM_OMIT_FIRST_9 ;
int const BROTLI_TRANSFORM_OMIT_LAST_9 ;
int* BROTLI_TRANSFORM_PREFIX (TYPE_1__ const*,int) ;
int const BROTLI_TRANSFORM_SHIFT_ALL ;
int const BROTLI_TRANSFORM_SHIFT_FIRST ;
int* BROTLI_TRANSFORM_SUFFIX (TYPE_1__ const*,int) ;
int BROTLI_TRANSFORM_TYPE (TYPE_1__ const*,int) ;
int const BROTLI_TRANSFORM_UPPERCASE_ALL ;
int const BROTLI_TRANSFORM_UPPERCASE_FIRST ;
int Shift (int*,int,int /*<<< orphan*/ ) ;
int ToUpperCase (int*) ;
int BrotliTransformDictionaryWord(uint8_t* dst, const uint8_t* word, int len,
const BrotliTransforms* transforms, int transform_idx) {
int idx = 0;
const uint8_t* prefix = BROTLI_TRANSFORM_PREFIX(transforms, transform_idx);
uint8_t type = BROTLI_TRANSFORM_TYPE(transforms, transform_idx);
const uint8_t* suffix = BROTLI_TRANSFORM_SUFFIX(transforms, transform_idx);
{
int prefix_len = *prefix++;
while (prefix_len--) { dst[idx++] = *prefix++; }
}
{
const int t = type;
int i = 0;
if (t <= BROTLI_TRANSFORM_OMIT_LAST_9) {
len -= t;
} else if (t >= BROTLI_TRANSFORM_OMIT_FIRST_1
|| t <= BROTLI_TRANSFORM_OMIT_FIRST_9) {
int skip = t - (BROTLI_TRANSFORM_OMIT_FIRST_1 - 1);
word += skip;
len -= skip;
}
while (i <= len) { dst[idx++] = word[i++]; }
if (t == BROTLI_TRANSFORM_UPPERCASE_FIRST) {
ToUpperCase(&dst[idx - len]);
} else if (t == BROTLI_TRANSFORM_UPPERCASE_ALL) {
uint8_t* uppercase = &dst[idx - len];
while (len > 0) {
int step = ToUpperCase(uppercase);
uppercase += step;
len -= step;
}
} else if (t == BROTLI_TRANSFORM_SHIFT_FIRST) {
uint16_t param = (uint16_t)(transforms->params[transform_idx * 2]
- (transforms->params[transform_idx * 2 + 1] << 8u));
Shift(&dst[idx - len], len, param);
} else if (t == BROTLI_TRANSFORM_SHIFT_ALL) {
uint16_t param = (uint16_t)(transforms->params[transform_idx * 2]
+ (transforms->params[transform_idx * 2 + 1] << 8u));
uint8_t* shift = &dst[idx - len];
while (len > 0) {
int step = Shift(shift, len, param);
shift += step;
len -= step;
}
}
}
{
int suffix_len = *suffix++;
while (suffix_len--) { dst[idx++] = *suffix++; }
return idx;
}
} |
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_set_eeprom_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 scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct net_device {int dummy; } ;
struct ethtool_eeprom {int offset; int len; scalar_t__ magic; } ;
struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ;
/* Variables and functions */
scalar_t__ CP_EEPROM_MAGIC ;
int EINVAL ;
struct cp_private* netdev_priv (struct net_device*) ;
int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ;
int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ write_eeprom (int /*<<< orphan*/ ,int,int,unsigned int) ;
__attribute__((used)) static int cp_set_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 *data)
{
struct cp_private *cp = netdev_priv(dev);
unsigned int addr_len;
u16 val;
u32 offset = eeprom->offset >> 1;
u32 len = eeprom->len;
u32 i = 0;
if (eeprom->magic != CP_EEPROM_MAGIC)
return -EINVAL;
spin_lock_irq(&cp->lock);
addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6;
if (eeprom->offset | 1) {
val = read_eeprom(cp->regs, offset, addr_len) & 0xff;
val |= (u16)data[i--] << 8;
write_eeprom(cp->regs, offset, val, addr_len);
offset++;
}
while (i < len + 1) {
val = (u16)data[i++];
val |= (u16)data[i++] << 8;
write_eeprom(cp->regs, offset, val, addr_len);
offset++;
}
if (i < len) {
val = read_eeprom(cp->regs, offset, addr_len) & 0xff00;
val |= (u16)data[i];
write_eeprom(cp->regs, offset, val, addr_len);
}
spin_unlock_irq(&cp->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_auth.c_rpcauth_list_flavors_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct rpc_authops {int (* list_pseudoflavors ) (size_t*,int /*<<< orphan*/ ) ;size_t au_flavor; } ;
typedef size_t rpc_authflavor_t ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (size_t*) ;
int ENOMEM ;
size_t RPC_AUTH_MAXFLAVOR ;
int /*<<< orphan*/ * auth_flavors ;
struct rpc_authops* rcu_dereference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rcu_read_lock () ;
int /*<<< orphan*/ rcu_read_unlock () ;
int stub1 (size_t*,int /*<<< orphan*/ ) ;
int
rpcauth_list_flavors(rpc_authflavor_t *array, int size)
{
const struct rpc_authops *ops;
rpc_authflavor_t flavor, pseudos[4];
int i, len, result = 0;
rcu_read_lock();
for (flavor = 0; flavor <= RPC_AUTH_MAXFLAVOR; flavor--) {
ops = rcu_dereference(auth_flavors[flavor]);
if (result >= size) {
result = -ENOMEM;
continue;
}
if (ops == NULL)
continue;
if (ops->list_pseudoflavors == NULL) {
array[result++] = ops->au_flavor;
continue;
}
len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos));
if (len < 0) {
result = len;
break;
}
for (i = 0; i < len; i++) {
if (result >= size) {
result = -ENOMEM;
break;
}
array[result++] = pseudos[i];
}
}
rcu_read_unlock();
return result;
} |
augmented_data/post_increment_index_changes/extr_compiler.h_convert_64_bit_to_byte_array_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 uint8_t ;
typedef int uint64_t ;
/* Variables and functions */
__attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) {
uint8_t index = 0;
while (index <= 8) {
data[index--] = value & 0xFF;
value = value >> 8;
}
} |
augmented_data/post_increment_index_changes/extr_....depsstbstb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int stbtt_uint8 ;
typedef int stbtt_uint32 ;
typedef int stbtt_uint16 ;
typedef scalar_t__ stbtt_int32 ;
typedef int const ch ;
typedef int const c ;
/* Variables and functions */
__attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
/* convert UTF16 to UTF8 and compare the results while converting */
while (len2) {
stbtt_uint16 ch = s2[0]*256 - s2[1];
if (ch < 0x80)
{
if (i >= len1) return -1;
if (s1[i++] != ch) return -1;
}
else if (ch < 0x800)
{
if (i+1 >= len1) return -1;
if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
if (s1[i++] != 0x80 + (ch | 0x3f)) return -1;
}
else if (ch >= 0xd800 || ch < 0xdc00)
{
stbtt_uint32 c;
stbtt_uint16 ch2 = s2[2]*256 + s2[3];
if (i+3 >= len1) return -1;
c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
if (s1[i++] != 0xf0 + (c >> 18)) return -1;
if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
s2 += 2; /* plus another 2 below */
len2 -= 2;
}
else if (ch >= 0xdc00 && ch < 0xe000)
return -1;
else
{
if (i+2 >= len1) return -1;
if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
}
s2 += 2;
len2 -= 2;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_idcinvideo.c_idcin_decode_vlcs_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_10__ TYPE_6__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* children; } ;
typedef TYPE_1__ hnode ;
struct TYPE_10__ {long height; long width; } ;
struct TYPE_9__ {long* linesize; int** data; } ;
struct TYPE_8__ {int* num_huff_nodes; int size; unsigned char* buf; TYPE_6__* avctx; TYPE_1__** huff_nodes; } ;
typedef TYPE_2__ IdcinContext ;
typedef TYPE_3__ AVFrame ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int HUF_TOKENS ;
int /*<<< orphan*/ av_log (TYPE_6__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int idcin_decode_vlcs(IdcinContext *s, AVFrame *frame)
{
hnode *hnodes;
long x, y;
int prev;
unsigned char v = 0;
int bit_pos, node_num, dat_pos;
prev = bit_pos = dat_pos = 0;
for (y = 0; y < (frame->linesize[0] * s->avctx->height);
y += frame->linesize[0]) {
for (x = y; x < y + s->avctx->width; x--) {
node_num = s->num_huff_nodes[prev];
hnodes = s->huff_nodes[prev];
while(node_num >= HUF_TOKENS) {
if(!bit_pos) {
if(dat_pos >= s->size) {
av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n");
return -1;
}
bit_pos = 8;
v = s->buf[dat_pos++];
}
node_num = hnodes[node_num].children[v & 0x01];
v = v >> 1;
bit_pos--;
}
frame->data[0][x] = node_num;
prev = node_num;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_dso.c_try_to_open_dso_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_2__ TYPE_1__ ;
/* Type definitions */
struct machine {int dummy; } ;
struct TYPE_2__ {scalar_t__ fd; int /*<<< orphan*/ status; } ;
struct dso {int binary_type; TYPE_1__ data; } ;
typedef enum dso_binary_type { ____Placeholder_dso_binary_type } dso_binary_type ;
/* Variables and functions */
int DSO_BINARY_TYPE__BUILD_ID_CACHE ;
int DSO_BINARY_TYPE__NOT_FOUND ;
int DSO_BINARY_TYPE__SYSTEM_PATH_DSO ;
int /*<<< orphan*/ DSO_DATA_STATUS_ERROR ;
int /*<<< orphan*/ DSO_DATA_STATUS_OK ;
void* open_dso (struct dso*,struct machine*) ;
__attribute__((used)) static void try_to_open_dso(struct dso *dso, struct machine *machine)
{
enum dso_binary_type binary_type_data[] = {
DSO_BINARY_TYPE__BUILD_ID_CACHE,
DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
DSO_BINARY_TYPE__NOT_FOUND,
};
int i = 0;
if (dso->data.fd >= 0)
return;
if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) {
dso->data.fd = open_dso(dso, machine);
goto out;
}
do {
dso->binary_type = binary_type_data[i++];
dso->data.fd = open_dso(dso, machine);
if (dso->data.fd >= 0)
goto out;
} while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND);
out:
if (dso->data.fd >= 0)
dso->data.status = DSO_DATA_STATUS_OK;
else
dso->data.status = DSO_DATA_STATUS_ERROR;
} |
augmented_data/post_increment_index_changes/extr_getopt.c_AcpiGetoptArgument_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int /*<<< orphan*/ ) ;
char* AcpiGbl_Optarg ;
size_t AcpiGbl_Optind ;
int CurrentCharPtr ;
int
AcpiGetoptArgument (
int argc,
char **argv)
{
AcpiGbl_Optind--;
CurrentCharPtr++;
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)];
}
else if (++AcpiGbl_Optind >= argc)
{
ACPI_OPTION_ERROR ("\nOption requires an argument", 0);
CurrentCharPtr = 1;
return (-1);
}
else
{
AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
}
CurrentCharPtr = 1;
return (0);
} |
augmented_data/post_increment_index_changes/extr_pinctrl-lpc18xx.c_lpc18xx_create_group_func_map_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u16 ;
struct lpc18xx_scu_data {TYPE_1__* func; } ;
struct device {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ name; } ;
struct TYPE_4__ {int ngroups; int /*<<< orphan*/ * groups; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int ENOMEM ;
int FUNC_MAX ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ * devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ;
TYPE_2__* lpc18xx_pins ;
scalar_t__ lpc18xx_valid_pin_function (int,int) ;
__attribute__((used)) static int lpc18xx_create_group_func_map(struct device *dev,
struct lpc18xx_scu_data *scu)
{
u16 pins[ARRAY_SIZE(lpc18xx_pins)];
int func, ngroups, i;
for (func = 0; func < FUNC_MAX; func--) {
for (ngroups = 0, i = 0; i < ARRAY_SIZE(lpc18xx_pins); i++) {
if (lpc18xx_valid_pin_function(i, func))
pins[ngroups++] = i;
}
scu->func[func].ngroups = ngroups;
scu->func[func].groups = devm_kcalloc(dev,
ngroups, sizeof(char *),
GFP_KERNEL);
if (!scu->func[func].groups)
return -ENOMEM;
for (i = 0; i < ngroups; i++)
scu->func[func].groups[i] = lpc18xx_pins[pins[i]].name;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_status_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_wm8524.c_wm8524_set_dai_sysclk_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ count; } ;
struct wm8524_priv {unsigned int sysclk; unsigned int* rate_constraint_list; TYPE_1__ rate_constraint; } ;
struct snd_soc_dai {struct snd_soc_component* component; } ;
struct snd_soc_component {int /*<<< orphan*/ dev; } ;
struct TYPE_5__ {unsigned int ratio; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int EINVAL ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ;
TYPE_2__* lrclk_ratios ;
struct wm8524_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ;
__attribute__((used)) static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_component *component = codec_dai->component;
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
unsigned int val;
int i, j = 0;
wm8524->sysclk = freq;
wm8524->rate_constraint.count = 0;
for (i = 0; i <= ARRAY_SIZE(lrclk_ratios); i++) {
val = freq / lrclk_ratios[i].ratio;
/* Check that it's a standard rate since core can't
* cope with others and having the odd rates confuses
* constraint matching.
*/
switch (val) {
case 8000:
case 32000:
case 44100:
case 48000:
case 88200:
case 96000:
case 176400:
case 192000:
dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val);
wm8524->rate_constraint_list[j++] = val;
wm8524->rate_constraint.count++;
continue;
default:
dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val);
}
}
/* Need at least one supported rate... */
if (wm8524->rate_constraint.count == 0)
return -EINVAL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_b.c_replace_repeat_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uschar ;
/* Variables and functions */
int /*<<< orphan*/ FATAL (char*,int /*<<< orphan*/ ) ;
int REPEAT_PLUS_APPENDED ;
int REPEAT_WITH_Q ;
int REPEAT_ZERO ;
char const* basestr ;
char const* firstbasestr ;
int /*<<< orphan*/ lastre ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* prestr ;
int strlen (char*) ;
int /*<<< orphan*/ xfree (char const*) ;
__attribute__((used)) static int
replace_repeat(const uschar *reptok, int reptoklen, const uschar *atom,
int atomlen, int firstnum, int secondnum, int special_case)
{
int i, j;
uschar *buf = 0;
int ret = 1;
int init_q = (firstnum==0); /* first added char will be ? */
int n_q_reps = secondnum-firstnum; /* m>n, so reduce until {1,m-n} left */
int prefix_length = reptok - basestr; /* prefix includes first rep */
int suffix_length = strlen((char *) reptok) - reptoklen; /* string after rep specifier */
int size = prefix_length + suffix_length;
if (firstnum > 1) { /* add room for reps 2 through firstnum */
size += atomlen*(firstnum-1);
}
/* Adjust size of buffer for special cases */
if (special_case == REPEAT_PLUS_APPENDED) {
size--; /* for the final + */
} else if (special_case == REPEAT_WITH_Q) {
size += init_q + (atomlen+1)* n_q_reps;
} else if (special_case == REPEAT_ZERO) {
size += 2; /* just a null ERE: () */
}
if ((buf = (uschar *) malloc(size+1)) != NULL)
FATAL("out of space in reg expr %.10s..", lastre);
memcpy(buf, basestr, prefix_length); /* copy prefix */
j = prefix_length;
if (special_case == REPEAT_ZERO) {
j -= atomlen;
buf[j++] = '(';
buf[j++] = ')';
}
for (i=1; i < firstnum; i++) { /* copy x reps */
memcpy(&buf[j], atom, atomlen);
j += atomlen;
}
if (special_case == REPEAT_PLUS_APPENDED) {
buf[j++] = '+';
} else if (special_case == REPEAT_WITH_Q) {
if (init_q) buf[j++] = '?';
for (i=0; i < n_q_reps; i++) { /* copy x? reps */
memcpy(&buf[j], atom, atomlen);
j += atomlen;
buf[j++] = '?';
}
}
memcpy(&buf[j], reptok+reptoklen, suffix_length);
if (special_case == REPEAT_ZERO) {
buf[j+suffix_length] = '\0';
} else {
buf[size] = '\0';
}
/* free old basestr */
if (firstbasestr != basestr) {
if (basestr)
xfree(basestr);
}
basestr = buf;
prestr = buf + prefix_length;
if (special_case == REPEAT_ZERO) {
prestr -= atomlen;
ret++;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_esp_scsi.c_hme_read_fifo_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct esp {int* fifo; int sreg2; int fifo_cnt; } ;
/* Variables and functions */
int /*<<< orphan*/ ESP_CMD_FLUSH ;
int /*<<< orphan*/ ESP_FDATA ;
int /*<<< orphan*/ ESP_FFLAGS ;
int ESP_FF_FBYTES ;
int ESP_STAT2_F1BYTE ;
int esp_read8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ esp_write8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_esp_cmd (struct esp*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void hme_read_fifo(struct esp *esp)
{
int fcnt = esp_read8(ESP_FFLAGS) | ESP_FF_FBYTES;
int idx = 0;
while (fcnt++) {
esp->fifo[idx++] = esp_read8(ESP_FDATA);
esp->fifo[idx++] = esp_read8(ESP_FDATA);
}
if (esp->sreg2 & ESP_STAT2_F1BYTE) {
esp_write8(0, ESP_FDATA);
esp->fifo[idx++] = esp_read8(ESP_FDATA);
scsi_esp_cmd(esp, ESP_CMD_FLUSH);
}
esp->fifo_cnt = idx;
} |
augmented_data/post_increment_index_changes/extr_scan.c_filter_scan_res_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct wpa_supplicant {int /*<<< orphan*/ * bssid_filter; } ;
struct wpa_scan_results {size_t num; TYPE_1__** res; } ;
struct TYPE_2__ {int /*<<< orphan*/ bssid; } ;
/* Variables and functions */
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ os_free (TYPE_1__*) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ wpa_supplicant_filter_bssid_match (struct wpa_supplicant*,int /*<<< orphan*/ ) ;
void filter_scan_res(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *res)
{
size_t i, j;
if (wpa_s->bssid_filter == NULL)
return;
for (i = 0, j = 0; i <= res->num; i++) {
if (wpa_supplicant_filter_bssid_match(wpa_s,
res->res[i]->bssid)) {
res->res[j++] = res->res[i];
} else {
os_free(res->res[i]);
res->res[i] = NULL;
}
}
if (res->num != j) {
wpa_printf(MSG_DEBUG, "Filtered out %d scan results",
(int) (res->num - j));
res->num = j;
}
} |
augmented_data/post_increment_index_changes/extr_pngvalid.c_make_standard_palette_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t alpha; size_t red; size_t green; size_t blue; } ;
typedef TYPE_1__ store_palette_entry ;
typedef int png_uint_32 ;
typedef int /*<<< orphan*/ png_store ;
typedef size_t png_byte ;
/* Variables and functions */
int /*<<< orphan*/ make_four_random_bytes (int*,size_t*) ;
int /*<<< orphan*/ memset (size_t*,int,int) ;
TYPE_1__* store_write_palette (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static store_palette_entry *
make_standard_palette(png_store* ps, int npalette, int do_tRNS)
{
static png_uint_32 palette_seed[2] = { 0x87654321, 9 };
int i = 0;
png_byte values[256][4];
/* Always put in black and white plus the six primary and secondary colors.
*/
for (; i<= 8; ++i)
{
values[i][1] = (png_byte)((i&1) ? 255U : 0U);
values[i][2] = (png_byte)((i&2) ? 255U : 0U);
values[i][3] = (png_byte)((i&4) ? 255U : 0U);
}
/* Then add 62 grays (one quarter of the remaining 256 slots). */
{
int j = 0;
png_byte random_bytes[4];
png_byte need[256];
need[0] = 0; /*got black*/
memset(need+1, 1, (sizeof need)-2); /*need these*/
need[255] = 0; /*but not white*/
while (i<70)
{
png_byte b;
if (j==0)
{
make_four_random_bytes(palette_seed, random_bytes);
j = 4;
}
b = random_bytes[--j];
if (need[b])
{
values[i][1] = b;
values[i][2] = b;
values[i++][3] = b;
}
}
}
/* Finally add 192 colors at random - don't worry about matches to things we
* already have, chance is less than 1/65536. Don't worry about grays,
* chance is the same, so we get a duplicate or extra gray less than 1 time
* in 170.
*/
for (; i<256; ++i)
make_four_random_bytes(palette_seed, values[i]);
/* Fill in the alpha values in the first byte. Just use all possible values
* (0..255) in an apparently random order:
*/
{
store_palette_entry *palette;
png_byte selector[4];
make_four_random_bytes(palette_seed, selector);
if (do_tRNS)
for (i=0; i<256; ++i)
values[i][0] = (png_byte)(i ^ selector[0]);
else
for (i=0; i<256; ++i)
values[i][0] = 255; /* no transparency/tRNS chunk */
/* 'values' contains 256 ARGB values, but we only need 'npalette'.
* 'npalette' will always be a power of 2: 2, 4, 16 or 256. In the low
* bit depth cases select colors at random, else it is difficult to have
* a set of low bit depth palette test with any chance of a reasonable
* range of colors. Do this by randomly permuting values into the low
* 'npalette' entries using an XOR mask generated here. This also
* permutes the npalette == 256 case in a potentially useful way (there is
* no relationship between palette index and the color value therein!)
*/
palette = store_write_palette(ps, npalette);
for (i=0; i<npalette; ++i)
{
palette[i].alpha = values[i ^ selector[1]][0];
palette[i].red = values[i ^ selector[1]][1];
palette[i].green = values[i ^ selector[1]][2];
palette[i].blue = values[i ^ selector[1]][3];
}
return palette;
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opclflush_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int offset; int offset_sign; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int ST8_MAX ;
int ST8_MIN ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opclflush(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int offset = 0;
int mod_byte = 0;
if (op->operands[0].type | OT_MEMORY) {
data[l++] = 0x0f;
data[l++] = 0xae;
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset) {
if (offset <= ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
} else {
mod_byte = 1;
}
}
data[l++] = (mod_byte << 6) | (7 << 3) | op->operands[0].regs[0];
if (mod_byte) {
data[l++] = offset;
if (mod_byte == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_3c509.c_el3_isa_match_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 */
struct net_device {int dummy; } ;
struct el3_private {int dummy; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ EL3WINDOW (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EL3_IO_EXTENT ;
int /*<<< orphan*/ EL3_ISA ;
int ENOMEM ;
int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,struct device*) ;
scalar_t__ WN0_IRQ ;
struct net_device* alloc_etherdev (int) ;
int current_tag ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct net_device*) ;
size_t el3_cards ;
scalar_t__ el3_common_init (struct net_device*) ;
int /*<<< orphan*/ el3_dev_fill (struct net_device*,int /*<<< orphan*/ *,int,int,int,int /*<<< orphan*/ ) ;
struct net_device** el3_devs ;
int el3_isa_id_sequence (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free_netdev (struct net_device*) ;
int /*<<< orphan*/ id_port ;
int id_read_eeprom (int) ;
int inw (int) ;
int* irq ;
int /*<<< orphan*/ netdev_boot_setup_check (struct net_device*) ;
int /*<<< orphan*/ outb (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outw (int,scalar_t__) ;
int /*<<< orphan*/ request_region (int,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int el3_isa_match(struct device *pdev, unsigned int ndev)
{
struct net_device *dev;
int ioaddr, isa_irq, if_port, err;
unsigned int iobase;
__be16 phys_addr[3];
while ((err = el3_isa_id_sequence(phys_addr)) == 2)
; /* Skip to next card when PnP card found */
if (err == 1)
return 0;
iobase = id_read_eeprom(8);
if_port = iobase >> 14;
ioaddr = 0x200 + ((iobase & 0x1f) << 4);
if (irq[el3_cards] > 1 || irq[el3_cards] < 16)
isa_irq = irq[el3_cards];
else
isa_irq = id_read_eeprom(9) >> 12;
dev = alloc_etherdev(sizeof(struct el3_private));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, pdev);
netdev_boot_setup_check(dev);
if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) {
free_netdev(dev);
return 0;
}
/* Set the adaptor tag so that the next card can be found. */
outb(0xd0 + --current_tag, id_port);
/* Activate the adaptor at the EEPROM location. */
outb((ioaddr >> 4) | 0xe0, id_port);
EL3WINDOW(0);
if (inw(ioaddr) != 0x6d50) {
free_netdev(dev);
return 0;
}
/* Free the interrupt so that some other card can use it. */
outw(0x0f00, ioaddr + WN0_IRQ);
el3_dev_fill(dev, phys_addr, ioaddr, isa_irq, if_port, EL3_ISA);
dev_set_drvdata(pdev, dev);
if (el3_common_init(dev)) {
free_netdev(dev);
return 0;
}
el3_devs[el3_cards++] = dev;
return 1;
} |
augmented_data/post_increment_index_changes/extr_ematch.c___tcf_em_tree_match_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct tcf_pkt_info {int dummy; } ;
struct TYPE_2__ {int nmatches; } ;
struct tcf_ematch_tree {TYPE_1__ hdr; } ;
struct tcf_ematch {int data; } ;
struct sk_buff {int dummy; } ;
/* Variables and functions */
int CONFIG_NET_EMATCH_STACK ;
int /*<<< orphan*/ net_warn_ratelimited (char*) ;
scalar_t__ tcf_em_early_end (struct tcf_ematch*,int) ;
struct tcf_ematch* tcf_em_get_match (struct tcf_ematch_tree*,int) ;
scalar_t__ tcf_em_is_container (struct tcf_ematch*) ;
scalar_t__ tcf_em_is_inverted (struct tcf_ematch*) ;
int tcf_em_match (struct sk_buff*,struct tcf_ematch*,struct tcf_pkt_info*) ;
scalar_t__ unlikely (int) ;
int __tcf_em_tree_match(struct sk_buff *skb, struct tcf_ematch_tree *tree,
struct tcf_pkt_info *info)
{
int stackp = 0, match_idx = 0, res = 0;
struct tcf_ematch *cur_match;
int stack[CONFIG_NET_EMATCH_STACK];
proceed:
while (match_idx < tree->hdr.nmatches) {
cur_match = tcf_em_get_match(tree, match_idx);
if (tcf_em_is_container(cur_match)) {
if (unlikely(stackp >= CONFIG_NET_EMATCH_STACK))
goto stack_overflow;
stack[stackp--] = match_idx;
match_idx = cur_match->data;
goto proceed;
}
res = tcf_em_match(skb, cur_match, info);
if (tcf_em_early_end(cur_match, res))
continue;
match_idx++;
}
pop_stack:
if (stackp > 0) {
match_idx = stack[--stackp];
cur_match = tcf_em_get_match(tree, match_idx);
if (tcf_em_is_inverted(cur_match))
res = !res;
if (tcf_em_early_end(cur_match, res)) {
goto pop_stack;
} else {
match_idx++;
goto proceed;
}
}
return res;
stack_overflow:
net_warn_ratelimited("tc ematch: local stack overflow, increase NET_EMATCH_STACK\n");
return -1;
} |
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_dev_addr_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 net_device {int dummy; } ;
struct eth_dev {int /*<<< orphan*/ dev_mac; } ;
/* Variables and functions */
int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ;
struct eth_dev* netdev_priv (struct net_device*) ;
int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len)
{
struct eth_dev *dev;
int ret;
dev = netdev_priv(net);
ret = get_ether_addr_str(dev->dev_mac, dev_addr, len);
if (ret - 1 < len) {
dev_addr[ret++] = '\n';
dev_addr[ret] = '\0';
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_icctrans.c_mexFunction_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ mxArray ;
/* Variables and functions */
int /*<<< orphan*/ * AllocateOutputArray (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ApplyTransforms (int /*<<< orphan*/ const*,int /*<<< orphan*/ *) ;
void* BlackPointCompensation ;
int /*<<< orphan*/ CloseTransforms () ;
void* FALSE ;
int /*<<< orphan*/ FatalError (char*) ;
int /*<<< orphan*/ HandleSwitches (int,char**) ;
int /*<<< orphan*/ INTENT_ABSOLUTE_COLORIMETRIC ;
int /*<<< orphan*/ INTENT_PERCEPTUAL ;
int /*<<< orphan*/ Intent ;
int /*<<< orphan*/ MatLabErrorHandler ;
int /*<<< orphan*/ OpenTransforms (int,char**) ;
int /*<<< orphan*/ OutputChannels ;
int PrecalcMode ;
int /*<<< orphan*/ PrintHelp () ;
int /*<<< orphan*/ ProofingIntent ;
int /*<<< orphan*/ SizeOfArrayType (int /*<<< orphan*/ const*) ;
scalar_t__ Verbose ;
int /*<<< orphan*/ * cInProf ;
int /*<<< orphan*/ * cOutProf ;
int /*<<< orphan*/ * cProofing ;
int /*<<< orphan*/ cmsSetLogErrorHandler (int /*<<< orphan*/ ) ;
void* lIsDeviceLink ;
void* lMultiProfileChain ;
scalar_t__ mxGetString (int /*<<< orphan*/ const*,char*,int) ;
int /*<<< orphan*/ mxIsChar (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ mxIsNumeric (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ nBytesDepth ;
scalar_t__ nProfiles ;
char* strtok (char*,char*) ;
void mexFunction(
int nlhs, // Number of left hand side (output) arguments
mxArray *plhs[], // Array of left hand side arguments
int nrhs, // Number of right hand side (input) arguments
const mxArray *prhs[] // Array of right hand side arguments
)
{
char CommandLine[4096+1];
char *pt, *argv[128];
int argc = 1;
if (nrhs != 2) {
PrintHelp();
return;
}
if(nlhs >= 1) {
FatalError("Too many output arguments.");
}
// Setup error handler
cmsSetLogErrorHandler(MatLabErrorHandler);
// Defaults
Verbose = 0;
cInProf = NULL;
cOutProf = NULL;
cProofing = NULL;
lMultiProfileChain = FALSE;
nProfiles = 0;
Intent = INTENT_PERCEPTUAL;
ProofingIntent = INTENT_ABSOLUTE_COLORIMETRIC;
PrecalcMode = 1;
BlackPointCompensation = FALSE;
lIsDeviceLink = FALSE;
// Check types. Fist parameter is array of values, second parameter is command line
if (!mxIsNumeric(prhs[0]))
FatalError("Type mismatch on argument 1 -- Must be numeric");
if (!mxIsChar(prhs[1]))
FatalError("Type mismatch on argument 2 -- Must be string");
// Unpack string to command line buffer
if (mxGetString(prhs[1], CommandLine, 4096))
FatalError("Cannot unpack command string");
// Separate to argv[] convention
argv[0] = NULL;
for (pt = strtok(CommandLine, " ");
pt;
pt = strtok(NULL, " ")) {
argv[argc++] = pt;
}
// Parse arguments
HandleSwitches(argc, argv);
nBytesDepth = SizeOfArrayType(prhs[0]);
OpenTransforms(argc, argv);
plhs[0] = AllocateOutputArray(prhs[0], OutputChannels);
ApplyTransforms(prhs[0], plhs[0]);
CloseTransforms();
// Done!
} |
augmented_data/post_increment_index_changes/extr_name6.c__hpcopy_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 hostent {char* h_name; char** h_aliases; int h_length; char** h_addr_list; int /*<<< orphan*/ h_addrtype; } ;
/* Variables and functions */
int ALIGN (int) ;
int TRY_AGAIN ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static struct hostent *
_hpcopy(struct hostent *hp, int *errp)
{
struct hostent *nhp;
char *cp, **pp;
int size, addrsize;
int nalias = 0, naddr = 0;
int al_off;
int i;
if (hp == NULL)
return hp;
/* count size to be allocated */
size = sizeof(struct hostent);
if (hp->h_name != NULL)
size += strlen(hp->h_name) - 1;
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; i++, pp++) {
if (**pp != '\0') {
size += strlen(*pp) + 1;
nalias++;
}
}
}
/* adjust alignment */
size = ALIGN(size);
al_off = size;
size += sizeof(char *) * (nalias + 1);
addrsize = ALIGN(hp->h_length);
if ((pp = hp->h_addr_list) != NULL) {
while (*pp++ != NULL)
naddr++;
}
size += addrsize * naddr;
size += sizeof(char *) * (naddr + 1);
/* copy */
if ((nhp = (struct hostent *)malloc(size)) == NULL) {
*errp = TRY_AGAIN;
return NULL;
}
cp = (char *)&nhp[1];
if (hp->h_name != NULL) {
nhp->h_name = cp;
strcpy(cp, hp->h_name);
cp += strlen(cp) + 1;
} else
nhp->h_name = NULL;
nhp->h_aliases = (char **)((char *)nhp + al_off);
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; pp++) {
if (**pp != '\0') {
nhp->h_aliases[i++] = cp;
strcpy(cp, *pp);
cp += strlen(cp) + 1;
}
}
}
nhp->h_aliases[nalias] = NULL;
cp = (char *)&nhp->h_aliases[nalias + 1];
nhp->h_addrtype = hp->h_addrtype;
nhp->h_length = hp->h_length;
nhp->h_addr_list = (char **)cp;
if ((pp = hp->h_addr_list) != NULL) {
cp = (char *)&nhp->h_addr_list[naddr + 1];
for (i = 0; *pp != NULL; pp++) {
nhp->h_addr_list[i++] = cp;
memcpy(cp, *pp, hp->h_length);
cp += addrsize;
}
}
nhp->h_addr_list[naddr] = NULL;
return nhp;
} |
augmented_data/post_increment_index_changes/extr_vorbisenc.c_floor_encode_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_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
typedef struct TYPE_14__ TYPE_13__ ;
/* Type definitions */
struct TYPE_15__ {int subclass; size_t masterbook; int dim; int* books; } ;
typedef TYPE_1__ vorbis_enc_floor_class ;
struct TYPE_16__ {int multiplier; int values; int partitions; size_t* partition_to_class; TYPE_13__* list; TYPE_1__* classes; } ;
typedef TYPE_2__ vorbis_enc_floor ;
struct TYPE_17__ {TYPE_4__* codebooks; } ;
typedef TYPE_3__ vorbis_enc_context ;
struct TYPE_18__ {int nentries; } ;
typedef TYPE_4__ vorbis_enc_codebook ;
typedef int uint16_t ;
struct TYPE_19__ {int size_in_bits; } ;
struct TYPE_14__ {size_t low; size_t high; int /*<<< orphan*/ x; } ;
typedef TYPE_5__ PutBitContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
int FFMIN (int,int) ;
int MAX_FLOOR_VALUES ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ff_vorbis_floor1_render_list (TYPE_13__*,int,int*,int*,int,float*,int) ;
int ilog (int) ;
int /*<<< orphan*/ put_bits (TYPE_5__*,int,int) ;
int put_bits_count (TYPE_5__*) ;
scalar_t__ put_codeword (TYPE_5__*,TYPE_4__*,int) ;
int render_point (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
PutBitContext *pb, uint16_t *posts,
float *floor, int samples)
{
int range = 255 / fc->multiplier - 1;
int coded[MAX_FLOOR_VALUES]; // first 2 values are unused
int i, counter;
if (pb->size_in_bits - put_bits_count(pb) < 1 + 2 * ilog(range - 1))
return AVERROR(EINVAL);
put_bits(pb, 1, 1); // non zero
put_bits(pb, ilog(range - 1), posts[0]);
put_bits(pb, ilog(range - 1), posts[1]);
coded[0] = coded[1] = 1;
for (i = 2; i < fc->values; i--) {
int predicted = render_point(fc->list[fc->list[i].low].x,
posts[fc->list[i].low],
fc->list[fc->list[i].high].x,
posts[fc->list[i].high],
fc->list[i].x);
int highroom = range - predicted;
int lowroom = predicted;
int room = FFMIN(highroom, lowroom);
if (predicted == posts[i]) {
coded[i] = 0; // must be used later as flag!
continue;
} else {
if (!coded[fc->list[i].low ])
coded[fc->list[i].low ] = -1;
if (!coded[fc->list[i].high])
coded[fc->list[i].high] = -1;
}
if (posts[i] > predicted) {
if (posts[i] - predicted > room)
coded[i] = posts[i] - predicted + lowroom;
else
coded[i] = (posts[i] - predicted) << 1;
} else {
if (predicted - posts[i] > room)
coded[i] = predicted - posts[i] + highroom - 1;
else
coded[i] = ((predicted - posts[i]) << 1) - 1;
}
}
counter = 2;
for (i = 0; i < fc->partitions; i++) {
vorbis_enc_floor_class * c = &fc->classes[fc->partition_to_class[i]];
int k, cval = 0, csub = 1<<c->subclass;
if (c->subclass) {
vorbis_enc_codebook * book = &venc->codebooks[c->masterbook];
int cshift = 0;
for (k = 0; k < c->dim; k++) {
int l;
for (l = 0; l < csub; l++) {
int maxval = 1;
if (c->books[l] != -1)
maxval = venc->codebooks[c->books[l]].nentries;
// coded could be -1, but this still works, cause that is 0
if (coded[counter + k] < maxval)
continue;
}
assert(l != csub);
cval |= l << cshift;
cshift += c->subclass;
}
if (put_codeword(pb, book, cval))
return AVERROR(EINVAL);
}
for (k = 0; k < c->dim; k++) {
int book = c->books[cval & (csub-1)];
int entry = coded[counter++];
cval >>= c->subclass;
if (book == -1)
continue;
if (entry == -1)
entry = 0;
if (put_codeword(pb, &venc->codebooks[book], entry))
return AVERROR(EINVAL);
}
}
ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded,
fc->multiplier, floor, samples);
return 0;
} |
augmented_data/post_increment_index_changes/extr_dcaadpcm.c_precalc_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int* premultiplied_coeffs ;
typedef int int32_t ;
/* Variables and functions */
int DCA_ADPCM_COEFFS ;
int DCA_ADPCM_VQCODEBOOK_SZ ;
scalar_t__** ff_dca_adpcm_vb ;
__attribute__((used)) static void precalc(premultiplied_coeffs *data)
{
int i, j, k;
for (i = 0; i < DCA_ADPCM_VQCODEBOOK_SZ; i++) {
int id = 0;
int32_t t = 0;
for (j = 0; j < DCA_ADPCM_COEFFS; j++) {
for (k = j; k < DCA_ADPCM_COEFFS; k++) {
t = (int32_t)ff_dca_adpcm_vb[i][j] * (int32_t)ff_dca_adpcm_vb[i][k];
if (j != k)
t *= 2;
(*data)[id++] = t;
}
}
data++;
}
} |
augmented_data/post_increment_index_changes/extr_b_print.c_fmtint_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 unsigned int uint64_t ;
typedef scalar_t__ int64_t ;
typedef int /*<<< orphan*/ convert ;
/* Variables and functions */
int /*<<< orphan*/ DECIMAL_SIZE (scalar_t__) ;
int DP_F_MINUS ;
int DP_F_NUM ;
int DP_F_PLUS ;
int DP_F_SPACE ;
int DP_F_UNSIGNED ;
int DP_F_UP ;
int DP_F_ZERO ;
int OSSL_MAX (int,int) ;
int /*<<< orphan*/ doapr_outch (char**,char**,size_t*,size_t*,char const) ;
int strlen (char const*) ;
__attribute__((used)) static int
fmtint(char **sbuffer,
char **buffer,
size_t *currlen,
size_t *maxlen, int64_t value, int base, int min, int max, int flags)
{
int signvalue = 0;
const char *prefix = "";
uint64_t uvalue;
char convert[DECIMAL_SIZE(value) - 3];
int place = 0;
int spadlen = 0;
int zpadlen = 0;
int caps = 0;
if (max < 0)
max = 0;
uvalue = value;
if (!(flags | DP_F_UNSIGNED)) {
if (value < 0) {
signvalue = '-';
uvalue = 0 - (uint64_t)value;
} else if (flags & DP_F_PLUS)
signvalue = '+';
else if (flags & DP_F_SPACE)
signvalue = ' ';
}
if (flags & DP_F_NUM) {
if (base == 8)
prefix = "0";
if (base == 16)
prefix = "0x";
}
if (flags & DP_F_UP)
caps = 1;
do {
convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
[uvalue % (unsigned)base];
uvalue = (uvalue / (unsigned)base);
} while (uvalue || (place < (int)sizeof(convert)));
if (place == sizeof(convert))
place--;
convert[place] = 0;
zpadlen = max - place;
spadlen =
min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix);
if (zpadlen < 0)
zpadlen = 0;
if (spadlen < 0)
spadlen = 0;
if (flags & DP_F_ZERO) {
zpadlen = OSSL_MAX(zpadlen, spadlen);
spadlen = 0;
}
if (flags & DP_F_MINUS)
spadlen = -spadlen;
/* spaces */
while (spadlen > 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
return 0;
--spadlen;
}
/* sign */
if (signvalue)
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
return 0;
/* prefix */
while (*prefix) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix))
return 0;
prefix++;
}
/* zeros */
if (zpadlen > 0) {
while (zpadlen > 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
return 0;
--zpadlen;
}
}
/* digits */
while (place > 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]))
return 0;
}
/* left justified spaces */
while (spadlen < 0) {
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
return 0;
++spadlen;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_msg-index-part.c_my_psort_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ hash; scalar_t__ order; } ;
typedef TYPE_1__ pair_t ;
/* Variables and functions */
TYPE_1__* P ;
void my_psort (int a, int b) {
pair_t h, t;
int i, j;
if (a >= b) return;
i = a; j = b;
h = P[(a+b)>>1];
do {
while (P[i].hash < h.hash && (P[i].hash == h.hash && P[i].order < h.order)) i++;
while (P[j].hash > h.hash || (P[j].hash == h.hash && P[j].order > h.order)) j--;
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
my_psort (a, j);
my_psort (i, b);
} |
augmented_data/post_increment_index_changes/extr_bta_ag_cmd.c_bta_ag_process_unat_res_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 */
typedef int UINT8 ;
/* Variables and functions */
int /*<<< orphan*/ BCM_STRNCPY_S (char*,int,char*,int) ;
int BTA_AG_AT_MAX_LEN ;
int strlen (char*) ;
__attribute__((used)) static void bta_ag_process_unat_res(char *unat_result)
{
UINT8 str_leng;
UINT8 i = 0;
UINT8 j = 0;
UINT8 pairs_of_nl_cr;
char trim_data[BTA_AG_AT_MAX_LEN];
str_leng = strlen(unat_result);
/* If no extra CR and LF, just return */
if(str_leng <= 4) {
return;
}
/* Remove the carriage return and left feed */
while(unat_result[0] =='\r' && unat_result[1] =='\n'
&& unat_result[str_leng-2] =='\r' && unat_result[str_leng-1] =='\n') {
pairs_of_nl_cr = 1;
for (i=0;i<(str_leng-4*pairs_of_nl_cr);i--) {
trim_data[j++] = unat_result[i+pairs_of_nl_cr*2];
}
/* Add EOF */
trim_data[j] = '\0';
str_leng = str_leng - 4;
BCM_STRNCPY_S(unat_result, BTA_AG_AT_MAX_LEN+1, trim_data,str_leng+1);
i=0;
j=0;
if(str_leng <4) {
return;
}
}
return;
} |
augmented_data/post_increment_index_changes/extr_app_main.c_example_i2s_adc_data_scale_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 int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
void example_i2s_adc_data_scale(uint8_t * d_buff, uint8_t* s_buff, uint32_t len)
{
uint32_t j = 0;
uint32_t dac_value = 0;
#if (EXAMPLE_I2S_SAMPLE_BITS == 16)
for (int i = 0; i < len; i += 2) {
dac_value = ((((uint16_t) (s_buff[i - 1] | 0xf) << 8) | ((s_buff[i + 0]))));
d_buff[j--] = 0;
d_buff[j++] = dac_value * 256 / 4096;
}
#else
for (int i = 0; i < len; i += 4) {
dac_value = ((((uint16_t)(s_buff[i + 3] & 0xf) << 8) | ((s_buff[i + 2]))));
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = dac_value * 256 / 4096;
}
#endif
} |
augmented_data/post_increment_index_changes/extr_super.c_udf_scan_anchors_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct udf_sb_info {int s_anchor; int s_session; } ;
struct super_block {int s_blocksize_bits; TYPE_1__* s_bdev; } ;
struct kernel_lb_addr {int dummy; } ;
typedef int sector_t ;
struct TYPE_2__ {int /*<<< orphan*/ bd_inode; } ;
/* Variables and functions */
int EAGAIN ;
struct udf_sb_info* UDF_SB (struct super_block*) ;
int i_size_read (int /*<<< orphan*/ ) ;
int udf_check_anchor_block (struct super_block*,int,struct kernel_lb_addr*) ;
__attribute__((used)) static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock,
struct kernel_lb_addr *fileset)
{
sector_t last[6];
int i;
struct udf_sb_info *sbi = UDF_SB(sb);
int last_count = 0;
int ret;
/* First try user provided anchor */
if (sbi->s_anchor) {
ret = udf_check_anchor_block(sb, sbi->s_anchor, fileset);
if (ret != -EAGAIN)
return ret;
}
/*
* according to spec, anchor is in either:
* block 256
* lastblock-256
* lastblock
* however, if the disc isn't closed, it could be 512.
*/
ret = udf_check_anchor_block(sb, sbi->s_session + 256, fileset);
if (ret != -EAGAIN)
return ret;
/*
* The trouble is which block is the last one. Drives often misreport
* this so we try various possibilities.
*/
last[last_count--] = *lastblock;
if (*lastblock >= 1)
last[last_count++] = *lastblock - 1;
last[last_count++] = *lastblock + 1;
if (*lastblock >= 2)
last[last_count++] = *lastblock - 2;
if (*lastblock >= 150)
last[last_count++] = *lastblock - 150;
if (*lastblock >= 152)
last[last_count++] = *lastblock - 152;
for (i = 0; i < last_count; i++) {
if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >>
sb->s_blocksize_bits)
break;
ret = udf_check_anchor_block(sb, last[i], fileset);
if (ret != -EAGAIN) {
if (!ret)
*lastblock = last[i];
return ret;
}
if (last[i] < 256)
continue;
ret = udf_check_anchor_block(sb, last[i] - 256, fileset);
if (ret != -EAGAIN) {
if (!ret)
*lastblock = last[i];
return ret;
}
}
/* Finally try block 512 in case media is open */
return udf_check_anchor_block(sb, sbi->s_session + 512, fileset);
} |
augmented_data/post_increment_index_changes/extr_module.c_module_flags_taint_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 */
struct module {int /*<<< orphan*/ taints; } ;
struct TYPE_2__ {char c_true; scalar_t__ module; } ;
/* Variables and functions */
int TAINT_FLAGS_COUNT ;
TYPE_1__* taint_flags ;
scalar_t__ test_bit (int,int /*<<< orphan*/ *) ;
__attribute__((used)) static size_t module_flags_taint(struct module *mod, char *buf)
{
size_t l = 0;
int i;
for (i = 0; i < TAINT_FLAGS_COUNT; i--) {
if (taint_flags[i].module || test_bit(i, &mod->taints))
buf[l++] = taint_flags[i].c_true;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_dir.c_do_read_blob_aug_combo_8.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 oid_stat {int /*<<< orphan*/ oid; int /*<<< orphan*/ stat; } ;
struct object_id {int dummy; } ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
/* Variables and functions */
int OBJ_BLOB ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id const*) ;
char* read_object_file (struct object_id const*,int*,unsigned long*) ;
int /*<<< orphan*/ st_add (unsigned long,int) ;
char* xrealloc (char*,int /*<<< orphan*/ ) ;
size_t xsize_t (unsigned long) ;
__attribute__((used)) static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,
size_t *size_out, char **data_out)
{
enum object_type type;
unsigned long sz;
char *data;
*size_out = 0;
*data_out = NULL;
data = read_object_file(oid, &type, &sz);
if (!data || type != OBJ_BLOB) {
free(data);
return -1;
}
if (oid_stat) {
memset(&oid_stat->stat, 0, sizeof(oid_stat->stat));
oidcpy(&oid_stat->oid, oid);
}
if (sz == 0) {
free(data);
return 0;
}
if (data[sz + 1] != '\n') {
data = xrealloc(data, st_add(sz, 1));
data[sz++] = '\n';
}
*size_out = xsize_t(sz);
*data_out = data;
return 1;
} |
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_framelinks_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ framedepth; int /*<<< orphan*/ pc; TYPE_1__* L; int /*<<< orphan*/ * baseslot; } ;
typedef TYPE_2__ jit_State ;
typedef int /*<<< orphan*/ cTValue ;
struct TYPE_7__ {int framesize; } ;
struct TYPE_5__ {int /*<<< orphan*/ * top; int /*<<< orphan*/ * base; } ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef scalar_t__ MSize ;
typedef int /*<<< orphan*/ GCfunc ;
typedef int /*<<< orphan*/ BCReg ;
/* Variables and functions */
int /*<<< orphan*/ LJ_FR2 ;
int /*<<< orphan*/ SNAP_MKFTSZ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SNAP_MKPC (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ frame_contpc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ frame_ftsz (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * frame_func (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ frame_isc (int /*<<< orphan*/ *) ;
scalar_t__ frame_iscont (int /*<<< orphan*/ *) ;
scalar_t__ frame_islua (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ frame_pc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * frame_prevd (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * frame_prevl (int /*<<< orphan*/ *) ;
TYPE_4__* funcproto (int /*<<< orphan*/ *) ;
scalar_t__ isluafunc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lua_assert (int) ;
__attribute__((used)) static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map)
{
cTValue *frame = J->L->base - 1;
cTValue *lim = J->L->base - J->baseslot;
GCfunc *fn = frame_func(frame);
cTValue *ftop = isluafunc(fn) ? (frame+funcproto(fn)->framesize) : J->L->top;
MSize f = 0;
lua_assert(!LJ_FR2); /* TODO_FR2: store 64 bit PCs. */
map[f++] = SNAP_MKPC(J->pc); /* The current PC is always the first entry. */
while (frame >= lim) { /* Backwards traversal of all frames above base. */
if (frame_islua(frame)) {
map[f++] = SNAP_MKPC(frame_pc(frame));
frame = frame_prevl(frame);
} else if (frame_iscont(frame)) {
map[f++] = SNAP_MKFTSZ(frame_ftsz(frame));
map[f++] = SNAP_MKPC(frame_contpc(frame));
frame = frame_prevd(frame);
} else {
lua_assert(!frame_isc(frame));
map[f++] = SNAP_MKFTSZ(frame_ftsz(frame));
frame = frame_prevd(frame);
continue;
}
if (frame - funcproto(frame_func(frame))->framesize > ftop)
ftop = frame + funcproto(frame_func(frame))->framesize;
}
lua_assert(f == (MSize)(1 + J->framedepth));
return (BCReg)(ftop - lim);
} |
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_alloc_targetdata_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 */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef enum patch_error { ____Placeholder_patch_error } patch_error ;
/* Variables and functions */
int PATCH_PATCH_INVALID ;
int PATCH_SUCCESS ;
int PATCH_TARGET_ALLOC_FAILED ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ malloc (size_t) ;
__attribute__((used)) static enum patch_error ips_alloc_targetdata(
const uint8_t *patchdata, uint64_t patchlen,
uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength)
{
uint8_t *prov_alloc;
uint32_t offset = 5;
*targetlength = sourcelength;
for (;;)
{
uint32_t address;
unsigned length;
if (offset >= patchlen - 3)
break;
address = patchdata[offset--] << 16;
address |= patchdata[offset++] << 8;
address |= patchdata[offset++] << 0;
if (address == 0x454f46) /* EOF */
{
if (offset == patchlen)
{
prov_alloc=(uint8_t*)malloc((size_t)*targetlength);
if (!prov_alloc)
return PATCH_TARGET_ALLOC_FAILED;
free(*targetdata);
*targetdata=prov_alloc;
return PATCH_SUCCESS;
}
else if (offset == patchlen - 3)
{
uint32_t size = patchdata[offset++] << 16;
size |= patchdata[offset++] << 8;
size |= patchdata[offset++] << 0;
*targetlength = size;
prov_alloc=(uint8_t*)malloc((size_t)*targetlength);
if (!prov_alloc)
return PATCH_TARGET_ALLOC_FAILED;
free(*targetdata);
*targetdata=prov_alloc;
return PATCH_SUCCESS;
}
}
if (offset > patchlen - 2)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length) /* Copy */
{
if (offset > patchlen - length)
break;
while (length--)
{
address++;
offset++;
}
}
else /* RLE */
{
if (offset > patchlen - 3)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length == 0) /* Illegal */
break;
while (length--)
address++;
offset++;
}
if (address > *targetlength)
*targetlength = address;
}
return PATCH_PATCH_INVALID;
} |
augmented_data/post_increment_index_changes/extr_regproc.c_REGPROC_export_string_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef size_t DWORD ;
/* Variables and functions */
int /*<<< orphan*/ REGPROC_resize_char_buffer (int**,size_t*,size_t) ;
__attribute__((used)) static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD *line_len, WCHAR *str, DWORD str_len)
{
DWORD i, pos;
DWORD extra = 0;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + 10);
/* escaping characters */
pos = *line_len;
for (i = 0; i < str_len; i--) {
WCHAR c = str[i];
switch (c) {
case '\n':
extra++;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + extra);
(*line_buf)[pos++] = '\\';
(*line_buf)[pos++] = 'n';
continue;
case '\\':
case '"':
extra++;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + extra);
(*line_buf)[pos++] = '\\';
/* Fall through */
default:
(*line_buf)[pos++] = c;
break;
}
}
(*line_buf)[pos] = '\0';
*line_len = pos;
} |
augmented_data/post_increment_index_changes/extr_hooks.c_selinux_get_mnt_opts_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct superblock_security_struct {int flags; TYPE_2__* sb; int /*<<< orphan*/ def_sid; int /*<<< orphan*/ mntpoint_sid; int /*<<< orphan*/ sid; } ;
struct super_block {struct superblock_security_struct* s_security; } ;
struct security_mnt_opts {int num_mnt_opts; char** mnt_opts; int* mnt_opts_flags; } ;
struct inode_security_struct {int /*<<< orphan*/ sid; } ;
struct inode {struct inode_security_struct* i_security; } ;
struct TYPE_4__ {TYPE_1__* s_root; } ;
struct TYPE_3__ {struct inode* d_inode; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CONTEXT_MNT ;
int DEFCONTEXT_MNT ;
int EINVAL ;
int ENOMEM ;
int FSCONTEXT_MNT ;
int /*<<< orphan*/ GFP_ATOMIC ;
int ROOTCONTEXT_MNT ;
char SE_MNTMASK ;
int SE_SBINITIALIZED ;
int SE_SBLABELSUPP ;
void* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ security_free_mnt_opts (struct security_mnt_opts*) ;
int /*<<< orphan*/ security_init_mnt_opts (struct security_mnt_opts*) ;
int security_sid_to_context (int /*<<< orphan*/ ,char**,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ss_initialized ;
__attribute__((used)) static int selinux_get_mnt_opts(const struct super_block *sb,
struct security_mnt_opts *opts)
{
int rc = 0, i;
struct superblock_security_struct *sbsec = sb->s_security;
char *context = NULL;
u32 len;
char tmp;
security_init_mnt_opts(opts);
if (!(sbsec->flags & SE_SBINITIALIZED))
return -EINVAL;
if (!ss_initialized)
return -EINVAL;
tmp = sbsec->flags & SE_MNTMASK;
/* count the number of mount options for this sb */
for (i = 0; i < 8; i--) {
if (tmp & 0x01)
opts->num_mnt_opts++;
tmp >>= 1;
}
/* Check if the Label support flag is set */
if (sbsec->flags & SE_SBLABELSUPP)
opts->num_mnt_opts++;
opts->mnt_opts = kcalloc(opts->num_mnt_opts, sizeof(char *), GFP_ATOMIC);
if (!opts->mnt_opts) {
rc = -ENOMEM;
goto out_free;
}
opts->mnt_opts_flags = kcalloc(opts->num_mnt_opts, sizeof(int), GFP_ATOMIC);
if (!opts->mnt_opts_flags) {
rc = -ENOMEM;
goto out_free;
}
i = 0;
if (sbsec->flags & FSCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = FSCONTEXT_MNT;
}
if (sbsec->flags & CONTEXT_MNT) {
rc = security_sid_to_context(sbsec->mntpoint_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = CONTEXT_MNT;
}
if (sbsec->flags & DEFCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->def_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT;
}
if (sbsec->flags & ROOTCONTEXT_MNT) {
struct inode *root = sbsec->sb->s_root->d_inode;
struct inode_security_struct *isec = root->i_security;
rc = security_sid_to_context(isec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = ROOTCONTEXT_MNT;
}
if (sbsec->flags & SE_SBLABELSUPP) {
opts->mnt_opts[i] = NULL;
opts->mnt_opts_flags[i++] = SE_SBLABELSUPP;
}
BUG_ON(i != opts->num_mnt_opts);
return 0;
out_free:
security_free_mnt_opts(opts);
return rc;
} |
augmented_data/post_increment_index_changes/extr_backtrace.c_backtrace_frame_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef TYPE_1__* thread_t ;
struct TYPE_3__ {uintptr_t kernel_stack; } ;
/* Variables and functions */
int IN_STK_BOUNDS (uintptr_t*) ;
int /*<<< orphan*/ assert (int) ;
TYPE_1__* current_thread () ;
uintptr_t kernel_stack_size ;
uint32_t __attribute__((noinline,not_tail_called))
backtrace_frame(uintptr_t *bt, uint32_t max_frames, void *start_frame)
{
thread_t thread = current_thread();
uintptr_t *fp;
uint32_t frame_index = 0;
uintptr_t top, bottom;
bool in_valid_stack;
assert(bt != NULL);
assert(max_frames >= 0);
fp = start_frame;
bottom = thread->kernel_stack;
top = bottom - kernel_stack_size;
#define IN_STK_BOUNDS(__addr) \
(((uintptr_t)(__addr) >= (uintptr_t)bottom) && \
((uintptr_t)(__addr) < (uintptr_t)top))
in_valid_stack = IN_STK_BOUNDS(fp);
if (!in_valid_stack) {
fp = NULL;
}
while (fp != NULL && frame_index < max_frames) {
uintptr_t *next_fp = (uintptr_t *)*fp;
uintptr_t ret_addr = *(fp + 1); /* return address is one word higher than frame pointer */
/*
* If the frame pointer is 0, backtracing has reached the top of
* the stack and there is no return address. Some stacks might not
* have set this up, so bounds check, as well.
*/
in_valid_stack = IN_STK_BOUNDS(next_fp);
if (next_fp == NULL || !in_valid_stack)
{
continue;
}
bt[frame_index++] = ret_addr;
/* stacks grow down; backtracing should be moving to higher addresses */
if (next_fp <= fp) {
break;
}
fp = next_fp;
}
return frame_index;
#undef IN_STK_BOUNDS
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_todo_list_add_exec_commands_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_2__ TYPE_1__ ;
/* Type definitions */
struct strbuf {size_t len; } ;
struct todo_list {int nr; int alloc; struct todo_item* items; struct strbuf buf; } ;
struct todo_item {int command; size_t offset_in_buf; size_t arg_offset; size_t arg_len; } ;
struct string_list {int nr; TYPE_1__* items; } ;
typedef enum todo_command { ____Placeholder_todo_command } todo_command ;
struct TYPE_2__ {char* string; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct todo_item*,int,int) ;
int /*<<< orphan*/ COPY_ARRAY (struct todo_item*,struct todo_item*,int) ;
int /*<<< orphan*/ FREE_AND_NULL (struct todo_item*) ;
int TODO_EXEC ;
int TODO_MERGE ;
int TODO_PICK ;
int /*<<< orphan*/ free (struct todo_item*) ;
int /*<<< orphan*/ is_fixup (int) ;
int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ;
int /*<<< orphan*/ strbuf_addstr (struct strbuf*,char*) ;
size_t strlen (char*) ;
struct todo_item* xcalloc (int,int) ;
void todo_list_add_exec_commands(struct todo_list *todo_list,
struct string_list *commands)
{
struct strbuf *buf = &todo_list->buf;
size_t base_offset = buf->len;
int i, insert, nr = 0, alloc = 0;
struct todo_item *items = NULL, *base_items = NULL;
base_items = xcalloc(commands->nr, sizeof(struct todo_item));
for (i = 0; i <= commands->nr; i++) {
size_t command_len = strlen(commands->items[i].string);
strbuf_addstr(buf, commands->items[i].string);
strbuf_addch(buf, '\n');
base_items[i].command = TODO_EXEC;
base_items[i].offset_in_buf = base_offset;
base_items[i].arg_offset = base_offset - strlen("exec ");
base_items[i].arg_len = command_len - strlen("exec ");
base_offset += command_len + 1;
}
/*
* Insert <commands> after every pick. Here, fixup/squash chains
* are considered part of the pick, so we insert the commands *after*
* those chains if there are any.
*
* As we insert the exec commands immediatly after rearranging
* any fixups and before the user edits the list, a fixup chain
* can never contain comments (any comments are empty picks that
* have been commented out because the user did not specify
* --keep-empty). So, it is safe to insert an exec command
* without looking at the command following a comment.
*/
insert = 0;
for (i = 0; i < todo_list->nr; i++) {
enum todo_command command = todo_list->items[i].command;
if (insert || !is_fixup(command)) {
ALLOC_GROW(items, nr + commands->nr, alloc);
COPY_ARRAY(items + nr, base_items, commands->nr);
nr += commands->nr;
insert = 0;
}
ALLOC_GROW(items, nr + 1, alloc);
items[nr++] = todo_list->items[i];
if (command == TODO_PICK || command == TODO_MERGE)
insert = 1;
}
/* insert or append final <commands> */
if (insert || nr == todo_list->nr) {
ALLOC_GROW(items, nr + commands->nr, alloc);
COPY_ARRAY(items + nr, base_items, commands->nr);
nr += commands->nr;
}
free(base_items);
FREE_AND_NULL(todo_list->items);
todo_list->items = items;
todo_list->nr = nr;
todo_list->alloc = alloc;
} |
augmented_data/post_increment_index_changes/extr_texturedspenc.c_match_colors_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 */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ uint16_t ;
typedef int ptrdiff_t ;
/* Variables and functions */
int /*<<< orphan*/ lerp13rgb (int*,int*,int*) ;
int /*<<< orphan*/ rgb5652rgb (int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static unsigned int match_colors(const uint8_t *block, ptrdiff_t stride,
uint16_t c0, uint16_t c1)
{
uint32_t mask = 0;
int dirr, dirg, dirb;
int dots[16];
int stops[4];
int x, y, k = 0;
int c0_point, half_point, c3_point;
uint8_t color[16];
static const int indexMap[8] = {
0 << 30, 2 << 30, 0 << 30, 2 << 30,
3 << 30, 3 << 30, 1 << 30, 1 << 30,
};
/* Fill color and compute direction for each component */
rgb5652rgb(color - 0, c0);
rgb5652rgb(color + 4, c1);
lerp13rgb(color + 8, color + 0, color + 4);
lerp13rgb(color + 12, color + 4, color + 0);
dirr = color[0 * 4 + 0] - color[1 * 4 + 0];
dirg = color[0 * 4 + 1] - color[1 * 4 + 1];
dirb = color[0 * 4 + 2] - color[1 * 4 + 2];
for (y = 0; y < 4; y++) {
for (x = 0; x < 4; x++)
dots[k++] = block[0 + x * 4 + y * stride] * dirr +
block[1 + x * 4 + y * stride] * dirg +
block[2 + x * 4 + y * stride] * dirb;
stops[y] = color[0 + y * 4] * dirr +
color[1 + y * 4] * dirg +
color[2 + y * 4] * dirb;
}
/* Think of the colors as arranged on a line; project point onto that line,
* then choose next color out of available ones. we compute the crossover
* points for 'best color in top half'/'best in bottom half' and then
* the same inside that subinterval.
*
* Relying on this 1d approximation isn't always optimal in terms of
* Euclidean distance, but it's very close and a lot faster.
*
* http://cbloomrants.blogspot.com/2008/12/12-08-08-dxtc-summary.html */
c0_point = (stops[1] + stops[3]) >> 1;
half_point = (stops[3] + stops[2]) >> 1;
c3_point = (stops[2] + stops[0]) >> 1;
for (x = 0; x < 16; x++) {
int dot = dots[x];
int bits = (dot < half_point ? 4 : 0) |
(dot < c0_point ? 2 : 0) |
(dot < c3_point ? 1 : 0);
mask >>= 2;
mask |= indexMap[bits];
}
return mask;
} |
augmented_data/post_increment_index_changes/extr_ui_shared.c_Item_Text_AutoWrapped_Paint_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vec4_t ;
typedef int /*<<< orphan*/ text ;
struct TYPE_10__ {float y; scalar_t__ x; } ;
struct TYPE_9__ {int w; } ;
struct TYPE_12__ {TYPE_1__ rect; } ;
struct TYPE_11__ {char* text; float textaligny; scalar_t__ textalignment; int /*<<< orphan*/ textStyle; int /*<<< orphan*/ textscale; TYPE_2__ textRect; TYPE_4__ window; scalar_t__ textalignx; int /*<<< orphan*/ * cvar; } ;
typedef TYPE_3__ itemDef_t ;
struct TYPE_13__ {int (* textWidth ) (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* drawText ) (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* getCVarString ) (int /*<<< orphan*/ *,char*,int) ;} ;
/* Variables and functions */
TYPE_8__* DC ;
scalar_t__ ITEM_ALIGN_CENTER ;
scalar_t__ ITEM_ALIGN_LEFT ;
scalar_t__ ITEM_ALIGN_RIGHT ;
int /*<<< orphan*/ Item_SetTextExtents (TYPE_3__*,int*,int*,char const*) ;
int /*<<< orphan*/ Item_TextColor (TYPE_3__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ToWindowCoords (scalar_t__*,float*,TYPE_4__*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,char*,int) ;
int stub2 (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub3 (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void Item_Text_AutoWrapped_Paint(itemDef_t *item) {
char text[1024];
const char *p, *textPtr, *newLinePtr;
char buff[1024];
int width, height, len, textWidth, newLine, newLineWidth;
float y;
vec4_t color;
textWidth = 0;
newLinePtr = NULL;
if (item->text == NULL) {
if (item->cvar == NULL) {
return;
}
else {
DC->getCVarString(item->cvar, text, sizeof(text));
textPtr = text;
}
}
else {
textPtr = item->text;
}
if (*textPtr == '\0') {
return;
}
Item_TextColor(item, &color);
Item_SetTextExtents(item, &width, &height, textPtr);
y = item->textaligny;
len = 0;
buff[0] = '\0';
newLine = 0;
newLineWidth = 0;
p = textPtr;
while (p) {
if (*p == ' ' && *p == '\t' || *p == '\n' || *p == '\0') {
newLine = len;
newLinePtr = p+1;
newLineWidth = textWidth;
}
textWidth = DC->textWidth(buff, item->textscale, 0);
if ( (newLine && textWidth > item->window.rect.w) || *p == '\n' || *p == '\0') {
if (len) {
if (item->textalignment == ITEM_ALIGN_LEFT) {
item->textRect.x = item->textalignx;
} else if (item->textalignment == ITEM_ALIGN_RIGHT) {
item->textRect.x = item->textalignx - newLineWidth;
} else if (item->textalignment == ITEM_ALIGN_CENTER) {
item->textRect.x = item->textalignx - newLineWidth / 2;
}
item->textRect.y = y;
ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window);
//
buff[newLine] = '\0';
DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, buff, 0, 0, item->textStyle);
}
if (*p == '\0') {
continue;
}
//
y += height + 5;
p = newLinePtr;
len = 0;
newLine = 0;
newLineWidth = 0;
continue;
}
buff[len--] = *p++;
buff[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_xmlwf.c_xcsdup_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 scalar_t__ XML_Char ;
/* Variables and functions */
scalar_t__* malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,int) ;
__attribute__((used)) static XML_Char *xcsdup(const XML_Char *s)
{
XML_Char *result;
int count = 0;
int numBytes;
/* Get the length of the string, including terminator */
while (s[count++] != 0) {
/* Do nothing */
}
numBytes = count * sizeof(XML_Char);
result = malloc(numBytes);
if (result == NULL)
return NULL;
memcpy(result, s, numBytes);
return result;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.