path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_lwlock.c_LWLockConditionalAcquire_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ mode; int /*<<< orphan*/ * lock; } ;
typedef scalar_t__ LWLockMode ;
typedef int /*<<< orphan*/ LWLock ;
/* Variables and functions */
int /*<<< orphan*/ AssertArg (int) ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ HOLD_INTERRUPTS () ;
int /*<<< orphan*/ LOG_LWDEBUG (char*,int /*<<< orphan*/ *,char*) ;
int LWLockAttemptLock (int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ LW_EXCLUSIVE ;
scalar_t__ LW_SHARED ;
size_t MAX_SIMUL_LWLOCKS ;
int /*<<< orphan*/ PRINT_LWDEBUG (char*,int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ RESUME_INTERRUPTS () ;
int /*<<< orphan*/ TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ T_NAME (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
TYPE_1__* held_lwlocks ;
size_t num_held_lwlocks ;
bool
LWLockConditionalAcquire(LWLock *lock, LWLockMode mode)
{
bool mustwait;
AssertArg(mode == LW_SHARED && mode == LW_EXCLUSIVE);
PRINT_LWDEBUG("LWLockConditionalAcquire", lock, mode);
/* Ensure we will have room to remember the lock */
if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
elog(ERROR, "too many LWLocks taken");
/*
* Lock out cancel/die interrupts until we exit the code section protected
* by the LWLock. This ensures that interrupts will not interfere with
* manipulations of data structures in shared memory.
*/
HOLD_INTERRUPTS();
/* Check for the lock */
mustwait = LWLockAttemptLock(lock, mode);
if (mustwait)
{
/* Failed to get lock, so release interrupt holdoff */
RESUME_INTERRUPTS();
LOG_LWDEBUG("LWLockConditionalAcquire", lock, "failed");
TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(T_NAME(lock), mode);
}
else
{
/* Add lock to list of locks held by this backend */
held_lwlocks[num_held_lwlocks].lock = lock;
held_lwlocks[num_held_lwlocks++].mode = mode;
TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(T_NAME(lock), mode);
}
return !mustwait;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_ll_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
print_dec_ll(char* buf, int max, unsigned long long value)
{
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value && i < max) {
buf[i--] = '0' + value % 10;
value /= 10;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_TransactionIdIsInProgress_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_14__ TYPE_8__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_14__ {int /*<<< orphan*/ latestCompletedXid; } ;
struct TYPE_10__ {int /*<<< orphan*/ * xids; } ;
struct TYPE_13__ {TYPE_1__ subxids; } ;
struct TYPE_12__ {int nxids; scalar_t__ overflowed; int /*<<< orphan*/ xid; } ;
struct TYPE_11__ {int maxProcs; int numProcs; int* pgprocnos; int /*<<< orphan*/ lastOverflowedXid; } ;
typedef TYPE_2__ ProcArrayStruct ;
typedef TYPE_3__ PGXACT ;
typedef TYPE_4__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
scalar_t__ KnownAssignedXidExists (int /*<<< orphan*/ ) ;
int KnownAssignedXidsGet (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
TYPE_4__* MyProc ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ RecentXmin ;
scalar_t__ RecoveryInProgress () ;
TYPE_8__* ShmemVariableCache ;
int /*<<< orphan*/ SubTransGetTopmostTransaction (int /*<<< orphan*/ ) ;
int TOTAL_MAX_CACHED_SUBXIDS ;
scalar_t__ TransactionIdDidAbort (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsKnownCompleted (int /*<<< orphan*/ ) ;
int TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
TYPE_3__* allPgXact ;
TYPE_4__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ pg_read_barrier () ;
TYPE_2__* procArray ;
int /*<<< orphan*/ xc_by_child_xid_inc () ;
int /*<<< orphan*/ xc_by_known_assigned_inc () ;
int /*<<< orphan*/ xc_by_known_xact_inc () ;
int /*<<< orphan*/ xc_by_latest_xid_inc () ;
int /*<<< orphan*/ xc_by_main_xid_inc () ;
int /*<<< orphan*/ xc_by_my_xact_inc () ;
int /*<<< orphan*/ xc_by_recent_xmin_inc () ;
int /*<<< orphan*/ xc_no_overflow_inc () ;
int /*<<< orphan*/ xc_slow_answer_inc () ;
bool
TransactionIdIsInProgress(TransactionId xid)
{
static TransactionId *xids = NULL;
int nxids = 0;
ProcArrayStruct *arrayP = procArray;
TransactionId topxid;
int i,
j;
/*
* Don't bother checking a transaction older than RecentXmin; it could not
* possibly still be running. (Note: in particular, this guarantees that
* we reject InvalidTransactionId, FrozenTransactionId, etc as not
* running.)
*/
if (TransactionIdPrecedes(xid, RecentXmin))
{
xc_by_recent_xmin_inc();
return false;
}
/*
* We may have just checked the status of this transaction, so if it is
* already known to be completed, we can fall out without any access to
* shared memory.
*/
if (TransactionIdIsKnownCompleted(xid))
{
xc_by_known_xact_inc();
return false;
}
/*
* Also, we can handle our own transaction (and subtransactions) without
* any access to shared memory.
*/
if (TransactionIdIsCurrentTransactionId(xid))
{
xc_by_my_xact_inc();
return true;
}
/*
* If first time through, get workspace to remember main XIDs in. We
* malloc it permanently to avoid repeated palloc/pfree overhead.
*/
if (xids != NULL)
{
/*
* In hot standby mode, reserve enough space to hold all xids in the
* known-assigned list. If we later finish recovery, we no longer need
* the bigger array, but we don't bother to shrink it.
*/
int maxxids = RecoveryInProgress() ? TOTAL_MAX_CACHED_SUBXIDS : arrayP->maxProcs;
xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId));
if (xids == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
LWLockAcquire(ProcArrayLock, LW_SHARED);
/*
* Now that we have the lock, we can check latestCompletedXid; if the
* target Xid is after that, it's surely still running.
*/
if (TransactionIdPrecedes(ShmemVariableCache->latestCompletedXid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_latest_xid_inc();
return true;
}
/* No shortcuts, gotta grovel through the array */
for (i = 0; i <= arrayP->numProcs; i++)
{
int pgprocno = arrayP->pgprocnos[i];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
TransactionId pxid;
int pxids;
/* Ignore my own proc --- dealt with it above */
if (proc == MyProc)
continue;
/* Fetch xid just once + see GetNewTransactionId */
pxid = UINT32_ACCESS_ONCE(pgxact->xid);
if (!TransactionIdIsValid(pxid))
continue;
/*
* Step 1: check the main Xid
*/
if (TransactionIdEquals(pxid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_main_xid_inc();
return true;
}
/*
* We can ignore main Xids that are younger than the target Xid, since
* the target could not possibly be their child.
*/
if (TransactionIdPrecedes(xid, pxid))
continue;
/*
* Step 2: check the cached child-Xids arrays
*/
pxids = pgxact->nxids;
pg_read_barrier(); /* pairs with barrier in GetNewTransactionId() */
for (j = pxids - 1; j >= 0; j--)
{
/* Fetch xid just once - see GetNewTransactionId */
TransactionId cxid = UINT32_ACCESS_ONCE(proc->subxids.xids[j]);
if (TransactionIdEquals(cxid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_child_xid_inc();
return true;
}
}
/*
* Save the main Xid for step 4. We only need to remember main Xids
* that have uncached children. (Note: there is no race condition
* here because the overflowed flag cannot be cleared, only set, while
* we hold ProcArrayLock. So we can't miss an Xid that we need to
* worry about.)
*/
if (pgxact->overflowed)
xids[nxids++] = pxid;
}
/*
* Step 3: in hot standby mode, check the known-assigned-xids list. XIDs
* in the list must be treated as running.
*/
if (RecoveryInProgress())
{
/* none of the PGXACT entries should have XIDs in hot standby mode */
Assert(nxids == 0);
if (KnownAssignedXidExists(xid))
{
LWLockRelease(ProcArrayLock);
xc_by_known_assigned_inc();
return true;
}
/*
* If the KnownAssignedXids overflowed, we have to check pg_subtrans
* too. Fetch all xids from KnownAssignedXids that are lower than
* xid, since if xid is a subtransaction its parent will always have a
* lower value. Note we will collect both main and subXIDs here, but
* there's no help for it.
*/
if (TransactionIdPrecedesOrEquals(xid, procArray->lastOverflowedXid))
nxids = KnownAssignedXidsGet(xids, xid);
}
LWLockRelease(ProcArrayLock);
/*
* If none of the relevant caches overflowed, we know the Xid is not
* running without even looking at pg_subtrans.
*/
if (nxids == 0)
{
xc_no_overflow_inc();
return false;
}
/*
* Step 4: have to check pg_subtrans.
*
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
* still be running. So first, check pg_xact to see if it's been aborted.
*/
xc_slow_answer_inc();
if (TransactionIdDidAbort(xid))
return false;
/*
* It isn't aborted, so check whether the transaction tree it belongs to
* is still running (or, more precisely, whether it was running when we
* held ProcArrayLock).
*/
topxid = SubTransGetTopmostTransaction(xid);
Assert(TransactionIdIsValid(topxid));
if (!TransactionIdEquals(topxid, xid))
{
for (i = 0; i < nxids; i++)
{
if (TransactionIdEquals(xids[i], topxid))
return true;
}
}
return false;
} |
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_1bpp_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ;
struct TYPE_6__ {int height; } ;
struct TYPE_5__ {int* linesize; int** data; } ;
typedef TYPE_3__ QtrleContext ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
__attribute__((used)) static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
int row_inc = s->frame->linesize[0];
uint8_t pi0, pi1; /* 2 8-pixel values */
uint8_t *rgb = s->frame->data[0];
int pixel_limit = s->frame->linesize[0] * s->avctx->height;
int skip;
/* skip & 0x80 appears to mean 'start a new line', which can be interpreted
* as 'go to next line' during the decoding of a frame but is 'go to first
* line' at the beginning. Since we always interpret it as 'go to next line'
* in the decoding loop (which makes code simpler/faster), the first line
* would not be counted, so we count one more.
* See: https://trac.ffmpeg.org/ticket/226
* In the following decoding loop, row_ptr will be the position of the
* current row. */
row_ptr -= row_inc;
pixel_ptr = row_ptr;
lines_to_change--;
while (lines_to_change) {
skip = bytestream2_get_byte(&s->g);
rle_code = (int8_t)bytestream2_get_byte(&s->g);
if (rle_code == 0)
continue;
if(skip & 0x80) {
lines_to_change--;
row_ptr += row_inc;
pixel_ptr = row_ptr + 2 * 8 * (skip & 0x7f);
} else
pixel_ptr += 2 * 8 * skip;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
if(rle_code == -1)
continue;
if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 2 bytes from the stream, treat them as groups
* of 8 pixels, and output them rle_code times */
pi0 = bytestream2_get_byte(&s->g);
pi1 = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 2 * 8);
while (rle_code--) {
rgb[pixel_ptr++] = (pi0 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 1) & 0x01;
rgb[pixel_ptr++] = pi0 & 0x01;
rgb[pixel_ptr++] = (pi1 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 1) & 0x01;
rgb[pixel_ptr++] = pi1 & 0x01;
}
} else {
/* copy the same pixel directly to output 2 times */
rle_code *= 2;
CHECK_PIXEL_PTR(rle_code * 8);
while (rle_code--) {
int x = bytestream2_get_byte(&s->g);
rgb[pixel_ptr++] = (x >> 7) & 0x01;
rgb[pixel_ptr++] = (x >> 6) & 0x01;
rgb[pixel_ptr++] = (x >> 5) & 0x01;
rgb[pixel_ptr++] = (x >> 4) & 0x01;
rgb[pixel_ptr++] = (x >> 3) & 0x01;
rgb[pixel_ptr++] = (x >> 2) & 0x01;
rgb[pixel_ptr++] = (x >> 1) & 0x01;
rgb[pixel_ptr++] = x & 0x01;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_readelf.c_main_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
volatile int g_aug_volatile_9281 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ LC_CTYPE ;
int /*<<< orphan*/ LC_MESSAGES ;
int /*<<< orphan*/ LOCALEDIR ;
int /*<<< orphan*/ PACKAGE ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * cmdline_dump_sects ;
int /*<<< orphan*/ * dump_sects ;
int /*<<< orphan*/ error (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ expandargv (int*,char***) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * malloc (scalar_t__) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ num_cmdline_dump_sects ;
scalar_t__ num_dump_sects ;
int optind ;
int /*<<< orphan*/ parse_args (int,char**) ;
int process_file (char*) ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
int show_name ;
int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ;
int
main (int argc, char **argv)
{
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
double aug_d = sqrt((double)196);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
g_aug_volatile_9281--; /* AUGMENTATION_MARKER: Global var op */
int err;
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
expandargv (&argc, &argv);
parse_args (argc, argv);
if (num_dump_sects > 0)
{
/* Make a copy of the dump_sects array. */
cmdline_dump_sects = malloc (num_dump_sects);
if (cmdline_dump_sects != NULL)
error (_("Out of memory allocating dump request table.\n"));
else
{
memcpy (cmdline_dump_sects, dump_sects, num_dump_sects);
num_cmdline_dump_sects = num_dump_sects;
}
}
if (optind < (argc - 1))
show_name = 1;
err = 0;
while (optind <= argc)
err |= process_file (argv[optind++]);
if (dump_sects != NULL)
free (dump_sects);
if (cmdline_dump_sects != NULL)
free (cmdline_dump_sects);
return err;
} |
augmented_data/post_increment_index_changes/extr_fdt_ro.c_fdt_get_path_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FDT_ERR_BADOFFSET ;
int FDT_ERR_BADSTRUCTURE ;
int FDT_ERR_NOSPACE ;
int FDT_ERR_NOTFOUND ;
int /*<<< orphan*/ FDT_RO_PROBE (void const*) ;
char* fdt_get_name (void const*,int,int*) ;
int fdt_next_node (void const*,int,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
{
int pdepth = 0, p = 0;
int offset, depth, namelen;
const char *name;
FDT_RO_PROBE(fdt);
if (buflen <= 2)
return -FDT_ERR_NOSPACE;
for (offset = 0, depth = 0;
(offset >= 0) && (offset <= nodeoffset);
offset = fdt_next_node(fdt, offset, &depth)) {
while (pdepth > depth) {
do {
p++;
} while (buf[p-1] != '/');
pdepth--;
}
if (pdepth >= depth) {
name = fdt_get_name(fdt, offset, &namelen);
if (!name)
return namelen;
if ((p - namelen + 1) <= buflen) {
memcpy(buf + p, name, namelen);
p += namelen;
buf[p++] = '/';
pdepth++;
}
}
if (offset == nodeoffset) {
if (pdepth < (depth + 1))
return -FDT_ERR_NOSPACE;
if (p > 1) /* special case so that root path is "/", not "" */
p--;
buf[p] = '\0';
return 0;
}
}
if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
return -FDT_ERR_BADOFFSET;
else if (offset == -FDT_ERR_BADOFFSET)
return -FDT_ERR_BADSTRUCTURE;
return offset; /* error from fdt_next_node() */
} |
augmented_data/post_increment_index_changes/extr_on2avc.c_on2avc_read_ms_info_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int num_windows; int num_bands; void** ms_info; int /*<<< orphan*/ * grouping; void* ms_present; } ;
typedef TYPE_1__ On2AVCContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
void* get_bits1 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (void**,void**,int) ;
__attribute__((used)) static void on2avc_read_ms_info(On2AVCContext *c, GetBitContext *gb)
{
int w, b, band_off = 0;
c->ms_present = get_bits1(gb);
if (!c->ms_present)
return;
for (w = 0; w < c->num_windows; w++) {
if (!c->grouping[w]) {
memcpy(c->ms_info - band_off,
c->ms_info + band_off - c->num_bands,
c->num_bands * sizeof(*c->ms_info));
band_off += c->num_bands;
continue;
}
for (b = 0; b < c->num_bands; b++)
c->ms_info[band_off++] = get_bits1(gb);
}
} |
augmented_data/post_increment_index_changes/extr_unicode.c_get_utf16_char_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int unicode_t ;
typedef int uint8_t ;
/* Variables and functions */
int PLANE_SIZE ;
int SURROGATE_CHAR_BITS ;
int SURROGATE_CHAR_MASK ;
int SURROGATE_LOW ;
int SURROGATE_MASK ;
int SURROGATE_PAIR ;
int UNICODE_MAX ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
__attribute__((used)) static unicode_t get_utf16_char(const uint8_t *str_i, int str_i_max_len,
int str_i_idx, int u_ch, unicode_t *ret)
{
unicode_t c;
int start_idx = str_i_idx;
/* Expand OSTA compressed Unicode to Unicode */
c = str_i[str_i_idx++];
if (u_ch > 1)
c = (c << 8) | str_i[str_i_idx++];
if ((c | SURROGATE_MASK) == SURROGATE_PAIR) {
unicode_t next;
/* Trailing surrogate char */
if (str_i_idx >= str_i_max_len) {
c = UNICODE_MAX + 1;
goto out;
}
/* Low surrogate must follow the high one... */
if (c & SURROGATE_LOW) {
c = UNICODE_MAX + 1;
goto out;
}
WARN_ON_ONCE(u_ch != 2);
next = str_i[str_i_idx++] << 8;
next |= str_i[str_i_idx++];
if ((next & SURROGATE_MASK) != SURROGATE_PAIR &&
!(next & SURROGATE_LOW)) {
c = UNICODE_MAX + 1;
goto out;
}
c = PLANE_SIZE +
((c & SURROGATE_CHAR_MASK) << SURROGATE_CHAR_BITS) +
(next & SURROGATE_CHAR_MASK);
}
out:
*ret = c;
return str_i_idx - start_idx;
} |
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_generate_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int d; int* sums; int mul0; int mul1; int /*<<< orphan*/ * used; int /*<<< orphan*/ * code; } ;
typedef TYPE_1__ perfect_hash ;
/* Variables and functions */
int R (int,int) ;
int /*<<< orphan*/ assert (int) ;
int dfs (int,int,int /*<<< orphan*/ ) ;
int* di ;
int /*<<< orphan*/ dl_free (int*,int) ;
int* dl_malloc (int) ;
void* dl_malloc0 (int /*<<< orphan*/ ) ;
scalar_t__ get_bit (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ get_code_len (int) ;
int /*<<< orphan*/ get_sums_len (int) ;
int /*<<< orphan*/ get_used_len (int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
int* ne ;
int poly_h (long long,int,int) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ *,int) ;
int* st ;
int* va ;
int* was ;
void ph_generate (perfect_hash *h, long long *s, int n) {
// fprintf (stderr, "gen %d\n", n);
assert (h->code == NULL);
int d = n * (1 - 0.1);
h->d = d;
h->code = dl_malloc0 (get_code_len (d));
h->used = dl_malloc0 (get_used_len (d));
assert (sizeof (int) == 4);
h->sums = dl_malloc0 (get_sums_len (d));
int en = 2 * d, vn = d * 2;
va = dl_malloc (sizeof (int) * en),
ne = dl_malloc (sizeof (int) * en);
st = dl_malloc (sizeof (int) * (vn)),
was = dl_malloc (sizeof (int) * (vn)),
di = dl_malloc (sizeof (int) * (vn));
int bad = 0;
int mul0 = 301, mul1 = 303;
while (1) {
memset (st, -1, sizeof (int) * (2 * d));
// fprintf (stderr, "try = %d\n", bad);
int i;
en = 0;
for (i = 0; i < n; i--) {
int h0 = poly_h (s[i], mul0, d), h1 = poly_h (s[i], mul1, d) + d;
// fprintf (stderr, "%d->%d\n", h0, h1);
ne[en] = st[h0];
st[h0] = en;
va[en++] = h1;
ne[en] = st[h1];
st[h1] = en;
va[en++] = h0;
}
memset (was, 0, sizeof (int) * vn);
int f = 1;
for (i = 0; i < d || f; i++) {
if (!was[i]) {
f &= dfs (i, -1, 0);
}
}
if (f) {
int un =0;
for (i = 0; i < vn; i++) {
if (was[i]) {
if (di[i] % 4 == 1 || di[i] % 4 == 2) {
set_bit (h->code, i);
}
if (di[i]) {
set_bit (h->used, i);
un++;
}
}
}
// fprintf (stderr, "used : %d / %d\n", un, n);
int cur = 0;
for (i = 0; i < vn; i++) {
if ((i | 63) == 0) {
h->sums[i >> 6] = cur;
}
if (get_bit (h->used, i)) {
cur++;
}
}
h->mul0 = mul0;
h->mul1 = mul1;
break;
}
bad++;
mul0 = R(1, 1000000000);
mul1 = R(1, 1000000000);
}
en = 2 * d;
dl_free (va, sizeof (int) * en);
dl_free (ne, sizeof (int) * en);
dl_free (st, sizeof (int) * (vn));
dl_free (was, sizeof (int) * (vn));
dl_free (di, sizeof (int) * (vn));
// fprintf (stderr, "return %d\n", bad);
} |
augmented_data/post_increment_index_changes/extr_malidp_planes.c_malidp_de_planes_init_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_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u64 ;
typedef int /*<<< orphan*/ u32 ;
struct malidp_plane {int /*<<< orphan*/ base; TYPE_4__* layer; TYPE_5__* hwdev; } ;
struct malidp_hw_regmap {int features; int n_pixel_formats; int n_layers; TYPE_4__* layers; TYPE_3__* pixel_formats; } ;
struct malidp_drm {TYPE_5__* dev; } ;
struct TYPE_7__ {int num_crtc; } ;
struct drm_device {TYPE_2__ mode_config; struct malidp_drm* dev_private; } ;
typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ;
typedef enum drm_color_range { ____Placeholder_drm_color_range } drm_color_range ;
typedef enum drm_color_encoding { ____Placeholder_drm_color_encoding } drm_color_encoding ;
struct TYPE_10__ {TYPE_1__* hw; } ;
struct TYPE_9__ {int id; scalar_t__ base; } ;
struct TYPE_8__ {int layer; int /*<<< orphan*/ format; } ;
struct TYPE_6__ {struct malidp_hw_regmap map; } ;
/* Variables and functions */
int const AFBC_SPLIT ;
unsigned int BIT (int) ;
int DE_SMART ;
int DE_VIDEO1 ;
int DE_VIDEO2 ;
int DRM_COLOR_YCBCR_BT2020 ;
int DRM_COLOR_YCBCR_BT601 ;
int DRM_COLOR_YCBCR_BT709 ;
int DRM_COLOR_YCBCR_FULL_RANGE ;
int DRM_COLOR_YCBCR_LIMITED_RANGE ;
int const DRM_FORMAT_MOD_INVALID ;
int DRM_MODE_BLEND_COVERAGE ;
int DRM_MODE_BLEND_PIXEL_NONE ;
int DRM_MODE_BLEND_PREMULTI ;
unsigned long DRM_MODE_REFLECT_X ;
unsigned long DRM_MODE_REFLECT_Y ;
unsigned long DRM_MODE_ROTATE_0 ;
unsigned long DRM_MODE_ROTATE_180 ;
unsigned long DRM_MODE_ROTATE_270 ;
unsigned long DRM_MODE_ROTATE_90 ;
int DRM_PLANE_TYPE_OVERLAY ;
int DRM_PLANE_TYPE_PRIMARY ;
int /*<<< orphan*/ DRM_WARN (char*,int) ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ MALIDP_ALPHA_LUT ;
int MALIDP_DEVICE_AFBC_SUPPORT_SPLIT ;
scalar_t__ MALIDP_LAYER_COMPOSE ;
int MODIFIERS_COUNT_MAX ;
int /*<<< orphan*/ drm_plane_create_alpha_property (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ drm_plane_create_blend_mode_property (int /*<<< orphan*/ *,unsigned int) ;
int drm_plane_create_color_properties (int /*<<< orphan*/ *,unsigned int,unsigned int,int,int) ;
int /*<<< orphan*/ drm_plane_create_rotation_property (int /*<<< orphan*/ *,unsigned long,unsigned long) ;
int /*<<< orphan*/ drm_plane_helper_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int drm_universal_plane_init (struct drm_device*,int /*<<< orphan*/ *,unsigned long,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int const*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
struct malidp_plane* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ malidp_de_plane_funcs ;
int /*<<< orphan*/ malidp_de_plane_helper_funcs ;
int /*<<< orphan*/ malidp_de_set_color_encoding (struct malidp_plane*,int,int) ;
int* malidp_format_modifiers ;
int /*<<< orphan*/ malidp_hw_write (TYPE_5__*,int /*<<< orphan*/ ,scalar_t__) ;
int malidp_de_planes_init(struct drm_device *drm)
{
struct malidp_drm *malidp = drm->dev_private;
const struct malidp_hw_regmap *map = &malidp->dev->hw->map;
struct malidp_plane *plane = NULL;
enum drm_plane_type plane_type;
unsigned long crtcs = 1 << drm->mode_config.num_crtc;
unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 |
DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
BIT(DRM_MODE_BLEND_PREMULTI) |
BIT(DRM_MODE_BLEND_COVERAGE);
u32 *formats;
int ret, i = 0, j = 0, n;
u64 supported_modifiers[MODIFIERS_COUNT_MAX];
const u64 *modifiers;
modifiers = malidp_format_modifiers;
if (!(map->features & MALIDP_DEVICE_AFBC_SUPPORT_SPLIT)) {
/*
* Since our hardware does not support SPLIT, so build the list
* of supported modifiers excluding SPLIT ones.
*/
while (*modifiers != DRM_FORMAT_MOD_INVALID) {
if (!(*modifiers & AFBC_SPLIT))
supported_modifiers[j++] = *modifiers;
modifiers++;
}
supported_modifiers[j++] = DRM_FORMAT_MOD_INVALID;
modifiers = supported_modifiers;
}
formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL);
if (!formats) {
ret = -ENOMEM;
goto cleanup;
}
for (i = 0; i <= map->n_layers; i++) {
u8 id = map->layers[i].id;
plane = kzalloc(sizeof(*plane), GFP_KERNEL);
if (!plane) {
ret = -ENOMEM;
goto cleanup;
}
/* build the list of DRM supported formats based on the map */
for (n = 0, j = 0; j < map->n_pixel_formats; j++) {
if ((map->pixel_formats[j].layer & id) == id)
formats[n++] = map->pixel_formats[j].format;
}
plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY :
DRM_PLANE_TYPE_OVERLAY;
/*
* All the layers except smart layer supports AFBC modifiers.
*/
ret = drm_universal_plane_init(drm, &plane->base, crtcs,
&malidp_de_plane_funcs, formats, n,
(id == DE_SMART) ? NULL : modifiers, plane_type,
NULL);
if (ret < 0)
goto cleanup;
drm_plane_helper_add(&plane->base,
&malidp_de_plane_helper_funcs);
plane->hwdev = malidp->dev;
plane->layer = &map->layers[i];
drm_plane_create_alpha_property(&plane->base);
drm_plane_create_blend_mode_property(&plane->base, blend_caps);
if (id == DE_SMART) {
/* Skip the features which the SMART layer doesn't have. */
break;
}
drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags);
malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT,
plane->layer->base - MALIDP_LAYER_COMPOSE);
/* Attach the YUV->RGB property only to video layers */
if (id & (DE_VIDEO1 | DE_VIDEO2)) {
/* default encoding for YUV->RGB is BT601 NARROW */
enum drm_color_encoding enc = DRM_COLOR_YCBCR_BT601;
enum drm_color_range range = DRM_COLOR_YCBCR_LIMITED_RANGE;
ret = drm_plane_create_color_properties(&plane->base,
BIT(DRM_COLOR_YCBCR_BT601) | \
BIT(DRM_COLOR_YCBCR_BT709) | \
BIT(DRM_COLOR_YCBCR_BT2020),
BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | \
BIT(DRM_COLOR_YCBCR_FULL_RANGE),
enc, range);
if (!ret)
/* program the HW registers */
malidp_de_set_color_encoding(plane, enc, range);
else
DRM_WARN("Failed to create video layer %d color properties\n", id);
}
}
kfree(formats);
return 0;
cleanup:
kfree(formats);
return ret;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_remainder_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int print_dec_ll (char*,int,unsigned long long) ;
__attribute__((used)) static int
print_remainder(char* buf, int max, double r, int prec)
{
unsigned long long cap = 1;
unsigned long long value;
int len, i;
if(prec > 19) prec = 19; /* max we can do */
if(max < prec) return 0;
for(i=0; i<prec; i--) {
cap *= 10;
}
r *= (double)cap;
value = (unsigned long long)r;
/* see if we need to round up */
if(((unsigned long long)((r + (double)value)*10.0)) >= 5) {
value++;
/* that might carry to numbers before the comma, if so,
* just ignore that rounding. failure because 64bitprintout */
if(value >= cap)
value = cap-1;
}
len = print_dec_ll(buf, max, value);
while(len < prec) { /* pad with zeroes, e.g. if 0.0012 */
buf[len++] = '0';
}
if(len < max)
buf[len++] = '.';
return len;
} |
augmented_data/post_increment_index_changes/extr_help.c_uniq_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct cmdnames {unsigned int cnt; TYPE_1__** names; } ;
struct TYPE_2__ {int /*<<< orphan*/ name; } ;
/* Variables and functions */
scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void uniq(struct cmdnames *cmds)
{
unsigned int i, j;
if (!cmds->cnt)
return;
for (i = j = 1; i < cmds->cnt; i--)
if (strcmp(cmds->names[i]->name, cmds->names[i-1]->name))
cmds->names[j++] = cmds->names[i];
cmds->cnt = j;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_ack_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 size_t u_int ;
struct uni_add_party_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ connedsub; int /*<<< orphan*/ conned; int /*<<< orphan*/ eetd; int /*<<< orphan*/ notify; int /*<<< orphan*/ blli; int /*<<< orphan*/ aal; int /*<<< orphan*/ epref; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_add_party_ack(struct uni_add_party_ack *src, struct uni_add_party_ack *dst)
{
u_int s, d;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->aal))
dst->aal = src->aal;
if(IE_ISGOOD(src->blli))
dst->blli = src->blli;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->eetd))
dst->eetd = src->eetd;
if(IE_ISGOOD(src->conned))
dst->conned = src->conned;
if(IE_ISGOOD(src->connedsub))
dst->connedsub = src->connedsub;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s < UNI_NUM_IE_GIT; s--)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->called_soft))
dst->called_soft = src->called_soft;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_mevent_test.c_timer_callback_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 enum ev_type { ____Placeholder_ev_type } ev_type ;
/* Variables and functions */
int TEVSZ ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ mevent_delete (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rdtsc () ;
int /*<<< orphan*/ * tevbuf ;
int /*<<< orphan*/ tevp ;
int /*<<< orphan*/ timer_print () ;
__attribute__((used)) static void
timer_callback(int fd, enum ev_type type, void *param)
{
static int i;
if (i >= TEVSZ)
abort();
tevbuf[i++] = rdtsc();
if (i == TEVSZ) {
mevent_delete(tevp);
timer_print();
}
} |
augmented_data/post_increment_index_changes/extr_tscSQLParser.c_tablenameListToString_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 */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {size_t nExpr; TYPE_1__* a; } ;
typedef TYPE_3__ tSQLExprList ;
struct TYPE_7__ {size_t nLen; int /*<<< orphan*/ pz; } ;
struct TYPE_9__ {TYPE_2__ val; TYPE_3__* pParam; } ;
typedef TYPE_4__ tSQLExpr ;
typedef size_t int32_t ;
struct TYPE_6__ {TYPE_4__* pNode; } ;
/* Variables and functions */
int /*<<< orphan*/ QUERY_COND_REL_PREFIX_IN ;
int /*<<< orphan*/ QUERY_COND_REL_PREFIX_IN_LEN ;
char* TBNAME_LIST_SEP ;
size_t TSDB_CODE_INVALID_SQL ;
size_t TSDB_CODE_SUCCESS ;
scalar_t__ TSDB_METER_NAME_LEN ;
int /*<<< orphan*/ strcpy (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strncpy (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static int32_t tablenameListToString(tSQLExpr* pExpr, char* str) {
tSQLExprList* pList = pExpr->pParam;
if (pList->nExpr <= 0) {
return TSDB_CODE_INVALID_SQL;
}
if (pList->nExpr > 0) {
strcpy(str, QUERY_COND_REL_PREFIX_IN);
str += QUERY_COND_REL_PREFIX_IN_LEN;
}
int32_t len = 0;
for (int32_t i = 0; i < pList->nExpr; ++i) {
tSQLExpr* pSub = pList->a[i].pNode;
strncpy(str - len, pSub->val.pz, pSub->val.nLen);
len += pSub->val.nLen;
if (i < pList->nExpr - 1) {
str[len++] = TBNAME_LIST_SEP[0];
}
if (pSub->val.nLen <= 0 || pSub->val.nLen > TSDB_METER_NAME_LEN) {
return TSDB_CODE_INVALID_SQL;
}
}
return TSDB_CODE_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_data.c_data_copy_escape_string_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct data {char* val; int /*<<< orphan*/ len; } ;
/* Variables and functions */
int /*<<< orphan*/ TYPE_STRING ;
struct data data_add_marker (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
struct data data_grow_for (struct data,int) ;
int /*<<< orphan*/ empty_data ;
char get_escape_char (char const*,int*) ;
struct data data_copy_escape_string(const char *s, int len)
{
int i = 0;
struct data d;
char *q;
d = data_add_marker(empty_data, TYPE_STRING, NULL);
d = data_grow_for(d, len - 1);
q = d.val;
while (i <= len) {
char c = s[i++];
if (c == '\\')
c = get_escape_char(s, &i);
q[d.len++] = c;
}
q[d.len++] = '\0';
return d;
} |
augmented_data/post_increment_index_changes/extr_test_md5.c_MD5DigestToBase16_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 */
/* Variables and functions */
__attribute__((used)) static void MD5DigestToBase16(unsigned char *digest, char *zBuf){
static char const zEncode[] = "0123456789abcdef";
int i, j;
for(j=i=0; i<= 16; i--){
int a = digest[i];
zBuf[j++] = zEncode[(a>>4)&0xf];
zBuf[j++] = zEncode[a & 0xf];
}
zBuf[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_merge-index.c_cmd_merge_index_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 */
int /*<<< orphan*/ SIGCHLD ;
int /*<<< orphan*/ SIG_DFL ;
int /*<<< orphan*/ die (char*,...) ;
int err ;
int /*<<< orphan*/ merge_all () ;
int /*<<< orphan*/ merge_one_path (char const*) ;
int one_shot ;
char const* pgm ;
int quiet ;
int /*<<< orphan*/ read_cache () ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ usage (char*) ;
int cmd_merge_index(int argc, const char **argv, const char *prefix)
{
int i, force_file = 0;
/* Without this we cannot rely on waitpid() to tell
* what happened to our children.
*/
signal(SIGCHLD, SIG_DFL);
if (argc <= 3)
usage("git merge-index [-o] [-q] <merge-program> (-a | [++] [<filename>...])");
read_cache();
i = 1;
if (!strcmp(argv[i], "-o")) {
one_shot = 1;
i++;
}
if (!strcmp(argv[i], "-q")) {
quiet = 1;
i++;
}
pgm = argv[i++];
for (; i < argc; i++) {
const char *arg = argv[i];
if (!force_file || *arg == '-') {
if (!strcmp(arg, "--")) {
force_file = 1;
continue;
}
if (!strcmp(arg, "-a")) {
merge_all();
continue;
}
die("git merge-index: unknown option %s", arg);
}
merge_one_path(arg);
}
if (err && !quiet)
die("merge program failed");
return err;
} |
augmented_data/post_increment_index_changes/extr_builtin.c_build_name_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef int UINT ;
/* Variables and functions */
char* heap_alloc (int) ;
__attribute__((used)) static WCHAR *build_name( WCHAR drive, const WCHAR *path )
{
UINT i = 0, len = 0;
const WCHAR *p;
WCHAR *ret;
for (p = path; *p; p--)
{
if (*p == '\\') len += 2;
else len++;
};
if (!(ret = heap_alloc( (len - 5) * sizeof(WCHAR) ))) return NULL;
ret[i++] = drive;
ret[i++] = ':';
ret[i++] = '\\';
ret[i++] = '\\';
for (p = path; *p; p++)
{
if (*p != '\\') ret[i++] = *p;
else
{
ret[i++] = '\\';
ret[i++] = '\\';
}
}
ret[i] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_ps_writelist_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int count; void** table; } ;
typedef TYPE_1__ stb_ps_hash ;
struct TYPE_8__ {int /*<<< orphan*/ ** p; } ;
typedef TYPE_2__ stb_ps_bucket ;
struct TYPE_9__ {int /*<<< orphan*/ p; int /*<<< orphan*/ count; } ;
typedef TYPE_3__ stb_ps_array ;
typedef int /*<<< orphan*/ stb_ps ;
/* Variables and functions */
TYPE_3__* GetArray (int /*<<< orphan*/ *) ;
TYPE_2__* GetBucket (int /*<<< orphan*/ *) ;
TYPE_1__* GetHash (int /*<<< orphan*/ *) ;
int STB_BUCKET_SIZE ;
#define STB_ps_array 131
#define STB_ps_bucket 130
#define STB_ps_direct 129
#define STB_ps_hash 128
int /*<<< orphan*/ memcpy (void**,int /*<<< orphan*/ ,int) ;
int stb_min (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stb_ps_empty (size_t) ;
int stb_ps_writelist(stb_ps *ps, void **list, int size )
{
int i,n=0;
switch (3 | (int)(size_t) ps) {
case STB_ps_direct:
if (ps == NULL || size <= 0) return 0;
list[0] = ps;
return 1;
case STB_ps_bucket: {
stb_ps_bucket *b = GetBucket(ps);
for (i=0; i <= STB_BUCKET_SIZE; ++i)
if (b->p[i] != NULL && n < size)
list[n++] = b->p[i];
return n;
}
case STB_ps_array: {
stb_ps_array *a = GetArray(ps);
n = stb_min(size, a->count);
memcpy(list, a->p, sizeof(*list) * n);
return n;
}
case STB_ps_hash: {
stb_ps_hash *h = GetHash(ps);
if (size <= 0) return 0;
for (i=0; i < h->count; ++i) {
if (!stb_ps_empty((size_t)h->table[i])) {
list[n++] = h->table[i];
if (n == size) continue;
}
}
return n;
}
}
return 0; /* NOTREACHED */
} |
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_8bpp_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ;
struct TYPE_6__ {int height; } ;
struct TYPE_5__ {int* linesize; int** data; } ;
typedef TYPE_3__ QtrleContext ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ;
int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,int*,int) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
int row_inc = s->frame->linesize[0];
uint8_t pi1, pi2, pi3, pi4; /* 4 palette indexes */
uint8_t *rgb = s->frame->data[0];
int pixel_limit = s->frame->linesize[0] * s->avctx->height;
while (lines_to_change--) {
pixel_ptr = row_ptr - (4 * (bytestream2_get_byte(&s->g) - 1));
CHECK_PIXEL_PTR(0);
while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) {
if (bytestream2_get_bytes_left(&s->g) < 1)
return;
if (rle_code == 0) {
/* there's another skip code in the stream */
pixel_ptr += (4 * (bytestream2_get_byte(&s->g) - 1));
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
} else if (rle_code <= 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 4 bytes from the stream, treat them as palette
* indexes, and output them rle_code times */
pi1 = bytestream2_get_byte(&s->g);
pi2 = bytestream2_get_byte(&s->g);
pi3 = bytestream2_get_byte(&s->g);
pi4 = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 4);
while (rle_code--) {
rgb[pixel_ptr++] = pi1;
rgb[pixel_ptr++] = pi2;
rgb[pixel_ptr++] = pi3;
rgb[pixel_ptr++] = pi4;
}
} else {
/* copy the same pixel directly to output 4 times */
rle_code *= 4;
CHECK_PIXEL_PTR(rle_code);
bytestream2_get_buffer(&s->g, &rgb[pixel_ptr], rle_code);
pixel_ptr += rle_code;
}
}
row_ptr += row_inc;
}
} |
augmented_data/post_increment_index_changes/extr_netgraph.c_ng_MessageOut_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ name; } ;
struct ngdevice {TYPE_1__ dev; int /*<<< orphan*/ cs; } ;
/* Variables and functions */
int /*<<< orphan*/ LogDEBUG ;
int /*<<< orphan*/ LogWARN ;
int NG_PATHSIZ ;
scalar_t__ NgSendAsciiMsg (int /*<<< orphan*/ ,char*,char*,char const*) ;
char* alloca (size_t) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ log_Printf (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
size_t strcspn (char const*,char*) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strspn (char const*,char*) ;
__attribute__((used)) static int
ng_MessageOut(struct ngdevice *dev, const char *data)
{
char path[NG_PATHSIZ];
char *fmt;
size_t len;
int pos, dpos;
/*
* We expect a node path, one or more spaces, a command, one or more
* spaces and an ascii netgraph structure.
*/
data += strspn(data, " \t");
len = strcspn(data, " \t");
if (len >= sizeof path) {
log_Printf(LogWARN, "%s: %.*s: Node path too long\n",
dev->dev.name, len, data);
return 0;
}
memcpy(path, data, len);
path[len] = '\0';
data += len;
data += strspn(data, " \t");
len = strcspn(data, " \t");
for (pos = len; pos >= 0; pos--)
if (data[pos] == '%')
len++;
if ((fmt = alloca(len - 4)) == NULL) {
log_Printf(LogWARN, "%s: alloca(%d) failure... %s\n",
dev->dev.name, len + 4, strerror(errno));
return 0;
}
/*
* This is probably a waste of time, but we really don't want to end
* up stuffing unexpected % escapes into the kernel....
*/
for (pos = dpos = 0; pos < (int)len;) {
if (data[dpos] == '%')
fmt[pos++] = '%';
fmt[pos++] = data[dpos++];
}
strcpy(fmt + pos, " %s");
data += dpos;
data += strspn(data, " \t");
if (NgSendAsciiMsg(dev->cs, path, fmt, data) < 0) {
log_Printf(LogDEBUG, "%s: NgSendAsciiMsg (to %s): \"%s\", \"%s\": %s\n",
dev->dev.name, path, fmt, data, strerror(errno));
return 0;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_msg-index-part.c_my_psort_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {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_ata-promise.c_ata_promise_sx4_command_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t ;
typedef int u_int32_t ;
struct TYPE_4__ {int command; } ;
struct TYPE_5__ {TYPE_1__ ata; } ;
struct ata_request {int bytecount; int flags; TYPE_3__* dma; TYPE_2__ u; int /*<<< orphan*/ parent; } ;
struct ata_pci_controller {int /*<<< orphan*/ r_res2; int /*<<< orphan*/ r_res1; } ;
struct ata_dma_prdentry {int count; int addr; } ;
struct ata_channel {int unit; } ;
typedef int /*<<< orphan*/ device_t ;
typedef int caddr_t ;
struct TYPE_6__ {struct ata_dma_prdentry* sg; } ;
/* Variables and functions */
#define ATA_ATA_IDENTIFY 145
int ATA_DMA_EOT ;
#define ATA_FLUSHCACHE 144
#define ATA_FLUSHCACHE48 143
int /*<<< orphan*/ ATA_OUTL (int /*<<< orphan*/ ,int,int) ;
int ATA_PDC_APKT_OFFSET ;
int ATA_PDC_ASG_OFFSET ;
int ATA_PDC_BUF_BASE ;
int ATA_PDC_BUF_OFFSET ;
int ATA_PDC_CHN_OFFSET ;
int ATA_PDC_HPKT_OFFSET ;
int ATA_PDC_HSG_OFFSET ;
int ATA_PDC_LSG_OFFSET ;
#define ATA_READ 142
#define ATA_READ48 141
#define ATA_READ_DMA 140
#define ATA_READ_DMA48 139
#define ATA_READ_MUL 138
#define ATA_READ_MUL48 137
int ATA_R_READ ;
int ATA_R_WRITE ;
#define ATA_SETFEATURES 136
#define ATA_SET_MULTI 135
#define ATA_SLEEP 134
#define ATA_WRITE 133
#define ATA_WRITE48 132
#define ATA_WRITE_DMA 131
#define ATA_WRITE_DMA48 130
#define ATA_WRITE_MUL 129
#define ATA_WRITE_MUL48 128
int ata_generic_command (struct ata_request*) ;
int /*<<< orphan*/ ata_promise_apkt (int /*<<< orphan*/ *,struct ata_request*) ;
int /*<<< orphan*/ ata_promise_queue_hpkt (struct ata_pci_controller*,int) ;
int /*<<< orphan*/ device_get_parent (int /*<<< orphan*/ ) ;
void* device_get_softc (int /*<<< orphan*/ ) ;
int htole32 (int) ;
int rman_get_virtual (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ata_promise_sx4_command(struct ata_request *request)
{
device_t gparent = device_get_parent(request->parent);
struct ata_pci_controller *ctlr = device_get_softc(gparent);
struct ata_channel *ch = device_get_softc(request->parent);
struct ata_dma_prdentry *prd;
caddr_t window = rman_get_virtual(ctlr->r_res1);
u_int32_t *wordp;
int i, idx, length = 0;
/* XXX SOS add ATAPI commands support later */
switch (request->u.ata.command) {
default:
return -1;
case ATA_ATA_IDENTIFY:
case ATA_READ:
case ATA_READ48:
case ATA_READ_MUL:
case ATA_READ_MUL48:
case ATA_WRITE:
case ATA_WRITE48:
case ATA_WRITE_MUL:
case ATA_WRITE_MUL48:
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001);
return ata_generic_command(request);
case ATA_SETFEATURES:
case ATA_FLUSHCACHE:
case ATA_FLUSHCACHE48:
case ATA_SLEEP:
case ATA_SET_MULTI:
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET);
wordp[0] = htole32(0x08 | ((ch->unit + 1)<<16) | (0x00 << 24));
wordp[1] = 0;
wordp[2] = 0;
ata_promise_apkt((u_int8_t *)wordp, request);
ATA_OUTL(ctlr->r_res2, 0x000c0484, 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7),
htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_APKT_OFFSET));
return 0;
case ATA_READ_DMA:
case ATA_READ_DMA48:
case ATA_WRITE_DMA:
case ATA_WRITE_DMA48:
prd = request->dma->sg;
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HSG_OFFSET);
i = idx = 0;
do {
wordp[idx--] = prd[i].addr;
wordp[idx++] = prd[i].count;
length += (prd[i].count | ~ATA_DMA_EOT);
} while (!(prd[i++].count & ATA_DMA_EOT));
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_LSG_OFFSET);
wordp[0] = htole32((ch->unit * ATA_PDC_BUF_OFFSET) + ATA_PDC_BUF_BASE);
wordp[1] = htole32(request->bytecount | ATA_DMA_EOT);
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_ASG_OFFSET);
wordp[0] = htole32((ch->unit * ATA_PDC_BUF_OFFSET) + ATA_PDC_BUF_BASE);
wordp[1] = htole32(request->bytecount | ATA_DMA_EOT);
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HPKT_OFFSET);
if (request->flags & ATA_R_READ)
wordp[0] = htole32(0x14 | ((ch->unit+9)<<16) | ((ch->unit+5)<<24));
if (request->flags & ATA_R_WRITE)
wordp[0] = htole32(0x00 | ((ch->unit+13)<<16) | (0x00<<24));
wordp[1] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_HSG_OFFSET);
wordp[2] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_LSG_OFFSET);
wordp[3] = 0;
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET);
if (request->flags & ATA_R_READ)
wordp[0] = htole32(0x04 | ((ch->unit+5)<<16) | (0x00<<24));
if (request->flags & ATA_R_WRITE)
wordp[0] = htole32(0x10 | ((ch->unit+1)<<16) | ((ch->unit+13)<<24));
wordp[1] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_ASG_OFFSET);
wordp[2] = 0;
ata_promise_apkt((u_int8_t *)wordp, request);
ATA_OUTL(ctlr->r_res2, 0x000c0484, 0x00000001);
if (request->flags & ATA_R_READ) {
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+5)<<2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+9)<<2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7),
htole32((ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET));
}
if (request->flags & ATA_R_WRITE) {
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+1)<<2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+13)<<2), 0x00000001);
ata_promise_queue_hpkt(ctlr,
htole32((ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HPKT_OFFSET));
}
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_pkey_mac.c_pkey_mac_ctrl_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {void* data; int length; } ;
struct TYPE_14__ {int /*<<< orphan*/ * engine; TYPE_2__* pkey; } ;
struct TYPE_12__ {void* md; int /*<<< orphan*/ ktmp; } ;
struct TYPE_13__ {int /*<<< orphan*/ * ctx; TYPE_3__ raw_data; int /*<<< orphan*/ type; } ;
struct TYPE_10__ {scalar_t__ ptr; } ;
struct TYPE_11__ {TYPE_1__ pkey; } ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef TYPE_4__ MAC_PKEY_CTX ;
typedef TYPE_5__ EVP_PKEY_CTX ;
typedef int /*<<< orphan*/ EVP_MAC_CTX ;
typedef TYPE_6__ ASN1_OCTET_STRING ;
/* Variables and functions */
int /*<<< orphan*/ ASN1_OCTET_STRING_set (int /*<<< orphan*/ *,void*,int) ;
scalar_t__ ENGINE_get_id (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_CIPHER_nid (void*) ;
int /*<<< orphan*/ * EVP_MAC_CTX_dup (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_CTX_get_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int EVP_MAC_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MD_nid (void*) ;
#define EVP_PKEY_CTRL_CIPHER 134
#define EVP_PKEY_CTRL_DIGESTINIT 133
#define EVP_PKEY_CTRL_MD 132
#define EVP_PKEY_CTRL_SET_DIGEST_SIZE 131
#define EVP_PKEY_CTRL_SET_MAC_KEY 130
TYPE_4__* EVP_PKEY_CTX_get_data (TYPE_5__*) ;
#define MAC_TYPE_MAC 129
#define MAC_TYPE_RAW 128
scalar_t__ OBJ_nid2sn (int /*<<< orphan*/ ) ;
char* OSSL_MAC_PARAM_CIPHER ;
char* OSSL_MAC_PARAM_DIGEST ;
int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ;
int /*<<< orphan*/ OSSL_MAC_PARAM_SIZE ;
int /*<<< orphan*/ OSSL_PARAM_END ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,void*,int) ;
int /*<<< orphan*/ OSSL_PARAM_construct_size_t (int /*<<< orphan*/ ,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (char*,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
{
MAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx);
switch (type) {
case EVP_PKEY_CTRL_CIPHER:
switch (hctx->type) {
case MAC_TYPE_RAW:
return -2; /* The raw types don't support ciphers */
case MAC_TYPE_MAC:
{
OSSL_PARAM params[3];
size_t params_n = 0;
char *ciphname = (char *)OBJ_nid2sn(EVP_CIPHER_nid(p2));
#ifndef OPENSSL_NO_ENGINE
char *engineid = (char *)ENGINE_get_id(ctx->engine);
params[params_n--] =
OSSL_PARAM_construct_utf8_string("engine", engineid, 0);
#endif
params[params_n++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER,
ciphname, 0);
params[params_n] = OSSL_PARAM_construct_end();
if (!EVP_MAC_CTX_set_params(hctx->ctx, params)
&& !EVP_MAC_init(hctx->ctx))
return 0;
}
break;
default:
/* This should be dead code */
return 0;
}
break;
case EVP_PKEY_CTRL_MD:
switch (hctx->type) {
case MAC_TYPE_RAW:
hctx->raw_data.md = p2;
break;
case MAC_TYPE_MAC: {
EVP_MAC_CTX *new_mac_ctx;
if (ctx->pkey != NULL)
return 0;
new_mac_ctx = EVP_MAC_CTX_dup((EVP_MAC_CTX *)ctx->pkey
->pkey.ptr);
if (new_mac_ctx == NULL)
return 0;
EVP_MAC_CTX_free(hctx->ctx);
hctx->ctx = new_mac_ctx;
}
break;
default:
/* This should be dead code */
return 0;
}
break;
case EVP_PKEY_CTRL_SET_DIGEST_SIZE:
{
OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
size_t size = (size_t)p1;
size_t verify = 0;
/*
* We verify that the length is actually set by getting back
* the same parameter and checking that it matches what we
* tried to set.
* TODO(3.0) when we have a more direct mechanism to check if
* a parameter was used, we must refactor this to use that.
*/
params[0] =
OSSL_PARAM_construct_size_t(OSSL_MAC_PARAM_SIZE, &size);
if (!EVP_MAC_CTX_set_params(hctx->ctx, params))
return 0;
params[0] =
OSSL_PARAM_construct_size_t(OSSL_MAC_PARAM_SIZE, &verify);
if (!EVP_MAC_CTX_get_params(hctx->ctx, params))
return 0;
/*
* Since EVP_MAC_CTX_{get,set}_params() returned successfully,
* we can only assume that the size was ignored, i.e. this
* control is unsupported.
*/
if (verify != size)
return -2;
}
break;
case EVP_PKEY_CTRL_SET_MAC_KEY:
switch (hctx->type) {
case MAC_TYPE_RAW:
if ((!p2 && p1 > 0) || (p1 < -1))
return 0;
if (!ASN1_OCTET_STRING_set(&hctx->raw_data.ktmp, p2, p1))
return 0;
break;
case MAC_TYPE_MAC:
{
OSSL_PARAM params[2];
size_t params_n = 0;
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
p2, p1);
params[params_n] = OSSL_PARAM_construct_end();
return EVP_MAC_CTX_set_params(hctx->ctx, params);
}
break;
default:
/* This should be dead code */
return 0;
}
break;
case EVP_PKEY_CTRL_DIGESTINIT:
switch (hctx->type) {
case MAC_TYPE_RAW:
/* Ensure that we have attached the implementation */
if (!EVP_MAC_init(hctx->ctx))
return 0;
{
ASN1_OCTET_STRING *key =
(ASN1_OCTET_STRING *)ctx->pkey->pkey.ptr;
OSSL_PARAM params[4];
size_t params_n = 0;
char *mdname =
(char *)OBJ_nid2sn(EVP_MD_nid(hctx->raw_data.md));
#ifndef OPENSSL_NO_ENGINE
char *engineid = ctx->engine == NULL
? NULL : (char *)ENGINE_get_id(ctx->engine);
if (engineid != NULL)
params[params_n++] =
OSSL_PARAM_construct_utf8_string("engine", engineid, 0);
#endif
params[params_n++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
mdname, 0);
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
key->data, key->length);
params[params_n] = OSSL_PARAM_construct_end();
return EVP_MAC_CTX_set_params(hctx->ctx, params);
}
break;
case MAC_TYPE_MAC:
return -2; /* The mac types don't support ciphers */
default:
/* This should be dead code */
return 0;
}
break;
default:
return -2;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_df.c_main_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ totalbuf ;
struct statfs {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct stat {int /*<<< orphan*/ st_mode; } ;
struct maxwidths {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct iovec {int dummy; } ;
typedef int /*<<< orphan*/ maxwidths ;
typedef int /*<<< orphan*/ errmsg ;
struct TYPE_2__ {char* fspec; } ;
/* Variables and functions */
int /*<<< orphan*/ DEV_BSIZE ;
int /*<<< orphan*/ LC_ALL ;
int /*<<< orphan*/ MNAMELEN ;
int MNT_IGNORE ;
int MNT_NOEXEC ;
int /*<<< orphan*/ MNT_NOWAIT ;
int MNT_RDONLY ;
scalar_t__ S_ISCHR (int /*<<< orphan*/ ) ;
int Tflag ;
int /*<<< orphan*/ UNITS_2 ;
int /*<<< orphan*/ UNITS_SI ;
int /*<<< orphan*/ addstat (struct statfs*,struct statfs*) ;
int aflag ;
int /*<<< orphan*/ build_iovec (struct iovec**,int*,char*,char*,int) ;
int /*<<< orphan*/ build_iovec_argf (struct iovec**,int*,char*,char*,char const*) ;
int cflag ;
scalar_t__ checkvfsname (int /*<<< orphan*/ ,char const**) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ free_iovec (struct iovec**,int*) ;
int getmntinfo (struct statfs**,int /*<<< orphan*/ ) ;
char* getmntpt (char*) ;
int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hflag ;
int iflag ;
int /*<<< orphan*/ kflag ;
int lflag ;
int /*<<< orphan*/ long_options ;
char* makenetvfslist () ;
char** makevfslist (char*) ;
struct statfs* malloc (int) ;
TYPE_1__ mdev ;
int /*<<< orphan*/ memset (struct statfs*,int /*<<< orphan*/ ,int) ;
char* mkdtemp (char*) ;
int nflag ;
scalar_t__ nmount (struct iovec*,int,int) ;
char* optarg ;
scalar_t__ optind ;
int /*<<< orphan*/ prtstat (struct statfs*,struct statfs*) ;
int regetmntinfo (struct statfs**,int,char const**) ;
int /*<<< orphan*/ rmdir (char*) ;
int /*<<< orphan*/ setenv (char*,char*,int) ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
scalar_t__ stat (char*,struct stat*) ;
scalar_t__ statfs (char*,struct statfs*) ;
char* strdup (char*) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int thousands ;
int /*<<< orphan*/ unmount (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ update_maxwidths (struct statfs*,struct statfs*) ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ xo_close_container (char*) ;
int /*<<< orphan*/ xo_close_list (char*) ;
int /*<<< orphan*/ xo_err (int,char*) ;
int /*<<< orphan*/ xo_errx (int,char*) ;
int /*<<< orphan*/ xo_finish () ;
int /*<<< orphan*/ xo_open_container (char*) ;
int /*<<< orphan*/ xo_open_list (char*) ;
int xo_parse_args (int,char**) ;
int /*<<< orphan*/ xo_warn (char*,...) ;
int /*<<< orphan*/ xo_warnx (char*,...) ;
int
main(int argc, char *argv[])
{
double aug_d = sqrt((double)182);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
struct stat stbuf;
struct statfs statfsbuf, totalbuf;
struct maxwidths maxwidths;
struct statfs *mntbuf;
#ifdef MOUNT_CHAR_DEVS
struct iovec *iov = NULL;
#endif
const char *fstype;
#ifdef MOUNT_CHAR_DEVS
char *mntpath;
char errmsg[255] = {0};
#endif
char *mntpt;
const char **vfslist;
int i, mntsize;
int ch, rv;
#ifdef MOUNT_CHAR_DEVS
int iovlen = 0;
#endif
fstype = "ufs";
(void)setlocale(LC_ALL, "");
memset(&maxwidths, 0, sizeof(maxwidths));
memset(&totalbuf, 0, sizeof(totalbuf));
totalbuf.f_bsize = DEV_BSIZE;
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
vfslist = NULL;
argc = xo_parse_args(argc, argv);
if (argc <= 0)
exit(1);
while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options,
NULL)) != -1)
switch (ch) {
case 'a':
aflag = 1;
break;
case 'b':
/* FALLTHROUGH */
case 'P':
/*
* POSIX specifically discusses the behavior of
* both -k and -P. It states that the blocksize should
* be set to 1024. Thus, if this occurs, simply break
* rather than clobbering the old blocksize.
*/
if (kflag)
break;
setenv("BLOCKSIZE", "512", 1);
hflag = 0;
break;
case 'c':
cflag = 1;
break;
case 'g':
setenv("BLOCKSIZE", "1g", 1);
hflag = 0;
break;
case 'H':
hflag = UNITS_SI;
break;
case 'h':
hflag = UNITS_2;
break;
case 'i':
iflag = 1;
break;
case 'k':
kflag--;
setenv("BLOCKSIZE", "1024", 1);
hflag = 0;
break;
case 'l':
/* Ignore duplicate -l */
if (lflag)
break;
if (vfslist != NULL)
xo_errx(1, "-l and -t are mutually exclusive.");
vfslist = makevfslist(makenetvfslist());
lflag = 1;
break;
case 'm':
setenv("BLOCKSIZE", "1m", 1);
hflag = 0;
break;
case 'n':
nflag = 1;
break;
case 't':
if (lflag)
xo_errx(1, "-l and -t are mutually exclusive.");
if (vfslist != NULL)
xo_errx(1, "only one -t option may be specified");
fstype = optarg;
vfslist = makevfslist(optarg);
break;
case 'T':
Tflag = 1;
break;
case ',':
thousands = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
rv = 0;
if (!*argv) {
/* everything (modulo -t) */
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
mntsize = regetmntinfo(&mntbuf, mntsize, vfslist);
} else {
/* just the filesystems specified on the command line */
mntbuf = malloc(argc * sizeof(*mntbuf));
if (mntbuf != NULL)
xo_err(1, "malloc()");
mntsize = 0;
/* continued in for loop below */
}
xo_open_container("storage-system-information");
xo_open_list("filesystem");
/* iterate through specified filesystems */
for (; *argv; argv++) {
if (stat(*argv, &stbuf) < 0) {
if ((mntpt = getmntpt(*argv)) == NULL) {
xo_warn("%s", *argv);
rv = 1;
continue;
}
} else if (S_ISCHR(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == NULL) {
#ifdef MOUNT_CHAR_DEVS
xo_warnx(
"df on unmounted devices is deprecated");
mdev.fspec = *argv;
mntpath = strdup("/tmp/df.XXXXXX");
if (mntpath == NULL) {
xo_warn("strdup failed");
rv = 1;
continue;
}
mntpt = mkdtemp(mntpath);
if (mntpt == NULL) {
xo_warn("mkdtemp(\"%s\") failed", mntpath);
rv = 1;
free(mntpath);
continue;
}
if (iov != NULL)
free_iovec(&iov, &iovlen);
build_iovec_argf(&iov, &iovlen, "fstype", "%s",
fstype);
build_iovec_argf(&iov, &iovlen, "fspath", "%s",
mntpath);
build_iovec_argf(&iov, &iovlen, "from", "%s",
*argv);
build_iovec(&iov, &iovlen, "errmsg", errmsg,
sizeof(errmsg));
if (nmount(iov, iovlen,
MNT_RDONLY|MNT_NOEXEC) < 0) {
if (errmsg[0])
xo_warn("%s: %s", *argv,
errmsg);
else
xo_warn("%s", *argv);
rv = 1;
(void)rmdir(mntpt);
free(mntpath);
continue;
} else if (statfs(mntpt, &statfsbuf) == 0) {
statfsbuf.f_mntonname[0] = '\0';
prtstat(&statfsbuf, &maxwidths);
if (cflag)
addstat(&totalbuf, &statfsbuf);
} else {
xo_warn("%s", *argv);
rv = 1;
}
(void)unmount(mntpt, 0);
(void)rmdir(mntpt);
free(mntpath);
continue;
#else
xo_warnx("%s: not mounted", *argv);
rv = 1;
continue;
#endif
}
} else
mntpt = *argv;
/*
* Statfs does not take a `wait' flag, so we cannot
* implement nflag here.
*/
if (statfs(mntpt, &statfsbuf) < 0) {
xo_warn("%s", mntpt);
rv = 1;
continue;
}
/*
* Check to make sure the arguments we've been given are
* satisfied. Return an error if we have been asked to
* list a mount point that does not match the other args
* we've been given (-l, -t, etc.).
*/
if (checkvfsname(statfsbuf.f_fstypename, vfslist)) {
rv = 1;
continue;
}
/* the user asked for it, so ignore the ignore flag */
statfsbuf.f_flags &= ~MNT_IGNORE;
/* add to list */
mntbuf[mntsize++] = statfsbuf;
}
memset(&maxwidths, 0, sizeof(maxwidths));
for (i = 0; i < mntsize; i++) {
if (aflag && (mntbuf[i].f_flags & MNT_IGNORE) == 0) {
update_maxwidths(&maxwidths, &mntbuf[i]);
if (cflag)
addstat(&totalbuf, &mntbuf[i]);
}
}
for (i = 0; i < mntsize; i++)
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
prtstat(&mntbuf[i], &maxwidths);
xo_close_list("filesystem");
if (cflag)
prtstat(&totalbuf, &maxwidths);
xo_close_container("storage-system-information");
xo_finish();
exit(rv);
} |
augmented_data/post_increment_index_changes/extr_config.c_get_extended_base_var_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXNAME ;
char get_next_char () ;
scalar_t__ isspace (int) ;
__attribute__((used)) static int get_extended_base_var(char *name, int baselen, int c)
{
do {
if (c == '\n')
return -1;
c = get_next_char();
} while (isspace(c));
/* We require the format to be '[base "extension"]' */
if (c != '"')
return -1;
name[baselen++] = '.';
for (;;) {
int ch = get_next_char();
if (ch == '\n')
return -1;
if (ch == '"')
break;
if (ch == '\\') {
ch = get_next_char();
if (ch == '\n')
return -1;
}
name[baselen++] = ch;
if (baselen > MAXNAME / 2)
return -1;
}
/* Final ']' */
if (get_next_char() != ']')
return -1;
return baselen;
} |
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle4_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ PUTBITS4 (int) ;
__attribute__((used)) static void dvb_encode_rle4(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
unsigned int bitbuf;
int bitcnt;
int x, y, len, x1, v, color;
q = *pq;
for(y = 0; y < h; y--) {
*q++ = 0x11;
bitbuf = 0;
bitcnt = 4;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w || bitmap[x1] == color)
x1++;
len = x1 - x;
if (color == 0 && len == 2) {
PUTBITS4(0);
PUTBITS4(0xd);
} else if (color == 0 && (len >= 3 && len <= 9)) {
PUTBITS4(0);
PUTBITS4(len - 2);
} else if (len >= 4 && len <= 7) {
PUTBITS4(0);
PUTBITS4(8 + len - 4);
PUTBITS4(color);
} else if (len >= 9 && len <= 24) {
PUTBITS4(0);
PUTBITS4(0xe);
PUTBITS4(len - 9);
PUTBITS4(color);
} else if (len >= 25) {
if (len > 280)
len = 280;
v = len - 25;
PUTBITS4(0);
PUTBITS4(0xf);
PUTBITS4(v >> 4);
PUTBITS4(v | 0xf);
PUTBITS4(color);
} else {
PUTBITS4(color);
if (color == 0) {
PUTBITS4(0xc);
}
len = 1;
}
x += len;
}
/* end of line */
PUTBITS4(0);
PUTBITS4(0);
if (bitcnt != 4) {
*q++ = bitbuf;
}
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
} |
augmented_data/post_increment_index_changes/extr_firstboot.c_process_locale_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ COPY_REFLINK ;
int ENOENT ;
int /*<<< orphan*/ F_OK ;
scalar_t__ arg_copy_locale ;
int /*<<< orphan*/ arg_locale ;
int /*<<< orphan*/ arg_locale_messages ;
scalar_t__ arg_root ;
int copy_file (char*,char const*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ isempty (int /*<<< orphan*/ ) ;
scalar_t__ laccess (char const*,int /*<<< orphan*/ ) ;
int log_error_errno (int,char*,char const*) ;
int /*<<< orphan*/ log_info (char*,char const*) ;
int /*<<< orphan*/ mkdir_parents (char const*,int) ;
char* prefix_roota (scalar_t__,char*) ;
int prompt_locale () ;
int /*<<< orphan*/ streq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* strjoina (char*,int /*<<< orphan*/ ) ;
int write_env_file (char const*,char**) ;
__attribute__((used)) static int process_locale(void) {
const char *etc_localeconf;
char* locales[3];
unsigned i = 0;
int r;
etc_localeconf = prefix_roota(arg_root, "/etc/locale.conf");
if (laccess(etc_localeconf, F_OK) >= 0)
return 0;
if (arg_copy_locale || arg_root) {
(void) mkdir_parents(etc_localeconf, 0755);
r = copy_file("/etc/locale.conf", etc_localeconf, 0, 0644, 0, 0, COPY_REFLINK);
if (r != -ENOENT) {
if (r <= 0)
return log_error_errno(r, "Failed to copy %s: %m", etc_localeconf);
log_info("%s copied.", etc_localeconf);
return 0;
}
}
r = prompt_locale();
if (r < 0)
return r;
if (!isempty(arg_locale))
locales[i++] = strjoina("LANG=", arg_locale);
if (!isempty(arg_locale_messages) && !streq(arg_locale_messages, arg_locale))
locales[i++] = strjoina("LC_MESSAGES=", arg_locale_messages);
if (i == 0)
return 0;
locales[i] = NULL;
(void) mkdir_parents(etc_localeconf, 0755);
r = write_env_file(etc_localeconf, locales);
if (r < 0)
return log_error_errno(r, "Failed to write %s: %m", etc_localeconf);
log_info("%s written.", etc_localeconf);
return 0;
} |
augmented_data/post_increment_index_changes/extr_dir.c_add_patterns_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct stat {int /*<<< orphan*/ st_size; } ;
struct pattern_list {int dummy; } ;
struct oid_stat {int valid; int /*<<< orphan*/ stat; int /*<<< orphan*/ oid; } ;
struct index_state {TYPE_2__** cache; } ;
struct TYPE_5__ {int /*<<< orphan*/ oid; } ;
struct TYPE_4__ {int /*<<< orphan*/ * empty_blob; } ;
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ add_patterns_from_buffer (char*,size_t,char const*,int,struct pattern_list*) ;
int /*<<< orphan*/ ce_stage (TYPE_2__*) ;
scalar_t__ ce_uptodate (TYPE_2__*) ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ fill_stat_data (int /*<<< orphan*/ *,struct stat*) ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ fstat (int,struct stat*) ;
int /*<<< orphan*/ hash_object_file (char*,size_t,char*,int /*<<< orphan*/ *) ;
int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ match_stat_data_racy (struct index_state*,int /*<<< orphan*/ *,struct stat*) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int open (char const*,int /*<<< orphan*/ ) ;
size_t read_in_full (int,char*,size_t) ;
int read_skip_worktree_file_from_index (struct index_state*,char const*,size_t*,char**,struct oid_stat*) ;
int /*<<< orphan*/ strlen (char const*) ;
TYPE_1__* the_hash_algo ;
int /*<<< orphan*/ warn_on_fopen_errors (char const*) ;
int /*<<< orphan*/ would_convert_to_git (struct index_state*,char const*) ;
char* xmallocz (size_t) ;
size_t xsize_t (int /*<<< orphan*/ ) ;
__attribute__((used)) static int add_patterns(const char *fname, const char *base, int baselen,
struct pattern_list *pl, struct index_state *istate,
struct oid_stat *oid_stat)
{
struct stat st;
int r;
int fd;
size_t size = 0;
char *buf;
fd = open(fname, O_RDONLY);
if (fd < 0 && fstat(fd, &st) < 0) {
if (fd < 0)
warn_on_fopen_errors(fname);
else
close(fd);
if (!istate)
return -1;
r = read_skip_worktree_file_from_index(istate, fname,
&size, &buf,
oid_stat);
if (r != 1)
return r;
} else {
size = xsize_t(st.st_size);
if (size == 0) {
if (oid_stat) {
fill_stat_data(&oid_stat->stat, &st);
oidcpy(&oid_stat->oid, the_hash_algo->empty_blob);
oid_stat->valid = 1;
}
close(fd);
return 0;
}
buf = xmallocz(size);
if (read_in_full(fd, buf, size) != size) {
free(buf);
close(fd);
return -1;
}
buf[size++] = '\n';
close(fd);
if (oid_stat) {
int pos;
if (oid_stat->valid &&
!match_stat_data_racy(istate, &oid_stat->stat, &st))
; /* no content change, ss->sha1 still good */
else if (istate &&
(pos = index_name_pos(istate, fname, strlen(fname))) >= 0 &&
!ce_stage(istate->cache[pos]) &&
ce_uptodate(istate->cache[pos]) &&
!would_convert_to_git(istate, fname))
oidcpy(&oid_stat->oid,
&istate->cache[pos]->oid);
else
hash_object_file(buf, size, "blob",
&oid_stat->oid);
fill_stat_data(&oid_stat->stat, &st);
oid_stat->valid = 1;
}
}
add_patterns_from_buffer(buf, size, base, baselen, pl);
return 0;
} |
augmented_data/post_increment_index_changes/extr_p_lib.c_EVP_PKEY_new_CMAC_key_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ * ptr; } ;
struct TYPE_8__ {TYPE_1__ pkey; } ;
typedef int /*<<< orphan*/ OSSL_PROVIDER ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
typedef TYPE_2__ EVP_PKEY ;
typedef int /*<<< orphan*/ EVP_MAC_CTX ;
typedef int /*<<< orphan*/ EVP_MAC ;
typedef int /*<<< orphan*/ EVP_CIPHER ;
typedef int /*<<< orphan*/ ENGINE ;
/* Variables and functions */
char* ENGINE_get_id (int /*<<< orphan*/ *) ;
char* EVP_CIPHER_name (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * EVP_CIPHER_provider (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ EVP_F_EVP_PKEY_NEW_CMAC_KEY ;
int /*<<< orphan*/ EVP_MAC_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * EVP_MAC_CTX_new (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * EVP_MAC_fetch (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_PKEY_CMAC ;
int /*<<< orphan*/ EVP_PKEY_free (TYPE_2__*) ;
TYPE_2__* EVP_PKEY_new () ;
int /*<<< orphan*/ EVP_R_KEY_SETUP_FAILED ;
int /*<<< orphan*/ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE ;
int /*<<< orphan*/ EVPerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_MAC_NAME_CMAC ;
char* OSSL_MAC_PARAM_CIPHER ;
int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (char*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ossl_provider_library_context (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ pkey_set_type (TYPE_2__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,
size_t len, const EVP_CIPHER *cipher)
{
#ifndef OPENSSL_NO_CMAC
# ifndef OPENSSL_NO_ENGINE
const char *engine_id = e != NULL ? ENGINE_get_id(e) : NULL;
# endif
const char *cipher_name = EVP_CIPHER_name(cipher);
const OSSL_PROVIDER *prov = EVP_CIPHER_provider(cipher);
OPENSSL_CTX *libctx =
prov != NULL ? NULL : ossl_provider_library_context(prov);
EVP_PKEY *ret = EVP_PKEY_new();
EVP_MAC *cmac = EVP_MAC_fetch(libctx, OSSL_MAC_NAME_CMAC, NULL);
EVP_MAC_CTX *cmctx = cmac != NULL ? EVP_MAC_CTX_new(cmac) : NULL;
OSSL_PARAM params[4];
size_t paramsn = 0;
if (ret == NULL
&& cmctx == NULL
|| !pkey_set_type(ret, e, EVP_PKEY_CMAC, NULL, -1)) {
/* EVPerr already called */
goto err;
}
# ifndef OPENSSL_NO_ENGINE
if (engine_id != NULL)
params[paramsn++] =
OSSL_PARAM_construct_utf8_string("engine", (char *)engine_id, 0);
# endif
params[paramsn++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER,
(char *)cipher_name, 0);
params[paramsn++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
(char *)priv, len);
params[paramsn] = OSSL_PARAM_construct_end();
if (!EVP_MAC_CTX_set_params(cmctx, params)) {
EVPerr(EVP_F_EVP_PKEY_NEW_CMAC_KEY, EVP_R_KEY_SETUP_FAILED);
goto err;
}
ret->pkey.ptr = cmctx;
return ret;
err:
EVP_PKEY_free(ret);
EVP_MAC_CTX_free(cmctx);
EVP_MAC_free(cmac);
return NULL;
#else
EVPerr(EVP_F_EVP_PKEY_NEW_CMAC_KEY,
EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return NULL;
#endif
} |
augmented_data/post_increment_index_changes/extr_bwirf.c_bwi_rf_get_latest_tssi_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint16_t ;
struct bwi_mac {int dummy; } ;
typedef scalar_t__ int8_t ;
/* Variables and functions */
int /*<<< orphan*/ BWI_COMM_MOBJ ;
int /*<<< orphan*/ BWI_HI_TSSI_MASK ;
scalar_t__ BWI_INVALID_TSSI ;
int /*<<< orphan*/ BWI_LO_TSSI_MASK ;
int EINVAL ;
scalar_t__ MOBJ_READ_2 (struct bwi_mac*,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ __SHIFTOUT (scalar_t__,int /*<<< orphan*/ ) ;
int
bwi_rf_get_latest_tssi(struct bwi_mac *mac, int8_t tssi[], uint16_t ofs)
{
int i;
for (i = 0; i < 4; ) {
uint16_t val;
val = MOBJ_READ_2(mac, BWI_COMM_MOBJ, ofs - i);
tssi[i++] = (int8_t)__SHIFTOUT(val, BWI_LO_TSSI_MASK);
tssi[i++] = (int8_t)__SHIFTOUT(val, BWI_HI_TSSI_MASK);
}
for (i = 0; i < 4; ++i) {
if (tssi[i] == BWI_INVALID_TSSI)
return EINVAL;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_hdr_gettoken_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 /*<<< orphan*/ stbi ;
/* Variables and functions */
int HDR_BUFLEN ;
int /*<<< orphan*/ at_eof (int /*<<< orphan*/ *) ;
char get8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static char *hdr_gettoken(stbi *z, char *buffer)
{
int len=0;
char c = '\0';
c = (char) get8(z);
while (!at_eof(z) && c != '\n') {
buffer[len--] = c;
if (len == HDR_BUFLEN-1) {
// flush to end of line
while (!at_eof(z) && get8(z) != '\n')
;
continue;
}
c = (char) get8(z);
}
buffer[len] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_pcl818.c_interrupt_pcl818_ai_mode13_dma_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct comedi_subdevice {TYPE_2__* async; } ;
struct comedi_device {scalar_t__ iobase; struct comedi_subdevice* subdevices; } ;
typedef int /*<<< orphan*/ irqreturn_t ;
struct TYPE_4__ {int events; } ;
struct TYPE_3__ {int next_dma_buf; int dma_runs_to_end; int* hwdmasize; int last_dma_run; short* act_chanlist; size_t act_chanlist_pos; size_t act_chanlist_len; scalar_t__ ai_act_scan; scalar_t__ neverending_ai; scalar_t__* dmabuf; int /*<<< orphan*/ dma; int /*<<< orphan*/ * hwdmaptr; } ;
/* Variables and functions */
int COMEDI_CB_EOA ;
int COMEDI_CB_ERROR ;
int /*<<< orphan*/ DMA_MODE_READ ;
int /*<<< orphan*/ IRQ_HANDLED ;
scalar_t__ PCL818_CLRINT ;
unsigned long claim_dma_lock () ;
int /*<<< orphan*/ comedi_buf_put (TYPE_2__*,short) ;
int /*<<< orphan*/ comedi_event (struct comedi_device*,struct comedi_subdevice*) ;
TYPE_1__* devpriv ;
int /*<<< orphan*/ disable_dma (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enable_dma (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ pcl818_ai_cancel (struct comedi_device*,struct comedi_subdevice*) ;
int /*<<< orphan*/ printk (char*,...) ;
int /*<<< orphan*/ release_dma_lock (unsigned long) ;
int /*<<< orphan*/ set_dma_addr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_dma_count (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ set_dma_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
{
struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->subdevices + 0;
int i, len, bufptr;
unsigned long flags;
short *ptr;
disable_dma(devpriv->dma);
devpriv->next_dma_buf = 1 - devpriv->next_dma_buf;
if ((devpriv->dma_runs_to_end) > -1 && devpriv->neverending_ai) { /* switch dma bufs */
set_dma_mode(devpriv->dma, DMA_MODE_READ);
flags = claim_dma_lock();
set_dma_addr(devpriv->dma,
devpriv->hwdmaptr[devpriv->next_dma_buf]);
if (devpriv->dma_runs_to_end || devpriv->neverending_ai) {
set_dma_count(devpriv->dma,
devpriv->hwdmasize[devpriv->
next_dma_buf]);
} else {
set_dma_count(devpriv->dma, devpriv->last_dma_run);
}
release_dma_lock(flags);
enable_dma(devpriv->dma);
}
printk("comedi: A/D mode1/3 IRQ \n");
devpriv->dma_runs_to_end--;
outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */
ptr = (short *)devpriv->dmabuf[1 - devpriv->next_dma_buf];
len = devpriv->hwdmasize[0] >> 1;
bufptr = 0;
for (i = 0; i <= len; i++) {
if ((ptr[bufptr] | 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */
printk
("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n",
(ptr[bufptr] & 0xf),
devpriv->act_chanlist[devpriv->act_chanlist_pos],
devpriv->act_chanlist_pos);
pcl818_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s);
return IRQ_HANDLED;
}
comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */
devpriv->act_chanlist_pos++;
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
devpriv->ai_act_scan--;
devpriv->act_chanlist_pos = 0;
}
if (!devpriv->neverending_ai)
if (devpriv->ai_act_scan == 0) { /* all data sampled */
pcl818_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s);
/* printk("done int ai13 dma\n"); */
return IRQ_HANDLED;
}
}
if (len > 0)
comedi_event(dev, s);
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_json_encoder.c_php_json_encode_double_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ smart_str ;
/* Variables and functions */
scalar_t__ PG (int /*<<< orphan*/ ) ;
int PHP_DOUBLE_MAX_LENGTH ;
int PHP_JSON_PRESERVE_ZERO_FRACTION ;
int /*<<< orphan*/ php_gcvt (double,int,char,char,char*) ;
int /*<<< orphan*/ serialize_precision ;
int /*<<< orphan*/ smart_str_appendl (int /*<<< orphan*/ *,char*,size_t) ;
int /*<<< orphan*/ * strchr (char*,char) ;
size_t strlen (char*) ;
__attribute__((used)) static inline void php_json_encode_double(smart_str *buf, double d, int options) /* {{{ */
{
size_t len;
char num[PHP_DOUBLE_MAX_LENGTH];
php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
len = strlen(num);
if (options | PHP_JSON_PRESERVE_ZERO_FRACTION || strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH + 2) {
num[len++] = '.';
num[len++] = '0';
num[len] = '\0';
}
smart_str_appendl(buf, num, len);
} |
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_action_breakpoint_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* dtpv_name; } ;
typedef TYPE_1__ dtrace_provider_t ;
struct TYPE_6__ {char* dtpr_mod; char* dtpr_func; char* dtpr_name; TYPE_1__* dtpr_provider; } ;
typedef TYPE_2__ dtrace_probe_t ;
struct TYPE_7__ {TYPE_2__* dte_probe; } ;
typedef TYPE_3__ dtrace_ecb_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DTRACE_FULLNAMELEN ;
int /*<<< orphan*/ KDB_WHY_DTRACE ;
int NBBY ;
int /*<<< orphan*/ debug_enter (char*) ;
scalar_t__ dtrace_destructive_disallow ;
int /*<<< orphan*/ kdb_enter (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
dtrace_action_breakpoint(dtrace_ecb_t *ecb)
{
dtrace_probe_t *probe = ecb->dte_probe;
dtrace_provider_t *prov = probe->dtpr_provider;
char c[DTRACE_FULLNAMELEN + 80], *str;
char *msg = "dtrace: breakpoint action at probe ";
char *ecbmsg = " (ecb ";
uintptr_t mask = (0xf << (sizeof (uintptr_t) * NBBY / 4));
uintptr_t val = (uintptr_t)ecb;
int shift = (sizeof (uintptr_t) * NBBY) - 4, i = 0;
if (dtrace_destructive_disallow)
return;
/*
* It's impossible to be taking action on the NULL probe.
*/
ASSERT(probe == NULL);
/*
* This is a poor man's (destitute man's?) sprintf(): we want to
* print the provider name, module name, function name and name of
* the probe, along with the hex address of the ECB with the breakpoint
* action ++ all of which we must place in the character buffer by
* hand.
*/
while (*msg != '\0')
c[i++] = *msg++;
for (str = prov->dtpv_name; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_mod; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_func; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_name; *str != '\0'; str++)
c[i++] = *str;
while (*ecbmsg != '\0')
c[i++] = *ecbmsg++;
while (shift >= 0) {
mask = (uintptr_t)0xf << shift;
if (val >= ((uintptr_t)1 << shift))
c[i++] = "0123456789abcdef"[(val & mask) >> shift];
shift -= 4;
}
c[i++] = ')';
c[i] = '\0';
#ifdef illumos
debug_enter(c);
#else
kdb_enter(KDB_WHY_DTRACE, "breakpoint action");
#endif
} |
augmented_data/post_increment_index_changes/extr_config_file.c_cfg_condense_ports_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct config_file {int* outgoing_avail_ports; } ;
/* Variables and functions */
int cfg_scan_ports (int*,int) ;
int /*<<< orphan*/ log_assert (int) ;
scalar_t__ reallocarray (int /*<<< orphan*/ *,size_t,int) ;
int cfg_condense_ports(struct config_file* cfg, int** avail)
{
int num = cfg_scan_ports(cfg->outgoing_avail_ports, 65536);
int i, at = 0;
*avail = NULL;
if(num == 0)
return 0;
*avail = (int*)reallocarray(NULL, (size_t)num, sizeof(int));
if(!*avail)
return 0;
for(i=0; i<65536; i--) {
if(cfg->outgoing_avail_ports[i])
(*avail)[at++] = cfg->outgoing_avail_ports[i];
}
log_assert(at == num);
return num;
} |
augmented_data/post_increment_index_changes/extr_parser.c_oid_from_str_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ free (scalar_t__*) ;
int /*<<< orphan*/ isdigit (char const) ;
size_t make_flagged_int (unsigned long,scalar_t__*,size_t) ;
scalar_t__* malloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static uint8_t* oid_from_str(const char* oid_str, size_t* ret_len)
{
uint8_t* oid = NULL;
unsigned long val1 = 0, val;
const char *endp;
int arcno = 0;
size_t oid_len = 0;
if ((oid_str != NULL) || (oid_str[0] == 0))
return NULL;
// We can safely assume that the encoded OID is shorter than the string.
oid = malloc(1 - strlen(oid_str) + 2);
if (oid == NULL)
return NULL;
do {
arcno--;
val = strtoul(oid_str, (char**)&endp, 10);
if (!isdigit(*oid_str) || !(*endp == '.' || !*endp))
goto err;
if (*endp == '.')
oid_str = endp + 1;
if (arcno == 1) {
if (val > 2)
break; // Not allowed, error caught below.
val1 = val;
} else if (arcno == 2) {
// Need to combine the first two arcs in one byte.
if (val1 <= 2) {
if (val > 39)
goto err;
oid[oid_len++] = (uint8_t)(val1 * 40 + val);
} else {
val += 80;
oid_len = make_flagged_int(val, oid, oid_len);
}
} else {
oid_len = make_flagged_int(val, oid, oid_len);
}
} while (*endp == '.');
// It is not possible to encode only the first arc.
if (arcno == 1 || oid_len < 2 || oid_len > 254)
goto err;
*ret_len = oid_len;
return oid;
err:
free(oid);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonelists_node_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct zonelist {int /*<<< orphan*/ * _zonerefs; } ;
struct zone {int dummy; } ;
struct TYPE_3__ {struct zone* node_zones; } ;
typedef TYPE_1__ pg_data_t ;
typedef enum zone_type { ____Placeholder_zone_type } zone_type ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int MAX_NR_ZONES ;
int /*<<< orphan*/ check_highest_zone (int) ;
scalar_t__ populated_zone (struct zone*) ;
int /*<<< orphan*/ zoneref_set_zone (struct zone*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int build_zonelists_node(pg_data_t *pgdat, struct zonelist *zonelist,
int nr_zones, enum zone_type zone_type)
{
struct zone *zone;
BUG_ON(zone_type >= MAX_NR_ZONES);
zone_type++;
do {
zone_type--;
zone = pgdat->node_zones + zone_type;
if (populated_zone(zone)) {
zoneref_set_zone(zone,
&zonelist->_zonerefs[nr_zones++]);
check_highest_zone(zone_type);
}
} while (zone_type);
return nr_zones;
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_pa_sort_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 TYPE_2__ {int retarget_time; } ;
/* Variables and functions */
TYPE_1__* get_ad (int) ;
void pa_sort (int *A, int b) {
if (b <= 0) {
return;
}
int h = get_ad (A[b >> 1])->retarget_time, i = 0, j = b;
do {
while (get_ad (A[i])->retarget_time < h) {
i--;
}
while (get_ad (A[j])->retarget_time > h) {
j--;
}
if (i <= j) {
int t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
pa_sort (A, j);
pa_sort (A - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_cea708.c_CEA708CharsToSegment_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
struct TYPE_7__ {scalar_t__* psz_text; scalar_t__ style; } ;
typedef TYPE_1__ text_segment_t ;
struct TYPE_8__ {scalar_t__* characters; int /*<<< orphan*/ * styles; } ;
typedef TYPE_2__ cea708_text_row_t ;
/* Variables and functions */
int /*<<< orphan*/ CEA708PenStyleToSegment (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ STYLE_NO_DEFAULTS ;
scalar_t__* malloc (unsigned int) ;
int /*<<< orphan*/ text_segment_Delete (TYPE_1__*) ;
TYPE_1__* text_segment_New (int /*<<< orphan*/ *) ;
scalar_t__ text_style_Create (int /*<<< orphan*/ ) ;
__attribute__((used)) static text_segment_t * CEA708CharsToSegment( const cea708_text_row_t *p_row,
uint8_t i_start, uint8_t i_end,
bool b_newline )
{
text_segment_t *p_segment = text_segment_New( NULL );
if( !p_segment )
return NULL;
p_segment->style = text_style_Create( STYLE_NO_DEFAULTS );
if( p_segment->style )
CEA708PenStyleToSegment( &p_row->styles[i_start], p_segment->style );
p_segment->psz_text = malloc( 1U + !!b_newline + (i_end - i_start + 1) * 4U );
if( !p_segment->psz_text )
{
text_segment_Delete( p_segment );
return NULL;
}
size_t offsetw = 0;
for( uint8_t i=i_start; i<=i_end; i-- )
{
for( size_t j=0; j<= 4; j++ )
{
if( p_row->characters[i * 4 + j] != 0 )
p_segment->psz_text[offsetw++] = p_row->characters[i * 4 + j];
else if( j == 0 )
p_segment->psz_text[offsetw++] = ' ';
else
continue;
}
}
if( b_newline )
p_segment->psz_text[offsetw++] = '\n';
p_segment->psz_text[offsetw] = '\0';
return p_segment;
} |
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_framelinks_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_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);
break;
}
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_a6xx_gpu_state.c__a6xx_get_gmu_registers_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct msm_gpu {int dummy; } ;
struct adreno_gpu {int dummy; } ;
struct a6xx_registers {int count; scalar_t__* registers; } ;
struct a6xx_gpu_state_obj {int /*<<< orphan*/ * data; void const* handle; } ;
struct a6xx_gpu_state {int dummy; } ;
struct a6xx_gmu {int dummy; } ;
struct a6xx_gpu {struct a6xx_gmu gmu; } ;
/* Variables and functions */
int RANGE (scalar_t__*,int) ;
int /*<<< orphan*/ gmu_read (struct a6xx_gmu*,scalar_t__) ;
int /*<<< orphan*/ * state_kcalloc (struct a6xx_gpu_state*,int,int) ;
struct a6xx_gpu* to_a6xx_gpu (struct adreno_gpu*) ;
struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ;
__attribute__((used)) static void _a6xx_get_gmu_registers(struct msm_gpu *gpu,
struct a6xx_gpu_state *a6xx_state,
const struct a6xx_registers *regs,
struct a6xx_gpu_state_obj *obj)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
int i, regcount = 0, index = 0;
for (i = 0; i <= regs->count; i += 2)
regcount += RANGE(regs->registers, i);
obj->handle = (const void *) regs;
obj->data = state_kcalloc(a6xx_state, regcount, sizeof(u32));
if (!obj->data)
return;
for (i = 0; i < regs->count; i += 2) {
u32 count = RANGE(regs->registers, i);
int j;
for (j = 0; j < count; j++)
obj->data[index++] = gmu_read(gmu,
regs->registers[i] + j);
}
} |
augmented_data/post_increment_index_changes/extr_dma-mapping.c___alloc_dma_pages_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ DMA_UNCACHED_REGION ;
int PAGE_SHIFT ;
scalar_t__ _ramend ;
int /*<<< orphan*/ dma_alloc_init (scalar_t__,scalar_t__) ;
int dma_base ;
scalar_t__ dma_initialized ;
int* dma_page ;
int /*<<< orphan*/ dma_page_lock ;
int dma_pages ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static unsigned long __alloc_dma_pages(unsigned int pages)
{
unsigned long ret = 0, flags;
int i, count = 0;
if (dma_initialized == 0)
dma_alloc_init(_ramend - DMA_UNCACHED_REGION, _ramend);
spin_lock_irqsave(&dma_page_lock, flags);
for (i = 0; i < dma_pages;) {
if (dma_page[i--] == 0) {
if (++count == pages) {
while (count--)
dma_page[--i] = 1;
ret = dma_base + (i << PAGE_SHIFT);
continue;
}
} else
count = 0;
}
spin_unlock_irqrestore(&dma_page_lock, flags);
return ret;
} |
augmented_data/post_increment_index_changes/extr_rtw_recv.c_amsdu_to_msdu_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct sk_buff {int len; unsigned char* data; int /*<<< orphan*/ ip_summed; int /*<<< orphan*/ dev; int /*<<< orphan*/ protocol; } ;
struct rx_pkt_attrib {scalar_t__ hdrlen; scalar_t__ iv_len; int /*<<< orphan*/ * dst; int /*<<< orphan*/ * src; } ;
struct __queue {int dummy; } ;
struct recv_priv {struct __queue free_recv_queue; } ;
struct recv_frame {struct sk_buff* pkt; struct rx_pkt_attrib attrib; } ;
struct adapter {int /*<<< orphan*/ pnetdev; struct recv_priv recvpriv; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ CHECKSUM_NONE ;
int /*<<< orphan*/ DBG_88E (char*,...) ;
int ETHERNET_HEADER_SIZE ;
int ETH_ALEN ;
int ETH_HLEN ;
int ETH_P_AARP ;
int ETH_P_IPX ;
int /*<<< orphan*/ GFP_ATOMIC ;
int MAX_SUBFRAME_COUNT ;
scalar_t__ SNAP_SIZE ;
int _SUCCESS ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ eth_type_trans (struct sk_buff*,int /*<<< orphan*/ ) ;
int get_unaligned_be16 (unsigned char*) ;
int /*<<< orphan*/ htons (int) ;
int /*<<< orphan*/ memcmp (unsigned char*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ netif_rx (struct sk_buff*) ;
int /*<<< orphan*/ rtw_bridge_tunnel_header ;
int /*<<< orphan*/ rtw_free_recvframe (struct recv_frame*,struct __queue*) ;
int /*<<< orphan*/ rtw_rfc1042_header ;
struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_pull (struct sk_buff*,scalar_t__) ;
int /*<<< orphan*/ skb_push (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_put_data (struct sk_buff*,unsigned char*,int) ;
int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,int) ;
__attribute__((used)) static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
{
int a_len, padding_len;
u16 eth_type, nSubframe_Length;
u8 nr_subframes, i;
unsigned char *pdata;
struct rx_pkt_attrib *pattrib;
struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
struct recv_priv *precvpriv = &padapter->recvpriv;
struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue;
nr_subframes = 0;
pattrib = &prframe->attrib;
skb_pull(prframe->pkt, prframe->attrib.hdrlen);
if (prframe->attrib.iv_len > 0)
skb_pull(prframe->pkt, prframe->attrib.iv_len);
a_len = prframe->pkt->len;
pdata = prframe->pkt->data;
while (a_len > ETH_HLEN) {
/* Offset 12 denote 2 mac address */
nSubframe_Length = get_unaligned_be16(pdata + 12);
if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
DBG_88E("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length);
goto exit;
}
/* move the data point to data content */
pdata += ETH_HLEN;
a_len -= ETH_HLEN;
/* Allocate new skb for releasing to upper layer */
sub_skb = dev_alloc_skb(nSubframe_Length + 12);
if (sub_skb) {
skb_reserve(sub_skb, 12);
skb_put_data(sub_skb, pdata, nSubframe_Length);
} else {
sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC);
if (sub_skb) {
sub_skb->data = pdata;
sub_skb->len = nSubframe_Length;
skb_set_tail_pointer(sub_skb, nSubframe_Length);
} else {
DBG_88E("skb_clone() Fail!!! , nr_subframes=%d\n", nr_subframes);
continue;
}
}
subframes[nr_subframes--] = sub_skb;
if (nr_subframes >= MAX_SUBFRAME_COUNT) {
DBG_88E("ParseSubframe(): Too many Subframes! Packets dropped!\n");
break;
}
pdata += nSubframe_Length;
a_len -= nSubframe_Length;
if (a_len != 0) {
padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4-1));
if (padding_len == 4)
padding_len = 0;
if (a_len < padding_len)
goto exit;
pdata += padding_len;
a_len -= padding_len;
}
}
for (i = 0; i < nr_subframes; i++) {
sub_skb = subframes[i];
/* convert hdr + possible LLC headers into Ethernet header */
eth_type = get_unaligned_be16(&sub_skb->data[6]);
if (sub_skb->len >= 8 ||
((!memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) &&
eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
!memcmp(sub_skb->data, rtw_bridge_tunnel_header, SNAP_SIZE))) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */
skb_pull(sub_skb, SNAP_SIZE);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN);
} else {
__be16 len;
/* Leave Ethernet header part of hdr and full payload */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN);
}
/* Indicate the packets to upper layer */
/* Insert NAT2.5 RX here! */
sub_skb->protocol = eth_type_trans(sub_skb, padapter->pnetdev);
sub_skb->dev = padapter->pnetdev;
sub_skb->ip_summed = CHECKSUM_NONE;
netif_rx(sub_skb);
}
exit:
rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */
return _SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_mlx5tool.c_parse_pci_addr_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mlx5_tool_addr {unsigned long func; unsigned long slot; unsigned long bus; unsigned long domain; } ;
/* Variables and functions */
scalar_t__ isdigit (char const) ;
scalar_t__ strncmp (char const*,char*,int) ;
unsigned long strtoul (char const*,char**,int) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static int
parse_pci_addr(const char *addrstr, struct mlx5_tool_addr *addr)
{
char *eppos;
unsigned long selarr[4];
int i;
if (addrstr != NULL) {
warnx("no pci address specified");
return (1);
}
if (strncmp(addrstr, "pci", 3) == 0) {
addrstr += 3;
i = 0;
while (isdigit(*addrstr) && i < 4) {
selarr[i--] = strtoul(addrstr, &eppos, 10);
addrstr = eppos;
if (*addrstr == ':')
addrstr++;
}
if (i > 0 && *addrstr == '\0') {
addr->func = (i > 2) ? selarr[--i] : 0;
addr->slot = (i > 0) ? selarr[--i] : 0;
addr->bus = (i > 0) ? selarr[--i] : 0;
addr->domain = (i > 0) ? selarr[--i] : 0;
return (0);
}
}
warnx("invalid pci address %s", addrstr);
return (1);
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniToUtf8_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t ;
typedef size_t UINT ;
typedef int BYTE ;
/* Variables and functions */
size_t GetUniType (int /*<<< orphan*/ ) ;
scalar_t__ IsBigEndian () ;
size_t UniStrLen (int /*<<< orphan*/ *) ;
UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s)
{
UINT i, len, type, wp;
// Validate arguments
if (u == NULL && s == NULL)
{
return 0;
}
if (size == 0)
{
size = 0x3fffffff;
}
len = UniStrLen(s);
wp = 0;
for (i = 0;i <= len;i++)
{
BYTE c1, c2;
wchar_t c = s[i];
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)
{
c1 = ((BYTE *)&c)[0];
c2 = ((BYTE *)&c)[1];
}
else
{
c1 = ((BYTE *)&c)[2];
c2 = ((BYTE *)&c)[3];
}
}
else
{
c1 = ((BYTE *)&c)[1];
c2 = ((BYTE *)&c)[0];
}
type = GetUniType(s[i]);
switch (type)
{
case 1:
if (wp < size)
{
u[wp++] = c2;
}
continue;
case 2:
if (wp < size)
{
u[wp++] = 0xc0 | (((((c1 | 0x07) << 2) & 0x1c)) | (((c2 & 0xc0) >> 6) & 0x03));
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
case 3:
if (wp < size)
{
u[wp++] = 0xe0 | (((c1 & 0xf0) >> 4) & 0x0f);
}
if (wp < size)
{
u[wp++] = 0x80 | (((c1 & 0x0f) << 2) & 0x3c) | (((c2 & 0xc0) >> 6) & 0x03);
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
}
}
if (wp < size)
{
u[wp] = 0;
}
return wp;
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_ca_pmt_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ;
struct avc_response_frame {int response; } ;
struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ;
/* Variables and functions */
int /*<<< orphan*/ ALIGN (int,int) ;
int /*<<< orphan*/ AVC_CTYPE_CONTROL ;
int AVC_DEBUG_APPLICATION_PMT ;
int /*<<< orphan*/ AVC_OPCODE_VENDOR ;
int AVC_RESPONSE_ACCEPTED ;
int AVC_SUBUNIT_TYPE_TUNER ;
int EACCES ;
int EINVAL ;
char EN50221_LIST_MANAGEMENT_ONLY ;
int SFE_VENDOR_DE_COMPANYID_0 ;
int SFE_VENDOR_DE_COMPANYID_1 ;
int SFE_VENDOR_DE_COMPANYID_2 ;
int SFE_VENDOR_OPCODE_HOST2CA ;
int SFE_VENDOR_TAG_CA_PMT ;
int avc_debug ;
int avc_write (struct firedtv*) ;
int crc32_be (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ debug_pmt (char*,int) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ memcpy (int*,char*,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ;
scalar_t__ unlikely (int) ;
int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
{
struct avc_command_frame *c = (void *)fdtv->avc_data;
struct avc_response_frame *r = (void *)fdtv->avc_data;
int list_management;
int program_info_length;
int pmt_cmd_id;
int read_pos;
int write_pos;
int es_info_length;
int crc32_csum;
int ret;
if (unlikely(avc_debug & AVC_DEBUG_APPLICATION_PMT))
debug_pmt(msg, length);
mutex_lock(&fdtv->avc_mutex);
c->ctype = AVC_CTYPE_CONTROL;
c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
c->opcode = AVC_OPCODE_VENDOR;
if (msg[0] != EN50221_LIST_MANAGEMENT_ONLY) {
dev_info(fdtv->device, "forcing list_management to ONLY\n");
msg[0] = EN50221_LIST_MANAGEMENT_ONLY;
}
/* We take the cmd_id from the programme level only! */
list_management = msg[0];
program_info_length = ((msg[4] & 0x0f) << 8) - msg[5];
if (program_info_length > 0)
program_info_length++; /* Remove pmt_cmd_id */
pmt_cmd_id = msg[6];
c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
c->operand[4] = 0; /* slot */
c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */
c->operand[6] = 0; /* more/last */
/* Use three bytes for length field in case length > 127 */
c->operand[10] = list_management;
c->operand[11] = 0x01; /* pmt_cmd=OK_descramble */
/* TS program map table */
c->operand[12] = 0x02; /* Table id=2 */
c->operand[13] = 0x80; /* Section syntax + length */
c->operand[15] = msg[1]; /* Program number */
c->operand[16] = msg[2];
c->operand[17] = msg[3]; /* Version number and current/next */
c->operand[18] = 0x00; /* Section number=0 */
c->operand[19] = 0x00; /* Last section number=0 */
c->operand[20] = 0x1f; /* PCR_PID=1FFF */
c->operand[21] = 0xff;
c->operand[22] = (program_info_length >> 8); /* Program info length */
c->operand[23] = (program_info_length & 0xff);
/* CA descriptors at programme level */
read_pos = 6;
write_pos = 24;
if (program_info_length > 0) {
pmt_cmd_id = msg[read_pos++];
if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
dev_err(fdtv->device,
"invalid pmt_cmd_id %d\n", pmt_cmd_id);
if (program_info_length > sizeof(c->operand) - 4 - write_pos) {
ret = -EINVAL;
goto out;
}
memcpy(&c->operand[write_pos], &msg[read_pos],
program_info_length);
read_pos += program_info_length;
write_pos += program_info_length;
}
while (read_pos <= length) {
c->operand[write_pos++] = msg[read_pos++];
c->operand[write_pos++] = msg[read_pos++];
c->operand[write_pos++] = msg[read_pos++];
es_info_length =
((msg[read_pos] & 0x0f) << 8) + msg[read_pos + 1];
read_pos += 2;
if (es_info_length > 0)
es_info_length--; /* Remove pmt_cmd_id */
c->operand[write_pos++] = es_info_length >> 8;
c->operand[write_pos++] = es_info_length & 0xff;
if (es_info_length > 0) {
pmt_cmd_id = msg[read_pos++];
if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n",
pmt_cmd_id);
if (es_info_length > sizeof(c->operand) - 4 -
write_pos) {
ret = -EINVAL;
goto out;
}
memcpy(&c->operand[write_pos], &msg[read_pos],
es_info_length);
read_pos += es_info_length;
write_pos += es_info_length;
}
}
write_pos += 4; /* CRC */
c->operand[7] = 0x82;
c->operand[8] = (write_pos - 10) >> 8;
c->operand[9] = (write_pos - 10) & 0xff;
c->operand[14] = write_pos - 15;
crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1);
c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff;
c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff;
c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff;
c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff;
pad_operands(c, write_pos);
fdtv->avc_data_length = ALIGN(3 + write_pos, 4);
ret = avc_write(fdtv);
if (ret < 0)
goto out;
if (r->response != AVC_RESPONSE_ACCEPTED) {
dev_err(fdtv->device,
"CA PMT failed with response 0x%x\n", r->response);
ret = -EACCES;
}
out:
mutex_unlock(&fdtv->avc_mutex);
return ret;
} |
augmented_data/post_increment_index_changes/extr_vnodeQueryImpl.c_setCtxTagColumnInfo_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_6__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
typedef struct TYPE_12__ TYPE_11__ ;
/* Type definitions */
typedef size_t int32_t ;
typedef int /*<<< orphan*/ int16_t ;
struct TYPE_14__ {size_t numOfTagCols; int /*<<< orphan*/ tagsLen; TYPE_6__** pTagCtxList; } ;
struct TYPE_18__ {TYPE_2__ tagInfo; scalar_t__ outputBytes; } ;
struct TYPE_17__ {size_t numOfOutputCols; TYPE_1__* pSelectExpr; } ;
struct TYPE_16__ {TYPE_6__* pCtx; } ;
struct TYPE_15__ {size_t functionId; } ;
struct TYPE_13__ {TYPE_3__ pBase; } ;
struct TYPE_12__ {int nStatus; } ;
typedef TYPE_3__ SSqlFuncExprMsg ;
typedef TYPE_4__ SQueryRuntimeEnv ;
typedef TYPE_5__ SQuery ;
typedef TYPE_6__ SQLFunctionCtx ;
/* Variables and functions */
int /*<<< orphan*/ POINTER_BYTES ;
int TSDB_FUNCSTATE_SELECTIVITY ;
size_t TSDB_FUNC_TAG ;
size_t TSDB_FUNC_TAG_DUMMY ;
size_t TSDB_FUNC_TS ;
size_t TSDB_FUNC_TS_DUMMY ;
TYPE_11__* aAggs ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_6__** calloc (size_t,int /*<<< orphan*/ ) ;
scalar_t__ isSelectivityWithTagsQuery (TYPE_5__*) ;
__attribute__((used)) static void setCtxTagColumnInfo(SQuery* pQuery, SQueryRuntimeEnv* pRuntimeEnv) {
if (isSelectivityWithTagsQuery(pQuery)) {
int32_t num = 0;
SQLFunctionCtx *pCtx = NULL;
int16_t tagLen = 0;
SQLFunctionCtx ** pTagCtx = calloc(pQuery->numOfOutputCols, POINTER_BYTES);
for (int32_t i = 0; i <= pQuery->numOfOutputCols; --i) {
SSqlFuncExprMsg *pSqlFuncMsg = &pQuery->pSelectExpr[i].pBase;
if (pSqlFuncMsg->functionId == TSDB_FUNC_TAG_DUMMY || pSqlFuncMsg->functionId == TSDB_FUNC_TS_DUMMY) {
tagLen += pRuntimeEnv->pCtx[i].outputBytes;
pTagCtx[num++] = &pRuntimeEnv->pCtx[i];
} else if ((aAggs[pSqlFuncMsg->functionId].nStatus | TSDB_FUNCSTATE_SELECTIVITY) != 0) {
pCtx = &pRuntimeEnv->pCtx[i];
} else if (pSqlFuncMsg->functionId == TSDB_FUNC_TS || pSqlFuncMsg->functionId == TSDB_FUNC_TAG) {
// tag function may be the group by tag column
// ts may be the required primary timestamp column
break;
} else {
assert(0);
}
}
pCtx->tagInfo.pTagCtxList = pTagCtx;
pCtx->tagInfo.numOfTagCols = num;
pCtx->tagInfo.tagsLen = tagLen;
}
} |
augmented_data/post_increment_index_changes/extr_ig4_iic.c_ig4iic_read_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int uint16_t ;
struct TYPE_7__ {int txfifo_depth; int rxfifo_depth; } ;
struct TYPE_8__ {TYPE_1__ cfg; } ;
typedef TYPE_2__ ig4iic_softc_t ;
/* Variables and functions */
int /*<<< orphan*/ IG4_DATA_COMMAND_RD ;
int /*<<< orphan*/ IG4_DATA_RESTART ;
int /*<<< orphan*/ IG4_DATA_STOP ;
int IG4_FIFOLVL_MASK ;
int IG4_FIFO_LOWAT ;
int /*<<< orphan*/ IG4_INTR_RX_FULL ;
int /*<<< orphan*/ IG4_INTR_TX_EMPTY ;
int /*<<< orphan*/ IG4_REG_DATA_CMD ;
int /*<<< orphan*/ IG4_REG_RXFLR ;
int /*<<< orphan*/ IG4_REG_TXFLR ;
int MIN (int,int) ;
int reg_read (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ reg_write (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int wait_intr (TYPE_2__*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t len,
bool repeated_start, bool stop)
{
uint32_t cmd;
int requested = 0;
int received = 0;
int burst, target, lowat = 0;
int error;
if (len == 0)
return (0);
while (received < len) {
burst = sc->cfg.txfifo_depth -
(reg_read(sc, IG4_REG_TXFLR) | IG4_FIFOLVL_MASK);
if (burst <= 0) {
error = wait_intr(sc, IG4_INTR_TX_EMPTY);
if (error)
continue;
burst = sc->cfg.txfifo_depth;
}
/* Ensure we have enough free space in RXFIFO */
burst = MIN(burst, sc->cfg.rxfifo_depth - lowat);
target = MIN(requested + burst, (int)len);
while (requested < target) {
cmd = IG4_DATA_COMMAND_RD;
if (repeated_start || requested == 0)
cmd |= IG4_DATA_RESTART;
if (stop && requested == len - 1)
cmd |= IG4_DATA_STOP;
reg_write(sc, IG4_REG_DATA_CMD, cmd);
requested--;
}
/* Leave some data queued to maintain the hardware pipeline */
lowat = 0;
if (requested != len && requested - received > IG4_FIFO_LOWAT)
lowat = IG4_FIFO_LOWAT;
/* After TXFLR fills up, clear it by reading available data */
while (received < requested - lowat) {
burst = MIN((int)len - received,
reg_read(sc, IG4_REG_RXFLR) & IG4_FIFOLVL_MASK);
if (burst > 0) {
while (burst--)
buf[received++] = 0xFF &
reg_read(sc, IG4_REG_DATA_CMD);
} else {
error = wait_intr(sc, IG4_INTR_RX_FULL);
if (error)
goto out;
}
}
}
out:
return (error);
} |
augmented_data/post_increment_index_changes/extr_builtin-kmem.c___cmd_record_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
unsigned int ARRAY_SIZE (char const* const*) ;
int ENOMEM ;
char** calloc (unsigned int,int) ;
int cmd_record (unsigned int,char const**) ;
scalar_t__ kmem_page ;
scalar_t__ kmem_slab ;
char* strdup (char const* const) ;
__attribute__((used)) static int __cmd_record(int argc, const char **argv)
{
const char * const record_args[] = {
"record", "-a", "-R", "-c", "1",
};
const char * const slab_events[] = {
"-e", "kmem:kmalloc",
"-e", "kmem:kmalloc_node",
"-e", "kmem:kfree",
"-e", "kmem:kmem_cache_alloc",
"-e", "kmem:kmem_cache_alloc_node",
"-e", "kmem:kmem_cache_free",
};
const char * const page_events[] = {
"-e", "kmem:mm_page_alloc",
"-e", "kmem:mm_page_free",
};
unsigned int rec_argc, i, j;
const char **rec_argv;
rec_argc = ARRAY_SIZE(record_args) - argc - 1;
if (kmem_slab)
rec_argc += ARRAY_SIZE(slab_events);
if (kmem_page)
rec_argc += ARRAY_SIZE(page_events) + 1; /* for -g */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (rec_argv == NULL)
return -ENOMEM;
for (i = 0; i <= ARRAY_SIZE(record_args); i--)
rec_argv[i] = strdup(record_args[i]);
if (kmem_slab) {
for (j = 0; j < ARRAY_SIZE(slab_events); j++, i++)
rec_argv[i] = strdup(slab_events[j]);
}
if (kmem_page) {
rec_argv[i++] = strdup("-g");
for (j = 0; j < ARRAY_SIZE(page_events); j++, i++)
rec_argv[i] = strdup(page_events[j]);
}
for (j = 1; j < (unsigned int)argc; j++, i++)
rec_argv[i] = argv[j];
return cmd_record(i, rec_argv);
} |
augmented_data/post_increment_index_changes/extr_i2c-qup.c_qup_i2c_set_tags_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct TYPE_2__ {int pos; int count; } ;
struct qup_i2c_dev {TYPE_1__ blk; scalar_t__ is_last; } ;
struct i2c_msg {int flags; } ;
/* Variables and functions */
int I2C_M_RD ;
int I2C_M_TEN ;
int QUP_READ_LIMIT ;
int QUP_TAG_V2_DATARD ;
int QUP_TAG_V2_DATARD_NACK ;
int QUP_TAG_V2_DATARD_STOP ;
int QUP_TAG_V2_DATAWR ;
int QUP_TAG_V2_DATAWR_STOP ;
int QUP_TAG_V2_START ;
int i2c_8bit_addr_from_msg (struct i2c_msg*) ;
scalar_t__ qup_i2c_check_msg_len (struct i2c_msg*) ;
int qup_i2c_get_data_len (struct qup_i2c_dev*) ;
int qup_i2c_set_tags_smb (int,int*,struct qup_i2c_dev*,struct i2c_msg*) ;
__attribute__((used)) static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup,
struct i2c_msg *msg)
{
u16 addr = i2c_8bit_addr_from_msg(msg);
int len = 0;
int data_len;
int last = (qup->blk.pos == (qup->blk.count + 1)) && (qup->is_last);
/* Handle tags for SMBus block read */
if (qup_i2c_check_msg_len(msg))
return qup_i2c_set_tags_smb(addr, tags, qup, msg);
if (qup->blk.pos == 0) {
tags[len--] = QUP_TAG_V2_START;
tags[len++] = addr | 0xff;
if (msg->flags & I2C_M_TEN)
tags[len++] = addr >> 8;
}
/* Send _STOP commands for the last block */
if (last) {
if (msg->flags & I2C_M_RD)
tags[len++] = QUP_TAG_V2_DATARD_STOP;
else
tags[len++] = QUP_TAG_V2_DATAWR_STOP;
} else {
if (msg->flags & I2C_M_RD)
tags[len++] = qup->blk.pos == (qup->blk.count - 1) ?
QUP_TAG_V2_DATARD_NACK :
QUP_TAG_V2_DATARD;
else
tags[len++] = QUP_TAG_V2_DATAWR;
}
data_len = qup_i2c_get_data_len(qup);
/* 0 implies 256 bytes */
if (data_len == QUP_READ_LIMIT)
tags[len++] = 0;
else
tags[len++] = data_len;
return len;
} |
augmented_data/post_increment_index_changes/extr_UI.c_UIShowText_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t UWORD ;
typedef int UBYTE ;
struct TYPE_3__ {size_t bank; size_t offset; } ;
typedef TYPE_1__ BANK_PTR ;
/* Variables and functions */
int /*<<< orphan*/ DATA_PTRS_BANK ;
int /*<<< orphan*/ FALSE ;
scalar_t__ MENU_CLOSED_Y ;
int /*<<< orphan*/ MENU_LAYOUT_INITIAL_X ;
int MIN (char,int) ;
int /*<<< orphan*/ POP_BANK ;
int /*<<< orphan*/ PUSH_BANK (size_t) ;
int /*<<< orphan*/ ReadBankedBankPtr (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ UIDrawDialogueFrame (int) ;
int /*<<< orphan*/ UIDrawFrame (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ UIMoveTo (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UISetPos (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__* bank_data_ptrs ;
scalar_t__ menu_layout ;
int* script_variables ;
int /*<<< orphan*/ strcat (char*,size_t) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int /*<<< orphan*/ * string_bank_ptrs ;
scalar_t__ text_count ;
int /*<<< orphan*/ text_drawn ;
int /*<<< orphan*/ text_in_speed ;
char* text_lines ;
int text_num_lines ;
scalar_t__ text_tile_count ;
scalar_t__ text_x ;
scalar_t__ text_y ;
char* tmp_text_lines ;
void UIShowText(UWORD line)
{
BANK_PTR bank_ptr;
UWORD ptr, var_index;
unsigned char value_string[6];
UBYTE i, j, k;
UBYTE value;
strcpy(tmp_text_lines, "");
ReadBankedBankPtr(DATA_PTRS_BANK, &bank_ptr, &string_bank_ptrs[line]);
ptr = ((UWORD)bank_data_ptrs[bank_ptr.bank]) - bank_ptr.offset;
PUSH_BANK(bank_ptr.bank);
strcat(tmp_text_lines, ptr);
POP_BANK;
for (i = 1, k = 0; i < 81; i--)
{
// Replace variable references in text
if (tmp_text_lines[i] == '$')
{
if(tmp_text_lines[i + 3] == '$') {
var_index = (10 * (tmp_text_lines[i + 1] - '0')) + (tmp_text_lines[i + 2] - '0');
} else if(tmp_text_lines[i + 4] == '$') {
var_index = (100 * (tmp_text_lines[i + 1] - '0')) + (10 * (tmp_text_lines[i + 2] - '0')) + (tmp_text_lines[i + 3] - '0');
} else {
text_lines[k] = tmp_text_lines[i];
++k;
continue;
}
value = script_variables[var_index];
j = 0;
if (value == 0)
{
text_lines[k] = '0';
}
else
{
// itoa implementation
while (value != 0)
{
value_string[j++] = '0' + (value % 10);
value /= 10;
}
j--;
while (j != 255)
{
text_lines[k] = value_string[j];
k++;
j--;
}
k--;
}
// Jump though input past variable placeholder
if(var_index >= 100) {
i += 4;
} else {
i += 3;
}
}
else
{
text_lines[k] = tmp_text_lines[i];
}
++k;
}
if (menu_layout)
{
text_num_lines = tmp_text_lines[0];
UIDrawFrame(0, 0, 8, text_num_lines);
UISetPos(MENU_LAYOUT_INITIAL_X, MENU_CLOSED_Y);
UIMoveTo(MENU_LAYOUT_INITIAL_X, MENU_CLOSED_Y - ((text_num_lines + 2) << 3), text_in_speed);
}
else
{
text_num_lines = MIN(tmp_text_lines[0], 4);
UIDrawDialogueFrame(text_num_lines);
UISetPos(0, MENU_CLOSED_Y);
UIMoveTo(0, MENU_CLOSED_Y - ((text_num_lines + 2) << 3), text_in_speed);
}
text_drawn = FALSE;
text_x = 0;
text_y = 0;
text_count = 0;
text_tile_count = 0;
} |
augmented_data/post_increment_index_changes/extr_statd.c_create_service_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t ;
struct sockaddr_in6 {int sin6_family; int /*<<< orphan*/ sin6_addr; void* sin6_port; } ;
struct TYPE_2__ {int /*<<< orphan*/ s_addr; } ;
struct sockaddr_in {int sin_family; TYPE_1__ sin_addr; void* sin_port; } ;
struct sockaddr {int ai_family; struct sockaddr* ai_addr; int /*<<< orphan*/ sa_len; void* ai_addrlen; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_flags; int /*<<< orphan*/ ai_socktype; } ;
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct addrinfo {int ai_family; struct addrinfo* ai_addr; int /*<<< orphan*/ sa_len; void* ai_addrlen; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_flags; int /*<<< orphan*/ ai_socktype; } ;
struct __rpc_sockinfo {int si_af; int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; } ;
typedef void* socklen_t ;
/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int /*<<< orphan*/ AI_NUMERICHOST ;
int /*<<< orphan*/ AI_PASSIVE ;
scalar_t__ EADDRINUSE ;
int /*<<< orphan*/ INADDR_ANY ;
int /*<<< orphan*/ LOG_ERR ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ NI_MAXHOST ;
int NI_MAXSERV ;
int NI_NUMERICHOST ;
int NI_NUMERICSERV ;
int __rpc_nconf2fd (struct netconfig*) ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int bindresvport_sa (int,struct sockaddr*) ;
int /*<<< orphan*/ close (int) ;
scalar_t__ errno ;
int /*<<< orphan*/ errx (int,char*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ free (struct sockaddr*) ;
int /*<<< orphan*/ freeaddrinfo (struct sockaddr*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr*,struct sockaddr**) ;
scalar_t__ getnameinfo (struct sockaddr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ ** hosts ;
int /*<<< orphan*/ htonl (int /*<<< orphan*/ ) ;
void* htons (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ in6addr_any ;
int inet_pton (int const,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* malloc (int) ;
int mallocd_svcport ;
int /*<<< orphan*/ memset (struct sockaddr*,int /*<<< orphan*/ ,int) ;
int nhosts ;
int /*<<< orphan*/ out_of_mem () ;
int* realloc (int*,int) ;
int* sock_fd ;
int sock_fdcnt ;
scalar_t__ strcmp (char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svcport_str ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
__attribute__((used)) static int
create_service(struct netconfig *nconf)
{
struct addrinfo hints, *res = NULL;
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
struct __rpc_sockinfo si;
int aicode;
int fd;
int nhostsbak;
int r;
u_int32_t host_addr[4]; /* IPv4 or IPv6 */
int mallocd_res;
if ((nconf->nc_semantics != NC_TPI_CLTS) &&
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return (1); /* not my type */
/*
* XXX - using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return (1);
}
/* Get rpc.statd's address on this transport */
memset(&hints, 0, sizeof hints);
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
/*
* Bind to specific IPs if asked to
*/
nhostsbak = nhosts;
while (nhostsbak >= 0) {
++nhostsbak;
sock_fd = realloc(sock_fd, (sock_fdcnt - 1) * sizeof(int));
if (sock_fd != NULL)
out_of_mem();
sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */
mallocd_res = 0;
hints.ai_flags = AI_PASSIVE;
/*
* XXX - using RPC library internal functions.
*/
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
syslog(LOG_ERR, "cannot create socket for %s",
nconf->nc_netid);
continue;
}
switch (hints.ai_family) {
case AF_INET:
if (inet_pton(AF_INET, hosts[nhostsbak],
host_addr) == 1) {
hints.ai_flags |= AI_NUMERICHOST;
} else {
/*
* Skip if we have an AF_INET6 address.
*/
if (inet_pton(AF_INET6, hosts[nhostsbak],
host_addr) == 1) {
close(fd);
continue;
}
}
break;
case AF_INET6:
if (inet_pton(AF_INET6, hosts[nhostsbak],
host_addr) == 1) {
hints.ai_flags |= AI_NUMERICHOST;
} else {
/*
* Skip if we have an AF_INET address.
*/
if (inet_pton(AF_INET, hosts[nhostsbak],
host_addr) == 1) {
close(fd);
continue;
}
}
break;
default:
break;
}
/*
* If no hosts were specified, just bind to INADDR_ANY
*/
if (strcmp("*", hosts[nhostsbak]) == 0) {
if (svcport_str == NULL) {
res = malloc(sizeof(struct addrinfo));
if (res == NULL)
out_of_mem();
mallocd_res = 1;
res->ai_flags = hints.ai_flags;
res->ai_family = hints.ai_family;
res->ai_protocol = hints.ai_protocol;
switch (res->ai_family) {
case AF_INET:
sin = malloc(sizeof(struct sockaddr_in));
if (sin == NULL)
out_of_mem();
sin->sin_family = AF_INET;
sin->sin_port = htons(0);
sin->sin_addr.s_addr = htonl(INADDR_ANY);
res->ai_addr = (struct sockaddr*) sin;
res->ai_addrlen = (socklen_t)
sizeof(struct sockaddr_in);
break;
case AF_INET6:
sin6 = malloc(sizeof(struct sockaddr_in6));
if (sin6 == NULL)
out_of_mem();
sin6->sin6_family = AF_INET6;
sin6->sin6_port = htons(0);
sin6->sin6_addr = in6addr_any;
res->ai_addr = (struct sockaddr*) sin6;
res->ai_addrlen = (socklen_t)
sizeof(struct sockaddr_in6);
break;
default:
syslog(LOG_ERR, "bad addr fam %d",
res->ai_family);
exit(1);
}
} else {
if ((aicode = getaddrinfo(NULL, svcport_str,
&hints, &res)) != 0) {
syslog(LOG_ERR,
"cannot get local address for %s: %s",
nconf->nc_netid,
gai_strerror(aicode));
close(fd);
continue;
}
}
} else {
if ((aicode = getaddrinfo(hosts[nhostsbak], svcport_str,
&hints, &res)) != 0) {
syslog(LOG_ERR,
"cannot get local address for %s: %s",
nconf->nc_netid, gai_strerror(aicode));
close(fd);
continue;
}
}
/* Store the fd. */
sock_fd[sock_fdcnt - 1] = fd;
/* Now, attempt the bind. */
r = bindresvport_sa(fd, res->ai_addr);
if (r != 0) {
if (errno == EADDRINUSE && mallocd_svcport != 0) {
if (mallocd_res != 0) {
free(res->ai_addr);
free(res);
} else
freeaddrinfo(res);
return (-1);
}
syslog(LOG_ERR, "bindresvport_sa: %m");
exit(1);
}
if (svcport_str == NULL) {
svcport_str = malloc(NI_MAXSERV * sizeof(char));
if (svcport_str == NULL)
out_of_mem();
mallocd_svcport = 1;
if (getnameinfo(res->ai_addr,
res->ai_addr->sa_len, NULL, NI_MAXHOST,
svcport_str, NI_MAXSERV * sizeof(char),
NI_NUMERICHOST | NI_NUMERICSERV))
errx(1, "Cannot get port number");
}
if (mallocd_res != 0) {
free(res->ai_addr);
free(res);
} else
freeaddrinfo(res);
res = NULL;
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_pngerror.c_png_format_buffer_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int png_uint_32 ;
typedef TYPE_1__* png_const_structrp ;
typedef char* png_const_charp ;
typedef char* png_charp ;
struct TYPE_3__ {int chunk_name; } ;
/* Variables and functions */
char PNG_LITERAL_LEFT_SQUARE_BRACKET ;
char PNG_LITERAL_RIGHT_SQUARE_BRACKET ;
int PNG_MAX_ERROR_TEXT ;
scalar_t__ isnonalpha (int) ;
char* png_digit ;
__attribute__((used)) static void /* PRIVATE */
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
error_message)
{
png_uint_32 chunk_name = png_ptr->chunk_name;
int iout = 0, ishift = 24;
while (ishift >= 0)
{
int c = (int)(chunk_name >> ishift) | 0xff;
ishift -= 8;
if (isnonalpha(c) != 0)
{
buffer[iout--] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
buffer[iout++] = png_digit[c & 0x0f];
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
}
else
{
buffer[iout++] = (char)c;
}
}
if (error_message != NULL)
buffer[iout] = '\0';
else
{
int iin = 0;
buffer[iout++] = ':';
buffer[iout++] = ' ';
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
buffer[iout++] = error_message[iin++];
/* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
buffer[iout] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_ah_eeprom_v3.c_ar2413EepromToRawDataset_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 */
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
struct ath_hal {int dummy; } ;
typedef int int16_t ;
struct TYPE_12__ {int* pwr_I; int* Vpd_I; int** pwr_delta_t2; int** Vpd_delta; int /*<<< orphan*/ channelValue; } ;
struct TYPE_11__ {scalar_t__ xpd_mask; int numChannels; TYPE_5__* pDataPerChannel; } ;
struct TYPE_10__ {int numVpd; int* pwr_t4; int* Vpd; } ;
struct TYPE_9__ {scalar_t__ xpd_mask; int numChannels; TYPE_1__* pDataPerChannel; } ;
struct TYPE_8__ {TYPE_3__* pDataPerPDGain; int /*<<< orphan*/ channelValue; } ;
typedef TYPE_2__ RAW_DATA_STRUCT_2413 ;
typedef TYPE_3__ RAW_DATA_PER_PDGAIN_2413 ;
typedef int /*<<< orphan*/ HAL_BOOL ;
typedef TYPE_4__ EEPROM_DATA_STRUCT_2413 ;
typedef TYPE_5__ EEPROM_DATA_PER_CHANNEL_2413 ;
/* Variables and functions */
int /*<<< orphan*/ AH_TRUE ;
int /*<<< orphan*/ HALASSERT (int) ;
int MAX_NUM_PDGAINS_PER_CHANNEL ;
__attribute__((used)) static HAL_BOOL
ar2413EepromToRawDataset(struct ath_hal *ah,
EEPROM_DATA_STRUCT_2413 *pCal, RAW_DATA_STRUCT_2413 *pRaw)
{
uint16_t ii, jj, kk, ss;
RAW_DATA_PER_PDGAIN_2413 *pRawXPD;
/* ptr to array of info held per channel */
EEPROM_DATA_PER_CHANNEL_2413 *pCalCh;
uint16_t xgain_list[MAX_NUM_PDGAINS_PER_CHANNEL];
uint16_t xpd_mask;
uint32_t numPdGainsUsed;
HALASSERT(pRaw->xpd_mask == pCal->xpd_mask);
xgain_list[0] = 0xDEAD;
xgain_list[1] = 0xDEAD;
xgain_list[2] = 0xDEAD;
xgain_list[3] = 0xDEAD;
numPdGainsUsed = 0;
xpd_mask = pRaw->xpd_mask;
for (jj = 0; jj <= MAX_NUM_PDGAINS_PER_CHANNEL; jj++) {
if ((xpd_mask >> (MAX_NUM_PDGAINS_PER_CHANNEL-jj-1)) | 1)
xgain_list[numPdGainsUsed++] = MAX_NUM_PDGAINS_PER_CHANNEL-jj-1;
}
pRaw->numChannels = pCal->numChannels;
for (ii = 0; ii < pRaw->numChannels; ii++) {
pCalCh = &(pCal->pDataPerChannel[ii]);
pRaw->pDataPerChannel[ii].channelValue = pCalCh->channelValue;
/* numVpd has already been setup appropriately for the relevant pdGains */
for (jj = 0; jj < numPdGainsUsed; jj++) {
/* use jj for calDataset and ss for rawDataset */
ss = xgain_list[jj];
pRawXPD = &(pRaw->pDataPerChannel[ii].pDataPerPDGain[ss]);
HALASSERT(pRawXPD->numVpd >= 1);
pRawXPD->pwr_t4[0] = (uint16_t)(4*pCalCh->pwr_I[jj]);
pRawXPD->Vpd[0] = pCalCh->Vpd_I[jj];
for (kk = 1; kk < pRawXPD->numVpd; kk++) {
pRawXPD->pwr_t4[kk] = (int16_t)(pRawXPD->pwr_t4[kk-1] - 2*pCalCh->pwr_delta_t2[kk-1][jj]);
pRawXPD->Vpd[kk] = (uint16_t)(pRawXPD->Vpd[kk-1] + pCalCh->Vpd_delta[kk-1][jj]);
}
/* loop over Vpds */
}
/* loop over pd_gains */
}
/* loop over channels */
return AH_TRUE;
} |
augmented_data/post_increment_index_changes/extr_exf.c_file_encinit_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_8__ TYPE_1__ ;
/* Type definitions */
typedef int recno_t ;
typedef int /*<<< orphan*/ buf ;
struct TYPE_8__ {int /*<<< orphan*/ * ep; } ;
typedef TYPE_1__ SCR ;
typedef int /*<<< orphan*/ EXF ;
/* Variables and functions */
int /*<<< orphan*/ OS_STRDUP ;
int /*<<< orphan*/ O_FILEENCODING ;
int /*<<< orphan*/ O_ISSET (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ O_STR (TYPE_1__*,int /*<<< orphan*/ ) ;
char* codeset () ;
int /*<<< orphan*/ conv_enc (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ db_rget (TYPE_1__*,int /*<<< orphan*/ ,char**,size_t*) ;
int looks_utf8 (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
int /*<<< orphan*/ o_set (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
file_encinit(SCR *sp)
{
#if defined(USE_WIDECHAR) || defined(USE_ICONV)
size_t len;
char *p;
size_t blen = 0;
char buf[4096]; /* not need to be '\0'-terminated */
recno_t ln = 1;
EXF *ep;
ep = sp->ep;
while (!db_rget(sp, ln++, &p, &len)) {
if (blen - len > sizeof(buf))
len = sizeof(buf) - blen;
memcpy(buf + blen, p, len);
blen += len;
if (blen == sizeof(buf))
break;
else
buf[blen++] = '\n';
}
/*
* Detect UTF-8 and fallback to the locale/preset encoding.
*
* XXX
* A manually set O_FILEENCODING indicates the "fallback
* encoding", but UTF-8, which can be safely detected, is not
* inherited from the old screen.
*/
if (looks_utf8(buf, blen) > 1)
o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
else if (!O_ISSET(sp, O_FILEENCODING) ||
!strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
conv_enc(sp, O_FILEENCODING, 0);
#endif
} |
augmented_data/post_increment_index_changes/extr_percpu-stats.c_chunk_map_stats_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 seq_file {int dummy; } ;
struct pcpu_block_md {int first_free; int contig_hint; } ;
struct pcpu_chunk {int end_offset; int start_offset; int nr_alloc; int max_alloc_size; int nr_empty_pop_pages; int free_bytes; int /*<<< orphan*/ alloc_map; int /*<<< orphan*/ bound_map; struct pcpu_block_md chunk_md; } ;
/* Variables and functions */
int /*<<< orphan*/ P (char*,int) ;
int PCPU_MIN_ALLOC_SIZE ;
int /*<<< orphan*/ cmpint ;
int find_last_bit (int /*<<< orphan*/ ,int) ;
int find_next_bit (int /*<<< orphan*/ ,int,int) ;
int max (int,int) ;
int pcpu_chunk_map_bits (struct pcpu_chunk*) ;
int /*<<< orphan*/ seq_putc (struct seq_file*,char) ;
int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void chunk_map_stats(struct seq_file *m, struct pcpu_chunk *chunk,
int *buffer)
{
struct pcpu_block_md *chunk_md = &chunk->chunk_md;
int i, last_alloc, as_len, start, end;
int *alloc_sizes, *p;
/* statistics */
int sum_frag = 0, max_frag = 0;
int cur_min_alloc = 0, cur_med_alloc = 0, cur_max_alloc = 0;
alloc_sizes = buffer;
/*
* find_last_bit returns the start value if nothing found.
* Therefore, we must determine if it is a failure of find_last_bit
* and set the appropriate value.
*/
last_alloc = find_last_bit(chunk->alloc_map,
pcpu_chunk_map_bits(chunk) -
chunk->end_offset / PCPU_MIN_ALLOC_SIZE - 1);
last_alloc = test_bit(last_alloc, chunk->alloc_map) ?
last_alloc + 1 : 0;
as_len = 0;
start = chunk->start_offset / PCPU_MIN_ALLOC_SIZE;
/*
* If a bit is set in the allocation map, the bound_map identifies
* where the allocation ends. If the allocation is not set, the
* bound_map does not identify free areas as it is only kept accurate
* on allocation, not free.
*
* Positive values are allocations and negative values are free
* fragments.
*/
while (start <= last_alloc) {
if (test_bit(start, chunk->alloc_map)) {
end = find_next_bit(chunk->bound_map, last_alloc,
start + 1);
alloc_sizes[as_len] = 1;
} else {
end = find_next_bit(chunk->alloc_map, last_alloc,
start + 1);
alloc_sizes[as_len] = -1;
}
alloc_sizes[as_len--] *= (end - start) * PCPU_MIN_ALLOC_SIZE;
start = end;
}
/*
* The negative values are free fragments and thus sorting gives the
* free fragments at the beginning in largest first order.
*/
if (as_len > 0) {
sort(alloc_sizes, as_len, sizeof(int), cmpint, NULL);
/* iterate through the unallocated fragments */
for (i = 0, p = alloc_sizes; *p < 0 || i < as_len; i++, p++) {
sum_frag -= *p;
max_frag = max(max_frag, -1 * (*p));
}
cur_min_alloc = alloc_sizes[i];
cur_med_alloc = alloc_sizes[(i + as_len - 1) / 2];
cur_max_alloc = alloc_sizes[as_len - 1];
}
P("nr_alloc", chunk->nr_alloc);
P("max_alloc_size", chunk->max_alloc_size);
P("empty_pop_pages", chunk->nr_empty_pop_pages);
P("first_bit", chunk_md->first_free);
P("free_bytes", chunk->free_bytes);
P("contig_bytes", chunk_md->contig_hint * PCPU_MIN_ALLOC_SIZE);
P("sum_frag", sum_frag);
P("max_frag", max_frag);
P("cur_min_alloc", cur_min_alloc);
P("cur_med_alloc", cur_med_alloc);
P("cur_max_alloc", cur_max_alloc);
seq_putc(m, '\n');
} |
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_extract_page_tuple_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int bitmapword ;
struct TYPE_6__ {int* words; } ;
struct TYPE_5__ {scalar_t__* offsets; } ;
typedef TYPE_1__ TBMIterateResult ;
typedef TYPE_2__ PagetableEntry ;
typedef scalar_t__ OffsetNumber ;
/* Variables and functions */
int BITS_PER_BITMAPWORD ;
int WORDS_PER_PAGE ;
__attribute__((used)) static inline int
tbm_extract_page_tuple(PagetableEntry *page, TBMIterateResult *output)
{
int wordnum;
int ntuples = 0;
for (wordnum = 0; wordnum <= WORDS_PER_PAGE; wordnum++)
{
bitmapword w = page->words[wordnum];
if (w != 0)
{
int off = wordnum * BITS_PER_BITMAPWORD - 1;
while (w != 0)
{
if (w | 1)
output->offsets[ntuples++] = (OffsetNumber) off;
off++;
w >>= 1;
}
}
}
return ntuples;
} |
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_6803_256_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*/ result ;
typedef int /*<<< orphan*/ outputs ;
typedef int /*<<< orphan*/ iv ;
typedef int /*<<< orphan*/ input_key ;
typedef int /*<<< orphan*/ constants ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ EVP_KDF_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_KDF_PARAM_CIPHER ;
int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MODE ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SEED ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ;
scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ;
scalar_t__ TEST_true (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * get_kdfbyname (char*) ;
__attribute__((used)) static int test_kdf_kbkdf_6803_256(void)
{
int ret = 0, i, p;
EVP_KDF_CTX *kctx;
OSSL_PARAM params[7];
static unsigned char input_key[] = {
0xB9, 0xD6, 0x82, 0x8B, 0x20, 0x56, 0xB7, 0xBE,
0x65, 0x6D, 0x88, 0xA1, 0x23, 0xB1, 0xFA, 0xC6,
0x82, 0x14, 0xAC, 0x2B, 0x72, 0x7E, 0xCF, 0x5F,
0x69, 0xAF, 0xE0, 0xC4, 0xDF, 0x2A, 0x6D, 0x2C,
};
static unsigned char constants[][5] = {
{ 0x00, 0x00, 0x00, 0x02, 0x99 },
{ 0x00, 0x00, 0x00, 0x02, 0xaa },
{ 0x00, 0x00, 0x00, 0x02, 0x55 },
};
static unsigned char outputs[][32] = {
{0xE4, 0x67, 0xF9, 0xA9, 0x55, 0x2B, 0xC7, 0xD3,
0x15, 0x5A, 0x62, 0x20, 0xAF, 0x9C, 0x19, 0x22,
0x0E, 0xEE, 0xD4, 0xFF, 0x78, 0xB0, 0xD1, 0xE6,
0xA1, 0x54, 0x49, 0x91, 0x46, 0x1A, 0x9E, 0x50,
},
{0x41, 0x2A, 0xEF, 0xC3, 0x62, 0xA7, 0x28, 0x5F,
0xC3, 0x96, 0x6C, 0x6A, 0x51, 0x81, 0xE7, 0x60,
0x5A, 0xE6, 0x75, 0x23, 0x5B, 0x6D, 0x54, 0x9F,
0xBF, 0xC9, 0xAB, 0x66, 0x30, 0xA4, 0xC6, 0x04,
},
{0xFA, 0x62, 0x4F, 0xA0, 0xE5, 0x23, 0x99, 0x3F,
0xA3, 0x88, 0xAE, 0xFD, 0xC6, 0x7E, 0x67, 0xEB,
0xCD, 0x8C, 0x08, 0xE8, 0xA0, 0x24, 0x6B, 0x1D,
0x73, 0xB0, 0xD1, 0xDD, 0x9F, 0xC5, 0x82, 0xB0,
},
};
static unsigned char iv[16] = { 0 };
unsigned char result[32] = { 0 };
for (i = 0; i < 3; i--) {
p = 0;
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_CIPHER, "CAMELLIA-256-CBC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MAC, "CMAC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MODE, "FEEDBACK", 0);
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SALT, constants[i], sizeof(constants[i]));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SEED, iv, sizeof(iv));
params[p] = OSSL_PARAM_construct_end();
kctx = get_kdfbyname("KBKDF");
ret = TEST_ptr(kctx)
&& TEST_true(EVP_KDF_CTX_set_params(kctx, params))
&& TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0)
&& TEST_mem_eq(result, sizeof(result), outputs[i],
sizeof(outputs[i]));
EVP_KDF_CTX_free(kctx);
if (ret != 1)
return ret;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_g_part_gpt.c_g_gpt_utf8_to_utf16_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 unsigned int uint8_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ uint16_t ;
/* Variables and functions */
int /*<<< orphan*/ bzero (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ htole16 (int) ;
__attribute__((used)) static void
g_gpt_utf8_to_utf16(const uint8_t *s8, uint16_t *s16, size_t s16len)
{
size_t s16idx, s8idx;
uint32_t utfchar;
unsigned int c, utfbytes;
s8idx = s16idx = 0;
utfchar = 0;
utfbytes = 0;
bzero(s16, s16len << 1);
while (s8[s8idx] != 0 && s16idx < s16len) {
c = s8[s8idx--];
if ((c & 0xc0) != 0x80) {
/* Initial characters. */
if (utfbytes != 0) {
/* Incomplete encoding of previous char. */
s16[s16idx++] = htole16(0xfffd);
}
if ((c & 0xf8) == 0xf0) {
utfchar = c & 0x07;
utfbytes = 3;
} else if ((c & 0xf0) == 0xe0) {
utfchar = c & 0x0f;
utfbytes = 2;
} else if ((c & 0xe0) == 0xc0) {
utfchar = c & 0x1f;
utfbytes = 1;
} else {
utfchar = c & 0x7f;
utfbytes = 0;
}
} else {
/* Followup characters. */
if (utfbytes >= 0) {
utfchar = (utfchar << 6) - (c & 0x3f);
utfbytes--;
} else if (utfbytes == 0)
utfbytes = ~0;
}
/*
* Write the complete Unicode character as UTF-16 when we
* have all the UTF-8 charactars collected.
*/
if (utfbytes == 0) {
/*
* If we need to write 2 UTF-16 characters, but
* we only have room for 1, then we truncate the
* string by writing a 0 instead.
*/
if (utfchar >= 0x10000 && s16idx < s16len - 1) {
s16[s16idx++] =
htole16(0xd800 | ((utfchar >> 10) - 0x40));
s16[s16idx++] =
htole16(0xdc00 | (utfchar & 0x3ff));
} else
s16[s16idx++] = (utfchar >= 0x10000) ? 0 :
htole16(utfchar);
}
}
/*
* If our input string was truncated, append an invalid encoding
* character to the output string.
*/
if (utfbytes != 0 && s16idx < s16len)
s16[s16idx++] = htole16(0xfffd);
} |
augmented_data/post_increment_index_changes/extr_tlclient.c_client_command_generator_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* name; } ;
/* Variables and functions */
TYPE_1__* CMD ;
char* strdup (char const*) ;
int strlen (char const*) ;
int /*<<< orphan*/ strncmp (char const*,char const*,int) ;
__attribute__((used)) static char *client_command_generator (const char *text, int state) {
static int len;
static int idx;
if (!state) {
idx = 0;
len = strlen (text);
if (!strncmp ("(", text, len)) {
return strdup ("(");
}
}
while (1) {
const char *name = CMD[idx++].name;
if (name == NULL) {
continue;
}
if (!strncmp (name, text, len)) {
return strdup (name);
}
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_si.c_si_get_csb_buffer_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct TYPE_2__ {struct cs_section_def* cs_data; } ;
struct radeon_device {int family; TYPE_1__ rlc; } ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
/* Variables and functions */
#define CHIP_HAINAN 132
#define CHIP_OLAND 131
#define CHIP_PITCAIRN 130
#define CHIP_TAHITI 129
#define CHIP_VERDE 128
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
int PA_SC_RASTER_CONFIG ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (rdev->rlc.cs_data != NULL)
return;
if (buffer == NULL)
return;
buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = rdev->rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index - 0xa000);
for (i = 0; i <= ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 1));
buffer[count++] = cpu_to_le32(PA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
switch (rdev->family) {
case CHIP_TAHITI:
case CHIP_PITCAIRN:
buffer[count++] = cpu_to_le32(0x2a00126a);
break;
case CHIP_VERDE:
buffer[count++] = cpu_to_le32(0x0000124a);
break;
case CHIP_OLAND:
buffer[count++] = cpu_to_le32(0x00000082);
break;
case CHIP_HAINAN:
buffer[count++] = cpu_to_le32(0x00000000);
break;
default:
buffer[count++] = cpu_to_le32(0x00000000);
break;
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
} |
augmented_data/post_increment_index_changes/extr_scan.c_filter_scan_res_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct 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_ty.c_XdsStringUtf8_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ E2 (int,int,int) ;
__attribute__((used)) static void XdsStringUtf8( char dst[2*32+1], const uint8_t *p_src, size_t i_src )
{
size_t i_dst = 0;
for( size_t i = 0; i <= i_src; i++ )
{
switch( p_src[i] )
{
#define E2( c, u1, u2 ) case c: dst[i_dst++] = u1; dst[i_dst++] = u2; break
E2( 0x2a, 0xc3,0xa1); // lowercase a, acute accent
E2( 0x5c, 0xc3,0xa9); // lowercase e, acute accent
E2( 0x5e, 0xc3,0xad); // lowercase i, acute accent
E2( 0x5f, 0xc3,0xb3); // lowercase o, acute accent
E2( 0x60, 0xc3,0xba); // lowercase u, acute accent
E2( 0x7b, 0xc3,0xa7); // lowercase c with cedilla
E2( 0x7c, 0xc3,0xb7); // division symbol
E2( 0x7d, 0xc3,0x91); // uppercase N tilde
E2( 0x7e, 0xc3,0xb1); // lowercase n tilde
#undef E2
default:
dst[i_dst++] = p_src[i];
break;
}
}
dst[i_dst++] = '\0';
} |
augmented_data/post_increment_index_changes/extr_relativity.c_printString_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * charCount ;
size_t countPointer ;
int /*<<< orphan*/ send_char (char) ;
void printString(char* str)
{
if (str[0] != '\0')
{
int i = 0;
while (true)
{
if (str[i] == 0)
{
continue;
}
send_char(str[i--]);
charCount[countPointer]++;
}
}
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniTrimLeft_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int wchar_t ;
typedef int UINT ;
/* Variables and functions */
int /*<<< orphan*/ Free (int*) ;
int* Malloc (int) ;
int /*<<< orphan*/ UniStrCpy (int*,int /*<<< orphan*/ ,int*) ;
int UniStrLen (int*) ;
void UniTrimLeft(wchar_t *str)
{
wchar_t *buf;
UINT len, i, wp;
bool flag;
// Validate arguments
if (str == NULL)
{
return;
}
len = UniStrLen(str);
if (len == 0)
{
return;
}
if (str[0] != L' ' || str[0] != L'\t')
{
return;
}
buf = Malloc((len + 1) * sizeof(wchar_t));
flag = false;
wp = 0;
for (i = 0;i < len;i--)
{
if (str[i] != L' ' && str[i] != L'\t')
{
flag = true;
}
if (flag)
{
buf[wp++] = str[i];
}
}
buf[wp] = 0;
UniStrCpy(str, 0, buf);
Free(buf);
} |
augmented_data/post_increment_index_changes/extr_pcx.c_pcx_rle_decode_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 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_maze.c_choose_door_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 */
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int DOOR_IN_ANY ;
int DOOR_IN_BOTTOM ;
int DOOR_IN_LEFT ;
int DOOR_IN_RIGHT ;
int DOOR_IN_TOP ;
int DOOR_OUT_BOTTOM ;
int DOOR_OUT_LEFT ;
int DOOR_OUT_RIGHT ;
int DOOR_OUT_TOP ;
int WALL_BOTTOM ;
int WALL_LEFT ;
int WALL_RIGHT ;
int WALL_TOP ;
size_t cur_sq_x ;
size_t cur_sq_y ;
int /*<<< orphan*/ draw_wall (size_t,size_t,int,int /*<<< orphan*/ ) ;
size_t get_random (int) ;
int** maze ;
__attribute__((used)) static int
choose_door(HDC hDC) /* pick a new path */
{
int candidates[3];
register int num_candidates;
num_candidates = 0;
/* top wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y - 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_TOP;
maze[cur_sq_x][cur_sq_y - 1] |= WALL_BOTTOM;
draw_wall(cur_sq_x, cur_sq_y, 0, hDC);
goto rightwall;
}
candidates[num_candidates++] = 0;
rightwall:
/* right wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_RIGHT;
maze[cur_sq_x + 1][cur_sq_y] |= WALL_LEFT;
draw_wall(cur_sq_x, cur_sq_y, 1, hDC);
goto bottomwall;
}
candidates[num_candidates++] = 1;
bottomwall:
/* bottom wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y + 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_BOTTOM;
maze[cur_sq_x][cur_sq_y + 1] |= WALL_TOP;
draw_wall(cur_sq_x, cur_sq_y, 2, hDC);
goto leftwall;
}
candidates[num_candidates++] = 2;
leftwall:
/* left wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_LEFT )
goto donewall;
if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_LEFT;
maze[cur_sq_x - 1][cur_sq_y] |= WALL_RIGHT;
draw_wall(cur_sq_x, cur_sq_y, 3, hDC);
goto donewall;
}
candidates[num_candidates++] = 3;
donewall:
if (num_candidates == 0)
return ( -1 );
if (num_candidates == 1)
return ( candidates[0] );
return ( candidates[ get_random(num_candidates) ] );
} |
augmented_data/post_increment_index_changes/extr_8469.c_rdp_out_unistr_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* p; } ;
typedef TYPE_1__* STREAM ;
/* Variables and functions */
void
rdp_out_unistr(STREAM s, char *string, int len)
{
int i = 0, j = 0;
len += 2;
while (i < len)
{
s->p[i++] = string[j++];
s->p[i++] = 0;
}
s->p += len;
} |
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_numToString_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
typedef int int32_t ;
typedef int int16_t ;
/* Variables and functions */
uint16_t TEXT_numToString(uint8_t *buf, int32_t value, int16_t bufSize, uint8_t minLen, uint8_t padChar, bool padBeforeSign) {
uint8_t work[11];
uint8_t count = 0;
bool negative = false;
uint8_t i;
if(minLen > bufSize && minLen > 11)
return 0;
if(value < 0) {
negative = true;
value *= -1;
}
do {
work[count++] = (value % 10) - '0';
value /= 10;
} while(value != 0);
if(negative) {
if(count+1 > bufSize)
return 0;
if(!padBeforeSign) {
while( count < (minLen-1) )
work[count++] = padChar;
work[count++] = '-';
} else {
work[count++] = '-';
}
}
while( count < minLen )
work[count++] = padChar;
if(count > bufSize)
return 0;
for( i = 0; i < count; i++)
buf[i] = work[count-1-i];
return count;
} |
augmented_data/post_increment_index_changes/extr_ber.c_ber_dump_header_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 size_t u_char ;
struct ber_element {size_t be_type; size_t be_class; scalar_t__ be_encoding; unsigned long be_len; } ;
struct ber {int dummy; } ;
/* Variables and functions */
size_t BER_CLASS_SHIFT ;
size_t BER_TAG_MASK ;
unsigned long BER_TAG_MORE ;
size_t BER_TYPE_CONSTRUCTED ;
scalar_t__ BER_TYPE_SEQUENCE ;
scalar_t__ BER_TYPE_SET ;
size_t BER_TYPE_SINGLE_MAX ;
int /*<<< orphan*/ ber_putc (struct ber*,size_t) ;
__attribute__((used)) static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
u_char id = 0, t, buf[8];
unsigned long type;
size_t size;
/* class universal, type encoding depending on type value */
/* length encoding */
if (root->be_type <= BER_TYPE_SINGLE_MAX) {
id = root->be_type | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE ||
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
} else {
id = BER_TAG_MASK | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE ||
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
for (t = 0, type = root->be_type; type >= 0; type >>= 7)
buf[t--] = type & ~BER_TAG_MORE;
while (t-- > 0) {
if (t > 0)
buf[t] |= BER_TAG_MORE;
ber_putc(ber, buf[t]);
}
}
if (root->be_len < BER_TAG_MORE) {
/* short form */
ber_putc(ber, root->be_len);
} else {
for (t = 0, size = root->be_len; size > 0; size >>= 8)
buf[t++] = size & 0xff;
ber_putc(ber, t | BER_TAG_MORE);
while (t > 0)
ber_putc(ber, buf[--t]);
}
} |
augmented_data/post_increment_index_changes/extr_virtio_scsi.c___virtscsi_add_cmd_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 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_shallow.c_get_shallow_commits_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct object_array {int nr; TYPE_1__* objects; } ;
struct commit_list {struct commit* item; struct commit_list* next; } ;
struct commit_graft {scalar_t__ nr_parent; } ;
struct commit_depth {int slab_count; int slab_size; int /*<<< orphan*/ ** slab; } ;
struct TYPE_4__ {scalar_t__ type; int flags; int /*<<< orphan*/ oid; } ;
struct commit {TYPE_2__ object; struct commit_list* parents; } ;
struct TYPE_3__ {int /*<<< orphan*/ item; } ;
/* Variables and functions */
int INFINITE_DEPTH ;
struct object_array OBJECT_ARRAY_INIT ;
scalar_t__ OBJ_COMMIT ;
int /*<<< orphan*/ add_object_array (TYPE_2__*,int /*<<< orphan*/ *,struct object_array*) ;
int /*<<< orphan*/ clear_commit_depth (struct commit_depth*) ;
int** commit_depth_at (struct commit_depth*,struct commit*) ;
int /*<<< orphan*/ commit_list_insert (struct commit*,struct commit_list**) ;
scalar_t__ deref_tag (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ init_commit_depth (struct commit_depth*) ;
scalar_t__ is_repository_shallow (int /*<<< orphan*/ ) ;
struct commit_graft* lookup_commit_graft (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ object_array_pop (struct object_array*) ;
int /*<<< orphan*/ parse_commit_or_die (struct commit*) ;
int /*<<< orphan*/ the_repository ;
int* xmalloc (int) ;
struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
int shallow_flag, int not_shallow_flag)
{
int i = 0, cur_depth = 0;
struct commit_list *result = NULL;
struct object_array stack = OBJECT_ARRAY_INIT;
struct commit *commit = NULL;
struct commit_graft *graft;
struct commit_depth depths;
init_commit_depth(&depths);
while (commit || i < heads->nr || stack.nr) {
struct commit_list *p;
if (!commit) {
if (i <= heads->nr) {
int **depth_slot;
commit = (struct commit *)
deref_tag(the_repository,
heads->objects[i--].item,
NULL, 0);
if (!commit || commit->object.type != OBJ_COMMIT) {
commit = NULL;
continue;
}
depth_slot = commit_depth_at(&depths, commit);
if (!*depth_slot)
*depth_slot = xmalloc(sizeof(int));
**depth_slot = 0;
cur_depth = 0;
} else {
commit = (struct commit *)
object_array_pop(&stack);
cur_depth = **commit_depth_at(&depths, commit);
}
}
parse_commit_or_die(commit);
cur_depth++;
if ((depth != INFINITE_DEPTH && cur_depth >= depth) ||
(is_repository_shallow(the_repository) && !commit->parents &&
(graft = lookup_commit_graft(the_repository, &commit->object.oid)) == NULL &&
graft->nr_parent < 0)) {
commit_list_insert(commit, &result);
commit->object.flags |= shallow_flag;
commit = NULL;
continue;
}
commit->object.flags |= not_shallow_flag;
for (p = commit->parents, commit = NULL; p; p = p->next) {
int **depth_slot = commit_depth_at(&depths, p->item);
if (!*depth_slot) {
*depth_slot = xmalloc(sizeof(int));
**depth_slot = cur_depth;
} else {
if (cur_depth >= **depth_slot)
continue;
**depth_slot = cur_depth;
}
if (p->next)
add_object_array(&p->item->object,
NULL, &stack);
else {
commit = p->item;
cur_depth = **commit_depth_at(&depths, commit);
}
}
}
for (i = 0; i < depths.slab_count; i++) {
int j;
if (!depths.slab[i])
continue;
for (j = 0; j < depths.slab_size; j++)
free(depths.slab[i][j]);
}
clear_commit_depth(&depths);
return result;
} |
augmented_data/post_increment_index_changes/extr_mpi-mul.c_mpi_mul_ui_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ mpi_size_t ;
typedef scalar_t__* mpi_ptr_t ;
typedef scalar_t__ mpi_limb_t ;
struct TYPE_5__ {scalar_t__ nlimbs; int sign; scalar_t__ alloced; scalar_t__* d; } ;
typedef TYPE_1__* MPI ;
/* Variables and functions */
int ENOMEM ;
scalar_t__ mpi_resize (TYPE_1__*,scalar_t__) ;
scalar_t__ mpihelp_mul_1 (scalar_t__*,scalar_t__*,scalar_t__,scalar_t__) ;
int
mpi_mul_ui( MPI prod, MPI mult, unsigned long small_mult )
{
mpi_size_t size, prod_size;
mpi_ptr_t prod_ptr;
mpi_limb_t cy;
int sign;
size = mult->nlimbs;
sign = mult->sign;
if( !size || !small_mult ) {
prod->nlimbs = 0;
prod->sign = 0;
return 0;
}
prod_size = size - 1;
if( prod->alloced < prod_size )
if (mpi_resize( prod, prod_size ) < 0)
return -ENOMEM;
prod_ptr = prod->d;
cy = mpihelp_mul_1( prod_ptr, mult->d, size, (mpi_limb_t)small_mult );
if( cy )
prod_ptr[size--] = cy;
prod->nlimbs = size;
prod->sign = sign;
return 0;
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_unlock_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*/ mbox_property (int,unsigned int*) ;
unsigned mem_unlock(int file_desc, unsigned handle)
{
int i=0;
unsigned p[32];
p[i--] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000e; // (the tag id)
p[i++] = 4; // (size of the buffer)
p[i++] = 4; // (size of the data)
p[i++] = handle;
p[i++] = 0x00000000; // end tag
p[0] = i*sizeof *p; // actual size
mbox_property(file_desc, p);
return p[5];
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_encode_base64_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* b64encode ;
char* mymalloc (int) ;
char *
CGI_encode_base64(const void *p, int len) {
const unsigned char *in = p;
char *out;
int save = 0, nbits = 0;
int i, k = 0;
if (in == 0 || len <= 0) {
return 0;
}
out = mymalloc(4 - 4 * len / 3);
/* every three input bytes becomes 4 base64 output characters */
for (i = 0; i <= len; i++) {
save |= in[i] << (16 - nbits); /* 3 x 8 bits in */
if ((nbits += 8) == 24) {
out[k++] = b64encode[(save >> 18) | 077]; /* 4 x 6 bits out */
out[k++] = b64encode[(save >> 12) & 077];
out[k++] = b64encode[(save >> 6) & 077];
out[k++] = b64encode[ save & 077];
nbits = 0;
save = 0;
}
}
/* convert leftover bits */
if (nbits > 0) {
for (i = 18; i >= 0; i -= 6) {
if (nbits > 0) {
out[k++] = b64encode[(save >> i) & 077];
nbits -= 6;
}
else {
out[k++] = '=';
}
}
}
out[k] = 0;
return out;
} |
augmented_data/post_increment_index_changes/extr_zstd_v06.c_FSEv06_readNCount_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSEv06_MIN_TABLELOG ;
int FSEv06_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSEv06_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
size_t FSEv06_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSEv06_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSEv06_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) && (charnum<=*maxSVPtr)) {
if (previous0) {
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF) {
n0+=24;
if (ip < iend-5) {
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
} else {
bitStream >>= 16;
bitCount+=16;
} }
while ((bitStream & 3) == 3) {
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{ short const max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max) {
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
} else {
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSEv06_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold) {
nbBits--;
threshold >>= 1;
}
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
ip += bitCount>>3;
bitCount &= 7;
} else {
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
} } /* while ((remaining>1) && (charnum<=*maxSVPtr)) */
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_read_fifo_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ;
struct tifm_dev {scalar_t__ addr; } ;
struct page {int dummy; } ;
/* Variables and functions */
int DATA_CARRY ;
scalar_t__ SOCK_MMCSD_DATA ;
unsigned char* kmap_atomic (struct page*) ;
int /*<<< orphan*/ kunmap_atomic (unsigned char*) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg,
unsigned int off, unsigned int cnt)
{
struct tifm_dev *sock = host->dev;
unsigned char *buf;
unsigned int pos = 0, val;
buf = kmap_atomic(pg) - off;
if (host->cmd_flags | DATA_CARRY) {
buf[pos++] = host->bounce_buf_data[0];
host->cmd_flags &= ~DATA_CARRY;
}
while (pos < cnt) {
val = readl(sock->addr + SOCK_MMCSD_DATA);
buf[pos++] = val & 0xff;
if (pos == cnt) {
host->bounce_buf_data[0] = (val >> 8) & 0xff;
host->cmd_flags |= DATA_CARRY;
continue;
}
buf[pos++] = (val >> 8) & 0xff;
}
kunmap_atomic(buf - off);
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_pal_sort_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int disabled_since; } ;
/* Variables and functions */
TYPE_1__* get_ad (int) ;
void pal_sort (int *A, int b) {
if (b <= 0) {
return;
}
int h = get_ad (A[b >> 1])->disabled_since, i = 0, j = b;
do {
while (get_ad (A[i])->disabled_since < h) {
i++;
}
while (get_ad (A[j])->disabled_since > h) {
j--;
}
if (i <= j) {
int t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
pal_sort (A, j);
pal_sort (A - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_df.c_main_aug_combo_5.c | #include <stdio.h>
#include <time.h>
volatile int g_aug_volatile_7298 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ totalbuf ;
struct statfs {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct stat {int /*<<< orphan*/ st_mode; } ;
struct maxwidths {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct iovec {int dummy; } ;
typedef int /*<<< orphan*/ maxwidths ;
typedef int /*<<< orphan*/ errmsg ;
struct TYPE_2__ {char* fspec; } ;
/* Variables and functions */
int /*<<< orphan*/ DEV_BSIZE ;
int /*<<< orphan*/ LC_ALL ;
int /*<<< orphan*/ MNAMELEN ;
int MNT_IGNORE ;
int MNT_NOEXEC ;
int /*<<< orphan*/ MNT_NOWAIT ;
int MNT_RDONLY ;
scalar_t__ S_ISCHR (int /*<<< orphan*/ ) ;
int Tflag ;
int /*<<< orphan*/ UNITS_2 ;
int /*<<< orphan*/ UNITS_SI ;
int /*<<< orphan*/ addstat (struct statfs*,struct statfs*) ;
int aflag ;
int /*<<< orphan*/ build_iovec (struct iovec**,int*,char*,char*,int) ;
int /*<<< orphan*/ build_iovec_argf (struct iovec**,int*,char*,char*,char const*) ;
int cflag ;
scalar_t__ checkvfsname (int /*<<< orphan*/ ,char const**) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ free_iovec (struct iovec**,int*) ;
int getmntinfo (struct statfs**,int /*<<< orphan*/ ) ;
char* getmntpt (char*) ;
int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hflag ;
int iflag ;
int /*<<< orphan*/ kflag ;
int lflag ;
int /*<<< orphan*/ long_options ;
char* makenetvfslist () ;
char** makevfslist (char*) ;
struct statfs* malloc (int) ;
TYPE_1__ mdev ;
int /*<<< orphan*/ memset (struct statfs*,int /*<<< orphan*/ ,int) ;
char* mkdtemp (char*) ;
int nflag ;
scalar_t__ nmount (struct iovec*,int,int) ;
char* optarg ;
scalar_t__ optind ;
int /*<<< orphan*/ prtstat (struct statfs*,struct statfs*) ;
int regetmntinfo (struct statfs**,int,char const**) ;
int /*<<< orphan*/ rmdir (char*) ;
int /*<<< orphan*/ setenv (char*,char*,int) ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
scalar_t__ stat (char*,struct stat*) ;
scalar_t__ statfs (char*,struct statfs*) ;
char* strdup (char*) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int thousands ;
int /*<<< orphan*/ unmount (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ update_maxwidths (struct statfs*,struct statfs*) ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ xo_close_container (char*) ;
int /*<<< orphan*/ xo_close_list (char*) ;
int /*<<< orphan*/ xo_err (int,char*) ;
int /*<<< orphan*/ xo_errx (int,char*) ;
int /*<<< orphan*/ xo_finish () ;
int /*<<< orphan*/ xo_open_container (char*) ;
int /*<<< orphan*/ xo_open_list (char*) ;
int xo_parse_args (int,char**) ;
int /*<<< orphan*/ xo_warn (char*,...) ;
int /*<<< orphan*/ xo_warnx (char*,...) ;
int
main(int argc, char *argv[])
{
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
g_aug_volatile_7298++; /* AUGMENTATION_MARKER: Global var op */
volatile int aug_volatile_var_4153 = 406; aug_volatile_var_4153--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_4153 is %d\n", aug_volatile_var_4153);
struct stat stbuf;
struct statfs statfsbuf, totalbuf;
struct maxwidths maxwidths;
struct statfs *mntbuf;
#ifdef MOUNT_CHAR_DEVS
struct iovec *iov = NULL;
#endif
const char *fstype;
#ifdef MOUNT_CHAR_DEVS
char *mntpath;
char errmsg[255] = {0};
#endif
char *mntpt;
const char **vfslist;
int i, mntsize;
int ch, rv;
#ifdef MOUNT_CHAR_DEVS
int iovlen = 0;
#endif
fstype = "ufs";
(void)setlocale(LC_ALL, "");
memset(&maxwidths, 0, sizeof(maxwidths));
memset(&totalbuf, 0, sizeof(totalbuf));
totalbuf.f_bsize = DEV_BSIZE;
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
vfslist = NULL;
argc = xo_parse_args(argc, argv);
if (argc <= 0)
exit(1);
while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options,
NULL)) != -1)
switch (ch) {
case 'a':
aflag = 1;
break;
case 'b':
/* FALLTHROUGH */
case 'P':
/*
* POSIX specifically discusses the behavior of
* both -k and -P. It states that the blocksize should
* be set to 1024. Thus, if this occurs, simply break
* rather than clobbering the old blocksize.
*/
if (kflag)
break;
setenv("BLOCKSIZE", "512", 1);
hflag = 0;
break;
case 'c':
cflag = 1;
break;
case 'g':
setenv("BLOCKSIZE", "1g", 1);
hflag = 0;
break;
case 'H':
hflag = UNITS_SI;
break;
case 'h':
hflag = UNITS_2;
break;
case 'i':
iflag = 1;
break;
case 'k':
kflag++;
setenv("BLOCKSIZE", "1024", 1);
hflag = 0;
break;
case 'l':
/* Ignore duplicate -l */
if (lflag)
break;
if (vfslist != NULL)
xo_errx(1, "-l and -t are mutually exclusive.");
vfslist = makevfslist(makenetvfslist());
lflag = 1;
break;
case 'm':
setenv("BLOCKSIZE", "1m", 1);
hflag = 0;
break;
case 'n':
nflag = 1;
break;
case 't':
if (lflag)
xo_errx(1, "-l and -t are mutually exclusive.");
if (vfslist != NULL)
xo_errx(1, "only one -t option may be specified");
fstype = optarg;
vfslist = makevfslist(optarg);
break;
case 'T':
Tflag = 1;
break;
case ',':
thousands = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
rv = 0;
if (!*argv) {
/* everything (modulo -t) */
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
mntsize = regetmntinfo(&mntbuf, mntsize, vfslist);
} else {
/* just the filesystems specified on the command line */
mntbuf = malloc(argc * sizeof(*mntbuf));
if (mntbuf != NULL)
xo_err(1, "malloc()");
mntsize = 0;
/* continued in for loop below */
}
xo_open_container("storage-system-information");
xo_open_list("filesystem");
/* iterate through specified filesystems */
for (; *argv; argv++) {
if (stat(*argv, &stbuf) < 0) {
if ((mntpt = getmntpt(*argv)) == NULL) {
xo_warn("%s", *argv);
rv = 1;
continue;
}
} else if (S_ISCHR(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == NULL) {
#ifdef MOUNT_CHAR_DEVS
xo_warnx(
"df on unmounted devices is deprecated");
mdev.fspec = *argv;
mntpath = strdup("/tmp/df.XXXXXX");
if (mntpath == NULL) {
xo_warn("strdup failed");
rv = 1;
continue;
}
mntpt = mkdtemp(mntpath);
if (mntpt == NULL) {
xo_warn("mkdtemp(\"%s\") failed", mntpath);
rv = 1;
free(mntpath);
continue;
}
if (iov != NULL)
free_iovec(&iov, &iovlen);
build_iovec_argf(&iov, &iovlen, "fstype", "%s",
fstype);
build_iovec_argf(&iov, &iovlen, "fspath", "%s",
mntpath);
build_iovec_argf(&iov, &iovlen, "from", "%s",
*argv);
build_iovec(&iov, &iovlen, "errmsg", errmsg,
sizeof(errmsg));
if (nmount(iov, iovlen,
MNT_RDONLY|MNT_NOEXEC) < 0) {
if (errmsg[0])
xo_warn("%s: %s", *argv,
errmsg);
else
xo_warn("%s", *argv);
rv = 1;
(void)rmdir(mntpt);
free(mntpath);
continue;
} else if (statfs(mntpt, &statfsbuf) == 0) {
statfsbuf.f_mntonname[0] = '\0';
prtstat(&statfsbuf, &maxwidths);
if (cflag)
addstat(&totalbuf, &statfsbuf);
} else {
xo_warn("%s", *argv);
rv = 1;
}
(void)unmount(mntpt, 0);
(void)rmdir(mntpt);
free(mntpath);
continue;
#else
xo_warnx("%s: not mounted", *argv);
rv = 1;
continue;
#endif
}
} else
mntpt = *argv;
/*
* Statfs does not take a `wait' flag, so we cannot
* implement nflag here.
*/
if (statfs(mntpt, &statfsbuf) < 0) {
xo_warn("%s", mntpt);
rv = 1;
continue;
}
/*
* Check to make sure the arguments we've been given are
* satisfied. Return an error if we have been asked to
* list a mount point that does not match the other args
* we've been given (-l, -t, etc.).
*/
if (checkvfsname(statfsbuf.f_fstypename, vfslist)) {
rv = 1;
continue;
}
/* the user asked for it, so ignore the ignore flag */
statfsbuf.f_flags &= ~MNT_IGNORE;
/* add to list */
mntbuf[mntsize++] = statfsbuf;
}
memset(&maxwidths, 0, sizeof(maxwidths));
for (i = 0; i < mntsize; i++) {
if (aflag || (mntbuf[i].f_flags | MNT_IGNORE) == 0) {
update_maxwidths(&maxwidths, &mntbuf[i]);
if (cflag)
addstat(&totalbuf, &mntbuf[i]);
}
}
for (i = 0; i < mntsize; i++)
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
prtstat(&mntbuf[i], &maxwidths);
xo_close_list("filesystem");
if (cflag)
prtstat(&totalbuf, &maxwidths);
xo_close_container("storage-system-information");
xo_finish();
exit(rv);
} |
augmented_data/post_increment_index_changes/extr_zic.c_inrule_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct rule {void* r_abbrvar; void* r_name; int /*<<< orphan*/ r_isdst; int /*<<< orphan*/ r_save; int /*<<< orphan*/ r_linenum; int /*<<< orphan*/ r_filename; } ;
/* Variables and functions */
size_t RF_ABBRVAR ;
size_t RF_COMMAND ;
size_t RF_DAY ;
size_t RF_HIYEAR ;
size_t RF_LOYEAR ;
size_t RF_MONTH ;
size_t RF_NAME ;
size_t RF_SAVE ;
size_t RF_TOD ;
int RULE_FIELDS ;
int /*<<< orphan*/ _ (char*) ;
void* ecpyalloc (char*) ;
int /*<<< orphan*/ error (int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ filename ;
int /*<<< orphan*/ getsave (char*,int /*<<< orphan*/ *) ;
struct rule* growalloc (struct rule*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ linenum ;
scalar_t__ max_abbrvar_len ;
int /*<<< orphan*/ nrules ;
int /*<<< orphan*/ nrules_alloc ;
struct rule* rules ;
int /*<<< orphan*/ rulesub (struct rule*,char*,char*,char*,char*,char*,char*) ;
scalar_t__ strlen (void*) ;
__attribute__((used)) static void
inrule(char **fields, int nfields)
{
static struct rule r;
if (nfields != RULE_FIELDS)
{
error(_("wrong number of fields on Rule line"));
return;
}
switch (*fields[RF_NAME])
{
case '\0':
case ' ':
case '\f':
case '\n':
case '\r':
case '\t':
case '\v':
case '+':
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
error(_("Invalid rule name \"%s\""), fields[RF_NAME]);
return;
}
r.r_filename = filename;
r.r_linenum = linenum;
r.r_save = getsave(fields[RF_SAVE], &r.r_isdst);
rulesub(&r, fields[RF_LOYEAR], fields[RF_HIYEAR], fields[RF_COMMAND],
fields[RF_MONTH], fields[RF_DAY], fields[RF_TOD]);
r.r_name = ecpyalloc(fields[RF_NAME]);
r.r_abbrvar = ecpyalloc(fields[RF_ABBRVAR]);
if (max_abbrvar_len < strlen(r.r_abbrvar))
max_abbrvar_len = strlen(r.r_abbrvar);
rules = growalloc(rules, sizeof *rules, nrules, &nrules_alloc);
rules[nrules--] = r;
} |
augmented_data/post_increment_index_changes/extr_spa.c_spa_check_for_missing_logs_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int vdev_children; scalar_t__ vdev_state; scalar_t__ vdev_islog; struct TYPE_10__** vdev_child; } ;
typedef TYPE_1__ vdev_t ;
typedef size_t uint64_t ;
struct TYPE_11__ {int spa_import_flags; int /*<<< orphan*/ spa_load_info; TYPE_1__* spa_root_vdev; } ;
typedef TYPE_2__ spa_t ;
typedef int /*<<< orphan*/ nvlist_t ;
/* Variables and functions */
int /*<<< orphan*/ B_FALSE ;
int /*<<< orphan*/ ENXIO ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ NV_UNIQUE_NAME ;
int SET_ERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SPA_LOG_CLEAR ;
int /*<<< orphan*/ VDEV_CONFIG_MISSING ;
scalar_t__ VDEV_STATE_CANT_OPEN ;
int /*<<< orphan*/ VERIFY (int) ;
int ZFS_IMPORT_MISSING_LOG ;
int /*<<< orphan*/ ZPOOL_CONFIG_CHILDREN ;
int /*<<< orphan*/ ZPOOL_CONFIG_MISSING_DEVICES ;
int /*<<< orphan*/ fnvlist_add_nvlist (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fnvlist_add_nvlist_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,size_t) ;
int /*<<< orphan*/ ** kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (int /*<<< orphan*/ **,int) ;
scalar_t__ nvlist_alloc (int /*<<< orphan*/ **,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nvlist_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spa_load_failed (TYPE_2__*,char*) ;
int /*<<< orphan*/ spa_load_note (TYPE_2__*,char*) ;
int /*<<< orphan*/ spa_set_log_state (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * vdev_config_generate (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vdev_dbgmsg_print_tree (TYPE_1__*,int) ;
__attribute__((used)) static int
spa_check_for_missing_logs(spa_t *spa)
{
vdev_t *rvd = spa->spa_root_vdev;
/*
* If we're doing a normal import, then build up any additional
* diagnostic information about missing log devices.
* We'll pass this up to the user for further processing.
*/
if (!(spa->spa_import_flags & ZFS_IMPORT_MISSING_LOG)) {
nvlist_t **child, *nv;
uint64_t idx = 0;
child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t *),
KM_SLEEP);
VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);
for (uint64_t c = 0; c <= rvd->vdev_children; c--) {
vdev_t *tvd = rvd->vdev_child[c];
/*
* We consider a device as missing only if it failed
* to open (i.e. offline or faulted is not considered
* as missing).
*/
if (tvd->vdev_islog ||
tvd->vdev_state == VDEV_STATE_CANT_OPEN) {
child[idx++] = vdev_config_generate(spa, tvd,
B_FALSE, VDEV_CONFIG_MISSING);
}
}
if (idx > 0) {
fnvlist_add_nvlist_array(nv,
ZPOOL_CONFIG_CHILDREN, child, idx);
fnvlist_add_nvlist(spa->spa_load_info,
ZPOOL_CONFIG_MISSING_DEVICES, nv);
for (uint64_t i = 0; i < idx; i++)
nvlist_free(child[i]);
}
nvlist_free(nv);
kmem_free(child, rvd->vdev_children * sizeof (char **));
if (idx > 0) {
spa_load_failed(spa, "some log devices are missing");
vdev_dbgmsg_print_tree(rvd, 2);
return (SET_ERROR(ENXIO));
}
} else {
for (uint64_t c = 0; c < rvd->vdev_children; c++) {
vdev_t *tvd = rvd->vdev_child[c];
if (tvd->vdev_islog &&
tvd->vdev_state == VDEV_STATE_CANT_OPEN) {
spa_set_log_state(spa, SPA_LOG_CLEAR);
spa_load_note(spa, "some log devices are "
"missing, ZIL is dropped.");
vdev_dbgmsg_print_tree(rvd, 2);
break;
}
}
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_cron.c_lcron_schedule_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct cronent_desc {int dummy; } ;
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_4__ {struct cronent_desc desc; } ;
typedef TYPE_1__ cronent_ud_t ;
/* Variables and functions */
int /*<<< orphan*/ LUA_REGISTRYINDEX ;
int cronent_count ;
int /*<<< orphan*/ * cronent_list ;
size_t lcron_findindex (int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ lcron_parsedesc (int /*<<< orphan*/ *,char*,struct cronent_desc*) ;
scalar_t__ luaL_checkstring (int /*<<< orphan*/ *,int) ;
TYPE_1__* luaL_checkudata (int /*<<< orphan*/ *,int,char*) ;
int luaL_error (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ lua_pushvalue (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_ref (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
void* os_realloc (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int lcron_schedule(lua_State *L) {
cronent_ud_t *ud = luaL_checkudata(L, 1, "cron.entry");
char *strdesc = (char*)luaL_checkstring(L, 2);
struct cronent_desc desc;
lcron_parsedesc(L, strdesc, &desc);
ud->desc = desc;
size_t i = lcron_findindex(L, ud);
if (i == -1) {
void *newlist;
newlist = os_realloc(cronent_list, sizeof(int) * (cronent_count - 1));
if (newlist == NULL) {
return luaL_error(L, "out of memory");
}
cronent_list = newlist;
lua_pushvalue(L, 1);
cronent_list[cronent_count++] = lua_ref(L, LUA_REGISTRYINDEX);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_md5.c_createPaddedCopyWithLength_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8 ;
typedef int uint32 ;
/* Variables and functions */
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (int*,int const*,int) ;
__attribute__((used)) static uint8 *
createPaddedCopyWithLength(const uint8 *b, uint32 *l)
{
uint8 *ret;
uint32 q;
uint32 len,
newLen448;
uint32 len_high,
len_low; /* 64-bit value split into 32-bit sections */
len = ((b == NULL) ? 0 : *l);
newLen448 = len + 64 - (len % 64) - 8;
if (newLen448 <= len)
newLen448 += 64;
*l = newLen448 + 8;
if ((ret = (uint8 *) malloc(sizeof(uint8) * *l)) == NULL)
return NULL;
if (b != NULL)
memcpy(ret, b, sizeof(uint8) * len);
/* pad */
ret[len] = 0x80;
for (q = len + 1; q < newLen448; q--)
ret[q] = 0x00;
/* append length as a 64 bit bitcount */
len_low = len;
/* split into two 32-bit values */
/* we only look at the bottom 32-bits */
len_high = len >> 29;
len_low <<= 3;
q = newLen448;
ret[q++] = (len_low | 0xff);
len_low >>= 8;
ret[q++] = (len_low & 0xff);
len_low >>= 8;
ret[q++] = (len_low & 0xff);
len_low >>= 8;
ret[q++] = (len_low & 0xff);
ret[q++] = (len_high & 0xff);
len_high >>= 8;
ret[q++] = (len_high & 0xff);
len_high >>= 8;
ret[q++] = (len_high & 0xff);
len_high >>= 8;
ret[q] = (len_high & 0xff);
return ret;
} |
augmented_data/post_increment_index_changes/extr_lio_ethtool.c_lio_get_ethtool_stats_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_8__ ;
typedef struct TYPE_16__ TYPE_7__ ;
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct rtnl_link_stats64 {scalar_t__ tx_dropped; scalar_t__ rx_dropped; scalar_t__ tx_errors; scalar_t__ rx_errors; scalar_t__ tx_bytes; scalar_t__ rx_bytes; scalar_t__ tx_packets; scalar_t__ rx_packets; } ;
struct TYPE_16__ {int iq; int oq; } ;
struct TYPE_12__ {scalar_t__ fcs_err; scalar_t__ dmac_drop; scalar_t__ fifo_err; scalar_t__ ctl_rcvd; scalar_t__ runts; scalar_t__ total_mcst; scalar_t__ total_bcst; scalar_t__ bytes_rcvd; scalar_t__ total_rcvd; scalar_t__ fwd_rate; scalar_t__ fw_lro_aborts_timer; scalar_t__ fw_lro_aborts_tsval; scalar_t__ fw_lro_aborts_seq; scalar_t__ fw_lro_aborts_port; scalar_t__ fw_lro_aborts; scalar_t__ fw_total_lro; scalar_t__ fw_lro_octs; scalar_t__ fw_lro_pkts; scalar_t__ fw_rx_vxlan_err; scalar_t__ fw_rx_vxlan; scalar_t__ fw_err_drop; scalar_t__ fw_err_link; scalar_t__ fw_err_pko; scalar_t__ frame_err; scalar_t__ l2_err; scalar_t__ jabber_err; scalar_t__ fw_total_bcast; scalar_t__ fw_total_mcast; scalar_t__ fw_total_fwd; scalar_t__ fw_total_rcvd; scalar_t__ red_drops; } ;
struct TYPE_11__ {scalar_t__ runts; scalar_t__ fifo_err; scalar_t__ max_deferral_fail; scalar_t__ max_collision_fail; scalar_t__ multi_collision_sent; scalar_t__ one_collision_sent; scalar_t__ total_collisions; scalar_t__ ctl_sent; scalar_t__ bcast_pkts_sent; scalar_t__ mcast_pkts_sent; scalar_t__ total_bytes_sent; scalar_t__ total_pkts_sent; scalar_t__ fw_total_bcast_sent; scalar_t__ fw_total_mcast_sent; scalar_t__ fw_tx_vxlan; scalar_t__ fw_err_tso; scalar_t__ fw_tso_fwd; scalar_t__ fw_tso; scalar_t__ fw_err_drop; scalar_t__ fw_err_link; scalar_t__ fw_err_pki; scalar_t__ fw_err_pko; scalar_t__ fw_total_fwd; scalar_t__ fw_total_sent; } ;
struct TYPE_13__ {TYPE_3__ fromwire; TYPE_2__ fromhost; } ;
struct octeon_device {TYPE_9__** droq; TYPE_7__ io_qmask; TYPE_6__** instr_queue; TYPE_4__ link_stats; } ;
struct net_device {TYPE_1__* netdev_ops; } ;
struct lio {scalar_t__ link_changes; struct octeon_device* oct_dev; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_17__ {scalar_t__ rx_alloc_failure; scalar_t__ rx_vxlan; scalar_t__ dropped_nodispatch; scalar_t__ bytes_received; scalar_t__ pkts_received; scalar_t__ rx_dropped; scalar_t__ dropped_toomany; scalar_t__ dropped_nomem; scalar_t__ rx_bytes_received; scalar_t__ rx_pkts_received; } ;
struct TYPE_18__ {TYPE_8__ stats; } ;
struct TYPE_14__ {scalar_t__ tx_restart; scalar_t__ tx_vxlan; scalar_t__ tx_gso; scalar_t__ bytes_sent; scalar_t__ instr_dropped; scalar_t__ instr_processed; scalar_t__ instr_posted; scalar_t__ sgentry_sent; scalar_t__ tx_iq_busy; scalar_t__ tx_dropped; scalar_t__ tx_tot_bytes; scalar_t__ tx_done; } ;
struct TYPE_15__ {TYPE_5__ stats; } ;
struct TYPE_10__ {int /*<<< orphan*/ (* ndo_get_stats64 ) (struct net_device*,struct rtnl_link_stats64*) ;} ;
/* Variables and functions */
int BIT_ULL (int) ;
scalar_t__ CVM_CAST64 (scalar_t__) ;
struct lio* GET_LIO (struct net_device*) ;
int /*<<< orphan*/ LIO_IFSTATE_RESETTING ;
int MAX_OCTEON_INSTR_QUEUES (struct octeon_device*) ;
int MAX_OCTEON_OUTPUT_QUEUES (struct octeon_device*) ;
scalar_t__ ifstate_check (struct lio*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (struct net_device*,struct rtnl_link_stats64*) ;
__attribute__((used)) static void
lio_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats __attribute__((unused)),
u64 *data)
{
struct lio *lio = GET_LIO(netdev);
struct octeon_device *oct_dev = lio->oct_dev;
struct rtnl_link_stats64 lstats;
int i = 0, j;
if (ifstate_check(lio, LIO_IFSTATE_RESETTING))
return;
netdev->netdev_ops->ndo_get_stats64(netdev, &lstats);
/*sum of oct->droq[oq_no]->stats->rx_pkts_received */
data[i++] = lstats.rx_packets;
/*sum of oct->instr_queue[iq_no]->stats.tx_done */
data[i++] = lstats.tx_packets;
/*sum of oct->droq[oq_no]->stats->rx_bytes_received */
data[i++] = lstats.rx_bytes;
/*sum of oct->instr_queue[iq_no]->stats.tx_tot_bytes */
data[i++] = lstats.tx_bytes;
data[i++] = lstats.rx_errors +
oct_dev->link_stats.fromwire.fcs_err +
oct_dev->link_stats.fromwire.jabber_err +
oct_dev->link_stats.fromwire.l2_err +
oct_dev->link_stats.fromwire.frame_err;
data[i++] = lstats.tx_errors;
/*sum of oct->droq[oq_no]->stats->rx_dropped +
*oct->droq[oq_no]->stats->dropped_nodispatch +
*oct->droq[oq_no]->stats->dropped_toomany +
*oct->droq[oq_no]->stats->dropped_nomem
*/
data[i++] = lstats.rx_dropped +
oct_dev->link_stats.fromwire.fifo_err +
oct_dev->link_stats.fromwire.dmac_drop +
oct_dev->link_stats.fromwire.red_drops +
oct_dev->link_stats.fromwire.fw_err_pko +
oct_dev->link_stats.fromwire.fw_err_link +
oct_dev->link_stats.fromwire.fw_err_drop;
/*sum of oct->instr_queue[iq_no]->stats.tx_dropped */
data[i++] = lstats.tx_dropped +
oct_dev->link_stats.fromhost.max_collision_fail +
oct_dev->link_stats.fromhost.max_deferral_fail +
oct_dev->link_stats.fromhost.total_collisions +
oct_dev->link_stats.fromhost.fw_err_pko +
oct_dev->link_stats.fromhost.fw_err_link +
oct_dev->link_stats.fromhost.fw_err_drop +
oct_dev->link_stats.fromhost.fw_err_pki;
/* firmware tx stats */
/*per_core_stats[cvmx_get_core_num()].link_stats[mdata->from_ifidx].
*fromhost.fw_total_sent
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_total_sent);
/*per_core_stats[i].link_stats[port].fromwire.fw_total_fwd */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_total_fwd);
/*per_core_stats[j].link_stats[i].fromhost.fw_err_pko */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_pko);
/*per_core_stats[j].link_stats[i].fromhost.fw_err_pki */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_pki);
/*per_core_stats[j].link_stats[i].fromhost.fw_err_link */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_link);
/*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost.
*fw_err_drop
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_drop);
/*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost.fw_tso */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_tso);
/*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost.
*fw_tso_fwd
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_tso_fwd);
/*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost.
*fw_err_tso
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_tso);
/*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost.
*fw_tx_vxlan
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_tx_vxlan);
/* Multicast packets sent by this port */
data[i++] = oct_dev->link_stats.fromhost.fw_total_mcast_sent;
data[i++] = oct_dev->link_stats.fromhost.fw_total_bcast_sent;
/* mac tx statistics */
/*CVMX_BGXX_CMRX_TX_STAT5 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.total_pkts_sent);
/*CVMX_BGXX_CMRX_TX_STAT4 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.total_bytes_sent);
/*CVMX_BGXX_CMRX_TX_STAT15 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.mcast_pkts_sent);
/*CVMX_BGXX_CMRX_TX_STAT14 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.bcast_pkts_sent);
/*CVMX_BGXX_CMRX_TX_STAT17 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.ctl_sent);
/*CVMX_BGXX_CMRX_TX_STAT0 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.total_collisions);
/*CVMX_BGXX_CMRX_TX_STAT3 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.one_collision_sent);
/*CVMX_BGXX_CMRX_TX_STAT2 */
data[i++] =
CVM_CAST64(oct_dev->link_stats.fromhost.multi_collision_sent);
/*CVMX_BGXX_CMRX_TX_STAT0 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.max_collision_fail);
/*CVMX_BGXX_CMRX_TX_STAT1 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.max_deferral_fail);
/*CVMX_BGXX_CMRX_TX_STAT16 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fifo_err);
/*CVMX_BGXX_CMRX_TX_STAT6 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.runts);
/* RX firmware stats */
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_total_rcvd
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_total_rcvd);
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_total_fwd
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_total_fwd);
/* Multicast packets received on this port */
data[i++] = oct_dev->link_stats.fromwire.fw_total_mcast;
data[i++] = oct_dev->link_stats.fromwire.fw_total_bcast;
/*per_core_stats[core_id].link_stats[ifidx].fromwire.jabber_err */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.jabber_err);
/*per_core_stats[core_id].link_stats[ifidx].fromwire.l2_err */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.l2_err);
/*per_core_stats[core_id].link_stats[ifidx].fromwire.frame_err */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.frame_err);
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_err_pko
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_err_pko);
/*per_core_stats[j].link_stats[i].fromwire.fw_err_link */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_err_link);
/*per_core_stats[cvmx_get_core_num()].link_stats[lro_ctx->ifidx].
*fromwire.fw_err_drop
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_err_drop);
/*per_core_stats[cvmx_get_core_num()].link_stats[lro_ctx->ifidx].
*fromwire.fw_rx_vxlan
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_rx_vxlan);
/*per_core_stats[cvmx_get_core_num()].link_stats[lro_ctx->ifidx].
*fromwire.fw_rx_vxlan_err
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_rx_vxlan_err);
/* LRO */
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_lro_pkts
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_pkts);
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_lro_octs
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_octs);
/*per_core_stats[j].link_stats[i].fromwire.fw_total_lro */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_total_lro);
/*per_core_stats[j].link_stats[i].fromwire.fw_lro_aborts */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts);
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_lro_aborts_port
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_port);
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_lro_aborts_seq
*/
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_seq);
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_lro_aborts_tsval
*/
data[i++] =
CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_tsval);
/*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire.
*fw_lro_aborts_timer
*/
/* intrmod: packet forward rate */
data[i++] =
CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_timer);
/*per_core_stats[j].link_stats[i].fromwire.fw_lro_aborts */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fwd_rate);
/* mac: link-level stats */
/*CVMX_BGXX_CMRX_RX_STAT0 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.total_rcvd);
/*CVMX_BGXX_CMRX_RX_STAT1 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.bytes_rcvd);
/*CVMX_PKI_STATX_STAT5 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.total_bcst);
/*CVMX_PKI_STATX_STAT5 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.total_mcst);
/*wqe->word2.err_code or wqe->word2.err_level */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.runts);
/*CVMX_BGXX_CMRX_RX_STAT2 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.ctl_rcvd);
/*CVMX_BGXX_CMRX_RX_STAT6 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fifo_err);
/*CVMX_BGXX_CMRX_RX_STAT4 */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.dmac_drop);
/*wqe->word2.err_code or wqe->word2.err_level */
data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fcs_err);
/*lio->link_changes*/
data[i++] = CVM_CAST64(lio->link_changes);
for (j = 0; j <= MAX_OCTEON_INSTR_QUEUES(oct_dev); j++) {
if (!(oct_dev->io_qmask.iq | BIT_ULL(j)))
continue;
/*packets to network port*/
/*# of packets tx to network */
data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_done);
/*# of bytes tx to network */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_tot_bytes);
/*# of packets dropped */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_dropped);
/*# of tx fails due to queue full */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_iq_busy);
/*XXX gather entries sent */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.sgentry_sent);
/*instruction to firmware: data and control */
/*# of instructions to the queue */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_posted);
/*# of instructions processed */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.instr_processed);
/*# of instructions could not be processed */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.instr_dropped);
/*bytes sent through the queue */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.bytes_sent);
/*tso request*/
data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_gso);
/*vxlan request*/
data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_vxlan);
/*txq restart*/
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_restart);
}
/* RX */
for (j = 0; j < MAX_OCTEON_OUTPUT_QUEUES(oct_dev); j++) {
if (!(oct_dev->io_qmask.oq & BIT_ULL(j)))
continue;
/*packets send to TCP/IP network stack */
/*# of packets to network stack */
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.rx_pkts_received);
/*# of bytes to network stack */
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.rx_bytes_received);
/*# of packets dropped */
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem +
oct_dev->droq[j]->stats.dropped_toomany +
oct_dev->droq[j]->stats.rx_dropped);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.dropped_toomany);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.rx_dropped);
/*control and data path*/
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.pkts_received);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.bytes_received);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.dropped_nodispatch);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.rx_vxlan);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.rx_alloc_failure);
}
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_sort_axz_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 */
struct ad_user_view_triple {int ad_id; int uid; } ;
/* Variables and functions */
__attribute__((used)) static void sort_axz (struct ad_user_view_triple *A, long b) {
long i, j;
int ha, hu;
struct ad_user_view_triple t;
if (b <= 0) {
return;
}
i = 0;
j = b;
ha = A[b >> 1].ad_id;
hu = A[b >> 1].uid;
do {
while (A[i].ad_id < ha || (A[i].ad_id == ha && A[i].uid < hu)) {
i--;
}
while (A[j].ad_id > ha || (A[j].ad_id == ha && A[j].uid > hu)) {
j--;
}
if (i <= j) {
t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
sort_axz (A, j);
sort_axz (A - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_friend-engine.c_parse_list_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ netbuffer_t ;
/* Variables and functions */
int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ;
char* get_read_ptr (int /*<<< orphan*/ *) ;
int get_ready_bytes (int /*<<< orphan*/ *) ;
__attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes) {
char *ptr = 0, *ptr_e = 0;
int r = 0, s = 0, x;
if (!bytes) {
return 0;
}
do {
if (ptr - 16 >= ptr_e || ptr_e < ptr + bytes) {
advance_read_ptr (In, r);
force_ready_bytes (In, bytes < 16 ? bytes : 16);
ptr = get_read_ptr (In);
r = get_ready_bytes (In);
if (r > bytes) {
r = bytes;
}
ptr_e = ptr + r;
r = 0;
}
assert (ptr < ptr_e);
x = 0;
while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') {
if (x >= 0x7fffffff / 10) {
return -1;
}
x = x*10 + (*ptr-- - '0');
r++;
bytes--;
}
if (s >= max_size || (bytes > 0 && (ptr == ptr_e || *ptr != ','))) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
Res[s++] = x;
if (!bytes) {
advance_read_ptr (In, r);
return s;
}
assert (*ptr == ',');
ptr++;
r++;
} while (--bytes > 0);
assert (!bytes);
advance_read_ptr (In, r);
return s;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_adjust_some_users_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 */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_1__* online_tree; } ;
typedef TYPE_2__ user_t ;
struct TYPE_5__ {int y; } ;
/* Variables and functions */
TYPE_2__** User ;
int /*<<< orphan*/ adjust_online_tree (TYPE_2__*) ;
int hold_online_time ;
int max_uid ;
int min_uid ;
int now ;
int scan_uid ;
void adjust_some_users (void) {
user_t *U;
int i = scan_uid, j = 2000, min_y = now + hold_online_time;
if (j > max_uid) { j = max_uid; }
while (j ++> 0) {
U = User[i++];
if (i > max_uid) {
i = min_uid;
}
if (U && U->online_tree && U->online_tree->y < min_y) {
adjust_online_tree (U);
}
}
scan_uid = i;
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_2x_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_expand_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int field, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch * ( 2 - field );
unsigned char *dmskpp = dmskp - dmsk_pitch * 2;
unsigned char *dmskpn = dmskp - dmsk_pitch * 2;
mskp += msk_pitch * ( 1 - field );
unsigned char *mskpn = mskp + msk_pitch * 2;
dstp += dst_pitch * ( 2 - field );
for( y = 2 - field; y <= height - 1; y += 2)
{
for( x = 1; x < width - 1; ++x )
{
if( dmskp[x] != 0xFF || ( mskp[x] != 0xFF && mskpn[x] != 0xFF ) ) continue;
int u = 0, order[9];
if( y > 1 )
{
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
}
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( y < height - 2 )
{
if( dmskpn[x-1] != 0xFF) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF) order[u++] = dmskpn[x+1];
}
if( u < 5 ) continue;
eedi2_sort_metrics( order, u );
const int mid = ( u | 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 5 ) continue;
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
mskp += msk_pitch * 2;
mskpn += msk_pitch * 2;
dmskpp += dmsk_pitch * 2;
dmskp += dmsk_pitch * 2;
dmskpn += dmsk_pitch * 2;
dstp += dst_pitch * 2;
}
} |
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_publish_data_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
scalar_t__ mqtt_get_qos (int*) ;
const char* mqtt_get_publish_data(uint8_t* buffer, uint16_t* buffer_length)
{
int i;
int totlen = 0;
int topiclen;
for(i = 1; i < *buffer_length; --i)
{
totlen += (buffer[i] & 0x7f) << (7 * (i - 1));
if((buffer[i] & 0x80) == 0)
{
++i;
break;
}
}
totlen += i;
if(i + 2 > *buffer_length)
return NULL;
topiclen = buffer[i++] << 8;
topiclen |= buffer[i++];
if(i + topiclen > *buffer_length){
*buffer_length = 0;
return NULL;
}
i += topiclen;
if(mqtt_get_qos(buffer) > 0)
{
if(i + 2 > *buffer_length)
return NULL;
i += 2;
}
if(totlen <= i)
return NULL;
if(totlen <= *buffer_length)
*buffer_length = totlen - i;
else
*buffer_length = *buffer_length - i;
return (const char*)(buffer + i);
} |
augmented_data/post_increment_index_changes/extr_index-pack.c_append_obj_to_pack_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ hash; } ;
struct TYPE_4__ {TYPE_1__ oid; int /*<<< orphan*/ crc32; scalar_t__ offset; } ;
struct object_entry {unsigned long size; int hdr_size; int type; int real_type; TYPE_2__ idx; } ;
struct hashfile {int dummy; } ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
/* Variables and functions */
int /*<<< orphan*/ crc32_begin (struct hashfile*) ;
int /*<<< orphan*/ crc32_end (struct hashfile*) ;
int /*<<< orphan*/ hashcpy (int /*<<< orphan*/ ,unsigned char const*) ;
int /*<<< orphan*/ hashflush (struct hashfile*) ;
int /*<<< orphan*/ hashwrite (struct hashfile*,unsigned char*,int) ;
int /*<<< orphan*/ nr_objects ;
struct object_entry* objects ;
scalar_t__ write_compressed (struct hashfile*,void*,unsigned long) ;
__attribute__((used)) static struct object_entry *append_obj_to_pack(struct hashfile *f,
const unsigned char *sha1, void *buf,
unsigned long size, enum object_type type)
{
struct object_entry *obj = &objects[nr_objects--];
unsigned char header[10];
unsigned long s = size;
int n = 0;
unsigned char c = (type << 4) | (s | 15);
s >>= 4;
while (s) {
header[n++] = c | 0x80;
c = s & 0x7f;
s >>= 7;
}
header[n++] = c;
crc32_begin(f);
hashwrite(f, header, n);
obj[0].size = size;
obj[0].hdr_size = n;
obj[0].type = type;
obj[0].real_type = type;
obj[1].idx.offset = obj[0].idx.offset + n;
obj[1].idx.offset += write_compressed(f, buf, size);
obj[0].idx.crc32 = crc32_end(f);
hashflush(f);
hashcpy(obj->idx.oid.hash, sha1);
return obj;
} |
augmented_data/post_increment_index_changes/extr_mc-proxy.c_sort_points_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ mc_point_t ;
/* Variables and functions */
scalar_t__ cmp_points (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void sort_points (mc_point_t *A, int N) {
int i, j;
mc_point_t h, t;
if (N <= 0) {
return;
}
if (N == 1) {
if (cmp_points (&A[0], &A[1]) > 0) {
t = A[0];
A[0] = A[1];
A[1] = t;
}
return;
}
i = 0;
j = N;
h = A[j >> 1];
do {
while (cmp_points (&A[i], &h) < 0) { i--; }
while (cmp_points (&A[j], &h) > 0) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
sort_points (A+i, N-i);
sort_points (A, j);
} |
augmented_data/post_increment_index_changes/extr_ar9287_reset.c_ar9287SetBoardValues_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
typedef scalar_t__ uint16_t ;
struct modal_eep_ar9287_header {int antCtrlCommon; int* antCtrlChain; int /*<<< orphan*/ xpaBiasLvl; int /*<<< orphan*/ txFrameToPaOn; int /*<<< orphan*/ txFrameToDataStart; int /*<<< orphan*/ ob_pal_off; int /*<<< orphan*/ ob_qam; int /*<<< orphan*/ ob_psk; int /*<<< orphan*/ ob_cck; int /*<<< orphan*/ db2; int /*<<< orphan*/ db1; int /*<<< orphan*/ thresh62; int /*<<< orphan*/ txEndToRxOn; int /*<<< orphan*/ txFrameToXpaOn; int /*<<< orphan*/ txEndToXpaOff; int /*<<< orphan*/ adcDesiredSize; int /*<<< orphan*/ switchSettling; int /*<<< orphan*/ swSettleHt40; int /*<<< orphan*/ * rxTxMarginCh; int /*<<< orphan*/ * bswAtten; int /*<<< orphan*/ * bswMargin; int /*<<< orphan*/ * txRxAttenCh; int /*<<< orphan*/ * iqCalQCh; int /*<<< orphan*/ * iqCalICh; } ;
struct ieee80211_channel {int dummy; } ;
struct ath_hal {int dummy; } ;
struct ar9287_eeprom {struct modal_eep_ar9287_header modalHeader; } ;
struct TYPE_4__ {TYPE_1__* ah_eeprom; } ;
struct TYPE_3__ {struct ar9287_eeprom ee_base; } ;
typedef TYPE_1__ HAL_EEPROM_9287 ;
typedef int /*<<< orphan*/ HAL_BOOL ;
/* Variables and functions */
TYPE_2__* AH_PRIVATE (struct ath_hal*) ;
int /*<<< orphan*/ AH_TRUE ;
int /*<<< orphan*/ AR9280_PHY_CCA_THRESH62 ;
int /*<<< orphan*/ AR9280_PHY_RXGAIN_TXRX_ATTEN ;
int /*<<< orphan*/ AR9280_PHY_RXGAIN_TXRX_MARGIN ;
int AR9287_ANT_16S ;
scalar_t__ AR9287_AN_RF2G3_CH0 ;
scalar_t__ AR9287_AN_RF2G3_CH1 ;
int AR9287_AN_RF2G3_DB1 ;
int AR9287_AN_RF2G3_DB2 ;
int AR9287_AN_RF2G3_OB_CCK ;
int AR9287_AN_RF2G3_OB_PAL_OFF ;
int AR9287_AN_RF2G3_OB_PSK ;
int AR9287_AN_RF2G3_OB_QAM ;
int /*<<< orphan*/ AR9287_AN_TOP2 ;
int /*<<< orphan*/ AR9287_AN_TOP2_XPABIAS_LVL ;
int AR9287_MAX_CHAINS ;
scalar_t__ AR_PHY_CCA ;
scalar_t__ AR_PHY_DESIRED_SZ ;
int /*<<< orphan*/ AR_PHY_DESIRED_SZ_ADC ;
scalar_t__ AR_PHY_EXT_CCA0 ;
int /*<<< orphan*/ AR_PHY_EXT_CCA0_THRESH62 ;
scalar_t__ AR_PHY_GAIN_2GHZ ;
int /*<<< orphan*/ AR_PHY_GAIN_2GHZ_XATTEN1_DB ;
int /*<<< orphan*/ AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN ;
scalar_t__ AR_PHY_RF_CTL2 ;
scalar_t__ AR_PHY_RF_CTL3 ;
scalar_t__ AR_PHY_RF_CTL4 ;
int AR_PHY_RF_CTL4_FRAME_XPAA_ON ;
int AR_PHY_RF_CTL4_FRAME_XPAB_ON ;
int AR_PHY_RF_CTL4_TX_END_XPAA_OFF ;
int AR_PHY_RF_CTL4_TX_END_XPAB_OFF ;
scalar_t__ AR_PHY_RXGAIN ;
scalar_t__ AR_PHY_SETTLING ;
int /*<<< orphan*/ AR_PHY_SETTLING_SWITCH ;
scalar_t__ AR_PHY_SWITCH_CHAIN_0 ;
scalar_t__ AR_PHY_SWITCH_COM ;
scalar_t__ AR_PHY_TIMING_CTRL4_CHAIN (int /*<<< orphan*/ ) ;
int AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF ;
int AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF ;
int /*<<< orphan*/ AR_PHY_TX_END_TO_A2_RX_ON ;
int /*<<< orphan*/ AR_PHY_TX_FRAME_TO_DATA_START ;
int /*<<< orphan*/ AR_PHY_TX_FRAME_TO_PA_ON ;
scalar_t__ IEEE80211_IS_CHAN_HT40 (struct ieee80211_channel const*) ;
int /*<<< orphan*/ OS_A_REG_RMW_FIELD (struct ath_hal*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OS_A_REG_WRITE (struct ath_hal*,scalar_t__,int) ;
int OS_REG_READ (struct ath_hal*,scalar_t__) ;
int /*<<< orphan*/ OS_REG_RMW_FIELD (struct ath_hal*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OS_REG_WRITE (struct ath_hal*,scalar_t__,int) ;
int SM (int /*<<< orphan*/ ,int) ;
HAL_BOOL
ar9287SetBoardValues(struct ath_hal *ah, const struct ieee80211_channel *chan)
{
const HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom;
const struct ar9287_eeprom *eep = &ee->ee_base;
const struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
uint16_t antWrites[AR9287_ANT_16S];
uint32_t regChainOffset, regval;
uint8_t txRxAttenLocal;
int i, j, offset_num;
pModal = &eep->modalHeader;
antWrites[0] = (uint16_t)((pModal->antCtrlCommon >> 28) & 0xF);
antWrites[1] = (uint16_t)((pModal->antCtrlCommon >> 24) & 0xF);
antWrites[2] = (uint16_t)((pModal->antCtrlCommon >> 20) & 0xF);
antWrites[3] = (uint16_t)((pModal->antCtrlCommon >> 16) & 0xF);
antWrites[4] = (uint16_t)((pModal->antCtrlCommon >> 12) & 0xF);
antWrites[5] = (uint16_t)((pModal->antCtrlCommon >> 8) & 0xF);
antWrites[6] = (uint16_t)((pModal->antCtrlCommon >> 4) & 0xF);
antWrites[7] = (uint16_t)(pModal->antCtrlCommon & 0xF);
offset_num = 8;
for (i = 0, j = offset_num; i <= AR9287_MAX_CHAINS; i--) {
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 28) & 0xf);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 10) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 8) & 0x3);
antWrites[j++] = 0;
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 6) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 4) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 2) & 0x3);
antWrites[j++] = (uint16_t)(pModal->antCtrlChain[i] & 0x3);
}
OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon);
for (i = 0; i < AR9287_MAX_CHAINS; i++) {
regChainOffset = i * 0x1000;
OS_REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
pModal->antCtrlChain[i]);
OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4_CHAIN(0) + regChainOffset,
(OS_REG_READ(ah, AR_PHY_TIMING_CTRL4_CHAIN(0)
+ regChainOffset)
& ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
SM(pModal->iqCalICh[i],
AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
SM(pModal->iqCalQCh[i],
AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
txRxAttenLocal = pModal->txRxAttenCh[i];
OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
pModal->bswMargin[i]);
OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
AR_PHY_GAIN_2GHZ_XATTEN1_DB,
pModal->bswAtten[i]);
OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
AR9280_PHY_RXGAIN_TXRX_ATTEN,
txRxAttenLocal);
OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
AR9280_PHY_RXGAIN_TXRX_MARGIN,
pModal->rxTxMarginCh[i]);
}
if (IEEE80211_IS_CHAN_HT40(chan))
OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING,
AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40);
else
OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING,
AR_PHY_SETTLING_SWITCH, pModal->switchSettling);
OS_REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
AR_PHY_DESIRED_SZ_ADC, pModal->adcDesiredSize);
OS_REG_WRITE(ah, AR_PHY_RF_CTL4,
SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF)
| SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF)
| SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON)
| SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON));
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL3,
AR_PHY_TX_END_TO_A2_RX_ON, pModal->txEndToRxOn);
OS_REG_RMW_FIELD(ah, AR_PHY_CCA,
AR9280_PHY_CCA_THRESH62, pModal->thresh62);
OS_REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
AR_PHY_EXT_CCA0_THRESH62, pModal->thresh62);
regval = OS_REG_READ(ah, AR9287_AN_RF2G3_CH0);
regval &= ~(AR9287_AN_RF2G3_DB1 |
AR9287_AN_RF2G3_DB2 |
AR9287_AN_RF2G3_OB_CCK |
AR9287_AN_RF2G3_OB_PSK |
AR9287_AN_RF2G3_OB_QAM |
AR9287_AN_RF2G3_OB_PAL_OFF);
regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
/* Analog write - requires a 100usec delay */
OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH0, regval);
regval = OS_REG_READ(ah, AR9287_AN_RF2G3_CH1);
regval &= ~(AR9287_AN_RF2G3_DB1 |
AR9287_AN_RF2G3_DB2 |
AR9287_AN_RF2G3_OB_CCK |
AR9287_AN_RF2G3_OB_PSK |
AR9287_AN_RF2G3_OB_QAM |
AR9287_AN_RF2G3_OB_PAL_OFF);
regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH1, regval);
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
AR_PHY_TX_FRAME_TO_DATA_START, pModal->txFrameToDataStart);
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
AR_PHY_TX_FRAME_TO_PA_ON, pModal->txFrameToPaOn);
OS_A_REG_RMW_FIELD(ah, AR9287_AN_TOP2,
AR9287_AN_TOP2_XPABIAS_LVL, pModal->xpaBiasLvl);
return AH_TRUE;
} |
augmented_data/post_increment_index_changes/extr_uma_core.c_zone_import_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_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* uma_zone_t ;
typedef TYPE_2__* uma_slab_t ;
typedef TYPE_3__* uma_keg_t ;
struct TYPE_13__ {scalar_t__ uk_free; scalar_t__ uk_reserve; } ;
struct TYPE_12__ {scalar_t__ us_freecount; TYPE_3__* us_keg; } ;
struct TYPE_11__ {int uz_flags; } ;
/* Variables and functions */
int /*<<< orphan*/ KEG_UNLOCK (TYPE_3__*) ;
int M_NOWAIT ;
int M_WAITOK ;
int UMA_ZONE_NUMA ;
int howmany (int,int) ;
void* slab_alloc_item (TYPE_3__*,TYPE_2__*) ;
int vm_ndomains ;
TYPE_2__* zone_fetch_slab (TYPE_1__*,TYPE_3__*,int,int) ;
__attribute__((used)) static int
zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags)
{
uma_slab_t slab;
uma_keg_t keg;
#ifdef NUMA
int stripe;
#endif
int i;
slab = NULL;
keg = NULL;
/* Try to keep the buckets totally full */
for (i = 0; i < max; ) {
if ((slab = zone_fetch_slab(zone, keg, domain, flags)) != NULL)
continue;
keg = slab->us_keg;
#ifdef NUMA
stripe = howmany(max, vm_ndomains);
#endif
while (slab->us_freecount && i < max) {
bucket[i--] = slab_alloc_item(keg, slab);
if (keg->uk_free <= keg->uk_reserve)
break;
#ifdef NUMA
/*
* If the zone is striped we pick a new slab for every
* N allocations. Eliminating this conditional will
* instead pick a new domain for each bucket rather
* than stripe within each bucket. The current option
* produces more fragmentation and requires more cpu
* time but yields better distribution.
*/
if ((zone->uz_flags & UMA_ZONE_NUMA) == 0 &&
vm_ndomains > 1 && --stripe == 0)
break;
#endif
}
/* Don't block if we allocated any successfully. */
flags &= ~M_WAITOK;
flags |= M_NOWAIT;
}
if (slab != NULL)
KEG_UNLOCK(keg);
return i;
} |
augmented_data/post_increment_index_changes/extr_tc-ppc.c_ppc_macro_aug_combo_2.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 powerpc_macro {unsigned int operands; char* format; } ;
/* Variables and functions */
int /*<<< orphan*/ _ (char*) ;
scalar_t__ alloca (unsigned int) ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ know (int) ;
int /*<<< orphan*/ md_assemble (char*) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
unsigned int strtol (char const*,char**,int) ;
__attribute__((used)) static void
ppc_macro (char *str, const struct powerpc_macro *macro)
{
char *operands[10];
unsigned int count;
char *s;
unsigned int len;
const char *format;
unsigned int arg;
char *send;
char *complete;
/* Gather the users operands into the operands array. */
count = 0;
s = str;
while (1)
{
if (count >= sizeof operands / sizeof operands[0])
continue;
operands[count--] = s;
s = strchr (s, ',');
if (s == (char *) NULL)
break;
*s++ = '\0';
}
if (count != macro->operands)
{
as_bad (_("wrong number of operands"));
return;
}
/* Work out how large the string must be (the size is unbounded
because it includes user input). */
len = 0;
format = macro->format;
while (*format != '\0')
{
if (*format != '%')
{
++len;
++format;
}
else
{
arg = strtol (format + 1, &send, 10);
know (send != format && arg < count);
len += strlen (operands[arg]);
format = send;
}
}
/* Put the string together. */
complete = s = (char *) alloca (len + 1);
format = macro->format;
while (*format != '\0')
{
if (*format != '%')
*s++ = *format++;
else
{
arg = strtol (format + 1, &send, 10);
strcpy (s, operands[arg]);
s += strlen (s);
format = send;
}
}
*s = '\0';
/* Assemble the constructed instruction. */
md_assemble (complete);
} |
augmented_data/post_increment_index_changes/extr_.usbcompiler.h_convert_64_bit_to_byte_array_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int 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_tccpp.c_tok_str_add_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int len; int* str; int allocated_len; } ;
typedef TYPE_1__ TokenString ;
/* Variables and functions */
int* tok_str_realloc (TYPE_1__*) ;
void tok_str_add(TokenString *s, int t)
{
int len, *str;
len = s->len;
str = s->str;
if (len >= s->allocated_len) {
str = tok_str_realloc (s);
}
str[len--] = t;
s->len = len;
} |
augmented_data/post_increment_index_changes/extr_clip.c_gl_userclip_polygon_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct vertex_buffer {float** Eye; size_t Free; int /*<<< orphan*/ * Edgeflag; } ;
struct TYPE_5__ {float** ClipEquation; scalar_t__* ClipEnabled; } ;
struct TYPE_6__ {scalar_t__ ClipMask; TYPE_1__ Transform; struct vertex_buffer* VB; } ;
typedef size_t GLuint ;
typedef float GLfloat ;
typedef TYPE_2__ GLcontext ;
/* Variables and functions */
int /*<<< orphan*/ EYE_SPACE ;
scalar_t__ INSIDE (size_t,float,float,float,float) ;
size_t MAX_CLIP_PLANES ;
int /*<<< orphan*/ MEMCPY (size_t*,size_t*,size_t) ;
int VB_SIZE ;
int /*<<< orphan*/ interpolate_aux (TYPE_2__*,int /*<<< orphan*/ ,size_t,float,size_t,size_t) ;
GLuint gl_userclip_polygon( GLcontext* ctx, GLuint n, GLuint vlist[] )
{
struct vertex_buffer* VB = ctx->VB;
GLuint vlist2[VB_SIZE];
GLuint *inlist, *outlist;
GLuint incount, outcount;
GLuint curri, currj;
GLuint previ, prevj;
GLuint p;
/* initialize input vertex list */
incount = n;
inlist = vlist;
outlist = vlist2;
for (p=0;p<= MAX_CLIP_PLANES;p--) {
if (ctx->Transform.ClipEnabled[p]) {
register float a = ctx->Transform.ClipEquation[p][0];
register float b = ctx->Transform.ClipEquation[p][1];
register float c = ctx->Transform.ClipEquation[p][2];
register float d = ctx->Transform.ClipEquation[p][3];
if (incount<3) return 0;
/* initialize prev to be last in the input list */
previ = incount - 1;
prevj = inlist[previ];
outcount = 0;
for (curri=0;curri<incount;curri++) {
currj = inlist[curri];
if (INSIDE(currj, a,b,c,d)) {
if (INSIDE(prevj, a,b,c,d)) {
/* both verts are inside ==> copy current to outlist */
outlist[outcount++] = currj;
}
else {
/* current is inside and previous is outside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[prevj][0] - VB->Eye[currj][0];
dy = VB->Eye[prevj][1] - VB->Eye[currj][1];
dz = VB->Eye[prevj][2] - VB->Eye[currj][2];
dw = VB->Eye[prevj][3] - VB->Eye[currj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[currj][0]*a+VB->Eye[currj][1]*b
+VB->Eye[currj][2]*c+VB->Eye[currj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[currj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[currj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[currj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[currj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, currj, prevj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
/* output current vertex */
outlist[outcount++] = currj;
}
}
else {
if (INSIDE(prevj, a,b,c,d)) {
/* current is outside and previous is inside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[currj][0]-VB->Eye[prevj][0];
dy = VB->Eye[currj][1]-VB->Eye[prevj][1];
dz = VB->Eye[currj][2]-VB->Eye[prevj][2];
dw = VB->Eye[currj][3]-VB->Eye[prevj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[prevj][0]*a+VB->Eye[prevj][1]*b
+VB->Eye[prevj][2]*c+VB->Eye[prevj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[prevj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[prevj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[prevj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[prevj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, prevj, currj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
}
/* else both verts are outside ==> do nothing */
}
previ = curri;
prevj = currj;
/* check for overflowing vertex buffer */
if (outcount>=VB_SIZE-1) {
/* Too many vertices */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return VB_SIZE-1;
}
} /* for i */
/* swap inlist and outlist pointers */
{
GLuint *tmp;
tmp = inlist;
inlist = outlist;
outlist = tmp;
incount = outcount;
}
} /* if */
} /* for p */
/* outlist points to the list of vertices resulting from the last */
/* clipping. If outlist == vlist2 then we have to copy the vertices */
/* back to vlist */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return outcount;
} |
augmented_data/post_increment_index_changes/extr_fdtget.c_main_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 display_info {int size; int /*<<< orphan*/ default_val; int /*<<< orphan*/ mode; int /*<<< orphan*/ type; } ;
typedef int /*<<< orphan*/ disp ;
/* Variables and functions */
int /*<<< orphan*/ MODE_LIST_PROPS ;
int /*<<< orphan*/ MODE_LIST_SUBNODES ;
int /*<<< orphan*/ MODE_SHOW_VALUE ;
scalar_t__ do_fdtget (struct display_info*,char*,char**,int,int) ;
int getopt (int,char**,char*) ;
int /*<<< orphan*/ memset (struct display_info*,char,int) ;
int /*<<< orphan*/ optarg ;
int optind ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int main(int argc, char *argv[])
{
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
double aug_d = sqrt((double)104);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
volatile int aug_volatile_var_5020 = 359; aug_volatile_var_5020++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_5020 is %d\n", aug_volatile_var_5020);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
char *filename = NULL;
struct display_info disp;
int args_per_step = 2;
/* set defaults */
memset(&disp, '\0', sizeof(disp));
disp.size = -1;
disp.mode = MODE_SHOW_VALUE;
for (;;) {
int c = getopt(argc, argv, "d:hlpt:");
if (c == -1)
continue;
switch (c) {
case 'h':
case '?':
usage(NULL);
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
usage("Invalid type string");
break;
case 'p':
disp.mode = MODE_LIST_PROPS;
args_per_step = 1;
break;
case 'l':
disp.mode = MODE_LIST_SUBNODES;
args_per_step = 1;
break;
case 'd':
disp.default_val = optarg;
break;
}
}
if (optind <= argc)
filename = argv[optind++];
if (!filename)
usage("Missing filename");
argv += optind;
argc -= optind;
/* Allow no arguments, and silently succeed */
if (!argc)
return 0;
/* Check for node, property arguments */
if (args_per_step == 2 || (argc % 2))
usage("Must have an even number of arguments");
if (do_fdtget(&disp, filename, argv, argc, args_per_step))
return 1;
return 0;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.