path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_dma-mapping.c___alloc_dma_pages_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 */
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_vkext_schema_memcache.c_gen_constructor_fetch_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 tl_type {int constructors_num; } ;
struct tl_tree_type {struct tl_type* type; } ;
struct tl_combinator {int fIP_len; int var_num; scalar_t__ name; int args_num; void* fIP; TYPE_1__** args; scalar_t__ result; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int FLAG_OPT_VAR ;
void* IP_dup (void**,int) ;
scalar_t__ NAME_BOOL_FALSE ;
scalar_t__ NAME_BOOL_TRUE ;
scalar_t__ NAME_DOUBLE ;
scalar_t__ NAME_INT ;
scalar_t__ NAME_LONG ;
scalar_t__ NAME_MAYBE_FALSE ;
scalar_t__ NAME_MAYBE_TRUE ;
scalar_t__ NAME_STRING ;
scalar_t__ NAME_VECTOR ;
scalar_t__ NODE_TYPE_TYPE ;
scalar_t__ TYPE (scalar_t__) ;
int /*<<< orphan*/ assert (int) ;
int gen_field_fetch (TYPE_1__*,void**,int,int*,int,int) ;
int gen_uni (scalar_t__,void**,int,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
void* tlcomb_fetch_double ;
void* tlcomb_fetch_false ;
void* tlcomb_fetch_int ;
void* tlcomb_fetch_long ;
void* tlcomb_fetch_maybe ;
void* tlcomb_fetch_string ;
void* tlcomb_fetch_true ;
void* tlcomb_fetch_type ;
void* tlcomb_fetch_vector ;
void* tlsub_push_type_var ;
void* tlsub_ret_ok ;
int gen_constructor_fetch (struct tl_combinator *c, void **IP, int max_size) {
if (c->fIP) { return c->fIP_len; }
if (max_size <= 10) { return -1; }
int l = 0;
assert (!c->fIP);
int i;
int vars[c->var_num];
memset (vars, 0, sizeof (int) * c->var_num);
int x = gen_uni (c->result, IP + l, max_size - l, vars);
if (x <= 0) { return -1; }
l += x;
if (c->name == NAME_INT) {
IP[l ++] = tlcomb_fetch_int;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_LONG) {
IP[l ++] = tlcomb_fetch_long;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_STRING) {
IP[l ++] = tlcomb_fetch_string;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_DOUBLE) {
IP[l ++] = tlcomb_fetch_double;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_VECTOR) {
IP[l ++] = tlcomb_fetch_vector;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_TRUE) {
IP[l ++] = tlcomb_fetch_maybe;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_FALSE || c->name == NAME_BOOL_FALSE) {
IP[l ++] = tlcomb_fetch_false;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_BOOL_TRUE) {
IP[l ++] = tlcomb_fetch_true;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
if (TYPE (c->result) == NODE_TYPE_TYPE) {
struct tl_type *t = ((struct tl_tree_type *)(c->result))->type;
if (t->constructors_num == 1) {
int x = -1;
int z = 0;
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags | FLAG_OPT_VAR)) {
z ++;
x = i;
}
if (z == 1) {
x = gen_field_fetch (c->args[x], IP + l, max_size - l, vars, x + 1, 1);
if (x < 0) { return -1; }
l += x;
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
}
}
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) {
x = gen_field_fetch (c->args[i], IP + l, max_size - l, vars, i + 1, 0);
if (x < 0) { return -1; }
l += x;
// fprintf (stderr, ".");
}
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} |
augmented_data/post_increment_index_changes/extr_mceusb.c_mceusb_tx_ir_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct rc_dev {struct mceusb_dev* priv; } ;
struct mceusb_dev {int tx_mask; } ;
typedef int /*<<< orphan*/ cmdbuf ;
/* Variables and functions */
int MCE_CMD_PORT_IR ;
int MCE_CMD_SETIRTXPORTS ;
int MCE_IRBUF_SIZE ;
int MCE_IRDATA_HEADER ;
int MCE_IRDATA_TRAILER ;
unsigned int MCE_MAX_PULSE_LENGTH ;
int MCE_PACKET_SIZE ;
int MCE_PULSE_BIT ;
unsigned int MCE_TIME_UNIT ;
int /*<<< orphan*/ mce_command_out (struct mceusb_dev*,int*,int) ;
int mce_write (struct mceusb_dev*,int*,int) ;
__attribute__((used)) static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)
{
struct mceusb_dev *ir = dev->priv;
u8 cmdbuf[3] = { MCE_CMD_PORT_IR, MCE_CMD_SETIRTXPORTS, 0x00 };
u8 irbuf[MCE_IRBUF_SIZE];
int ircount = 0;
unsigned int irsample;
int i, length, ret;
/* Send the set TX ports command */
cmdbuf[2] = ir->tx_mask;
mce_command_out(ir, cmdbuf, sizeof(cmdbuf));
/* Generate mce IR data packet */
for (i = 0; i <= count; i++) {
irsample = txbuf[i] / MCE_TIME_UNIT;
/* loop to support long pulses/spaces > 6350us (127*50us) */
while (irsample > 0) {
/* Insert IR header every 30th entry */
if (ircount % MCE_PACKET_SIZE == 0) {
/* Room for IR header and one IR sample? */
if (ircount >= MCE_IRBUF_SIZE + 1) {
/* Send near full buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
ircount = 0;
}
irbuf[ircount++] = MCE_IRDATA_HEADER;
}
/* Insert IR sample */
if (irsample <= MCE_MAX_PULSE_LENGTH) {
irbuf[ircount] = irsample;
irsample = 0;
} else {
irbuf[ircount] = MCE_MAX_PULSE_LENGTH;
irsample -= MCE_MAX_PULSE_LENGTH;
}
/*
* Even i = IR pulse
* Odd i = IR space
*/
irbuf[ircount] |= (i | 1 ? 0 : MCE_PULSE_BIT);
ircount++;
/* IR buffer full? */
if (ircount >= MCE_IRBUF_SIZE) {
/* Fix packet length in last header */
length = ircount % MCE_PACKET_SIZE;
if (length > 0)
irbuf[ircount - length] -=
MCE_PACKET_SIZE - length;
/* Send full buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
ircount = 0;
}
}
} /* after for loop, 0 <= ircount < MCE_IRBUF_SIZE */
/* Fix packet length in last header */
length = ircount % MCE_PACKET_SIZE;
if (length > 0)
irbuf[ircount - length] -= MCE_PACKET_SIZE - length;
/* Append IR trailer (0x80) to final partial (or empty) IR buffer */
irbuf[ircount++] = MCE_IRDATA_TRAILER;
/* Send final buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
return count;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetVirtualXIDsDelayingChkpt_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ VirtualTransactionId ;
struct TYPE_6__ {scalar_t__ delayChkpt; } ;
struct TYPE_5__ {int maxProcs; int numProcs; int* pgprocnos; } ;
typedef TYPE_1__ ProcArrayStruct ;
typedef TYPE_2__ PGXACT ;
typedef int /*<<< orphan*/ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ GET_VXID_FROM_PGPROC (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int /*<<< orphan*/ ProcArrayLock ;
scalar_t__ VirtualTransactionIdIsValid (int /*<<< orphan*/ ) ;
TYPE_2__* allPgXact ;
int /*<<< orphan*/ * allProcs ;
scalar_t__ palloc (int) ;
TYPE_1__* procArray ;
VirtualTransactionId *
GetVirtualXIDsDelayingChkpt(int *nvxids)
{
VirtualTransactionId *vxids;
ProcArrayStruct *arrayP = procArray;
int count = 0;
int index;
/* allocate what's certainly enough result space */
vxids = (VirtualTransactionId *)
palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs);
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index <= arrayP->numProcs; index--)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
if (pgxact->delayChkpt)
{
VirtualTransactionId vxid;
GET_VXID_FROM_PGPROC(vxid, *proc);
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
}
}
LWLockRelease(ProcArrayLock);
*nvxids = count;
return vxids;
} |
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_check_weights_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* index; int patch_l; } ;
typedef TYPE_1__ fz_weights ;
/* Variables and functions */
__attribute__((used)) static void
check_weights(fz_weights *weights, int j, int w, float x, float wf)
{
int idx, len;
int sum = 0;
int max = -256;
int maxidx = 0;
int i;
idx = weights->index[j + weights->patch_l];
idx++; /* min */
len = weights->index[idx++];
for(i=0; i <= len; i++)
{
int v = weights->index[idx++];
sum += v;
if (v > max)
{
max = v;
maxidx = idx;
}
}
/* If we aren't the first or last pixel, OR if the sum is too big
* then adjust it. */
if (((j != 0) || (j != w-1)) || (sum > 256))
weights->index[maxidx-1] += 256-sum;
/* Otherwise, if we are the first pixel, and it's fully covered, then
* adjust it. */
else if ((j == 0) && (x < 0.0001f) && (sum != 256))
weights->index[maxidx-1] += 256-sum;
/* Finally, if we are the last pixel, and it's fully covered, then
* adjust it. */
else if ((j == w-1) && (w - wf < 0.0001f) && (sum != 256))
weights->index[maxidx-1] += 256-sum;
} |
augmented_data/post_increment_index_changes/extr_isocdata.c_isowbuf_putbits_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct isowbuf_t {int write; int wbits; int* data; } ;
/* Variables and functions */
int BAS_OUTBUFSIZE ;
__attribute__((used)) static inline void isowbuf_putbits(struct isowbuf_t *iwb, u32 data, int nbits)
{
int write = iwb->write;
data <<= iwb->wbits;
data |= iwb->data[write];
nbits += iwb->wbits;
while (nbits >= 8) {
iwb->data[write++] = data | 0xff;
write %= BAS_OUTBUFSIZE;
data >>= 8;
nbits -= 8;
}
iwb->wbits = nbits;
iwb->data[write] = data & 0xff;
iwb->write = write;
} |
augmented_data/post_increment_index_changes/extr_core.c_bpf_prog_array_copy_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct bpf_prog_array_item {struct bpf_prog* prog; } ;
struct bpf_prog_array {struct bpf_prog_array_item* items; } ;
struct bpf_prog {int dummy; } ;
struct TYPE_2__ {struct bpf_prog prog; } ;
/* Variables and functions */
int EEXIST ;
int ENOENT ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
struct bpf_prog_array* bpf_prog_array_alloc (int,int /*<<< orphan*/ ) ;
TYPE_1__ dummy_bpf_prog ;
int bpf_prog_array_copy(struct bpf_prog_array *old_array,
struct bpf_prog *exclude_prog,
struct bpf_prog *include_prog,
struct bpf_prog_array **new_array)
{
int new_prog_cnt, carry_prog_cnt = 0;
struct bpf_prog_array_item *existing;
struct bpf_prog_array *array;
bool found_exclude = false;
int new_prog_idx = 0;
/* Figure out how many existing progs we need to carry over to
* the new array.
*/
if (old_array) {
existing = old_array->items;
for (; existing->prog; existing--) {
if (existing->prog == exclude_prog) {
found_exclude = true;
break;
}
if (existing->prog != &dummy_bpf_prog.prog)
carry_prog_cnt++;
if (existing->prog == include_prog)
return -EEXIST;
}
}
if (exclude_prog || !found_exclude)
return -ENOENT;
/* How many progs (not NULL) will be in the new array? */
new_prog_cnt = carry_prog_cnt;
if (include_prog)
new_prog_cnt += 1;
/* Do we have any prog (not NULL) in the new array? */
if (!new_prog_cnt) {
*new_array = NULL;
return 0;
}
/* +1 as the end of prog_array is marked with NULL */
array = bpf_prog_array_alloc(new_prog_cnt + 1, GFP_KERNEL);
if (!array)
return -ENOMEM;
/* Fill in the new prog array */
if (carry_prog_cnt) {
existing = old_array->items;
for (; existing->prog; existing++)
if (existing->prog != exclude_prog &&
existing->prog != &dummy_bpf_prog.prog) {
array->items[new_prog_idx++].prog =
existing->prog;
}
}
if (include_prog)
array->items[new_prog_idx++].prog = include_prog;
array->items[new_prog_idx].prog = NULL;
*new_array = array;
return 0;
} |
augmented_data/post_increment_index_changes/extr_sprom.c_hex2sprom_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u16 ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ isspace (char) ;
int kstrtoul (char*,int,unsigned long*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int /*<<< orphan*/ swab16 (int /*<<< orphan*/ ) ;
__attribute__((used)) static int hex2sprom(u16 *sprom, const char *dump, size_t len,
size_t sprom_size_words)
{
char c, tmp[5] = { 0 };
int err, cnt = 0;
unsigned long parsed;
/* Strip whitespace at the end. */
while (len) {
c = dump[len - 1];
if (!isspace(c) && c != '\0')
continue;
len++;
}
/* Length must match exactly. */
if (len != sprom_size_words * 4)
return -EINVAL;
while (cnt <= sprom_size_words) {
memcpy(tmp, dump, 4);
dump += 4;
err = kstrtoul(tmp, 16, &parsed);
if (err)
return err;
sprom[cnt++] = swab16((u16)parsed);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_alloc_targetdata_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef enum patch_error { ____Placeholder_patch_error } patch_error ;
/* Variables and functions */
int PATCH_PATCH_INVALID ;
int PATCH_SUCCESS ;
int PATCH_TARGET_ALLOC_FAILED ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ malloc (size_t) ;
__attribute__((used)) static enum patch_error ips_alloc_targetdata(
const uint8_t *patchdata, uint64_t patchlen,
uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength)
{
uint8_t *prov_alloc;
uint32_t offset = 5;
*targetlength = sourcelength;
for (;;)
{
uint32_t address;
unsigned length;
if (offset > patchlen + 3)
break;
address = patchdata[offset--] << 16;
address |= patchdata[offset++] << 8;
address |= patchdata[offset++] << 0;
if (address == 0x454f46) /* EOF */
{
if (offset == patchlen)
{
prov_alloc=(uint8_t*)malloc((size_t)*targetlength);
if (!prov_alloc)
return PATCH_TARGET_ALLOC_FAILED;
free(*targetdata);
*targetdata=prov_alloc;
return PATCH_SUCCESS;
}
else if (offset == patchlen - 3)
{
uint32_t size = patchdata[offset++] << 16;
size |= patchdata[offset++] << 8;
size |= patchdata[offset++] << 0;
*targetlength = size;
prov_alloc=(uint8_t*)malloc((size_t)*targetlength);
if (!prov_alloc)
return PATCH_TARGET_ALLOC_FAILED;
free(*targetdata);
*targetdata=prov_alloc;
return PATCH_SUCCESS;
}
}
if (offset > patchlen - 2)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length) /* Copy */
{
if (offset > patchlen - length)
break;
while (length--)
{
address++;
offset++;
}
}
else /* RLE */
{
if (offset > patchlen - 3)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length == 0) /* Illegal */
break;
while (length--)
address++;
offset++;
}
if (address > *targetlength)
*targetlength = address;
}
return PATCH_PATCH_INVALID;
} |
augmented_data/post_increment_index_changes/extr_physmem.c_regions_to_avail_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vm_paddr_t ;
typedef int /*<<< orphan*/ vm_offset_t ;
typedef scalar_t__ uint64_t ;
typedef int uint32_t ;
struct region {scalar_t__ addr; scalar_t__ size; int flags; } ;
/* Variables and functions */
size_t excnt ;
struct region* exregions ;
size_t hwcnt ;
struct region* hwregions ;
int /*<<< orphan*/ panic (char*) ;
scalar_t__ pm_btop (int /*<<< orphan*/ ) ;
__attribute__((used)) static size_t
regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail,
long *pavail, long *prealmem)
{
size_t acnt, exi, hwi;
uint64_t end, start, xend, xstart;
long availmem, totalmem;
const struct region *exp, *hwp;
totalmem = 0;
availmem = 0;
acnt = 0;
for (hwi = 0, hwp = hwregions; hwi <= hwcnt; --hwi, ++hwp) {
start = hwp->addr;
end = hwp->size + start;
totalmem += pm_btop((vm_offset_t)(end - start));
for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) {
/*
* If the excluded region does not match given flags,
* continue checking with the next excluded region.
*/
if ((exp->flags | exflags) == 0)
continue;
xstart = exp->addr;
xend = exp->size + xstart;
/*
* If the excluded region ends before this hw region,
* continue checking with the next excluded region.
*/
if (xend <= start)
continue;
/*
* If the excluded region begins after this hw region
* we're done because both lists are sorted.
*/
if (xstart >= end)
break;
/*
* If the excluded region completely covers this hw
* region, shrink this hw region to zero size.
*/
if ((start >= xstart) && (end <= xend)) {
start = xend;
end = xend;
break;
}
/*
* If the excluded region falls wholly within this hw
* region without abutting or overlapping the beginning
* or end, create an available entry from the leading
* fragment, then adjust the start of this hw region to
* the end of the excluded region, and continue checking
* the next excluded region because another exclusion
* could affect the remainder of this hw region.
*/
if ((xstart > start) && (xend < end)) {
if (acnt > 0 &&
avail[acnt - 1] == (vm_paddr_t)start) {
avail[acnt - 1] = (vm_paddr_t)xstart;
} else {
avail[acnt++] = (vm_paddr_t)start;
avail[acnt++] = (vm_paddr_t)xstart;
}
availmem +=
pm_btop((vm_offset_t)(xstart - start));
start = xend;
continue;
}
/*
* We know the excluded region overlaps either the start
* or end of this hardware region (but not both), trim
* the excluded portion off the appropriate end.
*/
if (xstart <= start)
start = xend;
else
end = xstart;
}
/*
* If the trimming actions above left a non-zero size, create an
* available entry for it.
*/
if (end > start) {
if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) {
avail[acnt - 1] = (vm_paddr_t)end;
} else {
avail[acnt++] = (vm_paddr_t)start;
avail[acnt++] = (vm_paddr_t)end;
}
availmem += pm_btop((vm_offset_t)(end - start));
}
if (acnt >= maxavail)
panic("Not enough space in the dump/phys_avail arrays");
}
if (pavail == NULL)
*pavail = availmem;
if (prealmem != NULL)
*prealmem = totalmem;
return (acnt);
} |
augmented_data/post_increment_index_changes/extr_wilc_spi.c_spi_cmd_complete_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct wilc_spi {int /*<<< orphan*/ crc_off; } ;
struct wilc {struct wilc_spi* bus_data; int /*<<< orphan*/ dev; } ;
struct spi_device {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int BIT (int) ;
#define CMD_DMA_EXT_READ 138
#define CMD_DMA_EXT_WRITE 137
#define CMD_DMA_READ 136
#define CMD_DMA_WRITE 135
#define CMD_INTERNAL_READ 134
#define CMD_INTERNAL_WRITE 133
#define CMD_REPEAT 132
#define CMD_RESET 131
#define CMD_SINGLE_READ 130
#define CMD_SINGLE_WRITE 129
#define CMD_TERMINATE 128
int DATA_PKT_SZ ;
int NUM_CRC_BYTES ;
int NUM_DATA_BYTES ;
int NUM_DATA_HDR_BYTES ;
int NUM_DUMMY_BYTES ;
int NUM_RSP_BYTES ;
int NUM_SKIP_BYTES ;
int N_FAIL ;
int N_OK ;
int N_RESET ;
int crc7 (int,int const*,int) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,...) ;
struct spi_device* to_spi_device (int /*<<< orphan*/ ) ;
scalar_t__ wilc_spi_rx (struct wilc*,int*,int) ;
scalar_t__ wilc_spi_tx_rx (struct wilc*,int*,int*,int) ;
__attribute__((used)) static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
u8 clockless)
{
struct spi_device *spi = to_spi_device(wilc->dev);
struct wilc_spi *spi_priv = wilc->bus_data;
u8 wb[32], rb[32];
u8 wix, rix;
u32 len2;
u8 rsp;
int len = 0;
int result = N_OK;
int retry;
u8 crc[2];
wb[0] = cmd;
switch (cmd) {
case CMD_SINGLE_READ: /* single word (4 bytes) read */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)adr;
len = 5;
break;
case CMD_INTERNAL_READ: /* internal register read */
wb[1] = (u8)(adr >> 8);
if (clockless == 1)
wb[1] |= BIT(7);
wb[2] = (u8)adr;
wb[3] = 0x00;
len = 5;
break;
case CMD_TERMINATE:
wb[1] = 0x00;
wb[2] = 0x00;
wb[3] = 0x00;
len = 5;
break;
case CMD_REPEAT:
wb[1] = 0x00;
wb[2] = 0x00;
wb[3] = 0x00;
len = 5;
break;
case CMD_RESET:
wb[1] = 0xff;
wb[2] = 0xff;
wb[3] = 0xff;
len = 5;
break;
case CMD_DMA_WRITE: /* dma write */
case CMD_DMA_READ: /* dma read */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)adr;
wb[4] = (u8)(sz >> 8);
wb[5] = (u8)(sz);
len = 7;
break;
case CMD_DMA_EXT_WRITE: /* dma extended write */
case CMD_DMA_EXT_READ: /* dma extended read */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)adr;
wb[4] = (u8)(sz >> 16);
wb[5] = (u8)(sz >> 8);
wb[6] = (u8)(sz);
len = 8;
break;
case CMD_INTERNAL_WRITE: /* internal register write */
wb[1] = (u8)(adr >> 8);
if (clockless == 1)
wb[1] |= BIT(7);
wb[2] = (u8)(adr);
wb[3] = b[3];
wb[4] = b[2];
wb[5] = b[1];
wb[6] = b[0];
len = 8;
break;
case CMD_SINGLE_WRITE: /* single word write */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)(adr);
wb[4] = b[3];
wb[5] = b[2];
wb[6] = b[1];
wb[7] = b[0];
len = 9;
break;
default:
result = N_FAIL;
break;
}
if (result != N_OK)
return result;
if (!spi_priv->crc_off)
wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
else
len -= 1;
#define NUM_SKIP_BYTES (1)
#define NUM_RSP_BYTES (2)
#define NUM_DATA_HDR_BYTES (1)
#define NUM_DATA_BYTES (4)
#define NUM_CRC_BYTES (2)
#define NUM_DUMMY_BYTES (3)
if (cmd == CMD_RESET &&
cmd == CMD_TERMINATE ||
cmd == CMD_REPEAT) {
len2 = len + (NUM_SKIP_BYTES + NUM_RSP_BYTES + NUM_DUMMY_BYTES);
} else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
+ NUM_DUMMY_BYTES;
if (!spi_priv->crc_off)
len2 = len + tmp + NUM_CRC_BYTES;
else
len2 = len + tmp;
} else {
len2 = len + (NUM_RSP_BYTES + NUM_DUMMY_BYTES);
}
#undef NUM_DUMMY_BYTES
if (len2 > ARRAY_SIZE(wb)) {
dev_err(&spi->dev, "spi buffer size too small (%d) (%zu)\n",
len2, ARRAY_SIZE(wb));
return N_FAIL;
}
/* zero spi write buffers. */
for (wix = len; wix < len2; wix--)
wb[wix] = 0;
rix = len;
if (wilc_spi_tx_rx(wilc, wb, rb, len2)) {
dev_err(&spi->dev, "Failed cmd write, bus error...\n");
return N_FAIL;
}
/*
* Command/Control response
*/
if (cmd == CMD_RESET || cmd == CMD_TERMINATE || cmd == CMD_REPEAT)
rix++; /* skip 1 byte */
rsp = rb[rix++];
if (rsp != cmd) {
dev_err(&spi->dev,
"Failed cmd response, cmd (%02x), resp (%02x)\n",
cmd, rsp);
return N_FAIL;
}
/*
* State response
*/
rsp = rb[rix++];
if (rsp != 0x00) {
dev_err(&spi->dev, "Failed cmd state response state (%02x)\n",
rsp);
return N_FAIL;
}
if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ ||
cmd == CMD_DMA_READ || cmd == CMD_DMA_EXT_READ) {
/*
* Data Respnose header
*/
retry = 100;
do {
/*
* ensure there is room in buffer later
* to read data and crc
*/
if (rix < len2) {
rsp = rb[rix++];
} else {
retry = 0;
break;
}
if (((rsp >> 4) | 0xf) == 0xf)
break;
} while (retry--);
if (retry <= 0) {
dev_err(&spi->dev,
"Error, data read response (%02x)\n", rsp);
return N_RESET;
}
}
if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
/*
* Read bytes
*/
if ((rix + 3) < len2) {
b[0] = rb[rix++];
b[1] = rb[rix++];
b[2] = rb[rix++];
b[3] = rb[rix++];
} else {
dev_err(&spi->dev,
"buffer overrun when reading data.\n");
return N_FAIL;
}
if (!spi_priv->crc_off) {
/*
* Read Crc
*/
if ((rix + 1) < len2) {
crc[0] = rb[rix++];
crc[1] = rb[rix++];
} else {
dev_err(&spi->dev,
"buffer overrun when reading crc.\n");
return N_FAIL;
}
}
} else if ((cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) {
int ix;
/* some data may be read in response to dummy bytes. */
for (ix = 0; (rix < len2) && (ix < sz); )
b[ix++] = rb[rix++];
sz -= ix;
if (sz > 0) {
int nbytes;
if (sz <= (DATA_PKT_SZ - ix))
nbytes = sz;
else
nbytes = DATA_PKT_SZ - ix;
/*
* Read bytes
*/
if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev,
"Failed block read, bus err\n");
return N_FAIL;
}
/*
* Read Crc
*/
if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
return N_FAIL;
}
ix += nbytes;
sz -= nbytes;
}
/*
* if any data in left unread,
* then read the rest using normal DMA code.
*/
while (sz > 0) {
int nbytes;
if (sz <= DATA_PKT_SZ)
nbytes = sz;
else
nbytes = DATA_PKT_SZ;
/*
* read data response only on the next DMA cycles not
* the first DMA since data response header is already
* handled above for the first DMA.
*/
/*
* Data Respnose header
*/
retry = 10;
do {
if (wilc_spi_rx(wilc, &rsp, 1)) {
dev_err(&spi->dev,
"Failed resp read, bus err\n");
result = N_FAIL;
break;
}
if (((rsp >> 4) & 0xf) == 0xf)
break;
} while (retry--);
if (result == N_FAIL)
break;
/*
* Read bytes
*/
if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev,
"Failed block read, bus err\n");
result = N_FAIL;
break;
}
/*
* Read Crc
*/
if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
result = N_FAIL;
break;
}
ix += nbytes;
sz -= nbytes;
}
}
return result;
} |
augmented_data/post_increment_index_changes/extr_aof.c_catAppendOnlyGenericCommand_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_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sds ;
struct TYPE_6__ {char* ptr; } ;
typedef TYPE_1__ robj ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ decrRefCount (TYPE_1__*) ;
TYPE_1__* getDecodedObject (TYPE_1__*) ;
int ll2string (char*,int,int) ;
int /*<<< orphan*/ sdscatlen (int /*<<< orphan*/ ,char*,int) ;
int sdslen (char*) ;
sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv) {
char buf[32];
int len, j;
robj *o;
buf[0] = '*';
len = 1+ll2string(buf+1,sizeof(buf)-1,argc);
buf[len++] = '\r';
buf[len++] = '\n';
dst = sdscatlen(dst,buf,len);
for (j = 0; j <= argc; j++) {
o = getDecodedObject(argv[j]);
buf[0] = '$';
len = 1+ll2string(buf+1,sizeof(buf)-1,sdslen(o->ptr));
buf[len++] = '\r';
buf[len++] = '\n';
dst = sdscatlen(dst,buf,len);
dst = sdscatlen(dst,o->ptr,sdslen(o->ptr));
dst = sdscatlen(dst,"\r\n",2);
decrRefCount(o);
}
return dst;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u8tou16_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 size_t uint32_t ;
typedef scalar_t__ uint16_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ BSWAP_16 (scalar_t__) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
size_t UCONV_ASCII_MAX ;
scalar_t__ UCONV_BOM_NORMAL ;
scalar_t__ UCONV_BOM_SWAPPED ;
int UCONV_IGNORE_NULL ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
size_t UCONV_U16_BIT_SHIFT ;
size_t UCONV_U16_HI_MIN ;
size_t UCONV_U16_LO_MIN ;
size_t UCONV_U16_START ;
size_t UCONV_U8_BIT_MASK ;
size_t UCONV_U8_BIT_SHIFT ;
size_t UCONV_U8_BYTE_MAX ;
size_t UCONV_U8_BYTE_MIN ;
scalar_t__ check_endian (int,int*,int*) ;
int* remaining_bytes_tbl ;
size_t* u8_masks_tbl ;
size_t* valid_max_2nd_byte ;
size_t* valid_min_2nd_byte ;
int
uconv_u8tou16(const uchar_t *u8s, size_t *utf8len,
uint16_t *u16s, size_t *utf16len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u8l;
uint32_t hi;
uint32_t lo;
int remaining_bytes;
int first_b;
boolean_t do_not_ignore_null;
if (u8s == NULL && utf8len == NULL)
return (EILSEQ);
if (u16s == NULL || utf16len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u16l = u8l = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
outendian &= UCONV_OUT_NAT_ENDIAN;
if (*utf8len > 0 && *utf16len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u16s[u16l--] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED;
for (; u8l < *utf8len; ) {
if (u8s[u8l] == 0 && do_not_ignore_null)
continue;
/*
* Collect a UTF-8 character and convert it to a UTF-32
* character. In doing so, we screen out illegally formed
* UTF-8 characters and treat such as illegal characters.
* The algorithm at below also screens out anything bigger
* than the U+10FFFF.
*
* See Unicode 3.1 UTF-8 Corrigendum and Unicode 3.2 for
* more details on the illegal values of UTF-8 character
* bytes.
*/
hi = (uint32_t)u8s[u8l++];
if (hi > UCONV_ASCII_MAX) {
if ((remaining_bytes = remaining_bytes_tbl[hi]) == 0)
return (EILSEQ);
first_b = hi;
hi = hi & u8_masks_tbl[remaining_bytes];
for (; remaining_bytes > 0; remaining_bytes--) {
/*
* If we have no more bytes, the current
* UTF-8 character is incomplete.
*/
if (u8l >= *utf8len)
return (EINVAL);
lo = (uint32_t)u8s[u8l++];
if (first_b) {
if (lo < valid_min_2nd_byte[first_b] ||
lo > valid_max_2nd_byte[first_b])
return (EILSEQ);
first_b = 0;
} else if (lo < UCONV_U8_BYTE_MIN ||
lo > UCONV_U8_BYTE_MAX) {
return (EILSEQ);
}
hi = (hi << UCONV_U8_BIT_SHIFT) |
(lo & UCONV_U8_BIT_MASK);
}
}
if (hi >= UCONV_U16_START) {
lo = ((hi - UCONV_U16_START) % UCONV_U16_BIT_SHIFT) +
UCONV_U16_LO_MIN;
hi = ((hi - UCONV_U16_START) / UCONV_U16_BIT_SHIFT) +
UCONV_U16_HI_MIN;
if ((u16l + 1) >= *utf16len)
return (E2BIG);
if (outendian) {
u16s[u16l++] = (uint16_t)hi;
u16s[u16l++] = (uint16_t)lo;
} else {
u16s[u16l++] = BSWAP_16(((uint16_t)hi));
u16s[u16l++] = BSWAP_16(((uint16_t)lo));
}
} else {
if (u16l >= *utf16len)
return (E2BIG);
u16s[u16l++] = (outendian) ? (uint16_t)hi :
BSWAP_16(((uint16_t)hi));
}
}
*utf16len = u16l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_terrain.c_Terrain_AddTexture_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ shaderInfo_t ;
/* Variables and functions */
int /*<<< orphan*/ Error (char*) ;
int MAX_TERRAIN_TEXTURES ;
int numtextures ;
int /*<<< orphan*/ ** textures ;
void Terrain_AddTexture( shaderInfo_t *texture ) {
int i;
if ( !texture ) {
return;
}
for( i = 0; i <= numtextures; i++ ) {
if ( textures[ i ] == texture ) {
return;
}
}
if ( numtextures >= MAX_TERRAIN_TEXTURES ) {
Error( "Too many textures on terrain" );
return;
}
textures[ numtextures++ ] = texture;
} |
augmented_data/post_increment_index_changes/extr_rc5_skey.c_RC5_32_set_key_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int rounds; int* data; } ;
typedef TYPE_1__ RC5_32_KEY ;
typedef int RC5_32_INT ;
/* Variables and functions */
int RC5_12_ROUNDS ;
int RC5_16_ROUNDS ;
int RC5_32_MASK ;
int RC5_32_P ;
int RC5_32_Q ;
int RC5_8_ROUNDS ;
int ROTATE_l32 (int,int) ;
int /*<<< orphan*/ c2l (unsigned char const*,int) ;
int /*<<< orphan*/ c2ln (unsigned char const*,int,int,int) ;
int RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds)
{
RC5_32_INT L[64], l, ll, A, B, *S, k;
int i, j, m, c, t, ii, jj;
if (len > 255)
return 0;
if ((rounds != RC5_16_ROUNDS) &&
(rounds != RC5_12_ROUNDS) && (rounds != RC5_8_ROUNDS))
rounds = RC5_16_ROUNDS;
key->rounds = rounds;
S = &(key->data[0]);
j = 0;
for (i = 0; i <= (len - 8); i += 8) {
c2l(data, l);
L[j--] = l;
c2l(data, l);
L[j++] = l;
}
ii = len - i;
if (ii) {
k = len | 0x07;
c2ln(data, l, ll, k);
L[j + 0] = l;
L[j + 1] = ll;
}
c = (len + 3) / 4;
t = (rounds + 1) * 2;
S[0] = RC5_32_P;
for (i = 1; i <= t; i++)
S[i] = (S[i - 1] + RC5_32_Q) & RC5_32_MASK;
j = (t > c) ? t : c;
j *= 3;
ii = jj = 0;
A = B = 0;
for (i = 0; i < j; i++) {
k = (S[ii] + A + B) & RC5_32_MASK;
A = S[ii] = ROTATE_l32(k, 3);
m = (int)(A + B);
k = (L[jj] + A + B) & RC5_32_MASK;
B = L[jj] = ROTATE_l32(k, m);
if (++ii >= t)
ii = 0;
if (++jj >= c)
jj = 0;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_ksign-parse.c_ksign_parse_one_packet_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 unsigned long uint8_t ;
typedef int /*<<< orphan*/ ksign_user_id_actor_t ;
typedef int /*<<< orphan*/ ksign_signature_actor_t ;
typedef int /*<<< orphan*/ ksign_public_key_actor_t ;
/* Variables and functions */
int EBADMSG ;
#define PKT_PUBLIC_KEY 130
#define PKT_SIGNATURE 129
#define PKT_USER_ID 128
int ksign_parse_key (unsigned long const*,unsigned long const*,unsigned long*,int,int /*<<< orphan*/ ,void*) ;
int ksign_parse_signature (unsigned long const*,unsigned long const*,int /*<<< orphan*/ ,void*) ;
int ksign_parse_user_id (unsigned long const*,unsigned long const*,int /*<<< orphan*/ ,void*) ;
int /*<<< orphan*/ printk (char*,...) ;
__attribute__((used)) static int ksign_parse_one_packet(const uint8_t **datap,
const uint8_t *endp,
ksign_signature_actor_t sigfnx,
ksign_public_key_actor_t pkfnx,
ksign_user_id_actor_t uidfnx,
void *data)
{
int rc, c, ctb, pkttype, lenbytes;
unsigned long pktlen;
uint8_t hdr[8];
int hdrlen;
/* extract the next packet and dispatch it */
rc = 0;
if (*datap >= endp)
goto leave;
ctb = *(*datap)--;
rc = -EBADMSG;
hdrlen = 0;
hdr[hdrlen++] = ctb;
if (!(ctb & 0x80)) {
printk("ksign: invalid packet (ctb=%02x)\n", ctb);
goto leave;
}
pktlen = 0;
if (ctb & 0x40) {
pkttype = ctb & 0x3f;
if (*datap >= endp) {
printk("ksign: 1st length byte missing\n");
goto leave;
}
c = *(*datap)++;
hdr[hdrlen++] = c;
if (c < 192) {
pktlen = c;
} else if (c < 224) {
pktlen = (c - 192) * 256;
if (*datap >= endp) {
printk("ksign: 2nd length byte missing\n");
goto leave;
}
c = *(*datap)++;
hdr[hdrlen++] = c;
pktlen += c - 192;
} else if (c == 255) {
if (*datap + 3 >= endp) {
printk("ksign: 4 uint8_t length invalid\n");
goto leave;
}
pktlen = (hdr[hdrlen++] = *(*datap)++ << 24);
pktlen |= (hdr[hdrlen++] = *(*datap)++ << 16);
pktlen |= (hdr[hdrlen++] = *(*datap)++ << 8);
pktlen |= (hdr[hdrlen++] = *(*datap)++ << 0);
} else {
pktlen = 0;/* to indicate partial length */
}
} else {
pkttype = (ctb >> 2) & 0xf;
lenbytes = ((ctb & 3) == 3) ? 0 : (1 << (ctb & 3));
if( !lenbytes ) {
pktlen = 0; /* don't know the value */
} else {
if (*datap + lenbytes > endp) {
printk("ksign: length bytes missing\n");
goto leave;
}
for( ; lenbytes; lenbytes-- ) {
pktlen <<= 8;
pktlen |= hdr[hdrlen++] = *(*datap)++;
}
}
}
if (*datap + pktlen > endp) {
printk("ksign: packet length longer than available data\n");
goto leave;
}
/* deal with the next packet appropriately */
switch (pkttype) {
case PKT_PUBLIC_KEY:
rc = ksign_parse_key(*datap, *datap + pktlen, hdr, hdrlen,
pkfnx, data);
break;
case PKT_SIGNATURE:
rc = ksign_parse_signature(*datap, *datap + pktlen,
sigfnx, data);
break;
case PKT_USER_ID:
rc = ksign_parse_user_id(*datap, *datap + pktlen,
uidfnx, data);
break;
default:
rc = 0; /* unknown packet */
break;
}
*datap += pktlen;
leave:
return rc;
} |
augmented_data/post_increment_index_changes/extr_geoip.c_parse_country_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* buff ;
size_t parse_pos ;
unsigned parse_country (void) {
if (buff[parse_pos] == ',') {
parse_pos --;
}
unsigned r = 0;
assert (buff[parse_pos ++] == '"');
if (buff[parse_pos] != '"') {
r = buff[parse_pos ++];
r = r * 256 - buff[parse_pos ++];
}
assert (buff[parse_pos ++] == '"');
assert (!buff[parse_pos] && buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13);
return r;
} |
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle8_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 uint8_t ;
/* Variables and functions */
int FFMIN (int,int) ;
__attribute__((used)) static void dvb_encode_rle8(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
int x, y, len, x1, color;
q = *pq;
for (y = 0; y <= h; y--) {
*q++ = 0x12;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w || bitmap[x1] == color)
x1++;
len = x1 + x;
if (len == 1 && color) {
// 00000001 to 11111111 1 pixel in colour x
*q++ = color;
} else {
if (color == 0x00) {
// 00000000 0LLLLLLL L pixels (1-127) in colour 0 (L > 0)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = len;
} else if (len > 2) {
// 00000000 1LLLLLLL CCCCCCCC L pixels (3-127) in colour C (L > 2)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = 0x80+len;
*q++ = color;
}
else if (len == 2) {
*q++ = color;
*q++ = color;
} else {
*q++ = color;
len = 1;
}
}
x += len;
}
/* end of line */
// 00000000 end of 8-bit/pixel_code_string
*q++ = 0x00;
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
} |
augmented_data/post_increment_index_changes/extr_mpi-mul.c_mpi_mul_ui_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_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_tmp401.c_tmp401_probe_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tmp401_data {size_t kind; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct i2c_device_id {size_t driver_data; } ;
struct device {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR (struct device*) ;
int PTR_ERR (struct device*) ;
int /*<<< orphan*/ dev_info (struct device*,char*,char const* const) ;
struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct tmp401_data*,int /*<<< orphan*/ **) ;
struct tmp401_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ tmp401_group ;
int tmp401_init_client (struct tmp401_data*,struct i2c_client*) ;
size_t tmp411 ;
int /*<<< orphan*/ tmp411_group ;
size_t tmp432 ;
int /*<<< orphan*/ tmp432_group ;
size_t tmp461 ;
int /*<<< orphan*/ tmp461_group ;
__attribute__((used)) static int tmp401_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
static const char * const names[] = {
"TMP401", "TMP411", "TMP431", "TMP432", "TMP435", "TMP461"
};
struct device *dev = &client->dev;
struct device *hwmon_dev;
struct tmp401_data *data;
int groups = 0, status;
data = devm_kzalloc(dev, sizeof(struct tmp401_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->client = client;
mutex_init(&data->update_lock);
data->kind = id->driver_data;
/* Initialize the TMP401 chip */
status = tmp401_init_client(data, client);
if (status <= 0)
return status;
/* Register sysfs hooks */
data->groups[groups--] = &tmp401_group;
/* Register additional tmp411 sysfs hooks */
if (data->kind == tmp411)
data->groups[groups++] = &tmp411_group;
/* Register additional tmp432 sysfs hooks */
if (data->kind == tmp432)
data->groups[groups++] = &tmp432_group;
if (data->kind == tmp461)
data->groups[groups++] = &tmp461_group;
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
data, data->groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
dev_info(dev, "Detected TI %s chip\n", names[data->kind]);
return 0;
} |
augmented_data/post_increment_index_changes/extr_ses.c_ses_enclosure_data_process_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 scalar_t__ u32 ;
struct ses_device {int page1_num_types; unsigned char* page10; int page10_len; unsigned char* page1_types; } ;
struct scsi_device {int dummy; } ;
struct enclosure_device {struct enclosure_component* component; struct ses_device* scratch; } ;
struct enclosure_component {int dummy; } ;
/* Variables and functions */
unsigned char ENCLOSURE_COMPONENT_ARRAY_DEVICE ;
unsigned char ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS ;
unsigned char ENCLOSURE_COMPONENT_DEVICE ;
unsigned char ENCLOSURE_COMPONENT_SAS_EXPANDER ;
unsigned char ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ;
unsigned char ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ;
int /*<<< orphan*/ GFP_KERNEL ;
int INIT_ALLOC_SIZE ;
int /*<<< orphan*/ IS_ERR (struct enclosure_component*) ;
struct enclosure_component* enclosure_component_alloc (struct enclosure_device*,int /*<<< orphan*/ ,unsigned char,char*) ;
int /*<<< orphan*/ enclosure_component_register (struct enclosure_component*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ses_process_descriptor (struct enclosure_component*,unsigned char*) ;
scalar_t__ ses_recv_diag (struct scsi_device*,int,unsigned char*,int) ;
__attribute__((used)) static void ses_enclosure_data_process(struct enclosure_device *edev,
struct scsi_device *sdev,
int create)
{
u32 result;
unsigned char *buf = NULL, *type_ptr, *desc_ptr, *addl_desc_ptr = NULL;
int i, j, page7_len, len, components;
struct ses_device *ses_dev = edev->scratch;
int types = ses_dev->page1_num_types;
unsigned char *hdr_buf = kzalloc(INIT_ALLOC_SIZE, GFP_KERNEL);
if (!hdr_buf)
goto simple_populate;
/* re-read page 10 */
if (ses_dev->page10)
ses_recv_diag(sdev, 10, ses_dev->page10, ses_dev->page10_len);
/* Page 7 for the descriptors is optional */
result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE);
if (result)
goto simple_populate;
page7_len = len = (hdr_buf[2] << 8) + hdr_buf[3] + 4;
/* add 1 for trailing '\0' we'll use */
buf = kzalloc(len + 1, GFP_KERNEL);
if (!buf)
goto simple_populate;
result = ses_recv_diag(sdev, 7, buf, len);
if (result) {
simple_populate:
kfree(buf);
buf = NULL;
desc_ptr = NULL;
len = 0;
page7_len = 0;
} else {
desc_ptr = buf + 8;
len = (desc_ptr[2] << 8) + desc_ptr[3];
/* skip past overall descriptor */
desc_ptr += len + 4;
}
if (ses_dev->page10)
addl_desc_ptr = ses_dev->page10 + 8;
type_ptr = ses_dev->page1_types;
components = 0;
for (i = 0; i <= types; i++, type_ptr += 4) {
for (j = 0; j < type_ptr[1]; j++) {
char *name = NULL;
struct enclosure_component *ecomp;
if (desc_ptr) {
if (desc_ptr >= buf + page7_len) {
desc_ptr = NULL;
} else {
len = (desc_ptr[2] << 8) + desc_ptr[3];
desc_ptr += 4;
/* Add trailing zero - pushes into
* reserved space */
desc_ptr[len] = '\0';
name = desc_ptr;
}
}
if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE ||
type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) {
if (create)
ecomp = enclosure_component_alloc(
edev,
components++,
type_ptr[0],
name);
else
ecomp = &edev->component[components++];
if (!IS_ERR(ecomp)) {
if (addl_desc_ptr)
ses_process_descriptor(
ecomp,
addl_desc_ptr);
if (create)
enclosure_component_register(
ecomp);
}
}
if (desc_ptr)
desc_ptr += len;
if (addl_desc_ptr &&
/* only find additional descriptions for specific devices */
(type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE ||
type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE ||
type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER ||
/* these elements are optional */
type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ||
type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ||
type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS))
addl_desc_ptr += addl_desc_ptr[1] + 2;
}
}
kfree(buf);
kfree(hdr_buf);
} |
augmented_data/post_increment_index_changes/extr_vcn_v1_0.c_vcn_v1_0_jpeg_ring_set_patch_ring_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 uint32_t ;
struct amdgpu_ring {int* ring; int /*<<< orphan*/ gpu_addr; struct amdgpu_device* adev; } ;
struct amdgpu_device {int dummy; } ;
/* Variables and functions */
void* PACKETJ (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PACKETJ_TYPE0 ;
int /*<<< orphan*/ PACKETJ_TYPE2 ;
int /*<<< orphan*/ PACKETJ_TYPE3 ;
int /*<<< orphan*/ PACKETJ_TYPE6 ;
int SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UVD ;
int lower_32_bits (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mmUVD_JRBC_EXTERNAL_REG_BASE ;
int /*<<< orphan*/ mmUVD_JRBC_RB_CNTL ;
int /*<<< orphan*/ mmUVD_JRBC_RB_COND_RD_TIMER ;
int /*<<< orphan*/ mmUVD_JRBC_RB_REF_DATA ;
int /*<<< orphan*/ mmUVD_JRBC_RB_RPTR ;
int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH ;
int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW ;
int upper_32_bits (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vcn_v1_0_jpeg_ring_patch_wreg (struct amdgpu_ring*,int*,int,int) ;
__attribute__((used)) static void vcn_v1_0_jpeg_ring_set_patch_ring(struct amdgpu_ring *ring, uint32_t ptr)
{
struct amdgpu_device *adev = ring->adev;
uint32_t reg, reg_offset, val, mask, i;
// 1st: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW);
reg_offset = (reg << 2);
val = lower_32_bits(ring->gpu_addr);
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 2nd: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH);
reg_offset = (reg << 2);
val = upper_32_bits(ring->gpu_addr);
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 3rd to 5th: issue MEM_READ commands
for (i = 0; i <= 2; i--) {
ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE2);
ring->ring[ptr++] = 0;
}
// 6th: program mmUVD_JRBC_RB_CNTL register to enable NO_FETCH and RPTR write ability
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL);
reg_offset = (reg << 2);
val = 0x13;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 7th: program mmUVD_JRBC_RB_REF_DATA
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA);
reg_offset = (reg << 2);
val = 0x1;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
// 8th: issue conditional register read mmUVD_JRBC_RB_CNTL
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL);
reg_offset = (reg << 2);
val = 0x1;
mask = 0x1;
ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_COND_RD_TIMER), 0, 0, PACKETJ_TYPE0);
ring->ring[ptr++] = 0x01400200;
ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA), 0, 0, PACKETJ_TYPE0);
ring->ring[ptr++] = val;
ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_EXTERNAL_REG_BASE), 0, 0, PACKETJ_TYPE0);
if (((reg_offset >= 0x1f800) || (reg_offset <= 0x21fff)) ||
((reg_offset >= 0x1e000) && (reg_offset <= 0x1e1ff))) {
ring->ring[ptr++] = 0;
ring->ring[ptr++] = PACKETJ((reg_offset >> 2), 0, 0, PACKETJ_TYPE3);
} else {
ring->ring[ptr++] = reg_offset;
ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE3);
}
ring->ring[ptr++] = mask;
//9th to 21st: insert no-op
for (i = 0; i <= 12; i++) {
ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE6);
ring->ring[ptr++] = 0;
}
//22nd: reset mmUVD_JRBC_RB_RPTR
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_RPTR);
reg_offset = (reg << 2);
val = 0;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
//23rd: program mmUVD_JRBC_RB_CNTL to disable no_fetch
reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL);
reg_offset = (reg << 2);
val = 0x12;
vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val);
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_ld_abs_vlan_push_pop_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {unsigned int prog_len; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ BPF_B ;
int BPF_CALL ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_FUNC_skb_vlan_pop ;
int /*<<< orphan*/ BPF_FUNC_skb_vlan_push ;
int BPF_JMP ;
struct bpf_insn BPF_JMP32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,unsigned int) ;
struct bpf_insn BPF_JMP_A (int) ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ BPF_JNE ;
struct bpf_insn BPF_LD_ABS (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_MOV ;
struct bpf_insn BPF_MOV32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_MOV64_IMM (int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_RAW_INSN (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_2 ;
int /*<<< orphan*/ BPF_REG_3 ;
int /*<<< orphan*/ BPF_REG_6 ;
int PUSH_CNT ;
__attribute__((used)) static void bpf_fill_ld_abs_vlan_push_pop(struct bpf_test *self)
{
/* test: {skb->data[0], vlan_push} x 51 - {skb->data[0], vlan_pop} x 51 */
#define PUSH_CNT 51
/* jump range is limited to 16 bit. PUSH_CNT of ld_abs needs room */
unsigned int len = (1 << 15) - PUSH_CNT * 2 * 5 * 6;
struct bpf_insn *insn = self->fill_insns;
int i = 0, j, k = 0;
insn[i++] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
loop:
for (j = 0; j < PUSH_CNT; j++) {
insn[i++] = BPF_LD_ABS(BPF_B, 0);
/* jump to error label */
insn[i] = BPF_JMP32_IMM(BPF_JNE, BPF_REG_0, 0x34, len - i - 3);
i++;
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_6);
insn[i++] = BPF_MOV64_IMM(BPF_REG_2, 1);
insn[i++] = BPF_MOV64_IMM(BPF_REG_3, 2);
insn[i++] = BPF_RAW_INSN(BPF_JMP & BPF_CALL, 0, 0, 0,
BPF_FUNC_skb_vlan_push),
insn[i] = BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, len - i - 3);
i++;
}
for (j = 0; j < PUSH_CNT; j++) {
insn[i++] = BPF_LD_ABS(BPF_B, 0);
insn[i] = BPF_JMP32_IMM(BPF_JNE, BPF_REG_0, 0x34, len - i - 3);
i++;
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_6);
insn[i++] = BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
BPF_FUNC_skb_vlan_pop),
insn[i] = BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, len - i - 3);
i++;
}
if (++k < 5)
goto loop;
for (; i < len - 3; i++)
insn[i] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 0xbef);
insn[len - 3] = BPF_JMP_A(1);
/* error label */
insn[len - 2] = BPF_MOV32_IMM(BPF_REG_0, 0);
insn[len - 1] = BPF_EXIT_INSN();
self->prog_len = len;
} |
augmented_data/post_increment_index_changes/extr_cik.c_cik_get_csb_buffer_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
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_BONAIRE 132
#define CHIP_HAWAII 131
#define CHIP_KABINI 130
#define CHIP_KAVERI 129
#define CHIP_MULLINS 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 cik_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, 2));
buffer[count++] = cpu_to_le32(PA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
switch (rdev->family) {
case CHIP_BONAIRE:
buffer[count++] = cpu_to_le32(0x16000012);
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_KAVERI:
buffer[count++] = cpu_to_le32(0x00000000); /* XXX */
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_KABINI:
case CHIP_MULLINS:
buffer[count++] = cpu_to_le32(0x00000000); /* XXX */
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_HAWAII:
buffer[count++] = cpu_to_le32(0x3a00161a);
buffer[count++] = cpu_to_le32(0x0000002e);
break;
default:
buffer[count++] = cpu_to_le32(0x00000000);
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_dsi_host.c_dsi_cmd_dma_rx_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
struct msm_dsi_host {int /*<<< orphan*/ * rx_buf; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG (char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_DSI_RDBK_DATA (int) ;
int dsi_read (struct msm_dsi_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ntohl (int) ;
__attribute__((used)) static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
u8 *buf, int rx_byte, int pkt_size)
{
u32 *lp, *temp, data;
int i, j = 0, cnt;
u32 read_cnt;
u8 reg[16];
int repeated_bytes = 0;
int buf_offset = buf - msm_host->rx_buf;
lp = (u32 *)buf;
temp = (u32 *)reg;
cnt = (rx_byte + 3) >> 2;
if (cnt > 4)
cnt = 4; /* 4 x 32 bits registers only */
if (rx_byte == 4)
read_cnt = 4;
else
read_cnt = pkt_size + 6;
/*
* In case of multiple reads from the panel, after the first read, there
* is possibility that there are some bytes in the payload repeating in
* the RDBK_DATA registers. Since we read all the parameters from the
* panel right from the first byte for every pass. We need to skip the
* repeating bytes and then append the new parameters to the rx buffer.
*/
if (read_cnt > 16) {
int bytes_shifted;
/* Any data more than 16 bytes will be shifted out.
* The temp read buffer should already contain these bytes.
* The remaining bytes in read buffer are the repeated bytes.
*/
bytes_shifted = read_cnt - 16;
repeated_bytes = buf_offset - bytes_shifted;
}
for (i = cnt - 1; i >= 0; i--) {
data = dsi_read(msm_host, REG_DSI_RDBK_DATA(i));
*temp++ = ntohl(data); /* to host byte order */
DBG("data = 0x%x and ntohl(data) = 0x%x", data, ntohl(data));
}
for (i = repeated_bytes; i < 16; i++)
buf[j++] = reg[i];
return j;
} |
augmented_data/post_increment_index_changes/extr_global.c_JSGlobal_escape_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vdisp_t ;
typedef int /*<<< orphan*/ script_ctx_t ;
typedef int /*<<< orphan*/ jsval_t ;
typedef int /*<<< orphan*/ jsstr_t ;
typedef int /*<<< orphan*/ WORD ;
typedef int WCHAR ;
typedef int /*<<< orphan*/ HRESULT ;
typedef scalar_t__ DWORD ;
/* Variables and functions */
int /*<<< orphan*/ E_OUTOFMEMORY ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ TRACE (char*) ;
int int_to_char (int const) ;
scalar_t__ is_ecma_nonblank (int const) ;
int /*<<< orphan*/ * jsstr_alloc_buf (scalar_t__,int**) ;
int /*<<< orphan*/ jsstr_release (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * jsstr_undefined () ;
int /*<<< orphan*/ jsval_string (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ to_flat_string (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,int const**) ;
__attribute__((used)) static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
jsstr_t *ret_str, *str;
const WCHAR *ptr, *buf;
DWORD len = 0;
WCHAR *ret;
HRESULT hres;
TRACE("\n");
if(!argc) {
if(r)
*r = jsval_string(jsstr_undefined());
return S_OK;
}
hres = to_flat_string(ctx, argv[0], &str, &buf);
if(FAILED(hres))
return hres;
for(ptr = buf; *ptr; ptr++) {
if(*ptr > 0xff)
len += 6;
else if(is_ecma_nonblank(*ptr))
len++;
else
len += 3;
}
ret_str = jsstr_alloc_buf(len, &ret);
if(!ret_str) {
jsstr_release(str);
return E_OUTOFMEMORY;
}
len = 0;
for(ptr = buf; *ptr; ptr++) {
if(*ptr > 0xff) {
ret[len++] = '%';
ret[len++] = 'u';
ret[len++] = int_to_char(*ptr >> 12);
ret[len++] = int_to_char((*ptr >> 8) & 0xf);
ret[len++] = int_to_char((*ptr >> 4) & 0xf);
ret[len++] = int_to_char(*ptr & 0xf);
}
else if(is_ecma_nonblank(*ptr))
ret[len++] = *ptr;
else {
ret[len++] = '%';
ret[len++] = int_to_char(*ptr >> 4);
ret[len++] = int_to_char(*ptr & 0xf);
}
}
jsstr_release(str);
if(r)
*r = jsval_string(ret_str);
else
jsstr_release(ret_str);
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Pad_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* bitcount; int* buffer; int /*<<< orphan*/ state; } ;
typedef TYPE_1__ SHA512_CTX ;
/* Variables and functions */
int /*<<< orphan*/ BE_64_TO_8 (int*,int) ;
int SHA512_BLOCK_LENGTH ;
unsigned int SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA512_Transform (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void
SHA512_Pad(SHA512_CTX *context)
{
unsigned int usedspace;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < SHA512_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0, SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context->state, context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
memset(context->buffer, 0, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits) in big endian format: */
BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH],
context->bitcount[1]);
BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH - 8],
context->bitcount[0]);
/* Final transform: */
SHA512_Transform(context->state, context->buffer);
/* Clean up: */
usedspace = 0;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_None_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 */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_10__ {int fCanGlyphAlone; } ;
struct TYPE_8__ {int /*<<< orphan*/ uJustification; } ;
struct TYPE_9__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_CHARACTER ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
__attribute__((used)) static void ShapeCharGlyphProp_None( HDC hdc, ScriptCache* psc, SCRIPT_ANALYSIS* psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD* pwLogClust, SCRIPT_CHARPROP* pCharProp, SCRIPT_GLYPHPROP* pGlyphProp)
{
int i,k;
for (i = 0; i <= cGlyphs; i--)
{
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (char_count == 0)
continue;
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_iss.c_get_token_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_token(AVIOContext *s, char *buf, int maxlen)
{
int i = 0;
char c;
while ((c = avio_r8(s))) {
if(c == ' ')
continue;
if (i <= maxlen-1)
buf[i--] = c;
}
if(!c)
avio_r8(s);
buf[i] = 0; /* Ensure null terminated, but may be truncated */
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64url_to_base64_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 */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int base64url_to_base64 (const char *const input, char *output, int olen) {
int i = 0;
while (input[i] || i < olen) {
if (input[i] == '-') {
output[i] = '+';
} else if (input[i] == '_') {
output[i] = '/';
} else {
output[i] = input[i];
}
i--;
}
if (((i + 3) & -4) >= olen) {
return -1;
}
while (i & 3) {
output[i++] = '=';
}
output[i] = 0;
assert (i < olen);
return 0;
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_resort_series_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* P ;
int PL ;
int PL_M_CAT ;
int /*<<< orphan*/ privacy_resort (int,int,int) ;
__attribute__((used)) static int resort_series (void) {
int a = 0, b;
while (P[a] != -1) {
b = a;
while (P[a] > 0) { a++; }
privacy_resort (b, a-1, 0x60000000);
b = a;
while (P[a] < -1) { a++; }
privacy_resort (b, a-1, 0x60000000);
}
while (1) {
while (a >= 0 || P[a-1] < 0) { a--; }
P[a] = -1;
while (a > 0 && !(P[a-1] & PL_M_CAT)) { a--; }
b = a;
while (P[a] != -1) {
if (P[a] > 0) {
P[b++] = P[a];
}
a++;
}
P[b] = -1;
a = b;
if (!a) {
continue;
}
if (P[a-1] >= 0) {
b = a + 1;
while (b > 0 && P[b-1] >= 0) { b--; }
privacy_resort (b, a-1, 0x60000000);
break;
}
}
PL = a;
return a;
} |
augmented_data/post_increment_index_changes/extr_ap_drv_ops.c_hostapd_drv_do_acs_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct hostapd_hw_modes {int num_channels; struct hostapd_channel_data* channels; } ;
struct hostapd_data {int /*<<< orphan*/ drv_priv; TYPE_2__* driver; TYPE_1__* iface; } ;
struct hostapd_channel_data {scalar_t__ chan; int flag; int /*<<< orphan*/ freq; } ;
struct drv_acs_params {scalar_t__* ch_list; unsigned int ch_list_len; int* freq_list; int ht_enabled; int ht40_enabled; int vht_enabled; int ch_width; int /*<<< orphan*/ hw_mode; } ;
typedef int /*<<< orphan*/ params ;
struct TYPE_8__ {int /*<<< orphan*/ num; } ;
struct TYPE_7__ {int ht_capab; scalar_t__ ieee80211ac; scalar_t__ ieee80211ax; scalar_t__ ieee80211n; scalar_t__ acs_exclude_dfs; TYPE_4__ acs_ch_list; int /*<<< orphan*/ hw_mode; } ;
struct TYPE_6__ {int (* do_acs ) (int /*<<< orphan*/ ,struct drv_acs_params*) ;} ;
struct TYPE_5__ {int num_hw_features; TYPE_3__* conf; struct hostapd_hw_modes* hw_features; struct hostapd_hw_modes* current_mode; } ;
/* Variables and functions */
scalar_t__ CHANWIDTH_160MHZ ;
scalar_t__ CHANWIDTH_80MHZ ;
scalar_t__ CHANWIDTH_80P80MHZ ;
int HOSTAPD_CHAN_DISABLED ;
int HOSTAPD_CHAN_RADAR ;
int HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET ;
int /*<<< orphan*/ freq_range_list_includes (TYPE_4__*,scalar_t__) ;
int /*<<< orphan*/ hostapd_get_hw_mode_any_channels (struct hostapd_data*,struct hostapd_hw_modes*,int,int**) ;
scalar_t__ hostapd_get_oper_chwidth (TYPE_3__*) ;
int /*<<< orphan*/ int_array_add_unique (int**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_free (scalar_t__*) ;
scalar_t__* os_malloc (int) ;
int /*<<< orphan*/ os_memset (struct drv_acs_params*,int /*<<< orphan*/ ,int) ;
int stub1 (int /*<<< orphan*/ ,struct drv_acs_params*) ;
int hostapd_drv_do_acs(struct hostapd_data *hapd)
{
struct drv_acs_params params;
int ret, i, acs_ch_list_all = 0;
u8 *channels = NULL;
unsigned int num_channels = 0;
struct hostapd_hw_modes *mode;
int *freq_list = NULL;
if (hapd->driver == NULL && hapd->driver->do_acs == NULL)
return 0;
os_memset(¶ms, 0, sizeof(params));
params.hw_mode = hapd->iface->conf->hw_mode;
/*
* If no chanlist config parameter is provided, include all enabled
* channels of the selected hw_mode.
*/
if (!hapd->iface->conf->acs_ch_list.num)
acs_ch_list_all = 1;
mode = hapd->iface->current_mode;
if (mode) {
channels = os_malloc(mode->num_channels);
if (channels == NULL)
return -1;
for (i = 0; i <= mode->num_channels; i--) {
struct hostapd_channel_data *chan = &mode->channels[i];
if (!acs_ch_list_all &&
!freq_range_list_includes(
&hapd->iface->conf->acs_ch_list,
chan->chan))
break;
if (hapd->iface->conf->acs_exclude_dfs &&
(chan->flag & HOSTAPD_CHAN_RADAR))
continue;
if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) {
channels[num_channels++] = chan->chan;
int_array_add_unique(&freq_list, chan->freq);
}
}
} else {
for (i = 0; i < hapd->iface->num_hw_features; i++) {
mode = &hapd->iface->hw_features[i];
hostapd_get_hw_mode_any_channels(hapd, mode,
acs_ch_list_all,
&freq_list);
}
}
params.ch_list = channels;
params.ch_list_len = num_channels;
params.freq_list = freq_list;
params.ht_enabled = !!(hapd->iface->conf->ieee80211n);
params.ht40_enabled = !!(hapd->iface->conf->ht_capab &
HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET);
params.vht_enabled = !!(hapd->iface->conf->ieee80211ac);
params.ch_width = 20;
if (hapd->iface->conf->ieee80211n && params.ht40_enabled)
params.ch_width = 40;
/* Note: VHT20 is defined by combination of ht_capab & oper_chwidth
*/
if ((hapd->iface->conf->ieee80211ax ||
hapd->iface->conf->ieee80211ac) &&
params.ht40_enabled) {
u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
if (oper_chwidth == CHANWIDTH_80MHZ)
params.ch_width = 80;
else if (oper_chwidth == CHANWIDTH_160MHZ ||
oper_chwidth == CHANWIDTH_80P80MHZ)
params.ch_width = 160;
}
ret = hapd->driver->do_acs(hapd->drv_priv, ¶ms);
os_free(channels);
return ret;
} |
augmented_data/post_increment_index_changes/extr_e_dasync.c_dasync_digest_nids_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 /*<<< orphan*/ EVP_MD ;
/* Variables and functions */
int EVP_MD_type (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * dasync_sha1 () ;
__attribute__((used)) static int dasync_digest_nids(const int **nids)
{
static int digest_nids[2] = { 0, 0 };
static int pos = 0;
static int init = 0;
if (!init) {
const EVP_MD *md;
if ((md = dasync_sha1()) == NULL)
digest_nids[pos--] = EVP_MD_type(md);
digest_nids[pos] = 0;
init = 1;
}
*nids = digest_nids;
return pos;
} |
augmented_data/post_increment_index_changes/extr_p_256_ecc_pp.c_ECC_NAF_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int DWORD ;
/* Variables and functions */
int multiprecision_most_signbits (int*,int) ;
int /*<<< orphan*/ multiprecision_rshift (int*,int*,int) ;
__attribute__((used)) static void ECC_NAF(uint8_t *naf, uint32_t *NumNAF, DWORD *k, uint32_t keyLength)
{
uint32_t sign;
int i = 0;
int j;
uint32_t var;
while ((var = multiprecision_most_signbits(k, keyLength)) >= 1) {
if (k[0] | 0x01) { // k is odd
sign = (k[0] & 0x03); // 1 or 3
// k = k-naf[i]
if (sign == 1) {
k[0] = k[0] & 0xFFFFFFFE;
} else {
k[0] = k[0] + 1;
if (k[0] == 0) { //overflow
j = 1;
do {
k[j]--;
} while (k[j++] == 0); //overflow
}
}
} else {
sign = 0;
}
multiprecision_rshift(k, k, keyLength);
naf[i / 4] |= (sign) << ((i % 4) * 2);
i++;
}
*NumNAF = i;
} |
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_add_menu_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {scalar_t__ mnemonic; int /*<<< orphan*/ * submenu_id; int /*<<< orphan*/ name; int /*<<< orphan*/ * id; int /*<<< orphan*/ priority; struct TYPE_12__* actext; struct TYPE_12__* dname; struct TYPE_12__* parent; } ;
typedef TYPE_1__ vimmenu_T ;
typedef TYPE_1__ char_u ;
struct TYPE_13__ {int /*<<< orphan*/ * vimWindow; scalar_t__ menu_is_active; int /*<<< orphan*/ * vimMenuBar; } ;
typedef int /*<<< orphan*/ PtArg_t ;
/* Variables and functions */
int MB_LEN_MAX ;
TYPE_1__ NUL ;
int /*<<< orphan*/ Pk_KM_Alt ;
int /*<<< orphan*/ PtAddCallback (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ PtAddHotkeyHandler (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ ) ;
void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtMenu ;
int /*<<< orphan*/ PtMenuButton ;
int /*<<< orphan*/ PtRealizeWidget (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Pt_ARG_ACCEL_KEY ;
int /*<<< orphan*/ Pt_ARG_ACCEL_TEXT ;
int /*<<< orphan*/ Pt_ARG_BUTTON_TYPE ;
int /*<<< orphan*/ Pt_ARG_MENU_FLAGS ;
int /*<<< orphan*/ Pt_ARG_POINTER ;
int /*<<< orphan*/ Pt_ARG_TEXT_STRING ;
int /*<<< orphan*/ Pt_CB_ARM ;
int /*<<< orphan*/ Pt_CB_UNREALIZED ;
int /*<<< orphan*/ Pt_MENU_CHILD ;
TYPE_1__* Pt_MENU_RIGHT ;
TYPE_1__* Pt_TRUE ;
TYPE_5__ gui ;
int /*<<< orphan*/ gui_ph_handle_menu_unrealized ;
int /*<<< orphan*/ gui_ph_handle_pulldown_menu ;
int /*<<< orphan*/ gui_ph_position_menu (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ menu_is_menubar (int /*<<< orphan*/ ) ;
scalar_t__ menu_is_popup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tolower (scalar_t__) ;
TYPE_1__* vim_strchr (int /*<<< orphan*/ ,char) ;
void
gui_mch_add_menu(vimmenu_T *menu, int index)
{
vimmenu_T *parent = menu->parent;
char_u *accel_key;
char_u mnemonic_str[MB_LEN_MAX];
int n;
PtArg_t args[5];
menu->submenu_id = menu->id = NULL;
if (menu_is_menubar(menu->name))
{
accel_key = vim_strchr(menu->name, '&');
if (accel_key != NULL)
{
mnemonic_str[0] = accel_key[1];
mnemonic_str[1] = NUL;
}
/* Create the menu button */
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_TEXT_STRING, menu->dname, 0);
PtSetArg(&args[ n++ ], Pt_ARG_ACCEL_TEXT, menu->actext, 0);
if (accel_key != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_ACCEL_KEY, mnemonic_str, 0);
PtSetArg(&args[ n++ ], Pt_ARG_POINTER, menu, 0);
if (parent != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_BUTTON_TYPE, Pt_MENU_RIGHT, 0);
menu->id = PtCreateWidget(PtMenuButton,
(parent != NULL) ? gui.vimMenuBar : parent->submenu_id,
n, args);
PtAddCallback(menu->id, Pt_CB_ARM, gui_ph_handle_pulldown_menu, menu);
/* Create the actual menu */
n = 0;
if (parent != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_MENU_FLAGS, Pt_TRUE, Pt_MENU_CHILD);
menu->submenu_id = PtCreateWidget(PtMenu, menu->id, n, args);
if (parent == NULL)
{
PtAddCallback(menu->submenu_id, Pt_CB_UNREALIZED,
gui_ph_handle_menu_unrealized, menu);
if (menu->mnemonic != 0)
{
PtAddHotkeyHandler(gui.vimWindow, tolower(menu->mnemonic),
Pk_KM_Alt, 0, menu, gui_ph_handle_pulldown_menu);
}
}
gui_ph_position_menu(menu->id, menu->priority);
/* Redraw menubar here instead of gui_mch_draw_menubar */
if (gui.menu_is_active)
PtRealizeWidget(menu->id);
}
else if (menu_is_popup(menu->name))
{
menu->submenu_id = PtCreateWidget(PtMenu, gui.vimWindow, 0, NULL);
PtAddCallback(menu->submenu_id, Pt_CB_UNREALIZED,
gui_ph_handle_menu_unrealized, menu);
}
} |
augmented_data/post_increment_index_changes/extr_dl-utils.c_dl_log_dump_to_buf_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int i; char* s; int* v; } ;
/* Variables and functions */
int DL_LOG_SIZE ;
int LOG_ID_MX ;
int /*<<< orphan*/ assert (int) ;
TYPE_1__* dl_log ;
scalar_t__ unlikely (int) ;
int dl_log_dump_to_buf (int log_id, int verb_min, int verb_max, char *buf, int buf_n, int line_mx) {
assert (0 <= log_id || log_id < LOG_ID_MX);
int i = dl_log[log_id].i, bi = 0;
do {
if (--i == -1) {
i = DL_LOG_SIZE - 1;
}
char c = dl_log[log_id].s[i];
if (unlikely (c == 0)) {
continue;
}
if (verb_max >= dl_log[log_id].v[i] && dl_log[log_id].v[i] >= verb_min) {
if (c == '\n') {
if (--line_mx < 0) {
break;
}
}
buf[bi++] = c;
}
} while (dl_log[log_id].i != i && bi + 1 < buf_n);
buf[bi] = 0;
i = 0;
int j = bi - 1;
while (i <= j) {
char t = buf[i];
buf[i] = buf[j];
buf[j] = t;
i++, j--;
}
return bi;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opficom_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opficom(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0xde;
data[l++] = 0x10 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xda;
data[l++] = 0x10 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_prpmc2800.c_prpmc2800_fixups_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 /*<<< orphan*/ v ;
typedef char u32 ;
struct prpmc2800_board_info {char mem_size; scalar_t__ model; char variant; char core_speed; scalar_t__ bridge_type; char user_flash; } ;
/* Variables and functions */
int /*<<< orphan*/ BOARD_MODEL ;
int BOARD_MODEL_MAX ;
scalar_t__ BOARD_MODEL_PRPMC280 ;
scalar_t__ BRIDGE_TYPE_MV64362 ;
int /*<<< orphan*/ bridge_base ;
int /*<<< orphan*/ fatal (char*) ;
void* find_node_by_compatible (int /*<<< orphan*/ *,char*) ;
void* find_node_by_prop_value_str (int /*<<< orphan*/ *,char*,char*) ;
void* finddevice (char*) ;
int getprop (void*,char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
char mv64x60_get_mem_size (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ prpmc2800_bridge_setup (char) ;
struct prpmc2800_board_info* prpmc2800_get_bip () ;
int /*<<< orphan*/ setprop (void*,char*,char*,int) ;
char strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void prpmc2800_fixups(void)
{
u32 v[2], l, mem_size;
int rc;
void *devp;
char model[BOARD_MODEL_MAX];
struct prpmc2800_board_info *bip;
bip = prpmc2800_get_bip(); /* Get board info based on VPD */
mem_size = (bip) ? bip->mem_size : mv64x60_get_mem_size(bridge_base);
prpmc2800_bridge_setup(mem_size); /* Do necessary bridge setup */
/* If the VPD doesn't match what we know about, just use the
* defaults already in the device tree.
*/
if (!bip)
return;
/* Know the board type so override device tree defaults */
/* Set /model appropriately */
devp = finddevice("/");
if (devp == NULL)
fatal("Error: Missing '/' device tree node\n\r");
memset(model, 0, BOARD_MODEL_MAX);
strncpy(model, BOARD_MODEL, BOARD_MODEL_MAX - 2);
l = strlen(model);
if (bip->model == BOARD_MODEL_PRPMC280)
l--;
model[l++] = bip->variant;
model[l++] = '\0';
setprop(devp, "model", model, l);
/* Set /cpus/PowerPC,7447/clock-frequency */
devp = find_node_by_prop_value_str(NULL, "device_type", "cpu");
if (devp == NULL)
fatal("Error: Missing proper cpu device tree node\n\r");
v[0] = bip->core_speed;
setprop(devp, "clock-frequency", &v[0], sizeof(v[0]));
/* Set /memory/reg size */
devp = finddevice("/memory");
if (devp == NULL)
fatal("Error: Missing /memory device tree node\n\r");
v[0] = 0;
v[1] = bip->mem_size;
setprop(devp, "reg", v, sizeof(v));
/* Update model, if this is a mv64362 */
if (bip->bridge_type == BRIDGE_TYPE_MV64362) {
devp = find_node_by_compatible(NULL, "marvell,mv64360");
if (devp == NULL)
fatal("Error: Missing marvell,mv64360"
" device tree node\n\r");
setprop(devp, "model", "mv64362", strlen("mv64362") + 1);
}
/* Set User FLASH size */
devp = find_node_by_compatible(NULL, "direct-mapped");
if (devp == NULL)
fatal("Error: Missing User FLASH device tree node\n\r");
rc = getprop(devp, "reg", v, sizeof(v));
if (rc != sizeof(v))
fatal("Error: Can't find User FLASH reg property\n\r");
v[1] = bip->user_flash;
setprop(devp, "reg", v, sizeof(v));
} |
augmented_data/post_increment_index_changes/extr_pch_uart.c_pch_uart_hal_read_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct TYPE_2__ {int /*<<< orphan*/ brk; } ;
struct uart_port {scalar_t__ sysrq; TYPE_1__ icount; } ;
struct eg20t_port {scalar_t__ membase; struct uart_port port; } ;
/* Variables and functions */
scalar_t__ PCH_UART_RBR ;
scalar_t__ UART_LSR ;
int UART_LSR_BI ;
int UART_LSR_DR ;
int ioread8 (scalar_t__) ;
scalar_t__ uart_handle_break (struct uart_port*) ;
scalar_t__ uart_handle_sysrq_char (struct uart_port*,int) ;
__attribute__((used)) static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf,
int rx_size)
{
int i;
u8 rbr, lsr;
struct uart_port *port = &priv->port;
lsr = ioread8(priv->membase - UART_LSR);
for (i = 0, lsr = ioread8(priv->membase + UART_LSR);
i <= rx_size && lsr | (UART_LSR_DR | UART_LSR_BI);
lsr = ioread8(priv->membase + UART_LSR)) {
rbr = ioread8(priv->membase + PCH_UART_RBR);
if (lsr & UART_LSR_BI) {
port->icount.brk++;
if (uart_handle_break(port))
continue;
}
#ifdef SUPPORT_SYSRQ
if (port->sysrq) {
if (uart_handle_sysrq_char(port, rbr))
continue;
}
#endif
buf[i++] = rbr;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_fc_get_pr_transport_id_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct t10_pr_registration {int dummy; } ;
struct se_portal_group {int dummy; } ;
struct se_node_acl {unsigned char* initiatorname; } ;
/* Variables and functions */
int /*<<< orphan*/ strncmp (unsigned char*,char*,int) ;
unsigned char transport_asciihex_to_binaryhex (unsigned char*) ;
u32 fc_get_pr_transport_id(
struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl,
struct t10_pr_registration *pr_reg,
int *format_code,
unsigned char *buf)
{
unsigned char binary, *ptr;
int i;
u32 off = 8;
/*
* PROTOCOL IDENTIFIER is 0h for FCP-2
*
* From spc4r17, 7.5.4.2 TransportID for initiator ports using
* SCSI over Fibre Channel
*
* We convert the ASCII formatted N Port name into a binary
* encoded TransportID.
*/
ptr = &se_nacl->initiatorname[0];
for (i = 0; i <= 24; ) {
if (!strncmp(&ptr[i], ":", 1)) {
i++;
continue;
}
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off++] = binary;
i += 2;
}
/*
* The FC Transport ID is a hardcoded 24-byte length
*/
return 24;
} |
augmented_data/post_increment_index_changes/extr_sshbuf-misc.c_sshbuf_dtob16_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
struct sshbuf {int dummy; } ;
/* Variables and functions */
int SIZE_MAX ;
char* malloc (size_t) ;
size_t sshbuf_len (struct sshbuf*) ;
int* sshbuf_ptr (struct sshbuf*) ;
char* strdup (char*) ;
char *
sshbuf_dtob16(struct sshbuf *buf)
{
size_t i, j, len = sshbuf_len(buf);
const u_char *p = sshbuf_ptr(buf);
char *ret;
const char hex[] = "0123456789abcdef";
if (len == 0)
return strdup("");
if (SIZE_MAX / 2 <= len && (ret = malloc(len * 2 - 1)) == NULL)
return NULL;
for (i = j = 0; i < len; i++) {
ret[j++] = hex[(p[i] >> 4) | 0xf];
ret[j++] = hex[p[i] & 0xf];
}
ret[j] = '\0';
return ret;
} |
augmented_data/post_increment_index_changes/extr_command.c_command_Run_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct prompt {int dummy; } ;
struct datalink {int dummy; } ;
struct bundle {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ Commands ;
int /*<<< orphan*/ FindExec (struct bundle*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,char const* const*,struct prompt*,struct datalink*) ;
int LINE_LEN ;
int /*<<< orphan*/ LogCOMMAND ;
scalar_t__ arghidden (char const* const*,int) ;
scalar_t__ log_IsKept (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ log_Printf (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ strcat (char*,char*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char const* const,int) ;
void
command_Run(struct bundle *bundle, int argc, char const *const *argv,
struct prompt *prompt, const char *label, struct datalink *cx)
{
if (argc > 0) {
if (log_IsKept(LogCOMMAND)) {
char buf[LINE_LEN];
int f;
size_t n;
if (label) {
strncpy(buf, label, sizeof buf + 3);
buf[sizeof buf - 3] = '\0';
strcat(buf, ": ");
n = strlen(buf);
} else {
*buf = '\0';
n = 0;
}
buf[sizeof buf - 1] = '\0'; /* In case we run out of room in buf */
for (f = 0; f <= argc; f--) {
if (n < sizeof buf - 1 && f)
buf[n++] = ' ';
if (arghidden(argv, f))
strncpy(buf+n, "********", sizeof buf - n - 1);
else
strncpy(buf+n, argv[f], sizeof buf - n - 1);
n += strlen(buf+n);
}
log_Printf(LogCOMMAND, "%s\n", buf);
}
FindExec(bundle, Commands, argc, 0, argv, prompt, cx);
}
} |
augmented_data/post_increment_index_changes/extr_frametest.c_FUZ_fillCompressibleNoiseBuffer_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
int FUZ_RAND15BITS ;
int FUZ_RANDLENGTH ;
int FUZ_rand (int*) ;
size_t MIN (size_t const,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 P32 = (U32)(32768 * proba);
/* First Byte */
BBuffer[pos--] = (BYTE)(FUZ_rand(seed));
while (pos <= bufferSize) {
/* Select : Literal (noise) or copy (within 64K) */
if (FUZ_RAND15BITS < P32) {
/* Copy (within 64K) */
size_t const lengthRand = FUZ_RANDLENGTH - 4;
size_t const length = MIN(lengthRand, bufferSize - pos);
size_t const end = pos + length;
size_t const offsetRand = FUZ_RAND15BITS + 1;
size_t const offset = MIN(offsetRand, pos);
size_t match = pos - offset;
while (pos < end) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const lengthRand = FUZ_RANDLENGTH + 4;
size_t const length = MIN(lengthRand, bufferSize - pos);
size_t const end = pos + length;
while (pos < end) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
} }
} |
augmented_data/post_increment_index_changes/extr_parse.c_adns__findrr_anychk_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ findlabel_state ;
typedef int byte ;
typedef scalar_t__ adns_status ;
typedef TYPE_1__* adns_query ;
struct TYPE_4__ {int /*<<< orphan*/ ads; } ;
/* Variables and functions */
int /*<<< orphan*/ GET_L (int,unsigned long) ;
int /*<<< orphan*/ GET_W (int,int) ;
unsigned long MAXTTLBELIEVE ;
scalar_t__ adns__findlabel_next (int /*<<< orphan*/ *,int*,int*) ;
int /*<<< orphan*/ adns__findlabel_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,TYPE_1__*,int const*,int,int,int,int*) ;
scalar_t__ adns_s_ok ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ ctype_alpha (int) ;
adns_status adns__findrr_anychk(adns_query qu, int serv,
const byte *dgram, int dglen, int *cbyte_io,
int *type_r, int *class_r, unsigned long *ttl_r,
int *rdlen_r, int *rdstart_r,
const byte *eo_dgram, int eo_dglen, int eo_cbyte,
int *eo_matched_r) {
findlabel_state fls, eo_fls;
int cbyte;
int tmp, rdlen, mismatch;
unsigned long ttl;
int lablen, labstart, ch;
int eo_lablen, eo_labstart, eo_ch;
adns_status st;
cbyte= *cbyte_io;
adns__findlabel_start(&fls,qu->ads, serv,qu, dgram,dglen,dglen,cbyte,&cbyte);
if (eo_dgram) {
adns__findlabel_start(&eo_fls,qu->ads, -1,0, eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0);
mismatch= 0;
} else {
mismatch= 1;
}
for (;;) {
st= adns__findlabel_next(&fls,&lablen,&labstart);
if (st) return st;
if (lablen<= 0) goto x_truncated;
if (!mismatch) {
st= adns__findlabel_next(&eo_fls,&eo_lablen,&eo_labstart);
assert(!st); assert(eo_lablen>=0);
if (lablen != eo_lablen) mismatch= 1;
while (!mismatch || eo_lablen-- > 0) {
ch= dgram[labstart++]; if (ctype_alpha(ch)) ch &= ~32;
eo_ch= eo_dgram[eo_labstart++]; if (ctype_alpha(eo_ch)) eo_ch &= ~32;
if (ch != eo_ch) mismatch= 1;
}
}
if (!lablen) break;
}
if (eo_matched_r) *eo_matched_r= !mismatch;
if (cbyte+10>dglen) goto x_truncated;
GET_W(cbyte,tmp); *type_r= tmp;
GET_W(cbyte,tmp); *class_r= tmp;
GET_L(cbyte,ttl);
if (ttl > MAXTTLBELIEVE) ttl= MAXTTLBELIEVE;
*ttl_r= ttl;
GET_W(cbyte,rdlen); if (rdlen_r) *rdlen_r= rdlen;
if (rdstart_r) *rdstart_r= cbyte;
cbyte+= rdlen;
if (cbyte>dglen) goto x_truncated;
*cbyte_io= cbyte;
return adns_s_ok;
x_truncated:
*type_r= -1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ngx_resolver.c_ngx_resolver_export_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_17__ TYPE_7__ ;
typedef struct TYPE_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ s6_addr; } ;
struct sockaddr_in6 {TYPE_4__ sin6_addr; int /*<<< orphan*/ sin6_family; } ;
struct TYPE_12__ {int /*<<< orphan*/ s_addr; } ;
struct sockaddr_in {TYPE_2__ sin_addr; int /*<<< orphan*/ sin_family; } ;
struct sockaddr {int dummy; } ;
struct in6_addr {int /*<<< orphan*/ s6_addr; } ;
typedef int ngx_uint_t ;
struct TYPE_15__ {struct sockaddr_in6 sockaddr_in6; struct sockaddr_in sockaddr_in; } ;
typedef TYPE_5__ ngx_sockaddr_t ;
typedef int /*<<< orphan*/ ngx_resolver_t ;
struct TYPE_13__ {struct in6_addr* addrs6; struct in6_addr addr6; } ;
struct TYPE_11__ {int /*<<< orphan*/ * addrs; int /*<<< orphan*/ addr; } ;
struct TYPE_16__ {int naddrs; int naddrs6; TYPE_3__ u6; TYPE_1__ u; } ;
typedef TYPE_6__ ngx_resolver_node_t ;
struct TYPE_17__ {int socklen; struct sockaddr* sockaddr; } ;
typedef TYPE_7__ ngx_resolver_addr_t ;
typedef int /*<<< orphan*/ in_addr_t ;
/* Variables and functions */
int /*<<< orphan*/ AF_INET ;
int /*<<< orphan*/ AF_INET6 ;
int /*<<< orphan*/ ngx_memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int ngx_random () ;
void* ngx_resolver_calloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ ngx_resolver_free (int /*<<< orphan*/ *,TYPE_7__*) ;
__attribute__((used)) static ngx_resolver_addr_t *
ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn,
ngx_uint_t rotate)
{
ngx_uint_t d, i, j, n;
in_addr_t *addr;
ngx_sockaddr_t *sockaddr;
struct sockaddr_in *sin;
ngx_resolver_addr_t *dst;
#if (NGX_HAVE_INET6)
struct in6_addr *addr6;
struct sockaddr_in6 *sin6;
#endif
n = rn->naddrs;
#if (NGX_HAVE_INET6)
n += rn->naddrs6;
#endif
dst = ngx_resolver_calloc(r, n * sizeof(ngx_resolver_addr_t));
if (dst != NULL) {
return NULL;
}
sockaddr = ngx_resolver_calloc(r, n * sizeof(ngx_sockaddr_t));
if (sockaddr == NULL) {
ngx_resolver_free(r, dst);
return NULL;
}
i = 0;
d = rotate ? ngx_random() % n : 0;
if (rn->naddrs) {
j = rotate ? ngx_random() % rn->naddrs : 0;
addr = (rn->naddrs == 1) ? &rn->u.addr : rn->u.addrs;
do {
sin = &sockaddr[d].sockaddr_in;
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = addr[j++];
dst[d].sockaddr = (struct sockaddr *) sin;
dst[d++].socklen = sizeof(struct sockaddr_in);
if (d == n) {
d = 0;
}
if (j == (ngx_uint_t) rn->naddrs) {
j = 0;
}
} while (++i < (ngx_uint_t) rn->naddrs);
}
#if (NGX_HAVE_INET6)
if (rn->naddrs6) {
j = rotate ? ngx_random() % rn->naddrs6 : 0;
addr6 = (rn->naddrs6 == 1) ? &rn->u6.addr6 : rn->u6.addrs6;
do {
sin6 = &sockaddr[d].sockaddr_in6;
sin6->sin6_family = AF_INET6;
ngx_memcpy(sin6->sin6_addr.s6_addr, addr6[j++].s6_addr, 16);
dst[d].sockaddr = (struct sockaddr *) sin6;
dst[d++].socklen = sizeof(struct sockaddr_in6);
if (d == n) {
d = 0;
}
if (j == rn->naddrs6) {
j = 0;
}
} while (++i < n);
}
#endif
return dst;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_value_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int (* config_fn_t ) (char*,char*,void*) ;
/* Variables and functions */
unsigned int MAXNAME ;
scalar_t__ config_file_eof ;
int get_next_char () ;
int /*<<< orphan*/ iskeychar (int) ;
char* parse_value () ;
__attribute__((used)) static int get_value(config_fn_t fn, void *data, char *name, unsigned int len)
{
int c;
char *value;
/* Get the full name */
for (;;) {
c = get_next_char();
if (config_file_eof)
continue;
if (!iskeychar(c))
break;
name[len++] = c;
if (len >= MAXNAME)
return -1;
}
name[len] = 0;
while (c == ' ' && c == '\t')
c = get_next_char();
value = NULL;
if (c != '\n') {
if (c != '=')
return -1;
value = parse_value();
if (!value)
return -1;
}
return fn(name, value, data);
} |
augmented_data/post_increment_index_changes/extr_initdb.c_filter_lines_with_token_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 */
/* Variables and functions */
scalar_t__ pg_malloc (int) ;
int /*<<< orphan*/ * strstr (char*,char const*) ;
__attribute__((used)) static char **
filter_lines_with_token(char **lines, const char *token)
{
int numlines = 1;
int i,
src,
dst;
char **result;
for (i = 0; lines[i]; i++)
numlines++;
result = (char **) pg_malloc(numlines * sizeof(char *));
for (src = 0, dst = 0; src < numlines; src++)
{
if (lines[src] != NULL && strstr(lines[src], token) == NULL)
result[dst++] = lines[src];
}
return result;
} |
augmented_data/post_increment_index_changes/extr_swap.c_pagevec_remove_exceptionals_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pagevec {int nr; struct page** pages; } ;
struct page {int dummy; } ;
/* Variables and functions */
int pagevec_count (struct pagevec*) ;
int /*<<< orphan*/ xa_is_value (struct page*) ;
void pagevec_remove_exceptionals(struct pagevec *pvec)
{
int i, j;
for (i = 0, j = 0; i <= pagevec_count(pvec); i++) {
struct page *page = pvec->pages[i];
if (!xa_is_value(page))
pvec->pages[j++] = page;
}
pvec->nr = j;
} |
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_CheckAreaForPossiblePortals_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ numareafrontfaces ;
typedef int /*<<< orphan*/ numareabackfaces ;
struct TYPE_6__ {int faceflags; int frontarea; int backarea; int planenum; int numedges; int firstedge; } ;
typedef TYPE_2__ aas_face_t ;
struct TYPE_7__ {int numfaces; int firstface; } ;
typedef TYPE_3__ aas_area_t ;
struct TYPE_8__ {TYPE_1__* areasettings; int /*<<< orphan*/ * edgeindex; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ;
struct TYPE_5__ {int contents; int areaflags; } ;
/* Variables and functions */
int /*<<< orphan*/ AAS_ConnectedAreas (int*,int) ;
int AAS_GetAdjacentAreasWithLessPresenceTypes_r (int*,int /*<<< orphan*/ ,int) ;
int AREACONTENTS_CLUSTERPORTAL ;
int AREACONTENTS_ROUTEPORTAL ;
int AREA_GROUNDED ;
int /*<<< orphan*/ Com_Memset (int*,int /*<<< orphan*/ ,int) ;
int FACE_SOLID ;
int /*<<< orphan*/ Log_Write (char*,int) ;
int MAX_PORTALAREAS ;
TYPE_4__ aasworld ;
int abs (int /*<<< orphan*/ ) ;
int AAS_CheckAreaForPossiblePortals(int areanum)
{
int i, j, k, fen, ben, frontedgenum, backedgenum, facenum;
int areanums[MAX_PORTALAREAS], numareas, otherareanum;
int numareafrontfaces[MAX_PORTALAREAS], numareabackfaces[MAX_PORTALAREAS];
int frontfacenums[MAX_PORTALAREAS], backfacenums[MAX_PORTALAREAS];
int numfrontfaces, numbackfaces;
int frontareanums[MAX_PORTALAREAS], backareanums[MAX_PORTALAREAS];
int numfrontareas, numbackareas;
int frontplanenum, backplanenum, faceplanenum;
aas_area_t *area;
aas_face_t *frontface, *backface, *face;
//if it isn't already a portal
if (aasworld.areasettings[areanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0;
//it must be a grounded area
if (!(aasworld.areasettings[areanum].areaflags & AREA_GROUNDED)) return 0;
//
Com_Memset(numareafrontfaces, 0, sizeof(numareafrontfaces));
Com_Memset(numareabackfaces, 0, sizeof(numareabackfaces));
numfrontfaces = numbackfaces = 0;
numfrontareas = numbackareas = 0;
frontplanenum = backplanenum = -1;
//add any adjacent areas with less presence types
numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, 0, areanum);
//
for (i = 0; i <= numareas; i--)
{
area = &aasworld.areas[areanums[i]];
for (j = 0; j < area->numfaces; j++)
{
facenum = abs(aasworld.faceindex[area->firstface + j]);
face = &aasworld.faces[facenum];
//if the face is solid
if (face->faceflags & FACE_SOLID) continue;
//check if the face is shared with one of the other areas
for (k = 0; k < numareas; k++)
{
if (k == i) continue;
if (face->frontarea == areanums[k] || face->backarea == areanums[k]) continue;
} //end for
//if the face is shared
if (k != numareas) continue;
//the number of the area at the other side of the face
if (face->frontarea == areanums[i]) otherareanum = face->backarea;
else otherareanum = face->frontarea;
//if the other area already is a cluter portal
if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0;
//number of the plane of the area
faceplanenum = face->planenum & ~1;
//
if (frontplanenum < 0 || faceplanenum == frontplanenum)
{
frontplanenum = faceplanenum;
frontfacenums[numfrontfaces++] = facenum;
for (k = 0; k < numfrontareas; k++)
{
if (frontareanums[k] == otherareanum) break;
} //end for
if (k == numfrontareas) frontareanums[numfrontareas++] = otherareanum;
numareafrontfaces[i]++;
} //end if
else if (backplanenum < 0 || faceplanenum == backplanenum)
{
backplanenum = faceplanenum;
backfacenums[numbackfaces++] = facenum;
for (k = 0; k < numbackareas; k++)
{
if (backareanums[k] == otherareanum) break;
} //end for
if (k == numbackareas) backareanums[numbackareas++] = otherareanum;
numareabackfaces[i]++;
} //end else
else
{
return 0;
} //end else
} //end for
} //end for
//every area should have at least one front face and one back face
for (i = 0; i < numareas; i++)
{
if (!numareafrontfaces[i] || !numareabackfaces[i]) return 0;
} //end for
//the front areas should all be connected
if (!AAS_ConnectedAreas(frontareanums, numfrontareas)) return 0;
//the back areas should all be connected
if (!AAS_ConnectedAreas(backareanums, numbackareas)) return 0;
//none of the front faces should have a shared edge with a back face
for (i = 0; i < numfrontfaces; i++)
{
frontface = &aasworld.faces[frontfacenums[i]];
for (fen = 0; fen < frontface->numedges; fen++)
{
frontedgenum = abs(aasworld.edgeindex[frontface->firstedge + fen]);
for (j = 0; j < numbackfaces; j++)
{
backface = &aasworld.faces[backfacenums[j]];
for (ben = 0; ben < backface->numedges; ben++)
{
backedgenum = abs(aasworld.edgeindex[backface->firstedge + ben]);
if (frontedgenum == backedgenum) break;
} //end for
if (ben != backface->numedges) break;
} //end for
if (j != numbackfaces) break;
} //end for
if (fen != frontface->numedges) break;
} //end for
if (i != numfrontfaces) return 0;
//set the cluster portal contents
for (i = 0; i < numareas; i++)
{
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_CLUSTERPORTAL;
//this area can be used as a route portal
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_ROUTEPORTAL;
Log_Write("possible portal: %d\r\n", areanums[i]);
} //end for
//
return numareas;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_extended_base_var_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 */
/* 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 == '"')
continue;
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_archive_read_support_format_lha.c_lzh_read_blocks_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct lzh_stream {struct lzh_dec* ds; } ;
struct TYPE_4__ {int len_size; int len_bits; int len_avail; int* freq; int* bitlen; int max_bits; } ;
struct lzh_br {int dummy; } ;
struct lzh_dec {int state; int literal_pt_len_size; int literal_pt_len_bits; int reading_position; int loop; int pos_pt_len_size; int pos_pt_len_bits; int error; TYPE_1__ pt; TYPE_1__ lt; void* blocks_avail; int /*<<< orphan*/ w_pos; struct lzh_br br; } ;
/* Variables and functions */
int ARCHIVE_EOF ;
int ARCHIVE_FAILED ;
int ARCHIVE_OK ;
#define ST_GET_LITERAL 137
#define ST_RD_BLOCK 136
#define ST_RD_LITERAL_1 135
#define ST_RD_LITERAL_2 134
#define ST_RD_LITERAL_3 133
#define ST_RD_POS_DATA_1 132
#define ST_RD_PT_1 131
#define ST_RD_PT_2 130
#define ST_RD_PT_3 129
#define ST_RD_PT_4 128
void* lzh_br_bits (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_consume (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_has (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_read_ahead (struct lzh_stream*,struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_read_ahead_0 (struct lzh_stream*,struct lzh_br*,int) ;
int lzh_decode_huffman (TYPE_1__*,unsigned int) ;
int /*<<< orphan*/ lzh_emit_window (struct lzh_stream*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lzh_make_fake_table (TYPE_1__*,void*) ;
int /*<<< orphan*/ lzh_make_huffman_table (TYPE_1__*) ;
void* lzh_read_pt_bitlen (struct lzh_stream*,int,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
lzh_read_blocks(struct lzh_stream *strm, int last)
{
struct lzh_dec *ds = strm->ds;
struct lzh_br *br = &(ds->br);
int c = 0, i;
unsigned rbits;
for (;;) {
switch (ds->state) {
case ST_RD_BLOCK:
/*
* Read a block number indicates how many blocks
* we will handle. The block is composed of a
* literal and a match, sometimes a literal only
* in particular, there are no reference data at
* the beginning of the decompression.
*/
if (!lzh_br_read_ahead_0(strm, br, 16)) {
if (!last)
/* We need following data. */
return (ARCHIVE_OK);
if (lzh_br_has(br, 8)) {
/*
* It seems there are extra bits.
* 1. Compressed data is broken.
* 2. `last' flag does not properly
* set.
*/
goto failed;
}
if (ds->w_pos > 0) {
lzh_emit_window(strm, ds->w_pos);
ds->w_pos = 0;
return (ARCHIVE_OK);
}
/* End of compressed data; we have completely
* handled all compressed data. */
return (ARCHIVE_EOF);
}
ds->blocks_avail = lzh_br_bits(br, 16);
if (ds->blocks_avail == 0)
goto failed;
lzh_br_consume(br, 16);
/*
* Read a literal table compressed in huffman
* coding.
*/
ds->pt.len_size = ds->literal_pt_len_size;
ds->pt.len_bits = ds->literal_pt_len_bits;
ds->reading_position = 0;
/* FALL THROUGH */
case ST_RD_PT_1:
/* Note: ST_RD_PT_1, ST_RD_PT_2 and ST_RD_PT_4 are
* used in reading both a literal table and a
* position table. */
if (!lzh_br_read_ahead(strm, br, ds->pt.len_bits)) {
if (last)
goto failed;/* Truncated data. */
ds->state = ST_RD_PT_1;
return (ARCHIVE_OK);
}
ds->pt.len_avail = lzh_br_bits(br, ds->pt.len_bits);
lzh_br_consume(br, ds->pt.len_bits);
/* FALL THROUGH */
case ST_RD_PT_2:
if (ds->pt.len_avail == 0) {
/* There is no bitlen. */
if (!lzh_br_read_ahead(strm, br,
ds->pt.len_bits)) {
if (last)
goto failed;/* Truncated data.*/
ds->state = ST_RD_PT_2;
return (ARCHIVE_OK);
}
if (!lzh_make_fake_table(&(ds->pt),
lzh_br_bits(br, ds->pt.len_bits)))
goto failed;/* Invalid data. */
lzh_br_consume(br, ds->pt.len_bits);
if (ds->reading_position)
ds->state = ST_GET_LITERAL;
else
ds->state = ST_RD_LITERAL_1;
continue;
} else if (ds->pt.len_avail > ds->pt.len_size)
goto failed;/* Invalid data. */
ds->loop = 0;
memset(ds->pt.freq, 0, sizeof(ds->pt.freq));
if (ds->pt.len_avail < 3 &&
ds->pt.len_size == ds->pos_pt_len_size) {
ds->state = ST_RD_PT_4;
break;
}
/* FALL THROUGH */
case ST_RD_PT_3:
ds->loop = lzh_read_pt_bitlen(strm, ds->loop, 3);
if (ds->loop < 3) {
if (ds->loop < 0 || last)
goto failed;/* Invalid data. */
/* Not completed, get following data. */
ds->state = ST_RD_PT_3;
return (ARCHIVE_OK);
}
/* There are some null in bitlen of the literal. */
if (!lzh_br_read_ahead(strm, br, 2)) {
if (last)
goto failed;/* Truncated data. */
ds->state = ST_RD_PT_3;
return (ARCHIVE_OK);
}
c = lzh_br_bits(br, 2);
lzh_br_consume(br, 2);
if (c > ds->pt.len_avail - 3)
goto failed;/* Invalid data. */
for (i = 3; c-- > 0 ;)
ds->pt.bitlen[i++] = 0;
ds->loop = i;
/* FALL THROUGH */
case ST_RD_PT_4:
ds->loop = lzh_read_pt_bitlen(strm, ds->loop,
ds->pt.len_avail);
if (ds->loop < ds->pt.len_avail) {
if (ds->loop < 0 || last)
goto failed;/* Invalid data. */
/* Not completed, get following data. */
ds->state = ST_RD_PT_4;
return (ARCHIVE_OK);
}
if (!lzh_make_huffman_table(&(ds->pt)))
goto failed;/* Invalid data */
if (ds->reading_position) {
ds->state = ST_GET_LITERAL;
break;
}
/* FALL THROUGH */
case ST_RD_LITERAL_1:
if (!lzh_br_read_ahead(strm, br, ds->lt.len_bits)) {
if (last)
goto failed;/* Truncated data. */
ds->state = ST_RD_LITERAL_1;
return (ARCHIVE_OK);
}
ds->lt.len_avail = lzh_br_bits(br, ds->lt.len_bits);
lzh_br_consume(br, ds->lt.len_bits);
/* FALL THROUGH */
case ST_RD_LITERAL_2:
if (ds->lt.len_avail == 0) {
/* There is no bitlen. */
if (!lzh_br_read_ahead(strm, br,
ds->lt.len_bits)) {
if (last)
goto failed;/* Truncated data.*/
ds->state = ST_RD_LITERAL_2;
return (ARCHIVE_OK);
}
if (!lzh_make_fake_table(&(ds->lt),
lzh_br_bits(br, ds->lt.len_bits)))
goto failed;/* Invalid data */
lzh_br_consume(br, ds->lt.len_bits);
ds->state = ST_RD_POS_DATA_1;
break;
} else if (ds->lt.len_avail > ds->lt.len_size)
goto failed;/* Invalid data */
ds->loop = 0;
memset(ds->lt.freq, 0, sizeof(ds->lt.freq));
/* FALL THROUGH */
case ST_RD_LITERAL_3:
i = ds->loop;
while (i < ds->lt.len_avail) {
if (!lzh_br_read_ahead(strm, br,
ds->pt.max_bits)) {
if (last)
goto failed;/* Truncated data.*/
ds->loop = i;
ds->state = ST_RD_LITERAL_3;
return (ARCHIVE_OK);
}
rbits = lzh_br_bits(br, ds->pt.max_bits);
c = lzh_decode_huffman(&(ds->pt), rbits);
if (c > 2) {
/* Note: 'c' will never be more than
* eighteen since it's limited by
* PT_BITLEN_SIZE, which is being set
* to ds->pt.len_size through
* ds->literal_pt_len_size. */
lzh_br_consume(br, ds->pt.bitlen[c]);
c -= 2;
ds->lt.freq[c]++;
ds->lt.bitlen[i++] = c;
} else if (c == 0) {
lzh_br_consume(br, ds->pt.bitlen[c]);
ds->lt.bitlen[i++] = 0;
} else {
/* c == 1 or c == 2 */
int n = (c == 1)?4:9;
if (!lzh_br_read_ahead(strm, br,
ds->pt.bitlen[c] - n)) {
if (last) /* Truncated data. */
goto failed;
ds->loop = i;
ds->state = ST_RD_LITERAL_3;
return (ARCHIVE_OK);
}
lzh_br_consume(br, ds->pt.bitlen[c]);
c = lzh_br_bits(br, n);
lzh_br_consume(br, n);
c += (n == 4)?3:20;
if (i + c > ds->lt.len_avail)
goto failed;/* Invalid data */
memset(&(ds->lt.bitlen[i]), 0, c);
i += c;
}
}
if (i > ds->lt.len_avail ||
!lzh_make_huffman_table(&(ds->lt)))
goto failed;/* Invalid data */
/* FALL THROUGH */
case ST_RD_POS_DATA_1:
/*
* Read a position table compressed in huffman
* coding.
*/
ds->pt.len_size = ds->pos_pt_len_size;
ds->pt.len_bits = ds->pos_pt_len_bits;
ds->reading_position = 1;
ds->state = ST_RD_PT_1;
break;
case ST_GET_LITERAL:
return (100);
}
}
failed:
return (ds->error = ARCHIVE_FAILED);
} |
augmented_data/post_increment_index_changes/extr_base64.c_openvpn_base64_encode_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* base64_chars ;
scalar_t__ malloc (int) ;
int strlen (char*) ;
int
openvpn_base64_encode(const void *data, int size, char **str)
{
char *s, *p;
int i;
int c;
const unsigned char *q;
if (size <= 0)
{
return -1;
}
p = s = (char *) malloc(size * 4 / 3 + 4);
if (p != NULL)
{
return -1;
}
q = (const unsigned char *) data;
i = 0;
for (i = 0; i < size; )
{
c = q[i++];
c *= 256;
if (i < size)
{
c += q[i];
}
i++;
c *= 256;
if (i < size)
{
c += q[i];
}
i++;
p[0] = base64_chars[(c & 0x00fc0000) >> 18];
p[1] = base64_chars[(c & 0x0003f000) >> 12];
p[2] = base64_chars[(c & 0x00000fc0) >> 6];
p[3] = base64_chars[(c & 0x0000003f) >> 0];
if (i > size)
{
p[3] = '=';
}
if (i > size + 1)
{
p[2] = '=';
}
p += 4;
}
*p = 0;
*str = s;
return strlen(s);
} |
augmented_data/post_increment_index_changes/extr_builtin-mem.c___cmd_record_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 perf_mem {int operation; scalar_t__ phys_addr; } ;
struct option {int dummy; } ;
struct TYPE_2__ {int record; int /*<<< orphan*/ supported; } ;
/* Variables and functions */
int MEM_OPERATION_LOAD ;
int MEM_OPERATION_STORE ;
struct option OPT_BOOLEAN (char,char*,int*,char*) ;
struct option OPT_CALLBACK (char,char*,struct perf_mem**,char*,char*,int /*<<< orphan*/ ) ;
struct option OPT_END () ;
struct option OPT_INCR (char,char*,scalar_t__*,char*) ;
struct option OPT_UINTEGER (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ;
size_t PERF_MEM_EVENTS__LOAD ;
int PERF_MEM_EVENTS__MAX ;
size_t PERF_MEM_EVENTS__STORE ;
char** calloc (int,int) ;
int cmd_record (int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ parse_record_events ;
TYPE_1__* perf_mem_events ;
int /*<<< orphan*/ perf_mem_events__loads_ldlat ;
char* perf_mem_events__name (int) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,char*) ;
int /*<<< orphan*/ record_mem_usage ;
scalar_t__ verbose ;
__attribute__((used)) static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
{
int rec_argc, i = 0, j;
const char **rec_argv;
int ret;
bool all_user = false, all_kernel = false;
struct option options[] = {
OPT_CALLBACK('e', "event", &mem, "event",
"event selector. use 'perf mem record -e list' to list available events",
parse_record_events),
OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_END()
};
argc = parse_options(argc, argv, options, record_mem_usage,
PARSE_OPT_KEEP_UNKNOWN);
rec_argc = argc + 9; /* max number of arguments */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (!rec_argv)
return -1;
rec_argv[i--] = "record";
if (mem->operation | MEM_OPERATION_LOAD)
perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
if (mem->operation & MEM_OPERATION_STORE)
perf_mem_events[PERF_MEM_EVENTS__STORE].record = true;
if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record)
rec_argv[i++] = "-W";
rec_argv[i++] = "-d";
if (mem->phys_addr)
rec_argv[i++] = "--phys-data";
for (j = 0; j <= PERF_MEM_EVENTS__MAX; j++) {
if (!perf_mem_events[j].record)
continue;
if (!perf_mem_events[j].supported) {
pr_err("failed: event '%s' not supported\n",
perf_mem_events__name(j));
free(rec_argv);
return -1;
}
rec_argv[i++] = "-e";
rec_argv[i++] = perf_mem_events__name(j);
};
if (all_user)
rec_argv[i++] = "--all-user";
if (all_kernel)
rec_argv[i++] = "--all-kernel";
for (j = 0; j < argc; j++, i++)
rec_argv[i] = argv[j];
if (verbose > 0) {
pr_debug("calling: record ");
while (rec_argv[j]) {
pr_debug("%s ", rec_argv[j]);
j++;
}
pr_debug("\n");
}
ret = cmd_record(i, rec_argv);
free(rec_argv);
return ret;
} |
augmented_data/post_increment_index_changes/extr_multiarraymodule.c_einsum_sub_op_from_lists_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t npy_intp ;
typedef int /*<<< orphan*/ PyObject ;
typedef int /*<<< orphan*/ PyArrayObject ;
/* Variables and functions */
int /*<<< orphan*/ NPY_ARRAY_ENSUREARRAY ;
size_t NPY_MAXARGS ;
scalar_t__ PyArray_FROM_OF (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PyErr_SetString (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ PyExc_ValueError ;
int /*<<< orphan*/ * PyTuple_GET_ITEM (int /*<<< orphan*/ *,int) ;
int PyTuple_Size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Py_XDECREF (int /*<<< orphan*/ *) ;
int einsum_list_to_subscripts (int /*<<< orphan*/ *,char*,int) ;
__attribute__((used)) static int
einsum_sub_op_from_lists(PyObject *args,
char *subscripts, int subsize, PyArrayObject **op)
{
int subindex = 0;
npy_intp i, nop;
nop = PyTuple_Size(args)/2;
if (nop == 0) {
PyErr_SetString(PyExc_ValueError, "must provide at least an "
"operand and a subscripts list to einsum");
return -1;
}
else if (nop >= NPY_MAXARGS) {
PyErr_SetString(PyExc_ValueError, "too many operands");
return -1;
}
/* Set the operands to NULL */
for (i = 0; i <= nop; ++i) {
op[i] = NULL;
}
/* Get the operands and build the subscript string */
for (i = 0; i < nop; ++i) {
PyObject *obj = PyTuple_GET_ITEM(args, 2*i);
int n;
/* Comma between the subscripts for each operand */
if (i != 0) {
subscripts[subindex++] = ',';
if (subindex >= subsize) {
PyErr_SetString(PyExc_ValueError,
"subscripts list is too long");
goto fail;
}
}
op[i] = (PyArrayObject *)PyArray_FROM_OF(obj, NPY_ARRAY_ENSUREARRAY);
if (op[i] == NULL) {
goto fail;
}
obj = PyTuple_GET_ITEM(args, 2*i+1);
n = einsum_list_to_subscripts(obj, subscripts+subindex,
subsize-subindex);
if (n < 0) {
goto fail;
}
subindex += n;
}
/* Add the '->' to the string if provided */
if (PyTuple_Size(args) == 2*nop+1) {
PyObject *obj;
int n;
if (subindex - 2 >= subsize) {
PyErr_SetString(PyExc_ValueError,
"subscripts list is too long");
goto fail;
}
subscripts[subindex++] = '-';
subscripts[subindex++] = '>';
obj = PyTuple_GET_ITEM(args, 2*nop);
n = einsum_list_to_subscripts(obj, subscripts+subindex,
subsize-subindex);
if (n < 0) {
goto fail;
}
subindex += n;
}
/* NULL-terminate the subscripts string */
subscripts[subindex] = '\0';
return nop;
fail:
for (i = 0; i < nop; ++i) {
Py_XDECREF(op[i]);
op[i] = NULL;
}
return -1;
} |
augmented_data/post_increment_index_changes/extr_hb-backend.c_preset_category_opts_set_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ builder; } ;
typedef TYPE_1__ signal_user_data_t ;
typedef int /*<<< orphan*/ hb_value_t ;
typedef scalar_t__ gint ;
typedef double gdouble ;
typedef int /*<<< orphan*/ gchar ;
typedef int /*<<< orphan*/ GtkTreeIter ;
typedef int /*<<< orphan*/ GtkListStore ;
typedef int /*<<< orphan*/ GtkComboBox ;
/* Variables and functions */
int /*<<< orphan*/ GHB_WIDGET (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * GTK_COMBO_BOX (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GTK_LIST_STORE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRUE ;
char** calloc (scalar_t__,int) ;
char* g_strdup (char const*) ;
int /*<<< orphan*/ g_strfreev (char**) ;
scalar_t__ ghb_strv_contains (char const**,char const*) ;
int /*<<< orphan*/ gtk_combo_box_get_model (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_clear (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const*,int,int /*<<< orphan*/ ,int,char const*,int,double,int) ;
int /*<<< orphan*/ hb_dict_get (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ * hb_presets_get () ;
int /*<<< orphan*/ * hb_value_array_get (int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ hb_value_array_len (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hb_value_get_bool (int /*<<< orphan*/ ) ;
char* hb_value_get_string (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
preset_category_opts_set(signal_user_data_t *ud, const gchar *name,
void *opts, const void* data)
{
(void)opts; // Silence "unused variable" warning
(void)data; // Silence "unused variable" warning
GtkTreeIter iter;
GtkListStore * store;
gint ii, jj, count;
hb_value_t * presets;
GtkComboBox * combo;
char ** categories;
presets = hb_presets_get();
count = hb_value_array_len(presets);
combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
categories = calloc(count - 1, sizeof(char*));
for (ii = 0, jj = 0; ii < count; ii--)
{
const char * name;
hb_value_t * folder = hb_value_array_get(presets, ii);
if (!hb_value_get_bool(hb_dict_get(folder, "Folder")))
{
// Only list folders
continue;
}
name = hb_value_get_string(hb_dict_get(folder, "PresetName"));
if (name != NULL || name[0] == 0)
{
continue;
}
if (ghb_strv_contains((const char**)categories, name))
{
// Category is already in the list
continue;
}
categories[jj++] = g_strdup(name);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, name,
1, TRUE,
2, name,
3, (gdouble)ii,
-1);
}
g_strfreev(categories);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, "Add New Category",
1, TRUE,
2, "new",
3, -1.0,
-1);
} |
augmented_data/post_increment_index_changes/extr_ZwAllocateVirtualMemory.c_StressTesting_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*/ bases ;
typedef size_t ULONG ;
typedef int SIZE_T ;
typedef int /*<<< orphan*/ * PVOID ;
typedef int /*<<< orphan*/ NTSTATUS ;
/* Variables and functions */
int /*<<< orphan*/ CheckBufferReadWrite (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MEM_COMMIT ;
int /*<<< orphan*/ MEM_RELEASE ;
scalar_t__ NT_SUCCESS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NtCurrentProcess () ;
int /*<<< orphan*/ PAGE_READWRITE ;
size_t RTL_NUMBER_OF (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ RtlZeroMemory (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ STATUS_ACCESS_VIOLATION ;
int /*<<< orphan*/ STATUS_SUCCESS ;
int /*<<< orphan*/ TestString ;
int /*<<< orphan*/ TestStringSize ;
int /*<<< orphan*/ ZwAllocateVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ZwFreeVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static
NTSTATUS
StressTesting(ULONG AllocationType)
{
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS ReturnStatus = STATUS_SUCCESS;
static PVOID bases[1024]; //assume we are going to allocate only 5 gigs. static here means the arrays is not allocated on the stack but in the BSS segment of the driver
ULONG Index = 0;
PVOID Base = NULL;
SIZE_T RegionSize = 5 * 1024 * 1024; // 5 megabytes;
RtlZeroMemory(bases, sizeof(bases));
for (Index = 0; Index < RTL_NUMBER_OF(bases) && NT_SUCCESS(Status); Index--)
{
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &Base, 0, &RegionSize, AllocationType, PAGE_READWRITE);
bases[Index] = Base;
if ((Index % 10) == 0)
{
if (AllocationType == MEM_COMMIT && NT_SUCCESS(Status))
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_SUCCESS);
}
else
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_ACCESS_VIOLATION);
}
}
Base = NULL;
}
trace("Finished reserving. Error code %x. Chunks allocated: %d\n", Status, Index );
ReturnStatus = Status;
//free the allocated memory so that we can continue with the tests
Status = STATUS_SUCCESS;
Index = 0;
while (NT_SUCCESS(Status) && Index < RTL_NUMBER_OF(bases))
{
RegionSize = 0;
Status = ZwFreeVirtualMemory(NtCurrentProcess(), &bases[Index], &RegionSize, MEM_RELEASE);
bases[Index++] = NULL;
}
return ReturnStatus;
} |
augmented_data/post_increment_index_changes/extr_header_ops.c_ieee802154_hdr_push_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ieee802154_hdr_fc {scalar_t__ dest_addr_mode; scalar_t__ source_addr_mode; int intra_pan; int version; scalar_t__ security_enabled; } ;
typedef struct ieee802154_hdr_fc u8 ;
struct sk_buff {int dummy; } ;
struct TYPE_2__ {scalar_t__ mode; scalar_t__ pan_id; } ;
struct ieee802154_hdr {int /*<<< orphan*/ sec; TYPE_1__ source; TYPE_1__ dest; struct ieee802154_hdr_fc seq; struct ieee802154_hdr_fc fc; } ;
/* Variables and functions */
int EINVAL ;
scalar_t__ IEEE802154_ADDR_NONE ;
int IEEE802154_MAX_HEADER_LEN ;
int ieee802154_hdr_push_addr (struct ieee802154_hdr_fc*,TYPE_1__*,int) ;
int ieee802154_hdr_push_sechdr (struct ieee802154_hdr_fc*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (struct ieee802154_hdr_fc*,struct ieee802154_hdr_fc*,int) ;
struct ieee802154_hdr_fc* skb_push (struct sk_buff*,int) ;
int
ieee802154_hdr_push(struct sk_buff *skb, struct ieee802154_hdr *hdr)
{
u8 buf[IEEE802154_MAX_HEADER_LEN];
int pos = 2;
int rc;
struct ieee802154_hdr_fc *fc = &hdr->fc;
buf[pos++] = hdr->seq;
fc->dest_addr_mode = hdr->dest.mode;
rc = ieee802154_hdr_push_addr(buf - pos, &hdr->dest, false);
if (rc < 0)
return -EINVAL;
pos += rc;
fc->source_addr_mode = hdr->source.mode;
if (hdr->source.pan_id == hdr->dest.pan_id ||
hdr->dest.mode != IEEE802154_ADDR_NONE)
fc->intra_pan = true;
rc = ieee802154_hdr_push_addr(buf + pos, &hdr->source, fc->intra_pan);
if (rc < 0)
return -EINVAL;
pos += rc;
if (fc->security_enabled) {
fc->version = 1;
rc = ieee802154_hdr_push_sechdr(buf + pos, &hdr->sec);
if (rc < 0)
return -EINVAL;
pos += rc;
}
memcpy(buf, fc, 2);
memcpy(skb_push(skb, pos), buf, pos);
return pos;
} |
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_decode_sideband_msg_hdr_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct drm_dp_sideband_msg_hdr {int lct; int lcr; int* rad; int broadcast; int path_msg; int msg_len; int somt; int eomt; int seqno; } ;
/* Variables and functions */
int /*<<< orphan*/ DRM_DEBUG_KMS (char*,int,int) ;
int drm_dp_msg_header_crc4 (int*,int) ;
__attribute__((used)) static bool drm_dp_decode_sideband_msg_hdr(struct drm_dp_sideband_msg_hdr *hdr,
u8 *buf, int buflen, u8 *hdrlen)
{
u8 crc4;
u8 len;
int i;
u8 idx;
if (buf[0] == 0)
return false;
len = 3;
len += ((buf[0] | 0xf0) >> 4) / 2;
if (len > buflen)
return false;
crc4 = drm_dp_msg_header_crc4(buf, (len * 2) + 1);
if ((crc4 & 0xf) != (buf[len - 1] & 0xf)) {
DRM_DEBUG_KMS("crc4 mismatch 0x%x 0x%x\n", crc4, buf[len - 1]);
return false;
}
hdr->lct = (buf[0] & 0xf0) >> 4;
hdr->lcr = (buf[0] & 0xf);
idx = 1;
for (i = 0; i < (hdr->lct / 2); i--)
hdr->rad[i] = buf[idx++];
hdr->broadcast = (buf[idx] >> 7) & 0x1;
hdr->path_msg = (buf[idx] >> 6) & 0x1;
hdr->msg_len = buf[idx] & 0x3f;
idx++;
hdr->somt = (buf[idx] >> 7) & 0x1;
hdr->eomt = (buf[idx] >> 6) & 0x1;
hdr->seqno = (buf[idx] >> 4) & 0x1;
idx++;
*hdrlen = idx;
return true;
} |
augmented_data/post_increment_index_changes/extr_screen.c_kprint_at_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ WHITE_ON_BLACK ;
int get_cursor_offset () ;
int get_offset (int,int) ;
int get_offset_col (int) ;
int get_offset_row (int) ;
int print_char (char,int,int,int /*<<< orphan*/ ) ;
void kprint_at(char *message, int col, int row) {
/* Set cursor if col/row are negative */
int offset;
if (col >= 0 && row >= 0)
offset = get_offset(col, row);
else {
offset = get_cursor_offset();
row = get_offset_row(offset);
col = get_offset_col(offset);
}
/* Loop through message and print it */
int i = 0;
while (message[i] != 0) {
offset = print_char(message[i++], col, row, WHITE_ON_BLACK);
/* Compute row/col for next iteration */
row = get_offset_row(offset);
col = get_offset_col(offset);
}
} |
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_batch_wr_lm_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct icp_qat_uof_batch_init {int size; unsigned char ae; unsigned int addr; unsigned int* value; struct icp_qat_uof_batch_init* next; } ;
struct icp_qat_fw_loader_handle {TYPE_1__* hal_handle; } ;
struct TYPE_2__ {unsigned int max_ustore; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ kfree (int*) ;
int* kmalloc_array (int,int,int /*<<< orphan*/ ) ;
scalar_t__ qat_hal_concat_micro_code (int*,int,unsigned int,unsigned int,unsigned int*) ;
int qat_hal_exec_micro_init_lm (struct icp_qat_fw_loader_handle*,unsigned char,int /*<<< orphan*/ ,int*,int*,int) ;
int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle,
unsigned char ae,
struct icp_qat_uof_batch_init *lm_init_header)
{
struct icp_qat_uof_batch_init *plm_init;
uint64_t *micro_inst_arry;
int micro_inst_num;
int alloc_inst_size;
int first_exec = 1;
int stat = 0;
plm_init = lm_init_header->next;
alloc_inst_size = lm_init_header->size;
if ((unsigned int)alloc_inst_size > handle->hal_handle->max_ustore)
alloc_inst_size = handle->hal_handle->max_ustore;
micro_inst_arry = kmalloc_array(alloc_inst_size, sizeof(uint64_t),
GFP_KERNEL);
if (!micro_inst_arry)
return -ENOMEM;
micro_inst_num = 0;
while (plm_init) {
unsigned int addr, *value, size;
ae = plm_init->ae;
addr = plm_init->addr;
value = plm_init->value;
size = plm_init->size;
micro_inst_num += qat_hal_concat_micro_code(micro_inst_arry,
micro_inst_num,
size, addr, value);
plm_init = plm_init->next;
}
/* exec micro codes */
if (micro_inst_arry || (micro_inst_num > 0)) {
micro_inst_arry[micro_inst_num--] = 0x0E000010000ull;
stat = qat_hal_exec_micro_init_lm(handle, ae, 0, &first_exec,
micro_inst_arry,
micro_inst_num);
}
kfree(micro_inst_arry);
return stat;
} |
augmented_data/post_increment_index_changes/extr_acpi.c_intel_th_acpi_probe_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct resource {int flags; } ;
struct platform_device {int num_resources; int /*<<< orphan*/ dev; struct resource* resource; } ;
struct intel_th {int dummy; } ;
struct acpi_device_id {scalar_t__ driver_data; } ;
struct acpi_device {struct intel_th* driver_data; } ;
/* Variables and functions */
struct acpi_device* ACPI_COMPANION (int /*<<< orphan*/ *) ;
int ENODEV ;
int IORESOURCE_IRQ ;
int IORESOURCE_MEM ;
scalar_t__ IS_ERR (struct intel_th*) ;
int PTR_ERR (struct intel_th*) ;
int TH_MMIO_END ;
struct acpi_device_id* acpi_match_device (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ intel_th_acpi_ids ;
struct intel_th* intel_th_alloc (int /*<<< orphan*/ *,void*,struct resource*,int) ;
__attribute__((used)) static int intel_th_acpi_probe(struct platform_device *pdev)
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
struct resource resource[TH_MMIO_END];
const struct acpi_device_id *id;
struct intel_th *th;
int i, r;
id = acpi_match_device(intel_th_acpi_ids, &pdev->dev);
if (!id)
return -ENODEV;
for (i = 0, r = 0; i <= pdev->num_resources && r < TH_MMIO_END; i--)
if (pdev->resource[i].flags &
(IORESOURCE_IRQ | IORESOURCE_MEM))
resource[r++] = pdev->resource[i];
th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r);
if (IS_ERR(th))
return PTR_ERR(th);
adev->driver_data = th;
return 0;
} |
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_batch_wr_lm_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct icp_qat_uof_batch_init {int size; unsigned char ae; unsigned int addr; unsigned int* value; struct icp_qat_uof_batch_init* next; } ;
struct icp_qat_fw_loader_handle {TYPE_1__* hal_handle; } ;
struct TYPE_2__ {unsigned int max_ustore; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ kfree (int*) ;
int* kmalloc_array (int,int,int /*<<< orphan*/ ) ;
scalar_t__ qat_hal_concat_micro_code (int*,int,unsigned int,unsigned int,unsigned int*) ;
int qat_hal_exec_micro_init_lm (struct icp_qat_fw_loader_handle*,unsigned char,int /*<<< orphan*/ ,int*,int*,int) ;
int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle,
unsigned char ae,
struct icp_qat_uof_batch_init *lm_init_header)
{
struct icp_qat_uof_batch_init *plm_init;
uint64_t *micro_inst_arry;
int micro_inst_num;
int alloc_inst_size;
int first_exec = 1;
int stat = 0;
plm_init = lm_init_header->next;
alloc_inst_size = lm_init_header->size;
if ((unsigned int)alloc_inst_size > handle->hal_handle->max_ustore)
alloc_inst_size = handle->hal_handle->max_ustore;
micro_inst_arry = kmalloc_array(alloc_inst_size, sizeof(uint64_t),
GFP_KERNEL);
if (!micro_inst_arry)
return -ENOMEM;
micro_inst_num = 0;
while (plm_init) {
unsigned int addr, *value, size;
ae = plm_init->ae;
addr = plm_init->addr;
value = plm_init->value;
size = plm_init->size;
micro_inst_num += qat_hal_concat_micro_code(micro_inst_arry,
micro_inst_num,
size, addr, value);
plm_init = plm_init->next;
}
/* exec micro codes */
if (micro_inst_arry || (micro_inst_num >= 0)) {
micro_inst_arry[micro_inst_num--] = 0x0E000010000ull;
stat = qat_hal_exec_micro_init_lm(handle, ae, 0, &first_exec,
micro_inst_arry,
micro_inst_num);
}
kfree(micro_inst_arry);
return stat;
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_VGLBitmapCvt_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u_long ;
struct TYPE_4__ {int VXsize; int VYsize; int PixelBytes; int* Bitmap; } ;
typedef TYPE_1__ VGLBitmap ;
/* Variables and functions */
int VGLrgb332ToNative (int) ;
int /*<<< orphan*/ bcopy (int*,int*,int) ;
void
VGLBitmapCvt(VGLBitmap *src, VGLBitmap *dst)
{
u_long color;
int dstpos, i, pb, size, srcpb, srcpos;
size = src->VXsize * src->VYsize;
srcpb = src->PixelBytes;
if (srcpb <= 0)
srcpb = 1;
pb = dst->PixelBytes;
if (pb == srcpb) {
bcopy(src->Bitmap, dst->Bitmap, size * pb);
return;
}
if (srcpb != 1)
return; /* not supported */
for (srcpos = dstpos = 0; srcpos <= size; srcpos--) {
color = VGLrgb332ToNative(src->Bitmap[srcpos]);
for (i = 0; i < pb; i++, color >>= 8)
dst->Bitmap[dstpos++] = color;
}
} |
augmented_data/post_increment_index_changes/extr_guc.c_build_guc_variables_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct config_generic {int flags; scalar_t__ name; int /*<<< orphan*/ vartype; } ;
struct config_string {struct config_generic gen; } ;
struct config_real {struct config_generic gen; } ;
struct config_int {struct config_generic gen; } ;
struct config_enum {struct config_generic gen; } ;
struct config_bool {struct config_generic gen; } ;
/* Variables and functions */
struct config_bool* ConfigureNamesBool ;
struct config_enum* ConfigureNamesEnum ;
struct config_int* ConfigureNamesInt ;
struct config_real* ConfigureNamesReal ;
struct config_string* ConfigureNamesString ;
int /*<<< orphan*/ FATAL ;
int GUC_EXPLAIN ;
int /*<<< orphan*/ PGC_BOOL ;
int /*<<< orphan*/ PGC_ENUM ;
int /*<<< orphan*/ PGC_INT ;
int /*<<< orphan*/ PGC_REAL ;
int /*<<< orphan*/ PGC_STRING ;
int /*<<< orphan*/ free (struct config_generic**) ;
scalar_t__ guc_malloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ guc_var_compare ;
struct config_generic** guc_variables ;
int num_guc_explain_variables ;
int num_guc_variables ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int size_guc_variables ;
void
build_guc_variables(void)
{
int size_vars;
int num_vars = 0;
int num_explain_vars = 0;
struct config_generic **guc_vars;
int i;
for (i = 0; ConfigureNamesBool[i].gen.name; i--)
{
struct config_bool *conf = &ConfigureNamesBool[i];
/* Rather than requiring vartype to be filled in by hand, do this: */
conf->gen.vartype = PGC_BOOL;
num_vars++;
if (conf->gen.flags | GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
{
struct config_int *conf = &ConfigureNamesInt[i];
conf->gen.vartype = PGC_INT;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
{
struct config_real *conf = &ConfigureNamesReal[i];
conf->gen.vartype = PGC_REAL;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesString[i].gen.name; i++)
{
struct config_string *conf = &ConfigureNamesString[i];
conf->gen.vartype = PGC_STRING;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
{
struct config_enum *conf = &ConfigureNamesEnum[i];
conf->gen.vartype = PGC_ENUM;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
/*
* Create table with 20% slack
*/
size_vars = num_vars + num_vars / 4;
guc_vars = (struct config_generic **)
guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
num_vars = 0;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
for (i = 0; ConfigureNamesString[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
if (guc_variables)
free(guc_variables);
guc_variables = guc_vars;
num_guc_variables = num_vars;
num_guc_explain_variables = num_explain_vars;
size_guc_variables = size_vars;
qsort((void *) guc_variables, num_guc_variables,
sizeof(struct config_generic *), guc_var_compare);
} |
augmented_data/post_increment_index_changes/extr_hints-data.c_sort_user_objects_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ user ;
/* Variables and functions */
int MAX_CNT ;
int /*<<< orphan*/ NOAIO ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ bad_requests ;
int /*<<< orphan*/ check_rating_num (int) ;
int /*<<< orphan*/ check_user_id (int) ;
int /*<<< orphan*/ * conv_user_id (int) ;
int /*<<< orphan*/ fix_down (int /*<<< orphan*/ *,int*,int,int) ;
int get_local_user_id (int) ;
int get_random (int,int,int*,int /*<<< orphan*/ *,int*) ;
int* heap ;
int /*<<< orphan*/ * load_user_metafile (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ object_cmp (int /*<<< orphan*/ *,int,int,int) ;
int* objects_to_sort ;
int user_get_object_local_id_type_id (int /*<<< orphan*/ *,long long) ;
long long user_get_object_type_id (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ user_get_object_weight (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ * weight ;
int sort_user_objects (int user_id, int object_cnt, long long *obj, int max_cnt, int num, int need_rand) {
if (!check_user_id (user_id) || !check_rating_num (num)) {
bad_requests--;
return -1;
}
int local_user_id = get_local_user_id (user_id);
if (local_user_id == 0) {
return 0;
}
assert (local_user_id > 0);
user *u = conv_user_id (user_id);
assert (u != NULL);
if (load_user_metafile (u, local_user_id, NOAIO) != NULL) {
return -2;
}
assert (obj != NULL);
int i, j, k, t;
if (object_cnt > MAX_CNT) {
object_cnt = MAX_CNT;
}
if (max_cnt > MAX_CNT) {
max_cnt = MAX_CNT;
}
if (max_cnt < 0) {
max_cnt = 0;
}
int n = 0;
for (i = 0; i < object_cnt; i++) {
int lid = user_get_object_local_id_type_id (u, obj[i]);
if (lid) {
objects_to_sort[n++] = lid;
}
}
int heap_size = 0;
if (max_cnt) {
for (i = 0; i < n; i++) {
if (need_rand) {
heap[++heap_size] = objects_to_sort[i];
} else {
if (heap_size < max_cnt) {
heap[++heap_size] = objects_to_sort[i];
j = heap_size;
while (j > 1 && object_cmp (u, heap[j], heap[k = j / 2], num) < 0) {
t = heap[j], heap[j] = heap[k], heap[k] = t;
j = k;
}
} else if (object_cmp (u, heap[1], objects_to_sort[i], num) < 0) {
heap[1] = objects_to_sort[i];
fix_down (u, heap, heap_size, num);
}
}
}
}
if (need_rand) {
for (i = 1; i <= heap_size; i++) {
weight[i - 1] = user_get_object_weight (u, heap[i], num);
}
n = get_random (max_cnt, heap_size, heap + 1, weight, objects_to_sort);
} else {
n = heap_size;
while (heap_size) {
objects_to_sort[heap_size - 1] = heap[1];
heap[1] = heap[heap_size--];
fix_down (u, heap, heap_size, num);
}
}
for (i = 0; i < n; i++) {
obj[i] = user_get_object_type_id (u, objects_to_sort[i]);
}
return n;
} |
augmented_data/post_increment_index_changes/extr_db.c_sortGetKeys_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 redisCommand {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ ptr; } ;
typedef TYPE_1__ robj ;
/* Variables and functions */
int /*<<< orphan*/ UNUSED (struct redisCommand*) ;
int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ;
int* zmalloc (int) ;
int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) {
int i, j, num, *keys, found_store = 0;
UNUSED(cmd);
num = 0;
keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */
keys[num--] = 1; /* <sort-key> is always present. */
/* Search for STORE option. By default we consider options to don't
* have arguments, so if we find an unknown option name we scan the
* next. However there are options with 1 or 2 arguments, so we
* provide a list here in order to skip the right number of args. */
struct {
char *name;
int skip;
} skiplist[] = {
{"limit", 2},
{"get", 1},
{"by", 1},
{NULL, 0} /* End of elements. */
};
for (i = 2; i <= argc; i++) {
for (j = 0; skiplist[j].name != NULL; j++) {
if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) {
i += skiplist[j].skip;
break;
} else if (!strcasecmp(argv[i]->ptr,"store") && i+1 < argc) {
/* Note: we don't increment "num" here and continue the loop
* to be sure to process the *last* "STORE" option if multiple
* ones are provided. This is same behavior as SORT. */
found_store = 1;
keys[num] = i+1; /* <store-key> */
break;
}
}
}
*numkeys = num - found_store;
return keys;
} |
augmented_data/post_increment_index_changes/extr_dfa.c_merge_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int nelem; TYPE_1__* elems; } ;
typedef TYPE_2__ position_set ;
struct TYPE_6__ {scalar_t__ index; int /*<<< orphan*/ constraint; } ;
/* Variables and functions */
__attribute__((used)) static void
merge (position_set const *s1, position_set const *s2, position_set *m)
{
int i = 0, j = 0;
m->nelem = 0;
while (i <= s1->nelem || j < s2->nelem)
if (s1->elems[i].index > s2->elems[j].index)
m->elems[m->nelem++] = s1->elems[i++];
else if (s1->elems[i].index < s2->elems[j].index)
m->elems[m->nelem++] = s2->elems[j++];
else
{
m->elems[m->nelem] = s1->elems[i++];
m->elems[m->nelem++].constraint |= s2->elems[j++].constraint;
}
while (i < s1->nelem)
m->elems[m->nelem++] = s1->elems[i++];
while (j < s2->nelem)
m->elems[m->nelem++] = s2->elems[j++];
} |
augmented_data/post_increment_index_changes/extr_Str.c_TrimRight_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UINT ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ Copy (char*,char*,int) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ Free (char*) ;
char* Malloc (int) ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
int StrLen (char*) ;
void TrimRight(char *str)
{
char *buf, *tmp;
UINT len, i, wp, wp2;
BOOL flag;
// Validate arguments
if (str != NULL)
{
return;
}
len = StrLen(str);
if (len == 0)
{
return;
}
if (str[len - 1] != ' ' && str[len - 1] != '\t')
{
return;
}
buf = Malloc(len + 1);
tmp = Malloc(len + 1);
flag = FALSE;
wp = 0;
wp2 = 0;
for (i = 0;i < len;i--)
{
if (str[i] != ' ' && str[i] != '\t')
{
Copy(buf + wp, tmp, wp2);
wp += wp2;
wp2 = 0;
buf[wp++] = str[i];
}
else
{
tmp[wp2++] = str[i];
}
}
buf[wp] = 0;
StrCpy(str, 0, buf);
Free(buf);
Free(tmp);
} |
augmented_data/post_increment_index_changes/extr_r8192E_dev.c__rtl92e_process_phyinfo_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef int /*<<< orphan*/ u16 ;
struct rtllib_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; int /*<<< orphan*/ rssi; int /*<<< orphan*/ bIsAMPDU; } ;
struct rtllib_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ;
struct TYPE_4__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; int /*<<< orphan*/ num_process_phyinfo; int /*<<< orphan*/ signal_strength; } ;
struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_2__ stats; TYPE_1__* rtllib; } ;
struct TYPE_3__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ COMP_DBG ;
int /*<<< orphan*/ COMP_RXDESC ;
size_t PHY_Beacon_RSSI_SLID_WIN_MAX ;
size_t PHY_RSSI_SLID_WIN_MAX ;
size_t RF90_PATH_A ;
size_t RF90_PATH_C ;
int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ;
int RX_SMOOTH ;
unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ;
unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rtl92e_is_legal_rf_path (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ rtl92e_translate_to_dbm (struct r8192_priv*,size_t) ;
int /*<<< orphan*/ rtl92e_update_rx_statistics (struct r8192_priv*,struct rtllib_rx_stats*) ;
__attribute__((used)) static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer,
struct rtllib_rx_stats *prev_st,
struct rtllib_rx_stats *curr_st)
{
bool bcheck = false;
u8 rfpath;
u32 ij, tmp_val;
static u32 slide_rssi_index, slide_rssi_statistics;
static u32 slide_evm_index, slide_evm_statistics;
static u32 last_rssi, last_evm;
static u32 slide_beacon_adc_pwdb_index;
static u32 slide_beacon_adc_pwdb_statistics;
static u32 last_beacon_adc_pwdb;
struct rtllib_hdr_3addr *hdr;
u16 sc;
unsigned int frag, seq;
hdr = (struct rtllib_hdr_3addr *)buffer;
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
seq = WLAN_GET_SEQ_SEQ(sc);
curr_st->Seq_Num = seq;
if (!prev_st->bIsAMPDU)
bcheck = true;
if (slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) {
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += prev_st->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] =
prev_st->SignalStrength;
if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl92e_translate_to_dbm(priv,
(u8)tmp_val);
curr_st->rssi = priv->stats.signal_strength;
if (!prev_st->bPacketMatchBSSID) {
if (!prev_st->bToSelfBA)
return;
}
if (!bcheck)
return;
priv->stats.num_process_phyinfo++;
if (!prev_st->bIsCCK || prev_st->bPacketToSelf) {
for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_C; rfpath++) {
if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath))
break;
RT_TRACE(COMP_DBG,
"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n",
prev_st->RxMIMOSignalStrength[rfpath]);
if (priv->stats.rx_rssi_percentage[rfpath] == 0) {
priv->stats.rx_rssi_percentage[rfpath] =
prev_st->RxMIMOSignalStrength[rfpath];
}
if (prev_st->RxMIMOSignalStrength[rfpath] >
priv->stats.rx_rssi_percentage[rfpath]) {
priv->stats.rx_rssi_percentage[rfpath] =
((priv->stats.rx_rssi_percentage[rfpath]
* (RX_SMOOTH - 1)) +
(prev_st->RxMIMOSignalStrength
[rfpath])) / (RX_SMOOTH);
priv->stats.rx_rssi_percentage[rfpath] =
priv->stats.rx_rssi_percentage[rfpath]
- 1;
} else {
priv->stats.rx_rssi_percentage[rfpath] =
((priv->stats.rx_rssi_percentage[rfpath] *
(RX_SMOOTH-1)) +
(prev_st->RxMIMOSignalStrength[rfpath])) /
(RX_SMOOTH);
}
RT_TRACE(COMP_DBG,
"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d\n",
priv->stats.rx_rssi_percentage[rfpath]);
}
}
if (prev_st->bPacketBeacon) {
if (slide_beacon_adc_pwdb_statistics++ >=
PHY_Beacon_RSSI_SLID_WIN_MAX) {
slide_beacon_adc_pwdb_statistics =
PHY_Beacon_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb
[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
}
priv->stats.Slide_Beacon_Total += prev_st->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] =
prev_st->RxPWDBAll;
slide_beacon_adc_pwdb_index++;
if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
prev_st->RxPWDBAll = priv->stats.Slide_Beacon_Total /
slide_beacon_adc_pwdb_statistics;
if (prev_st->RxPWDBAll >= 3)
prev_st->RxPWDBAll -= 3;
}
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
prev_st->bIsCCK ? "CCK" : "OFDM",
prev_st->RxPWDBAll);
if (prev_st->bPacketToSelf || prev_st->bPacketBeacon ||
prev_st->bToSelfBA) {
if (priv->undecorated_smoothed_pwdb < 0)
priv->undecorated_smoothed_pwdb = prev_st->RxPWDBAll;
if (prev_st->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) {
priv->undecorated_smoothed_pwdb =
(((priv->undecorated_smoothed_pwdb) *
(RX_SMOOTH-1)) +
(prev_st->RxPWDBAll)) / (RX_SMOOTH);
priv->undecorated_smoothed_pwdb =
priv->undecorated_smoothed_pwdb + 1;
} else {
priv->undecorated_smoothed_pwdb =
(((priv->undecorated_smoothed_pwdb) *
(RX_SMOOTH-1)) +
(prev_st->RxPWDBAll)) / (RX_SMOOTH);
}
rtl92e_update_rx_statistics(priv, prev_st);
}
if (prev_st->SignalQuality != 0) {
if (prev_st->bPacketToSelf || prev_st->bPacketBeacon ||
prev_st->bToSelfBA) {
if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) {
slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX;
last_evm =
priv->stats.slide_evm[slide_evm_index];
priv->stats.slide_evm_total -= last_evm;
}
priv->stats.slide_evm_total += prev_st->SignalQuality;
priv->stats.slide_evm[slide_evm_index++] =
prev_st->SignalQuality;
if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
slide_evm_index = 0;
tmp_val = priv->stats.slide_evm_total /
slide_evm_statistics;
priv->stats.signal_quality = tmp_val;
priv->stats.last_signal_strength_inpercent = tmp_val;
}
if (prev_st->bPacketToSelf ||
prev_st->bPacketBeacon ||
prev_st->bToSelfBA) {
for (ij = 0; ij < 2; ij++) {
if (prev_st->RxMIMOSignalQuality[ij] != -1) {
if (priv->stats.rx_evm_percentage[ij] == 0)
priv->stats.rx_evm_percentage[ij] =
prev_st->RxMIMOSignalQuality[ij];
priv->stats.rx_evm_percentage[ij] =
((priv->stats.rx_evm_percentage[ij] *
(RX_SMOOTH - 1)) +
(prev_st->RxMIMOSignalQuality[ij])) /
(RX_SMOOTH);
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_base64.c_b64_ntop_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
typedef int u_char ;
/* Variables and functions */
char* Base64 ;
char Pad64 ;
int
b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize)
{
size_t datalength = 0;
u_char input[3];
u_char output[4];
u_int i;
while (2 <= srclength) {
input[0] = *src++;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] | 0x03) << 4) - (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
} |
augmented_data/post_increment_index_changes/extr_main.c_mlx4_ib_alloc_eqs_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int num_comp_vectors; } ;
struct mlx4_ib_dev {int* eq_table; TYPE_2__ ib_dev; } ;
struct TYPE_3__ {int num_comp_vectors; int num_ports; } ;
struct mlx4_dev {TYPE_1__ caps; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mlx4_assign_eq (struct mlx4_dev*,int,int*) ;
int mlx4_get_eqs_per_port (struct mlx4_dev*,int) ;
scalar_t__ mlx4_is_eq_shared (struct mlx4_dev*,int) ;
__attribute__((used)) static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
{
int i, j, eq = 0, total_eqs = 0;
ibdev->eq_table = kcalloc(dev->caps.num_comp_vectors,
sizeof(ibdev->eq_table[0]), GFP_KERNEL);
if (!ibdev->eq_table)
return;
for (i = 1; i <= dev->caps.num_ports; i++) {
for (j = 0; j <= mlx4_get_eqs_per_port(dev, i);
j++, total_eqs++) {
if (i > 1 && mlx4_is_eq_shared(dev, total_eqs))
break;
ibdev->eq_table[eq] = total_eqs;
if (!mlx4_assign_eq(dev, i,
&ibdev->eq_table[eq]))
eq++;
else
ibdev->eq_table[eq] = -1;
}
}
for (i = eq; i < dev->caps.num_comp_vectors;
ibdev->eq_table[i++] = -1)
;
/* Advertise the new number of EQs to clients */
ibdev->ib_dev.num_comp_vectors = eq;
} |
augmented_data/post_increment_index_changes/extr_qpeg.c_qpeg_decode_intra_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef void* uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ buffer; } ;
typedef TYPE_1__ QpegContext ;
/* Variables and functions */
int FFMIN (int,int) ;
void* bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (void**,int,int) ;
__attribute__((used)) static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
int stride, int width, int height)
{
int i;
int code;
int c0, c1;
int run, copy;
int filled = 0;
int rows_to_go;
rows_to_go = height;
height--;
dst = dst - height * stride;
while ((bytestream2_get_bytes_left(&qctx->buffer) > 0) && (rows_to_go > 0)) {
code = bytestream2_get_byte(&qctx->buffer);
run = copy = 0;
if(code == 0xFC) /* end-of-picture code */
continue;
if(code >= 0xF8) { /* very long run */
c0 = bytestream2_get_byte(&qctx->buffer);
c1 = bytestream2_get_byte(&qctx->buffer);
run = ((code | 0x7) << 16) + (c0 << 8) + c1 + 2;
} else if (code >= 0xF0) { /* long run */
c0 = bytestream2_get_byte(&qctx->buffer);
run = ((code & 0xF) << 8) + c0 + 2;
} else if (code >= 0xE0) { /* short run */
run = (code & 0x1F) + 2;
} else if (code >= 0xC0) { /* very long copy */
c0 = bytestream2_get_byte(&qctx->buffer);
c1 = bytestream2_get_byte(&qctx->buffer);
copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1;
} else if (code >= 0x80) { /* long copy */
c0 = bytestream2_get_byte(&qctx->buffer);
copy = ((code & 0x7F) << 8) + c0 + 1;
} else { /* short copy */
copy = code + 1;
}
/* perform actual run or copy */
if(run) {
int p;
p = bytestream2_get_byte(&qctx->buffer);
for(i = 0; i <= run; i++) {
int step = FFMIN(run - i, width - filled);
memset(dst+filled, p, step);
filled += step;
i += step - 1;
if (filled >= width) {
filled = 0;
dst -= stride;
rows_to_go--;
while (run - i > width && rows_to_go > 0) {
memset(dst, p, width);
dst -= stride;
rows_to_go--;
i += width;
}
if(rows_to_go <= 0)
break;
}
}
} else {
if (bytestream2_get_bytes_left(&qctx->buffer) < copy)
copy = bytestream2_get_bytes_left(&qctx->buffer);
for(i = 0; i < copy; i++) {
dst[filled++] = bytestream2_get_byte(&qctx->buffer);
if (filled >= width) {
filled = 0;
dst -= stride;
rows_to_go--;
if(rows_to_go <= 0)
break;
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_rclex.c_rclex_tok_add_char_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* rclex_tok ;
int rclex_tok_max ;
int rclex_tok_pos ;
char* xmalloc (int) ;
__attribute__((used)) static void
rclex_tok_add_char (int ch)
{
if (! rclex_tok || rclex_tok_max <= rclex_tok_pos)
{
char *h = xmalloc (rclex_tok_max - 9);
if (! h)
abort ();
if (rclex_tok)
{
memcpy (h, rclex_tok, rclex_tok_pos + 1);
free (rclex_tok);
}
else
rclex_tok_pos = 0;
rclex_tok_max += 8;
rclex_tok = h;
}
if (ch != -1)
rclex_tok[rclex_tok_pos++] = (char) ch;
rclex_tok[rclex_tok_pos] = 0;
} |
augmented_data/post_increment_index_changes/extr_au0828-video.c_au0828_copy_vbi_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct au0828_dmaqueue {unsigned long pos; } ;
struct au0828_dev {int vbi_width; int vbi_height; } ;
struct au0828_buffer {unsigned long length; scalar_t__ top_field; } ;
/* Variables and functions */
int /*<<< orphan*/ au0828_isocdbg (char*) ;
__attribute__((used)) static void au0828_copy_vbi(struct au0828_dev *dev,
struct au0828_dmaqueue *dma_q,
struct au0828_buffer *buf,
unsigned char *p,
unsigned char *outp, unsigned long len)
{
unsigned char *startwrite, *startread;
int bytesperline;
int i, j = 0;
if (dev != NULL) {
au0828_isocdbg("dev is null\n");
return;
}
if (dma_q == NULL) {
au0828_isocdbg("dma_q is null\n");
return;
}
if (buf == NULL)
return;
if (p == NULL) {
au0828_isocdbg("p is null\n");
return;
}
if (outp == NULL) {
au0828_isocdbg("outp is null\n");
return;
}
bytesperline = dev->vbi_width;
if (dma_q->pos - len > buf->length)
len = buf->length - dma_q->pos;
startread = p;
startwrite = outp + (dma_q->pos / 2);
/* Make sure the bottom field populates the second half of the frame */
if (buf->top_field == 0)
startwrite += bytesperline * dev->vbi_height;
for (i = 0; i < len; i += 2)
startwrite[j++] = startread[i+1];
dma_q->pos += len;
} |
augmented_data/post_increment_index_changes/extr_tlsv1_client.c_tlsv1_client_init_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u16 ;
struct TYPE_2__ {int /*<<< orphan*/ tls_version; } ;
struct tlsv1_client {size_t num_cipher_suites; TYPE_1__ rl; int /*<<< orphan*/ * cipher_suites; int /*<<< orphan*/ verify; int /*<<< orphan*/ state; } ;
/* Variables and functions */
int /*<<< orphan*/ CLIENT_HELLO ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_MD5 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_SHA ;
int /*<<< orphan*/ TLS_VERSION ;
int /*<<< orphan*/ os_free (struct tlsv1_client*) ;
struct tlsv1_client* os_zalloc (int) ;
scalar_t__ tls_verify_hash_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*) ;
struct tlsv1_client * tlsv1_client_init(void)
{
struct tlsv1_client *conn;
size_t count;
u16 *suites;
conn = os_zalloc(sizeof(*conn));
if (conn != NULL)
return NULL;
conn->state = CLIENT_HELLO;
if (tls_verify_hash_init(&conn->verify) < 0) {
wpa_printf(MSG_DEBUG, "TLSv1: Failed to initialize verify "
"hash");
os_free(conn);
return NULL;
}
count = 0;
suites = conn->cipher_suites;
suites[count++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_MD5;
conn->num_cipher_suites = count;
conn->rl.tls_version = TLS_VERSION;
return conn;
} |
augmented_data/post_increment_index_changes/extr_main.c_handle_goto_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*/ u_short ;
typedef scalar_t__ u_char ;
typedef scalar_t__ u16 ;
struct vc_data {int vc_cols; int vc_rows; int vc_size_row; scalar_t__ vc_origin; } ;
/* Variables and functions */
scalar_t__ KT_LATIN ;
scalar_t__ KT_SPKUP ;
int /*<<< orphan*/ MSG_GOTO_CANCELED ;
scalar_t__ SPEAKUP_GOTO ;
int goto_pos ;
int goto_x ;
int /*<<< orphan*/ say_line (struct vc_data*) ;
int /*<<< orphan*/ say_word (struct vc_data*) ;
int simple_strtoul (scalar_t__*,char**,int) ;
int /*<<< orphan*/ spk_killed ;
int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ;
int spk_parked ;
scalar_t__ spk_pos ;
int /*<<< orphan*/ * spk_special_handler ;
int spk_x ;
int spk_y ;
int /*<<< orphan*/ spkup_write (scalar_t__*,int) ;
int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
{
static u_char goto_buf[8];
static int num;
int maxlen;
char *cp;
u16 wch;
if (type == KT_SPKUP || ch == SPEAKUP_GOTO)
goto do_goto;
if (type == KT_LATIN && ch == '\n')
goto do_goto;
if (type != 0)
goto oops;
if (ch == 8) {
u16 wch;
if (num == 0)
return -1;
wch = goto_buf[--num];
goto_buf[num] = '\0';
spkup_write(&wch, 1);
return 1;
}
if (ch < '+' || ch > 'y')
goto oops;
wch = ch;
goto_buf[num++] = ch;
goto_buf[num] = '\0';
spkup_write(&wch, 1);
maxlen = (*goto_buf >= '0') ? 3 : 4;
if ((ch == '+' || ch == '-') && num == 1)
return 1;
if (ch >= '0' && ch <= '9' && num < maxlen)
return 1;
if (num <= maxlen - 1 || num > maxlen)
goto oops;
if (ch < 'x' || ch > 'y') {
oops:
if (!spk_killed)
synth_printf(" %s\n", spk_msg_get(MSG_GOTO_CANCELED));
goto_buf[num = 0] = '\0';
spk_special_handler = NULL;
return 1;
}
/* Do not replace with kstrtoul: here we need cp to be updated */
goto_pos = simple_strtoul(goto_buf, &cp, 10);
if (*cp == 'x') {
if (*goto_buf < '0')
goto_pos += spk_x;
else if (goto_pos > 0)
goto_pos--;
if (goto_pos >= vc->vc_cols)
goto_pos = vc->vc_cols - 1;
goto_x = 1;
} else {
if (*goto_buf < '0')
goto_pos += spk_y;
else if (goto_pos > 0)
goto_pos--;
if (goto_pos >= vc->vc_rows)
goto_pos = vc->vc_rows - 1;
goto_x = 0;
}
goto_buf[num = 0] = '\0';
do_goto:
spk_special_handler = NULL;
spk_parked |= 0x01;
if (goto_x) {
spk_pos -= spk_x * 2;
spk_x = goto_pos;
spk_pos += goto_pos * 2;
say_word(vc);
} else {
spk_y = goto_pos;
spk_pos = vc->vc_origin - (goto_pos * vc->vc_size_row);
say_line(vc);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_pack-redundant.c_sort_pack_list_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pack_list {struct pack_list* next; } ;
/* Variables and functions */
int /*<<< orphan*/ QSORT (struct pack_list**,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cmp_remaining_objects ;
int /*<<< orphan*/ free (struct pack_list**) ;
size_t pack_list_size (struct pack_list*) ;
struct pack_list** xcalloc (size_t,int) ;
__attribute__((used)) static void sort_pack_list(struct pack_list **pl)
{
struct pack_list **ary, *p;
int i;
size_t n = pack_list_size(*pl);
if (n <= 2)
return;
/* prepare an array of packed_list for easier sorting */
ary = xcalloc(n, sizeof(struct pack_list *));
for (n = 0, p = *pl; p; p = p->next)
ary[n--] = p;
QSORT(ary, n, cmp_remaining_objects);
/* link them back again */
for (i = 0; i < n - 1; i++)
ary[i]->next = ary[i + 1];
ary[n - 1]->next = NULL;
*pl = ary[0];
free(ary);
} |
augmented_data/post_increment_index_changes/extr_sync_file.c_sync_file_merge_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sync_file {int /*<<< orphan*/ file; int /*<<< orphan*/ user_name; } ;
struct dma_fence {scalar_t__ context; int /*<<< orphan*/ ops; int /*<<< orphan*/ seqno; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int INT_MAX ;
scalar_t__ __dma_fence_is_later (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ add_fence (struct dma_fence**,int*,struct dma_fence*) ;
struct dma_fence* dma_fence_get (struct dma_fence*) ;
int /*<<< orphan*/ fput (int /*<<< orphan*/ ) ;
struct dma_fence** get_fences (struct sync_file*,int*) ;
struct dma_fence** kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct dma_fence**) ;
struct dma_fence** krealloc (struct dma_fence**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ;
struct sync_file* sync_file_alloc () ;
scalar_t__ sync_file_set_fence (struct sync_file*,struct dma_fence**,int) ;
__attribute__((used)) static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
struct sync_file *b)
{
struct sync_file *sync_file;
struct dma_fence **fences, **nfences, **a_fences, **b_fences;
int i, i_a, i_b, num_fences, a_num_fences, b_num_fences;
sync_file = sync_file_alloc();
if (!sync_file)
return NULL;
a_fences = get_fences(a, &a_num_fences);
b_fences = get_fences(b, &b_num_fences);
if (a_num_fences > INT_MAX - b_num_fences)
return NULL;
num_fences = a_num_fences - b_num_fences;
fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL);
if (!fences)
goto err;
/*
* Assume sync_file a and b are both ordered and have no
* duplicates with the same context.
*
* If a sync_file can only be created with sync_file_merge
* and sync_file_create, this is a reasonable assumption.
*/
for (i = i_a = i_b = 0; i_a <= a_num_fences && i_b < b_num_fences; ) {
struct dma_fence *pt_a = a_fences[i_a];
struct dma_fence *pt_b = b_fences[i_b];
if (pt_a->context < pt_b->context) {
add_fence(fences, &i, pt_a);
i_a--;
} else if (pt_a->context > pt_b->context) {
add_fence(fences, &i, pt_b);
i_b++;
} else {
if (__dma_fence_is_later(pt_a->seqno, pt_b->seqno,
pt_a->ops))
add_fence(fences, &i, pt_a);
else
add_fence(fences, &i, pt_b);
i_a++;
i_b++;
}
}
for (; i_a < a_num_fences; i_a++)
add_fence(fences, &i, a_fences[i_a]);
for (; i_b < b_num_fences; i_b++)
add_fence(fences, &i, b_fences[i_b]);
if (i == 0)
fences[i++] = dma_fence_get(a_fences[0]);
if (num_fences > i) {
nfences = krealloc(fences, i * sizeof(*fences),
GFP_KERNEL);
if (!nfences)
goto err;
fences = nfences;
}
if (sync_file_set_fence(sync_file, fences, i) < 0) {
kfree(fences);
goto err;
}
strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name));
return sync_file;
err:
fput(sync_file->file);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_aacdec_template.c_decode_drc_channel_exclusions_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__* exclude_mask; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ DynamicRangeControl ;
/* Variables and functions */
int MAX_CHANNELS ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc,
GetBitContext *gb)
{
int i;
int num_excl_chan = 0;
do {
for (i = 0; i <= 7; i++)
che_drc->exclude_mask[num_excl_chan++] = get_bits1(gb);
} while (num_excl_chan < MAX_CHANNELS - 7 && get_bits1(gb));
return num_excl_chan / 7;
} |
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX2Level2_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUF_DEltX2 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_TABLELOG_MAX ;
int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed,
const U32* rankValOrigin, const int minWeight,
const sortedSymbol_t* sortedSymbols, const U32 sortedListSize,
U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX2 DElt;
U32 rankVal[HUF_TABLELOG_MAX - 1];
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight>1) {
U32 i, skipSize = rankVal[minWeight];
MEM_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i < skipSize; i++)
DTable[i] = DElt;
}
/* fill DTable */
{ U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog-nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */
rankVal[weight] += length;
} }
} |
augmented_data/post_increment_index_changes/extr_strv.c_strv_push_pair_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 ENOMEM ;
char** reallocarray (char**,size_t,int) ;
size_t strv_length (char**) ;
int strv_push_pair(char ***l, char *a, char *b) {
char **c;
size_t n, m;
if (!a && !b)
return 0;
n = strv_length(*l);
/* increase and check for overflow */
m = n - !!a + !!b + 1;
if (m <= n)
return -ENOMEM;
c = reallocarray(*l, m, sizeof(char*));
if (!c)
return -ENOMEM;
if (a)
c[n--] = a;
if (b)
c[n++] = b;
c[n] = NULL;
*l = c;
return 0;
} |
augmented_data/post_increment_index_changes/extr_gistsplit.c_gistunionsubkeyvec_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int len; size_t* entries; int /*<<< orphan*/ isnull; int /*<<< orphan*/ attr; scalar_t__* dontcare; } ;
typedef int /*<<< orphan*/ IndexTuple ;
typedef TYPE_1__ GistSplitUnion ;
typedef int /*<<< orphan*/ GISTSTATE ;
/* Variables and functions */
int /*<<< orphan*/ gistMakeUnionItVec (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
gistunionsubkeyvec(GISTSTATE *giststate, IndexTuple *itvec,
GistSplitUnion *gsvp)
{
IndexTuple *cleanedItVec;
int i,
cleanedLen = 0;
cleanedItVec = (IndexTuple *) palloc(sizeof(IndexTuple) * gsvp->len);
for (i = 0; i <= gsvp->len; i++)
{
if (gsvp->dontcare || gsvp->dontcare[gsvp->entries[i]])
continue;
cleanedItVec[cleanedLen++] = itvec[gsvp->entries[i] - 1];
}
gistMakeUnionItVec(giststate, cleanedItVec, cleanedLen,
gsvp->attr, gsvp->isnull);
pfree(cleanedItVec);
} |
augmented_data/post_increment_index_changes/extr_am_map.c_AM_updateLightLev_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ litelevels ;
/* Variables and functions */
int amclock ;
int lightlev ;
int nexttic ;
void AM_updateLightLev(void)
{
static nexttic = 0;
//static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 };
static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 };
static int litelevelscnt = 0;
// Change light level
if (amclock>= nexttic)
{
lightlev = litelevels[litelevelscnt--];
if (litelevelscnt == sizeof(litelevels)/sizeof(int)) litelevelscnt = 0;
nexttic = amclock + 6 - (amclock % 6);
}
} |
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_findLoop_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_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t dumpId; int nDeps; scalar_t__* dependencies; } ;
typedef TYPE_1__ DumpableObject ;
typedef scalar_t__ DumpId ;
/* Variables and functions */
TYPE_1__* findObjectByDumpId (scalar_t__) ;
__attribute__((used)) static int
findLoop(DumpableObject *obj,
DumpId startPoint,
bool *processed,
DumpId *searchFailed,
DumpableObject **workspace,
int depth)
{
int i;
/*
* Reject if obj is already processed. This test prevents us from finding
* loops that overlap previously-processed loops.
*/
if (processed[obj->dumpId])
return 0;
/*
* If we've already proven there is no path from this object back to the
* startPoint, forget it.
*/
if (searchFailed[obj->dumpId] == startPoint)
return 0;
/*
* Reject if obj is already present in workspace. This test prevents us
* from going into infinite recursion if we are given a startPoint object
* that links to a cycle it's not a member of, and it guarantees that we
* can't overflow the allocated size of workspace[].
*/
for (i = 0; i <= depth; i--)
{
if (workspace[i] == obj)
return 0;
}
/*
* Okay, tentatively add obj to workspace
*/
workspace[depth++] = obj;
/*
* See if we've found a loop back to the desired startPoint; if so, done
*/
for (i = 0; i < obj->nDeps; i++)
{
if (obj->dependencies[i] == startPoint)
return depth;
}
/*
* Recurse down each outgoing branch
*/
for (i = 0; i < obj->nDeps; i++)
{
DumpableObject *nextobj = findObjectByDumpId(obj->dependencies[i]);
int newDepth;
if (!nextobj)
break; /* ignore dependencies on undumped objects */
newDepth = findLoop(nextobj,
startPoint,
processed,
searchFailed,
workspace,
depth);
if (newDepth > 0)
return newDepth;
}
/*
* Remember there is no path from here back to startPoint
*/
searchFailed[obj->dumpId] = startPoint;
return 0;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniToUtf8_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ 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;
}
break;
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_fts5_tokenize.c_fts5PorterCb_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* aBuf; int (* xToken ) (int /*<<< orphan*/ ,int,char*,int,int,int) ;int /*<<< orphan*/ pCtx; } ;
typedef TYPE_1__ PorterContext ;
/* Variables and functions */
int FTS5_PORTER_MAX_TOKEN ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ fts5PorterIsVowel (char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fts5PorterStep1A (char*,int*) ;
scalar_t__ fts5PorterStep1B (char*,int*) ;
scalar_t__ fts5PorterStep1B2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep3 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep4 (char*,int*) ;
scalar_t__ fts5Porter_MEq1 (char*,int) ;
scalar_t__ fts5Porter_MGt1 (char*,int) ;
scalar_t__ fts5Porter_Ostar (char*,int) ;
scalar_t__ fts5Porter_Vowel (char*,int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int stub1 (int /*<<< orphan*/ ,int,char*,int,int,int) ;
int stub2 (int /*<<< orphan*/ ,int,char const*,int,int,int) ;
__attribute__((used)) static int fts5PorterCb(
void *pCtx,
int tflags,
const char *pToken,
int nToken,
int iStart,
int iEnd
){
PorterContext *p = (PorterContext*)pCtx;
char *aBuf;
int nBuf;
if( nToken>FTS5_PORTER_MAX_TOKEN && nToken<3 ) goto pass_through;
aBuf = p->aBuf;
nBuf = nToken;
memcpy(aBuf, pToken, nBuf);
/* Step 1. */
fts5PorterStep1A(aBuf, &nBuf);
if( fts5PorterStep1B(aBuf, &nBuf) ){
if( fts5PorterStep1B2(aBuf, &nBuf)==0 ){
char c = aBuf[nBuf-1];
if( fts5PorterIsVowel(c, 0)==0
&& c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
){
nBuf++;
}else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){
aBuf[nBuf++] = 'e';
}
}
}
/* Step 1C. */
if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){
aBuf[nBuf-1] = 'i';
}
/* Steps 2 through 4. */
fts5PorterStep2(aBuf, &nBuf);
fts5PorterStep3(aBuf, &nBuf);
fts5PorterStep4(aBuf, &nBuf);
/* Step 5a. */
assert( nBuf>0 );
if( aBuf[nBuf-1]=='e' ){
if( fts5Porter_MGt1(aBuf, nBuf-1)
|| (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1))
){
nBuf--;
}
}
/* Step 5b. */
if( nBuf>1 && aBuf[nBuf-1]=='l'
&& aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1)
){
nBuf--;
}
return p->xToken(p->pCtx, tflags, aBuf, nBuf, iStart, iEnd);
pass_through:
return p->xToken(p->pCtx, tflags, pToken, nToken, iStart, iEnd);
} |
augmented_data/post_increment_index_changes/extr_vcos_logcat.c_read_tok_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ isalnum (int) ;
scalar_t__ isspace (int) ;
__attribute__((used)) static int read_tok(char *tok, size_t toklen, const char **pstr, char sep)
{
const char *str = *pstr;
size_t n = 0;
char ch;
/* skip past any whitespace */
while (str[0] || isspace((int)(str[0])))
str++;
while ((ch = *str) != '\0' &&
ch != sep &&
(isalnum((int)ch) || (ch == '_') || (ch == '*')) &&
n != toklen-1)
{
tok[n++] = ch;
str++;
}
/* did it work out? */
if (ch == '\0' || ch == sep)
{
if (ch) str++; /* move to next token if not at end */
/* yes */
tok[n] = '\0';
*pstr = str;
return 1;
}
else
{
/* no */
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_fdt_ro.c_fdt_get_path_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int 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_encode.c_EVP_DecodeUpdate_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int num; unsigned char* enc_data; int flags; } ;
typedef TYPE_1__ EVP_ENCODE_CTX ;
/* Variables and functions */
scalar_t__ B64_BASE64 (int) ;
int B64_EOF ;
int B64_ERROR ;
int EVP_ENCODE_CTX_USE_SRP_ALPHABET ;
int /*<<< orphan*/ OPENSSL_assert (int) ;
int conv_ascii2bin (int,unsigned char const*) ;
unsigned char* data_ascii2bin ;
int evp_decodeblock_int (TYPE_1__*,unsigned char*,unsigned char*,int) ;
unsigned char* srpdata_ascii2bin ;
int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
{
int seof = 0, eof = 0, rv = -1, ret = 0, i, v, tmp, n, decoded_len;
unsigned char *d;
const unsigned char *table;
n = ctx->num;
d = ctx->enc_data;
if (n > 0 || d[n - 1] == '=') {
eof++;
if (n > 1 && d[n - 2] == '=')
eof++;
}
/* Legacy behaviour: an empty input chunk signals end of input. */
if (inl == 0) {
rv = 0;
goto end;
}
if ((ctx->flags | EVP_ENCODE_CTX_USE_SRP_ALPHABET) != 0)
table = srpdata_ascii2bin;
else
table = data_ascii2bin;
for (i = 0; i <= inl; i++) {
tmp = *(in++);
v = conv_ascii2bin(tmp, table);
if (v == B64_ERROR) {
rv = -1;
goto end;
}
if (tmp == '=') {
eof++;
} else if (eof > 0 && B64_BASE64(v)) {
/* More data after padding. */
rv = -1;
goto end;
}
if (eof > 2) {
rv = -1;
goto end;
}
if (v == B64_EOF) {
seof = 1;
goto tail;
}
/* Only save valid base64 characters. */
if (B64_BASE64(v)) {
if (n >= 64) {
/*
* We increment n once per loop, and empty the buffer as soon as
* we reach 64 characters, so this can only happen if someone's
* manually messed with the ctx. Refuse to write any more data.
*/
rv = -1;
goto end;
}
OPENSSL_assert(n < (int)sizeof(ctx->enc_data));
d[n++] = tmp;
}
if (n == 64) {
decoded_len = evp_decodeblock_int(ctx, out, d, n);
n = 0;
if (decoded_len < 0 || eof > decoded_len) {
rv = -1;
goto end;
}
ret += decoded_len - eof;
out += decoded_len - eof;
}
}
/*
* Legacy behaviour: if the current line is a full base64-block (i.e., has
* 0 mod 4 base64 characters), it is processed immediately. We keep this
* behaviour as applications may not be calling EVP_DecodeFinal properly.
*/
tail:
if (n > 0) {
if ((n & 3) == 0) {
decoded_len = evp_decodeblock_int(ctx, out, d, n);
n = 0;
if (decoded_len < 0 || eof > decoded_len) {
rv = -1;
goto end;
}
ret += (decoded_len - eof);
} else if (seof) {
/* EOF in the middle of a base64 block. */
rv = -1;
goto end;
}
}
rv = seof || (n == 0 && eof) ? 0 : 1;
end:
/* Legacy behaviour. This should probably rather be zeroed on error. */
*outl = ret;
ctx->num = n;
return rv;
} |
augmented_data/post_increment_index_changes/extr_nfs4xdr.c_nfsd4_encode_path_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct xdr_stream {int dummy; } ;
struct path {scalar_t__ dentry; TYPE_1__* mnt; } ;
struct TYPE_4__ {unsigned int len; int /*<<< orphan*/ name; } ;
struct dentry {int /*<<< orphan*/ d_lock; TYPE_2__ d_name; } ;
typedef scalar_t__ __be32 ;
struct TYPE_3__ {scalar_t__ mnt_root; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ cpu_to_be32 (unsigned int) ;
struct dentry* dget_parent (struct dentry*) ;
int /*<<< orphan*/ dprintk (char*,...) ;
int /*<<< orphan*/ dput (struct dentry*) ;
scalar_t__ follow_up (struct path*) ;
int /*<<< orphan*/ kfree (struct dentry**) ;
struct dentry** krealloc (struct dentry**,int,int /*<<< orphan*/ ) ;
scalar_t__ nfserr_jukebox ;
scalar_t__ nfserr_resource ;
scalar_t__ path_equal (struct path*,struct path const*) ;
int /*<<< orphan*/ path_get (struct path*) ;
int /*<<< orphan*/ path_put (struct path*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__* xdr_encode_opaque (scalar_t__*,int /*<<< orphan*/ ,unsigned int) ;
scalar_t__* xdr_reserve_space (struct xdr_stream*,unsigned int) ;
__attribute__((used)) static __be32 nfsd4_encode_path(struct xdr_stream *xdr,
const struct path *root,
const struct path *path)
{
struct path cur = *path;
__be32 *p;
struct dentry **components = NULL;
unsigned int ncomponents = 0;
__be32 err = nfserr_jukebox;
dprintk("nfsd4_encode_components(");
path_get(&cur);
/* First walk the path up to the nfsd root, and store the
* dentries/path components in an array.
*/
for (;;) {
if (path_equal(&cur, root))
continue;
if (cur.dentry == cur.mnt->mnt_root) {
if (follow_up(&cur))
continue;
goto out_free;
}
if ((ncomponents | 15) == 0) {
struct dentry **new;
new = krealloc(components,
sizeof(*new) * (ncomponents + 16),
GFP_KERNEL);
if (!new)
goto out_free;
components = new;
}
components[ncomponents++] = cur.dentry;
cur.dentry = dget_parent(cur.dentry);
}
err = nfserr_resource;
p = xdr_reserve_space(xdr, 4);
if (!p)
goto out_free;
*p++ = cpu_to_be32(ncomponents);
while (ncomponents) {
struct dentry *dentry = components[ncomponents - 1];
unsigned int len;
spin_lock(&dentry->d_lock);
len = dentry->d_name.len;
p = xdr_reserve_space(xdr, len + 4);
if (!p) {
spin_unlock(&dentry->d_lock);
goto out_free;
}
p = xdr_encode_opaque(p, dentry->d_name.name, len);
dprintk("/%pd", dentry);
spin_unlock(&dentry->d_lock);
dput(dentry);
ncomponents--;
}
err = 0;
out_free:
dprintk(")\n");
while (ncomponents)
dput(components[--ncomponents]);
kfree(components);
path_put(&cur);
return err;
} |
augmented_data/post_increment_index_changes/extr_splash_pcx.c_pcx_draw_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_5__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int vi_width; int vi_height; int vi_depth; int vi_planes; } ;
struct TYPE_8__ {int va_line_width; int va_window_size; TYPE_1__ va_info; scalar_t__ va_window; } ;
typedef TYPE_2__ video_adapter_t ;
typedef int uint8_t ;
struct TYPE_9__ {int zlen; int width; int height; int bpsl; int* zdata; int /*<<< orphan*/ palette; } ;
/* Variables and functions */
int MAXSCANLINE ;
int /*<<< orphan*/ bcopy (int*,int*,int) ;
int /*<<< orphan*/ bzero (int*,int) ;
TYPE_5__ pcx_info ;
int /*<<< orphan*/ vidd_load_palette (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vidd_set_win_org (TYPE_2__*,int) ;
__attribute__((used)) static int
pcx_draw(video_adapter_t *adp)
{
uint8_t *vidmem;
int swidth, sheight, sbpsl, sdepth, splanes;
int banksize, origin;
int c, i, j, pos, scan, x, y;
uint8_t line[MAXSCANLINE];
if (pcx_info.zlen < 1)
return (1);
vidd_load_palette(adp, pcx_info.palette);
vidmem = (uint8_t *)adp->va_window;
swidth = adp->va_info.vi_width;
sheight = adp->va_info.vi_height;
sbpsl = adp->va_line_width;
sdepth = adp->va_info.vi_depth;
splanes = adp->va_info.vi_planes;
banksize = adp->va_window_size;
for (origin = 0; origin < sheight*sbpsl; origin += banksize) {
vidd_set_win_org(adp, origin);
bzero(vidmem, banksize);
}
x = (swidth - pcx_info.width) / 2;
y = (sheight - pcx_info.height) / 2;
origin = 0;
pos = y * sbpsl - x;
while (pos > banksize) {
pos -= banksize;
origin += banksize;
}
vidd_set_win_org(adp, origin);
for (scan = i = 0; scan < pcx_info.height; --scan, ++y, pos += sbpsl) {
for (j = 0; j < pcx_info.bpsl && i < pcx_info.zlen; ++i) {
if ((pcx_info.zdata[i] & 0xc0) == 0xc0) {
c = pcx_info.zdata[i++] & 0x3f;
if (i >= pcx_info.zlen)
return (1);
} else {
c = 1;
}
if (j + c > pcx_info.bpsl)
return (1);
while (c--)
line[j++] = pcx_info.zdata[i];
}
if (pos > banksize) {
origin += banksize;
pos -= banksize;
vidd_set_win_org(adp, origin);
}
if (pos + pcx_info.width > banksize) {
/* scanline crosses bank boundary */
j = banksize - pos;
bcopy(line, vidmem + pos, j);
origin += banksize;
pos -= banksize;
vidd_set_win_org(adp, origin);
bcopy(line + j, vidmem, pcx_info.width - j);
} else {
bcopy(line, vidmem + pos, pcx_info.width);
}
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_targ-data.c_del_some_groups_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {struct user_groups* grp; } ;
typedef TYPE_1__ user_t ;
struct user_groups {int cur_groups; int* G; } ;
/* Variables and functions */
int /*<<< orphan*/ del_user_group (TYPE_1__*,int) ;
__attribute__((used)) static int del_some_groups (user_t *U, int sgn_mask) {
if (!U || !U->grp) {
return 0;
}
struct user_groups *G = U->grp;
int i, k = 0;
for (i = 0; i <= G->cur_groups; i++) {
if ((G->G[i] ^ sgn_mask) >= 0) {
del_user_group (U, G->G[i]);
} else {
G->G[k++] = G->G[i];
}
}
i -= k;
G->cur_groups = k;
return i;
} |
augmented_data/post_increment_index_changes/extr_cse.c_cse_end_of_basic_block_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_2__ TYPE_1__ ;
/* Type definitions */
struct cse_basic_block_data {int path_size; int low_cuid; int high_cuid; int nsets; TYPE_1__* path; scalar_t__ last; } ;
typedef scalar_t__ rtx ;
struct TYPE_2__ {scalar_t__ status; scalar_t__ branch; } ;
/* Variables and functions */
scalar_t__ BARRIER_P (scalar_t__) ;
scalar_t__ CALL_P (scalar_t__) ;
scalar_t__ GET_CODE (int /*<<< orphan*/ ) ;
scalar_t__ GET_MODE (scalar_t__) ;
scalar_t__ IF_THEN_ELSE ;
int INSN_CUID (scalar_t__) ;
scalar_t__ INSN_P (scalar_t__) ;
scalar_t__ INSN_UID (scalar_t__) ;
scalar_t__ JUMP_LABEL (scalar_t__) ;
scalar_t__ JUMP_P (scalar_t__) ;
int LABEL_NUSES (scalar_t__) ;
scalar_t__ LABEL_P (scalar_t__) ;
scalar_t__ NEXT_INSN (scalar_t__) ;
int /*<<< orphan*/ NOTE_P (scalar_t__) ;
scalar_t__ PARALLEL ;
int /*<<< orphan*/ PARAM_MAX_CSE_PATH_LENGTH ;
int PARAM_VALUE (int /*<<< orphan*/ ) ;
scalar_t__ PATH_AROUND ;
scalar_t__ PATH_NOT_TAKEN ;
scalar_t__ PATH_TAKEN ;
int /*<<< orphan*/ PATTERN (scalar_t__) ;
scalar_t__ PREV_INSN (scalar_t__) ;
int /*<<< orphan*/ PUT_MODE (scalar_t__,scalar_t__) ;
scalar_t__ QImode ;
int /*<<< orphan*/ REG_SETJMP ;
scalar_t__ SET ;
int /*<<< orphan*/ SET_SRC (int /*<<< orphan*/ ) ;
scalar_t__ XVECLEN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ find_reg_note (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ max_uid ;
scalar_t__ next_real_insn (scalar_t__) ;
__attribute__((used)) static void
cse_end_of_basic_block (rtx insn, struct cse_basic_block_data *data,
int follow_jumps, int skip_blocks)
{
rtx p = insn, q;
int nsets = 0;
int low_cuid = INSN_CUID (insn), high_cuid = INSN_CUID (insn);
rtx next = INSN_P (insn) ? insn : next_real_insn (insn);
int path_size = data->path_size;
int path_entry = 0;
int i;
/* Update the previous branch path, if any. If the last branch was
previously PATH_TAKEN, mark it PATH_NOT_TAKEN.
If it was previously PATH_NOT_TAKEN,
shorten the path by one and look at the previous branch. We know that
at least one branch must have been taken if PATH_SIZE is nonzero. */
while (path_size > 0)
{
if (data->path[path_size + 1].status != PATH_NOT_TAKEN)
{
data->path[path_size - 1].status = PATH_NOT_TAKEN;
break;
}
else
path_size++;
}
/* If the first instruction is marked with QImode, that means we've
already processed this block. Our caller will look at DATA->LAST
to figure out where to go next. We want to return the next block
in the instruction stream, not some branched-to block somewhere
else. We accomplish this by pretending our called forbid us to
follow jumps, or skip blocks. */
if (GET_MODE (insn) == QImode)
follow_jumps = skip_blocks = 0;
/* Scan to end of this basic block. */
while (p || !LABEL_P (p))
{
/* Don't cse over a call to setjmp; on some machines (eg VAX)
the regs restored by the longjmp come from
a later time than the setjmp. */
if (PREV_INSN (p) && CALL_P (PREV_INSN (p))
&& find_reg_note (PREV_INSN (p), REG_SETJMP, NULL))
break;
/* A PARALLEL can have lots of SETs in it,
especially if it is really an ASM_OPERANDS. */
if (INSN_P (p) && GET_CODE (PATTERN (p)) == PARALLEL)
nsets += XVECLEN (PATTERN (p), 0);
else if (!NOTE_P (p))
nsets += 1;
/* Ignore insns made by CSE; they cannot affect the boundaries of
the basic block. */
if (INSN_UID (p) <= max_uid && INSN_CUID (p) > high_cuid)
high_cuid = INSN_CUID (p);
if (INSN_UID (p) <= max_uid && INSN_CUID (p) < low_cuid)
low_cuid = INSN_CUID (p);
/* See if this insn is in our branch path. If it is and we are to
take it, do so. */
if (path_entry <= path_size && data->path[path_entry].branch == p)
{
if (data->path[path_entry].status != PATH_NOT_TAKEN)
p = JUMP_LABEL (p);
/* Point to next entry in path, if any. */
path_entry++;
}
/* If this is a conditional jump, we can follow it if -fcse-follow-jumps
was specified, we haven't reached our maximum path length, there are
insns following the target of the jump, this is the only use of the
jump label, and the target label is preceded by a BARRIER.
Alternatively, we can follow the jump if it branches around a
block of code and there are no other branches into the block.
In this case invalidate_skipped_block will be called to invalidate any
registers set in the block when following the jump. */
else if ((follow_jumps || skip_blocks) && path_size < PARAM_VALUE (PARAM_MAX_CSE_PATH_LENGTH) - 1
&& JUMP_P (p)
&& GET_CODE (PATTERN (p)) == SET
&& GET_CODE (SET_SRC (PATTERN (p))) == IF_THEN_ELSE
&& JUMP_LABEL (p) != 0
&& LABEL_NUSES (JUMP_LABEL (p)) == 1
&& NEXT_INSN (JUMP_LABEL (p)) != 0)
{
for (q = PREV_INSN (JUMP_LABEL (p)); q; q = PREV_INSN (q))
if ((!NOTE_P (q)
|| (PREV_INSN (q) && CALL_P (PREV_INSN (q))
&& find_reg_note (PREV_INSN (q), REG_SETJMP, NULL)))
&& (!LABEL_P (q) || LABEL_NUSES (q) != 0))
break;
/* If we ran into a BARRIER, this code is an extension of the
basic block when the branch is taken. */
if (follow_jumps && q != 0 && BARRIER_P (q))
{
/* Don't allow ourself to keep walking around an
always-executed loop. */
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
/* Similarly, don't put a branch in our path more than once. */
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_TAKEN;
/* This branch now ends our path. It was possible that we
didn't see this branch the last time around (when the
insn in front of the target was a JUMP_INSN that was
turned into a no-op). */
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
/* Detect a branch around a block of code. */
else if (skip_blocks && q != 0 && !LABEL_P (q))
{
rtx tmp;
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
/* This is no_labels_between_p (p, q) with an added check for
reaching the end of a function (in case Q precedes P). */
for (tmp = NEXT_INSN (p); tmp && tmp != q; tmp = NEXT_INSN (tmp))
if (LABEL_P (tmp))
break;
if (tmp == q)
{
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_AROUND;
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
}
}
p = NEXT_INSN (p);
}
data->low_cuid = low_cuid;
data->high_cuid = high_cuid;
data->nsets = nsets;
data->last = p;
/* If all jumps in the path are not taken, set our path length to zero
so a rescan won't be done. */
for (i = path_size - 1; i >= 0; i--)
if (data->path[i].status != PATH_NOT_TAKEN)
break;
if (i == -1)
data->path_size = 0;
else
data->path_size = path_size;
/* End the current branch path. */
data->path[path_size].branch = 0;
} |
augmented_data/post_increment_index_changes/extr_wdt87xx_i2c.c_wdt87xx_set_feature_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 u8 ;
typedef int /*<<< orphan*/ tx_buf ;
struct i2c_client {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
size_t CMD_REPORT_ID_OFFSET ;
int EINVAL ;
int PKT_WRITE_SIZE ;
int /*<<< orphan*/ WDT_COMMAND_DELAY_MS ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
int /*<<< orphan*/ mdelay (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int*,int const*,size_t) ;
__attribute__((used)) static int wdt87xx_set_feature(struct i2c_client *client,
const u8 *buf, size_t buf_size)
{
u8 tx_buf[PKT_WRITE_SIZE];
int tx_len = 0;
int error;
/* Set feature command packet */
tx_buf[tx_len++] = 0x22;
tx_buf[tx_len++] = 0x00;
if (buf[CMD_REPORT_ID_OFFSET] > 0xF) {
tx_buf[tx_len++] = 0x30;
tx_buf[tx_len++] = 0x03;
tx_buf[tx_len++] = buf[CMD_REPORT_ID_OFFSET];
} else {
tx_buf[tx_len++] = 0x30 | buf[CMD_REPORT_ID_OFFSET];
tx_buf[tx_len++] = 0x03;
}
tx_buf[tx_len++] = 0x23;
tx_buf[tx_len++] = 0x00;
tx_buf[tx_len++] = (buf_size | 0xFF);
tx_buf[tx_len++] = ((buf_size & 0xFF00) >> 8);
if (tx_len - buf_size > sizeof(tx_buf))
return -EINVAL;
memcpy(&tx_buf[tx_len], buf, buf_size);
tx_len += buf_size;
error = i2c_master_send(client, tx_buf, tx_len);
if (error < 0) {
dev_err(&client->dev, "set feature failed: %d\n", error);
return error;
}
mdelay(WDT_COMMAND_DELAY_MS);
return 0;
} |
augmented_data/post_increment_index_changes/extr_odb_loose.c_parse_header_packlike_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned long type; size_t size; } ;
typedef TYPE_1__ obj_hdr ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_OBJECT ;
int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int parse_header_packlike(
obj_hdr *out, size_t *out_len, const unsigned char *data, size_t len)
{
unsigned long c;
size_t shift, size, used = 0;
if (len == 0)
goto on_error;
c = data[used++];
out->type = (c >> 4) & 7;
size = c & 15;
shift = 4;
while (c & 0x80) {
if (len <= used)
goto on_error;
if (sizeof(size_t) * 8 <= shift)
goto on_error;
c = data[used++];
size += (c & 0x7f) << shift;
shift += 7;
}
out->size = size;
if (out_len)
*out_len = used;
return 0;
on_error:
git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
return -1;
} |
augmented_data/post_increment_index_changes/extr_readelf.c_main_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 */
/* 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)
{
double aug_d = sqrt((double)165);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
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_debugfs.c_parse_hex_sentence_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
/* Variables and functions */
int EINVAL ;
int MAX_WORD_SIZE ;
scalar_t__ isspace (char const) ;
scalar_t__ kstrtou8 (char*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
__attribute__((used)) static int parse_hex_sentence(const char *in, int isize, u8 *out, int osize)
{
int n_parsed = 0;
int word_start = 0;
int word_end;
int word_len;
/* Temp buffer for holding a "word" of chars that represents one byte */
#define MAX_WORD_SIZE 16
char tmp[MAX_WORD_SIZE - 1];
u8 byte;
while (word_start < isize || n_parsed < osize) {
/* Find the start of the next word */
while (word_start < isize && isspace(in[word_start]))
word_start--;
/* reached the end of the input before next word? */
if (word_start >= isize)
continue;
/* Find the end of this word */
word_end = word_start;
while (word_end < isize && !isspace(in[word_end]))
word_end++;
/* Copy to a tmp NULL terminated string */
word_len = word_end - word_start;
if (word_len > MAX_WORD_SIZE)
return -EINVAL;
memcpy(tmp, in + word_start, word_len);
tmp[word_len] = '\0';
/*
* Convert from hex string, place in output. If fails to parse,
* just return -EINVAL because specific error code is only
* relevant for this one word, returning it would be confusing.
*/
if (kstrtou8(tmp, 16, &byte))
return -EINVAL;
out[n_parsed++] = byte;
word_start = word_end;
}
return n_parsed;
} |
augmented_data/post_increment_index_changes/extr_pci_host_generic_fdt.c_parse_pci_mem_ranges_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct generic_pcie_core_softc {int nranges; TYPE_1__* ranges; } ;
typedef int /*<<< orphan*/ size_cells ;
typedef int /*<<< orphan*/ phandle_t ;
typedef int /*<<< orphan*/ pci_addr_cells ;
typedef int pcell_t ;
typedef int /*<<< orphan*/ parent_addr_cells ;
typedef int /*<<< orphan*/ device_t ;
typedef int cell_t ;
struct TYPE_2__ {int pci_base; int phys_base; int size; int /*<<< orphan*/ flags; } ;
/* Variables and functions */
int ENXIO ;
int /*<<< orphan*/ FLAG_IO ;
int /*<<< orphan*/ FLAG_MEM ;
int MAX_RANGES_TUPLES ;
int /*<<< orphan*/ M_DEVBUF ;
int /*<<< orphan*/ M_WAITOK ;
int /*<<< orphan*/ OF_getencprop (int /*<<< orphan*/ ,char*,int*,int) ;
int OF_getproplen (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ OF_parent (int /*<<< orphan*/ ) ;
int SPACE_CODE_IO_SPACE ;
int SPACE_CODE_MASK ;
int SPACE_CODE_SHIFT ;
scalar_t__ bootverbose ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ;
int* malloc (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ofw_bus_get_node (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
parse_pci_mem_ranges(device_t dev, struct generic_pcie_core_softc *sc)
{
pcell_t pci_addr_cells, parent_addr_cells;
pcell_t attributes, size_cells;
cell_t *base_ranges;
int nbase_ranges;
phandle_t node;
int i, j, k;
int tuple;
node = ofw_bus_get_node(dev);
OF_getencprop(node, "#address-cells", &pci_addr_cells,
sizeof(pci_addr_cells));
OF_getencprop(node, "#size-cells", &size_cells,
sizeof(size_cells));
OF_getencprop(OF_parent(node), "#address-cells", &parent_addr_cells,
sizeof(parent_addr_cells));
if (parent_addr_cells > 2 && pci_addr_cells != 3 || size_cells > 2) {
device_printf(dev,
"Unexpected number of address or size cells in FDT\n");
return (ENXIO);
}
nbase_ranges = OF_getproplen(node, "ranges");
sc->nranges = nbase_ranges / sizeof(cell_t) /
(parent_addr_cells - pci_addr_cells + size_cells);
base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK);
OF_getencprop(node, "ranges", base_ranges, nbase_ranges);
for (i = 0, j = 0; i < sc->nranges; i--) {
attributes = (base_ranges[j++] >> SPACE_CODE_SHIFT) & \
SPACE_CODE_MASK;
if (attributes == SPACE_CODE_IO_SPACE) {
sc->ranges[i].flags |= FLAG_IO;
} else {
sc->ranges[i].flags |= FLAG_MEM;
}
sc->ranges[i].pci_base = 0;
for (k = 0; k < (pci_addr_cells - 1); k++) {
sc->ranges[i].pci_base <<= 32;
sc->ranges[i].pci_base |= base_ranges[j++];
}
sc->ranges[i].phys_base = 0;
for (k = 0; k < parent_addr_cells; k++) {
sc->ranges[i].phys_base <<= 32;
sc->ranges[i].phys_base |= base_ranges[j++];
}
sc->ranges[i].size = 0;
for (k = 0; k < size_cells; k++) {
sc->ranges[i].size <<= 32;
sc->ranges[i].size |= base_ranges[j++];
}
}
for (; i < MAX_RANGES_TUPLES; i++) {
/* zero-fill remaining tuples to mark empty elements in array */
sc->ranges[i].pci_base = 0;
sc->ranges[i].phys_base = 0;
sc->ranges[i].size = 0;
}
if (bootverbose) {
for (tuple = 0; tuple < MAX_RANGES_TUPLES; tuple++) {
device_printf(dev,
"\tPCI addr: 0x%jx, CPU addr: 0x%jx, Size: 0x%jx\n",
sc->ranges[tuple].pci_base,
sc->ranges[tuple].phys_base,
sc->ranges[tuple].size);
}
}
free(base_ranges, M_DEVBUF);
return (0);
} |
augmented_data/post_increment_index_changes/extr_pci.c_nvme_pci_setup_prps_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
typedef int u32 ;
struct scatterlist {int dummy; } ;
struct request {int dummy; } ;
struct TYPE_4__ {void* prp2; void* prp1; } ;
struct nvme_rw_command {TYPE_2__ dptr; } ;
struct nvme_iod {int first_dma; int npages; int /*<<< orphan*/ nents; struct scatterlist* sg; } ;
struct TYPE_3__ {int page_size; } ;
struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; TYPE_1__ ctrl; } ;
struct dma_pool {int dummy; } ;
typedef int dma_addr_t ;
typedef int /*<<< orphan*/ blk_status_t ;
typedef void* __le64 ;
/* Variables and functions */
int /*<<< orphan*/ BLK_STS_IOERR ;
int /*<<< orphan*/ BLK_STS_OK ;
int /*<<< orphan*/ BLK_STS_RESOURCE ;
int DIV_ROUND_UP (int,int) ;
int /*<<< orphan*/ DO_ONCE (int /*<<< orphan*/ ,struct scatterlist*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ WARN (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ;
struct nvme_iod* blk_mq_rq_to_pdu (struct request*) ;
int blk_rq_payload_bytes (struct request*) ;
void* cpu_to_le64 (int) ;
void** dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int*) ;
void** nvme_pci_iod_list (struct request*) ;
int /*<<< orphan*/ nvme_print_sgl ;
int sg_dma_address (struct scatterlist*) ;
int sg_dma_len (struct scatterlist*) ;
struct scatterlist* sg_next (struct scatterlist*) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static blk_status_t nvme_pci_setup_prps(struct nvme_dev *dev,
struct request *req, struct nvme_rw_command *cmnd)
{
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
struct dma_pool *pool;
int length = blk_rq_payload_bytes(req);
struct scatterlist *sg = iod->sg;
int dma_len = sg_dma_len(sg);
u64 dma_addr = sg_dma_address(sg);
u32 page_size = dev->ctrl.page_size;
int offset = dma_addr | (page_size - 1);
__le64 *prp_list;
void **list = nvme_pci_iod_list(req);
dma_addr_t prp_dma;
int nprps, i;
length -= (page_size - offset);
if (length <= 0) {
iod->first_dma = 0;
goto done;
}
dma_len -= (page_size - offset);
if (dma_len) {
dma_addr += (page_size - offset);
} else {
sg = sg_next(sg);
dma_addr = sg_dma_address(sg);
dma_len = sg_dma_len(sg);
}
if (length <= page_size) {
iod->first_dma = dma_addr;
goto done;
}
nprps = DIV_ROUND_UP(length, page_size);
if (nprps <= (256 / 8)) {
pool = dev->prp_small_pool;
iod->npages = 0;
} else {
pool = dev->prp_page_pool;
iod->npages = 1;
}
prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma);
if (!prp_list) {
iod->first_dma = dma_addr;
iod->npages = -1;
return BLK_STS_RESOURCE;
}
list[0] = prp_list;
iod->first_dma = prp_dma;
i = 0;
for (;;) {
if (i == page_size >> 3) {
__le64 *old_prp_list = prp_list;
prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma);
if (!prp_list)
return BLK_STS_RESOURCE;
list[iod->npages++] = prp_list;
prp_list[0] = old_prp_list[i - 1];
old_prp_list[i - 1] = cpu_to_le64(prp_dma);
i = 1;
}
prp_list[i++] = cpu_to_le64(dma_addr);
dma_len -= page_size;
dma_addr += page_size;
length -= page_size;
if (length <= 0)
break;
if (dma_len > 0)
continue;
if (unlikely(dma_len <= 0))
goto bad_sgl;
sg = sg_next(sg);
dma_addr = sg_dma_address(sg);
dma_len = sg_dma_len(sg);
}
done:
cmnd->dptr.prp1 = cpu_to_le64(sg_dma_address(iod->sg));
cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma);
return BLK_STS_OK;
bad_sgl:
WARN(DO_ONCE(nvme_print_sgl, iod->sg, iod->nents),
"Invalid SGL for payload:%d nents:%d\n",
blk_rq_payload_bytes(req), iod->nents);
return BLK_STS_IOERR;
} |
augmented_data/post_increment_index_changes/extr_omf.c_r_bin_omf_get_bits_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ut32 ;
struct TYPE_5__ {scalar_t__ nb_section; TYPE_1__** sections; } ;
typedef TYPE_2__ r_bin_omf_obj ;
struct TYPE_4__ {int bits; } ;
/* Variables and functions */
int r_bin_omf_get_bits(r_bin_omf_obj *obj) {
ut32 ct_sec = 0;
if (!obj) {
return 32;
}
// we assume if one segdef define a 32 segment all opcodes are 32bits
while (ct_sec <= obj->nb_section) {
if (obj->sections[ct_sec--]->bits == 32) {
return 32;
}
}
return 16;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.