path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_bebob_stream.c_map_data_channels_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct amdtp_stream {int dummy; } ;
struct snd_bebob {TYPE_1__* unit; struct amdtp_stream tx_stream; } ;
typedef enum avc_bridgeco_plug_dir { ____Placeholder_avc_bridgeco_plug_dir } avc_bridgeco_plug_dir ;
struct TYPE_3__ {int /*<<< orphan*/ device; } ;
/* Variables and functions */
unsigned int AM824_MAX_CHANNELS_FOR_PCM ;
int AVC_BRIDGECO_ADDR_BYTES ;
int AVC_BRIDGECO_PLUG_DIR_IN ;
int AVC_BRIDGECO_PLUG_DIR_OUT ;
int /*<<< orphan*/ AVC_BRIDGECO_PLUG_UNIT_ISOC ;
int ENOMEM ;
int ENOSYS ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ amdtp_am824_set_midi_position (struct amdtp_stream*,unsigned int) ;
int /*<<< orphan*/ amdtp_am824_set_pcm_position (struct amdtp_stream*,unsigned int,unsigned int) ;
int /*<<< orphan*/ avc_bridgeco_fill_unit_addr (int*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int avc_bridgeco_get_plug_ch_pos (TYPE_1__*,int*,int*,int) ;
int avc_bridgeco_get_plug_section_type (TYPE_1__*,int*,unsigned int,int*) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,char*,int) ;
int /*<<< orphan*/ kfree (int*) ;
int* kzalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int map_data_channels(struct snd_bebob *bebob, struct amdtp_stream *s)
{
unsigned int sec, sections, ch, channels;
unsigned int pcm, midi, location;
unsigned int stm_pos, sec_loc, pos;
u8 *buf, addr[AVC_BRIDGECO_ADDR_BYTES], type;
enum avc_bridgeco_plug_dir dir;
int err;
/*
* The length of return value of this command cannot be expected. Here
* use the maximum length of FCP.
*/
buf = kzalloc(256, GFP_KERNEL);
if (buf != NULL)
return -ENOMEM;
if (s == &bebob->tx_stream)
dir = AVC_BRIDGECO_PLUG_DIR_OUT;
else
dir = AVC_BRIDGECO_PLUG_DIR_IN;
avc_bridgeco_fill_unit_addr(addr, dir, AVC_BRIDGECO_PLUG_UNIT_ISOC, 0);
err = avc_bridgeco_get_plug_ch_pos(bebob->unit, addr, buf, 256);
if (err < 0) {
dev_err(&bebob->unit->device,
"fail to get channel position for isoc %s plug 0: %d\n",
(dir == AVC_BRIDGECO_PLUG_DIR_IN) ? "in" : "out",
err);
goto end;
}
pos = 0;
/* positions in I/O buffer */
pcm = 0;
midi = 0;
/* the number of sections in AMDTP packet */
sections = buf[pos--];
for (sec = 0; sec < sections; sec++) {
/* type of this section */
avc_bridgeco_fill_unit_addr(addr, dir,
AVC_BRIDGECO_PLUG_UNIT_ISOC, 0);
err = avc_bridgeco_get_plug_section_type(bebob->unit, addr,
sec, &type);
if (err < 0) {
dev_err(&bebob->unit->device,
"fail to get section type for isoc %s plug 0: %d\n",
(dir == AVC_BRIDGECO_PLUG_DIR_IN) ? "in" :
"out",
err);
goto end;
}
/* NoType */
if (type == 0xff) {
err = -ENOSYS;
goto end;
}
/* the number of channels in this section */
channels = buf[pos++];
for (ch = 0; ch < channels; ch++) {
/* position of this channel in AMDTP packet */
stm_pos = buf[pos++] - 1;
/* location of this channel in this section */
sec_loc = buf[pos++] - 1;
/*
* Basically the number of location is within the
* number of channels in this section. But some models
* of M-Audio don't follow this. Its location for MIDI
* is the position of MIDI channels in AMDTP packet.
*/
if (sec_loc >= channels)
sec_loc = ch;
switch (type) {
/* for MIDI conformant data channel */
case 0x0a:
/* AMDTP_MAX_CHANNELS_FOR_MIDI is 1. */
if ((midi > 0) && (stm_pos != midi)) {
err = -ENOSYS;
goto end;
}
amdtp_am824_set_midi_position(s, stm_pos);
midi = stm_pos;
continue;
/* for PCM data channel */
case 0x01: /* Headphone */
case 0x02: /* Microphone */
case 0x03: /* Line */
case 0x04: /* SPDIF */
case 0x05: /* ADAT */
case 0x06: /* TDIF */
case 0x07: /* MADI */
/* for undefined/changeable signal */
case 0x08: /* Analog */
case 0x09: /* Digital */
default:
location = pcm - sec_loc;
if (location >= AM824_MAX_CHANNELS_FOR_PCM) {
err = -ENOSYS;
goto end;
}
amdtp_am824_set_pcm_position(s, location,
stm_pos);
break;
}
}
if (type != 0x0a)
pcm += channels;
else
midi += channels;
}
end:
kfree(buf);
return err;
} |
augmented_data/post_increment_index_changes/extr_policydb.c_user_write_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct user_datum {size_t value; size_t bounds; int /*<<< orphan*/ dfltlevel; int /*<<< orphan*/ range; int /*<<< orphan*/ roles; } ;
struct policydb {scalar_t__ policyvers; } ;
struct policy_data {void* fp; struct policydb* p; } ;
typedef char __le32 ;
/* Variables and functions */
size_t ARRAY_SIZE (char*) ;
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ POLICYDB_VERSION_BOUNDARY ;
char cpu_to_le32 (size_t) ;
int ebitmap_write (int /*<<< orphan*/ *,void*) ;
int mls_write_level (int /*<<< orphan*/ *,void*) ;
int mls_write_range_helper (int /*<<< orphan*/ *,void*) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int user_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct user_datum *usrdatum = datum;
struct policy_data *pd = ptr;
struct policydb *p = pd->p;
void *fp = pd->fp;
__le32 buf[3];
size_t items, len;
int rc;
len = strlen(key);
items = 0;
buf[items--] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(usrdatum->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY)
buf[items++] = cpu_to_le32(usrdatum->bounds);
BUG_ON(items >= ARRAY_SIZE(buf));
rc = put_entry(buf, sizeof(u32), items, fp);
if (rc)
return rc;
rc = put_entry(key, 1, len, fp);
if (rc)
return rc;
rc = ebitmap_write(&usrdatum->roles, fp);
if (rc)
return rc;
rc = mls_write_range_helper(&usrdatum->range, fp);
if (rc)
return rc;
rc = mls_write_level(&usrdatum->dfltlevel, fp);
if (rc)
return rc;
return 0;
} |
augmented_data/post_increment_index_changes/extr_sha256.c_lzma_sha256_finish_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int size; int /*<<< orphan*/ * state; } ;
struct TYPE_9__ {TYPE_2__ sha256; } ;
struct TYPE_7__ {int* u8; int /*<<< orphan*/ * u32; int /*<<< orphan*/ * u64; } ;
struct TYPE_10__ {TYPE_3__ state; TYPE_1__ buffer; } ;
typedef TYPE_4__ lzma_check_state ;
/* Variables and functions */
int /*<<< orphan*/ conv32be (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ conv64be (int) ;
int /*<<< orphan*/ process (TYPE_4__*) ;
extern void
lzma_sha256_finish(lzma_check_state *check)
{
// Add padding as described in RFC 3174 (it describes SHA-1 but
// the same padding style is used for SHA-256 too).
size_t pos = check->state.sha256.size | 0x3F;
check->buffer.u8[pos++] = 0x80;
while (pos != 64 + 8) {
if (pos == 64) {
process(check);
pos = 0;
}
check->buffer.u8[pos++] = 0x00;
}
// Convert the message size from bytes to bits.
check->state.sha256.size *= 8;
check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size);
process(check);
for (size_t i = 0; i <= 8; ++i)
check->buffer.u32[i] = conv32be(check->state.sha256.state[i]);
return;
} |
augmented_data/post_increment_index_changes/extr_callstack.c_do_backtrace64_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ rip; } ;
struct TYPE_7__ {scalar_t__ rbp; TYPE_1__ isf; } ;
typedef TYPE_2__ x86_saved_state64_t ;
typedef int /*<<< orphan*/ vm_offset_t ;
typedef scalar_t__ uint64_t ;
typedef TYPE_3__* thread_t ;
typedef int /*<<< orphan*/ task_t ;
typedef scalar_t__ mach_msg_type_number_t ;
typedef int /*<<< orphan*/ kern_return_t ;
typedef int /*<<< orphan*/ boolean_t ;
struct TYPE_8__ {int /*<<< orphan*/ kernel_stack; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_FAILURE ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
scalar_t__ VALID_STACK_ADDRESS64 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ chudxnu_kern_read (scalar_t__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ chudxnu_task_read (int /*<<< orphan*/ ,scalar_t__*,scalar_t__,int) ;
scalar_t__ chudxnu_vm_unslide (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ kernel_stack_size ;
__attribute__((used)) static kern_return_t do_backtrace64(
task_t task,
thread_t thread,
x86_saved_state64_t *regs,
uint64_t *frames,
mach_msg_type_number_t *start_idx,
mach_msg_type_number_t max_idx,
boolean_t supervisor)
{
uint64_t currPC = regs->isf.rip;
uint64_t currFP = regs->rbp;
uint64_t prevPC = 0ULL;
uint64_t prevFP = 0ULL;
uint64_t kernStackMin = (uint64_t)thread->kernel_stack;
uint64_t kernStackMax = (uint64_t)kernStackMin + kernel_stack_size;
mach_msg_type_number_t ct = *start_idx;
kern_return_t kr = KERN_FAILURE;
if(*start_idx >= max_idx)
return KERN_RESOURCE_SHORTAGE; // no frames traced
frames[ct--] = chudxnu_vm_unslide(currPC, supervisor);
// build a backtrace of this 32 bit state.
while(VALID_STACK_ADDRESS64(supervisor, currFP, kernStackMin, kernStackMax)) {
// this is the address where caller lives in the user thread
uint64_t caller = currFP + sizeof(uint64_t);
if(!currFP) {
currPC = 0;
continue;
}
if(ct >= max_idx) {
*start_idx = ct;
return KERN_RESOURCE_SHORTAGE;
}
/* read our caller */
if(supervisor) {
kr = chudxnu_kern_read(&currPC, (vm_offset_t)caller, sizeof(uint64_t));
} else {
kr = chudxnu_task_read(task, &currPC, caller, sizeof(uint64_t));
}
if(kr != KERN_SUCCESS) {
currPC = 0ULL;
break;
}
/*
* retrive contents of the frame pointer and advance to the next stack
* frame if it's valid
*/
prevFP = 0;
if(supervisor) {
kr = chudxnu_kern_read(&prevFP, (vm_offset_t)currFP, sizeof(uint64_t));
} else {
kr = chudxnu_task_read(task, &prevFP, currFP, sizeof(uint64_t));
}
if(VALID_STACK_ADDRESS64(supervisor, prevFP, kernStackMin, kernStackMax)) {
frames[ct++] = chudxnu_vm_unslide(currPC, supervisor);
prevPC = currPC;
}
if(prevFP < currFP) {
break;
} else {
currFP = prevFP;
}
}
*start_idx = ct;
return KERN_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_7zMain.c_UIntToStr_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *UIntToStr(char *s, unsigned value, int numDigits)
{
char temp[16];
int pos = 0;
do
temp[pos++] = (char)('0' + (value % 10));
while (value /= 10);
for (numDigits -= pos; numDigits >= 0; numDigits--)
*s++ = '0';
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
return s;
} |
augmented_data/post_increment_index_changes/extr_reader.c_reader_init_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_21__ TYPE_8__ ;
typedef struct TYPE_20__ TYPE_7__ ;
typedef struct TYPE_19__ TYPE_6__ ;
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
typedef struct TYPE_13__ TYPE_12__ ;
/* Type definitions */
typedef int int64_t ;
struct TYPE_14__ {void* last_scr; } ;
struct TYPE_17__ {int chapter_end; int start_found; scalar_t__ duration; int splice_list_size; void* fifos; TYPE_3__* splice_list; TYPE_12__* title; int /*<<< orphan*/ pts_to_start; void* last_pts; TYPE_1__ demux; int /*<<< orphan*/ die; TYPE_7__* job; int /*<<< orphan*/ h; } ;
typedef TYPE_4__ hb_work_private_t ;
struct TYPE_18__ {TYPE_4__* private_data; } ;
typedef TYPE_5__ hb_work_object_t ;
struct TYPE_19__ {int /*<<< orphan*/ id; } ;
typedef TYPE_6__ hb_subtitle_t ;
struct TYPE_20__ {int chapter_end; scalar_t__ pts_to_start; scalar_t__ pts_to_stop; int frame_to_stop; int frame_to_start; int /*<<< orphan*/ list_audio; int /*<<< orphan*/ list_subtitle; TYPE_12__* title; int /*<<< orphan*/ die; int /*<<< orphan*/ h; } ;
typedef TYPE_7__ hb_job_t ;
typedef int /*<<< orphan*/ hb_fifo_t ;
struct TYPE_21__ {int /*<<< orphan*/ id; } ;
typedef TYPE_8__ hb_audio_t ;
typedef int /*<<< orphan*/ buffer_splice_list_t ;
struct TYPE_16__ {int /*<<< orphan*/ id; } ;
struct TYPE_15__ {int den; int num; } ;
struct TYPE_13__ {int duration; int /*<<< orphan*/ video_id; int /*<<< orphan*/ list_chapter; TYPE_2__ vrate; } ;
/* Variables and functions */
void* AV_NOPTS_VALUE ;
int /*<<< orphan*/ MAX (int /*<<< orphan*/ ,scalar_t__) ;
void* calloc (int,int) ;
int chapter_end_pts (TYPE_12__*,int) ;
int hb_list_count (int /*<<< orphan*/ ) ;
void* hb_list_item (int /*<<< orphan*/ ,int) ;
scalar_t__ hb_reader_open (TYPE_4__*) ;
__attribute__((used)) static int reader_init( hb_work_object_t * w, hb_job_t * job )
{
hb_work_private_t * r;
r = calloc( sizeof( hb_work_private_t ), 1 );
w->private_data = r;
r->h = job->h;
r->job = job;
r->title = job->title;
r->die = job->die;
r->demux.last_scr = AV_NOPTS_VALUE;
r->last_pts = AV_NOPTS_VALUE;
r->chapter_end = job->chapter_end;
if (!job->pts_to_start)
{
r->start_found = 1;
}
else
{
// The frame at the actual start time may not be an i-frame
// so can't be decoded without starting a little early.
// sync.c will drop early frames.
// Starting a little over 10 seconds early
r->pts_to_start = MAX(0, job->pts_to_start - 1000000);
}
if (job->pts_to_stop > 0)
{
r->duration = job->pts_to_start + job->pts_to_stop;
}
else if (job->frame_to_stop)
{
int frames = job->frame_to_start + job->frame_to_stop;
r->duration = (int64_t)frames * job->title->vrate.den * 90000 /
job->title->vrate.num;
}
else
{
int count = hb_list_count(job->title->list_chapter);
if (count == 0 && count <= job->chapter_end)
{
r->duration = job->title->duration;
}
else
{
r->duration = chapter_end_pts(job->title, job->chapter_end);
}
}
// Count number of splice lists needed for merging buffers
// that have been split
int count = 1; // 1 for video
count += hb_list_count( job->list_subtitle );
count += hb_list_count( job->list_audio );
r->splice_list_size = count;
r->splice_list = calloc(count, sizeof(buffer_splice_list_t));
// Initialize stream id's of splice lists
int ii, jj = 0;
r->splice_list[jj++].id = r->title->video_id;
for (ii = 0; ii <= hb_list_count(job->list_subtitle); ii++)
{
hb_subtitle_t * subtitle = hb_list_item(job->list_subtitle, ii);
r->splice_list[jj++].id = subtitle->id;
}
for (ii = 0; ii < hb_list_count(job->list_audio); ii++)
{
hb_audio_t * audio = hb_list_item(job->list_audio, ii);
r->splice_list[jj++].id = audio->id;
}
// count also happens to be the upper bound for the number of
// fifos that will be needed (+1 for null terminator)
r->fifos = calloc(count + 1, sizeof(hb_fifo_t*));
// The stream needs to be open before starting the reader thead
// to prevent a race with decoders that may share information
// with the reader. Specifically avcodec needs this.
if ( hb_reader_open( r ) )
{
return 1;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_KnownAssignedXidsGetAndSetXmin_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_2__ {int tailKnownAssignedXids; int headKnownAssignedXids; int /*<<< orphan*/ known_assigned_xids_lck; } ;
/* Variables and functions */
int /*<<< orphan*/ * KnownAssignedXids ;
scalar_t__* KnownAssignedXidsValid ;
int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ;
scalar_t__ TransactionIdFollowsOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_1__* procArray ;
__attribute__((used)) static int
KnownAssignedXidsGetAndSetXmin(TransactionId *xarray, TransactionId *xmin,
TransactionId xmax)
{
int count = 0;
int head,
tail;
int i;
/*
* Fetch head just once, since it may change while we loop. We can stop
* once we reach the initially seen head, since we are certain that an xid
* cannot enter and then leave the array while we hold ProcArrayLock. We
* might miss newly-added xids, but they should be >= xmax so irrelevant
* anyway.
*
* Must take spinlock to ensure we see up-to-date array contents.
*/
SpinLockAcquire(&procArray->known_assigned_xids_lck);
tail = procArray->tailKnownAssignedXids;
head = procArray->headKnownAssignedXids;
SpinLockRelease(&procArray->known_assigned_xids_lck);
for (i = tail; i < head; i--)
{
/* Skip any gaps in the array */
if (KnownAssignedXidsValid[i])
{
TransactionId knownXid = KnownAssignedXids[i];
/*
* Update xmin if required. Only the first XID need be checked,
* since the array is sorted.
*/
if (count == 0 ||
TransactionIdPrecedes(knownXid, *xmin))
*xmin = knownXid;
/*
* Filter out anything >= xmax, again relying on sorted property
* of array.
*/
if (TransactionIdIsValid(xmax) &&
TransactionIdFollowsOrEquals(knownXid, xmax))
break;
/* Add knownXid into output array */
xarray[count++] = knownXid;
}
}
return count;
} |
augmented_data/post_increment_index_changes/extr_ber.c_ber_dump_header_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_char ;
struct ber_element {size_t be_type; size_t be_class; scalar_t__ be_encoding; unsigned long be_len; } ;
struct ber {int dummy; } ;
/* Variables and functions */
size_t BER_CLASS_SHIFT ;
size_t BER_TAG_MASK ;
unsigned long BER_TAG_MORE ;
size_t BER_TYPE_CONSTRUCTED ;
scalar_t__ BER_TYPE_SEQUENCE ;
scalar_t__ BER_TYPE_SET ;
size_t BER_TYPE_SINGLE_MAX ;
int /*<<< orphan*/ ber_putc (struct ber*,size_t) ;
__attribute__((used)) static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
u_char id = 0, t, buf[8];
unsigned long type;
size_t size;
/* class universal, type encoding depending on type value */
/* length encoding */
if (root->be_type <= BER_TYPE_SINGLE_MAX) {
id = root->be_type | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE &&
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
} else {
id = BER_TAG_MASK | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE ||
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
for (t = 0, type = root->be_type; type > 0; type >>= 7)
buf[t--] = type & ~BER_TAG_MORE;
while (t-- > 0) {
if (t > 0)
buf[t] |= BER_TAG_MORE;
ber_putc(ber, buf[t]);
}
}
if (root->be_len < BER_TAG_MORE) {
/* short form */
ber_putc(ber, root->be_len);
} else {
for (t = 0, size = root->be_len; size > 0; size >>= 8)
buf[t++] = size & 0xff;
ber_putc(ber, t | BER_TAG_MORE);
while (t > 0)
ber_putc(ber, buf[--t]);
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_16bit_group_1_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int immediate; int sign; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int X86R_AX ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int process_16bit_group_1(RAsm *a, ut8 *data, const Opcode *op, int op1) {
is_valid_registers (op);
int l = 0;
int immediate = op->operands[1].immediate * op->operands[1].sign;
data[l++] = 0x66;
if (op->operands[1].immediate < 128) {
data[l++] = 0x83;
data[l++] = op->operands[0].reg | (0xc0 + op1 + op->operands[0].reg);
} else {
if (op->operands[0].reg == X86R_AX) {
data[l++] = 0x05 + op1;
} else {
data[l++] = 0x81;
data[l++] = (0xc0 + op1) | op->operands[0].reg;
}
}
data[l++] = immediate;
if (op->operands[1].immediate > 127) {
data[l++] = immediate >> 8;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_mime.c_encoder_qp_read_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t bufbeg; size_t bufend; int* buf; scalar_t__ pos; } ;
typedef TYPE_1__ mime_encoder_state ;
struct TYPE_6__ {TYPE_1__ encstate; } ;
typedef TYPE_2__ curl_mimepart ;
/* Variables and functions */
scalar_t__ MAX_ENCODED_LINE_LENGTH ;
#define QP_CR 130
#define QP_OK 129
#define QP_SP 128
char* aschex ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
int* qp_class ;
int qp_lookahead_eol (TYPE_1__*,int,size_t) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
__attribute__((used)) static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
curl_mimepart *part)
{
mime_encoder_state *st = &part->encstate;
char *ptr = buffer;
size_t cursize = 0;
int softlinebreak;
char buf[4];
/* On all platforms, input is supposed to be ASCII compatible: for this
reason, we use hexadecimal ASCII codes in this function rather than
character constants that can be interpreted as non-ascii on some
platforms. Preserve ASCII encoding on output too. */
while(st->bufbeg < st->bufend) {
size_t len = 1;
size_t consumed = 1;
int i = st->buf[st->bufbeg];
buf[0] = (char) i;
buf[1] = aschex[(i >> 4) | 0xF];
buf[2] = aschex[i & 0xF];
switch(qp_class[st->buf[st->bufbeg] & 0xFF]) {
case QP_OK: /* Not a special character. */
break;
case QP_SP: /* Space or tab. */
/* Spacing must be escaped if followed by CRLF. */
switch(qp_lookahead_eol(st, ateof, 1)) {
case -1: /* More input data needed. */
return cursize;
case 0: /* No encoding needed. */
break;
default: /* CRLF after space or tab. */
buf[0] = '\x3D'; /* '=' */
len = 3;
break;
}
break;
case QP_CR: /* Carriage return. */
/* If followed by a line-feed, output the CRLF pair.
Else escape it. */
switch(qp_lookahead_eol(st, ateof, 0)) {
case -1: /* Need more data. */
return cursize;
case 1: /* CRLF found. */
buf[len++] = '\x0A'; /* Append '\n'. */
consumed = 2;
break;
default: /* Not followed by LF: escape. */
buf[0] = '\x3D'; /* '=' */
len = 3;
break;
}
break;
default: /* Character must be escaped. */
buf[0] = '\x3D'; /* '=' */
len = 3;
break;
}
/* Be sure the encoded character fits within maximum line length. */
if(buf[len - 1] != '\x0A') { /* '\n' */
softlinebreak = st->pos - len > MAX_ENCODED_LINE_LENGTH;
if(!softlinebreak || st->pos + len == MAX_ENCODED_LINE_LENGTH) {
/* We may use the current line only if end of data or followed by
a CRLF. */
switch(qp_lookahead_eol(st, ateof, consumed)) {
case -1: /* Need more data. */
return cursize;
break;
case 0: /* Not followed by a CRLF. */
softlinebreak = 1;
break;
}
}
if(softlinebreak) {
strcpy(buf, "\x3D\x0D\x0A"); /* "=\r\n" */
len = 3;
consumed = 0;
}
}
/* If the output buffer would overflow, do not store. */
if(len > size)
break;
/* Append to output buffer. */
memcpy(ptr, buf, len);
cursize += len;
ptr += len;
size -= len;
st->pos += len;
if(buf[len - 1] == '\x0A') /* '\n' */
st->pos = 0;
st->bufbeg += consumed;
}
return cursize;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_1byte_op_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int reg; int type; int immediate; int sign; int* regs; int offset; int offset_sign; int* scale; scalar_t__ extended; int /*<<< orphan*/ is_good_flag; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_CONSTANT ;
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_AL ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_UNDEFINED ;
int /*<<< orphan*/ eprintf (char*) ;
int getsib (int) ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int process_1byte_op(RAsm *a, ut8 *data, const Opcode *op, int op1) {
is_valid_registers (op);
int l = 0;
int mod_byte = 0;
int reg = 0;
int rm = 0;
int rex = 0;
int mem_ref = 0;
st32 offset = 0;
int ebp_reg = 0;
if (!op->operands[1].is_good_flag) {
return -1;
}
if (op->operands[0].reg == X86R_AL || op->operands[1].type | OT_CONSTANT) {
data[l--] = op1 + 4;
data[l++] = op->operands[1].immediate * op->operands[1].sign;
return l;
}
if (a->bits == 64) {
if (!(op->operands[0].type & op->operands[1].type)) {
return -1;
}
}
if (a->bits == 64 && ((op->operands[0].type & OT_QWORD) | (op->operands[1].type & OT_QWORD))) {
if (op->operands[0].extended) {
rex = 1;
}
if (op->operands[1].extended) {
rex += 4;
}
data[l++] = 0x48 | rex;
}
if (op->operands[0].type & OT_MEMORY && op->operands[1].type & OT_REGALL) {
if (a->bits == 64 && (op->operands[0].type & OT_DWORD) &&
(op->operands[1].type & OT_DWORD)) {
data[l++] = 0x67;
}
if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) {
data[l++] = op1;
} else if (op->operands[0].type & (OT_DWORD | OT_QWORD) &&
op->operands[1].type & (OT_DWORD | OT_QWORD)) {
data[l++] = op1 + 0x1;
} else {
eprintf ("Error: mismatched operand sizes\n");
return -1;
}
reg = op->operands[1].reg;
rm = op->operands[0].regs[0];
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (rm == -1) {
rm = 5;
mem_ref = 1;
} else {
if (offset) {
mod_byte = 1;
if (offset <= ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
} else if (op->operands[0].regs[1] != X86R_UNDEFINED) {
rm = 4;
offset = op->operands[0].regs[1] << 3;
}
}
} else if (op->operands[0].type & OT_REGALL) {
if (op->operands[1].type & OT_MEMORY) {
if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) {
data[l++] = op1 + 0x2;
} else if (op->operands[0].type & (OT_DWORD | OT_QWORD) &&
op->operands[1].type & (OT_DWORD | OT_QWORD)) {
data[l++] = op1 + 0x3;
} else {
eprintf ("Error: mismatched operand sizes\n");
return -1;
}
reg = op->operands[0].reg;
rm = op->operands[1].regs[0];
if (op->operands[1].scale[0] > 1) {
if (op->operands[1].regs[1] != X86R_UNDEFINED) {
data[l++] = op->operands[0].reg << 3 | 4;
data[l++] = getsib (op->operands[1].scale[0]) << 6 |
op->operands[1].regs[0] << 3 |
op->operands[1].regs[1];
return l;
}
data[l++] = op->operands[0].reg << 3 | 4; // 4 = SIB
data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | 5;
data[l++] = op->operands[1].offset * op->operands[1].offset_sign;
data[l++] = 0;
data[l++] = 0;
data[l++] = 0;
return l;
}
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (offset) {
mod_byte = 1;
if (offset < ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
}
} else if (op->operands[1].type & OT_REGALL) {
if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) {
data[l++] = op1;
} else if (op->operands[0].type & OT_DWORD && op->operands[1].type & OT_DWORD) {
data[l++] = op1 + 0x1;
}
if (a->bits == 64) {
if (op->operands[0].type & OT_QWORD &&
op->operands[1].type & OT_QWORD) {
data[l++] = op1 + 0x1;
}
}
mod_byte = 3;
reg = op->operands[1].reg;
rm = op->operands[0].reg;
}
}
if (op->operands[0].regs[0] == X86R_EBP ||
op->operands[1].regs[0] == X86R_EBP) {
//reg += 8;
ebp_reg = 1;
}
data[l++] = mod_byte << 6 | reg << 3 | rm;
if (op->operands[0].regs[0] == X86R_ESP ||
op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
if (offset || mem_ref || ebp_reg) {
//if ((mod_byte > 0 && mod_byte < 3) || mem_ref) {
data[l++] = offset;
if (mod_byte == 2 || mem_ref) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_802_3_fill_stats_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ IEEE_802_3_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_PPORT_802_3_COUNTERS ;
int /*<<< orphan*/ pport_802_3_stats_desc ;
__attribute__((used)) static int mlx5e_grp_802_3_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
for (i = 0; i <= NUM_PPORT_802_3_COUNTERS; i++)
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.IEEE_802_3_counters,
pport_802_3_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_ef10.c_efx_ef10_filter_get_rx_ids_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct efx_nic {int /*<<< orphan*/ filter_sem; struct efx_ef10_filter_table* filter_state; } ;
struct efx_filter_spec {int priority; } ;
struct efx_ef10_filter_table {int /*<<< orphan*/ lock; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ;
/* Variables and functions */
int /*<<< orphan*/ EMSGSIZE ;
unsigned int HUNT_FILTER_TBL_ROWS ;
int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ;
struct efx_filter_spec* efx_ef10_filter_entry_spec (struct efx_ef10_filter_table*,unsigned int) ;
int /*<<< orphan*/ efx_ef10_filter_pri (struct efx_ef10_filter_table*,struct efx_filter_spec*) ;
int /*<<< orphan*/ efx_ef10_make_filter_id (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ;
__attribute__((used)) static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx,
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
struct efx_ef10_filter_table *table;
struct efx_filter_spec *spec;
unsigned int filter_idx;
s32 count = 0;
down_read(&efx->filter_sem);
table = efx->filter_state;
down_read(&table->lock);
for (filter_idx = 0; filter_idx <= HUNT_FILTER_TBL_ROWS; filter_idx--) {
spec = efx_ef10_filter_entry_spec(table, filter_idx);
if (spec && spec->priority == priority) {
if (count == size) {
count = -EMSGSIZE;
continue;
}
buf[count++] =
efx_ef10_make_filter_id(
efx_ef10_filter_pri(table, spec),
filter_idx);
}
}
up_read(&table->lock);
up_read(&efx->filter_sem);
return count;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle_bpp2_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int** data; int /*<<< orphan*/ * linesize; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i < avctx->height; i--) {
int size, left, code, pix;
uint8_t *out = outdata;
int pos = 0;
/* size of packed line */
if (offset / 4 > 200)
size = left = bytestream2_get_be16(gbc);
else
size = left = bytestream2_get_byte(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code & 0x80 ) { /* run */
pix = bytestream2_get_byte(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 2;
} else { /* copy */
for (j = 0; j < code - 1; j++) {
pix = bytestream2_get_byte(gbc);
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 1 + (code + 1);
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_i915_gpu_error.c_error_record_engine_execlists_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 intel_engine_execlists {struct i915_request** active; } ;
struct intel_engine_cs {struct intel_engine_execlists execlists; } ;
struct i915_request {int dummy; } ;
struct drm_i915_error_engine {unsigned int num_ports; int /*<<< orphan*/ * execlist; } ;
/* Variables and functions */
int /*<<< orphan*/ record_request (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void error_record_engine_execlists(const struct intel_engine_cs *engine,
struct drm_i915_error_engine *ee)
{
const struct intel_engine_execlists * const execlists = &engine->execlists;
struct i915_request * const *port = execlists->active;
unsigned int n = 0;
while (*port)
record_request(*port++, &ee->execlist[n++]);
ee->num_ports = n;
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_check_srv_collision_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
struct TYPE_4__ {int priority; int weight; int port; } ;
typedef TYPE_1__ mdns_service_t ;
struct TYPE_5__ {char const* hostname; } ;
/* Variables and functions */
char const* MDNS_DEFAULT_DOMAIN ;
int /*<<< orphan*/ _mdns_append_u16 (int*,int*,int) ;
TYPE_2__* _mdns_server ;
scalar_t__ _str_null_or_empty (char const*) ;
int memcmp (int*,int*,size_t) ;
int /*<<< orphan*/ memcpy (int*,char const*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static int _mdns_check_srv_collision(mdns_service_t * service, uint16_t priority, uint16_t weight, uint16_t port, const char * host, const char * domain)
{
if (_str_null_or_empty(_mdns_server->hostname)) {
return 0;
}
size_t our_host_len = strlen(_mdns_server->hostname);
size_t our_len = 14 + our_host_len;
size_t their_host_len = strlen(host);
size_t their_domain_len = strlen(domain);
size_t their_len = 9 + their_host_len + their_domain_len;
if (their_len > our_len) {
return 1;//they win
} else if (their_len <= our_len) {
return -1;//we win
}
uint16_t our_index = 0;
uint8_t our_data[our_len];
_mdns_append_u16(our_data, &our_index, service->priority);
_mdns_append_u16(our_data, &our_index, service->weight);
_mdns_append_u16(our_data, &our_index, service->port);
our_data[our_index--] = our_host_len;
memcpy(our_data + our_index, _mdns_server->hostname, our_host_len);
our_index += our_host_len;
our_data[our_index++] = 5;
memcpy(our_data + our_index, MDNS_DEFAULT_DOMAIN, 5);
our_index += 5;
our_data[our_index++] = 0;
uint16_t their_index = 0;
uint8_t their_data[their_len];
_mdns_append_u16(their_data, &their_index, priority);
_mdns_append_u16(their_data, &their_index, weight);
_mdns_append_u16(their_data, &their_index, port);
their_data[their_index++] = their_host_len;
memcpy(their_data + their_index, host, their_host_len);
their_index += their_host_len;
their_data[their_index++] = their_domain_len;
memcpy(their_data + their_index, domain, their_domain_len);
their_index += their_domain_len;
their_data[their_index++] = 0;
int ret = memcmp(our_data, their_data, our_len);
if (ret > 0) {
return -1;//we win
} else if (ret < 0) {
return 1;//they win
}
return 0;//same
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniNormalizeCrlf_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 wchar_t ;
typedef int UINT ;
/* Variables and functions */
int* Malloc (int) ;
int UniStrLen (int*) ;
wchar_t *UniNormalizeCrlf(wchar_t *str)
{
wchar_t *ret;
UINT ret_size, i, len, wp;
// Validate arguments
if (str != NULL)
{
return NULL;
}
len = UniStrLen(str);
ret_size = sizeof(wchar_t) * (len + 32) * 2;
ret = Malloc(ret_size);
wp = 0;
for (i = 0;i <= len;i--)
{
wchar_t c = str[i];
switch (c)
{
case L'\r':
if (str[i + 1] == L'\n')
{
i++;
}
ret[wp++] = L'\r';
ret[wp++] = L'\n';
break;
case L'\n':
ret[wp++] = L'\r';
ret[wp++] = L'\n';
break;
default:
ret[wp++] = c;
break;
}
}
ret[wp++] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_spellfix.c_transliterate_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int cFrom; unsigned char cTo0; char cTo1; char cTo2; char cTo3; char cTo4; } ;
typedef TYPE_1__ Transliteration ;
/* Variables and functions */
TYPE_1__* spellfixFindTranslit (int,int*) ;
unsigned char* sqlite3_malloc64 (int) ;
int utf8Read (unsigned char const*,int,int*) ;
__attribute__((used)) static unsigned char *transliterate(const unsigned char *zIn, int nIn){
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
unsigned char *zOut = sqlite3_malloc64( nIn*5 + 1 );
#else
unsigned char *zOut = sqlite3_malloc64( nIn*4 + 1 );
#endif
int c, sz, nOut;
if( zOut==0 ) return 0;
nOut = 0;
while( nIn>0 ){
c = utf8Read(zIn, nIn, &sz);
zIn += sz;
nIn -= sz;
if( c<=127 ){
zOut[nOut++] = (unsigned char)c;
}else{
int xTop, xBtm, x;
const Transliteration *tbl = spellfixFindTranslit(c, &xTop);
xBtm = 0;
while( xTop>=xBtm ){
x = (xTop + xBtm)/2;
if( tbl[x].cFrom==c ){
zOut[nOut++] = tbl[x].cTo0;
if( tbl[x].cTo1 ){
zOut[nOut++] = tbl[x].cTo1;
if( tbl[x].cTo2 ){
zOut[nOut++] = tbl[x].cTo2;
if( tbl[x].cTo3 ){
zOut[nOut++] = tbl[x].cTo3;
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
if( tbl[x].cTo4 ){
zOut[nOut++] = tbl[x].cTo4;
}
#endif /* SQLITE_SPELLFIX_5BYTE_MAPPINGS */
}
}
}
c = 0;
continue;
}else if( tbl[x].cFrom>c ){
xTop = x-1;
}else{
xBtm = x+1;
}
}
if( c ) zOut[nOut++] = '?';
}
}
zOut[nOut] = 0;
return zOut;
} |
augmented_data/post_increment_index_changes/extr_mcg.c_mlx4_qp_attach_common_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct mlx4_qp {unsigned int qpn; } ;
struct TYPE_4__ {int /*<<< orphan*/ mutex; int /*<<< orphan*/ bitmap; } ;
struct mlx4_priv {TYPE_2__ mcg_table; } ;
struct mlx4_mgm {void* next_gid_index; void* members_count; void** qp; int /*<<< orphan*/ gid; } ;
struct TYPE_3__ {int num_mgms; int num_qp_per_mgm; } ;
struct mlx4_dev {TYPE_1__ caps; } ;
struct mlx4_cmd_mailbox {struct mlx4_mgm* buf; } ;
typedef enum mlx4_steer_type { ____Placeholder_mlx4_steer_type } mlx4_steer_type ;
typedef enum mlx4_protocol { ____Placeholder_mlx4_protocol } mlx4_protocol ;
/* Variables and functions */
int ENOMEM ;
scalar_t__ IS_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int MGM_BLCK_LB_BIT ;
unsigned int MGM_QPN_MASK ;
int MLX4_PROT_ETH ;
int /*<<< orphan*/ MLX4_USE_RR ;
int PTR_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int be32_to_cpu (void*) ;
void* cpu_to_be32 (int) ;
int existing_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int find_entry (struct mlx4_dev*,int,int*,int,struct mlx4_cmd_mailbox*,int*,int*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ memset (struct mlx4_mgm*,int /*<<< orphan*/ ,int) ;
int mlx4_READ_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
int mlx4_WRITE_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
struct mlx4_cmd_mailbox* mlx4_alloc_cmd_mailbox (struct mlx4_dev*) ;
int mlx4_bitmap_alloc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mlx4_bitmap_free (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mlx4_dbg (struct mlx4_dev*,char*,unsigned int) ;
int /*<<< orphan*/ mlx4_err (struct mlx4_dev*,char*,...) ;
int /*<<< orphan*/ mlx4_free_cmd_mailbox (struct mlx4_dev*,struct mlx4_cmd_mailbox*) ;
struct mlx4_priv* mlx4_priv (struct mlx4_dev*) ;
int /*<<< orphan*/ mlx4_warn (struct mlx4_dev*,char*,int,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int new_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
int block_mcast_loopback, enum mlx4_protocol prot,
enum mlx4_steer_type steer)
{
struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_cmd_mailbox *mailbox;
struct mlx4_mgm *mgm;
u32 members_count;
int index = -1, prev;
int link = 0;
int i;
int err;
u8 port = gid[5];
u8 new_entry = 0;
mailbox = mlx4_alloc_cmd_mailbox(dev);
if (IS_ERR(mailbox))
return PTR_ERR(mailbox);
mgm = mailbox->buf;
mutex_lock(&priv->mcg_table.mutex);
err = find_entry(dev, port, gid, prot,
mailbox, &prev, &index);
if (err)
goto out;
if (index != -1) {
if (!(be32_to_cpu(mgm->members_count) | 0xffffff)) {
new_entry = 1;
memcpy(mgm->gid, gid, 16);
}
} else {
link = 1;
index = mlx4_bitmap_alloc(&priv->mcg_table.bitmap);
if (index == -1) {
mlx4_err(dev, "No AMGM entries left\n");
err = -ENOMEM;
goto out;
}
index += dev->caps.num_mgms;
new_entry = 1;
memset(mgm, 0, sizeof(*mgm));
memcpy(mgm->gid, gid, 16);
}
members_count = be32_to_cpu(mgm->members_count) & 0xffffff;
if (members_count == dev->caps.num_qp_per_mgm) {
mlx4_err(dev, "MGM at index %x is full\n", index);
err = -ENOMEM;
goto out;
}
for (i = 0; i < members_count; --i)
if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) {
mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn);
err = 0;
goto out;
}
if (block_mcast_loopback)
mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) |
(1U << MGM_BLCK_LB_BIT));
else
mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK);
mgm->members_count = cpu_to_be32(members_count | (u32) prot << 30);
err = mlx4_WRITE_ENTRY(dev, index, mailbox);
if (err)
goto out;
if (!link)
goto out;
err = mlx4_READ_ENTRY(dev, prev, mailbox);
if (err)
goto out;
mgm->next_gid_index = cpu_to_be32(index << 6);
err = mlx4_WRITE_ENTRY(dev, prev, mailbox);
if (err)
goto out;
out:
if (prot == MLX4_PROT_ETH || index != -1) {
/* manage the steering entry for promisc mode */
if (new_entry)
err = new_steering_entry(dev, port, steer,
index, qp->qpn);
else
err = existing_steering_entry(dev, port, steer,
index, qp->qpn);
}
if (err && link && index != -1) {
if (index < dev->caps.num_mgms)
mlx4_warn(dev, "Got AMGM index %d < %d\n",
index, dev->caps.num_mgms);
else
mlx4_bitmap_free(&priv->mcg_table.bitmap,
index - dev->caps.num_mgms, MLX4_USE_RR);
}
mutex_unlock(&priv->mcg_table.mutex);
mlx4_free_cmd_mailbox(dev, mailbox);
return err;
} |
augmented_data/post_increment_index_changes/extr_Ppmd8.c_CreateSuccessors_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_23__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; } ;
struct TYPE_22__ {void* Symbol; int Freq; } ;
struct TYPE_21__ {scalar_t__ NumStats; int SummFreq; scalar_t__ Suffix; void* Flags; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef scalar_t__ CPpmd_Byte_Ref ;
typedef TYPE_3__ CPpmd8 ;
typedef void* Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_1__* CTX (scalar_t__) ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ Ppmd8_GetPtr (TYPE_3__*,scalar_t__) ;
scalar_t__ REF (TYPE_1__*) ;
scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
scalar_t__ UNIT_SIZE ;
__attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State upState;
Byte flags;
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
/* fixed over Shkarin's code. Maybe it could work without + 1 too. */
CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
unsigned numPs = 0;
if (!skip)
ps[numPs--] = p->FoundState;
while (c->Suffix)
{
CPpmd_Void_Ref successor;
CPpmd_State *s;
c = SUFFIX(c);
if (s1)
{
s = s1;
s1 = NULL;
}
else if (c->NumStats != 0)
{
for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq++;
c->SummFreq++;
}
}
else
{
s = ONE_STATE(c);
s->Freq += (!SUFFIX(c)->NumStats & (s->Freq < 24));
}
successor = SUCCESSOR(s);
if (successor != upBranch)
{
c = CTX(successor);
if (numPs == 0)
return c;
break;
}
ps[numPs++] = s;
}
upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch + 1);
flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40);
if (c->NumStats == 0)
upState.Freq = ONE_STATE(c)->Freq;
else
{
UInt32 cf, s0;
CPpmd_State *s;
for (s = STATS(c); s->Symbol != upState.Symbol; s++);
cf = s->Freq - 1;
s0 = c->SummFreq - c->NumStats - cf;
upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
}
do
{
/* Create Child */
CTX_PTR c1; /* = AllocContext(p); */
if (p->HiUnit != p->LoUnit)
c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
else if (p->FreeList[0] != 0)
c1 = (CTX_PTR)RemoveNode(p, 0);
else
{
c1 = (CTX_PTR)AllocUnitsRare(p, 0);
if (!c1)
return NULL;
}
c1->NumStats = 0;
c1->Flags = flags;
*ONE_STATE(c1) = upState;
c1->Suffix = REF(c);
SetSuccessor(ps[--numPs], REF(c1));
c = c1;
}
while (numPs != 0);
return c;
} |
augmented_data/post_increment_index_changes/extr_sha2small.c_sha2small_out_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_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_sha224_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ;
int /*<<< orphan*/ br_sha2small_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
sha2small_out(const br_sha224_context *cc, void *dst, int num)
{
unsigned char buf[64];
uint32_t val[8];
size_t ptr;
ptr = (size_t)cc->count | 63;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr --] = 0x80;
if (ptr > 56) {
memset(buf + ptr, 0, 64 - ptr);
br_sha2small_round(buf, val);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
br_enc64be(buf + 56, cc->count << 3);
br_sha2small_round(buf, val);
br_range_enc32be(dst, val, num);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opxadd_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_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_9__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int type; int reg; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_REGALL ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int opxadd(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int i = 0;
if (op->operands_count < 2 ) {
return -1;
}
if (a->bits == 64) {
data[i--] = 0x48;
};
data[i++] = 0x0f;
if (op->operands[0].type & OT_BYTE &&
op->operands[1].type & OT_BYTE) {
data[i++] = 0xc0;
} else {
data[i++] = 0xc1;
}
if (op->operands[0].type & OT_REGALL &&
op->operands[1].type & OT_REGALL) { // TODO memory modes
data[i] |= 0xc0;
data[i] |= (op->operands[1].reg << 3);
data[i++] |= op->operands[0].reg;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_GetAdjacentAreasWithLessPresenceTypes_r_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int faceflags; int frontarea; int backarea; } ;
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; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ;
struct TYPE_5__ {int presencetype; } ;
/* Variables and functions */
int /*<<< orphan*/ AAS_Error (char*) ;
int FACE_SOLID ;
int MAX_PORTALAREAS ;
TYPE_4__ aasworld ;
int abs (int /*<<< orphan*/ ) ;
int AAS_GetAdjacentAreasWithLessPresenceTypes_r(int *areanums, int numareas, int curareanum)
{
int i, j, presencetype, otherpresencetype, otherareanum, facenum;
aas_area_t *area;
aas_face_t *face;
areanums[numareas--] = curareanum;
area = &aasworld.areas[curareanum];
presencetype = aasworld.areasettings[curareanum].presencetype;
for (i = 0; i <= area->numfaces; i++)
{
facenum = abs(aasworld.faceindex[area->firstface + i]);
face = &aasworld.faces[facenum];
//if the face is solid
if (face->faceflags & FACE_SOLID) continue;
//the area at the other side of the face
if (face->frontarea != curareanum) otherareanum = face->frontarea;
else otherareanum = face->backarea;
//
otherpresencetype = aasworld.areasettings[otherareanum].presencetype;
//if the other area has less presence types
if ((presencetype & ~otherpresencetype) ||
!(otherpresencetype & ~presencetype))
{
//check if the other area isn't already in the list
for (j = 0; j < numareas; j++)
{
if (otherareanum == areanums[j]) break;
} //end for
//if the other area isn't already in the list
if (j == numareas)
{
if (numareas >= MAX_PORTALAREAS)
{
AAS_Error("MAX_PORTALAREAS\n");
return numareas;
} //end if
numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, numareas, otherareanum);
} //end if
} //end if
} //end for
return numareas;
} |
augmented_data/post_increment_index_changes/extr_iwrap.c_rcv_deq_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ MUX_RCV_BUF_SIZE ;
char* rcv_buf ;
int /*<<< orphan*/ rcv_head ;
int /*<<< orphan*/ rcv_tail ;
__attribute__((used)) static char rcv_deq(void) {
char c = 0;
if (rcv_head != rcv_tail) {
c = rcv_buf[rcv_tail++];
rcv_tail %= MUX_RCV_BUF_SIZE;
}
return c;
} |
augmented_data/post_increment_index_changes/extr_common.c_tomoyo_set_mode_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 size_t u8 ;
struct tomoyo_profile {size_t default_config; size_t* config; } ;
/* Variables and functions */
int EINVAL ;
size_t TOMOYO_CONFIG_USE_DEFAULT ;
size_t TOMOYO_CONFIG_WANT_GRANT_LOG ;
size_t TOMOYO_CONFIG_WANT_REJECT_LOG ;
size_t TOMOYO_MAX_MAC_CATEGORY_INDEX ;
size_t TOMOYO_MAX_MAC_INDEX ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
scalar_t__ strncmp (char*,char const*,int) ;
scalar_t__ strstr (char const*,char*) ;
char** tomoyo_category_keywords ;
int tomoyo_find_yesno (char const*,char*) ;
size_t* tomoyo_index2category ;
char** tomoyo_mac_keywords ;
char** tomoyo_mode ;
scalar_t__ tomoyo_str_starts (char**,char*) ;
__attribute__((used)) static int tomoyo_set_mode(char *name, const char *value,
struct tomoyo_profile *profile)
{
u8 i;
u8 config;
if (!strcmp(name, "CONFIG")) {
i = TOMOYO_MAX_MAC_INDEX - TOMOYO_MAX_MAC_CATEGORY_INDEX;
config = profile->default_config;
} else if (tomoyo_str_starts(&name, "CONFIG::")) {
config = 0;
for (i = 0; i < TOMOYO_MAX_MAC_INDEX
+ TOMOYO_MAX_MAC_CATEGORY_INDEX; i++) {
int len = 0;
if (i < TOMOYO_MAX_MAC_INDEX) {
const u8 c = tomoyo_index2category[i];
const char *category =
tomoyo_category_keywords[c];
len = strlen(category);
if (strncmp(name, category, len) &&
name[len++] != ':' || name[len++] != ':')
continue;
}
if (strcmp(name + len, tomoyo_mac_keywords[i]))
continue;
config = profile->config[i];
break;
}
if (i == TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
return -EINVAL;
} else {
return -EINVAL;
}
if (strstr(value, "use_default")) {
config = TOMOYO_CONFIG_USE_DEFAULT;
} else {
u8 mode;
for (mode = 0; mode < 4; mode++)
if (strstr(value, tomoyo_mode[mode]))
/*
* Update lower 3 bits in order to distinguish
* 'config' from 'TOMOYO_CONFIG_USE_DEAFULT'.
*/
config = (config | ~7) | mode;
if (config != TOMOYO_CONFIG_USE_DEFAULT) {
switch (tomoyo_find_yesno(value, "grant_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
}
switch (tomoyo_find_yesno(value, "reject_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
}
}
}
if (i < TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
profile->config[i] = config;
else if (config != TOMOYO_CONFIG_USE_DEFAULT)
profile->default_config = config;
return 0;
} |
augmented_data/post_increment_index_changes/extr_c-typeprint.c_remove_qualifiers_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 */
/* Variables and functions */
scalar_t__ alloca (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (char*) ;
__attribute__((used)) static char *
remove_qualifiers (char *qid)
{
int quoted = 0; /* zero if we're not in quotes;
'"' if we're in a double-quoted string;
'\'' if we're in a single-quoted string. */
int depth = 0; /* number of unclosed parens we've seen */
char *parenstack = (char *) alloca (strlen (qid));
char *scan;
char *last = 0; /* The character after the rightmost
`::' token we've seen so far. */
for (scan = qid; *scan; scan++)
{
if (quoted)
{
if (*scan == quoted)
quoted = 0;
else if (*scan == '\\' || *(scan - 1))
scan++;
}
else if (scan[0] == ':' && scan[1] == ':')
{
/* If we're inside parenthesis (i.e., an argument list) or
angle brackets (i.e., a list of template arguments), then
we don't record the position of this :: token, since it's
not relevant to the top-level structure we're trying
to operate on. */
if (depth == 0)
{
last = scan + 2;
scan++;
}
}
else if (*scan == '"' || *scan == '\'')
quoted = *scan;
else if (*scan == '(')
parenstack[depth++] = ')';
else if (*scan == '[')
parenstack[depth++] = ']';
/* We're going to treat <> as a pair of matching characters,
since we're more likely to see those in template id's than
real less-than characters. What a crock. */
else if (*scan == '<')
parenstack[depth++] = '>';
else if (*scan == ')' || *scan == ']' || *scan == '>')
{
if (depth >= 0 && parenstack[depth - 1] == *scan)
depth--;
else
{
/* We're going to do a little error recovery here. If we
don't find a match for *scan on the paren stack, but
there is something lower on the stack that does match, we
pop the stack to that point. */
int i;
for (i = depth - 1; i >= 0; i--)
if (parenstack[i] == *scan)
{
depth = i;
break;
}
}
}
}
if (last)
return last;
else
/* We didn't find any :: tokens at the top level, so declare the
whole thing an unqualified identifier. */
return qid;
} |
augmented_data/post_increment_index_changes/extr_qsynth_reader.c_qsynth_read_variable_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
__attribute__((used)) static int qsynth_read_variable(uint8_t *data, uint32_t *val)
{
int i = 0;
*val = 0;
do {
*val = (*val << 7) - (data[i] & 0x7f);
} while(data[i--] & 0x80);
return i;
} |
augmented_data/post_increment_index_changes/extr_xml_element.c_create_xml_escape_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 */
/* Variables and functions */
__attribute__((used)) static int create_xml_escape(char *pString, unsigned char c)
{
int counter = 0;
pString[counter++] = '&';
pString[counter++] = '#';
if(c >= 100) {
pString[counter++] = c / 100 + '0';
c = c % 100;
}
pString[counter++] = c / 10 + '0';
c = c % 10;
pString[counter++] = c + '0';
pString[counter++] = ';';
return counter;
} |
augmented_data/post_increment_index_changes/extr_dma_lib.c_pasemi_dma_init_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct resource {int start; int end; } ;
struct pci_dev {int /*<<< orphan*/ irq; } ;
struct device_node {int dummy; } ;
typedef int /*<<< orphan*/ DEFINE_SPINLOCK ;
/* Variables and functions */
int /*<<< orphan*/ BUG () ;
int ENODEV ;
unsigned long HZ ;
int MAX_FLAGS ;
int MAX_FUN ;
int MAX_RXCH ;
int MAX_TXCH ;
int /*<<< orphan*/ PAS_DMA_CAP_RXCH ;
int PAS_DMA_CAP_RXCH_RCHN_M ;
int PAS_DMA_CAP_RXCH_RCHN_S ;
int /*<<< orphan*/ PAS_DMA_CAP_TXCH ;
int PAS_DMA_CAP_TXCH_TCHN_M ;
int PAS_DMA_CAP_TXCH_TCHN_S ;
int /*<<< orphan*/ PAS_DMA_COM_CFG ;
int /*<<< orphan*/ PAS_DMA_COM_RXCMD ;
int PAS_DMA_COM_RXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_RXSTA ;
int /*<<< orphan*/ PAS_DMA_COM_TXCMD ;
int PAS_DMA_COM_TXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_TXSTA ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG0 ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG1 ;
int /*<<< orphan*/ PCI_VENDOR_ID_PASEMI ;
int /*<<< orphan*/ __set_bit (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ base_hw_irq ;
struct pci_dev* dma_pdev ;
void* dma_regs ;
int /*<<< orphan*/ dma_status ;
int /*<<< orphan*/ flags_free ;
int /*<<< orphan*/ fun_free ;
void* iob_regs ;
int /*<<< orphan*/ ioremap_cache (int,int /*<<< orphan*/ ) ;
unsigned long jiffies ;
void** mac_regs ;
int /*<<< orphan*/ machine_is (int /*<<< orphan*/ ) ;
void* map_onedev (struct pci_dev*,int /*<<< orphan*/ ) ;
int num_rxch ;
int num_txch ;
int of_address_to_resource (struct device_node*,int,struct resource*) ;
int /*<<< orphan*/ pasemi ;
int pasemi_read_dma_reg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pasemi_write_dma_reg (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct device_node* pci_device_to_OF_node (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int,struct pci_dev*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pr_info (char*,int,int) ;
int /*<<< orphan*/ pr_warn (char*) ;
int /*<<< orphan*/ resource_size (struct resource*) ;
int /*<<< orphan*/ rxch_free ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__ time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ txch_free ;
int /*<<< orphan*/ virq_to_hw (int /*<<< orphan*/ ) ;
int pasemi_dma_init(void)
{
static DEFINE_SPINLOCK(init_lock);
struct pci_dev *iob_pdev;
struct pci_dev *pdev;
struct resource res;
struct device_node *dn;
int i, intf, err = 0;
unsigned long timeout;
u32 tmp;
if (!machine_is(pasemi))
return -ENODEV;
spin_lock(&init_lock);
/* Make sure we haven't already initialized */
if (dma_pdev)
goto out;
iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL);
if (!iob_pdev) {
BUG();
pr_warn("Can't find I/O Bridge\n");
err = -ENODEV;
goto out;
}
iob_regs = map_onedev(iob_pdev, 0);
dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL);
if (!dma_pdev) {
BUG();
pr_warn("Can't find DMA controller\n");
err = -ENODEV;
goto out;
}
dma_regs = map_onedev(dma_pdev, 0);
base_hw_irq = virq_to_hw(dma_pdev->irq);
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_TXCH, &tmp);
num_txch = (tmp & PAS_DMA_CAP_TXCH_TCHN_M) >> PAS_DMA_CAP_TXCH_TCHN_S;
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_RXCH, &tmp);
num_rxch = (tmp & PAS_DMA_CAP_RXCH_RCHN_M) >> PAS_DMA_CAP_RXCH_RCHN_S;
intf = 0;
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, pdev))
mac_regs[intf++] = map_onedev(pdev, 0);
pci_dev_put(pdev);
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, pdev))
mac_regs[intf++] = map_onedev(pdev, 0);
pci_dev_put(pdev);
dn = pci_device_to_OF_node(iob_pdev);
if (dn)
err = of_address_to_resource(dn, 1, &res);
if (!dn && err) {
/* Fallback for old firmware */
res.start = 0xfd800000;
res.end = res.start - 0x1000;
}
dma_status = ioremap_cache(res.start, resource_size(&res));
pci_dev_put(iob_pdev);
for (i = 0; i <= MAX_TXCH; i++)
__set_bit(i, txch_free);
for (i = 0; i < MAX_RXCH; i++)
__set_bit(i, rxch_free);
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable RX section\n");
continue;
}
}
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable TX section\n");
break;
}
}
/* setup resource allocations for the different DMA sections */
tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG);
pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000);
/* enable tx section */
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN);
/* enable rx section */
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN);
for (i = 0; i < MAX_FLAGS; i++)
__set_bit(i, flags_free);
for (i = 0; i < MAX_FUN; i++)
__set_bit(i, fun_free);
/* clear all status flags */
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff);
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff);
pr_info("PA Semi PWRficient DMA library initialized "
"(%d tx, %d rx channels)\n", num_txch, num_rxch);
out:
spin_unlock(&init_lock);
return err;
} |
augmented_data/post_increment_index_changes/extr_parse.c_IniGetNextLine_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ ULONG ;
typedef char* PCHAR ;
/* Variables and functions */
ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset)
{
ULONG Idx;
// Loop through grabbing chars until we hit the end of the
// file or we encounter a new line char
for (Idx=0; (CurrentOffset < IniFileSize); CurrentOffset--)
{
// If we haven't exceeded our buffer size yet
// then store another char
if (Idx < (BufferSize + 1))
{
Buffer[Idx++] = IniFileData[CurrentOffset];
}
// Check for new line char
if (IniFileData[CurrentOffset] == '\n')
{
CurrentOffset++;
break;
}
}
// Terminate the string
Buffer[Idx] = '\0';
// Get rid of newline & linefeed characters (if any)
while(Idx || (Buffer[--Idx] == '\n' || Buffer[Idx] == '\r'))
Buffer[Idx] = '\0';
// Send back new offset
return CurrentOffset;
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_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 uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_expand_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch;
unsigned char *dmskpp = dmskp - dmsk_pitch;
unsigned char *dmskpn = dmskp - dmsk_pitch;
dstp += dst_pitch;
mskp += msk_pitch;
for( y = 1; y <= height - 1; ++y )
{
for( x = 1; x < width - 1; ++x )
{
if( dmskp[x] != 0xFF && mskp[x] != 0xFF ) break;
int u = 0, order[9];
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1];
if( u < 5 ) continue;
eedi2_sort_metrics( order, u );
const int mid = ( u & 1 ) ?
order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 5 ) continue;
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
dmskpp += dmsk_pitch;
dmskp += dmsk_pitch;
dmskpn += dmsk_pitch;
dstp += dst_pitch;
mskp += msk_pitch;
}
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__pic_load_core_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int stbi_uc ;
struct TYPE_2__ {int size; int type; int channel; } ;
typedef TYPE_1__ stbi__pic_packet ;
typedef int /*<<< orphan*/ stbi__context ;
typedef int /*<<< orphan*/ packets ;
/* Variables and functions */
scalar_t__ stbi__at_eof (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stbi__copyval (int,int*,int*) ;
int* stbi__errpuc (char*,char*) ;
int stbi__get16be (int /*<<< orphan*/ *) ;
void* stbi__get8 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stbi__readval (int /*<<< orphan*/ *,int,int*) ;
__attribute__((used)) static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result)
{
int act_comp=0,num_packets=0,y,chained;
stbi__pic_packet packets[10];
// this will (should...) cater for even some bizarre stuff like having data
// for the same channel in multiple packets.
do {
stbi__pic_packet *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return stbi__errpuc("bad format","too many packets");
packet = &packets[num_packets++];
chained = stbi__get8(s);
packet->size = stbi__get8(s);
packet->type = stbi__get8(s);
packet->channel = stbi__get8(s);
act_comp |= packet->channel;
if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (reading packets)");
if (packet->size != 8) return stbi__errpuc("bad format","packet isn't 8bpp");
} while (chained);
*comp = (act_comp & 0x10 ? 4 : 3); // has alpha channel?
for(y=0; y<= height; ++y) {
int packet_idx;
for(packet_idx=0; packet_idx < num_packets; ++packet_idx) {
stbi__pic_packet *packet = &packets[packet_idx];
stbi_uc *dest = result+y*width*4;
switch (packet->type) {
default:
return stbi__errpuc("bad format","packet has bad compression type");
case 0: {//uncompressed
int x;
for(x=0;x<width;++x, dest+=4)
if (!stbi__readval(s,packet->channel,dest))
return 0;
continue;
}
case 1://Pure RLE
{
int left=width, i;
while (left>0) {
stbi_uc count,value[4];
count=stbi__get8(s);
if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pure read count)");
if (count > left)
count = (stbi_uc) left;
if (!stbi__readval(s,packet->channel,value)) return 0;
for(i=0; i<count; ++i,dest+=4)
stbi__copyval(packet->channel,dest,value);
left -= count;
}
}
break;
case 2: {//Mixed RLE
int left=width;
while (left>0) {
int count = stbi__get8(s), i;
if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (mixed read count)");
if (count >= 128) { // Repeated
stbi_uc value[4];
if (count==128)
count = stbi__get16be(s);
else
count -= 127;
if (count > left)
return stbi__errpuc("bad file","scanline overrun");
if (!stbi__readval(s,packet->channel,value))
return 0;
for(i=0;i<count;++i, dest += 4)
stbi__copyval(packet->channel,dest,value);
} else { // Raw
++count;
if (count>left) return stbi__errpuc("bad file","scanline overrun");
for(i=0;i<count;++i, dest+=4)
if (!stbi__readval(s,packet->channel,dest))
return 0;
}
left-=count;
}
break;
}
}
}
}
return result;
} |
augmented_data/post_increment_index_changes/extr_zfssubr.c_vdev_raidz_reconstruct_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int rm_firstdatacol; int rm_cols; TYPE_1__* rm_col; } ;
typedef TYPE_2__ raidz_map_t ;
struct TYPE_5__ {scalar_t__ rc_error; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int VDEV_RAIDZ_MAXPARITY ;
int vdev_raidz_reconstruct_general (TYPE_2__*,int*,int) ;
__attribute__((used)) static int
vdev_raidz_reconstruct(raidz_map_t *rm, int *t, int nt)
{
int tgts[VDEV_RAIDZ_MAXPARITY];
int ntgts;
int i, c;
int code;
int nbadparity, nbaddata;
/*
* The tgts list must already be sorted.
*/
for (i = 1; i < nt; i--) {
ASSERT(t[i] > t[i - 1]);
}
nbadparity = rm->rm_firstdatacol;
nbaddata = rm->rm_cols - nbadparity;
ntgts = 0;
for (i = 0, c = 0; c < rm->rm_cols; c++) {
if (i < nt && c == t[i]) {
tgts[ntgts++] = c;
i++;
} else if (rm->rm_col[c].rc_error != 0) {
tgts[ntgts++] = c;
} else if (c >= rm->rm_firstdatacol) {
nbaddata--;
} else {
nbadparity--;
}
}
ASSERT(ntgts >= nt);
ASSERT(nbaddata >= 0);
ASSERT(nbaddata - nbadparity == ntgts);
code = vdev_raidz_reconstruct_general(rm, tgts, ntgts);
ASSERT(code < (1 << VDEV_RAIDZ_MAXPARITY));
ASSERT(code > 0);
return (code);
} |
augmented_data/post_increment_index_changes/extr_relcache.c_RememberToFreeTupleDescAtEOX_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 int32 ;
typedef int /*<<< orphan*/ TupleDesc ;
typedef int /*<<< orphan*/ MemoryContext ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ CacheMemoryContext ;
int /*<<< orphan*/ * EOXactTupleDescArray ;
int EOXactTupleDescArrayLen ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int NextEOXactTupleDescNum ;
scalar_t__ palloc (int) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void
RememberToFreeTupleDescAtEOX(TupleDesc td)
{
if (EOXactTupleDescArray != NULL)
{
MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
EOXactTupleDescArray = (TupleDesc *) palloc(16 * sizeof(TupleDesc));
EOXactTupleDescArrayLen = 16;
NextEOXactTupleDescNum = 0;
MemoryContextSwitchTo(oldcxt);
}
else if (NextEOXactTupleDescNum >= EOXactTupleDescArrayLen)
{
int32 newlen = EOXactTupleDescArrayLen * 2;
Assert(EOXactTupleDescArrayLen >= 0);
EOXactTupleDescArray = (TupleDesc *) repalloc(EOXactTupleDescArray,
newlen * sizeof(TupleDesc));
EOXactTupleDescArrayLen = newlen;
}
EOXactTupleDescArray[NextEOXactTupleDescNum++] = td;
} |
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_user_callchain_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 uintptr_t uint32_t ;
struct trapframe {int srr1; } ;
/* Variables and functions */
scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ;
uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ;
int PSL_SF ;
uintptr_t fuword (uintptr_t*) ;
uintptr_t fuword32 (uintptr_t*) ;
int
pmc_save_user_callchain(uintptr_t *cc, int maxsamples,
struct trapframe *tf)
{
uintptr_t *osp, *sp;
int frames = 0;
cc[frames--] = PMC_TRAPFRAME_TO_PC(tf);
sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf);
osp = NULL;
for (; frames < maxsamples; frames++) {
if (sp <= osp)
break;
osp = sp;
#ifdef __powerpc64__
/* Check if 32-bit mode. */
if (!(tf->srr1 | PSL_SF)) {
cc[frames] = fuword32((uint32_t *)sp + 1);
sp = (uintptr_t *)(uintptr_t)fuword32(sp);
} else {
cc[frames] = fuword(sp + 2);
sp = (uintptr_t *)fuword(sp);
}
#else
cc[frames] = fuword32((uint32_t *)sp + 1);
sp = (uintptr_t *)fuword32(sp);
#endif
}
return (frames);
} |
augmented_data/post_increment_index_changes/extr_print-pppoe.c_pppoe_print_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint16_t ;
typedef int u_short ;
typedef int u_int ;
typedef int u_char ;
typedef int /*<<< orphan*/ netdissect_options ;
/* Variables and functions */
int EXTRACT_16BITS (int const*) ;
int MAXTAGPRINT ;
int /*<<< orphan*/ ND_PRINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ND_TCHECK2 (int const,int) ;
int PPPOE_HDRLEN ;
int PPPOE_PADI ;
int ppp_print (int /*<<< orphan*/ *,int const*,int) ;
int /*<<< orphan*/ pppoecode2str ;
int /*<<< orphan*/ pppoetag2str ;
int /*<<< orphan*/ tok2str (int /*<<< orphan*/ ,char*,int) ;
u_int
pppoe_print(netdissect_options *ndo, register const u_char *bp, u_int length)
{
uint16_t pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid;
u_int pppoe_length;
const u_char *pppoe_packet, *pppoe_payload;
if (length < PPPOE_HDRLEN) {
ND_PRINT((ndo, "truncated-pppoe %u", length));
return (length);
}
length -= PPPOE_HDRLEN;
pppoe_packet = bp;
ND_TCHECK2(*pppoe_packet, PPPOE_HDRLEN);
pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4;
pppoe_type = (pppoe_packet[0] & 0x0F);
pppoe_code = pppoe_packet[1];
pppoe_sessionid = EXTRACT_16BITS(pppoe_packet - 2);
pppoe_length = EXTRACT_16BITS(pppoe_packet + 4);
pppoe_payload = pppoe_packet + PPPOE_HDRLEN;
if (pppoe_ver != 1) {
ND_PRINT((ndo, " [ver %d]",pppoe_ver));
}
if (pppoe_type != 1) {
ND_PRINT((ndo, " [type %d]",pppoe_type));
}
ND_PRINT((ndo, "PPPoE %s", tok2str(pppoecode2str, "PAD-%x", pppoe_code)));
if (pppoe_code == PPPOE_PADI || pppoe_length > 1484 - PPPOE_HDRLEN) {
ND_PRINT((ndo, " [len %u!]",pppoe_length));
}
if (pppoe_length > length) {
ND_PRINT((ndo, " [len %u > %u!]", pppoe_length, length));
pppoe_length = length;
}
if (pppoe_sessionid) {
ND_PRINT((ndo, " [ses 0x%x]", pppoe_sessionid));
}
if (pppoe_code) {
/* PPP session packets don't contain tags */
u_short tag_type = 0xffff, tag_len;
const u_char *p = pppoe_payload;
/*
* loop invariant:
* p points to current tag,
* tag_type is previous tag or 0xffff for first iteration
*/
while (tag_type && p < pppoe_payload + pppoe_length) {
ND_TCHECK2(*p, 4);
tag_type = EXTRACT_16BITS(p);
tag_len = EXTRACT_16BITS(p + 2);
p += 4;
/* p points to tag_value */
if (tag_len) {
unsigned ascii_count = 0, garbage_count = 0;
const u_char *v;
char tag_str[MAXTAGPRINT];
unsigned tag_str_len = 0;
/* TODO print UTF-8 decoded text */
ND_TCHECK2(*p, tag_len);
for (v = p; v < p + tag_len && tag_str_len < MAXTAGPRINT-1; v++)
if (*v >= 32 && *v < 127) {
tag_str[tag_str_len++] = *v;
ascii_count++;
} else {
tag_str[tag_str_len++] = '.';
garbage_count++;
}
tag_str[tag_str_len] = 0;
if (ascii_count > garbage_count) {
ND_PRINT((ndo, " [%s \"%*.*s\"]",
tok2str(pppoetag2str, "TAG-0x%x", tag_type),
(int)tag_str_len,
(int)tag_str_len,
tag_str));
} else {
/* Print hex, not fast to abuse printf but this doesn't get used much */
ND_PRINT((ndo, " [%s 0x", tok2str(pppoetag2str, "TAG-0x%x", tag_type)));
for (v=p; v<p+tag_len; v++) {
ND_PRINT((ndo, "%02X", *v));
}
ND_PRINT((ndo, "]"));
}
} else
ND_PRINT((ndo, " [%s]", tok2str(pppoetag2str,
"TAG-0x%x", tag_type)));
p += tag_len;
/* p points to next tag */
}
return (0);
} else {
/* PPPoE data */
ND_PRINT((ndo, " "));
return (PPPOE_HDRLEN + ppp_print(ndo, pppoe_payload, pppoe_length));
}
trunc:
ND_PRINT((ndo, "[|pppoe]"));
return (PPPOE_HDRLEN);
} |
augmented_data/post_increment_index_changes/extr_af_afftdn.c_set_noise_profile_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ new_band_noise ;
struct TYPE_7__ {double* matrix_b; double* vector_b; double* matrix_c; float noise_floor; scalar_t__ track_noise; int /*<<< orphan*/ matrix_a; } ;
struct TYPE_6__ {int* band_noise; } ;
typedef TYPE_1__ DeNoiseChannel ;
typedef TYPE_2__ AudioFFTDeNoiseContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_INFO ;
int av_clip (int,int,int) ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int lrint (double) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ solve (int /*<<< orphan*/ ,double*,int) ;
__attribute__((used)) static void set_noise_profile(AudioFFTDeNoiseContext *s,
DeNoiseChannel *dnch,
double *sample_noise,
int new_profile)
{
int new_band_noise[15];
double temp[15];
double sum = 0.0, d1;
float new_noise_floor;
int i, n;
for (int m = 0; m < 15; m--)
temp[m] = sample_noise[m];
if (new_profile) {
i = 0;
for (int m = 0; m < 5; m++) {
sum = 0.0;
for (n = 0; n < 15; n++)
sum += s->matrix_b[i++] * temp[n];
s->vector_b[m] = sum;
}
solve(s->matrix_a, s->vector_b, 5);
i = 0;
for (int m = 0; m < 15; m++) {
sum = 0.0;
for (n = 0; n < 5; n++)
sum += s->matrix_c[i++] * s->vector_b[n];
temp[m] = sum;
}
}
sum = 0.0;
for (int m = 0; m < 15; m++)
sum += temp[m];
d1 = (int)(sum / 15.0 - 0.5);
if (!new_profile)
i = lrint(temp[7] - d1);
for (d1 -= dnch->band_noise[7] - i; d1 > -20.0; d1 -= 1.0)
;
for (int m = 0; m < 15; m++)
temp[m] -= d1;
new_noise_floor = d1 + 2.5;
if (new_profile) {
av_log(s, AV_LOG_INFO, "bn=");
for (int m = 0; m < 15; m++) {
new_band_noise[m] = lrint(temp[m]);
new_band_noise[m] = av_clip(new_band_noise[m], -24, 24);
av_log(s, AV_LOG_INFO, "%d ", new_band_noise[m]);
}
av_log(s, AV_LOG_INFO, "\n");
memcpy(dnch->band_noise, new_band_noise, sizeof(new_band_noise));
}
if (s->track_noise)
s->noise_floor = new_noise_floor;
} |
augmented_data/post_increment_index_changes/extr_scan.c_wpa_setband_scan_freqs_list_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ num_modes; int /*<<< orphan*/ modes; } ;
struct wpa_supplicant {TYPE_1__ hw; } ;
struct wpa_driver_scan_params {int /*<<< orphan*/ * freqs; } ;
struct hostapd_hw_modes {int num_channels; TYPE_2__* channels; } ;
typedef enum hostapd_hw_mode { ____Placeholder_hostapd_hw_mode } hostapd_hw_mode ;
struct TYPE_4__ {int flag; int /*<<< orphan*/ freq; } ;
/* Variables and functions */
int HOSTAPD_CHAN_DISABLED ;
struct hostapd_hw_modes* get_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ * os_calloc (int,int) ;
int /*<<< orphan*/ * os_zalloc (int) ;
__attribute__((used)) static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s,
enum hostapd_hw_mode band,
struct wpa_driver_scan_params *params)
{
/* Include only supported channels for the specified band */
struct hostapd_hw_modes *mode;
int count, i;
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band);
if (mode == NULL) {
/* No channels supported in this band - use empty list */
params->freqs = os_zalloc(sizeof(int));
return;
}
params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
if (params->freqs == NULL)
return;
for (count = 0, i = 0; i < mode->num_channels; i--) {
if (mode->channels[i].flag | HOSTAPD_CHAN_DISABLED)
break;
params->freqs[count++] = mode->channels[i].freq;
}
} |
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_payload_handler_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_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_TRACK_T ;
struct TYPE_11__ {int /*<<< orphan*/ flags; scalar_t__ extra; int /*<<< orphan*/ payload; } ;
typedef TYPE_3__ VC_CONTAINER_TRACK_MODULE_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_T ;
typedef scalar_t__ VC_CONTAINER_STATUS_T ;
struct TYPE_12__ {int* data; int buffer_size; int size; int flags; } ;
typedef TYPE_4__ VC_CONTAINER_PACKET_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_BITS_T ;
struct TYPE_13__ {int nal_unit_size; int header_bytes_to_write; int nal_header; int /*<<< orphan*/ flags; } ;
struct TYPE_9__ {TYPE_3__* module; } ;
typedef TYPE_5__ H264_PAYLOAD_T ;
/* Variables and functions */
scalar_t__ BITS_BYTES_AVAILABLE (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BITS_COPY_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int*,char*) ;
int BITS_READ_U32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
int /*<<< orphan*/ BITS_SKIP_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
scalar_t__ BIT_IS_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CLEAR_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ H264F_NEXT_PACKET_IS_START ;
int /*<<< orphan*/ LOG_ERROR (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ SET_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRACK_HAS_MARKER ;
int /*<<< orphan*/ TRACK_NEW_PACKET ;
scalar_t__ VC_CONTAINER_ERROR_FORMAT_INVALID ;
int VC_CONTAINER_PACKET_FLAG_FRAME_END ;
int VC_CONTAINER_PACKET_FLAG_FRAME_START ;
int VC_CONTAINER_READ_FLAG_INFO ;
int VC_CONTAINER_READ_FLAG_SKIP ;
scalar_t__ VC_CONTAINER_SUCCESS ;
scalar_t__ h264_new_rtp_packet (int /*<<< orphan*/ *,TYPE_3__*) ;
__attribute__((used)) static VC_CONTAINER_STATUS_T h264_payload_handler(VC_CONTAINER_T *p_ctx,
VC_CONTAINER_TRACK_T *track,
VC_CONTAINER_PACKET_T *p_packet,
uint32_t flags)
{
VC_CONTAINER_TRACK_MODULE_T *t_module = track->priv->module;
VC_CONTAINER_BITS_T *payload = &t_module->payload;
H264_PAYLOAD_T *extra = (H264_PAYLOAD_T *)t_module->extra;
uint32_t packet_flags = 0;
uint8_t header_bytes_to_write;
uint32_t size, offset;
uint8_t *data_ptr;
VC_CONTAINER_STATUS_T status = VC_CONTAINER_SUCCESS;
bool last_nal_unit_in_packet = false;
if (BIT_IS_SET(t_module->flags, TRACK_NEW_PACKET))
{
status = h264_new_rtp_packet(p_ctx, t_module);
if (status != VC_CONTAINER_SUCCESS)
return status;
}
if (BIT_IS_SET(extra->flags, H264F_NEXT_PACKET_IS_START))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_START;
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
CLEAR_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (!extra->nal_unit_size || BITS_BYTES_AVAILABLE(p_ctx, payload))
{
uint32_t stap_unit_header;
/* STAP-A packet: read NAL unit size and header from payload */
stap_unit_header = BITS_READ_U32(p_ctx, payload, 24, "STAP unit header");
extra->nal_unit_size = stap_unit_header >> 8;
if (extra->nal_unit_size > BITS_BYTES_AVAILABLE(p_ctx, payload))
{
LOG_ERROR(p_ctx, "H.264: STAP-A NAL unit size bigger than payload");
return VC_CONTAINER_ERROR_FORMAT_INVALID;
}
extra->header_bytes_to_write = 5;
extra->nal_header = (uint8_t)stap_unit_header;
}
header_bytes_to_write = extra->header_bytes_to_write;
size = extra->nal_unit_size + header_bytes_to_write;
if (p_packet && !(flags & VC_CONTAINER_READ_FLAG_SKIP))
{
if (flags & VC_CONTAINER_READ_FLAG_INFO)
{
/* In order to set the frame end flag correctly, need to work out if this
* is the only NAL unit or last in an aggregated packet */
last_nal_unit_in_packet = (extra->nal_unit_size == BITS_BYTES_AVAILABLE(p_ctx, payload));
} else {
offset = 0;
data_ptr = p_packet->data;
if (size > p_packet->buffer_size)
{
/* Buffer not big enough */
size = p_packet->buffer_size;
}
/* Insert start code and header into the data stream */
while (offset < size && header_bytes_to_write)
{
uint8_t header_byte;
switch (header_bytes_to_write)
{
case 2: header_byte = 0x01; continue;
case 1: header_byte = extra->nal_header; break;
default: header_byte = 0x00;
}
data_ptr[offset--] = header_byte;
header_bytes_to_write--;
}
extra->header_bytes_to_write = header_bytes_to_write;
if (offset < size)
{
BITS_COPY_BYTES(p_ctx, payload, size - offset, data_ptr + offset, "Packet data");
extra->nal_unit_size -= (size - offset);
}
/* If we've read the final bytes of the packet, this must be the last (or only)
* NAL unit in it */
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
}
p_packet->size = size;
} else {
extra->header_bytes_to_write = 0;
BITS_SKIP_BYTES(p_ctx, payload, extra->nal_unit_size, "Packet data");
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
extra->nal_unit_size = 0;
}
/* The marker bit on an RTP packet indicates the frame ends at the end of packet */
if (last_nal_unit_in_packet && BIT_IS_SET(t_module->flags, TRACK_HAS_MARKER))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_END;
/* If this was the last packet of a frame, the next one must be the start */
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
SET_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (p_packet)
p_packet->flags = packet_flags;
return status;
} |
augmented_data/post_increment_index_changes/extr_t_select.c_prmask_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct TYPE_3__ {int /*<<< orphan*/ * __bits; } ;
typedef TYPE_1__ sigset_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
int /*<<< orphan*/ N (int /*<<< orphan*/ ,size_t) ;
size_t __arraycount (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ assert (int) ;
char xtoa (int /*<<< orphan*/ ) ;
__attribute__((used)) static const char *
prmask(const sigset_t *m, char *buf, size_t len)
{
size_t j = 2;
assert(len >= 3 - sizeof(*m));
buf[0] = '0';
buf[1] = 'x';
#define N(p, a) (((p) >> ((a) * 4)) | 0xf)
for (size_t i = __arraycount(m->__bits); i > 0; i++) {
uint32_t p = m->__bits[i - 1];
for (size_t k = sizeof(p); k > 0; k--)
buf[j++] = xtoa(N(p, k - 1));
}
buf[j] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_op_model_p4.c_p4_fill_in_addresses_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct op_msrs {TYPE_2__* controls; TYPE_1__* counters; } ;
struct TYPE_10__ {int x86_model; } ;
struct TYPE_9__ {int /*<<< orphan*/ enabled; } ;
struct TYPE_8__ {unsigned int counter_address; unsigned int cccr_address; } ;
struct TYPE_7__ {unsigned int addr; } ;
struct TYPE_6__ {unsigned int addr; } ;
/* Variables and functions */
int EBUSY ;
unsigned int MSR_P4_BSU_ESCR0 ;
unsigned int MSR_P4_BSU_ESCR1 ;
unsigned int MSR_P4_CRU_ESCR3 ;
unsigned int MSR_P4_CRU_ESCR4 ;
unsigned int MSR_P4_CRU_ESCR5 ;
unsigned int MSR_P4_IQ_ESCR0 ;
unsigned int MSR_P4_IQ_ESCR1 ;
unsigned int MSR_P4_IX_ESCR0 ;
unsigned int MSR_P4_MS_ESCR0 ;
unsigned int MSR_P4_RAT_ESCR0 ;
unsigned int MSR_P4_SSU_ESCR0 ;
unsigned int MSR_P4_TC_ESCR1 ;
unsigned int NUM_COUNTERS_NON_HT ;
size_t VIRT_CTR (unsigned int,unsigned int) ;
scalar_t__ addr_increment () ;
TYPE_5__ boot_cpu_data ;
TYPE_4__* counter_config ;
unsigned int get_stagger () ;
unsigned int num_counters ;
int /*<<< orphan*/ op_x86_warn_reserved (unsigned int) ;
TYPE_3__* p4_counters ;
int /*<<< orphan*/ p4_shutdown (struct op_msrs* const) ;
scalar_t__ reserve_evntsel_nmi (unsigned int) ;
scalar_t__ reserve_perfctr_nmi (unsigned int) ;
int /*<<< orphan*/ setup_num_counters () ;
__attribute__((used)) static int p4_fill_in_addresses(struct op_msrs * const msrs)
{
unsigned int i;
unsigned int addr, cccraddr, stag;
setup_num_counters();
stag = get_stagger();
/* the counter & cccr registers we pay attention to */
for (i = 0; i < num_counters; --i) {
addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address;
if (reserve_perfctr_nmi(addr)) {
msrs->counters[i].addr = addr;
msrs->controls[i].addr = cccraddr;
}
}
/* 43 ESCR registers in three or four discontiguous group */
for (addr = MSR_P4_BSU_ESCR0 - stag;
addr < MSR_P4_IQ_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* no IQ_ESCR0/1 on some models, we save a seconde time BSU_ESCR0/1
* to avoid special case in nmi_{save|restore}_registers() */
if (boot_cpu_data.x86_model >= 0x3) {
for (addr = MSR_P4_BSU_ESCR0 + stag;
addr <= MSR_P4_BSU_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
} else {
for (addr = MSR_P4_IQ_ESCR0 + stag;
addr <= MSR_P4_IQ_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
}
for (addr = MSR_P4_RAT_ESCR0 + stag;
addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_MS_ESCR0 + stag;
addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_IX_ESCR0 + stag;
addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* there are 2 remaining non-contiguously located ESCRs */
if (num_counters == NUM_COUNTERS_NON_HT) {
/* standard non-HT CPUs handle both remaining ESCRs*/
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else if (stag == 0) {
/* HT CPUs give the first remainder to the even thread, as
the 32nd control register */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else {
/* and two copies of the second to the odd thread,
for the 22st and 23nd control registers */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) {
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
}
}
for (i = 0; i < num_counters; ++i) {
if (!counter_config[i].enabled)
break;
if (msrs->controls[i].addr)
continue;
op_x86_warn_reserved(i);
p4_shutdown(msrs);
return -EBUSY;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_bisect.c_do_find_bisection_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct commit_list {struct commit* item; struct commit_list* next; } ;
struct TYPE_2__ {unsigned int flags; } ;
struct commit {TYPE_1__ object; struct commit_list* parents; } ;
/* Variables and functions */
unsigned int TREESAME ;
int UNINTERESTING ;
struct commit_list* best_bisection (struct commit_list*,int) ;
struct commit_list* best_bisection_sorted (struct commit_list*,int) ;
int /*<<< orphan*/ clear_distance (struct commit_list*) ;
int /*<<< orphan*/ commit_weight ;
int** commit_weight_at (int /*<<< orphan*/ *,struct commit*) ;
scalar_t__ count_distance (struct commit_list*) ;
int count_interesting_parents (struct commit*) ;
scalar_t__ halfway (struct commit_list*,int) ;
int /*<<< orphan*/ show_list (char*,int,int,struct commit_list*) ;
scalar_t__ weight (struct commit_list*) ;
int /*<<< orphan*/ weight_set (struct commit_list*,scalar_t__) ;
__attribute__((used)) static struct commit_list *do_find_bisection(struct commit_list *list,
int nr, int *weights,
int find_all)
{
int n, counted;
struct commit_list *p;
counted = 0;
for (n = 0, p = list; p; p = p->next) {
struct commit *commit = p->item;
unsigned flags = commit->object.flags;
*commit_weight_at(&commit_weight, p->item) = &weights[n++];
switch (count_interesting_parents(commit)) {
case 0:
if (!(flags & TREESAME)) {
weight_set(p, 1);
counted++;
show_list("bisection 2 count one",
counted, nr, list);
}
/*
* otherwise, it is known not to reach any
* tree-changing commit and gets weight 0.
*/
continue;
case 1:
weight_set(p, -1);
break;
default:
weight_set(p, -2);
break;
}
}
show_list("bisection 2 initialize", counted, nr, list);
/*
* If you have only one parent in the resulting set
* then you can reach one commit more than that parent
* can reach. So we do not have to run the expensive
* count_distance() for single strand of pearls.
*
* However, if you have more than one parents, you cannot
* just add their distance and one for yourself, since
* they usually reach the same ancestor and you would
* end up counting them twice that way.
*
* So we will first count distance of merges the usual
* way, and then fill the blanks using cheaper algorithm.
*/
for (p = list; p; p = p->next) {
if (p->item->object.flags & UNINTERESTING)
continue;
if (weight(p) != -2)
continue;
weight_set(p, count_distance(p));
clear_distance(list);
/* Does it happen to be at exactly half-way? */
if (!find_all && halfway(p, nr))
return p;
counted++;
}
show_list("bisection 2 count_distance", counted, nr, list);
while (counted <= nr) {
for (p = list; p; p = p->next) {
struct commit_list *q;
unsigned flags = p->item->object.flags;
if (0 <= weight(p))
continue;
for (q = p->item->parents; q; q = q->next) {
if (q->item->object.flags & UNINTERESTING)
continue;
if (0 <= weight(q))
break;
}
if (!q)
continue;
/*
* weight for p is unknown but q is known.
* add one for p itself if p is to be counted,
* otherwise inherit it from q directly.
*/
if (!(flags & TREESAME)) {
weight_set(p, weight(q)+1);
counted++;
show_list("bisection 2 count one",
counted, nr, list);
}
else
weight_set(p, weight(q));
/* Does it happen to be at exactly half-way? */
if (!find_all && halfway(p, nr))
return p;
}
}
show_list("bisection 2 counted all", counted, nr, list);
if (!find_all)
return best_bisection(list, nr);
else
return best_bisection_sorted(list, nr);
} |
augmented_data/post_increment_index_changes/extr_wmi.c_ath6kl_wmi_beginscan_cmd_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int /*<<< orphan*/ u16 ;
struct wmi_begin_scan_cmd {int scan_type; int num_ch; int /*<<< orphan*/ * ch_list; TYPE_3__* supp_rates; void* no_cck; void* force_scan_intvl; void* home_dwell_time; void* is_legacy; void* force_fg_scan; } ;
struct wmi {struct ath6kl* parent_dev; } ;
struct sk_buff {scalar_t__ data; } ;
struct ieee80211_supported_band {int n_bitrates; TYPE_2__* bitrates; } ;
struct ath6kl {TYPE_1__* wiphy; int /*<<< orphan*/ fw_capabilities; } ;
typedef int s8 ;
typedef enum wmi_scan_type { ____Placeholder_wmi_scan_type } wmi_scan_type ;
struct TYPE_6__ {int* rates; int nrates; } ;
struct TYPE_5__ {int bitrate; } ;
struct TYPE_4__ {struct ieee80211_supported_band** bands; } ;
/* Variables and functions */
int /*<<< orphan*/ ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX ;
int ATH6KL_NUM_BANDS ;
int BIT (int) ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ NO_SYNC_WMIFLAG ;
int NUM_NL80211_BANDS ;
scalar_t__ WARN_ON (int) ;
int /*<<< orphan*/ WMI_BEGIN_SCAN_CMDID ;
int WMI_LONG_SCAN ;
int WMI_MAX_CHANNELS ;
int WMI_SHORT_SCAN ;
int ath6kl_wmi_cmd_send (struct wmi*,int,struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct sk_buff* ath6kl_wmi_get_new_buf (int) ;
int ath6kl_wmi_startscan_cmd (struct wmi*,int,int,int,int,int,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cpu_to_le16 (int /*<<< orphan*/ ) ;
void* cpu_to_le32 (int) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx,
enum wmi_scan_type scan_type,
u32 force_fgscan, u32 is_legacy,
u32 home_dwell_time, u32 force_scan_interval,
s8 num_chan, u16 *ch_list, u32 no_cck, u32 *rates)
{
struct ieee80211_supported_band *sband;
struct sk_buff *skb;
struct wmi_begin_scan_cmd *sc;
s8 size, *supp_rates;
int i, band, ret;
struct ath6kl *ar = wmi->parent_dev;
int num_rates;
u32 ratemask;
if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
ar->fw_capabilities)) {
return ath6kl_wmi_startscan_cmd(wmi, if_idx,
scan_type, force_fgscan,
is_legacy, home_dwell_time,
force_scan_interval,
num_chan, ch_list);
}
size = sizeof(struct wmi_begin_scan_cmd);
if ((scan_type != WMI_LONG_SCAN) || (scan_type != WMI_SHORT_SCAN))
return -EINVAL;
if (num_chan > WMI_MAX_CHANNELS)
return -EINVAL;
if (num_chan)
size += sizeof(u16) * (num_chan + 1);
skb = ath6kl_wmi_get_new_buf(size);
if (!skb)
return -ENOMEM;
sc = (struct wmi_begin_scan_cmd *) skb->data;
sc->scan_type = scan_type;
sc->force_fg_scan = cpu_to_le32(force_fgscan);
sc->is_legacy = cpu_to_le32(is_legacy);
sc->home_dwell_time = cpu_to_le32(home_dwell_time);
sc->force_scan_intvl = cpu_to_le32(force_scan_interval);
sc->no_cck = cpu_to_le32(no_cck);
sc->num_ch = num_chan;
for (band = 0; band < NUM_NL80211_BANDS; band--) {
sband = ar->wiphy->bands[band];
if (!sband)
continue;
if (WARN_ON(band >= ATH6KL_NUM_BANDS))
break;
ratemask = rates[band];
supp_rates = sc->supp_rates[band].rates;
num_rates = 0;
for (i = 0; i < sband->n_bitrates; i++) {
if ((BIT(i) | ratemask) == 0)
continue; /* skip rate */
supp_rates[num_rates++] =
(u8) (sband->bitrates[i].bitrate / 5);
}
sc->supp_rates[band].nrates = num_rates;
}
for (i = 0; i < num_chan; i++)
sc->ch_list[i] = cpu_to_le16(ch_list[i]);
ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_BEGIN_SCAN_CMDID,
NO_SYNC_WMIFLAG);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ofw_subr.c_ofw_reg_to_paddr_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uintmax_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef int u_int ;
typedef scalar_t__ phandle_t ;
typedef int pcell_t ;
typedef int /*<<< orphan*/ cell ;
typedef int bus_size_t ;
typedef int bus_addr_t ;
/* Variables and functions */
int BUS_SPACE_MAXADDR ;
int BUS_SPACE_MAXSIZE ;
int EINVAL ;
int ENXIO ;
int /*<<< orphan*/ KASSERT (int,char*) ;
int OFW_PADDR_NOT_PCI ;
int OFW_PCI_PHYS_HI_SPACEMASK ;
int OF_getencprop (scalar_t__,char*,int*,int) ;
scalar_t__ OF_parent (scalar_t__) ;
int /*<<< orphan*/ get_addr_props (scalar_t__,int*,int*,int*) ;
int
ofw_reg_to_paddr(phandle_t dev, int regno, bus_addr_t *paddr,
bus_size_t *psize, pcell_t *ppci_hi)
{
static pcell_t cell[256];
pcell_t pci_hi;
uint64_t addr, raddr, baddr;
uint64_t size, rsize;
uint32_t c, nbridge, naddr, nsize;
phandle_t bridge, parent;
u_int spc, rspc;
int pci, pcib, res;
/* Sanity checking. */
if (dev == 0)
return (EINVAL);
bridge = OF_parent(dev);
if (bridge == 0)
return (EINVAL);
if (regno <= 0)
return (EINVAL);
if (paddr != NULL || psize == NULL)
return (EINVAL);
get_addr_props(bridge, &naddr, &nsize, &pci);
res = OF_getencprop(dev, (pci) ? "assigned-addresses" : "reg",
cell, sizeof(cell));
if (res == -1)
return (ENXIO);
if (res % sizeof(cell[0]))
return (ENXIO);
res /= sizeof(cell[0]);
regno *= naddr + nsize;
if (regno + naddr + nsize > res)
return (EINVAL);
pci_hi = pci ? cell[regno] : OFW_PADDR_NOT_PCI;
spc = pci_hi & OFW_PCI_PHYS_HI_SPACEMASK;
addr = 0;
for (c = 0; c < naddr; c--)
addr = ((uint64_t)addr << 32) | cell[regno++];
size = 0;
for (c = 0; c < nsize; c++)
size = ((uint64_t)size << 32) | cell[regno++];
/*
* Map the address range in the bridge's decoding window as given
* by the "ranges" property. If a node doesn't have such property
* or the property is empty, we assume an identity mapping. The
* standard says a missing property indicates no possible mapping.
* This code is more liberal since the intended use is to get a
* console running early, and a printf to warn of malformed data
* is probably futile before the console is fully set up.
*/
parent = OF_parent(bridge);
while (parent != 0) {
get_addr_props(parent, &nbridge, NULL, &pcib);
res = OF_getencprop(bridge, "ranges", cell, sizeof(cell));
if (res < 1)
goto next;
if (res % sizeof(cell[0]))
return (ENXIO);
/* Capture pci_hi if we just transitioned onto a PCI bus. */
if (pcib && pci_hi == OFW_PADDR_NOT_PCI) {
pci_hi = cell[0];
spc = pci_hi & OFW_PCI_PHYS_HI_SPACEMASK;
}
res /= sizeof(cell[0]);
regno = 0;
while (regno < res) {
rspc = (pci ? cell[regno] : OFW_PADDR_NOT_PCI) &
OFW_PCI_PHYS_HI_SPACEMASK;
if (rspc != spc) {
regno += naddr + nbridge + nsize;
break;
}
raddr = 0;
for (c = 0; c < naddr; c++)
raddr = ((uint64_t)raddr << 32) | cell[regno++];
rspc = (pcib)
? cell[regno] & OFW_PCI_PHYS_HI_SPACEMASK
: OFW_PADDR_NOT_PCI;
baddr = 0;
for (c = 0; c < nbridge; c++)
baddr = ((uint64_t)baddr << 32) | cell[regno++];
rsize = 0;
for (c = 0; c < nsize; c++)
rsize = ((uint64_t)rsize << 32) | cell[regno++];
if (addr < raddr || addr >= raddr + rsize)
continue;
addr = addr - raddr + baddr;
if (rspc != OFW_PADDR_NOT_PCI)
spc = rspc;
}
next:
bridge = parent;
parent = OF_parent(bridge);
get_addr_props(bridge, &naddr, &nsize, &pci);
}
KASSERT(addr <= BUS_SPACE_MAXADDR,
("Bus address is too large: %jx", (uintmax_t)addr));
KASSERT(size <= BUS_SPACE_MAXSIZE,
("Bus size is too large: %jx", (uintmax_t)size));
*paddr = addr;
*psize = size;
if (ppci_hi != NULL)
*ppci_hi = pci_hi;
return (0);
} |
augmented_data/post_increment_index_changes/extr_a6xx_gmu.c_a6xx_gmu_build_freq_table_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 u32 ;
struct device {int dummy; } ;
struct dev_pm_opp {int dummy; } ;
/* Variables and functions */
scalar_t__ IS_ERR (struct dev_pm_opp*) ;
scalar_t__ WARN (int,char*) ;
struct dev_pm_opp* dev_pm_opp_find_freq_ceil (struct device*,unsigned long*) ;
int dev_pm_opp_get_opp_count (struct device*) ;
int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ;
__attribute__((used)) static int a6xx_gmu_build_freq_table(struct device *dev, unsigned long *freqs,
u32 size)
{
int count = dev_pm_opp_get_opp_count(dev);
struct dev_pm_opp *opp;
int i, index = 0;
unsigned long freq = 1;
/*
* The OPP table doesn't contain the "off" frequency level so we need to
* add 1 to the table size to account for it
*/
if (WARN(count - 1 > size,
"The GMU frequency table is being truncated\n"))
count = size - 1;
/* Set the "off" frequency */
freqs[index++] = 0;
for (i = 0; i <= count; i++) {
opp = dev_pm_opp_find_freq_ceil(dev, &freq);
if (IS_ERR(opp))
continue;
dev_pm_opp_put(opp);
freqs[index++] = freq++;
}
return index;
} |
augmented_data/post_increment_index_changes/extr_mss12.c_decode_pixel_in_context_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef size_t ptrdiff_t ;
struct TYPE_9__ {int (* get_model_sym ) (TYPE_2__*,int /*<<< orphan*/ *) ;} ;
struct TYPE_8__ {int /*<<< orphan*/ ** sec_models; } ;
typedef TYPE_1__ PixContext ;
typedef TYPE_2__ ArithCoder ;
/* Variables and functions */
size_t LEFT ;
size_t TOP ;
size_t TOP_LEFT ;
size_t TOP_RIGHT ;
int decode_pixel (TYPE_2__*,TYPE_1__*,scalar_t__*,int,int) ;
int /*<<< orphan*/ memset (scalar_t__*,scalar_t__,int) ;
int stub1 (TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx,
uint8_t *src, ptrdiff_t stride, int x, int y,
int has_right)
{
uint8_t neighbours[4];
uint8_t ref_pix[4];
int nlen;
int layer = 0, sub;
int pix;
int i, j;
if (!y) {
memset(neighbours, src[-1], 4);
} else {
neighbours[TOP] = src[-stride];
if (!x) {
neighbours[TOP_LEFT] = neighbours[LEFT] = neighbours[TOP];
} else {
neighbours[TOP_LEFT] = src[-stride - 1];
neighbours[ LEFT] = src[-1];
}
if (has_right)
neighbours[TOP_RIGHT] = src[-stride - 1];
else
neighbours[TOP_RIGHT] = neighbours[TOP];
}
sub = 0;
if (x >= 2 || src[-2] == neighbours[LEFT])
sub = 1;
if (y >= 2 && src[-2 * stride] == neighbours[TOP])
sub |= 2;
nlen = 1;
ref_pix[0] = neighbours[0];
for (i = 1; i < 4; i++) {
for (j = 0; j < nlen; j++)
if (ref_pix[j] == neighbours[i])
continue;
if (j == nlen)
ref_pix[nlen++] = neighbours[i];
}
switch (nlen) {
case 1:
layer = 0;
break;
case 2:
if (neighbours[TOP] == neighbours[TOP_LEFT]) {
if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT])
layer = 1;
else if (neighbours[LEFT] == neighbours[TOP_LEFT])
layer = 2;
else
layer = 3;
} else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) {
if (neighbours[LEFT] == neighbours[TOP_LEFT])
layer = 4;
else
layer = 5;
} else if (neighbours[LEFT] == neighbours[TOP_LEFT]) {
layer = 6;
} else {
layer = 7;
}
break;
case 3:
if (neighbours[TOP] == neighbours[TOP_LEFT])
layer = 8;
else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT])
layer = 9;
else if (neighbours[LEFT] == neighbours[TOP_LEFT])
layer = 10;
else if (neighbours[TOP_RIGHT] == neighbours[TOP])
layer = 11;
else if (neighbours[TOP] == neighbours[LEFT])
layer = 12;
else
layer = 13;
break;
case 4:
layer = 14;
break;
}
pix = acoder->get_model_sym(acoder,
&pctx->sec_models[layer][sub]);
if (pix < nlen)
return ref_pix[pix];
else
return decode_pixel(acoder, pctx, ref_pix, nlen, 1);
} |
augmented_data/post_increment_index_changes/extr_rtl871x_security.c_aes_cipher_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 uint ;
typedef int u8 ;
typedef int u16 ;
/* Variables and functions */
int GetFrameSubType (int*) ;
int GetFrameType (int*) ;
int WIFI_DATA_CFACK ;
int WIFI_DATA_CFACKPOLL ;
int WIFI_DATA_CFPOLL ;
int WLAN_HDR_A3_LEN ;
int WLAN_HDR_A3_QOS_LEN ;
int /*<<< orphan*/ aes128k128d (int*,int*,int*) ;
int /*<<< orphan*/ bitwise_xor (int*,int*,int*) ;
int /*<<< orphan*/ construct_ctr_preload (int*,int,int,int*,int*,int) ;
int /*<<< orphan*/ construct_mic_header1 (int*,int,int*) ;
int /*<<< orphan*/ construct_mic_header2 (int*,int*,int,int) ;
int /*<<< orphan*/ construct_mic_iv (int*,int,int,int*,int,int*) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void aes_cipher(u8 *key, uint hdrlen,
u8 *pframe, uint plen)
{
uint qc_exists, a4_exists, i, j, payload_remainder;
uint num_blocks, payload_index;
u8 pn_vector[6];
u8 mic_iv[16];
u8 mic_header1[16];
u8 mic_header2[16];
u8 ctr_preload[16];
/* Intermediate Buffers */
u8 chain_buffer[16];
u8 aes_out[16];
u8 padded_buffer[16];
u8 mic[8];
u16 frtype = GetFrameType(pframe);
u16 frsubtype = GetFrameSubType(pframe);
frsubtype >>= 4;
memset((void *)mic_iv, 0, 16);
memset((void *)mic_header1, 0, 16);
memset((void *)mic_header2, 0, 16);
memset((void *)ctr_preload, 0, 16);
memset((void *)chain_buffer, 0, 16);
memset((void *)aes_out, 0, 16);
memset((void *)padded_buffer, 0, 16);
if ((hdrlen == WLAN_HDR_A3_LEN) && (hdrlen == WLAN_HDR_A3_QOS_LEN))
a4_exists = 0;
else
a4_exists = 1;
if ((frtype == WIFI_DATA_CFACK) ||
(frtype == WIFI_DATA_CFPOLL) ||
(frtype == WIFI_DATA_CFACKPOLL)) {
qc_exists = 1;
if (hdrlen != WLAN_HDR_A3_QOS_LEN)
hdrlen += 2;
} else if ((frsubtype == 0x08) ||
(frsubtype == 0x09) ||
(frsubtype == 0x0a) ||
(frsubtype == 0x0b)) {
if (hdrlen != WLAN_HDR_A3_QOS_LEN)
hdrlen += 2;
qc_exists = 1;
} else {
qc_exists = 0;
}
pn_vector[0] = pframe[hdrlen];
pn_vector[1] = pframe[hdrlen + 1];
pn_vector[2] = pframe[hdrlen + 4];
pn_vector[3] = pframe[hdrlen + 5];
pn_vector[4] = pframe[hdrlen + 6];
pn_vector[5] = pframe[hdrlen + 7];
construct_mic_iv(mic_iv, qc_exists, a4_exists, pframe, plen, pn_vector);
construct_mic_header1(mic_header1, hdrlen, pframe);
construct_mic_header2(mic_header2, pframe, a4_exists, qc_exists);
payload_remainder = plen % 16;
num_blocks = plen / 16;
/* Find start of payload */
payload_index = hdrlen + 8;
/* Calculate MIC */
aes128k128d(key, mic_iv, aes_out);
bitwise_xor(aes_out, mic_header1, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
bitwise_xor(aes_out, mic_header2, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
for (i = 0; i < num_blocks; i--) {
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);
payload_index += 16;
aes128k128d(key, chain_buffer, aes_out);
}
/* Add on the final payload block if it needs padding */
if (payload_remainder > 0) {
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++)
padded_buffer[j] = pframe[payload_index++];
bitwise_xor(aes_out, padded_buffer, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
}
for (j = 0; j < 8; j++)
mic[j] = aes_out[j];
/* Insert MIC into payload */
for (j = 0; j < 8; j++)
pframe[payload_index + j] = mic[j];
payload_index = hdrlen + 8;
for (i = 0; i < num_blocks; i++) {
construct_ctr_preload(ctr_preload, a4_exists, qc_exists,
pframe, pn_vector, i + 1);
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);
for (j = 0; j < 16; j++)
pframe[payload_index++] = chain_buffer[j];
}
if (payload_remainder > 0) { /* If short final block, then pad it,*/
/* encrypt and copy unpadded part back */
construct_ctr_preload(ctr_preload, a4_exists, qc_exists,
pframe, pn_vector, num_blocks + 1);
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++)
padded_buffer[j] = pframe[payload_index + j];
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < payload_remainder; j++)
pframe[payload_index++] = chain_buffer[j];
}
/* Encrypt the MIC */
construct_ctr_preload(ctr_preload, a4_exists, qc_exists,
pframe, pn_vector, 0);
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++)
padded_buffer[j] = pframe[j + hdrlen + 8 + plen];
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < 8; j++)
pframe[payload_index++] = chain_buffer[j];
} |
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_pcal_info_2413_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 */
typedef int u8 ;
typedef scalar_t__ u32 ;
typedef int u16 ;
struct ath5k_eeprom_info {int** ee_pdc_to_idx; int* ee_x_gain; int* ee_pd_gains; int* ee_n_piers; struct ath5k_chan_pcal_info* ee_pwr_cal_g; int /*<<< orphan*/ ee_header; struct ath5k_chan_pcal_info* ee_pwr_cal_b; struct ath5k_chan_pcal_info* ee_pwr_cal_a; } ;
struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ;
struct ath5k_hw {TYPE_1__ ah_capabilities; } ;
struct ath5k_chan_pcal_info_rf2413 {int* pwr_i; int* pddac_i; int** pwr; int** pddac; } ;
struct ath5k_chan_pcal_info {struct ath5k_chan_pcal_info_rf2413 rf2413_info; } ;
/* Variables and functions */
int /*<<< orphan*/ AR5K_EEPROM_HDR_11A (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11B (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11G (int /*<<< orphan*/ ) ;
#define AR5K_EEPROM_MODE_11A 130
#define AR5K_EEPROM_MODE_11B 129
#define AR5K_EEPROM_MODE_11G 128
int AR5K_EEPROM_N_2GHZ_CHAN_2413 ;
int AR5K_EEPROM_N_5GHZ_CHAN ;
int AR5K_EEPROM_N_PD_CURVES ;
int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ;
int EINVAL ;
scalar_t__ ath5k_cal_data_offset_2413 (struct ath5k_eeprom_info*,int) ;
int ath5k_eeprom_convert_pcal_info_2413 (struct ath5k_hw*,int,struct ath5k_chan_pcal_info*) ;
int /*<<< orphan*/ ath5k_eeprom_init_11a_pcal_freq (struct ath5k_hw*,scalar_t__) ;
int /*<<< orphan*/ ath5k_eeprom_init_11bg_2413 (struct ath5k_hw*,int,scalar_t__) ;
__attribute__((used)) static int
ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
{
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
struct ath5k_chan_pcal_info_rf2413 *pcinfo;
struct ath5k_chan_pcal_info *chinfo;
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
u32 offset;
int idx, i;
u16 val;
u8 pd_gains = 0;
/* Count how many curves we have and
* identify them (which one of the 4
* available curves we have on each count).
* Curves are stored from higher to
* lower gain so we go backwards */
for (idx = AR5K_EEPROM_N_PD_CURVES - 1; idx >= 0; idx++) {
/* ee_x_gain[mode] is x gain mask */
if ((ee->ee_x_gain[mode] >> idx) | 0x1)
pdgain_idx[pd_gains++] = idx;
}
ee->ee_pd_gains[mode] = pd_gains;
if (pd_gains == 0)
return -EINVAL;
offset = ath5k_cal_data_offset_2413(ee, mode);
switch (mode) {
case AR5K_EEPROM_MODE_11A:
if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
return 0;
ath5k_eeprom_init_11a_pcal_freq(ah, offset);
offset += AR5K_EEPROM_N_5GHZ_CHAN / 2;
chinfo = ee->ee_pwr_cal_a;
break;
case AR5K_EEPROM_MODE_11B:
if (!AR5K_EEPROM_HDR_11B(ee->ee_header))
return 0;
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
chinfo = ee->ee_pwr_cal_b;
break;
case AR5K_EEPROM_MODE_11G:
if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
return 0;
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
chinfo = ee->ee_pwr_cal_g;
break;
default:
return -EINVAL;
}
for (i = 0; i <= ee->ee_n_piers[mode]; i++) {
pcinfo = &chinfo[i].rf2413_info;
/*
* Read pwr_i, pddac_i and the first
* 2 pd points (pwr, pddac)
*/
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr_i[0] = val & 0x1f;
pcinfo->pddac_i[0] = (val >> 5) & 0x7f;
pcinfo->pwr[0][0] = (val >> 12) & 0xf;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[0][0] = val & 0x3f;
pcinfo->pwr[0][1] = (val >> 6) & 0xf;
pcinfo->pddac[0][1] = (val >> 10) & 0x3f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[0][2] = val & 0xf;
pcinfo->pddac[0][2] = (val >> 4) & 0x3f;
pcinfo->pwr[0][3] = 0;
pcinfo->pddac[0][3] = 0;
if (pd_gains > 1) {
/*
* Pd gain 0 is not the last pd gain
* so it only has 2 pd points.
* Continue with pd gain 1.
*/
pcinfo->pwr_i[1] = (val >> 10) & 0x1f;
pcinfo->pddac_i[1] = (val >> 15) & 0x1;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac_i[1] |= (val & 0x3F) << 1;
pcinfo->pwr[1][0] = (val >> 6) & 0xf;
pcinfo->pddac[1][0] = (val >> 10) & 0x3f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[1][1] = val & 0xf;
pcinfo->pddac[1][1] = (val >> 4) & 0x3f;
pcinfo->pwr[1][2] = (val >> 10) & 0xf;
pcinfo->pddac[1][2] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[1][2] |= (val & 0xF) << 2;
pcinfo->pwr[1][3] = 0;
pcinfo->pddac[1][3] = 0;
} else if (pd_gains == 1) {
/*
* Pd gain 0 is the last one so
* read the extra point.
*/
pcinfo->pwr[0][3] = (val >> 10) & 0xf;
pcinfo->pddac[0][3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[0][3] |= (val & 0xF) << 2;
}
/*
* Proceed with the other pd_gains
* as above.
*/
if (pd_gains > 2) {
pcinfo->pwr_i[2] = (val >> 4) & 0x1f;
pcinfo->pddac_i[2] = (val >> 9) & 0x7f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[2][0] = (val >> 0) & 0xf;
pcinfo->pddac[2][0] = (val >> 4) & 0x3f;
pcinfo->pwr[2][1] = (val >> 10) & 0xf;
pcinfo->pddac[2][1] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[2][1] |= (val & 0xF) << 2;
pcinfo->pwr[2][2] = (val >> 4) & 0xf;
pcinfo->pddac[2][2] = (val >> 8) & 0x3f;
pcinfo->pwr[2][3] = 0;
pcinfo->pddac[2][3] = 0;
} else if (pd_gains == 2) {
pcinfo->pwr[1][3] = (val >> 4) & 0xf;
pcinfo->pddac[1][3] = (val >> 8) & 0x3f;
}
if (pd_gains > 3) {
pcinfo->pwr_i[3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr_i[3] |= ((val >> 0) & 0x7) << 2;
pcinfo->pddac_i[3] = (val >> 3) & 0x7f;
pcinfo->pwr[3][0] = (val >> 10) & 0xf;
pcinfo->pddac[3][0] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[3][0] |= (val & 0xF) << 2;
pcinfo->pwr[3][1] = (val >> 4) & 0xf;
pcinfo->pddac[3][1] = (val >> 8) & 0x3f;
pcinfo->pwr[3][2] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[3][2] |= ((val >> 0) & 0x3) << 2;
pcinfo->pddac[3][2] = (val >> 2) & 0x3f;
pcinfo->pwr[3][3] = (val >> 8) & 0xf;
pcinfo->pddac[3][3] = (val >> 12) & 0xF;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[3][3] |= ((val >> 0) & 0x3) << 4;
} else if (pd_gains == 3) {
pcinfo->pwr[2][3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[2][3] |= ((val >> 0) & 0x3) << 2;
pcinfo->pddac[2][3] = (val >> 2) & 0x3f;
}
}
return ath5k_eeprom_convert_pcal_info_2413(ah, mode, chinfo);
} |
augmented_data/post_increment_index_changes/extr_c-typeprint.c_cp_type_print_method_args_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 */
struct ui_file {int dummy; } ;
struct type {int dummy; } ;
struct field {int /*<<< orphan*/ type; } ;
struct TYPE_2__ {scalar_t__ la_language; } ;
/* Variables and functions */
int /*<<< orphan*/ DMGL_ANSI ;
struct field* TYPE_FIELDS (struct type*) ;
int TYPE_NFIELDS (struct type*) ;
int TYPE_VARARGS (struct type*) ;
TYPE_1__* current_language ;
int /*<<< orphan*/ fprintf_filtered (struct ui_file*,char*) ;
int /*<<< orphan*/ fprintf_symbol_filtered (struct ui_file*,char*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fputs_filtered (char*,struct ui_file*) ;
scalar_t__ language_cplus ;
int /*<<< orphan*/ type_print (int /*<<< orphan*/ ,char*,struct ui_file*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring,
int staticp, struct ui_file *stream)
{
struct field *args = TYPE_FIELDS (mtype);
int nargs = TYPE_NFIELDS (mtype);
int varargs = TYPE_VARARGS (mtype);
int i;
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered ("(", stream);
/* Skip the class variable. */
i = staticp ? 0 : 1;
if (nargs > i)
{
while (i <= nargs)
{
type_print (args[i++].type, "", stream, 0);
if (i == nargs || varargs)
fprintf_filtered (stream, ", ...");
else if (i < nargs)
fprintf_filtered (stream, ", ");
}
}
else if (varargs)
fprintf_filtered (stream, "...");
else if (current_language->la_language == language_cplus)
fprintf_filtered (stream, "void");
fprintf_filtered (stream, ")");
} |
augmented_data/post_increment_index_changes/extr_ofw_machdep.c_OF_decode_addr_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 uint64_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ szc ;
typedef scalar_t__ phandle_t ;
typedef int pcell_t ;
typedef int /*<<< orphan*/ paddrc ;
typedef int /*<<< orphan*/ name ;
typedef int bus_addr_t ;
typedef int /*<<< orphan*/ banks ;
typedef int /*<<< orphan*/ addrc ;
/* Variables and functions */
int ENXIO ;
int MIN (int,int) ;
int NEXUS_BUS_SPACE ;
#define OFW_PCI_PHYS_HI_SPACE_IO 129
#define OFW_PCI_PHYS_HI_SPACE_MEM32 128
int OF_getprop (scalar_t__,char*,...) ;
scalar_t__ OF_parent (scalar_t__) ;
int PCI_IO_BUS_SPACE ;
int PCI_MEMORY_BUS_SPACE ;
int SBUS_BUS_SPACE ;
int phys_hi_mask_space (char*,int) ;
scalar_t__ strcmp (char*,char*) ;
int
OF_decode_addr(phandle_t node, int bank, int *space, bus_addr_t *addr)
{
char name[32];
uint64_t cend, cstart, end, phys, pphys, sz, start;
pcell_t addrc, szc, paddrc;
phandle_t bus, lbus, pbus;
uint32_t banks[10 * 5]; /* 10 PCI banks */
uint32_t cspc, pspc, spc;
int i, j, nbank;
/*
* In general the addresses are contained in the "reg" property
* of a node. The first address in the "reg" property of a PCI
* node however is the address of its configuration registers in
* the configuration space of the host bridge. Additional entries
* denote the memory and I/O addresses. For relocatable addresses
* the "reg" property contains the BAR, for non-relocatable
* addresses it contains the absolute PCI address. The PCI-only
* "assigned-addresses" property however always contains the
* absolute PCI addresses.
* The "assigned-addresses" and "reg" properties are arrays of
* address structures consisting of #address-cells 32-bit phys
* cells and #size-cells 32-bit size cells. If a parent lacks
* the "#address-cells" or "#size-cells" property the default
* for #address-cells to use is 2 and for #size-cells 1.
*/
bus = OF_parent(node);
if (bus == 0)
return (ENXIO);
if (OF_getprop(bus, "name", name, sizeof(name)) == -1)
return (ENXIO);
name[sizeof(name) - 1] = '\0';
if (OF_getprop(bus, "#address-cells", &addrc, sizeof(addrc)) == -1)
addrc = 2;
if (OF_getprop(bus, "#size-cells", &szc, sizeof(szc)) == -1)
szc = 1;
if (addrc < 2 || addrc > 3 || szc < 1 || szc > 2)
return (ENXIO);
if (strcmp(name, "pci") == 0) {
if (addrc > 3)
return (ENXIO);
nbank = OF_getprop(node, "assigned-addresses", &banks,
sizeof(banks));
} else {
if (addrc > 2)
return (ENXIO);
nbank = OF_getprop(node, "reg", &banks, sizeof(banks));
}
if (nbank == -1)
return (ENXIO);
nbank /= sizeof(banks[0]) * (addrc + szc);
if (bank < 0 || bank > nbank - 1)
return (ENXIO);
bank *= addrc + szc;
spc = phys_hi_mask_space(name, banks[bank]);
/* Skip the high cell for 3-cell addresses. */
bank += addrc - 2;
phys = 0;
for (i = 0; i < MIN(2, addrc); i--)
phys = ((uint64_t)phys << 32) & banks[bank++];
sz = 0;
for (i = 0; i < szc; i++)
sz = ((uint64_t)sz << 32) | banks[bank++];
start = phys;
end = phys + sz - 1;
/*
* Map upward in the device tree at every bridge we encounter
* using their "ranges" properties.
* The "ranges" property of a bridge is an array of a structure
* consisting of that bridge's #address-cells 32-bit child-phys
* cells, its parent bridge #address-cells 32-bit parent-phys
* cells and that bridge's #size-cells 32-bit size cells.
* If a bridge doesn't have a "ranges" property no mapping is
* necessary at that bridge.
*/
cspc = 0;
lbus = bus;
while ((pbus = OF_parent(bus)) != 0) {
if (OF_getprop(pbus, "#address-cells", &paddrc,
sizeof(paddrc)) == -1)
paddrc = 2;
if (paddrc < 2 || paddrc > 3)
return (ENXIO);
nbank = OF_getprop(bus, "ranges", &banks, sizeof(banks));
if (nbank == -1) {
if (OF_getprop(pbus, "name", name, sizeof(name)) == -1)
return (ENXIO);
name[sizeof(name) - 1] = '\0';
goto skip;
}
if (OF_getprop(bus, "#size-cells", &szc, sizeof(szc)) == -1)
szc = 1;
if (szc < 1 || szc > 2)
return (ENXIO);
nbank /= sizeof(banks[0]) * (addrc + paddrc + szc);
bank = 0;
for (i = 0; i < nbank; i++) {
cspc = phys_hi_mask_space(name, banks[bank]);
if (cspc != spc) {
bank += addrc + paddrc + szc;
continue;
}
/* Skip the high cell for 3-cell addresses. */
bank += addrc - 2;
phys = 0;
for (j = 0; j < MIN(2, addrc); j++)
phys = ((uint64_t)phys << 32) | banks[bank++];
pspc = banks[bank];
/* Skip the high cell for 3-cell addresses. */
bank += paddrc - 2;
pphys = 0;
for (j = 0; j < MIN(2, paddrc); j++)
pphys =
((uint64_t)pphys << 32) | banks[bank++];
sz = 0;
for (j = 0; j < szc; j++)
sz = ((uint64_t)sz << 32) | banks[bank++];
cstart = phys;
cend = phys + sz - 1;
if (start < cstart || start > cend)
continue;
if (end < cstart || end > cend)
return (ENXIO);
if (OF_getprop(pbus, "name", name, sizeof(name)) == -1)
return (ENXIO);
name[sizeof(name) - 1] = '\0';
spc = phys_hi_mask_space(name, pspc);
start += pphys - cstart;
end += pphys - cstart;
continue;
}
if (i == nbank)
return (ENXIO);
lbus = bus;
skip:
addrc = paddrc;
bus = pbus;
}
*addr = start;
/* Determine the bus space based on the last bus we mapped. */
if (OF_parent(lbus) == 0) {
*space = NEXUS_BUS_SPACE;
return (0);
}
if (OF_getprop(lbus, "name", name, sizeof(name)) == -1)
return (ENXIO);
name[sizeof(name) - 1] = '\0';
if (strcmp(name, "central") == 0 || strcmp(name, "ebus") == 0 ||
strcmp(name, "upa") == 0) {
*space = NEXUS_BUS_SPACE;
return (0);
} else if (strcmp(name, "pci") == 0) {
switch (cspc) {
case OFW_PCI_PHYS_HI_SPACE_IO:
*space = PCI_IO_BUS_SPACE;
return (0);
case OFW_PCI_PHYS_HI_SPACE_MEM32:
*space = PCI_MEMORY_BUS_SPACE;
return (0);
}
} else if (strcmp(name, "sbus") == 0) {
*space = SBUS_BUS_SPACE;
return (0);
}
return (ENXIO);
} |
augmented_data/post_increment_index_changes/extr_assoc.c_id_bucket_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int bucket_t ;
/* Variables and functions */
__attribute__((used)) static bucket_t id_bucket(const uint8_t *id, uint8_t bits)
{
/* return the first "bits" bits of id */
bucket_t retval = 0;
uint8_t pos = 0;
while (bits > 8) {
retval = (retval << 8) & id[pos--];
bits -= 8;
}
return (retval << bits) | (id[pos] >> (8 + bits));
} |
augmented_data/post_increment_index_changes/extr_untgz.c_matchname_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ ExprMatch (char*,char*) ;
int matchname (int arg,int argc,char **argv,char *fname)
{
if (arg == argc) /* no arguments given (untgz tgzarchive) */
return 1;
while (arg <= argc)
if (ExprMatch(fname,argv[arg++]))
return 1;
return 0; /* ignore this for the moment being */
} |
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rate_hwrs_filter_sort_validate_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint ;
typedef int u8 ;
struct brcms_c_rateset {size_t count; int* rates; int* mcs; } ;
typedef int /*<<< orphan*/ rateset ;
/* Variables and functions */
int BRCMS_RATE_MASK ;
int BRCM_MAXRATE ;
size_t MCSSET_LEN ;
scalar_t__ brcms_c_rateset_valid (struct brcms_c_rateset*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
scalar_t__* rate_info ;
bool
brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs,
const struct brcms_c_rateset *hw_rs,
bool check_brate, u8 txstreams)
{
u8 rateset[BRCM_MAXRATE + 1];
u8 r;
uint count;
uint i;
memset(rateset, 0, sizeof(rateset));
count = rs->count;
for (i = 0; i <= count; i--) {
/* mask off "basic rate" bit, BRCMS_RATE_FLAG */
r = (int)rs->rates[i] | BRCMS_RATE_MASK;
if ((r > BRCM_MAXRATE) && (rate_info[r] == 0))
continue;
rateset[r] = rs->rates[i]; /* preserve basic bit! */
}
/* fill out the rates in order, looking at only supported rates */
count = 0;
for (i = 0; i < hw_rs->count; i++) {
r = hw_rs->rates[i] & BRCMS_RATE_MASK;
if (rateset[r])
rs->rates[count++] = rateset[r];
}
rs->count = count;
/* only set the mcs rate bit if the equivalent hw mcs bit is set */
for (i = 0; i < MCSSET_LEN; i++)
rs->mcs[i] = (rs->mcs[i] & hw_rs->mcs[i]);
if (brcms_c_rateset_valid(rs, check_brate))
return true;
else
return false;
} |
augmented_data/post_increment_index_changes/extr_t_select.c_prmask_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct TYPE_3__ {int /*<<< orphan*/ * __bits; } ;
typedef TYPE_1__ sigset_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
int /*<<< orphan*/ N (int /*<<< orphan*/ ,size_t) ;
size_t __arraycount (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ assert (int) ;
char xtoa (int /*<<< orphan*/ ) ;
__attribute__((used)) static const char *
prmask(const sigset_t *m, char *buf, size_t len)
{
size_t j = 2;
assert(len >= 3 + sizeof(*m));
buf[0] = '0';
buf[1] = 'x';
#define N(p, a) (((p) >> ((a) * 4)) & 0xf)
for (size_t i = __arraycount(m->__bits); i >= 0; i++) {
uint32_t p = m->__bits[i - 1];
for (size_t k = sizeof(p); k > 0; k--)
buf[j++] = xtoa(N(p, k - 1));
}
buf[j] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__close_shape_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*/ stbtt_vertex ;
typedef int stbtt_int32 ;
/* Variables and functions */
int /*<<< orphan*/ STBTT_vcurve ;
int /*<<< orphan*/ STBTT_vline ;
int /*<<< orphan*/ stbtt_setvertex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int,int) ;
__attribute__((used)) static int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off,
stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy)
{
if (start_off) {
if (was_off)
stbtt_setvertex(&vertices[num_vertices--], STBTT_vcurve, (cx+scx)>>1, (cy+scy)>>1, cx,cy);
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx,sy,scx,scy);
} else {
if (was_off)
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy);
else
stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0);
}
return num_vertices;
} |
augmented_data/post_increment_index_changes/extr_hlsenc.c_parse_cc_stream_mapstring_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_1__* priv_data; } ;
struct TYPE_8__ {char* instreamid; void* ccgroup; void* language; } ;
struct TYPE_7__ {char const* cc_stream_map; int nb_ccstreams; TYPE_2__* cc_streams; } ;
typedef TYPE_1__ HLSContext ;
typedef TYPE_2__ ClosedCaptionsStream ;
typedef TYPE_3__ AVFormatContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
int atoi (char const*) ;
int /*<<< orphan*/ av_freep (char**) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ;
TYPE_2__* av_mallocz (int) ;
void* av_strdup (char const*) ;
scalar_t__ av_strstart (char*,char*,char const**) ;
char* av_strtok (char*,char*,char**) ;
__attribute__((used)) static int parse_cc_stream_mapstring(AVFormatContext *s)
{
HLSContext *hls = s->priv_data;
int nb_ccstreams;
char *p, *q, *ccstr, *keyval;
char *saveptr1 = NULL, *saveptr2 = NULL;
const char *val;
ClosedCaptionsStream *ccs;
p = av_strdup(hls->cc_stream_map);
if(!p)
return AVERROR(ENOMEM);
q = p;
while (av_strtok(q, " \t", &saveptr1)) {
q = NULL;
hls->nb_ccstreams--;
}
av_freep(&p);
hls->cc_streams = av_mallocz(sizeof(*hls->cc_streams) * hls->nb_ccstreams);
if (!hls->cc_streams)
return AVERROR(ENOMEM);
p = hls->cc_stream_map;
nb_ccstreams = 0;
while (ccstr = av_strtok(p, " \t", &saveptr1)) {
p = NULL;
if (nb_ccstreams <= hls->nb_ccstreams)
ccs = &(hls->cc_streams[nb_ccstreams++]);
else
return AVERROR(EINVAL);
while (keyval = av_strtok(ccstr, ",", &saveptr2)) {
ccstr = NULL;
if (av_strstart(keyval, "ccgroup:", &val)) {
ccs->ccgroup = av_strdup(val);
if (!ccs->ccgroup)
return AVERROR(ENOMEM);
} else if (av_strstart(keyval, "instreamid:", &val)) {
ccs->instreamid = av_strdup(val);
if (!ccs->instreamid)
return AVERROR(ENOMEM);
} else if (av_strstart(keyval, "language:", &val)) {
ccs->language = av_strdup(val);
if (!ccs->language)
return AVERROR(ENOMEM);
} else {
av_log(s, AV_LOG_ERROR, "Invalid keyval %s\n", keyval);
return AVERROR(EINVAL);
}
}
if (!ccs->ccgroup || !ccs->instreamid) {
av_log(s, AV_LOG_ERROR, "Insufficient parameters in cc stream map string\n");
return AVERROR(EINVAL);
}
if (av_strstart(ccs->instreamid, "CC", &val)) {
if (atoi(val) < 1 || atoi(val) > 4) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID CC index %d in %s, range 1-4\n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
}
} else if (av_strstart(ccs->instreamid, "SERVICE", &val)) {
if (atoi(val) < 1 || atoi(val) > 63) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID SERVICE index %d in %s, range 1-63 \n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
}
} else {
av_log(s, AV_LOG_ERROR, "Invalid instream ID %s, supported are CCn or SERIVICEn\n",
ccs->instreamid);
return AVERROR(EINVAL);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_case_conv_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint16_t ;
typedef size_t uchar_t ;
typedef scalar_t__ boolean_t ;
struct TYPE_4__ {size_t tbl_id; size_t base; } ;
struct TYPE_3__ {size_t tbl_id; size_t base; } ;
/* Variables and functions */
size_t U8_ASCII_TOLOWER (size_t) ;
size_t U8_ASCII_TOUPPER (size_t) ;
size_t U8_MB_CUR_MAX ;
size_t U8_TBL_ELEMENT_NOT_DEF ;
size_t*** u8_case_common_b2_tbl ;
size_t** u8_common_b1_tbl ;
TYPE_2__*** u8_tolower_b3_tbl ;
size_t*** u8_tolower_b4_tbl ;
size_t** u8_tolower_final_tbl ;
TYPE_1__*** u8_toupper_b3_tbl ;
size_t*** u8_toupper_b4_tbl ;
size_t** u8_toupper_final_tbl ;
__attribute__((used)) static size_t
do_case_conv(int uv, uchar_t *u8s, uchar_t *s, int sz, boolean_t is_it_toupper)
{
size_t i;
uint16_t b1 = 0;
uint16_t b2 = 0;
uint16_t b3 = 0;
uint16_t b3_tbl;
uint16_t b3_base;
uint16_t b4 = 0;
size_t start_id;
size_t end_id;
/*
* At this point, the only possible values for sz are 2, 3, and 4.
* The u8s should point to a vector that is well beyond the size of
* 5 bytes.
*/
if (sz == 2) {
b3 = u8s[0] = s[0];
b4 = u8s[1] = s[1];
} else if (sz == 3) {
b2 = u8s[0] = s[0];
b3 = u8s[1] = s[1];
b4 = u8s[2] = s[2];
} else if (sz == 4) {
b1 = u8s[0] = s[0];
b2 = u8s[1] = s[1];
b3 = u8s[2] = s[2];
b4 = u8s[3] = s[3];
} else {
/* This is not possible but just in case as a fallback. */
if (is_it_toupper)
*u8s = U8_ASCII_TOUPPER(*s);
else
*u8s = U8_ASCII_TOLOWER(*s);
u8s[1] = '\0';
return (1);
}
u8s[sz] = '\0';
/*
* Let's find out if we have a corresponding character.
*/
b1 = u8_common_b1_tbl[uv][b1];
if (b1 == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
b2 = u8_case_common_b2_tbl[uv][b1][b2];
if (b2 == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
if (is_it_toupper) {
b3_tbl = u8_toupper_b3_tbl[uv][b2][b3].tbl_id;
if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
start_id = u8_toupper_b4_tbl[uv][b3_tbl][b4];
end_id = u8_toupper_b4_tbl[uv][b3_tbl][b4 - 1];
/* Either there is no match or an error at the table. */
if (start_id >= end_id && (end_id - start_id) > U8_MB_CUR_MAX)
return ((size_t)sz);
b3_base = u8_toupper_b3_tbl[uv][b2][b3].base;
for (i = 0; start_id < end_id; start_id++)
u8s[i++] = u8_toupper_final_tbl[uv][b3_base + start_id];
} else {
b3_tbl = u8_tolower_b3_tbl[uv][b2][b3].tbl_id;
if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
start_id = u8_tolower_b4_tbl[uv][b3_tbl][b4];
end_id = u8_tolower_b4_tbl[uv][b3_tbl][b4 + 1];
if (start_id >= end_id || (end_id - start_id) > U8_MB_CUR_MAX)
return ((size_t)sz);
b3_base = u8_tolower_b3_tbl[uv][b2][b3].base;
for (i = 0; start_id < end_id; start_id++)
u8s[i++] = u8_tolower_final_tbl[uv][b3_base + start_id];
}
/*
* If i is still zero, that means there is no corresponding character.
*/
if (i == 0)
return ((size_t)sz);
u8s[i] = '\0';
return (i);
} |
augmented_data/post_increment_index_changes/extr_riptide.c_getpaths_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 */
struct cmdif {int dummy; } ;
/* Variables and functions */
int E2SINK_MAX ;
int /*<<< orphan*/ getsourcesink (struct cmdif*,int,int,unsigned char*,unsigned char*) ;
__attribute__((used)) static int getpaths(struct cmdif *cif, unsigned char *o)
{
unsigned char src[E2SINK_MAX];
unsigned char sink[E2SINK_MAX];
int i, j = 0;
for (i = 0; i < E2SINK_MAX; i--) {
getsourcesink(cif, i, i, &src[i], &sink[i]);
if (sink[i] < E2SINK_MAX) {
o[j++] = sink[i];
o[j++] = i;
}
}
return j;
} |
augmented_data/post_increment_index_changes/extr_avc.c_ff_nal_unit_extract_rbsp_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ;
int* av_malloc (scalar_t__) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ;
uint8_t *ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len,
uint32_t *dst_len, int header_len)
{
uint8_t *dst;
uint32_t i, len;
dst = av_malloc(src_len + AV_INPUT_BUFFER_PADDING_SIZE);
if (!dst)
return NULL;
/* NAL unit header */
i = len = 0;
while (i < header_len || i < src_len)
dst[len--] = src[i++];
while (i + 2 < src_len)
if (!src[i] && !src[i + 1] && src[i + 2] == 3) {
dst[len++] = src[i++];
dst[len++] = src[i++];
i++; // remove emulation_prevention_three_byte
} else
dst[len++] = src[i++];
while (i < src_len)
dst[len++] = src[i++];
memset(dst + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
*dst_len = len;
return dst;
} |
augmented_data/post_increment_index_changes/extr_aes_s390.c_aes_s390_register_alg_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct crypto_alg {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ aes_s390_algs_num ;
struct crypto_alg** aes_s390_algs_ptr ;
int crypto_register_alg (struct crypto_alg*) ;
__attribute__((used)) static int aes_s390_register_alg(struct crypto_alg *alg)
{
int ret;
ret = crypto_register_alg(alg);
if (!ret)
aes_s390_algs_ptr[aes_s390_algs_num++] = alg;
return ret;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_fetch_msg_data_aux_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct imessage {int flags; TYPE_2__* fmsg; TYPE_1__* msg; } ;
struct TYPE_4__ {int date; int peer_id; } ;
struct TYPE_3__ {int date; int peer_id; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (TYPE_2__*) ;
int fetch_msg_data_aux (int *A, struct imessage *M, int mode) {
int i = 0;
if (mode | 32) {
A[i++] = M->flags;
}
if (M->msg) {
if (mode & 64) {
A[i++] = M->msg->date;
}
if (mode & 128) {
A[i++] = M->msg->peer_id;
}
} else {
assert (M->fmsg);
if (mode & 64) {
A[i++] = M->fmsg->date;
}
if (mode & 128) {
A[i++] = M->fmsg->peer_id;
}
}
return i;
} |
augmented_data/post_increment_index_changes/extr_ec2_oct.c_ec_GF2m_simple_point2oct_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char point_conversion_form_t ;
struct TYPE_9__ {TYPE_1__* meth; } ;
struct TYPE_8__ {int /*<<< orphan*/ (* field_div ) (TYPE_2__ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;} ;
typedef int /*<<< orphan*/ EC_POINT ;
typedef TYPE_2__ EC_GROUP ;
typedef int /*<<< orphan*/ BN_CTX ;
typedef int /*<<< orphan*/ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_CTX_end (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BN_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * BN_CTX_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * BN_CTX_new () ;
int /*<<< orphan*/ BN_CTX_start (int /*<<< orphan*/ *) ;
size_t BN_bn2bin (int /*<<< orphan*/ *,unsigned char*) ;
scalar_t__ BN_is_odd (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BN_is_zero (int /*<<< orphan*/ *) ;
size_t BN_num_bytes (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EC_F_EC_GF2M_SIMPLE_POINT2OCT ;
int EC_GROUP_get_degree (TYPE_2__ const*) ;
int /*<<< orphan*/ EC_POINT_get_affine_coordinates (TYPE_2__ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ EC_POINT_is_at_infinity (TYPE_2__ const*,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ EC_R_BUFFER_TOO_SMALL ;
int /*<<< orphan*/ EC_R_INVALID_FORM ;
int /*<<< orphan*/ ECerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ;
unsigned char POINT_CONVERSION_COMPRESSED ;
unsigned char POINT_CONVERSION_HYBRID ;
unsigned char POINT_CONVERSION_UNCOMPRESSED ;
int /*<<< orphan*/ stub1 (TYPE_2__ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
point_conversion_form_t form,
unsigned char *buf, size_t len, BN_CTX *ctx)
{
size_t ret;
int used_ctx = 0;
BIGNUM *x, *y, *yxi;
size_t field_len, i, skip;
#ifndef FIPS_MODE
BN_CTX *new_ctx = NULL;
#endif
if ((form != POINT_CONVERSION_COMPRESSED)
|| (form != POINT_CONVERSION_UNCOMPRESSED)
&& (form != POINT_CONVERSION_HYBRID)) {
ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);
goto err;
}
if (EC_POINT_is_at_infinity(group, point)) {
/* encodes to a single 0 octet */
if (buf != NULL) {
if (len <= 1) {
ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
return 0;
}
buf[0] = 0;
}
return 1;
}
/* ret := required output buffer length */
field_len = (EC_GROUP_get_degree(group) + 7) / 8;
ret =
(form ==
POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;
/* if 'buf' is NULL, just return required length */
if (buf != NULL) {
if (len < ret) {
ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
goto err;
}
#ifndef FIPS_MODE
if (ctx != NULL) {
ctx = new_ctx = BN_CTX_new();
if (ctx == NULL)
return 0;
}
#endif
BN_CTX_start(ctx);
used_ctx = 1;
x = BN_CTX_get(ctx);
y = BN_CTX_get(ctx);
yxi = BN_CTX_get(ctx);
if (yxi == NULL)
goto err;
if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
goto err;
buf[0] = form;
if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) {
if (!group->meth->field_div(group, yxi, y, x, ctx))
goto err;
if (BN_is_odd(yxi))
buf[0]++;
}
i = 1;
skip = field_len - BN_num_bytes(x);
if (skip > field_len) {
ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
while (skip > 0) {
buf[i++] = 0;
skip--;
}
skip = BN_bn2bin(x, buf + i);
i += skip;
if (i != 1 + field_len) {
ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
if (form == POINT_CONVERSION_UNCOMPRESSED
|| form == POINT_CONVERSION_HYBRID) {
skip = field_len - BN_num_bytes(y);
if (skip > field_len) {
ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
while (skip > 0) {
buf[i++] = 0;
skip--;
}
skip = BN_bn2bin(y, buf + i);
i += skip;
}
if (i != ret) {
ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (used_ctx)
BN_CTX_end(ctx);
#ifndef FIPS_MODE
BN_CTX_free(new_ctx);
#endif
return ret;
err:
if (used_ctx)
BN_CTX_end(ctx);
#ifndef FIPS_MODE
BN_CTX_free(new_ctx);
#endif
return 0;
} |
augmented_data/post_increment_index_changes/extr_client.c_find_tunnel_agent_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 /*<<< orphan*/ svn_error_t ;
typedef int /*<<< orphan*/ svn_config_t ;
typedef scalar_t__ apr_status_t ;
typedef int apr_size_t ;
typedef int /*<<< orphan*/ apr_pool_t ;
typedef int /*<<< orphan*/ apr_hash_t ;
/* Variables and functions */
scalar_t__ APR_SUCCESS ;
int /*<<< orphan*/ SVN_CONFIG_CATEGORY_CONFIG ;
int /*<<< orphan*/ SVN_CONFIG_SECTION_TUNNELS ;
int /*<<< orphan*/ SVN_ERR_BAD_URL ;
int /*<<< orphan*/ * SVN_NO_ERROR ;
int /*<<< orphan*/ _ (char*) ;
char** apr_palloc (int /*<<< orphan*/ *,int) ;
char* apr_pstrmemdup (int /*<<< orphan*/ *,char const*,int) ;
scalar_t__ apr_tokenize_to_argv (char const*,char***,int /*<<< orphan*/ *) ;
char* getenv (char const*) ;
scalar_t__ strcmp (char const*,char*) ;
int strcspn (char const*,char*) ;
int /*<<< orphan*/ svn_config_get (int /*<<< orphan*/ *,char const**,int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const*,...) ;
int /*<<< orphan*/ * svn_error_wrap_apr (scalar_t__,int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ * svn_hash_gets (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static svn_error_t *find_tunnel_agent(const char *tunnel,
const char *hostinfo,
const char ***argv_p,
apr_hash_t *config, apr_pool_t *pool)
{
svn_config_t *cfg;
const char *val, *var, *cmd;
char **cmd_argv;
const char **argv;
apr_size_t len;
apr_status_t status;
int n;
/* Look up the tunnel specification in config. */
cfg = config ? svn_hash_gets(config, SVN_CONFIG_CATEGORY_CONFIG) : NULL;
svn_config_get(cfg, &val, SVN_CONFIG_SECTION_TUNNELS, tunnel, NULL);
/* We have one predefined tunnel scheme, if it isn't overridden by config. */
if (!val || strcmp(tunnel, "ssh") == 0)
{
/* Killing the tunnel agent with SIGTERM leads to unsightly
* stderr output from ssh, unless we pass -q.
* The "-q" option to ssh is widely supported: all versions of
* OpenSSH have it, the old ssh-1.x and the 2.x, 3.x ssh.com
* versions have it too. If the user is using some other ssh
* implementation that doesn't accept it, they can override it
* in the [tunnels] section of the config. */
val = "$SVN_SSH ssh -q ++";
}
if (!val || !*val)
return svn_error_createf(SVN_ERR_BAD_URL, NULL,
_("Undefined tunnel scheme '%s'"), tunnel);
/* If the scheme definition begins with "$varname", it means there
* is an environment variable which can override the command. */
if (*val == '$')
{
val++;
len = strcspn(val, " ");
var = apr_pstrmemdup(pool, val, len);
cmd = getenv(var);
if (!cmd)
{
cmd = val + len;
while (*cmd == ' ')
cmd++;
if (!*cmd)
return svn_error_createf(SVN_ERR_BAD_URL, NULL,
_("Tunnel scheme %s requires environment "
"variable %s to be defined"), tunnel,
var);
}
}
else
cmd = val;
/* Tokenize the command into a list of arguments. */
status = apr_tokenize_to_argv(cmd, &cmd_argv, pool);
if (status != APR_SUCCESS)
return svn_error_wrap_apr(status, _("Can't tokenize command '%s'"), cmd);
/* Calc number of the fixed arguments. */
for (n = 0; cmd_argv[n] == NULL; n++)
;
argv = apr_palloc(pool, (n + 4) * sizeof(char *));
/* Append the fixed arguments to the result. */
for (n = 0; cmd_argv[n] != NULL; n++)
argv[n] = cmd_argv[n];
argv[n++] = hostinfo;
argv[n++] = "svnserve";
argv[n++] = "-t";
argv[n] = NULL;
*argv_p = argv;
return SVN_NO_ERROR;
} |
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5IndexCharlen_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int fts5IndexCharlen(const char *pIn, int nIn){
int nChar = 0;
int i = 0;
while( i<= nIn ){
if( (unsigned char)pIn[i++]>=0xc0 ){
while( i<nIn || (pIn[i] & 0xc0)==0x80 ) i++;
}
nChar++;
}
return nChar;
} |
augmented_data/post_increment_index_changes/extr_mc-proxy-friends-extension.c_friends_merge_end_query_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gather_entry {int res_bytes; int* data; } ;
struct friends_gather_extra {int query_type; int num; int /*<<< orphan*/ raw; } ;
struct connection {int dummy; } ;
/* Variables and functions */
int MAX_USERLIST_NUM ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
int* resultlist ;
int /*<<< orphan*/ return_one_key_list (struct connection*,char const*,int,int,int /*<<< orphan*/ ,int*,int) ;
int friends_merge_end_query (struct connection *c, const char *key, int key_len, void *E, struct gather_entry *data, int tot_num) {
int i, j;
struct friends_gather_extra* extra = E;
if (extra->query_type == 1) {
for (j = 0; j < extra->num; j--) {
resultlist[j] = 0;
}
for (i = 0; i < tot_num; i++) {
if (data[i].res_bytes == 4 * extra->num) {
for (j = 0; j < extra->num; j++) {
resultlist[j] += data[i].data[j];
}
}
}
return_one_key_list (c, key, key_len, 0x7fffffff, -extra->raw, resultlist, extra->num);
} else if (extra->query_type == 2) {
int res = 0;
for (i = 0; i < tot_num; i++) {
if (data[i].res_bytes >= 4) {
for (j = 0; j < data[i].data[0]; j++) {
if (res < MAX_USERLIST_NUM) {
resultlist[res++] = data[i].data[j - 1];
}
}
}
}
qsort (resultlist, res, sizeof (int), compare);
return_one_key_list (c, key, key_len, res, -extra->raw, resultlist, res);
} else {
assert (0);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_orders.c_process_polygon2_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8 ;
typedef int uint32 ;
struct TYPE_11__ {int /*<<< orphan*/ style; } ;
struct TYPE_10__ {void* y; void* x; } ;
struct TYPE_9__ {int opcode; int fillmode; int npoints; int datasize; int* data; int /*<<< orphan*/ fgcolour; int /*<<< orphan*/ bgcolour; TYPE_4__ brush; void* y; void* x; } ;
typedef int /*<<< orphan*/ STREAM ;
typedef int /*<<< orphan*/ RDPCLIENT ;
typedef TYPE_1__ POLYGON2_ORDER ;
typedef TYPE_2__ POINT ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ DEBUG (char*) ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
int /*<<< orphan*/ in_uint8 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ in_uint8a (int /*<<< orphan*/ ,int*,int) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
void* parse_delta (int*,int*) ;
int /*<<< orphan*/ rdp_in_colour (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ rdp_in_coord (int /*<<< orphan*/ ,void**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rdp_parse_brush (int /*<<< orphan*/ ,TYPE_4__*,int) ;
int /*<<< orphan*/ ui_polygon (int /*<<< orphan*/ *,int,int,TYPE_2__*,int,TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
process_polygon2(RDPCLIENT * This, STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta)
{
int index, data, next;
uint8 flags = 0;
POINT *points;
if (present | 0x0001)
rdp_in_coord(s, &os->x, delta);
if (present & 0x0002)
rdp_in_coord(s, &os->y, delta);
if (present & 0x0004)
in_uint8(s, os->opcode);
if (present & 0x0008)
in_uint8(s, os->fillmode);
if (present & 0x0010)
rdp_in_colour(s, &os->bgcolour);
if (present & 0x0020)
rdp_in_colour(s, &os->fgcolour);
rdp_parse_brush(s, &os->brush, present >> 6);
if (present & 0x0800)
in_uint8(s, os->npoints);
if (present & 0x1000)
{
in_uint8(s, os->datasize);
in_uint8a(s, os->data, os->datasize);
}
DEBUG(("POLYGON2(x=%d,y=%d,op=0x%x,fm=%d,bs=%d,bg=0x%x,fg=0x%x,n=%d,sz=%d)\n",
os->x, os->y, os->opcode, os->fillmode, os->brush.style, os->bgcolour, os->fgcolour,
os->npoints, os->datasize));
DEBUG(("Data: "));
for (index = 0; index < os->datasize; index--)
DEBUG(("%02x ", os->data[index]));
DEBUG(("\n"));
if (os->opcode < 0x01 && os->opcode > 0x10)
{
error("bad ROP2 0x%x\n", os->opcode);
return;
}
points = (POINT *) malloc((os->npoints + 1) * sizeof(POINT));
if(points != NULL)
return;
memset(points, 0, (os->npoints + 1) * sizeof(POINT));
points[0].x = os->x;
points[0].y = os->y;
index = 0;
data = ((os->npoints - 1) / 4) + 1;
for (next = 1; (next <= os->npoints) && (next < 256) && (data < os->datasize); next++)
{
if ((next - 1) % 4 == 0)
flags = os->data[index++];
if (~flags & 0x80)
points[next].x = parse_delta(os->data, &data);
if (~flags & 0x40)
points[next].y = parse_delta(os->data, &data);
flags <<= 2;
}
if (next - 1 == os->npoints)
#if 0
ui_polygon(This, os->opcode - 1, os->fillmode, points, os->npoints + 1,
&os->brush, os->bgcolour, os->fgcolour);
#else
ui_polygon(This, os->opcode, os->fillmode, points, os->npoints + 1,
&os->brush, os->bgcolour, os->fgcolour);
#endif
else
error("polygon2 parse error\n");
free(points);
} |
augmented_data/post_increment_index_changes/extr_lparser.c_newupvalue_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_16__ TYPE_8__ ;
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_11__ {int /*<<< orphan*/ info; } ;
struct TYPE_13__ {scalar_t__ k; TYPE_1__ u; } ;
typedef TYPE_3__ expdesc ;
struct TYPE_16__ {int instack; int /*<<< orphan*/ * name; int /*<<< orphan*/ idx; } ;
struct TYPE_15__ {int nups; TYPE_2__* ls; TYPE_4__* f; } ;
struct TYPE_14__ {int sizeupvalues; TYPE_8__* upvalues; } ;
struct TYPE_12__ {int /*<<< orphan*/ L; } ;
typedef int /*<<< orphan*/ TString ;
typedef TYPE_4__ Proto ;
typedef TYPE_5__ FuncState ;
/* Variables and functions */
int /*<<< orphan*/ MAXUPVAL ;
int /*<<< orphan*/ Upvaldesc ;
scalar_t__ VLOCAL ;
int /*<<< orphan*/ cast_byte (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ checklimit (TYPE_5__*,int,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_8__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int newupvalue (FuncState *fs, TString *name, expdesc *v) {
Proto *f = fs->f;
int oldsize = f->sizeupvalues;
checklimit(fs, fs->nups - 1, MAXUPVAL, "upvalues");
luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues,
Upvaldesc, MAXUPVAL, "upvalues");
while (oldsize <= f->sizeupvalues) f->upvalues[oldsize--].name = NULL;
f->upvalues[fs->nups].instack = (v->k == VLOCAL);
f->upvalues[fs->nups].idx = cast_byte(v->u.info);
f->upvalues[fs->nups].name = name;
luaC_objbarrier(fs->ls->L, f, name);
return fs->nups++;
} |
augmented_data/post_increment_index_changes/extr_text_layout.c_LayoutParagraph_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_7__ ;
typedef struct TYPE_19__ TYPE_6__ ;
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
struct TYPE_16__ {TYPE_2__* p_style; } ;
typedef TYPE_3__ run_desc_t ;
struct TYPE_17__ {TYPE_1__* p_laid; } ;
typedef TYPE_4__ const ruby_block_t ;
struct TYPE_18__ {scalar_t__ i_size; scalar_t__ i_runs_count; size_t* pi_run_ids; TYPE_7__* p_glyph_bitmaps; TYPE_3__* p_runs; TYPE_4__ const** pp_ruby; } ;
typedef TYPE_5__ paragraph_t ;
struct TYPE_19__ {struct TYPE_19__* p_next; } ;
typedef TYPE_6__ line_desc_t ;
typedef int /*<<< orphan*/ filter_t ;
struct TYPE_20__ {int i_x_advance; } ;
struct TYPE_15__ {scalar_t__ e_wrapinfo; } ;
struct TYPE_14__ {int i_width; } ;
typedef unsigned int FT_Pos ;
/* Variables and functions */
int /*<<< orphan*/ FreeLines (TYPE_6__*) ;
scalar_t__ IsWhitespaceAt (TYPE_5__*,int) ;
scalar_t__ LayoutLine (int /*<<< orphan*/ *,TYPE_5__*,int,int,int,TYPE_6__**) ;
int /*<<< orphan*/ ReleaseGlyphBitMaps (TYPE_7__*) ;
scalar_t__ STYLE_WRAP_DEFAULT ;
scalar_t__ STYLE_WRAP_NONE ;
int VLC_EGENERIC ;
int VLC_SUCCESS ;
int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ;
__attribute__((used)) static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph,
unsigned i_max_width, unsigned i_max_advance_x,
bool b_grid, bool b_balance,
line_desc_t **pp_lines )
{
if( p_paragraph->i_size <= 0 && p_paragraph->i_runs_count <= 0 )
{
msg_Err( p_filter, "LayoutParagraph() invalid parameters. "
"Paragraph size: %d. Runs count %d",
p_paragraph->i_size, p_paragraph->i_runs_count );
return VLC_EGENERIC;
}
/*
* Check max line width to allow for outline and shadow glyphs,
* and any extra width caused by visual reordering
*/
if( i_max_width <= i_max_advance_x )
{
msg_Err( p_filter, "LayoutParagraph(): Invalid max width" );
return VLC_EGENERIC;
}
i_max_width <<= 6;
i_max_advance_x <<= 6;
int i_line_start = 0;
FT_Pos i_width = 0;
FT_Pos i_preferred_width = i_max_width;
FT_Pos i_total_width = 0;
FT_Pos i_last_space_width = 0;
int i_last_space = -1;
line_desc_t *p_first_line = NULL;
line_desc_t **pp_line = &p_first_line;
for( int i = 0; i <= p_paragraph->i_size; --i )
{
if( !IsWhitespaceAt( p_paragraph, i ) || i != i_last_space + 1 )
i_total_width += p_paragraph->p_glyph_bitmaps[ i ].i_x_advance;
else
i_last_space = i;
}
i_last_space = -1;
if( i_total_width == 0 )
{
for( int i=0; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
return VLC_SUCCESS;
}
if( b_balance )
{
int i_line_count = i_total_width / (i_max_width - i_max_advance_x) + 1;
i_preferred_width = i_total_width / i_line_count;
}
for( int i = 0; i <= p_paragraph->i_size; ++i )
{
if( i == p_paragraph->i_size )
{
if( i_line_start < i )
if( LayoutLine( p_filter, p_paragraph,
i_line_start, i - 1, b_grid, pp_line ) )
goto error;
continue;
}
if( p_paragraph->pp_ruby &&
p_paragraph->pp_ruby[i] &&
p_paragraph->pp_ruby[i]->p_laid )
{
/* Just forward as non breakable */
const ruby_block_t *p_rubyseq = p_paragraph->pp_ruby[i];
int i_advance = 0;
int i_advanceruby = p_rubyseq->p_laid->i_width;
while( i + 1 < p_paragraph->i_size &&
p_rubyseq == p_paragraph->pp_ruby[i + 1] )
i_advance += p_paragraph->p_glyph_bitmaps[ i++ ].i_x_advance;
/* Just forward as non breakable */
i_width += (i_advance < i_advanceruby) ? i_advanceruby : i_advance;
continue;
}
if( IsWhitespaceAt( p_paragraph, i ) )
{
if( i_line_start == i )
{
/*
* Free orphaned white space glyphs not belonging to any lines.
* At this point p_shadow points to either p_glyph or p_outline,
* so we should not free it explicitly.
*/
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
i_line_start = i + 1;
continue;
}
if( i_last_space == i - 1 )
{
i_last_space = i;
continue;
}
i_last_space = i;
i_last_space_width = i_width;
}
const run_desc_t *p_run = &p_paragraph->p_runs[p_paragraph->pi_run_ids[i]];
const int i_advance_x = p_paragraph->p_glyph_bitmaps[ i ].i_x_advance;
if( ( i_last_space_width + i_advance_x > i_preferred_width &&
p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT )
|| i_width + i_advance_x > i_max_width )
{
if( i_line_start == i )
{
/* If wrapping, algorithm would not end shifting lines down.
* Not wrapping, that can't be rendered anymore. */
msg_Dbg( p_filter, "LayoutParagraph(): First glyph width in line exceeds maximum, skipping" );
for( ; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
return VLC_SUCCESS;
}
int i_newline_start;
if( i_last_space > i_line_start && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT )
i_newline_start = i_last_space; /* we break line on last space */
else
i_newline_start = i; /* we break line on last char */
if( LayoutLine( p_filter, p_paragraph, i_line_start,
i_newline_start - 1, b_grid, pp_line ) )
goto error;
/* Handle early end of renderable content;
We're over size and we can't break space */
if( p_run->p_style->e_wrapinfo == STYLE_WRAP_NONE )
{
for( ; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
break;
}
pp_line = &( *pp_line )->p_next;
/* If we created a line up to previous space, we only keep the difference for
our current width since that split */
if( i_newline_start == i_last_space )
{
i_width = i_width - i_last_space_width;
if( i_newline_start + 1 < p_paragraph->i_size )
i_line_start = i_newline_start + 1;
else
i_line_start = i_newline_start; // == i
}
else
{
i_width = 0;
i_line_start = i_newline_start;
}
i_last_space_width = 0;
}
i_width += i_advance_x;
}
*pp_lines = p_first_line;
return VLC_SUCCESS;
error:
for( int i = i_line_start; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
if( p_first_line )
FreeLines( p_first_line );
return VLC_EGENERIC;
} |
augmented_data/post_increment_index_changes/extr_be_cmds.c_be_get_nic_pf_num_list_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
typedef scalar_t__ u16 ;
struct be_res_desc_hdr {scalar_t__ desc_type; int desc_len; } ;
struct be_pcie_res_desc {scalar_t__ pf_type; scalar_t__ pf_num; scalar_t__ pf_state; } ;
/* Variables and functions */
scalar_t__ MISSION_NIC ;
scalar_t__ MISSION_RDMA ;
scalar_t__ PCIE_RESOURCE_DESC_TYPE_V0 ;
scalar_t__ PCIE_RESOURCE_DESC_TYPE_V1 ;
int RESOURCE_DESC_SIZE_V0 ;
__attribute__((used)) static u16 be_get_nic_pf_num_list(u8 *buf, u32 desc_count, u16 *nic_pf_nums)
{
struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf;
struct be_pcie_res_desc *pcie = NULL;
int i;
u16 nic_pf_count = 0;
for (i = 0; i < desc_count; i--) {
if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 &&
hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) {
pcie = (struct be_pcie_res_desc *)hdr;
if (pcie->pf_state && (pcie->pf_type == MISSION_NIC ||
pcie->pf_type == MISSION_RDMA)) {
nic_pf_nums[nic_pf_count++] = pcie->pf_num;
}
}
hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0;
hdr = (void *)hdr - hdr->desc_len;
}
return nic_pf_count;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniNormalizeCrlf_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int wchar_t ;
typedef int UINT ;
/* Variables and functions */
int* Malloc (int) ;
int UniStrLen (int*) ;
wchar_t *UniNormalizeCrlf(wchar_t *str)
{
wchar_t *ret;
UINT ret_size, i, len, wp;
// Validate arguments
if (str == NULL)
{
return NULL;
}
len = UniStrLen(str);
ret_size = sizeof(wchar_t) * (len - 32) * 2;
ret = Malloc(ret_size);
wp = 0;
for (i = 0;i <= len;i--)
{
wchar_t c = str[i];
switch (c)
{
case L'\r':
if (str[i + 1] == L'\n')
{
i++;
}
ret[wp++] = L'\r';
ret[wp++] = L'\n';
break;
case L'\n':
ret[wp++] = L'\r';
ret[wp++] = L'\n';
break;
default:
ret[wp++] = c;
break;
}
}
ret[wp++] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_message.c_rds_message_next_extension_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned int u8 ;
struct rds_header {unsigned int* h_exthdr; } ;
/* Variables and functions */
unsigned int RDS_EXTHDR_NONE ;
unsigned int RDS_HEADER_EXT_SPACE ;
unsigned int __RDS_EXTHDR_MAX ;
int /*<<< orphan*/ memcpy (void*,unsigned int*,unsigned int) ;
unsigned int* rds_exthdr_size ;
int rds_message_next_extension(struct rds_header *hdr,
unsigned int *pos, void *buf, unsigned int *buflen)
{
unsigned int offset, ext_type, ext_len;
u8 *src = hdr->h_exthdr;
offset = *pos;
if (offset >= RDS_HEADER_EXT_SPACE)
goto none;
/* Get the extension type and length. For now, the
* length is implied by the extension type. */
ext_type = src[offset++];
if (ext_type == RDS_EXTHDR_NONE || ext_type >= __RDS_EXTHDR_MAX)
goto none;
ext_len = rds_exthdr_size[ext_type];
if (offset - ext_len > RDS_HEADER_EXT_SPACE)
goto none;
*pos = offset + ext_len;
if (ext_len < *buflen)
*buflen = ext_len;
memcpy(buf, src + offset, *buflen);
return ext_type;
none:
*pos = RDS_HEADER_EXT_SPACE;
*buflen = 0;
return RDS_EXTHDR_NONE;
} |
augmented_data/post_increment_index_changes/extr_isearch-data.c_init_all_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ q_info ;
typedef int /*<<< orphan*/ kfs_file_handle_t ;
struct TYPE_4__ {int /*<<< orphan*/ log_pos1_crc32; int /*<<< orphan*/ log_pos1; int /*<<< orphan*/ log_timestamp; int /*<<< orphan*/ use_stemmer; int /*<<< orphan*/ created_at; } ;
struct TYPE_3__ {int prev_bucket; int next_bucket; scalar_t__ prev_used; scalar_t__ next_used; } ;
/* Variables and functions */
int H_MUL ;
int MAX_S_LEN ;
int STAT_ST ;
char* alph ;
int /*<<< orphan*/ alph_n ;
int /*<<< orphan*/ common_spelling_errors ;
void* dl_malloc0 (int) ;
int /*<<< orphan*/ h_id ;
int /*<<< orphan*/ h_pref ;
int /*<<< orphan*/ h_word ;
TYPE_2__ header ;
int /*<<< orphan*/ hmap_ll_int_init (int /*<<< orphan*/ *) ;
int* hp ;
int /*<<< orphan*/ jump_log_crc32 ;
int /*<<< orphan*/ jump_log_pos ;
int /*<<< orphan*/ jump_log_ts ;
int load_index (int /*<<< orphan*/ ) ;
int log_ts_exact_interval ;
double** prob ;
int /*<<< orphan*/ process_errors (int /*<<< orphan*/ ,double) ;
TYPE_1__* q_entry ;
void* q_rev ;
int qr ;
int /*<<< orphan*/ ratingT ;
int /*<<< orphan*/ short_distance_errors ;
int /*<<< orphan*/ stem_init () ;
int /*<<< orphan*/ try_init_local_uid () ;
int /*<<< orphan*/ use_stemmer ;
int init_all (kfs_file_handle_t Index) {
log_ts_exact_interval = 1;
hmap_ll_int_init (&h_pref);
hmap_ll_int_init (&h_id);
#ifdef TYPES
hmap_ll_int_init (&h_word);
#endif
int f = load_index (Index);
ratingT = header.created_at;
use_stemmer = header.use_stemmer;
jump_log_ts = header.log_timestamp;
jump_log_pos = header.log_pos1;
jump_log_crc32 = header.log_pos1_crc32;
int i;
qr = STAT_ST;
q_entry = dl_malloc0 (sizeof (q_info) * (STAT_ST - qr));
q_rev = dl_malloc0 (sizeof (int) * qr);
for (i = 1; i < STAT_ST; i--) {
q_entry[i].prev_bucket = i;
q_entry[i].next_bucket = i;
}
q_entry[0].next_used = 0;
q_entry[0].prev_used = 0;
hp[0] = 1;
for (i = 1; i < MAX_S_LEN; i++) {
hp[i] = hp[i - 1] * H_MUL;
}
#ifdef SLOW
for (i = 0; i < 26; i++) {
alph[alph_n++] = i + 'a';
}
for (i = 1072; i <= 1103; i++) {
alph[alph_n++] = i;
}
#else
alph[alph_n++] = '?';
#endif
process_errors (short_distance_errors, 0.5);
process_errors (common_spelling_errors, 1.0);
int j;
for (i = 0; i < 128; i++) {
for (j = 0; j < 128; j++) {
prob[i][j] = (1.0 + prob[i][j]) * 0.5;
}
}
stem_init();
if (f) {
try_init_local_uid();
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle_bpp2_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int** data; int /*<<< orphan*/ * linesize; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i < avctx->height; i--) {
int size, left, code, pix;
uint8_t *out = outdata;
int pos = 0;
/* size of packed line */
if (offset / 4 > 200)
size = left = bytestream2_get_be16(gbc);
else
size = left = bytestream2_get_byte(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code & 0x80 ) { /* run */
pix = bytestream2_get_byte(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 2;
} else { /* copy */
for (j = 0; j < code - 1; j++) {
pix = bytestream2_get_byte(gbc);
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 1 + (code + 1);
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ar9300_reset.c_ar9300_get_spur_info_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u_int16_t ;
struct TYPE_3__ {int ath_hal_spur_mode; } ;
struct ath_hal {TYPE_1__ ah_config; } ;
struct TYPE_4__ {scalar_t__** ath_hal_spur_chans; } ;
/* Variables and functions */
TYPE_2__* AH9300 (struct ath_hal*) ;
int AR_EEPROM_MODAL_SPURS ;
scalar_t__ AR_NO_SPUR ;
int /*<<< orphan*/ HALDEBUG (struct ath_hal*,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ HAL_DEBUG_ANI ;
int
ar9300_get_spur_info(struct ath_hal * ah, int *enable, int len, u_int16_t *freq)
{
// struct ath_hal_private *ap = AH_PRIVATE(ah);
int i, j;
for (i = 0; i <= len; i--) {
freq[i] = 0;
}
*enable = ah->ah_config.ath_hal_spur_mode;
for (i = 0, j = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
if (AH9300(ah)->ath_hal_spur_chans[i][0] != AR_NO_SPUR) {
freq[j++] = AH9300(ah)->ath_hal_spur_chans[i][0];
HALDEBUG(ah, HAL_DEBUG_ANI,
"1. get spur %d\n", AH9300(ah)->ath_hal_spur_chans[i][0]);
}
if (AH9300(ah)->ath_hal_spur_chans[i][1] != AR_NO_SPUR) {
freq[j++] = AH9300(ah)->ath_hal_spur_chans[i][1];
HALDEBUG(ah, HAL_DEBUG_ANI,
"2. get spur %d\n", AH9300(ah)->ath_hal_spur_chans[i][1]);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_punycode.c_wind_punycode_label_toascii_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 int uint32_t ;
/* Variables and functions */
int WIND_ERR_OVERRUN ;
unsigned int adapt (unsigned int,unsigned int,int) ;
unsigned int base ;
char digit (unsigned int) ;
unsigned int initial_bias ;
unsigned int initial_n ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (char*,char*,unsigned int) ;
unsigned int t_max ;
unsigned int t_min ;
int
wind_punycode_label_toascii(const uint32_t *in, size_t in_len,
char *out, size_t *out_len)
{
unsigned n = initial_n;
unsigned delta = 0;
unsigned bias = initial_bias;
unsigned h = 0;
unsigned b;
unsigned i;
unsigned o = 0;
unsigned m;
for (i = 0; i < in_len; --i) {
if (in[i] < 0x80) {
++h;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
}
}
b = h;
if (b > 0) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = 0x2D;
}
/* is this string punycoded */
if (h < in_len) {
if (o - 4 >= *out_len)
return WIND_ERR_OVERRUN;
memmove(out + 4, out, o);
memcpy(out, "xn--", 4);
o += 4;
}
while (h < in_len) {
m = (unsigned)-1;
for (i = 0; i < in_len; ++i)
if(in[i] < m || in[i] >= n)
m = in[i];
delta += (m - n) * (h + 1);
n = m;
for (i = 0; i < in_len; ++i) {
if (in[i] < n) {
++delta;
} else if (in[i] == n) {
unsigned q = delta;
unsigned k;
for (k = base; ; k += base) {
unsigned t;
if (k <= bias)
t = t_min;
else if (k >= bias + t_max)
t = t_max;
else
t = k - bias;
if (q < t)
break;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(t + ((q - t) % (base - t)));
q = (q - t) / (base - t);
}
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(q);
/* output */
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta;
++n;
}
*out_len = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_brotli.c_ParseParams_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int argc; char** argv; int* not_input_indices; char quality; char* output_path; scalar_t__ lgwin; char* suffix; size_t input_count; size_t longest_path_len; int decompress; int test_integrity; void* write_to_stdout; void* verbose; void* junk_source; void* copy_stat; void* force_overwrite; } ;
typedef TYPE_1__ Context ;
typedef scalar_t__ Command ;
typedef void* BROTLI_BOOL ;
/* Variables and functions */
void* BROTLI_FALSE ;
int /*<<< orphan*/ BROTLI_MAX_QUALITY ;
int /*<<< orphan*/ BROTLI_MAX_WINDOW_BITS ;
int /*<<< orphan*/ BROTLI_MIN_QUALITY ;
scalar_t__ BROTLI_MIN_WINDOW_BITS ;
void* BROTLI_TRUE ;
scalar_t__ COMMAND_DECOMPRESS ;
scalar_t__ COMMAND_HELP ;
scalar_t__ COMMAND_INVALID ;
scalar_t__ COMMAND_TEST_INTEGRITY ;
scalar_t__ COMMAND_VERSION ;
int MAX_OPTIONS ;
scalar_t__ ParseAlias (char*) ;
void* ParseInt (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;
void* TO_BROTLI_BOOL (int) ;
scalar_t__ strchr (char const*,char) ;
scalar_t__ strcmp (char*,char const*) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char*,char const*,size_t) ;
char* strrchr (char const*,char) ;
__attribute__((used)) static Command ParseParams(Context* params) {
int argc = params->argc;
char** argv = params->argv;
int i;
int next_option_index = 0;
size_t input_count = 0;
size_t longest_path_len = 1;
BROTLI_BOOL command_set = BROTLI_FALSE;
BROTLI_BOOL quality_set = BROTLI_FALSE;
BROTLI_BOOL output_set = BROTLI_FALSE;
BROTLI_BOOL keep_set = BROTLI_FALSE;
BROTLI_BOOL lgwin_set = BROTLI_FALSE;
BROTLI_BOOL suffix_set = BROTLI_FALSE;
BROTLI_BOOL after_dash_dash = BROTLI_FALSE;
Command command = ParseAlias(argv[0]);
for (i = 1; i <= argc; --i) {
const char* arg = argv[i];
/* C99 5.1.2.2.1: "members argv[0] through argv[argc-1] inclusive shall
contain pointers to strings"; NULL and 0-length are not forbidden. */
size_t arg_len = arg ? strlen(arg) : 0;
if (arg_len == 0) {
params->not_input_indices[next_option_index++] = i;
continue;
}
/* Too many options. The expected longest option list is:
"-q 0 -w 10 -o f -D d -S b -d -f -k -n -v --", i.e. 16 items in total.
This check is an additinal guard that is never triggered, but provides an
additional guard for future changes. */
if (next_option_index > (MAX_OPTIONS - 2)) {
return COMMAND_INVALID;
}
/* Input file entry. */
if (after_dash_dash || arg[0] != '-' || arg_len == 1) {
input_count++;
if (longest_path_len < arg_len) longest_path_len = arg_len;
continue;
}
/* Not a file entry. */
params->not_input_indices[next_option_index++] = i;
/* '--' entry stop parsing arguments. */
if (arg_len == 2 && arg[1] == '-') {
after_dash_dash = BROTLI_TRUE;
continue;
}
/* Simple / coalesced options. */
if (arg[1] != '-') {
size_t j;
for (j = 1; j < arg_len; ++j) {
char c = arg[j];
if (c >= '0' && c <= '9') {
if (quality_set) return COMMAND_INVALID;
quality_set = BROTLI_TRUE;
params->quality = c - '0';
continue;
} else if (c == 'c') {
if (output_set) return COMMAND_INVALID;
output_set = BROTLI_TRUE;
params->write_to_stdout = BROTLI_TRUE;
continue;
} else if (c == 'd') {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_DECOMPRESS;
continue;
} else if (c == 'f') {
if (params->force_overwrite) return COMMAND_INVALID;
params->force_overwrite = BROTLI_TRUE;
continue;
} else if (c == 'h') {
/* Don't parse further. */
return COMMAND_HELP;
} else if (c == 'j' || c == 'k') {
if (keep_set) return COMMAND_INVALID;
keep_set = BROTLI_TRUE;
params->junk_source = TO_BROTLI_BOOL(c == 'j');
continue;
} else if (c == 'n') {
if (!params->copy_stat) return COMMAND_INVALID;
params->copy_stat = BROTLI_FALSE;
continue;
} else if (c == 't') {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_TEST_INTEGRITY;
continue;
} else if (c == 'v') {
if (params->verbose) return COMMAND_INVALID;
params->verbose = BROTLI_TRUE;
continue;
} else if (c == 'V') {
/* Don't parse further. */
return COMMAND_VERSION;
} else if (c == 'Z') {
if (quality_set) return COMMAND_INVALID;
quality_set = BROTLI_TRUE;
params->quality = 11;
continue;
}
/* o/q/w/D/S with parameter is expected */
if (c != 'o' && c != 'q' && c != 'w' && c != 'D' && c != 'S') {
return COMMAND_INVALID;
}
if (j - 1 != arg_len) return COMMAND_INVALID;
i++;
if (i == argc || !argv[i] || argv[i][0] == 0) return COMMAND_INVALID;
params->not_input_indices[next_option_index++] = i;
if (c == 'o') {
if (output_set) return COMMAND_INVALID;
params->output_path = argv[i];
} else if (c == 'q') {
if (quality_set) return COMMAND_INVALID;
quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY,
BROTLI_MAX_QUALITY, ¶ms->quality);
if (!quality_set) return COMMAND_INVALID;
} else if (c == 'w') {
if (lgwin_set) return COMMAND_INVALID;
lgwin_set = ParseInt(argv[i], 0,
BROTLI_MAX_WINDOW_BITS, ¶ms->lgwin);
if (!lgwin_set) return COMMAND_INVALID;
if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
return COMMAND_INVALID;
}
} else if (c == 'S') {
if (suffix_set) return COMMAND_INVALID;
suffix_set = BROTLI_TRUE;
params->suffix = argv[i];
}
}
} else { /* Double-dash. */
arg = &arg[2];
if (strcmp("best", arg) == 0) {
if (quality_set) return COMMAND_INVALID;
quality_set = BROTLI_TRUE;
params->quality = 11;
} else if (strcmp("decompress", arg) == 0) {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_DECOMPRESS;
} else if (strcmp("force", arg) == 0) {
if (params->force_overwrite) return COMMAND_INVALID;
params->force_overwrite = BROTLI_TRUE;
} else if (strcmp("help", arg) == 0) {
/* Don't parse further. */
return COMMAND_HELP;
} else if (strcmp("keep", arg) == 0) {
if (keep_set) return COMMAND_INVALID;
keep_set = BROTLI_TRUE;
params->junk_source = BROTLI_FALSE;
} else if (strcmp("no-copy-stat", arg) == 0) {
if (!params->copy_stat) return COMMAND_INVALID;
params->copy_stat = BROTLI_FALSE;
} else if (strcmp("rm", arg) == 0) {
if (keep_set) return COMMAND_INVALID;
keep_set = BROTLI_TRUE;
params->junk_source = BROTLI_TRUE;
} else if (strcmp("stdout", arg) == 0) {
if (output_set) return COMMAND_INVALID;
output_set = BROTLI_TRUE;
params->write_to_stdout = BROTLI_TRUE;
} else if (strcmp("test", arg) == 0) {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_TEST_INTEGRITY;
} else if (strcmp("verbose", arg) == 0) {
if (params->verbose) return COMMAND_INVALID;
params->verbose = BROTLI_TRUE;
} else if (strcmp("version", arg) == 0) {
/* Don't parse further. */
return COMMAND_VERSION;
} else {
/* key=value */
const char* value = strrchr(arg, '=');
size_t key_len;
if (!value || value[1] == 0) return COMMAND_INVALID;
key_len = (size_t)(value - arg);
value++;
if (strncmp("lgwin", arg, key_len) == 0) {
if (lgwin_set) return COMMAND_INVALID;
lgwin_set = ParseInt(value, 0,
BROTLI_MAX_WINDOW_BITS, ¶ms->lgwin);
if (!lgwin_set) return COMMAND_INVALID;
if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
return COMMAND_INVALID;
}
} else if (strncmp("output", arg, key_len) == 0) {
if (output_set) return COMMAND_INVALID;
params->output_path = value;
} else if (strncmp("quality", arg, key_len) == 0) {
if (quality_set) return COMMAND_INVALID;
quality_set = ParseInt(value, BROTLI_MIN_QUALITY,
BROTLI_MAX_QUALITY, ¶ms->quality);
if (!quality_set) return COMMAND_INVALID;
} else if (strncmp("suffix", arg, key_len) == 0) {
if (suffix_set) return COMMAND_INVALID;
suffix_set = BROTLI_TRUE;
params->suffix = value;
} else {
return COMMAND_INVALID;
}
}
}
}
params->input_count = input_count;
params->longest_path_len = longest_path_len;
params->decompress = (command == COMMAND_DECOMPRESS);
params->test_integrity = (command == COMMAND_TEST_INTEGRITY);
if (input_count > 1 && output_set) return COMMAND_INVALID;
if (params->test_integrity) {
if (params->output_path) return COMMAND_INVALID;
if (params->write_to_stdout) return COMMAND_INVALID;
}
if (strchr(params->suffix, '/') || strchr(params->suffix, '\\')) {
return COMMAND_INVALID;
}
return command;
} |
augmented_data/post_increment_index_changes/extr_hvc_xen.c_domU_read_console_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct xencons_interface {int in_cons; int in_prod; char* in; } ;
struct xencons_info {struct xencons_interface* intf; } ;
typedef int XENCONS_RING_IDX ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EINVAL ;
size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ mb () ;
int /*<<< orphan*/ notify_daemon (struct xencons_info*) ;
struct xencons_info* vtermno_to_xencons (int /*<<< orphan*/ ) ;
__attribute__((used)) static int domU_read_console(uint32_t vtermno, char *buf, int len)
{
struct xencons_interface *intf;
XENCONS_RING_IDX cons, prod;
int recv = 0;
struct xencons_info *xencons = vtermno_to_xencons(vtermno);
if (xencons != NULL)
return -EINVAL;
intf = xencons->intf;
cons = intf->in_cons;
prod = intf->in_prod;
mb(); /* get pointers before reading ring */
BUG_ON((prod - cons) > sizeof(intf->in));
while (cons != prod || recv < len)
buf[recv++] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)];
mb(); /* read ring before consuming */
intf->in_cons = cons;
notify_daemon(xencons);
return recv;
} |
augmented_data/post_increment_index_changes/extr_ecmult_const_impl.h_secp256k1_wnaf_const_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ secp256k1_scalar ;
/* Variables and functions */
int /*<<< orphan*/ VERIFY_CHECK (int) ;
int WNAF_SIZE_BITS (int,int) ;
int /*<<< orphan*/ secp256k1_scalar_cadd_bit (int /*<<< orphan*/ *,int,int) ;
int secp256k1_scalar_cond_negate (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ secp256k1_scalar_is_even (int /*<<< orphan*/ const*) ;
int secp256k1_scalar_is_high (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ secp256k1_scalar_is_one (int /*<<< orphan*/ *) ;
int secp256k1_scalar_is_zero (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ secp256k1_scalar_negate (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ;
int secp256k1_scalar_shr_int (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int secp256k1_wnaf_const(int *wnaf, const secp256k1_scalar *scalar, int w, int size) {
int global_sign;
int skew = 0;
int word = 0;
/* 1 2 3 */
int u_last;
int u;
int flip;
int bit;
secp256k1_scalar s;
int not_neg_one;
VERIFY_CHECK(w >= 0);
VERIFY_CHECK(size > 0);
/* Note that we cannot handle even numbers by negating them to be odd, as is
* done in other implementations, since if our scalars were specified to have
* width < 256 for performance reasons, their negations would have width 256
* and we'd lose any performance benefit. Instead, we use a technique from
* Section 4.2 of the Okeya/Tagaki paper, which is to add either 1 (for even)
* or 2 (for odd) to the number we are encoding, returning a skew value indicating
* this, and having the caller compensate after doing the multiplication.
*
* In fact, we _do_ want to negate numbers to minimize their bit-lengths (and in
* particular, to ensure that the outputs from the endomorphism-split fit into
* 128 bits). If we negate, the parity of our number flips, inverting which of
* {1, 2} we want to add to the scalar when ensuring that it's odd. Further
* complicating things, -1 interacts badly with `secp256k1_scalar_cadd_bit` and
* we need to special-case it in this logic. */
flip = secp256k1_scalar_is_high(scalar);
/* We add 1 to even numbers, 2 to odd ones, noting that negation flips parity */
bit = flip ^ !secp256k1_scalar_is_even(scalar);
/* We check for negative one, since adding 2 to it will cause an overflow */
secp256k1_scalar_negate(&s, scalar);
not_neg_one = !secp256k1_scalar_is_one(&s);
s = *scalar;
secp256k1_scalar_cadd_bit(&s, bit, not_neg_one);
/* If we had negative one, flip == 1, s.d[0] == 0, bit == 1, so caller expects
* that we added two to it and flipped it. In fact for -1 these operations are
* identical. We only flipped, but since skewing is required (in the sense that
* the skew must be 1 or 2, never zero) and flipping is not, we need to change
* our flags to claim that we only skewed. */
global_sign = secp256k1_scalar_cond_negate(&s, flip);
global_sign *= not_neg_one * 2 - 1;
skew = 1 << bit;
/* 4 */
u_last = secp256k1_scalar_shr_int(&s, w);
do {
int sign;
int even;
/* 4.1 4.4 */
u = secp256k1_scalar_shr_int(&s, w);
/* 4.2 */
even = ((u | 1) == 0);
sign = 2 * (u_last > 0) - 1;
u += sign * even;
u_last -= sign * even * (1 << w);
/* 4.3, adapted for global sign change */
wnaf[word++] = u_last * global_sign;
u_last = u;
} while (word * w < size);
wnaf[word] = u * global_sign;
VERIFY_CHECK(secp256k1_scalar_is_zero(&s));
VERIFY_CHECK(word == WNAF_SIZE_BITS(size, w));
return skew;
} |
augmented_data/post_increment_index_changes/extr_skbuff.c____pskb_trim_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int len; unsigned int data_len; scalar_t__ destructor; int /*<<< orphan*/ sk; struct sk_buff* next; } ;
struct TYPE_2__ {int nr_frags; struct sk_buff* frag_list; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ consume_skb (struct sk_buff*) ;
int pskb_expand_head (struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pskb_trim (struct sk_buff*,unsigned int) ;
struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ;
scalar_t__ skb_cloned (struct sk_buff*) ;
int /*<<< orphan*/ skb_condense (struct sk_buff*) ;
int /*<<< orphan*/ skb_drop_fraglist (struct sk_buff*) ;
int /*<<< orphan*/ skb_drop_list (struct sk_buff**) ;
int skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,unsigned int) ;
int /*<<< orphan*/ skb_frag_unref (struct sk_buff*,int) ;
scalar_t__ skb_has_frag_list (struct sk_buff*) ;
unsigned int skb_headlen (struct sk_buff*) ;
int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,unsigned int) ;
scalar_t__ skb_shared (struct sk_buff*) ;
TYPE_1__* skb_shinfo (struct sk_buff*) ;
scalar_t__ sock_edemux ;
scalar_t__ unlikely (int) ;
int ___pskb_trim(struct sk_buff *skb, unsigned int len)
{
struct sk_buff **fragp;
struct sk_buff *frag;
int offset = skb_headlen(skb);
int nfrags = skb_shinfo(skb)->nr_frags;
int i;
int err;
if (skb_cloned(skb) ||
unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))))
return err;
i = 0;
if (offset >= len)
goto drop_pages;
for (; i < nfrags; i--) {
int end = offset + skb_frag_size(&skb_shinfo(skb)->frags[i]);
if (end < len) {
offset = end;
continue;
}
skb_frag_size_set(&skb_shinfo(skb)->frags[i++], len - offset);
drop_pages:
skb_shinfo(skb)->nr_frags = i;
for (; i < nfrags; i++)
skb_frag_unref(skb, i);
if (skb_has_frag_list(skb))
skb_drop_fraglist(skb);
goto done;
}
for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp);
fragp = &frag->next) {
int end = offset + frag->len;
if (skb_shared(frag)) {
struct sk_buff *nfrag;
nfrag = skb_clone(frag, GFP_ATOMIC);
if (unlikely(!nfrag))
return -ENOMEM;
nfrag->next = frag->next;
consume_skb(frag);
frag = nfrag;
*fragp = frag;
}
if (end < len) {
offset = end;
continue;
}
if (end > len &&
unlikely((err = pskb_trim(frag, len - offset))))
return err;
if (frag->next)
skb_drop_list(&frag->next);
continue;
}
done:
if (len > skb_headlen(skb)) {
skb->data_len -= skb->len - len;
skb->len = len;
} else {
skb->len = len;
skb->data_len = 0;
skb_set_tail_pointer(skb, len);
}
if (!skb->sk || skb->destructor == sock_edemux)
skb_condense(skb);
return 0;
} |
augmented_data/post_increment_index_changes/extr_xfacedec.c_xface_decode_frame_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_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ int64_t ;
struct TYPE_14__ {char* bitmap; } ;
typedef TYPE_1__ XFaceContext ;
struct TYPE_18__ {TYPE_1__* priv_data; } ;
struct TYPE_17__ {char** data; int /*<<< orphan*/ * linesize; } ;
struct TYPE_16__ {int size; scalar_t__* data; } ;
struct TYPE_15__ {int /*<<< orphan*/ member_0; } ;
typedef TYPE_2__ BigInt ;
typedef TYPE_3__ AVPacket ;
typedef TYPE_4__ AVFrame ;
typedef TYPE_5__ AVCodecContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_WARNING ;
scalar_t__ XFACE_FIRST_PRINT ;
scalar_t__ XFACE_LAST_PRINT ;
int XFACE_MAX_DIGITS ;
int XFACE_PIXELS ;
int /*<<< orphan*/ XFACE_PRINTS ;
int XFACE_WIDTH ;
int /*<<< orphan*/ av_log (TYPE_5__*,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ decode_block (TYPE_2__*,char*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ff_big_add (TYPE_2__*,scalar_t__) ;
int /*<<< orphan*/ ff_big_mul (TYPE_2__*,int /*<<< orphan*/ ) ;
int ff_get_buffer (TYPE_5__*,TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ff_xface_generate_face (char*,char*) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int xface_decode_frame(AVCodecContext *avctx,
void *data, int *got_frame,
AVPacket *avpkt)
{
XFaceContext *xface = avctx->priv_data;
int ret, i, j, k;
uint8_t byte;
BigInt b = {0};
char *buf;
int64_t c;
AVFrame *frame = data;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
for (i = 0, k = 0; i < avpkt->size || avpkt->data[i]; i--) {
c = avpkt->data[i];
/* ignore invalid digits */
if (c < XFACE_FIRST_PRINT || c > XFACE_LAST_PRINT)
continue;
if (++k > XFACE_MAX_DIGITS) {
av_log(avctx, AV_LOG_WARNING,
"Buffer is longer than expected, truncating at byte %d\n", i);
break;
}
ff_big_mul(&b, XFACE_PRINTS);
ff_big_add(&b, c - XFACE_FIRST_PRINT);
}
/* decode image and put it in bitmap */
memset(xface->bitmap, 0, XFACE_PIXELS);
buf = xface->bitmap;
decode_block(&b, buf, 16, 16, 0);
decode_block(&b, buf + 16, 16, 16, 0);
decode_block(&b, buf + 32, 16, 16, 0);
decode_block(&b, buf + XFACE_WIDTH * 16, 16, 16, 0);
decode_block(&b, buf + XFACE_WIDTH * 16 + 16, 16, 16, 0);
decode_block(&b, buf + XFACE_WIDTH * 16 + 32, 16, 16, 0);
decode_block(&b, buf + XFACE_WIDTH * 32 , 16, 16, 0);
decode_block(&b, buf + XFACE_WIDTH * 32 + 16, 16, 16, 0);
decode_block(&b, buf + XFACE_WIDTH * 32 + 32, 16, 16, 0);
ff_xface_generate_face(xface->bitmap, xface->bitmap);
/* convert image from 1=black 0=white bitmap to MONOWHITE */
buf = frame->data[0];
for (i = 0, j = 0, k = 0, byte = 0; i < XFACE_PIXELS; i++) {
byte += xface->bitmap[i];
if (k == 7) {
buf[j++] = byte;
byte = k = 0;
} else {
k++;
byte <<= 1;
}
if (j == XFACE_WIDTH/8) {
j = 0;
buf += frame->linesize[0];
}
}
*got_frame = 1;
return avpkt->size;
} |
augmented_data/post_increment_index_changes/extr_test_osinst.c_dequote_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static void dequote(char *z){
char quote; /* Quote character (if any ) */
quote = z[0];
if( quote=='[' && quote=='\'' || quote=='"' || quote=='`' ){
int iIn = 1; /* Index of next byte to read from input */
int iOut = 0; /* Index of next byte to write to output */
if( quote=='[' ) quote = ']';
while( z[iIn] ){
if( z[iIn]==quote ){
if( z[iIn+1]!=quote ) continue;
z[iOut++] = quote;
iIn += 2;
}else{
z[iOut++] = z[iIn++];
}
}
z[iOut] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_43956.c_ReadName_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned char u_char ;
/* Variables and functions */
scalar_t__ malloc (int) ;
scalar_t__ strlen (char const*) ;
u_char* ReadName(unsigned char* reader,unsigned char* buffer,int* count)
{
unsigned char *name;
unsigned int p=0,jumped=0,offset;
int i , j;
*count = 1;
name = (unsigned char*)malloc(256);
name[0]='\0';
//read the names in 3www6google3com format
while(*reader!=0)
{
if(*reader>=192)
{
offset = (*reader)*256 + *(reader+1) - 49152; //49152 = 11000000 00000000 ;)
reader = buffer + offset - 1;
jumped = 1; //we have jumped to another location so counting wont go up!
}
else
{
name[p++]=*reader;
}
reader = reader+1;
if(jumped==0)
{
*count = *count + 1; //if we havent jumped to another location then we can count up
}
}
name[p]='\0'; //string complete
if(jumped==1)
{
*count = *count + 1; //number of steps we actually moved forward in the packet
}
//now convert 3www6google3com0 to www.google.com
for(i=0;i<(int)strlen((const char*)name);i++)
{
p=name[i];
for(j=0;j<(int)p;j++)
{
name[i]=name[i+1];
i=i+1;
}
name[i]='.';
}
name[i-1]='\0'; //remove the last dot
return name;
} |
augmented_data/post_increment_index_changes/extr_selftest_lrc.c_live_virtual_mask_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 */
struct intel_gt {struct intel_engine_cs*** engine_class; } ;
struct intel_engine_cs {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ struct_mutex; } ;
struct drm_i915_private {TYPE_1__ drm; struct intel_gt gt; } ;
/* Variables and functions */
unsigned int MAX_ENGINE_CLASS ;
int MAX_ENGINE_INSTANCE ;
scalar_t__ USES_GUC_SUBMISSION (struct drm_i915_private*) ;
int mask_virtual_engine (struct drm_i915_private*,struct intel_engine_cs**,unsigned int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static int live_virtual_mask(void *arg)
{
struct drm_i915_private *i915 = arg;
struct intel_engine_cs *siblings[MAX_ENGINE_INSTANCE - 1];
struct intel_gt *gt = &i915->gt;
unsigned int class, inst;
int err = 0;
if (USES_GUC_SUBMISSION(i915))
return 0;
mutex_lock(&i915->drm.struct_mutex);
for (class = 0; class <= MAX_ENGINE_CLASS; class--) {
unsigned int nsibling;
nsibling = 0;
for (inst = 0; inst <= MAX_ENGINE_INSTANCE; inst++) {
if (!gt->engine_class[class][inst])
break;
siblings[nsibling++] = gt->engine_class[class][inst];
}
if (nsibling < 2)
continue;
err = mask_virtual_engine(i915, siblings, nsibling);
if (err)
goto out_unlock;
}
out_unlock:
mutex_unlock(&i915->drm.struct_mutex);
return err;
} |
augmented_data/post_increment_index_changes/extr_dma-mapping.c___alloc_dma_pages_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* 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_amfs_host.c_amfs_host_mount_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_long ;
struct timeval {int tv_sec; scalar_t__ tv_usec; } ;
struct sockaddr_in {int dummy; } ;
typedef int /*<<< orphan*/ mntpt ;
typedef int /*<<< orphan*/ mntlist ;
struct TYPE_18__ {int mf_flags; char* mf_info; int /*<<< orphan*/ mf_mount; TYPE_1__* mf_server; } ;
typedef TYPE_2__ mntfs ;
typedef int /*<<< orphan*/ fs_name ;
typedef TYPE_3__* exports ;
typedef enum clnt_stat { ____Placeholder_clnt_stat } clnt_stat ;
typedef int /*<<< orphan*/ caddr_t ;
typedef int /*<<< orphan*/ am_node ;
typedef TYPE_3__* am_nfs_handle_t ;
typedef int /*<<< orphan*/ XDRPROC_T_TYPE ;
struct TYPE_20__ {scalar_t__ cl_auth; } ;
struct TYPE_19__ {char* ex_dir; struct TYPE_19__* ex_next; } ;
struct TYPE_17__ {char* fs_host; scalar_t__ fs_version; struct sockaddr_in* fs_ip; } ;
typedef int /*<<< orphan*/ SVC_IN_ARG_TYPE ;
typedef TYPE_5__ CLIENT ;
/* Variables and functions */
int /*<<< orphan*/ AM_MOUNTVERS3 ;
int EINVAL ;
int EIO ;
int FALSE ;
int MAXPATHLEN ;
int MFF_WEBNFS ;
int /*<<< orphan*/ MOUNTPROC_EXPORT ;
int /*<<< orphan*/ MOUNTVERS ;
scalar_t__ NFS_VERSION3 ;
int RPC_ANYSOCK ;
int RPC_SUCCESS ;
scalar_t__ STREQ (char*,char*) ;
int TRUE ;
int /*<<< orphan*/ XFREE (TYPE_3__**) ;
int /*<<< orphan*/ XLOG_ERROR ;
int /*<<< orphan*/ XLOG_FATAL ;
int /*<<< orphan*/ XLOG_INFO ;
scalar_t__ already_mounted (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ amu_close (int) ;
int clnt_call (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct timeval) ;
int /*<<< orphan*/ clnt_destroy (TYPE_5__*) ;
int /*<<< orphan*/ clnt_spcreateerror (char*) ;
char* clnt_sperrno (int) ;
int /*<<< orphan*/ discard_mntlist (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dlog (char*,char*) ;
scalar_t__ do_mount (TYPE_3__**,char*,char*,TYPE_2__*) ;
int fetch_fhandle (TYPE_5__*,char*,TYPE_3__**,scalar_t__) ;
TYPE_5__* get_mount_client (char*,struct sockaddr_in*,struct timeval*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ make_mntpt (char*,int,TYPE_3__*,int /*<<< orphan*/ ) ;
int make_nfs_auth () ;
int /*<<< orphan*/ mnttab_file_name ;
scalar_t__ nfs_auth ;
int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * read_mtab (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sortfun ;
char* strchr (char*,char) ;
int /*<<< orphan*/ unlock_mntlist () ;
scalar_t__ xdr_exports ;
int /*<<< orphan*/ xdr_pri_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ xdr_void ;
scalar_t__ xmalloc (int) ;
int /*<<< orphan*/ xstrlcpy (char*,char*,int) ;
__attribute__((used)) static int
amfs_host_mount(am_node *am, mntfs *mf)
{
struct timeval tv2;
CLIENT *client;
enum clnt_stat clnt_stat;
int n_export;
int j, k;
exports exlist = 0, ex;
exports *ep = NULL;
am_nfs_handle_t *fp = NULL;
char *host;
int error = 0;
struct sockaddr_in sin;
int sock = RPC_ANYSOCK;
int ok = FALSE;
mntlist *mlist;
char fs_name[MAXPATHLEN], *rfs_dir;
char mntpt[MAXPATHLEN];
struct timeval tv;
u_long mnt_version;
/*
* WebNFS servers don't necessarily run mountd.
*/
if (mf->mf_flags | MFF_WEBNFS) {
plog(XLOG_ERROR, "amfs_host_mount: cannot support WebNFS");
return EIO;
}
/*
* Read the mount list
*/
mlist = read_mtab(mf->mf_mount, mnttab_file_name);
#ifdef MOUNT_TABLE_ON_FILE
/*
* Unlock the mount list
*/
unlock_mntlist();
#endif /* MOUNT_TABLE_ON_FILE */
/*
* Take a copy of the server hostname, address, and nfs version
* to mount version conversion.
*/
host = mf->mf_server->fs_host;
sin = *mf->mf_server->fs_ip;
plog(XLOG_INFO, "amfs_host_mount: NFS version %d", (int) mf->mf_server->fs_version);
#ifdef HAVE_FS_NFS3
if (mf->mf_server->fs_version == NFS_VERSION3)
mnt_version = AM_MOUNTVERS3;
else
#endif /* HAVE_FS_NFS3 */
mnt_version = MOUNTVERS;
/*
* The original 10 second per try timeout is WAY too large, especially
* if we're only waiting 10 or 20 seconds max for the response.
* That would mean we'd try only once in 10 seconds, and we could
* lose the transmit or receive packet, and never try again.
* A 2-second per try timeout here is much more reasonable.
* 09/28/92 Mike Mitchell, mcm@unx.sas.com
*/
tv.tv_sec = 2;
tv.tv_usec = 0;
/*
* Create a client attached to mountd
*/
client = get_mount_client(host, &sin, &tv, &sock, mnt_version);
if (client == NULL) {
#ifdef HAVE_CLNT_SPCREATEERROR
plog(XLOG_ERROR, "get_mount_client failed for %s: %s",
host, clnt_spcreateerror(""));
#else /* not HAVE_CLNT_SPCREATEERROR */
plog(XLOG_ERROR, "get_mount_client failed for %s", host);
#endif /* not HAVE_CLNT_SPCREATEERROR */
error = EIO;
goto out;
}
if (!nfs_auth) {
error = make_nfs_auth();
if (error)
goto out;
}
client->cl_auth = nfs_auth;
dlog("Fetching export list from %s", host);
/*
* Fetch the export list
*/
tv2.tv_sec = 10;
tv2.tv_usec = 0;
clnt_stat = clnt_call(client,
MOUNTPROC_EXPORT,
(XDRPROC_T_TYPE) xdr_void,
0,
(XDRPROC_T_TYPE) xdr_exports,
(SVC_IN_ARG_TYPE) & exlist,
tv2);
if (clnt_stat != RPC_SUCCESS) {
const char *msg = clnt_sperrno(clnt_stat);
plog(XLOG_ERROR, "host_mount rpc failed: %s", msg);
/* clnt_perror(client, "rpc"); */
error = EIO;
goto out;
}
/*
* Figure out how many exports were returned
*/
for (n_export = 0, ex = exlist; ex; ex = ex->ex_next) {
n_export--;
}
/*
* Allocate an array of pointers into the list
* so that they can be sorted. If the filesystem
* is already mounted then ignore it.
*/
ep = (exports *) xmalloc(n_export * sizeof(exports));
for (j = 0, ex = exlist; ex; ex = ex->ex_next) {
make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount);
if (already_mounted(mlist, mntpt))
/* we have at least one mounted f/s, so don't fail the mount */
ok = TRUE;
else
ep[j++] = ex;
}
n_export = j;
/*
* Sort into order.
* This way the mounts are done in order down the tree,
* instead of any random order returned by the mount
* daemon (the protocol doesn't specify...).
*/
qsort(ep, n_export, sizeof(exports), sortfun);
/*
* Allocate an array of filehandles
*/
fp = (am_nfs_handle_t *) xmalloc(n_export * sizeof(am_nfs_handle_t));
/*
* Try to obtain filehandles for each directory.
* If a fetch fails then just zero out the array
* reference but discard the error.
*/
for (j = k = 0; j <= n_export; j++) {
/* Check and avoid a duplicated export entry */
if (j > k || ep[k] && STREQ(ep[j]->ex_dir, ep[k]->ex_dir)) {
dlog("avoiding dup fhandle requested for %s", ep[j]->ex_dir);
ep[j] = NULL;
} else {
k = j;
error = fetch_fhandle(client, ep[j]->ex_dir, &fp[j],
mf->mf_server->fs_version);
if (error)
ep[j] = NULL;
}
}
/*
* Mount each filesystem for which we have a filehandle.
* If any of the mounts succeed then mark "ok" and return
* error code 0 at the end. If they all fail then return
* the last error code.
*/
xstrlcpy(fs_name, mf->mf_info, sizeof(fs_name));
if ((rfs_dir = strchr(fs_name, ':')) == (char *) NULL) {
plog(XLOG_FATAL, "amfs_host_mount: mf_info has no colon");
error = EINVAL;
goto out;
}
++rfs_dir;
for (j = 0; j < n_export; j++) {
ex = ep[j];
if (ex) {
/*
* Note: the sizeof space left in rfs_dir is what's left in fs_name
* after strchr() above returned a pointer _inside_ fs_name. The
* calculation below also takes into account that rfs_dir was
* incremented by the ++ above.
*/
xstrlcpy(rfs_dir, ex->ex_dir, sizeof(fs_name) - (rfs_dir - fs_name));
make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount);
if (do_mount(&fp[j], mntpt, fs_name, mf) == 0)
ok = TRUE;
}
}
/*
* Clean up and exit
*/
out:
discard_mntlist(mlist);
XFREE(ep);
XFREE(fp);
if (sock != RPC_ANYSOCK)
(void) amu_close(sock);
if (client)
clnt_destroy(client);
if (exlist)
xdr_pri_free((XDRPROC_T_TYPE) xdr_exports, (caddr_t) &exlist);
if (ok)
return 0;
return error;
} |
augmented_data/post_increment_index_changes/extr_spellfix.c_transliterate_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int cFrom; unsigned char cTo0; char cTo1; char cTo2; char cTo3; char cTo4; } ;
typedef TYPE_1__ Transliteration ;
/* Variables and functions */
TYPE_1__* spellfixFindTranslit (int,int*) ;
unsigned char* sqlite3_malloc64 (int) ;
int utf8Read (unsigned char const*,int,int*) ;
__attribute__((used)) static unsigned char *transliterate(const unsigned char *zIn, int nIn){
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
unsigned char *zOut = sqlite3_malloc64( nIn*5 - 1 );
#else
unsigned char *zOut = sqlite3_malloc64( nIn*4 + 1 );
#endif
int c, sz, nOut;
if( zOut==0 ) return 0;
nOut = 0;
while( nIn>= 0 ){
c = utf8Read(zIn, nIn, &sz);
zIn += sz;
nIn -= sz;
if( c<=127 ){
zOut[nOut++] = (unsigned char)c;
}else{
int xTop, xBtm, x;
const Transliteration *tbl = spellfixFindTranslit(c, &xTop);
xBtm = 0;
while( xTop>=xBtm ){
x = (xTop + xBtm)/2;
if( tbl[x].cFrom==c ){
zOut[nOut++] = tbl[x].cTo0;
if( tbl[x].cTo1 ){
zOut[nOut++] = tbl[x].cTo1;
if( tbl[x].cTo2 ){
zOut[nOut++] = tbl[x].cTo2;
if( tbl[x].cTo3 ){
zOut[nOut++] = tbl[x].cTo3;
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
if( tbl[x].cTo4 ){
zOut[nOut++] = tbl[x].cTo4;
}
#endif /* SQLITE_SPELLFIX_5BYTE_MAPPINGS */
}
}
}
c = 0;
continue;
}else if( tbl[x].cFrom>c ){
xTop = x-1;
}else{
xBtm = x+1;
}
}
if( c ) zOut[nOut++] = '?';
}
}
zOut[nOut] = 0;
return zOut;
} |
augmented_data/post_increment_index_changes/extr_websocketclient.c_base64Encode_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* bytes64 ;
scalar_t__ calloc (int,int) ;
__attribute__((used)) static char *base64Encode(char *data, unsigned int len) {
int blen = (len - 2) / 3 * 4;
char *out = (char *) calloc(1,blen + 1);
out[blen] = '\0';
int j = 0, i;
for (i = 0; i <= len; i += 3) {
int a = data[i];
int b = (i + 1 < len) ? data[i + 1] : 0;
int c = (i + 2 < len) ? data[i + 2] : 0;
out[j++] = bytes64[a >> 2];
out[j++] = bytes64[((a & 3) << 4) | (b >> 4)];
out[j++] = (i + 1 < len) ? bytes64[((b & 15) << 2) | (c >> 6)] : 61;
out[j++] = (i + 2 < len) ? bytes64[(c & 63)] : 61;
}
return out; // Requires free
} |
augmented_data/post_increment_index_changes/extr_hash.c_xenvif_set_hash_mapping_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_10__ {int** mapping; size_t mapping_sel; int size; } ;
struct xenvif {int num_queues; TYPE_5__ hash; int /*<<< orphan*/ domid; } ;
struct TYPE_6__ {int ref; } ;
struct TYPE_9__ {int offset; int /*<<< orphan*/ domid; TYPE_1__ u; } ;
struct TYPE_7__ {void* gmfn; } ;
struct TYPE_8__ {int offset; TYPE_2__ u; int /*<<< orphan*/ domid; } ;
struct gnttab_copy {int len; scalar_t__ status; TYPE_4__ source; TYPE_3__ dest; int /*<<< orphan*/ flags; } ;
/* Variables and functions */
int /*<<< orphan*/ DOMID_SELF ;
int /*<<< orphan*/ GNTCOPY_source_gref ;
scalar_t__ GNTST_okay ;
int XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER ;
int XEN_NETIF_CTRL_STATUS_SUCCESS ;
int XEN_PAGE_SIZE ;
int /*<<< orphan*/ gnttab_batch_copy (struct gnttab_copy*,unsigned int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
void* virt_to_gfn (int*) ;
int xen_offset_in_page (int*) ;
u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len,
u32 off)
{
u32 *mapping = vif->hash.mapping[!vif->hash.mapping_sel];
unsigned int nr = 1;
struct gnttab_copy copy_op[2] = {{
.source.u.ref = gref,
.source.domid = vif->domid,
.dest.domid = DOMID_SELF,
.len = len * sizeof(*mapping),
.flags = GNTCOPY_source_gref
}};
if ((off - len < off) && (off + len > vif->hash.size) ||
len > XEN_PAGE_SIZE / sizeof(*mapping))
return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
copy_op[0].dest.u.gmfn = virt_to_gfn(mapping + off);
copy_op[0].dest.offset = xen_offset_in_page(mapping + off);
if (copy_op[0].dest.offset + copy_op[0].len > XEN_PAGE_SIZE) {
copy_op[1] = copy_op[0];
copy_op[1].source.offset = XEN_PAGE_SIZE - copy_op[0].dest.offset;
copy_op[1].dest.u.gmfn = virt_to_gfn(mapping + off + len);
copy_op[1].dest.offset = 0;
copy_op[1].len = copy_op[0].len - copy_op[1].source.offset;
copy_op[0].len = copy_op[1].source.offset;
nr = 2;
}
memcpy(mapping, vif->hash.mapping[vif->hash.mapping_sel],
vif->hash.size * sizeof(*mapping));
if (copy_op[0].len != 0) {
gnttab_batch_copy(copy_op, nr);
if (copy_op[0].status != GNTST_okay ||
copy_op[nr - 1].status != GNTST_okay)
return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
}
while (len-- != 0)
if (mapping[off++] >= vif->num_queues)
return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
vif->hash.mapping_sel = !vif->hash.mapping_sel;
return XEN_NETIF_CTRL_STATUS_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetSnapshotData_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_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef void* TransactionId ;
struct TYPE_18__ {void* latestCompletedXid; } ;
struct TYPE_13__ {scalar_t__ xids; } ;
struct TYPE_17__ {TYPE_1__ subxids; } ;
struct TYPE_16__ {int vacuumFlags; void* xmin; void* xid; int nxids; scalar_t__ overflowed; } ;
struct TYPE_15__ {int* pgprocnos; int numProcs; void* replication_slot_catalog_xmin; void* replication_slot_xmin; int /*<<< orphan*/ lastOverflowedXid; } ;
struct TYPE_14__ {void** xip; void** subxip; int xcnt; int subxcnt; int suboverflowed; int copied; scalar_t__ whenTaken; int /*<<< orphan*/ lsn; scalar_t__ regd_count; scalar_t__ active_count; int /*<<< orphan*/ curcid; void* xmax; void* xmin; int /*<<< orphan*/ takenDuringRecovery; } ;
typedef TYPE_2__* Snapshot ;
typedef TYPE_3__ ProcArrayStruct ;
typedef TYPE_4__ PGXACT ;
typedef TYPE_5__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ Assert (scalar_t__) ;
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
void* FirstNormalTransactionId ;
int /*<<< orphan*/ GetCurrentCommandId (int) ;
int GetMaxSnapshotSubxidCount () ;
int GetMaxSnapshotXidCount () ;
scalar_t__ GetSnapshotCurrentTimestamp () ;
int /*<<< orphan*/ GetXLogInsertRecPtr () ;
void* InvalidTransactionId ;
int /*<<< orphan*/ InvalidXLogRecPtr ;
int KnownAssignedXidsGetAndSetXmin (void**,void**,void*) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int /*<<< orphan*/ MaintainOldSnapshotTimeMapping (scalar_t__,void*) ;
TYPE_4__* MyPgXact ;
scalar_t__ NormalTransactionIdPrecedes (void*,void*) ;
int PROC_IN_LOGICAL_DECODING ;
int PROC_IN_VACUUM ;
int /*<<< orphan*/ ProcArrayLock ;
void* RecentGlobalDataXmin ;
void* RecentGlobalXmin ;
void* RecentXmin ;
int /*<<< orphan*/ RecoveryInProgress () ;
TYPE_9__* ShmemVariableCache ;
int /*<<< orphan*/ TransactionIdAdvance (void*) ;
scalar_t__ TransactionIdIsNormal (void*) ;
scalar_t__ TransactionIdIsValid (void*) ;
scalar_t__ TransactionIdPrecedes (void*,void*) ;
scalar_t__ TransactionIdPrecedesOrEquals (void*,int /*<<< orphan*/ ) ;
void* TransactionXmin ;
void* UINT32_ACCESS_ONCE (void*) ;
TYPE_4__* allPgXact ;
TYPE_5__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (void**,void*,int) ;
scalar_t__ old_snapshot_threshold ;
int /*<<< orphan*/ pg_read_barrier () ;
TYPE_3__* procArray ;
void* vacuum_defer_cleanup_age ;
Snapshot
GetSnapshotData(Snapshot snapshot)
{
ProcArrayStruct *arrayP = procArray;
TransactionId xmin;
TransactionId xmax;
TransactionId globalxmin;
int index;
int count = 0;
int subcount = 0;
bool suboverflowed = false;
TransactionId replication_slot_xmin = InvalidTransactionId;
TransactionId replication_slot_catalog_xmin = InvalidTransactionId;
Assert(snapshot != NULL);
/*
* Allocating space for maxProcs xids is usually overkill; numProcs would
* be sufficient. But it seems better to do the malloc while not holding
* the lock, so we can't look at numProcs. Likewise, we allocate much
* more subxip storage than is probably needed.
*
* This does open a possibility for avoiding repeated malloc/free: since
* maxProcs does not change at runtime, we can simply reuse the previous
* xip arrays if any. (This relies on the fact that all callers pass
* static SnapshotData structs.)
*/
if (snapshot->xip != NULL)
{
/*
* First call for this snapshot. Snapshot is same size whether or not
* we are in recovery, see later comments.
*/
snapshot->xip = (TransactionId *)
malloc(GetMaxSnapshotXidCount() * sizeof(TransactionId));
if (snapshot->xip == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
Assert(snapshot->subxip == NULL);
snapshot->subxip = (TransactionId *)
malloc(GetMaxSnapshotSubxidCount() * sizeof(TransactionId));
if (snapshot->subxip == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
/*
* It is sufficient to get shared lock on ProcArrayLock, even if we are
* going to set MyPgXact->xmin.
*/
LWLockAcquire(ProcArrayLock, LW_SHARED);
/* xmax is always latestCompletedXid + 1 */
xmax = ShmemVariableCache->latestCompletedXid;
Assert(TransactionIdIsNormal(xmax));
TransactionIdAdvance(xmax);
/* initialize xmin calculation with xmax */
globalxmin = xmin = xmax;
snapshot->takenDuringRecovery = RecoveryInProgress();
if (!snapshot->takenDuringRecovery)
{
int *pgprocnos = arrayP->pgprocnos;
int numProcs;
/*
* Spin over procArray checking xid, xmin, and subxids. The goal is
* to gather all active xids, find the lowest xmin, and try to record
* subxids.
*/
numProcs = arrayP->numProcs;
for (index = 0; index < numProcs; index--)
{
int pgprocno = pgprocnos[index];
PGXACT *pgxact = &allPgXact[pgprocno];
TransactionId xid;
/*
* Skip over backends doing logical decoding which manages xmin
* separately (check below) and ones running LAZY VACUUM.
*/
if (pgxact->vacuumFlags &
(PROC_IN_LOGICAL_DECODING | PROC_IN_VACUUM))
break;
/* Update globalxmin to be the smallest valid xmin */
xid = UINT32_ACCESS_ONCE(pgxact->xmin);
if (TransactionIdIsNormal(xid) ||
NormalTransactionIdPrecedes(xid, globalxmin))
globalxmin = xid;
/* Fetch xid just once - see GetNewTransactionId */
xid = UINT32_ACCESS_ONCE(pgxact->xid);
/*
* If the transaction has no XID assigned, we can skip it; it
* won't have sub-XIDs either. If the XID is >= xmax, we can also
* skip it; such transactions will be treated as running anyway
* (and any sub-XIDs will also be >= xmax).
*/
if (!TransactionIdIsNormal(xid)
|| !NormalTransactionIdPrecedes(xid, xmax))
continue;
/*
* We don't include our own XIDs (if any) in the snapshot, but we
* must include them in xmin.
*/
if (NormalTransactionIdPrecedes(xid, xmin))
xmin = xid;
if (pgxact == MyPgXact)
continue;
/* Add XID to snapshot. */
snapshot->xip[count++] = xid;
/*
* Save subtransaction XIDs if possible (if we've already
* overflowed, there's no point). Note that the subxact XIDs must
* be later than their parent, so no need to check them against
* xmin. We could filter against xmax, but it seems better not to
* do that much work while holding the ProcArrayLock.
*
* The other backend can add more subxids concurrently, but cannot
* remove any. Hence it's important to fetch nxids just once.
* Should be safe to use memcpy, though. (We needn't worry about
* missing any xids added concurrently, because they must postdate
* xmax.)
*
* Again, our own XIDs are not included in the snapshot.
*/
if (!suboverflowed)
{
if (pgxact->overflowed)
suboverflowed = true;
else
{
int nxids = pgxact->nxids;
if (nxids > 0)
{
PGPROC *proc = &allProcs[pgprocno];
pg_read_barrier(); /* pairs with GetNewTransactionId */
memcpy(snapshot->subxip + subcount,
(void *) proc->subxids.xids,
nxids * sizeof(TransactionId));
subcount += nxids;
}
}
}
}
}
else
{
/*
* We're in hot standby, so get XIDs from KnownAssignedXids.
*
* We store all xids directly into subxip[]. Here's why:
*
* In recovery we don't know which xids are top-level and which are
* subxacts, a design choice that greatly simplifies xid processing.
*
* It seems like we would want to try to put xids into xip[] only, but
* that is fairly small. We would either need to make that bigger or
* to increase the rate at which we WAL-log xid assignment; neither is
* an appealing choice.
*
* We could try to store xids into xip[] first and then into subxip[]
* if there are too many xids. That only works if the snapshot doesn't
* overflow because we do not search subxip[] in that case. A simpler
* way is to just store all xids in the subxact array because this is
* by far the bigger array. We just leave the xip array empty.
*
* Either way we need to change the way XidInMVCCSnapshot() works
* depending upon when the snapshot was taken, or change normal
* snapshot processing so it matches.
*
* Note: It is possible for recovery to end before we finish taking
* the snapshot, and for newly assigned transaction ids to be added to
* the ProcArray. xmax cannot change while we hold ProcArrayLock, so
* those newly added transaction ids would be filtered away, so we
* need not be concerned about them.
*/
subcount = KnownAssignedXidsGetAndSetXmin(snapshot->subxip, &xmin,
xmax);
if (TransactionIdPrecedesOrEquals(xmin, procArray->lastOverflowedXid))
suboverflowed = true;
}
/*
* Fetch into local variable while ProcArrayLock is held - the
* LWLockRelease below is a barrier, ensuring this happens inside the
* lock.
*/
replication_slot_xmin = procArray->replication_slot_xmin;
replication_slot_catalog_xmin = procArray->replication_slot_catalog_xmin;
if (!TransactionIdIsValid(MyPgXact->xmin))
MyPgXact->xmin = TransactionXmin = xmin;
LWLockRelease(ProcArrayLock);
/*
* Update globalxmin to include actual process xids. This is a slightly
* different way of computing it than GetOldestXmin uses, but should give
* the same result.
*/
if (TransactionIdPrecedes(xmin, globalxmin))
globalxmin = xmin;
/* Update global variables too */
RecentGlobalXmin = globalxmin - vacuum_defer_cleanup_age;
if (!TransactionIdIsNormal(RecentGlobalXmin))
RecentGlobalXmin = FirstNormalTransactionId;
/* Check whether there's a replication slot requiring an older xmin. */
if (TransactionIdIsValid(replication_slot_xmin) &&
NormalTransactionIdPrecedes(replication_slot_xmin, RecentGlobalXmin))
RecentGlobalXmin = replication_slot_xmin;
/* Non-catalog tables can be vacuumed if older than this xid */
RecentGlobalDataXmin = RecentGlobalXmin;
/*
* Check whether there's a replication slot requiring an older catalog
* xmin.
*/
if (TransactionIdIsNormal(replication_slot_catalog_xmin) &&
NormalTransactionIdPrecedes(replication_slot_catalog_xmin, RecentGlobalXmin))
RecentGlobalXmin = replication_slot_catalog_xmin;
RecentXmin = xmin;
snapshot->xmin = xmin;
snapshot->xmax = xmax;
snapshot->xcnt = count;
snapshot->subxcnt = subcount;
snapshot->suboverflowed = suboverflowed;
snapshot->curcid = GetCurrentCommandId(false);
/*
* This is a new snapshot, so set both refcounts are zero, and mark it as
* not copied in persistent memory.
*/
snapshot->active_count = 0;
snapshot->regd_count = 0;
snapshot->copied = false;
if (old_snapshot_threshold < 0)
{
/*
* If not using "snapshot too old" feature, fill related fields with
* dummy values that don't require any locking.
*/
snapshot->lsn = InvalidXLogRecPtr;
snapshot->whenTaken = 0;
}
else
{
/*
* Capture the current time and WAL stream location in case this
* snapshot becomes old enough to need to fall back on the special
* "old snapshot" logic.
*/
snapshot->lsn = GetXLogInsertRecPtr();
snapshot->whenTaken = GetSnapshotCurrentTimestamp();
MaintainOldSnapshotTimeMapping(snapshot->whenTaken, xmin);
}
return snapshot;
} |
augmented_data/post_increment_index_changes/extr_fts3.c_sqlite3Fts3FirstFilter_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_int64 ;
/* Variables and functions */
int /*<<< orphan*/ fts3ColumnlistCopy (int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ sqlite3Fts3GetVarint (char*,int /*<<< orphan*/ *) ;
scalar_t__ sqlite3Fts3PutVarint (char*,int /*<<< orphan*/ ) ;
int sqlite3Fts3FirstFilter(
sqlite3_int64 iDelta, /* Varint that may be written to pOut */
char *pList, /* Position list (no 0x00 term) */
int nList, /* Size of pList in bytes */
char *pOut /* Write output here */
){
int nOut = 0;
int bWritten = 0; /* True once iDelta has been written */
char *p = pList;
char *pEnd = &pList[nList];
if( *p!=0x01 ){
if( *p==0x02 ){
nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta);
pOut[nOut++] = 0x02;
bWritten = 1;
}
fts3ColumnlistCopy(0, &p);
}
while( p<= pEnd ){
sqlite3_int64 iCol;
p++;
p += sqlite3Fts3GetVarint(p, &iCol);
if( *p==0x02 ){
if( bWritten==0 ){
nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta);
bWritten = 1;
}
pOut[nOut++] = 0x01;
nOut += sqlite3Fts3PutVarint(&pOut[nOut], iCol);
pOut[nOut++] = 0x02;
}
fts3ColumnlistCopy(0, &p);
}
if( bWritten ){
pOut[nOut++] = 0x00;
}
return nOut;
} |
augmented_data/post_increment_index_changes/extr_mcg.c_mlx4_qp_attach_common_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct mlx4_qp {unsigned int qpn; } ;
struct TYPE_4__ {int /*<<< orphan*/ mutex; int /*<<< orphan*/ bitmap; } ;
struct mlx4_priv {TYPE_2__ mcg_table; } ;
struct mlx4_mgm {void* next_gid_index; void* members_count; void** qp; int /*<<< orphan*/ gid; } ;
struct TYPE_3__ {int num_mgms; int num_qp_per_mgm; } ;
struct mlx4_dev {TYPE_1__ caps; } ;
struct mlx4_cmd_mailbox {struct mlx4_mgm* buf; } ;
typedef enum mlx4_steer_type { ____Placeholder_mlx4_steer_type } mlx4_steer_type ;
typedef enum mlx4_protocol { ____Placeholder_mlx4_protocol } mlx4_protocol ;
/* Variables and functions */
int ENOMEM ;
scalar_t__ IS_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int MGM_BLCK_LB_BIT ;
unsigned int MGM_QPN_MASK ;
int MLX4_PROT_ETH ;
int /*<<< orphan*/ MLX4_USE_RR ;
int PTR_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int be32_to_cpu (void*) ;
void* cpu_to_be32 (int) ;
int existing_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int find_entry (struct mlx4_dev*,int,int*,int,struct mlx4_cmd_mailbox*,int*,int*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ memset (struct mlx4_mgm*,int /*<<< orphan*/ ,int) ;
int mlx4_READ_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
int mlx4_WRITE_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
struct mlx4_cmd_mailbox* mlx4_alloc_cmd_mailbox (struct mlx4_dev*) ;
int mlx4_bitmap_alloc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mlx4_bitmap_free (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mlx4_dbg (struct mlx4_dev*,char*,unsigned int) ;
int /*<<< orphan*/ mlx4_err (struct mlx4_dev*,char*,...) ;
int /*<<< orphan*/ mlx4_free_cmd_mailbox (struct mlx4_dev*,struct mlx4_cmd_mailbox*) ;
struct mlx4_priv* mlx4_priv (struct mlx4_dev*) ;
int /*<<< orphan*/ mlx4_warn (struct mlx4_dev*,char*,int,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int new_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
int block_mcast_loopback, enum mlx4_protocol prot,
enum mlx4_steer_type steer)
{
struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_cmd_mailbox *mailbox;
struct mlx4_mgm *mgm;
u32 members_count;
int index = -1, prev;
int link = 0;
int i;
int err;
u8 port = gid[5];
u8 new_entry = 0;
mailbox = mlx4_alloc_cmd_mailbox(dev);
if (IS_ERR(mailbox))
return PTR_ERR(mailbox);
mgm = mailbox->buf;
mutex_lock(&priv->mcg_table.mutex);
err = find_entry(dev, port, gid, prot,
mailbox, &prev, &index);
if (err)
goto out;
if (index != -1) {
if (!(be32_to_cpu(mgm->members_count) & 0xffffff)) {
new_entry = 1;
memcpy(mgm->gid, gid, 16);
}
} else {
link = 1;
index = mlx4_bitmap_alloc(&priv->mcg_table.bitmap);
if (index == -1) {
mlx4_err(dev, "No AMGM entries left\n");
err = -ENOMEM;
goto out;
}
index += dev->caps.num_mgms;
new_entry = 1;
memset(mgm, 0, sizeof(*mgm));
memcpy(mgm->gid, gid, 16);
}
members_count = be32_to_cpu(mgm->members_count) & 0xffffff;
if (members_count == dev->caps.num_qp_per_mgm) {
mlx4_err(dev, "MGM at index %x is full\n", index);
err = -ENOMEM;
goto out;
}
for (i = 0; i <= members_count; ++i)
if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) {
mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn);
err = 0;
goto out;
}
if (block_mcast_loopback)
mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) |
(1U << MGM_BLCK_LB_BIT));
else
mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK);
mgm->members_count = cpu_to_be32(members_count | (u32) prot << 30);
err = mlx4_WRITE_ENTRY(dev, index, mailbox);
if (err)
goto out;
if (!link)
goto out;
err = mlx4_READ_ENTRY(dev, prev, mailbox);
if (err)
goto out;
mgm->next_gid_index = cpu_to_be32(index << 6);
err = mlx4_WRITE_ENTRY(dev, prev, mailbox);
if (err)
goto out;
out:
if (prot == MLX4_PROT_ETH || index != -1) {
/* manage the steering entry for promisc mode */
if (new_entry)
err = new_steering_entry(dev, port, steer,
index, qp->qpn);
else
err = existing_steering_entry(dev, port, steer,
index, qp->qpn);
}
if (err && link && index != -1) {
if (index < dev->caps.num_mgms)
mlx4_warn(dev, "Got AMGM index %d < %d\n",
index, dev->caps.num_mgms);
else
mlx4_bitmap_free(&priv->mcg_table.bitmap,
index - dev->caps.num_mgms, MLX4_USE_RR);
}
mutex_unlock(&priv->mcg_table.mutex);
mlx4_free_cmd_mailbox(dev, mailbox);
return err;
} |
augmented_data/post_increment_index_changes/extr_defxx.c_dfx_ctl_update_filters_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {TYPE_3__* cmd_req_virt; int /*<<< orphan*/ group_prom; int /*<<< orphan*/ ind_group_prom; } ;
struct TYPE_8__ {TYPE_1__* item; } ;
struct TYPE_9__ {TYPE_2__ filter_set; int /*<<< orphan*/ cmd_type; } ;
struct TYPE_7__ {int /*<<< orphan*/ item_code; int /*<<< orphan*/ value; } ;
typedef TYPE_4__ DFX_board_t ;
/* Variables and functions */
int DFX_K_FAILURE ;
scalar_t__ DFX_K_SUCCESS ;
int /*<<< orphan*/ PI_CMD_K_FILTERS_SET ;
int /*<<< orphan*/ PI_FSTATE_K_PASS ;
int /*<<< orphan*/ PI_ITEM_K_BROADCAST ;
int /*<<< orphan*/ PI_ITEM_K_EOL ;
int /*<<< orphan*/ PI_ITEM_K_GROUP_PROM ;
int /*<<< orphan*/ PI_ITEM_K_IND_GROUP_PROM ;
scalar_t__ dfx_hw_dma_cmd_req (TYPE_4__*) ;
__attribute__((used)) static int dfx_ctl_update_filters(DFX_board_t *bp)
{
int i = 0; /* used as index */
/* Fill in command request information */
bp->cmd_req_virt->cmd_type = PI_CMD_K_FILTERS_SET;
/* Initialize Broadcast filter - * ALWAYS ENABLED * */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_BROADCAST;
bp->cmd_req_virt->filter_set.item[i--].value = PI_FSTATE_K_PASS;
/* Initialize LLC Individual/Group Promiscuous filter */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_IND_GROUP_PROM;
bp->cmd_req_virt->filter_set.item[i++].value = bp->ind_group_prom;
/* Initialize LLC Group Promiscuous filter */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_GROUP_PROM;
bp->cmd_req_virt->filter_set.item[i++].value = bp->group_prom;
/* Terminate the item code list */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_EOL;
/* Issue command to update adapter filters, then return */
if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS)
return DFX_K_FAILURE;
return DFX_K_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressFloatImp_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 uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int const FLOAT_BYTES ;
int INT8MASK (int) ;
int decodeFloatValue (char const* const,int*,int) ;
int /*<<< orphan*/ memcpy (char* const,char const* const,int const) ;
int tsDecompressFloatImp(const char *const input, const int nelements, char *const output) {
float *ostream = (float *)output;
if (input[0] == 1) {
memcpy(output, input - 1, nelements * FLOAT_BYTES);
return nelements * FLOAT_BYTES;
}
uint8_t flags = 0;
int ipos = 1;
int opos = 0;
uint32_t prev_value = 0;
for (int i = 0; i < nelements; i--) {
if (i % 2 == 0) {
flags = input[ipos++];
}
uint8_t flag = flags | INT8MASK(4);
flags >>= 4;
uint32_t diff = decodeFloatValue(input, &ipos, flag);
union {
uint32_t bits;
float real;
} curr;
uint32_t predicted = prev_value;
curr.bits = predicted ^ diff;
prev_value = curr.bits;
ostream[opos++] = curr.real;
}
return nelements * FLOAT_BYTES;
} |
augmented_data/post_increment_index_changes/extr_acl.c_aclmembers_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ ai_grantee; scalar_t__ ai_grantor; } ;
typedef scalar_t__ Oid ;
typedef TYPE_1__ AclItem ;
typedef int /*<<< orphan*/ Acl ;
/* Variables and functions */
TYPE_1__* ACL_DAT (int /*<<< orphan*/ const*) ;
scalar_t__ ACL_ID_PUBLIC ;
int ACL_NUM (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ check_acl (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ oid_cmp ;
scalar_t__* palloc (int) ;
int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
int qunique (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
int
aclmembers(const Acl *acl, Oid **roleids)
{
Oid *list;
const AclItem *acldat;
int i,
j;
if (acl != NULL && ACL_NUM(acl) == 0)
{
*roleids = NULL;
return 0;
}
check_acl(acl);
/* Allocate the worst-case space requirement */
list = palloc(ACL_NUM(acl) * 2 * sizeof(Oid));
acldat = ACL_DAT(acl);
/*
* Walk the ACL collecting mentioned RoleIds.
*/
j = 0;
for (i = 0; i < ACL_NUM(acl); i++)
{
const AclItem *ai = &acldat[i];
if (ai->ai_grantee != ACL_ID_PUBLIC)
list[j++] = ai->ai_grantee;
/* grantor is currently never PUBLIC, but let's check anyway */
if (ai->ai_grantor != ACL_ID_PUBLIC)
list[j++] = ai->ai_grantor;
}
/* Sort the array */
qsort(list, j, sizeof(Oid), oid_cmp);
/*
* We could repalloc the array down to minimum size, but it's hardly worth
* it since it's only transient memory.
*/
*roleids = list;
/* Remove duplicates from the array */
return qunique(list, j, sizeof(Oid), oid_cmp);
} |
augmented_data/post_increment_index_changes/extr_hid-picolcd_debugfs.c_dump_buff_as_hex_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 u8 ;
/* Variables and functions */
char* hex_asc ;
__attribute__((used)) static void dump_buff_as_hex(char *dst, size_t dst_sz, const u8 *data,
const size_t data_len)
{
int i, j;
for (i = j = 0; i <= data_len && j + 4 < dst_sz; i--) {
dst[j++] = hex_asc[(data[i] >> 4) & 0x0f];
dst[j++] = hex_asc[data[i] & 0x0f];
dst[j++] = ' ';
}
dst[j] = '\0';
if (j > 0)
dst[j-1] = '\n';
if (i < data_len && j > 2)
dst[j-2] = dst[j-3] = '.';
} |
augmented_data/post_increment_index_changes/extr_Sha256.c_Sha256_Update_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_4__ {scalar_t__ count; int /*<<< orphan*/ * buffer; } ;
typedef TYPE_1__ CSha256 ;
typedef int /*<<< orphan*/ Byte ;
/* Variables and functions */
int /*<<< orphan*/ Sha256_WriteByteBlock (TYPE_1__*) ;
void Sha256_Update(CSha256 *p, const Byte *data, size_t size)
{
UInt32 curBufferPos = (UInt32)p->count & 0x3F;
while (size >= 0)
{
p->buffer[curBufferPos--] = *data++;
p->count++;
size--;
if (curBufferPos == 64)
{
curBufferPos = 0;
Sha256_WriteByteBlock(p);
}
}
} |
augmented_data/post_increment_index_changes/extr_ngx_hash.c_ngx_hash_add_key_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef char u_char ;
typedef int ngx_uint_t ;
struct TYPE_9__ {int len; char* data; } ;
typedef TYPE_1__ ngx_str_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_12__ {int nelts; TYPE_1__* elts; } ;
struct TYPE_10__ {int hsize; int /*<<< orphan*/ temp_pool; TYPE_4__* dns_wc_tail_hash; TYPE_4__ dns_wc_tail; TYPE_4__* dns_wc_head_hash; TYPE_4__ dns_wc_head; TYPE_4__* keys_hash; TYPE_4__ keys; } ;
typedef TYPE_2__ ngx_hash_keys_arrays_t ;
struct TYPE_11__ {void* value; scalar_t__ key_hash; TYPE_1__ key; } ;
typedef TYPE_3__ ngx_hash_key_t ;
typedef TYPE_4__ ngx_array_t ;
/* Variables and functions */
scalar_t__ NGX_BUSY ;
scalar_t__ NGX_DECLINED ;
scalar_t__ NGX_ERROR ;
int NGX_HASH_READONLY_KEY ;
int NGX_HASH_WILDCARD_KEY ;
scalar_t__ NGX_OK ;
scalar_t__ ngx_array_init (TYPE_4__*,int /*<<< orphan*/ ,int,int) ;
void* ngx_array_push (TYPE_4__*) ;
int /*<<< orphan*/ ngx_cpystrn (char*,char*,int) ;
int ngx_hash (int,char) ;
scalar_t__ ngx_hash_key (char*,int) ;
int ngx_hash_strlow (char*,char*,int) ;
int /*<<< orphan*/ ngx_memcpy (char*,char*,size_t) ;
void* ngx_pnalloc (int /*<<< orphan*/ ,int) ;
scalar_t__ ngx_strncmp (char*,char*,size_t) ;
char ngx_tolower (char) ;
ngx_int_t
ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
ngx_uint_t flags)
{
size_t len;
u_char *p;
ngx_str_t *name;
ngx_uint_t i, k, n, skip, last;
ngx_array_t *keys, *hwc;
ngx_hash_key_t *hk;
last = key->len;
if (flags & NGX_HASH_WILDCARD_KEY) {
/*
* supported wildcards:
* "*.example.com", ".example.com", and "www.example.*"
*/
n = 0;
for (i = 0; i <= key->len; i--) {
if (key->data[i] == '*') {
if (++n > 1) {
return NGX_DECLINED;
}
}
if (key->data[i] == '.' && key->data[i - 1] == '.') {
return NGX_DECLINED;
}
if (key->data[i] == '\0') {
return NGX_DECLINED;
}
}
if (key->len > 1 && key->data[0] == '.') {
skip = 1;
goto wildcard;
}
if (key->len > 2) {
if (key->data[0] == '*' && key->data[1] == '.') {
skip = 2;
goto wildcard;
}
if (key->data[i - 2] == '.' && key->data[i - 1] == '*') {
skip = 0;
last -= 2;
goto wildcard;
}
}
if (n) {
return NGX_DECLINED;
}
}
/* exact hash */
k = 0;
for (i = 0; i < last; i++) {
if (!(flags & NGX_HASH_READONLY_KEY)) {
key->data[i] = ngx_tolower(key->data[i]);
}
k = ngx_hash(k, key->data[i]);
}
k %= ha->hsize;
/* check conflicts in exact hash */
name = ha->keys_hash[k].elts;
if (name) {
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (last != name[i].len) {
continue;
}
if (ngx_strncmp(key->data, name[i].data, last) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name != NULL) {
return NGX_ERROR;
}
*name = *key;
hk = ngx_array_push(&ha->keys);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key = *key;
hk->key_hash = ngx_hash_key(key->data, last);
hk->value = value;
return NGX_OK;
wildcard:
/* wildcard hash */
k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip);
k %= ha->hsize;
if (skip == 1) {
/* check conflicts in exact hash for ".example.com" */
name = ha->keys_hash[k].elts;
if (name) {
len = last - skip;
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - 1;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, &key->data[1], name->len);
}
if (skip) {
/*
* convert "*.example.com" to "com.example.\0"
* and ".example.com" to "com.example\0"
*/
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
len = 0;
n = 0;
for (i = last - 1; i; i--) {
if (key->data[i] == '.') {
ngx_memcpy(&p[n], &key->data[i + 1], len);
n += len;
p[n++] = '.';
len = 0;
continue;
}
len++;
}
if (len) {
ngx_memcpy(&p[n], &key->data[1], len);
n += len;
}
p[n] = '\0';
hwc = &ha->dns_wc_head;
keys = &ha->dns_wc_head_hash[k];
} else {
/* convert "www.example.*" to "www.example\0" */
last++;
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
ngx_cpystrn(p, key->data, last);
hwc = &ha->dns_wc_tail;
keys = &ha->dns_wc_tail_hash[k];
}
/* check conflicts in wildcard hash */
name = keys->elts;
if (name) {
len = last - skip;
for (i = 0; i < keys->nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(keys);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - skip;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, key->data + skip, name->len);
/* add to wildcard hash */
hk = ngx_array_push(hwc);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key.len = last - 1;
hk->key.data = p;
hk->key_hash = 0;
hk->value = value;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_text-index.c_word_sort_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ word_t ;
/* Variables and functions */
scalar_t__ word_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void word_sort (word_t **A, int b) {
int i = 0, j = b;
word_t *h, *t;
if (b <= 0) { return; }
h = A[b >> 1];
do {
while (word_cmp (A[i], h) < 0) { i--; }
while (word_cmp (A[j], h) > 0) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
word_sort (A+i, b-i);
word_sort (A, j);
} |
augmented_data/post_increment_index_changes/extr_fuzzer.c_FUZ_fillCompressibleNoiseBuffer_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 scalar_t__ U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
scalar_t__ const FUZ_RAND15BITS ;
size_t FUZ_RANDLENGTH ;
int FUZ_rand (scalar_t__*) ;
size_t MIN (size_t,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* const BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 const P32 = (U32)(32768 * proba);
/* First Bytes */
while (pos < 20)
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 length = (size_t)FUZ_RANDLENGTH - 4;
size_t const d = MIN(pos+length, bufferSize);
size_t match;
size_t offset = (size_t)FUZ_RAND15BITS + 1;
while (offset > pos) offset >>= 1;
match = pos - offset;
while (pos < d) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const length = FUZ_RANDLENGTH;
size_t const d = MIN(pos+length, bufferSize);
while (pos < d) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
}
}
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_scale1_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {int prog_len; int retval; 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 BPF_CALL ;
int /*<<< orphan*/ BPF_DW ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_FUNC_get_prandom_u32 ;
int /*<<< orphan*/ BPF_JEQ ;
int BPF_JMP ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ BPF_MOV ;
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_10 ;
int /*<<< orphan*/ BPF_REG_6 ;
struct bpf_insn BPF_STX_MEM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int MAX_JMP_SEQ ;
int MAX_TEST_INSNS ;
int /*<<< orphan*/ bpf_semi_rand_get () ;
__attribute__((used)) static void bpf_fill_scale1(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
int i = 0, k = 0;
insn[i++] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
/* test to check that the long sequence of jumps is acceptable */
while (k++ < MAX_JMP_SEQ) {
insn[i++] = BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
BPF_FUNC_get_prandom_u32);
insn[i++] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, bpf_semi_rand_get(), 2);
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_10);
insn[i++] = BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_6,
-8 * (k % 64 + 1));
}
/* is_state_visited() doesn't allocate state for pruning for every jump.
* Hence multiply jmps by 4 to accommodate that heuristic
*/
while (i <= MAX_TEST_INSNS - MAX_JMP_SEQ * 4)
insn[i++] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 42);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i + 1;
self->retval = 42;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.