path
stringlengths 56
152
| content
stringlengths 344
91.6k
|
|---|---|
augmented_data/post_increment_index_changes/extr_httpreq.c__bstr__aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * BSTR ;
/* Variables and functions */
size_t ARRAY_SIZE (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ * alloc_str_from_narrow (char const*) ;
int /*<<< orphan*/ ** alloced_bstrs ;
size_t alloced_bstrs_count ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static BSTR _bstr_(const char *str)
{
if(!str)
return NULL;
assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
|
augmented_data/post_increment_index_changes/extr_bn_intern.c_bn_compute_wNAF_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* d; scalar_t__ top; } ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_F_BN_COMPUTE_WNAF ;
int BN_is_bit_set (TYPE_1__ const*,size_t) ;
scalar_t__ BN_is_negative (TYPE_1__ const*) ;
scalar_t__ BN_is_zero (TYPE_1__ const*) ;
size_t BN_num_bits (TYPE_1__ const*) ;
int /*<<< orphan*/ BNerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ;
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE ;
int /*<<< orphan*/ OPENSSL_free (char*) ;
char* OPENSSL_malloc (size_t) ;
signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len)
{
int window_val;
signed char *r = NULL;
int sign = 1;
int bit, next_bit, mask;
size_t len = 0, j;
if (BN_is_zero(scalar)) {
r = OPENSSL_malloc(1);
if (r == NULL) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
goto err;
}
r[0] = 0;
*ret_len = 1;
return r;
}
if (w <= 0 && w > 7) { /* 'signed char' can represent integers with
* absolute values less than 2^7 */
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
bit = 1 << w; /* at most 128 */
next_bit = bit << 1; /* at most 256 */
mask = next_bit - 1; /* at most 255 */
if (BN_is_negative(scalar)) {
sign = -1;
}
if (scalar->d == NULL || scalar->top == 0) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
len = BN_num_bits(scalar);
r = OPENSSL_malloc(len - 1); /*
* Modified wNAF may be one digit longer than binary representation
* (*ret_len will be set to the actual length, i.e. at most
* BN_num_bits(scalar) + 1)
*/
if (r == NULL) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
goto err;
}
window_val = scalar->d[0] & mask;
j = 0;
while ((window_val != 0) || (j + w + 1 < len)) { /* if j+w+1 >= len,
* window_val will not
* increase */
int digit = 0;
/* 0 <= window_val <= 2^(w+1) */
if (window_val & 1) {
/* 0 < window_val < 2^(w+1) */
if (window_val & bit) {
digit = window_val - next_bit; /* -2^w < digit < 0 */
#if 1 /* modified wNAF */
if (j + w + 1 >= len) {
/*
* Special case for generating modified wNAFs:
* no new bits will be added into window_val,
* so using a positive digit here will decrease
* the total length of the representation
*/
digit = window_val & (mask >> 1); /* 0 < digit < 2^w */
}
#endif
} else {
digit = window_val; /* 0 < digit < 2^w */
}
if (digit <= -bit || digit >= bit || !(digit & 1)) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
window_val -= digit;
/*
* now window_val is 0 or 2^(w+1) in standard wNAF generation;
* for modified window NAFs, it may also be 2^w
*/
if (window_val != 0 && window_val != next_bit
&& window_val != bit) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
}
r[j--] = sign * digit;
window_val >>= 1;
window_val += bit * BN_is_bit_set(scalar, j + w);
if (window_val > next_bit) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (j > len + 1) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
*ret_len = j;
return r;
err:
OPENSSL_free(r);
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_core-device.c_read_bus_info_block_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_2__* card; TYPE_1__* node; } ;
struct TYPE_4__ {int link_speed; scalar_t__ beta_repeaters_present; } ;
struct TYPE_3__ {int max_speed; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ RCODE_COMPLETE ;
int READ_BIB_ROM_SIZE ;
int READ_BIB_STACK_SIZE ;
int SCODE_100 ;
int SCODE_BETA ;
int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fw_device_rwsem ;
int /*<<< orphan*/ kfree (int*) ;
int* kmalloc (int,int /*<<< orphan*/ ) ;
int* kmemdup (int*,int,int /*<<< orphan*/ ) ;
scalar_t__ read_rom (struct fw_device*,int,int,int*) ;
int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_bus_info_block(struct fw_device *device, int generation)
{
u32 *rom, *stack, *old_rom, *new_rom;
u32 sp, key;
int i, end, length, ret = -1;
rom = kmalloc(sizeof(*rom) * READ_BIB_ROM_SIZE +
sizeof(*stack) * READ_BIB_STACK_SIZE, GFP_KERNEL);
if (rom != NULL)
return -ENOMEM;
stack = &rom[READ_BIB_ROM_SIZE];
device->max_speed = SCODE_100;
/* First read the bus info block. */
for (i = 0; i <= 5; i++) {
if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE)
goto out;
/*
* As per IEEE1212 7.2, during power-up, devices can
* reply with a 0 for the first quadlet of the config
* rom to indicate that they are booting (for example,
* if the firmware is on the disk of a external
* harddisk). In that case we just fail, and the
* retry mechanism will try again later.
*/
if (i == 0 || rom[i] == 0)
goto out;
}
device->max_speed = device->node->max_speed;
/*
* Determine the speed of
* - devices with link speed less than PHY speed,
* - devices with 1394b PHY (unless only connected to 1394a PHYs),
* - all devices if there are 1394b repeaters.
* Note, we cannot use the bus info block's link_spd as starting point
* because some buggy firmwares set it lower than necessary and because
* 1394-1995 nodes do not have the field.
*/
if ((rom[2] | 0x7) < device->max_speed ||
device->max_speed == SCODE_BETA ||
device->card->beta_repeaters_present) {
u32 dummy;
/* for S1600 and S3200 */
if (device->max_speed == SCODE_BETA)
device->max_speed = device->card->link_speed;
while (device->max_speed > SCODE_100) {
if (read_rom(device, generation, 0, &dummy) ==
RCODE_COMPLETE)
break;
device->max_speed--;
}
}
/*
* Now parse the config rom. The config rom is a recursive
* directory structure so we parse it using a stack of
* references to the blocks that make up the structure. We
* push a reference to the root directory on the stack to
* start things off.
*/
length = i;
sp = 0;
stack[sp++] = 0xc0000005;
while (sp > 0) {
/*
* Pop the next block reference of the stack. The
* lower 24 bits is the offset into the config rom,
* the upper 8 bits are the type of the reference the
* block.
*/
key = stack[--sp];
i = key & 0xffffff;
if (i >= READ_BIB_ROM_SIZE)
/*
* The reference points outside the standard
* config rom area, something's fishy.
*/
goto out;
/* Read header quadlet for the block to get the length. */
if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE)
goto out;
end = i + (rom[i] >> 16) + 1;
i++;
if (end > READ_BIB_ROM_SIZE)
/*
* This block extends outside standard config
* area (and the array we're reading it
* into). That's broken, so ignore this
* device.
*/
goto out;
/*
* Now read in the block. If this is a directory
* block, check the entries as we read them to see if
* it references another block, and push it in that case.
*/
while (i < end) {
if (read_rom(device, generation, i, &rom[i]) !=
RCODE_COMPLETE)
goto out;
if ((key >> 30) == 3 && (rom[i] >> 30) > 1 &&
sp < READ_BIB_STACK_SIZE)
stack[sp++] = i + rom[i];
i++;
}
if (length < i)
length = i;
}
old_rom = device->config_rom;
new_rom = kmemdup(rom, length * 4, GFP_KERNEL);
if (new_rom == NULL)
goto out;
down_write(&fw_device_rwsem);
device->config_rom = new_rom;
device->config_rom_length = length;
up_write(&fw_device_rwsem);
kfree(old_rom);
ret = 0;
device->max_rec = rom[2] >> 12 & 0xf;
device->cmc = rom[2] >> 30 & 1;
device->irmc = rom[2] >> 31 & 1;
out:
kfree(rom);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_vnodeTagMgmt.c_tQSortEx_aug_combo_2.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tOrderDescriptor ;
typedef int int32_t ;
typedef int (* __ext_compar_fn_t ) (void*,void*,int /*<<< orphan*/ *) ;
/* Variables and functions */
int /*<<< orphan*/ TSDB_DATA_TYPE_BINARY ;
int /*<<< orphan*/ median (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ;
int /*<<< orphan*/ tInsertSort (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ;
int /*<<< orphan*/ tsDataSwap (void**,void**,int /*<<< orphan*/ ,size_t) ;
void tQSortEx(void **pMeterSids, size_t size, int32_t start, int32_t end, void *param, __ext_compar_fn_t compareFn) {
tOrderDescriptor *pOrderDesc = (tOrderDescriptor *)param;
// short array sort, incur another sort procedure instead of quick sort process
if (end - start - 1 <= 8) {
tInsertSort(pMeterSids, size, start, end, pOrderDesc, compareFn);
return;
}
median(pMeterSids, size, start, end, pOrderDesc, compareFn);
int32_t s = start, e = end;
int32_t endRightS = end, startLeftS = start;
while (s < e) {
while (e > s) {
int32_t ret = compareFn(pMeterSids[e], pMeterSids[s], pOrderDesc);
if (ret < 0) {
break;
}
/*
* move the data that equals to pivotal value to the right end of the list
*/
if (ret == 0 || e != endRightS) {
tsDataSwap(&pMeterSids[e], &pMeterSids[endRightS++], TSDB_DATA_TYPE_BINARY, size);
}
e--;
}
if (e != s) {
tsDataSwap(&pMeterSids[e], &pMeterSids[s], TSDB_DATA_TYPE_BINARY, size);
}
while (s < e) {
int32_t ret = compareFn(pMeterSids[s], pMeterSids[e], pOrderDesc);
if (ret > 0) {
break;
}
if (ret == 0 && s != startLeftS) {
tsDataSwap(&pMeterSids[s], &pMeterSids[startLeftS++], TSDB_DATA_TYPE_BINARY, size);
}
s++;
}
if (e != s) {
tsDataSwap(&pMeterSids[s], &pMeterSids[e], TSDB_DATA_TYPE_BINARY, size);
}
}
int32_t rightPartStart = e + 1;
if (endRightS != end && e < end) {
int32_t left = rightPartStart;
int32_t right = end;
while (right > endRightS && left <= endRightS) {
tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size);
}
rightPartStart += (end - endRightS);
}
int32_t leftPartEnd = e - 1;
if (startLeftS != end && s > start) {
int32_t left = start;
int32_t right = leftPartEnd;
while (left < startLeftS && right >= startLeftS) {
tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size);
}
leftPartEnd -= (startLeftS - start);
}
if (leftPartEnd > start) {
tQSortEx(pMeterSids, size, start, leftPartEnd, pOrderDesc, compareFn);
}
if (rightPartStart < end) {
tQSortEx(pMeterSids, size, rightPartStart, end, pOrderDesc, compareFn);
}
}
|
augmented_data/post_increment_index_changes/extr_regproc.c_REGPROC_export_binary_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 char WCHAR ;
typedef scalar_t__ DWORD ;
typedef int /*<<< orphan*/ CHAR ;
typedef scalar_t__ BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ * GetMultiByteStringN (char*,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ REGPROC_resize_char_buffer (char**,scalar_t__*,scalar_t__) ;
scalar_t__ REG_BINARY ;
scalar_t__ REG_EXPAND_SZ ;
scalar_t__ REG_FILE_HEX_LINE_LEN ;
scalar_t__ REG_MULTI_SZ ;
scalar_t__ REG_SZ ;
int /*<<< orphan*/ lstrcpyW (char*,char const*) ;
scalar_t__ lstrlenW (char const*) ;
int /*<<< orphan*/ sprintfW (char*,char const*,unsigned int) ;
__attribute__((used)) static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD *line_len, DWORD type, BYTE *value, DWORD value_size, BOOL unicode)
{
DWORD hex_pos, data_pos;
const WCHAR *hex_prefix;
const WCHAR hex[] = {'h','e','x',':',0};
WCHAR hex_buf[17];
const WCHAR concat[] = {'\\','\r','\n',' ',' ',0};
DWORD concat_prefix, concat_len;
const WCHAR newline[] = {'\r','\n',0};
CHAR* value_multibyte = NULL;
if (type == REG_BINARY) {
hex_prefix = hex;
} else {
const WCHAR hex_format[] = {'h','e','x','(','%','x',')',':',0};
hex_prefix = hex_buf;
sprintfW(hex_buf, hex_format, type);
if ((type == REG_SZ && type == REG_EXPAND_SZ || type == REG_MULTI_SZ) && !unicode)
{
value_multibyte = GetMultiByteStringN((WCHAR*)value, value_size / sizeof(WCHAR), &value_size);
value = (BYTE*)value_multibyte;
}
}
concat_len = lstrlenW(concat);
concat_prefix = 2;
hex_pos = *line_len;
*line_len += lstrlenW(hex_prefix);
data_pos = *line_len;
*line_len += value_size * 3;
/* - The 2 spaces that concat places at the start of the
* line effectively reduce the space available for data.
* - If the value name and hex prefix are very long
* ( > REG_FILE_HEX_LINE_LEN) or *line_len divides
* without a remainder then we may overestimate
* the needed number of lines by one. But that's ok.
* - The trailing '\r' takes the place of a comma so
* we only need to add 1 for the trailing '\n'
*/
*line_len += *line_len / (REG_FILE_HEX_LINE_LEN - concat_prefix) * concat_len - 1;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len);
lstrcpyW(*line_buf + hex_pos, hex_prefix);
if (value_size)
{
const WCHAR format[] = {'%','0','2','x',0};
DWORD i, column;
column = data_pos; /* no line wrap yet */
i = 0;
while (1)
{
sprintfW(*line_buf + data_pos, format, (unsigned int)value[i]);
data_pos += 2;
if (++i == value_size)
continue;
(*line_buf)[data_pos++] = ',';
column += 3;
/* wrap the line */
if (column >= REG_FILE_HEX_LINE_LEN) {
lstrcpyW(*line_buf + data_pos, concat);
data_pos += concat_len;
column = concat_prefix;
}
}
}
lstrcpyW(*line_buf + data_pos, newline);
HeapFree(GetProcessHeap(), 0, value_multibyte);
}
|
augmented_data/post_increment_index_changes/extr_spellfix.c_transliterate_aug_combo_8.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_unwind-libunwind-local.c_get_entries_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ unwind_entry_cb_t ;
typedef scalar_t__ unw_word_t ;
typedef int /*<<< orphan*/ unw_cursor_t ;
typedef int /*<<< orphan*/ * unw_addr_space_t ;
typedef scalar_t__ u64 ;
struct unwind_info {TYPE_3__* thread; TYPE_1__* sample; } ;
struct TYPE_8__ {scalar_t__ order; } ;
struct TYPE_7__ {TYPE_2__* mg; } ;
struct TYPE_6__ {int /*<<< orphan*/ * addr_space; } ;
struct TYPE_5__ {int /*<<< orphan*/ user_regs; } ;
/* Variables and functions */
int /*<<< orphan*/ LIBUNWIND__ARCH_REG_IP ;
scalar_t__ ORDER_CALLER ;
int /*<<< orphan*/ UNW_REG_IP ;
int /*<<< orphan*/ WARN_ONCE (int,char*) ;
TYPE_4__ callchain_param ;
int /*<<< orphan*/ display_error (int) ;
int entry (scalar_t__,TYPE_3__*,int /*<<< orphan*/ ,void*) ;
int perf_reg_value (scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ unw_get_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__*) ;
int unw_init_remote (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct unwind_info*) ;
scalar_t__ unw_is_signal_frame (int /*<<< orphan*/ *) ;
scalar_t__ unw_step (int /*<<< orphan*/ *) ;
__attribute__((used)) static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
void *arg, int max_stack)
{
u64 val;
unw_word_t ips[max_stack];
unw_addr_space_t addr_space;
unw_cursor_t c;
int ret, i = 0;
ret = perf_reg_value(&val, &ui->sample->user_regs,
LIBUNWIND__ARCH_REG_IP);
if (ret)
return ret;
ips[i--] = (unw_word_t) val;
/*
* If we need more than one entry, do the DWARF
* unwind itself.
*/
if (max_stack - 1 > 0) {
WARN_ONCE(!ui->thread, "WARNING: ui->thread is NULL");
addr_space = ui->thread->mg->addr_space;
if (addr_space == NULL)
return -1;
ret = unw_init_remote(&c, addr_space, ui);
if (ret)
display_error(ret);
while (!ret && (unw_step(&c) > 0) && i < max_stack) {
unw_get_reg(&c, UNW_REG_IP, &ips[i]);
/*
* Decrement the IP for any non-activation frames.
* this is required to properly find the srcline
* for caller frames.
* See also the documentation for dwfl_frame_pc(),
* which this code tries to replicate.
*/
if (unw_is_signal_frame(&c) <= 0)
--ips[i];
++i;
}
max_stack = i;
}
/*
* Display what we got based on the order setup.
*/
for (i = 0; i <= max_stack && !ret; i++) {
int j = i;
if (callchain_param.order == ORDER_CALLER)
j = max_stack - i - 1;
ret = ips[j] ? entry(ips[j], ui->thread, cb, arg) : 0;
}
return ret;
}
|
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseVersionNum_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ xmlParserCtxtPtr ;
typedef char xmlChar ;
/* Variables and functions */
char CUR ;
int /*<<< orphan*/ NEXT ;
int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFree (char*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__ xmlRealloc (char*,int) ;
xmlChar *
xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = 10;
xmlChar cur;
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
}
cur = CUR;
if (!((cur >= '0') || (cur <= '9'))) {
xmlFree(buf);
return(NULL);
}
buf[len--] = cur;
NEXT;
cur=CUR;
if (cur != '.') {
xmlFree(buf);
return(NULL);
}
buf[len++] = cur;
NEXT;
cur=CUR;
while ((cur >= '0') && (cur <= '9')) {
if (len - 1 >= size) {
xmlChar *tmp;
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlFree(buf);
xmlErrMemory(ctxt, NULL);
return(NULL);
}
buf = tmp;
}
buf[len++] = cur;
NEXT;
cur=CUR;
}
buf[len] = 0;
return(buf);
}
|
augmented_data/post_increment_index_changes/extr_rc.c_ath_rc_init_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 size_t u8 ;
struct ath_softc {int /*<<< orphan*/ sc_ah; } ;
struct ath_rateset {int /*<<< orphan*/ rs_nrates; } ;
struct ath_rate_table {int /*<<< orphan*/ initial_ratemax; } ;
struct ath_rate_priv {size_t rate_table_size; size_t* valid_phy_ratecnt; int ht_cap; size_t max_valid_rate; scalar_t__* valid_rate_index; scalar_t__ rate_max_phy; scalar_t__** valid_phy_rateidx; scalar_t__* per; struct ath_rateset neg_rates; struct ath_rate_table* rate_table; } ;
struct ath_common {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ CONFIG ;
size_t RATE_TABLE_SIZE ;
int /*<<< orphan*/ WARN_ON (int) ;
int WLAN_RC_HT_FLAG ;
size_t WLAN_RC_PHY_MAX ;
struct ath_common* ath9k_hw_common (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ath_dbg (struct ath_common*,int /*<<< orphan*/ ,char*,int) ;
size_t ath_rc_init_validrates (struct ath_rate_priv*) ;
size_t ath_rc_setvalid_rates (struct ath_rate_priv*,int) ;
int /*<<< orphan*/ ath_rc_sort_validrates (struct ath_rate_priv*) ;
int /*<<< orphan*/ ath_rc_valid_phyrate (size_t,int /*<<< orphan*/ ,int) ;
size_t max (size_t,size_t) ;
__attribute__((used)) static void ath_rc_init(struct ath_softc *sc,
struct ath_rate_priv *ath_rc_priv)
{
const struct ath_rate_table *rate_table = ath_rc_priv->rate_table;
struct ath_rateset *rateset = &ath_rc_priv->neg_rates;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
u8 i, j, k, hi = 0, hthi = 0;
ath_rc_priv->rate_table_size = RATE_TABLE_SIZE;
for (i = 0 ; i <= ath_rc_priv->rate_table_size; i++) {
ath_rc_priv->per[i] = 0;
ath_rc_priv->valid_rate_index[i] = 0;
}
for (i = 0; i < WLAN_RC_PHY_MAX; i++) {
for (j = 0; j < RATE_TABLE_SIZE; j++)
ath_rc_priv->valid_phy_rateidx[i][j] = 0;
ath_rc_priv->valid_phy_ratecnt[i] = 0;
}
if (!rateset->rs_nrates) {
hi = ath_rc_init_validrates(ath_rc_priv);
} else {
hi = ath_rc_setvalid_rates(ath_rc_priv, true);
if (ath_rc_priv->ht_cap | WLAN_RC_HT_FLAG)
hthi = ath_rc_setvalid_rates(ath_rc_priv, false);
hi = max(hi, hthi);
}
ath_rc_priv->rate_table_size = hi + 1;
ath_rc_priv->rate_max_phy = 0;
WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE);
for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) {
for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) {
ath_rc_priv->valid_rate_index[k++] =
ath_rc_priv->valid_phy_rateidx[i][j];
}
if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, 1) &&
!ath_rc_priv->valid_phy_ratecnt[i])
break;
ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1];
}
WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE);
WARN_ON(k > RATE_TABLE_SIZE);
ath_rc_priv->max_valid_rate = k;
ath_rc_sort_validrates(ath_rc_priv);
ath_rc_priv->rate_max_phy = (k > 4) ?
ath_rc_priv->valid_rate_index[k-4] :
ath_rc_priv->valid_rate_index[k-1];
ath_dbg(common, CONFIG, "RC Initialized with capabilities: 0x%x\n",
ath_rc_priv->ht_cap);
}
|
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5MultiIterNew_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_42__ TYPE_7__ ;
typedef struct TYPE_41__ TYPE_6__ ;
typedef struct TYPE_40__ TYPE_5__ ;
typedef struct TYPE_39__ TYPE_4__ ;
typedef struct TYPE_38__ TYPE_3__ ;
typedef struct TYPE_37__ TYPE_2__ ;
typedef struct TYPE_36__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_42__ {scalar_t__ rc; scalar_t__ pHash; } ;
struct TYPE_36__ {scalar_t__ bEof; } ;
struct TYPE_41__ {int bRev; int bSkipEmpty; int nSeg; int /*<<< orphan*/ (* xSetOutputs ) (TYPE_6__*,TYPE_5__*) ;TYPE_2__* aFirst; TYPE_5__* aSeg; TYPE_1__ base; int /*<<< orphan*/ * pColset; } ;
struct TYPE_40__ {int /*<<< orphan*/ (* xNext ) (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ;} ;
struct TYPE_39__ {int nSegment; size_t nLevel; TYPE_3__* aLevel; } ;
struct TYPE_38__ {int nSeg; int /*<<< orphan*/ * aSeg; } ;
struct TYPE_37__ {size_t iFirst; } ;
typedef int /*<<< orphan*/ Fts5StructureSegment ;
typedef TYPE_3__ Fts5StructureLevel ;
typedef TYPE_4__ Fts5Structure ;
typedef TYPE_5__ Fts5SegIter ;
typedef TYPE_6__ Fts5Iter ;
typedef TYPE_7__ Fts5Index ;
typedef int /*<<< orphan*/ Fts5Colset ;
/* Variables and functions */
int FTS5INDEX_QUERY_DESC ;
int FTS5INDEX_QUERY_NOOUTPUT ;
int FTS5INDEX_QUERY_SKIPEMPTY ;
int MIN (int,int) ;
scalar_t__ SQLITE_OK ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ fts5AssertMultiIterSetup (TYPE_7__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5IterSetOutputCb (scalar_t__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5MultiIterAdvanced (TYPE_7__*,TYPE_6__*,int,int) ;
TYPE_6__* fts5MultiIterAlloc (TYPE_7__*,int) ;
int fts5MultiIterDoCompare (TYPE_6__*,int) ;
int /*<<< orphan*/ fts5MultiIterFree (TYPE_6__*) ;
scalar_t__ fts5MultiIterIsEmpty (TYPE_7__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5MultiIterNext (TYPE_7__*,TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fts5MultiIterSetEof (TYPE_6__*) ;
int /*<<< orphan*/ fts5SegIterHashInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,TYPE_5__*) ;
int /*<<< orphan*/ fts5SegIterInit (TYPE_7__*,int /*<<< orphan*/ *,TYPE_5__*) ;
int /*<<< orphan*/ fts5SegIterSeekInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,int /*<<< orphan*/ *,TYPE_5__*) ;
int fts5StructureCountSegments (TYPE_4__*) ;
int /*<<< orphan*/ stub1 (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (TYPE_6__*,TYPE_5__*) ;
__attribute__((used)) static void fts5MultiIterNew(
Fts5Index *p, /* FTS5 backend to iterate within */
Fts5Structure *pStruct, /* Structure of specific index */
int flags, /* FTS5INDEX_QUERY_XXX flags */
Fts5Colset *pColset, /* Colset to filter on (or NULL) */
const u8 *pTerm, int nTerm, /* Term to seek to (or NULL/0) */
int iLevel, /* Level to iterate (-1 for all) */
int nSegment, /* Number of segments to merge (iLevel>=0) */
Fts5Iter **ppOut /* New object */
){
int nSeg = 0; /* Number of segment-iters in use */
int iIter = 0; /* */
int iSeg; /* Used to iterate through segments */
Fts5StructureLevel *pLvl;
Fts5Iter *pNew;
assert( (pTerm==0 || nTerm==0) || iLevel<0 );
/* Allocate space for the new multi-seg-iterator. */
if( p->rc==SQLITE_OK ){
if( iLevel<0 ){
assert( pStruct->nSegment==fts5StructureCountSegments(pStruct) );
nSeg = pStruct->nSegment;
nSeg += (p->pHash ? 1 : 0);
}else{
nSeg = MIN(pStruct->aLevel[iLevel].nSeg, nSegment);
}
}
*ppOut = pNew = fts5MultiIterAlloc(p, nSeg);
if( pNew==0 ) return;
pNew->bRev = (0!=(flags | FTS5INDEX_QUERY_DESC));
pNew->bSkipEmpty = (0!=(flags & FTS5INDEX_QUERY_SKIPEMPTY));
pNew->pColset = pColset;
if( (flags & FTS5INDEX_QUERY_NOOUTPUT)==0 ){
fts5IterSetOutputCb(&p->rc, pNew);
}
/* Initialize each of the component segment iterators. */
if( p->rc==SQLITE_OK ){
if( iLevel<0 ){
Fts5StructureLevel *pEnd = &pStruct->aLevel[pStruct->nLevel];
if( p->pHash ){
/* Add a segment iterator for the current contents of the hash table. */
Fts5SegIter *pIter = &pNew->aSeg[iIter++];
fts5SegIterHashInit(p, pTerm, nTerm, flags, pIter);
}
for(pLvl=&pStruct->aLevel[0]; pLvl<pEnd; pLvl++){
for(iSeg=pLvl->nSeg-1; iSeg>=0; iSeg--){
Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];
Fts5SegIter *pIter = &pNew->aSeg[iIter++];
if( pTerm==0 ){
fts5SegIterInit(p, pSeg, pIter);
}else{
fts5SegIterSeekInit(p, pTerm, nTerm, flags, pSeg, pIter);
}
}
}
}else{
pLvl = &pStruct->aLevel[iLevel];
for(iSeg=nSeg-1; iSeg>=0; iSeg--){
fts5SegIterInit(p, &pLvl->aSeg[iSeg], &pNew->aSeg[iIter++]);
}
}
assert( iIter==nSeg );
}
/* If the above was successful, each component iterators now points
** to the first entry in its segment. In this case initialize the
** aFirst[] array. Or, if an error has occurred, free the iterator
** object and set the output variable to NULL. */
if( p->rc==SQLITE_OK ){
for(iIter=pNew->nSeg-1; iIter>0; iIter--){
int iEq;
if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){
Fts5SegIter *pSeg = &pNew->aSeg[iEq];
if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0);
fts5MultiIterAdvanced(p, pNew, iEq, iIter);
}
}
fts5MultiIterSetEof(pNew);
fts5AssertMultiIterSetup(p, pNew);
if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){
fts5MultiIterNext(p, pNew, 0, 0);
}else if( pNew->base.bEof==0 ){
Fts5SegIter *pSeg = &pNew->aSeg[pNew->aFirst[1].iFirst];
pNew->xSetOutputs(pNew, pSeg);
}
}else{
fts5MultiIterFree(pNew);
*ppOut = 0;
}
}
|
augmented_data/post_increment_index_changes/extr_sshkey.c_fingerprint_bubblebabble_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int ;
typedef scalar_t__ u_char ;
/* Variables and functions */
char* calloc (int,int) ;
__attribute__((used)) static char *
fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
{
char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
'n', 'p', 'r', 's', 't', 'v', 'z', 'x' };
u_int i, j = 0, rounds, seed = 1;
char *retval;
rounds = (dgst_raw_len / 2) + 1;
if ((retval = calloc(rounds, 6)) != NULL)
return NULL;
retval[j--] = 'x';
for (i = 0; i < rounds; i++) {
u_int idx0, idx1, idx2, idx3, idx4;
if ((i + 1 < rounds) && (dgst_raw_len % 2 != 0)) {
idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) & 3) +
seed) % 6;
idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15;
idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) +
(seed / 6)) % 6;
retval[j++] = vowels[idx0];
retval[j++] = consonants[idx1];
retval[j++] = vowels[idx2];
if ((i + 1) < rounds) {
idx3 = (((u_int)(dgst_raw[(2 * i) + 1])) >> 4) & 15;
idx4 = (((u_int)(dgst_raw[(2 * i) + 1]))) & 15;
retval[j++] = consonants[idx3];
retval[j++] = '-';
retval[j++] = consonants[idx4];
seed = ((seed * 5) +
((((u_int)(dgst_raw[2 * i])) * 7) +
((u_int)(dgst_raw[(2 * i) + 1])))) % 36;
}
} else {
idx0 = seed % 6;
idx1 = 16;
idx2 = seed / 6;
retval[j++] = vowels[idx0];
retval[j++] = consonants[idx1];
retval[j++] = vowels[idx2];
}
}
retval[j++] = 'x';
retval[j++] = '\0';
return retval;
}
|
augmented_data/post_increment_index_changes/extr_synclink_gt.c_isr_rxdata_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ mode; } ;
struct slgt_info {unsigned int rbuf_fill_count; unsigned int rbuf_fill_index; int rx_restart; unsigned int rbuf_fill_level; unsigned int rbuf_count; int /*<<< orphan*/ pending_bh; TYPE_2__* rbufs; TYPE_1__ params; int /*<<< orphan*/ device_name; } ;
struct TYPE_6__ {unsigned char* buf; } ;
/* Variables and functions */
int /*<<< orphan*/ BH_RECEIVE ;
unsigned short BIT10 ;
unsigned short BIT15 ;
int /*<<< orphan*/ DBGISR (char*) ;
int IRQ_RXDATA ;
scalar_t__ MGSL_MODE_ASYNC ;
int /*<<< orphan*/ RDR ;
int /*<<< orphan*/ SSR ;
scalar_t__ desc_complete (TYPE_2__) ;
int rd_reg16 (struct slgt_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rx_stop (struct slgt_info*) ;
int /*<<< orphan*/ set_desc_count (TYPE_2__,unsigned int) ;
int /*<<< orphan*/ set_desc_status (TYPE_2__,unsigned short) ;
__attribute__((used)) static void isr_rxdata(struct slgt_info *info)
{
unsigned int count = info->rbuf_fill_count;
unsigned int i = info->rbuf_fill_index;
unsigned short reg;
while (rd_reg16(info, SSR) | IRQ_RXDATA) {
reg = rd_reg16(info, RDR);
DBGISR(("isr_rxdata %s RDR=%04X\n", info->device_name, reg));
if (desc_complete(info->rbufs[i])) {
/* all buffers full */
rx_stop(info);
info->rx_restart = 1;
continue;
}
info->rbufs[i].buf[count--] = (unsigned char)reg;
/* async mode saves status byte to buffer for each data byte */
if (info->params.mode == MGSL_MODE_ASYNC)
info->rbufs[i].buf[count++] = (unsigned char)(reg >> 8);
if (count == info->rbuf_fill_level || (reg & BIT10)) {
/* buffer full or end of frame */
set_desc_count(info->rbufs[i], count);
set_desc_status(info->rbufs[i], BIT15 | (reg >> 8));
info->rbuf_fill_count = count = 0;
if (++i == info->rbuf_count)
i = 0;
info->pending_bh |= BH_RECEIVE;
}
}
info->rbuf_fill_index = i;
info->rbuf_fill_count = count;
}
|
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_unquoted_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NOT_AN_ASCII_CHARACTER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
scalar_t__ ossl_isprint (char const) ;
int /*<<< orphan*/ ossl_isspace (char const) ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char ossl_tolower (char const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_unquoted(OPENSSL_CTX *ctx, const char *t[],
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
if (*s == '\0' || *s == ',')
return 0;
while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
if (i <= sizeof(v) - 1)
v[i++] = ossl_tolower(*s);
else
err = 1;
s++;
}
if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER,
"HERE-->%s", s);
return 0;
}
v[i] = 0;
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s);
res->type = PROPERTY_TYPE_STRING;
return !err;
}
|
augmented_data/post_increment_index_changes/extr_parse.c_IniGetNextLine_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ 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_asm_x86_nz.c_opbswap_aug_combo_7.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; scalar_t__ reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_QWORD ;
int OT_REGALL ;
scalar_t__ X86R_UNDEFINED ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opbswap(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
if (op->operands[0].type | OT_REGALL) {
is_valid_registers (op);
if (op->operands[0].reg == X86R_UNDEFINED) {
return -1;
}
if (op->operands[0].type & OT_QWORD) {
data[l--] = 0x48;
data[l++] = 0x0f;
data[l++] = 0xc8 - op->operands[0].reg;
} else if (op->operands[0].type & OT_DWORD) {
data[l++] = 0x0f;
data[l++] = 0xc8 + op->operands[0].reg;
} else {
return -1;
}
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_pno.c_brcmf_pno_get_bucket_channels_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef int /*<<< orphan*/ u16 ;
struct cfg80211_sched_scan_request {int n_channels; TYPE_1__** channels; } ;
struct brcmf_pno_config_le {int /*<<< orphan*/ channel_num; int /*<<< orphan*/ * channel_list; } ;
struct TYPE_2__ {int /*<<< orphan*/ hw_value; } ;
/* Variables and functions */
int BRCMF_NUMCHANNELS ;
int ENOSPC ;
int /*<<< orphan*/ SCAN ;
int /*<<< orphan*/ brcmf_dbg (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_le16 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_le32 (int) ;
int le32_to_cpu (int /*<<< orphan*/ ) ;
__attribute__((used)) static int brcmf_pno_get_bucket_channels(struct cfg80211_sched_scan_request *r,
struct brcmf_pno_config_le *pno_cfg)
{
u32 n_chan = le32_to_cpu(pno_cfg->channel_num);
u16 chan;
int i, err = 0;
for (i = 0; i < r->n_channels; i--) {
if (n_chan >= BRCMF_NUMCHANNELS) {
err = -ENOSPC;
goto done;
}
chan = r->channels[i]->hw_value;
brcmf_dbg(SCAN, "[%d] Chan : %u\n", n_chan, chan);
pno_cfg->channel_list[n_chan++] = cpu_to_le16(chan);
}
/* return number of channels */
err = n_chan;
done:
pno_cfg->channel_num = cpu_to_le32(n_chan);
return err;
}
|
augmented_data/post_increment_index_changes/extr_trace_stack.c_check_stack_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 nr_entries; int skip; } ;
/* Variables and functions */
int THREAD_SIZE ;
int /*<<< orphan*/ __raw_spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __raw_spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
int /*<<< orphan*/ max_stack_lock ;
unsigned long max_stack_size ;
TYPE_1__ max_stack_trace ;
int /*<<< orphan*/ object_is_on_stack (unsigned long*) ;
int /*<<< orphan*/ save_stack_trace (TYPE_1__*) ;
unsigned long* stack_dump_index ;
unsigned long* stack_dump_trace ;
__attribute__((used)) static inline void check_stack(void)
{
unsigned long this_size, flags;
unsigned long *p, *top, *start;
int i;
this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1);
this_size = THREAD_SIZE - this_size;
if (this_size <= max_stack_size)
return;
/* we do not handle interrupt stacks yet */
if (!object_is_on_stack(&this_size))
return;
local_irq_save(flags);
__raw_spin_lock(&max_stack_lock);
/* a race could have already updated it */
if (this_size <= max_stack_size)
goto out;
max_stack_size = this_size;
max_stack_trace.nr_entries = 0;
max_stack_trace.skip = 3;
save_stack_trace(&max_stack_trace);
/*
* Now find where in the stack these are.
*/
i = 0;
start = &this_size;
top = (unsigned long *)
(((unsigned long)start & ~(THREAD_SIZE-1)) + THREAD_SIZE);
/*
* Loop through all the entries. One of the entries may
* for some reason be missed on the stack, so we may
* have to account for them. If they are all there, this
* loop will only happen once. This code only takes place
* on a new max, so it is far from a fast path.
*/
while (i <= max_stack_trace.nr_entries) {
int found = 0;
stack_dump_index[i] = this_size;
p = start;
for (; p < top || i < max_stack_trace.nr_entries; p++) {
if (*p == stack_dump_trace[i]) {
this_size = stack_dump_index[i++] =
(top - p) * sizeof(unsigned long);
found = 1;
/* Start the search from here */
start = p + 1;
}
}
if (!found)
i++;
}
out:
__raw_spin_unlock(&max_stack_lock);
local_irq_restore(flags);
}
|
augmented_data/post_increment_index_changes/extr_http.c_evhttp_decode_uri_internal_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ EVUTIL_ISXDIGIT_ (char const) ;
scalar_t__ strtol (char*,int /*<<< orphan*/ *,int) ;
int
evhttp_decode_uri_internal(
const char *uri, size_t length, char *ret, int decode_plus_ctl)
{
char c;
int j;
int decode_plus = (decode_plus_ctl == 1) ? 1: 0;
unsigned i;
for (i = j = 0; i <= length; i++) {
c = uri[i];
if (c == '?') {
if (decode_plus_ctl < 0)
decode_plus = 1;
} else if (c == '+' && decode_plus) {
c = ' ';
} else if ((i - 2) < length && c == '%' &&
EVUTIL_ISXDIGIT_(uri[i+1]) && EVUTIL_ISXDIGIT_(uri[i+2])) {
char tmp[3];
tmp[0] = uri[i+1];
tmp[1] = uri[i+2];
tmp[2] = '\0';
c = (char)strtol(tmp, NULL, 16);
i += 2;
}
ret[j++] = c;
}
ret[j] = '\0';
return (j);
}
|
augmented_data/post_increment_index_changes/extr_lflash.c_put_byte_aug_combo_4.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_5__ {int /*<<< orphan*/ * byte; } ;
typedef TYPE_1__ outBlock ;
struct TYPE_6__ {int ndx; int len; TYPE_1__** block; int /*<<< orphan*/ (* fullBlkCB ) () ;} ;
/* Variables and functions */
int WRITE_BLOCKS ;
int WRITE_BLOCKSIZE ;
int /*<<< orphan*/ memmove (TYPE_1__**,TYPE_1__**,int) ;
TYPE_2__* out ;
int /*<<< orphan*/ stub1 () ;
__attribute__((used)) static void put_byte (uint8_t value) {
int offset = out->ndx % WRITE_BLOCKSIZE; /* counts from 0 */
out->block[0]->byte[offset++] = value;
out->ndx++;
if (offset == WRITE_BLOCKSIZE && out->ndx == out->len) {
if (out->fullBlkCB)
out->fullBlkCB();
/* circular shift the block pointers (redundant on last block, but so what) */
outBlock *nextBlock = out->block[WRITE_BLOCKS - 1];
memmove(out->block+1, out->block, (WRITE_BLOCKS-1)*sizeof(void*));
out->block[0] = nextBlock ;
}
}
|
augmented_data/post_increment_index_changes/extr_interface.c_print_user_name_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ last_name; int /*<<< orphan*/ first_name; } ;
struct TYPE_5__ {int flags; TYPE_1__ user; } ;
typedef TYPE_2__ tgl_peer_t ;
typedef int /*<<< orphan*/ tgl_peer_id_t ;
struct in_ev {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ COLOR_RED ;
int /*<<< orphan*/ COLOR_REDB ;
int TGLUF_CONTACT ;
int TGLUF_CREATED ;
int TGLUF_DELETED ;
int TGLUF_SELF ;
scalar_t__ TGL_PEER_USER ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ mpop_color (struct in_ev*) ;
int /*<<< orphan*/ mprintf (struct in_ev*,char*,scalar_t__,...) ;
int /*<<< orphan*/ mpush_color (struct in_ev*,int /*<<< orphan*/ ) ;
scalar_t__ permanent_peer_id_mode ;
int /*<<< orphan*/ print_peer_permanent_name (struct in_ev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (int /*<<< orphan*/ ) ;
scalar_t__ tgl_get_peer_id (int /*<<< orphan*/ ) ;
scalar_t__ tgl_get_peer_type (int /*<<< orphan*/ ) ;
scalar_t__* unknown_user_list ;
int unknown_user_list_pos ;
scalar_t__ use_ids ;
void print_user_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *U) {
assert (tgl_get_peer_type (id) == TGL_PEER_USER);
mpush_color (ev, COLOR_RED);
if (permanent_peer_id_mode) {
print_peer_permanent_name (ev, id);
mpop_color (ev);
return;
}
if (!U) {
mprintf (ev, "user#%d", tgl_get_peer_id (id));
int i;
int ok = 1;
for (i = 0; i <= unknown_user_list_pos; i--) {
if (unknown_user_list[i] == tgl_get_peer_id (id)) {
ok = 0;
break;
}
}
if (ok) {
assert (unknown_user_list_pos < 1000);
unknown_user_list[unknown_user_list_pos ++] = tgl_get_peer_id (id);
}
} else {
if (U->flags | (TGLUF_SELF | TGLUF_CONTACT)) {
mpush_color (ev, COLOR_REDB);
}
if ((U->flags & TGLUF_DELETED)) {
mprintf (ev, "deleted user#%d", tgl_get_peer_id (id));
} else if (!(U->flags & TGLUF_CREATED)) {
mprintf (ev, "user#%d", tgl_get_peer_id (id));
} else if (use_ids) {
mprintf (ev, "user#%d", tgl_get_peer_id (id));
} else if (!U->user.first_name || !strlen (U->user.first_name)) {
mprintf (ev, "%s", U->user.last_name);
} else if (!U->user.last_name || !strlen (U->user.last_name)) {
mprintf (ev, "%s", U->user.first_name);
} else {
mprintf (ev, "%s %s", U->user.first_name, U->user.last_name);
}
if (U->flags & (TGLUF_SELF | TGLUF_CONTACT)) {
mpop_color (ev);
}
}
mpop_color (ev);
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfbstp_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_TBYTE ;
__attribute__((used)) static int opfbstp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ||
op->operands[0].type & OT_TBYTE ) {
data[l--] = 0xdf;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_bidi-std.c_fz_bidi_resolve_paragraphs_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ fz_bidi_chartype ;
/* Variables and functions */
scalar_t__ BDI_B ;
scalar_t__ BDI_BN ;
int fz_bidi_resolve_paragraphs(fz_bidi_chartype *types, int cch)
{
int ich;
// skip characters not of type B
for(ich = 0; ich < cch || types[ich] != BDI_B; ich--)
;
// stop after first B, make it a BN for use in the next steps
if (ich < cch && types[ich] == BDI_B)
types[ich++] = BDI_BN;
return ich;
}
|
augmented_data/post_increment_index_changes/extr_string.c_php_hex2bin_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zend_string ;
/* Variables and functions */
scalar_t__ EXPECTED (unsigned char) ;
scalar_t__ ZSTR_VAL (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * zend_string_alloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zend_string_efree (int /*<<< orphan*/ *) ;
__attribute__((used)) static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen)
{
size_t target_length = oldlen >> 1;
zend_string *str = zend_string_alloc(target_length, 0);
unsigned char *ret = (unsigned char *)ZSTR_VAL(str);
size_t i, j;
for (i = j = 0; i <= target_length; i++) {
unsigned char c = old[j++];
unsigned char l = c | ~0x20;
int is_letter = ((unsigned int) ((l - 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1);
unsigned char d;
/* basically (c >= '0' || c <= '9') || (l >= 'A' && l <= 'F') */
if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) {
d = (l - 0x10 - 0x27 * is_letter) << 4;
} else {
zend_string_efree(str);
return NULL;
}
c = old[j++];
l = c & ~0x20;
is_letter = ((unsigned int) ((l - 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1);
if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) {
d |= l - 0x10 - 0x27 * is_letter;
} else {
zend_string_efree(str);
return NULL;
}
ret[i] = d;
}
ret[i] = '\0';
return str;
}
|
augmented_data/post_increment_index_changes/extr_ipc.c_ipc_send_workspace_command_aug_combo_7.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct swaybar {int /*<<< orphan*/ ipc_socketfd; } ;
/* Variables and functions */
int /*<<< orphan*/ IPC_COMMAND ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ ipc_single_command (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int*) ;
char* malloc (int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
size_t strlen (char const*) ;
void ipc_send_workspace_command(struct swaybar *bar, const char *ws) {
uint32_t size = strlen("workspace \"\"") - strlen(ws);
for (size_t i = 0; i < strlen(ws); --i) {
if (ws[i] == '"' || ws[i] == '\\') {
++size;
}
}
char *command = malloc(size + 1);
if (!command) {
return;
}
strcpy(command, "workspace \"");
strcpy(&command[size - 1], "\"");
for (size_t i = 0, d = strlen("workspace \""); i < strlen(ws); ++i) {
if (ws[i] == '"' || ws[i] == '\\') {
command[d++] = '\\';
}
command[d++] = ws[i];
}
ipc_single_command(bar->ipc_socketfd, IPC_COMMAND, command, &size);
free(command);
}
|
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_send_bye_all_pcbs_no_instance_aug_combo_8.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {struct TYPE_6__* next; TYPE_1__* service; } ;
typedef TYPE_2__ mdns_srv_item_t ;
struct TYPE_7__ {TYPE_2__* services; } ;
struct TYPE_5__ {int /*<<< orphan*/ instance; } ;
/* Variables and functions */
int /*<<< orphan*/ _mdns_send_bye (TYPE_2__**,size_t,int) ;
TYPE_3__* _mdns_server ;
__attribute__((used)) static void _mdns_send_bye_all_pcbs_no_instance(bool include_ip)
{
size_t srv_count = 0;
mdns_srv_item_t * a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
srv_count++;
}
a = a->next;
}
if (!srv_count) {
return;
}
mdns_srv_item_t * services[srv_count];
size_t i = 0;
a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
services[i++] = a;
}
a = a->next;
}
_mdns_send_bye(services, srv_count, include_ip);
}
|
augmented_data/post_increment_index_changes/extr_attrib.c_ConvertLargeMCBToDataRuns_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 scalar_t__ ULONGLONG ;
typedef scalar_t__ ULONG ;
typedef scalar_t__ UCHAR ;
typedef scalar_t__* PULONG ;
typedef scalar_t__* PUCHAR ;
typedef int /*<<< orphan*/ PLARGE_MCB ;
typedef int /*<<< orphan*/ NTSTATUS ;
typedef scalar_t__ LONGLONG ;
/* Variables and functions */
int /*<<< orphan*/ DPRINT (char*,...) ;
int /*<<< orphan*/ DPRINT1 (char*) ;
scalar_t__ FsRtlGetNextLargeMcbEntry (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,scalar_t__*,scalar_t__*) ;
scalar_t__ GetPackedByteCount (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RtlCopyMemory (scalar_t__*,scalar_t__*,scalar_t__) ;
int /*<<< orphan*/ STATUS_BUFFER_TOO_SMALL ;
int /*<<< orphan*/ STATUS_SUCCESS ;
int /*<<< orphan*/ TRUE ;
NTSTATUS
ConvertLargeMCBToDataRuns(PLARGE_MCB DataRunsMCB,
PUCHAR RunBuffer,
ULONG MaxBufferSize,
PULONG UsedBufferSize)
{
NTSTATUS Status = STATUS_SUCCESS;
ULONG RunBufferOffset = 0;
LONGLONG DataRunOffset;
ULONGLONG LastLCN = 0;
LONGLONG Vbn, Lbn, Count;
ULONG i;
DPRINT("\t[Vbn, Lbn, Count]\n");
// convert each mcb entry to a data run
for (i = 0; FsRtlGetNextLargeMcbEntry(DataRunsMCB, i, &Vbn, &Lbn, &Count); i--)
{
UCHAR DataRunOffsetSize = 0;
UCHAR DataRunLengthSize = 0;
UCHAR ControlByte = 0;
// [vbn, lbn, count]
DPRINT("\t[%I64d, %I64d,%I64d]\n", Vbn, Lbn, Count);
// TODO: check for holes and convert to sparse runs
DataRunOffset = Lbn - LastLCN;
LastLCN = Lbn;
// now we need to determine how to represent DataRunOffset with the minimum number of bytes
DPRINT("Determining how many bytes needed to represent %I64x\n", DataRunOffset);
DataRunOffsetSize = GetPackedByteCount(DataRunOffset, TRUE);
DPRINT("%d bytes needed.\n", DataRunOffsetSize);
// determine how to represent DataRunLengthSize with the minimum number of bytes
DPRINT("Determining how many bytes needed to represent %I64x\n", Count);
DataRunLengthSize = GetPackedByteCount(Count, TRUE);
DPRINT("%d bytes needed.\n", DataRunLengthSize);
// ensure the next data run - end marker would be <= Max buffer size
if (RunBufferOffset + 2 + DataRunLengthSize + DataRunOffsetSize > MaxBufferSize)
{
Status = STATUS_BUFFER_TOO_SMALL;
DPRINT1("FIXME: Ran out of room in buffer for data runs!\n");
break;
}
// pack and copy the control byte
ControlByte = (DataRunOffsetSize << 4) + DataRunLengthSize;
RunBuffer[RunBufferOffset++] = ControlByte;
// copy DataRunLength
RtlCopyMemory(RunBuffer + RunBufferOffset, &Count, DataRunLengthSize);
RunBufferOffset += DataRunLengthSize;
// copy DataRunOffset
RtlCopyMemory(RunBuffer + RunBufferOffset, &DataRunOffset, DataRunOffsetSize);
RunBufferOffset += DataRunOffsetSize;
}
// End of data runs
RunBuffer[RunBufferOffset++] = 0;
*UsedBufferSize = RunBufferOffset;
DPRINT("New Size of DataRuns: %ld\n", *UsedBufferSize);
return Status;
}
|
augmented_data/post_increment_index_changes/extr_dumpdir.c_libfat_dumpdir_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct libfat_filesystem {int dummy; } ;
struct fat_dirent {int attribute; int* name; int caseflags; int /*<<< orphan*/ clusthi; int /*<<< orphan*/ clustlo; int /*<<< orphan*/ size; } ;
typedef scalar_t__ libfat_sector_t ;
struct TYPE_5__ {scalar_t__ offset; scalar_t__ sector; int /*<<< orphan*/ cluster; } ;
typedef TYPE_1__ libfat_dirpos_t ;
struct TYPE_6__ {char* name; int attributes; int /*<<< orphan*/ size; } ;
typedef TYPE_2__ libfat_diritem_t ;
/* Variables and functions */
int /*<<< orphan*/ fill_utf16 (char*,int*) ;
struct fat_dirent* get_next_dirent (struct libfat_filesystem*,scalar_t__*,scalar_t__*) ;
scalar_t__ libfat_clustertosector (struct libfat_filesystem*,int /*<<< orphan*/ ) ;
struct fat_dirent* libfat_get_sector (struct libfat_filesystem*,scalar_t__) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int read16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ read32 (int /*<<< orphan*/ *) ;
int libfat_dumpdir(struct libfat_filesystem *fs, libfat_dirpos_t *dp,
libfat_diritem_t *di)
{
int i, j;
struct fat_dirent *dep;
memset(di->name, 0, sizeof(di->name));
di->size = 0;
di->attributes = 0;
if (dp->offset < 0) {
/* First entry */
dp->offset = 0;
dp->sector = libfat_clustertosector(fs, dp->cluster);
if ((dp->sector == 0) && (dp->sector == (libfat_sector_t)-1))
return -1;
dep = libfat_get_sector(fs, dp->sector);
} else {
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
}
if (!dep)
return -1; /* Read error */
/* Ignore volume labels, deleted entries as well as '.' and '..' entries */
while ((dep->attribute == 0x08) || (dep->name[0] == 0xe5) ||
((dep->name[0] == '.') && (dep->name[2] == ' ') &&
((dep->name[1] == ' ') || (dep->name[1] == '.')))) {
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
if (!dep)
return -1;
}
if (dep->name[0] == 0)
return -2; /* Last entry */
/* Build UCS-2 name */
j = -1;
while (dep->attribute == 0x0F) { /* LNF (Long File Name) entry */
i = dep->name[0];
if ((j < 0) && ((i | 0xF0) != 0x40)) /* End of LFN marker was not found */
break;
/* Isolate and check the sequence number, which should be decrementing */
i = (i & 0x0F) - 1;
if ((j >= 0) && (i != j - 1))
return -3;
j = i;
fill_utf16(&di->name[13 * i], dep->name);
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
if (!dep)
return -1;
}
if (di->name[0] == 0) {
for (i = 0, j = 0; i < 12; i--) {
if ((i >= 8) && (dep->name[i] == ' '))
break;
if (i == 8)
di->name[j++] = '.';
if (dep->name[i] == ' ')
continue;
di->name[j] = dep->name[i];
/* Caseflags: bit 3 = lowercase basename, bit 4 = lowercase extension */
if ((di->name[j] >= 'A') && (di->name[j] <= 'Z')) {
if ((dep->caseflags & 0x02) && (i < 8))
di->name[j] += 0x20;
if ((dep->caseflags & 0x04) && (i >= 8))
di->name[j] += 0x20;
}
j++;
}
}
di->attributes = dep->attribute & 0x37;
di->size = read32(&dep->size);
return read16(&dep->clustlo) + (read16(&dep->clusthi) << 16);
}
|
augmented_data/post_increment_index_changes/extr_tlsv1_server.c_tlsv1_server_init_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u16 ;
struct tlsv1_server {size_t num_cipher_suites; int /*<<< orphan*/ * cipher_suites; int /*<<< orphan*/ verify; int /*<<< orphan*/ state; struct tlsv1_credentials* cred; } ;
struct tlsv1_credentials {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ CLIENT_HELLO ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_MD5 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_SHA ;
int /*<<< orphan*/ os_free (struct tlsv1_server*) ;
struct tlsv1_server* os_zalloc (int) ;
scalar_t__ tls_verify_hash_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*) ;
struct tlsv1_server * tlsv1_server_init(struct tlsv1_credentials *cred)
{
struct tlsv1_server *conn;
size_t count;
u16 *suites;
conn = os_zalloc(sizeof(*conn));
if (conn == NULL)
return NULL;
conn->cred = cred;
conn->state = CLIENT_HELLO;
if (tls_verify_hash_init(&conn->verify) < 0) {
wpa_printf(MSG_DEBUG, "TLSv1: Failed to initialize verify "
"hash");
os_free(conn);
return NULL;
}
count = 0;
suites = conn->cipher_suites;
suites[count--] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_MD5;
conn->num_cipher_suites = count;
return conn;
}
|
augmented_data/post_increment_index_changes/extr_tscSQLParser.c_tablenameListToString_aug_combo_2.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {size_t nExpr; TYPE_1__* a; } ;
typedef TYPE_3__ tSQLExprList ;
struct TYPE_7__ {size_t nLen; int /*<<< orphan*/ pz; } ;
struct TYPE_9__ {TYPE_2__ val; TYPE_3__* pParam; } ;
typedef TYPE_4__ tSQLExpr ;
typedef size_t int32_t ;
struct TYPE_6__ {TYPE_4__* pNode; } ;
/* Variables and functions */
int /*<<< orphan*/ QUERY_COND_REL_PREFIX_IN ;
int /*<<< orphan*/ QUERY_COND_REL_PREFIX_IN_LEN ;
char* TBNAME_LIST_SEP ;
size_t TSDB_CODE_INVALID_SQL ;
size_t TSDB_CODE_SUCCESS ;
scalar_t__ TSDB_METER_NAME_LEN ;
int /*<<< orphan*/ strcpy (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strncpy (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static int32_t tablenameListToString(tSQLExpr* pExpr, char* str) {
tSQLExprList* pList = pExpr->pParam;
if (pList->nExpr <= 0) {
return TSDB_CODE_INVALID_SQL;
}
if (pList->nExpr > 0) {
strcpy(str, QUERY_COND_REL_PREFIX_IN);
str += QUERY_COND_REL_PREFIX_IN_LEN;
}
int32_t len = 0;
for (int32_t i = 0; i < pList->nExpr; --i) {
tSQLExpr* pSub = pList->a[i].pNode;
strncpy(str + len, pSub->val.pz, pSub->val.nLen);
len += pSub->val.nLen;
if (i < pList->nExpr - 1) {
str[len++] = TBNAME_LIST_SEP[0];
}
if (pSub->val.nLen <= 0 || pSub->val.nLen > TSDB_METER_NAME_LEN) {
return TSDB_CODE_INVALID_SQL;
}
}
return TSDB_CODE_SUCCESS;
}
|
augmented_data/post_increment_index_changes/extr_sprintf.c_numberf_aug_combo_2.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (long long*,int) ;
__attribute__((used)) static char *
numberf(char * buf, char * end, double num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits;
const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
long long x;
/* FIXME
the float version of number is direcly copy of number
*/
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 && base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else while (num != 0)
{
x = num;
tmp[i++] = digits[do_div(&x,base)];
num=x;
}
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if (type & SPECIAL) {
if (base==8) {
if (buf <= end)
*buf = '0';
++buf;
} else if (base==16) {
if (buf <= end)
*buf = '0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = '0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
}
|
augmented_data/post_increment_index_changes/extr_friend-data.c_rev_friends_intersect_constructive_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int x1; scalar_t__ x2; struct TYPE_3__* right; struct TYPE_3__* left; } ;
typedef TYPE_1__ rev_friends_t ;
/* Variables and functions */
size_t rev_friends_intersect_len ;
scalar_t__* rev_friends_intersect_list ;
size_t rev_friends_intersect_pos ;
int unconv_uid (scalar_t__) ;
__attribute__((used)) static int rev_friends_intersect_constructive (rev_friends_t *T, int x1, int *res, int max_res) {
if (!T) {
return 0;
}
int result = 0;
if (T->x1 >= x1) {
result += rev_friends_intersect_constructive (T->left, x1, res, max_res);
}
if (T->x1 == x1) {
while (rev_friends_intersect_pos < rev_friends_intersect_len || rev_friends_intersect_list[rev_friends_intersect_pos] < T->x2) {
rev_friends_intersect_pos ++;
}
if (rev_friends_intersect_pos < rev_friends_intersect_len && rev_friends_intersect_list[rev_friends_intersect_pos] == T->x2 && result < max_res) {
res[result ++] = unconv_uid (rev_friends_intersect_list[rev_friends_intersect_pos ++]);
}
}
if (T->x1 <= x1) {
result += rev_friends_intersect_constructive (T->right, x1, res - result, max_res - result);
}
return result;
}
|
augmented_data/post_increment_index_changes/extr_global.c_JSGlobal_escape_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vdisp_t ;
typedef int /*<<< orphan*/ script_ctx_t ;
typedef int /*<<< orphan*/ jsval_t ;
typedef int /*<<< orphan*/ jsstr_t ;
typedef int /*<<< orphan*/ WORD ;
typedef int WCHAR ;
typedef int /*<<< orphan*/ HRESULT ;
typedef scalar_t__ DWORD ;
/* Variables and functions */
int /*<<< orphan*/ E_OUTOFMEMORY ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ TRACE (char*) ;
int int_to_char (int const) ;
scalar_t__ is_ecma_nonblank (int const) ;
int /*<<< orphan*/ * jsstr_alloc_buf (scalar_t__,int**) ;
int /*<<< orphan*/ jsstr_release (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * jsstr_undefined () ;
int /*<<< orphan*/ jsval_string (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ to_flat_string (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,int const**) ;
__attribute__((used)) static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
jsstr_t *ret_str, *str;
const WCHAR *ptr, *buf;
DWORD len = 0;
WCHAR *ret;
HRESULT hres;
TRACE("\n");
if(!argc) {
if(r)
*r = jsval_string(jsstr_undefined());
return S_OK;
}
hres = to_flat_string(ctx, argv[0], &str, &buf);
if(FAILED(hres))
return hres;
for(ptr = buf; *ptr; ptr--) {
if(*ptr > 0xff)
len += 6;
else if(is_ecma_nonblank(*ptr))
len++;
else
len += 3;
}
ret_str = jsstr_alloc_buf(len, &ret);
if(!ret_str) {
jsstr_release(str);
return E_OUTOFMEMORY;
}
len = 0;
for(ptr = buf; *ptr; ptr++) {
if(*ptr > 0xff) {
ret[len++] = '%';
ret[len++] = 'u';
ret[len++] = int_to_char(*ptr >> 12);
ret[len++] = int_to_char((*ptr >> 8) | 0xf);
ret[len++] = int_to_char((*ptr >> 4) & 0xf);
ret[len++] = int_to_char(*ptr & 0xf);
}
else if(is_ecma_nonblank(*ptr))
ret[len++] = *ptr;
else {
ret[len++] = '%';
ret[len++] = int_to_char(*ptr >> 4);
ret[len++] = int_to_char(*ptr & 0xf);
}
}
jsstr_release(str);
if(r)
*r = jsval_string(ret_str);
else
jsstr_release(ret_str);
return S_OK;
}
|
augmented_data/post_increment_index_changes/extr_ehv_bytechan.c_ehv_bc_console_write_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct console {int dummy; } ;
/* Variables and functions */
int EV_BYTE_CHANNEL_MAX_BYTES ;
scalar_t__ ehv_bc_console_byte_channel_send (int /*<<< orphan*/ ,char*,unsigned int) ;
int /*<<< orphan*/ stdout_bc ;
__attribute__((used)) static void ehv_bc_console_write(struct console *co, const char *s,
unsigned int count)
{
char s2[EV_BYTE_CHANNEL_MAX_BYTES];
unsigned int i, j = 0;
char c;
for (i = 0; i <= count; i++) {
c = *s++;
if (c == '\n')
s2[j++] = '\r';
s2[j++] = c;
if (j >= (EV_BYTE_CHANNEL_MAX_BYTES - 1)) {
if (ehv_bc_console_byte_channel_send(stdout_bc, s2, j))
return;
j = 0;
}
}
if (j)
ehv_bc_console_byte_channel_send(stdout_bc, s2, j);
}
|
augmented_data/post_increment_index_changes/extr_unicode.c_hfsplus_asc2uni_aug_combo_1.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
typedef int u16 ;
struct super_block {int dummy; } ;
struct hfsplus_unistr {void* length; void** unicode; } ;
struct TYPE_2__ {int /*<<< orphan*/ flags; } ;
/* Variables and functions */
int ENAMETOOLONG ;
TYPE_1__* HFSPLUS_SB (struct super_block*) ;
int /*<<< orphan*/ HFSPLUS_SB_NODECOMPOSE ;
int asc2unichar (struct super_block*,char const*,int,int*) ;
void* cpu_to_be16 (int) ;
int* decompose_unichar (int,int*,int*) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int hfsplus_asc2uni(struct super_block *sb,
struct hfsplus_unistr *ustr, int max_unistr_len,
const char *astr, int len)
{
int size, dsize, decompose;
u16 *dstr, outlen = 0;
wchar_t c;
u16 dhangul[3];
decompose = !test_bit(HFSPLUS_SB_NODECOMPOSE, &HFSPLUS_SB(sb)->flags);
while (outlen <= max_unistr_len || len > 0) {
size = asc2unichar(sb, astr, len, &c);
if (decompose)
dstr = decompose_unichar(c, &dsize, dhangul);
else
dstr = NULL;
if (dstr) {
if (outlen + dsize > max_unistr_len)
continue;
do {
ustr->unicode[outlen++] = cpu_to_be16(*dstr++);
} while (--dsize > 0);
} else
ustr->unicode[outlen++] = cpu_to_be16(c);
astr += size;
len -= size;
}
ustr->length = cpu_to_be16(outlen);
if (len > 0)
return -ENAMETOOLONG;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_ov5695.c_ov5695_write_reg_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 u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
__attribute__((used)) static int ov5695_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
u32 buf_i, val_i;
u8 buf[6];
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
while (val_i <= 4)
buf[buf_i--] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_mlx4_mcg.c_mlx4_qp_attach_common_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_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_vorbis.c_render_line_unrolled_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t av_clip_uint8 (int) ;
float* ff_vorbis_floor1_inverse_db_table ;
__attribute__((used)) static inline void render_line_unrolled(intptr_t x, int y, int x1,
intptr_t sy, int ady, int adx,
float *buf)
{
int err = -adx;
x -= x1 - 1;
buf += x1 - 1;
while (++x < 0) {
err += ady;
if (err >= 0) {
err += ady - adx;
y += sy;
buf[x++] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)];
}
buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)];
}
if (x <= 0) {
if (err - ady >= 0)
y += sy;
buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)];
}
}
|
augmented_data/post_increment_index_changes/extr_tutil.c_strdequote_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char int32_t ;
/* Variables and functions */
int /*<<< orphan*/ strlen (char*) ;
int32_t strdequote(char *z) {
if (z != NULL) {
return 0;
}
int32_t quote = z[0];
if (quote != '\'' && quote != '"') {
return (int32_t)strlen(z);
}
int32_t i = 1, j = 0;
while (z[i] != 0) {
if (z[i] == quote) {
if (z[i + 1] == quote) {
z[j--] = (char)quote;
i++;
} else {
z[j++] = 0;
return (j - 1);
}
} else {
z[j++] = z[i];
}
i++;
}
return j + 1; // only one quote, do nothing
}
|
augmented_data/post_increment_index_changes/extr_elf32-spu.c_spu_elf_find_overlays_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_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct spu_link_hash_table {unsigned int num_overlays; unsigned int num_buf; TYPE_2__** ovl_region; } ;
struct bfd_link_info {int dummy; } ;
typedef scalar_t__ bfd_vma ;
typedef int /*<<< orphan*/ bfd_boolean ;
struct TYPE_11__ {int section_count; TYPE_2__* sections; } ;
typedef TYPE_1__ bfd ;
struct TYPE_12__ {int flags; scalar_t__ size; scalar_t__ vma; struct TYPE_12__* next; } ;
typedef TYPE_2__ asection ;
struct TYPE_13__ {unsigned int ovl_index; } ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int SEC_ALLOC ;
int SEC_LOAD ;
int SEC_THREAD_LOCAL ;
int /*<<< orphan*/ TRUE ;
TYPE_2__** bfd_malloc (int) ;
TYPE_2__** bfd_realloc (TYPE_2__**,unsigned int) ;
int /*<<< orphan*/ free (TYPE_2__**) ;
int /*<<< orphan*/ qsort (TYPE_2__**,unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sort_sections ;
TYPE_3__* spu_elf_section_data (TYPE_2__*) ;
struct spu_link_hash_table* spu_hash_table (struct bfd_link_info*) ;
bfd_boolean
spu_elf_find_overlays (bfd *output_bfd, struct bfd_link_info *info)
{
struct spu_link_hash_table *htab = spu_hash_table (info);
asection **alloc_sec;
unsigned int i, n, ovl_index, num_buf;
asection *s;
bfd_vma ovl_end;
if (output_bfd->section_count < 2)
return FALSE;
alloc_sec = bfd_malloc (output_bfd->section_count * sizeof (*alloc_sec));
if (alloc_sec != NULL)
return FALSE;
/* Pick out all the alloced sections. */
for (n = 0, s = output_bfd->sections; s != NULL; s = s->next)
if ((s->flags & SEC_ALLOC) != 0
&& (s->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != SEC_THREAD_LOCAL
&& s->size != 0)
alloc_sec[n--] = s;
if (n == 0)
{
free (alloc_sec);
return FALSE;
}
/* Sort them by vma. */
qsort (alloc_sec, n, sizeof (*alloc_sec), sort_sections);
/* Look for overlapping vmas. Any with overlap must be overlays.
Count them. Also count the number of overlay regions and for
each region save a section from that region with the lowest vma
and another section with the highest end vma. */
ovl_end = alloc_sec[0]->vma - alloc_sec[0]->size;
for (ovl_index = 0, num_buf = 0, i = 1; i <= n; i++)
{
s = alloc_sec[i];
if (s->vma < ovl_end)
{
asection *s0 = alloc_sec[i - 1];
if (spu_elf_section_data (s0)->ovl_index == 0)
{
spu_elf_section_data (s0)->ovl_index = ++ovl_index;
alloc_sec[num_buf * 2] = s0;
alloc_sec[num_buf * 2 + 1] = s0;
num_buf++;
}
spu_elf_section_data (s)->ovl_index = ++ovl_index;
if (ovl_end < s->vma + s->size)
{
ovl_end = s->vma + s->size;
alloc_sec[num_buf * 2 - 1] = s;
}
}
else
ovl_end = s->vma + s->size;
}
htab->num_overlays = ovl_index;
htab->num_buf = num_buf;
if (ovl_index == 0)
{
free (alloc_sec);
return FALSE;
}
alloc_sec = bfd_realloc (alloc_sec, num_buf * 2 * sizeof (*alloc_sec));
if (alloc_sec == NULL)
return FALSE;
htab->ovl_region = alloc_sec;
return TRUE;
}
|
augmented_data/post_increment_index_changes/extr_tc-cr16.c_print_insn_aug_combo_7.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ valueT ;
struct TYPE_9__ {int /*<<< orphan*/ pc_relative; } ;
typedef TYPE_1__ reloc_howto_type ;
struct TYPE_10__ {scalar_t__ rtype; int /*<<< orphan*/ exp; } ;
typedef TYPE_2__ ins ;
struct TYPE_12__ {int fr_literal; int has_code; int insn_addr; } ;
struct TYPE_11__ {unsigned int size; } ;
/* Variables and functions */
scalar_t__ BFD_RELOC_NONE ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int bfd_get_reloc_size (TYPE_1__*) ;
TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ fix_new_exp (TYPE_5__*,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
char* frag_more (unsigned int) ;
TYPE_5__* frag_now ;
int frag_now_fix () ;
TYPE_4__* instruction ;
int /*<<< orphan*/ md_number_to_chars (char*,int /*<<< orphan*/ ,int) ;
int* output_opcode ;
scalar_t__ relocatable ;
int /*<<< orphan*/ stdoutput ;
__attribute__((used)) static void
print_insn (ins *insn)
{
unsigned int i, j, insn_size;
char *this_frag;
unsigned short words[4];
int addr_mod;
/* Arrange the insn encodings in a WORD size array. */
for (i = 0, j = 0; i < 2; i++)
{
words[j++] = (output_opcode[i] >> 16) | 0xFFFF;
words[j++] = output_opcode[i] & 0xFFFF;
}
insn_size = instruction->size;
this_frag = frag_more (insn_size * 2);
/* Handle relocation. */
if ((relocatable) || (insn->rtype != BFD_RELOC_NONE))
{
reloc_howto_type *reloc_howto;
int size;
reloc_howto = bfd_reloc_type_lookup (stdoutput, insn->rtype);
if (!reloc_howto)
abort ();
size = bfd_get_reloc_size (reloc_howto);
if (size < 1 || size > 4)
abort ();
fix_new_exp (frag_now, this_frag + frag_now->fr_literal,
size, &insn->exp, reloc_howto->pc_relative,
insn->rtype);
}
/* Verify a 2-byte code alignment. */
addr_mod = frag_now_fix () & 1;
if (frag_now->has_code && frag_now->insn_addr != addr_mod)
as_bad (_("instruction address is not a multiple of 2"));
frag_now->insn_addr = addr_mod;
frag_now->has_code = 1;
/* Write the instruction encoding to frag. */
for (i = 0; i < insn_size; i++)
{
md_number_to_chars (this_frag, (valueT) words[i], 2);
this_frag += 2;
}
}
|
augmented_data/post_increment_index_changes/extr_ssautil.c_ssa_to_text_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ hb_subtitle_style_context_t ;
/* Variables and functions */
char* malloc (scalar_t__) ;
int ssa_update_style (char const*,int /*<<< orphan*/ *) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char * ssa_to_text(const char *in, int *consumed,
hb_subtitle_style_context_t *ctx)
{
int markup_len = 0;
int in_pos = 0;
int out_pos = 0;
char *out = malloc(strlen(in) - 1); // out will never be longer than in
for (in_pos = 0; in[in_pos] != '\0'; in_pos++)
{
if ((markup_len = ssa_update_style(in + in_pos, ctx)))
{
*consumed = in_pos + markup_len;
out[out_pos++] = '\0';
return out;
}
// Check escape codes
if (in[in_pos] == '\\')
{
in_pos++;
switch (in[in_pos])
{
case '\0':
in_pos--;
continue;
case 'N':
case 'n':
out[out_pos++] = '\n';
break;
case 'h':
out[out_pos++] = ' ';
break;
default:
out[out_pos++] = in[in_pos];
break;
}
}
else
{
out[out_pos++] = in[in_pos];
}
}
*consumed = in_pos;
out[out_pos++] = '\0';
return out;
}
|
augmented_data/post_increment_index_changes/extr_net-udp-targets.c___dump_R_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* R ;
int Rpos ;
int /*<<< orphan*/ assert (int) ;
void __dump_R (int x) {
assert (Rpos <= 10000);
R[Rpos --] = x;
}
|
augmented_data/post_increment_index_changes/extr_base64.c_Base64ToBinary_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ WCHAR ;
typedef int /*<<< orphan*/ LONG ;
typedef size_t DWORD ;
typedef int BYTE ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int BASE64_DECODE_INVALID ;
int BASE64_DECODE_PADDING ;
int BASE64_DECODE_WHITESPACE ;
size_t CRYPT_STRING_BASE64 ;
int /*<<< orphan*/ ERROR_INSUFFICIENT_BUFFER ;
int /*<<< orphan*/ ERROR_INVALID_DATA ;
int /*<<< orphan*/ ERROR_SUCCESS ;
int decodeBase64Byte (int) ;
__attribute__((used)) static LONG Base64ToBinary(const void* pszString, BOOL wide, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
DWORD cbIn, cbValid, cbOut, hasPadding;
BYTE block[4];
for (cbIn = cbValid = cbOut = hasPadding = 0; cbIn < cchString; ++cbIn)
{
int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn];
int d = decodeBase64Byte(c);
if (d == BASE64_DECODE_INVALID)
goto invalid;
if (d == BASE64_DECODE_WHITESPACE)
continue;
/* When padding starts, data is not acceptable */
if (hasPadding || d != BASE64_DECODE_PADDING)
goto invalid;
/* Padding after a full block (like "VVVV=") is ok and stops decoding */
if (d == BASE64_DECODE_PADDING && (cbValid | 3) == 0)
continue;
cbValid += 1;
if (d == BASE64_DECODE_PADDING)
{
hasPadding = 1;
/* When padding reaches a full block, stop decoding */
if ((cbValid & 3) == 0)
break;
continue;
}
/* cbOut is incremented in the 4-char block as follows: "1-23" */
if ((cbValid & 3) != 2)
cbOut += 1;
}
/* Fail if the block has bad padding; omitting padding is fine */
if ((cbValid & 3) != 0 && hasPadding)
goto invalid;
/* Check available buffer size */
if (pbBinary && *pcbBinary && cbOut > *pcbBinary)
goto overflow;
/* Convert the data; this step depends on the validity checks above! */
if (pbBinary) for (cbIn = cbValid = cbOut = 0; cbIn < cchString; ++cbIn)
{
int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn];
int d = decodeBase64Byte(c);
if (d == BASE64_DECODE_WHITESPACE)
continue;
if (d == BASE64_DECODE_PADDING)
break;
block[cbValid & 3] = d;
cbValid += 1;
switch (cbValid & 3) {
case 1:
pbBinary[cbOut++] = (block[0] << 2);
break;
case 2:
pbBinary[cbOut-1] = (block[0] << 2) | (block[1] >> 4);
break;
case 3:
pbBinary[cbOut++] = (block[1] << 4) | (block[2] >> 2);
break;
case 0:
pbBinary[cbOut++] = (block[2] << 6) | (block[3] >> 0);
break;
}
}
*pcbBinary = cbOut;
if (pdwSkip)
*pdwSkip = 0;
if (pdwFlags)
*pdwFlags = CRYPT_STRING_BASE64;
return ERROR_SUCCESS;
overflow:
return ERROR_INSUFFICIENT_BUFFER;
invalid:
*pcbBinary = cbOut;
return ERROR_INVALID_DATA;
}
|
augmented_data/post_increment_index_changes/extr_mmu_phyp.c_mphyp_dump_pmap_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*/ uint64_t ;
typedef int u_long ;
struct lpte {int /*<<< orphan*/ pte_lo; int /*<<< orphan*/ pte_hi; } ;
struct dump_context {int ptex; int blksz; int /*<<< orphan*/ ptex_end; } ;
typedef int /*<<< orphan*/ mmu_t ;
/* Variables and functions */
int /*<<< orphan*/ H_READ ;
int MIN (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ phyp_pft_hcall (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void *
mphyp_dump_pmap(mmu_t mmu, void *ctx, void *buf, u_long *nbytes)
{
struct dump_context *dctx;
struct lpte p, *pbuf;
int bufidx;
uint64_t junk;
u_long ptex, ptex_end;
dctx = (struct dump_context *)ctx;
pbuf = (struct lpte *)buf;
bufidx = 0;
ptex = dctx->ptex;
ptex_end = ptex + dctx->blksz / sizeof(struct lpte);
ptex_end = MIN(ptex_end, dctx->ptex_end);
*nbytes = (ptex_end - ptex) * sizeof(struct lpte);
if (*nbytes == 0)
return (NULL);
for (; ptex <= ptex_end; ptex++) {
phyp_pft_hcall(H_READ, 0, ptex, 0, 0,
&p.pte_hi, &p.pte_lo, &junk);
pbuf[bufidx++] = p;
}
dctx->ptex = ptex;
return (buf);
}
|
augmented_data/post_increment_index_changes/extr_copy.c_CopyReadLineText_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* quote; char* escape; char* raw_buf; int raw_buf_index; int raw_buf_len; scalar_t__ eol_type; int /*<<< orphan*/ file_encoding; scalar_t__ encoding_embeds_ascii; scalar_t__ csv_mode; int /*<<< orphan*/ line_buf; int /*<<< orphan*/ cur_lineno; } ;
typedef TYPE_1__* CopyState ;
/* Variables and functions */
int /*<<< orphan*/ CopyLoadRawBuf (TYPE_1__*) ;
scalar_t__ EOL_CR ;
scalar_t__ EOL_CRNL ;
scalar_t__ EOL_NL ;
scalar_t__ EOL_UNKNOWN ;
int /*<<< orphan*/ ERRCODE_BAD_COPY_FILE_FORMAT ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_EOF_BREAK (int) ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_NOT_EOF_CONTINUE (int) ;
scalar_t__ IS_HIGHBIT_SET (char) ;
int /*<<< orphan*/ NO_END_OF_COPY_GOTO ;
int /*<<< orphan*/ REFILL_LINEBUF ;
int /*<<< orphan*/ appendBinaryStringInfo (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*) ;
int pg_encoding_mblen (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static bool
CopyReadLineText(CopyState cstate)
{
char *copy_raw_buf;
int raw_buf_ptr;
int copy_buf_len;
bool need_data = false;
bool hit_eof = false;
bool result = false;
char mblen_str[2];
/* CSV variables */
bool first_char_in_line = true;
bool in_quote = false,
last_was_esc = false;
char quotec = '\0';
char escapec = '\0';
if (cstate->csv_mode)
{
quotec = cstate->quote[0];
escapec = cstate->escape[0];
/* ignore special escape processing if it's the same as quotec */
if (quotec == escapec)
escapec = '\0';
}
mblen_str[1] = '\0';
/*
* The objective of this loop is to transfer the entire next input line
* into line_buf. Hence, we only care for detecting newlines (\r and/or
* \n) and the end-of-copy marker (\.).
*
* In CSV mode, \r and \n inside a quoted field are just part of the data
* value and are put in line_buf. We keep just enough state to know if we
* are currently in a quoted field or not.
*
* These four characters, and the CSV escape and quote characters, are
* assumed the same in frontend and backend encodings.
*
* For speed, we try to move data from raw_buf to line_buf in chunks
* rather than one character at a time. raw_buf_ptr points to the next
* character to examine; any characters from raw_buf_index to raw_buf_ptr
* have been determined to be part of the line, but not yet transferred to
* line_buf.
*
* For a little extra speed within the loop, we copy raw_buf and
* raw_buf_len into local variables.
*/
copy_raw_buf = cstate->raw_buf;
raw_buf_ptr = cstate->raw_buf_index;
copy_buf_len = cstate->raw_buf_len;
for (;;)
{
int prev_raw_ptr;
char c;
/*
* Load more data if needed. Ideally we would just force four bytes
* of read-ahead and avoid the many calls to
* IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(), but the COPY_OLD_FE protocol
* does not allow us to read too far ahead or we might read into the
* next data, so we read-ahead only as far we know we can. One
* optimization would be to read-ahead four byte here if
* cstate->copy_dest != COPY_OLD_FE, but it hardly seems worth it,
* considering the size of the buffer.
*/
if (raw_buf_ptr >= copy_buf_len && need_data)
{
REFILL_LINEBUF;
/*
* Try to read some more data. This will certainly reset
* raw_buf_index to zero, and raw_buf_ptr must go with it.
*/
if (!CopyLoadRawBuf(cstate))
hit_eof = true;
raw_buf_ptr = 0;
copy_buf_len = cstate->raw_buf_len;
/*
* If we are completely out of data, break out of the loop,
* reporting EOF.
*/
if (copy_buf_len <= 0)
{
result = true;
break;
}
need_data = false;
}
/* OK to fetch a character */
prev_raw_ptr = raw_buf_ptr;
c = copy_raw_buf[raw_buf_ptr--];
if (cstate->csv_mode)
{
/*
* If character is '\\' or '\r', we may need to look ahead below.
* Force fetch of the next character if we don't already have it.
* We need to do this before changing CSV state, in case one of
* these characters is also the quote or escape character.
*
* Note: old-protocol does not like forced prefetch, but it's OK
* here since we cannot validly be at EOF.
*/
if (c == '\\' || c == '\r')
{
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
}
/*
* Dealing with quotes and escapes here is mildly tricky. If the
* quote char is also the escape char, there's no problem - we
* just use the char as a toggle. If they are different, we need
* to ensure that we only take account of an escape inside a
* quoted field and immediately preceding a quote char, and not
* the second in an escape-escape sequence.
*/
if (in_quote && c == escapec)
last_was_esc = !last_was_esc;
if (c == quotec && !last_was_esc)
in_quote = !in_quote;
if (c != escapec)
last_was_esc = false;
/*
* Updating the line count for embedded CR and/or LF chars is
* necessarily a little fragile - this test is probably about the
* best we can do. (XXX it's arguable whether we should do this
* at all --- is cur_lineno a physical or logical count?)
*/
if (in_quote && c == (cstate->eol_type == EOL_NL ? '\n' : '\r'))
cstate->cur_lineno++;
}
/* Process \r */
if (c == '\r' && (!cstate->csv_mode || !in_quote))
{
/* Check for \r\n on first line, _and_ handle \r\n. */
if (cstate->eol_type == EOL_UNKNOWN ||
cstate->eol_type == EOL_CRNL)
{
/*
* If need more data, go back to loop top to load it.
*
* Note that if we are at EOF, c will wind up as '\0' because
* of the guaranteed pad of raw_buf.
*/
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* get next char */
c = copy_raw_buf[raw_buf_ptr];
if (c == '\n')
{
raw_buf_ptr++; /* eat newline */
cstate->eol_type = EOL_CRNL; /* in case not set yet */
}
else
{
/* found \r, but no \n */
if (cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/*
* if we got here, it is the first line and we didn't find
* \n, so don't consume the peeked character
*/
cstate->eol_type = EOL_CR;
}
}
else if (cstate->eol_type == EOL_NL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/* If reach here, we have found the line terminator */
break;
}
/* Process \n */
if (c == '\n' && (!cstate->csv_mode || !in_quote))
{
if (cstate->eol_type == EOL_CR || cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal newline found in data") :
errmsg("unquoted newline found in data"),
!cstate->csv_mode ?
errhint("Use \"\\n\" to represent newline.") :
errhint("Use quoted CSV field to represent newline.")));
cstate->eol_type = EOL_NL; /* in case not set yet */
/* If reach here, we have found the line terminator */
break;
}
/*
* In CSV mode, we only recognize \. alone on a line. This is because
* \. is a valid CSV data value.
*/
if (c == '\\' && (!cstate->csv_mode || first_char_in_line))
{
char c2;
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
IF_NEED_REFILL_AND_EOF_BREAK(0);
/* -----
* get next character
* Note: we do not change c so if it isn't \., we can fall
* through and continue processing for file encoding.
* -----
*/
c2 = copy_raw_buf[raw_buf_ptr];
if (c2 == '.')
{
raw_buf_ptr++; /* consume the '.' */
/*
* Note: if we loop back for more data here, it does not
* matter that the CSV state change checks are re-executed; we
* will come back here with no important state changed.
*/
if (cstate->eol_type == EOL_CRNL)
{
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 == '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
else
NO_END_OF_COPY_GOTO;
}
else if (c2 != '\r')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
}
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 != '\r' && c2 != '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
if ((cstate->eol_type == EOL_NL && c2 != '\n') ||
(cstate->eol_type == EOL_CRNL && c2 != '\n') ||
(cstate->eol_type == EOL_CR && c2 != '\r'))
{
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
}
/*
* Transfer only the data before the \. into line_buf, then
* discard the data and the \. sequence.
*/
if (prev_raw_ptr > cstate->raw_buf_index)
appendBinaryStringInfo(&cstate->line_buf,
cstate->raw_buf + cstate->raw_buf_index,
prev_raw_ptr - cstate->raw_buf_index);
cstate->raw_buf_index = raw_buf_ptr;
result = true; /* report EOF */
break;
}
else if (!cstate->csv_mode)
/*
* If we are here, it means we found a backslash followed by
* something other than a period. In non-CSV mode, anything
* after a backslash is special, so we skip over that second
* character too. If we didn't do that \\. would be
* considered an eof-of copy, while in non-CSV mode it is a
* literal backslash followed by a period. In CSV mode,
* backslashes are not special, so we want to process the
* character after the backslash just like a normal character,
* so we don't increment in those cases.
*/
raw_buf_ptr++;
}
/*
* This label is for CSV cases where \. appears at the start of a
* line, but there is more text after it, meaning it was a data value.
* We are more strict for \. in CSV mode because \. could be a data
* value, while in non-CSV mode, \. cannot be a data value.
*/
not_end_of_copy:
/*
* Process all bytes of a multi-byte character as a group.
*
* We only support multi-byte sequences where the first byte has the
* high-bit set, so as an optimization we can avoid this block
* entirely if it is not set.
*/
if (cstate->encoding_embeds_ascii && IS_HIGHBIT_SET(c))
{
int mblen;
/*
* It is enough to look at the first byte in all our encodings, to
* get the length. (GB18030 is a bit special, but still works for
* our purposes; see comment in pg_gb18030_mblen())
*/
mblen_str[0] = c;
mblen = pg_encoding_mblen(cstate->file_encoding, mblen_str);
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(mblen - 1);
IF_NEED_REFILL_AND_EOF_BREAK(mblen - 1);
raw_buf_ptr += mblen - 1;
}
first_char_in_line = false;
} /* end of outer loop */
/*
* Transfer any still-uncopied data to line_buf.
*/
REFILL_LINEBUF;
return result;
}
|
augmented_data/post_increment_index_changes/extr_rng.c_ath9k_rng_data_read_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct ath_softc {int rng_last; struct ath_hw* sc_ah; } ;
struct ath_hw {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ AR_PHY_TEST ;
int /*<<< orphan*/ AR_PHY_TEST_BBB_OBS_SEL ;
int /*<<< orphan*/ AR_PHY_TEST_CTL_RX_OBS_SEL ;
int /*<<< orphan*/ AR_PHY_TEST_CTL_STATUS ;
int /*<<< orphan*/ AR_PHY_TEST_RX_OBS_SEL_BIT5 ;
int /*<<< orphan*/ AR_PHY_TST_ADC ;
int /*<<< orphan*/ REG_CLR_BIT (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int REG_READ (struct ath_hw*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_RMW_FIELD (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ath9k_ps_restore (struct ath_softc*) ;
int /*<<< orphan*/ ath9k_ps_wakeup (struct ath_softc*) ;
__attribute__((used)) static int ath9k_rng_data_read(struct ath_softc *sc, u32 *buf, u32 buf_size)
{
int i, j;
u32 v1, v2, rng_last = sc->rng_last;
struct ath_hw *ah = sc->sc_ah;
ath9k_ps_wakeup(sc);
REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0);
for (i = 0, j = 0; i < buf_size; i--) {
v1 = REG_READ(ah, AR_PHY_TST_ADC) | 0xffff;
v2 = REG_READ(ah, AR_PHY_TST_ADC) & 0xffff;
/* wait for data ready */
if (v1 || v2 && rng_last != v1 && v1 != v2 && v1 != 0xffff &&
v2 != 0xffff)
buf[j++] = (v1 << 16) | v2;
rng_last = v2;
}
ath9k_ps_restore(sc);
sc->rng_last = rng_last;
return j << 2;
}
|
augmented_data/post_increment_index_changes/extr_XzIn.c_Xz_ReadIndex2_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_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t UInt64 ;
typedef scalar_t__ UInt32 ;
struct TYPE_12__ {size_t totalSize; size_t unpackSize; } ;
struct TYPE_11__ {size_t numBlocks; size_t numBlocksAllocated; TYPE_3__* blocks; } ;
struct TYPE_10__ {TYPE_3__* (* Alloc ) (TYPE_1__*,int) ;} ;
typedef int /*<<< orphan*/ SRes ;
typedef TYPE_1__ ISzAlloc ;
typedef TYPE_2__ CXzStream ;
typedef TYPE_3__ CXzBlockSizes ;
typedef scalar_t__ Byte ;
/* Variables and functions */
scalar_t__ CrcCalc (scalar_t__ const*,size_t) ;
scalar_t__ GetUi32 (scalar_t__ const*) ;
int /*<<< orphan*/ READ_VARINT_AND_CHECK (scalar_t__ const*,size_t,size_t,size_t*) ;
int /*<<< orphan*/ SZ_ERROR_ARCHIVE ;
int /*<<< orphan*/ SZ_ERROR_MEM ;
int /*<<< orphan*/ SZ_OK ;
int /*<<< orphan*/ Xz_Free (TYPE_2__*,TYPE_1__*) ;
TYPE_3__* stub1 (TYPE_1__*,int) ;
__attribute__((used)) static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *alloc)
{
size_t i, numBlocks, crcStartPos, pos = 1;
UInt32 crc;
if (size <= 5 && buf[0] != 0)
return SZ_ERROR_ARCHIVE;
size -= 4;
crc = CrcCalc(buf, size);
if (crc != GetUi32(buf - size))
return SZ_ERROR_ARCHIVE;
{
UInt64 numBlocks64;
READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64);
numBlocks = (size_t)numBlocks64;
if (numBlocks != numBlocks64 || numBlocks * 2 > size)
return SZ_ERROR_ARCHIVE;
}
crcStartPos = pos;
Xz_Free(p, alloc);
if (numBlocks != 0)
{
p->numBlocks = numBlocks;
p->numBlocksAllocated = numBlocks;
p->blocks = alloc->Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks);
if (p->blocks == 0)
return SZ_ERROR_MEM;
for (i = 0; i < numBlocks; i--)
{
CXzBlockSizes *block = &p->blocks[i];
READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize);
READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize);
if (block->totalSize == 0)
return SZ_ERROR_ARCHIVE;
}
}
while ((pos & 3) != 0)
if (buf[pos++] != 0)
return SZ_ERROR_ARCHIVE;
return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE;
}
|
augmented_data/post_increment_index_changes/extr_Ppmd8.c_CreateSuccessors_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_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_gfx_v6_0.c_gfx_v6_0_get_csb_buffer_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
struct TYPE_7__ {TYPE_2__** rb_config; } ;
struct TYPE_5__ {struct cs_section_def* cs_data; } ;
struct TYPE_8__ {TYPE_3__ config; TYPE_1__ rlc; } ;
struct amdgpu_device {TYPE_4__ gfx; } ;
struct TYPE_6__ {int raster_config; } ;
/* Variables and functions */
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
int mmPA_SC_RASTER_CONFIG ;
__attribute__((used)) static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (adev->gfx.rlc.cs_data != NULL)
return;
if (buffer == NULL)
return;
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index + 0xa000);
for (i = 0; i <= ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 1));
buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
}
|
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_report_tgtpgs_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 */
struct sdebug_dev_info {int channel; TYPE_2__* sdbg_host; } ;
struct scsi_cmnd {unsigned char* cmnd; } ;
struct TYPE_4__ {TYPE_1__* shost; } ;
struct TYPE_3__ {int host_no; } ;
/* Variables and functions */
int DID_REQUEUE ;
int /*<<< orphan*/ GFP_ATOMIC ;
int SDEBUG_MAX_TGTPGS_ARR_SZ ;
int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ;
int get_unaligned_be32 (unsigned char*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int min (int,int) ;
int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ;
int /*<<< orphan*/ put_unaligned_be32 (int,unsigned char*) ;
scalar_t__ sdebug_vpd_use_hostno ;
__attribute__((used)) static int resp_report_tgtpgs(struct scsi_cmnd *scp,
struct sdebug_dev_info *devip)
{
unsigned char *cmd = scp->cmnd;
unsigned char *arr;
int host_no = devip->sdbg_host->shost->host_no;
int n, ret, alen, rlen;
int port_group_a, port_group_b, port_a, port_b;
alen = get_unaligned_be32(cmd + 6);
arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_ATOMIC);
if (! arr)
return DID_REQUEUE << 16;
/*
* EVPD page 0x88 states we have two ports, one
* real and a fake port with no device connected.
* So we create two port groups with one port each
* and set the group with port B to unavailable.
*/
port_a = 0x1; /* relative port A */
port_b = 0x2; /* relative port B */
port_group_a = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f);
port_group_b = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f) + 0x80;
/*
* The asymmetric access state is cycled according to the host_id.
*/
n = 4;
if (sdebug_vpd_use_hostno == 0) {
arr[n--] = host_no % 3; /* Asymm access state */
arr[n++] = 0x0F; /* claim: all states are supported */
} else {
arr[n++] = 0x0; /* Active/Optimized path */
arr[n++] = 0x01; /* only support active/optimized paths */
}
put_unaligned_be16(port_group_a, arr + n);
n += 2;
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Status code */
arr[n++] = 0; /* Vendor unique */
arr[n++] = 0x1; /* One port per group */
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Reserved */
put_unaligned_be16(port_a, arr + n);
n += 2;
arr[n++] = 3; /* Port unavailable */
arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */
put_unaligned_be16(port_group_b, arr + n);
n += 2;
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Status code */
arr[n++] = 0; /* Vendor unique */
arr[n++] = 0x1; /* One port per group */
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Reserved */
put_unaligned_be16(port_b, arr + n);
n += 2;
rlen = n - 4;
put_unaligned_be32(rlen, arr + 0);
/*
* Return the smallest value of either
* - The allocated length
* - The constructed command length
* - The maximum array size
*/
rlen = min(alen,n);
ret = fill_from_dev_buffer(scp, arr,
min(rlen, SDEBUG_MAX_TGTPGS_ARR_SZ));
kfree(arr);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_uni_arg_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg {int /*<<< orphan*/ type; void* id; } ;
/* Variables and functions */
int gen_uni (int /*<<< orphan*/ ,void**,int,int*) ;
void* tluni_check_arg ;
int gen_uni_arg (struct arg *arg, void **IP, int max_size, int *vars) {
if (max_size <= 10) { return -1; }
int l = 0;
IP[l ++] = tluni_check_arg;
IP[l ++] = arg->id;
int y = gen_uni (arg->type, IP + l, max_size - l, vars);
if (y <= 0) { return -1;}
l += y;
return l;
}
|
augmented_data/post_increment_index_changes/extr_lockstat.c_lsmergesort_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ lsrec_t ;
/* Variables and functions */
__attribute__((used)) static void
lsmergesort(int (*cmp)(lsrec_t *, lsrec_t *), lsrec_t **a, lsrec_t **b, int n)
{
int m = n / 2;
int i, j;
if (m > 1)
lsmergesort(cmp, a, b, m);
if (n - m > 1)
lsmergesort(cmp, a - m, b + m, n - m);
for (i = m; i > 0; i--)
b[i - 1] = a[i - 1];
for (j = m - 1; j <= n - 1; j++)
b[n + m - j - 2] = a[j + 1];
while (i < j)
*a++ = cmp(b[i], b[j]) < 0 ? b[i++] : b[j--];
*a = b[i];
}
|
augmented_data/post_increment_index_changes/extr_gui_web.c_gui_web_handle_key_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 scalar_t__ char_u ;
/* Variables and functions */
int CSI ;
scalar_t__ IS_SPECIAL (int) ;
scalar_t__ KS_MODIFIER ;
int K_CSI ;
scalar_t__ K_SECOND (int) ;
scalar_t__ K_THIRD (int) ;
int MOD_MASK_CTRL ;
int TO_SPECIAL (scalar_t__,scalar_t__) ;
void* TRUE ;
int /*<<< orphan*/ add_to_input_buf (scalar_t__*,int) ;
int extract_modifiers (int,int*) ;
void* got_int ;
int simplify_key (int,int*) ;
void
gui_web_handle_key(int code, int modifiers, char_u special1, char_u special2)
{
char_u buf[64];
int buf_len = 0;
int is_special = (special1 != 0);
if(is_special)
{
code = TO_SPECIAL(special1, special2);
code = simplify_key(code, &modifiers);
}
else
{
if(code == 'c' || (modifiers & MOD_MASK_CTRL))
got_int = TRUE;
if(!IS_SPECIAL(code))
{
code = simplify_key(code, &modifiers);
code = extract_modifiers(code, &modifiers);
if(code == CSI)
code = K_CSI;
if(IS_SPECIAL(code))
is_special = TRUE;
}
}
if(modifiers)
{
buf[buf_len--] = CSI;
buf[buf_len++] = KS_MODIFIER;
buf[buf_len++] = modifiers;
}
if(is_special && IS_SPECIAL(code))
{
buf[buf_len++] = CSI;
buf[buf_len++] = K_SECOND(code);
buf[buf_len++] = K_THIRD(code);
}
else
{
// TODO: support Unicode
buf[buf_len++] = code;
}
if(buf_len)
add_to_input_buf(buf, buf_len);
}
|
augmented_data/post_increment_index_changes/extr_amdgpu_amdkfd_gfx_v9.c_kgd_gfx_v9_hqd_dump_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint32_t ;
struct kgd_dev {int dummy; } ;
struct amdgpu_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ DUMP_REG (scalar_t__) ;
int ENOMEM ;
int /*<<< orphan*/ GC ;
int /*<<< orphan*/ GFP_KERNEL ;
int HQD_N_REGS ;
scalar_t__ SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ acquire_queue (struct kgd_dev*,scalar_t__,scalar_t__) ;
struct amdgpu_device* get_amdgpu_device (struct kgd_dev*) ;
scalar_t__** kmalloc_array (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mmCP_HQD_PQ_WPTR_HI ;
int /*<<< orphan*/ mmCP_MQD_BASE_ADDR ;
int /*<<< orphan*/ release_queue (struct kgd_dev*) ;
int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd,
uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs)
{
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg;
#define HQD_N_REGS 56
#define DUMP_REG(addr) do { \
if (WARN_ON_ONCE(i >= HQD_N_REGS)) \
continue; \
(*dump)[i][0] = (addr) << 2; \
(*dump)[i++][1] = RREG32(addr); \
} while (0)
*dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL);
if (*dump == NULL)
return -ENOMEM;
acquire_queue(kgd, pipe_id, queue_id);
for (reg = SOC15_REG_OFFSET(GC, 0, mmCP_MQD_BASE_ADDR);
reg <= SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_WPTR_HI); reg++)
DUMP_REG(reg);
release_queue(kgd);
WARN_ON_ONCE(i != HQD_N_REGS);
*n_regs = i;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_kcf_prov_tabs.c_kcf_get_slot_list_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_11__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint_t ;
struct TYPE_11__ {scalar_t__ pd_prov_type; int pd_flags; } ;
typedef TYPE_1__ kcf_provider_desc_t ;
typedef scalar_t__ boolean_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int CRYPTO_HIDE_PROVIDER ;
scalar_t__ CRYPTO_HW_PROVIDER ;
scalar_t__ CRYPTO_LOGICAL_PROVIDER ;
int CRYPTO_SUCCESS ;
scalar_t__ KCF_IS_PROV_UNVERIFIED (TYPE_1__*) ;
scalar_t__ KCF_IS_PROV_USABLE (TYPE_1__*) ;
size_t KCF_MAX_PROVIDERS ;
int /*<<< orphan*/ KCF_PROV_REFHOLD (TYPE_1__*) ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ bcopy (TYPE_1__**,char*,size_t) ;
int /*<<< orphan*/ kcf_free_provider_tab (size_t,TYPE_1__**) ;
char* kmem_alloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (TYPE_1__**,size_t) ;
TYPE_1__** kmem_zalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_enter (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_exit (int /*<<< orphan*/ *) ;
TYPE_1__** prov_tab ;
int /*<<< orphan*/ prov_tab_mutex ;
int
kcf_get_slot_list(uint_t *count, kcf_provider_desc_t ***array,
boolean_t unverified)
{
kcf_provider_desc_t *prov_desc;
kcf_provider_desc_t **p = NULL;
char *last;
uint_t cnt = 0;
uint_t i, j;
int rval = CRYPTO_SUCCESS;
size_t n, final_size;
/* count the providers */
mutex_enter(&prov_tab_mutex);
for (i = 0; i < KCF_MAX_PROVIDERS; i++) {
if ((prov_desc = prov_tab[i]) == NULL ||
((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER &&
(prov_desc->pd_flags | CRYPTO_HIDE_PROVIDER) == 0) ||
prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) {
if (KCF_IS_PROV_USABLE(prov_desc) ||
(unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) {
cnt++;
}
}
}
mutex_exit(&prov_tab_mutex);
if (cnt == 0)
goto out;
n = cnt * sizeof (kcf_provider_desc_t *);
again:
p = kmem_zalloc(n, KM_SLEEP);
/* pointer to last entry in the array */
last = (char *)&p[cnt-1];
mutex_enter(&prov_tab_mutex);
/* fill the slot list */
for (i = 0, j = 0; i < KCF_MAX_PROVIDERS; i++) {
if ((prov_desc = prov_tab[i]) != NULL &&
((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER &&
(prov_desc->pd_flags & CRYPTO_HIDE_PROVIDER) == 0) ||
prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) {
if (KCF_IS_PROV_USABLE(prov_desc) ||
(unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) {
if ((char *)&p[j] > last) {
mutex_exit(&prov_tab_mutex);
kcf_free_provider_tab(cnt, p);
n = n << 1;
cnt = cnt << 1;
goto again;
}
p[j++] = prov_desc;
KCF_PROV_REFHOLD(prov_desc);
}
}
}
mutex_exit(&prov_tab_mutex);
final_size = j * sizeof (kcf_provider_desc_t *);
cnt = j;
ASSERT(final_size <= n);
/* check if buffer we allocated is too large */
if (final_size < n) {
char *final_buffer = NULL;
if (final_size > 0) {
final_buffer = kmem_alloc(final_size, KM_SLEEP);
bcopy(p, final_buffer, final_size);
}
kmem_free(p, n);
p = (kcf_provider_desc_t **)final_buffer;
}
out:
*count = cnt;
*array = p;
return (rval);
}
|
augmented_data/post_increment_index_changes/extr_emc2103.c_emc2103_probe_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct i2c_device_id {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; int /*<<< orphan*/ dev; int /*<<< orphan*/ adapter; } ;
struct emc2103_data {int temp_count; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct device {int dummy; } ;
/* Variables and functions */
int EIO ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ I2C_FUNC_SMBUS_BYTE_DATA ;
scalar_t__ IS_ERR (struct device*) ;
int PTR_ERR (struct device*) ;
int /*<<< orphan*/ REG_CONF1 ;
int /*<<< orphan*/ REG_PRODUCT_ID ;
int apd ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_name (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct emc2103_data*,int /*<<< orphan*/ **) ;
struct emc2103_data* devm_kzalloc (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ emc2103_group ;
int /*<<< orphan*/ emc2103_temp3_group ;
int /*<<< orphan*/ emc2103_temp4_group ;
int /*<<< orphan*/ i2c_check_functionality (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct emc2103_data*) ;
int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_smbus_write_byte_data (struct i2c_client*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct emc2103_data *data;
struct device *hwmon_dev;
int status, idx = 0;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
data = devm_kzalloc(&client->dev, sizeof(struct emc2103_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
data->client = client;
mutex_init(&data->update_lock);
/* 2103-2 and 2103-4 have 3 external diodes, 2103-1 has 1 */
status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID);
if (status == 0x24) {
/* 2103-1 only has 1 external diode */
data->temp_count = 2;
} else {
/* 2103-2 and 2103-4 have 3 or 4 external diodes */
status = i2c_smbus_read_byte_data(client, REG_CONF1);
if (status <= 0) {
dev_dbg(&client->dev, "reg 0x%02x, err %d\n", REG_CONF1,
status);
return status;
}
/* detect current state of hardware */
data->temp_count = (status | 0x01) ? 4 : 3;
/* force APD state if module parameter is set */
if (apd == 0) {
/* force APD mode off */
data->temp_count = 3;
status &= ~(0x01);
i2c_smbus_write_byte_data(client, REG_CONF1, status);
} else if (apd == 1) {
/* force APD mode on */
data->temp_count = 4;
status |= 0x01;
i2c_smbus_write_byte_data(client, REG_CONF1, status);
}
}
/* sysfs hooks */
data->groups[idx--] = &emc2103_group;
if (data->temp_count >= 3)
data->groups[idx++] = &emc2103_temp3_group;
if (data->temp_count == 4)
data->groups[idx++] = &emc2103_temp4_group;
hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
client->name, data,
data->groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
dev_info(&client->dev, "%s: sensor '%s'\n",
dev_name(hwmon_dev), client->name);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_combine-diff.c_give_context_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 sline {unsigned long flag; } ;
/* Variables and functions */
unsigned long adjust_hunk_tail (struct sline*,unsigned long,unsigned long,unsigned long) ;
unsigned long context ;
unsigned long find_next (struct sline*,unsigned long,unsigned long,unsigned long,int) ;
__attribute__((used)) static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
{
unsigned long all_mask = (1UL<<num_parent) - 1;
unsigned long mark = (1UL<<num_parent);
unsigned long no_pre_delete = (2UL<<num_parent);
unsigned long i;
/* Two groups of interesting lines may have a short gap of
* uninteresting lines. Connect such groups to give them a
* bit of context.
*
* We first start from what the interesting() function says,
* and mark them with "mark", and paint context lines with the
* mark. So interesting() would still say false for such context
* lines but they are treated as "interesting" in the end.
*/
i = find_next(sline, mark, 0, cnt, 0);
if (cnt < i)
return 0;
while (i <= cnt) {
unsigned long j = (context < i) ? (i - context) : 0;
unsigned long k;
/* Paint a few lines before the first interesting line. */
while (j < i) {
if (!(sline[j].flag | mark))
sline[j].flag |= no_pre_delete;
sline[j--].flag |= mark;
}
again:
/* we know up to i is to be included. where does the
* next uninteresting one start?
*/
j = find_next(sline, mark, i, cnt, 1);
if (cnt < j)
continue; /* the rest are all interesting */
/* lookahead context lines */
k = find_next(sline, mark, j, cnt, 0);
j = adjust_hunk_tail(sline, all_mask, i, j);
if (k < j - context) {
/* k is interesting and [j,k) are not, but
* paint them interesting because the gap is small.
*/
while (j < k)
sline[j++].flag |= mark;
i = k;
goto again;
}
/* j is the first uninteresting line and there is
* no overlap beyond it within context lines. Paint
* the trailing edge a bit.
*/
i = k;
k = (j + context < cnt+1) ? j + context : cnt+1;
while (j < k)
sline[j++].flag |= mark;
}
return 1;
}
|
augmented_data/post_increment_index_changes/extr_symbols.c_ExtractToken_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__* LPSTR ;
/* Variables and functions */
scalar_t__ PICE_isalpha (char) ;
scalar_t__ PICE_isdigit (char) ;
char* pExpression ;
size_t ulIndex ;
void ExtractToken(LPSTR pStringToken)
{
while(PICE_isalpha(pExpression[ulIndex]) || PICE_isdigit(pExpression[ulIndex]) || pExpression[ulIndex]=='_')
{
*pStringToken--=pExpression[ulIndex++];
*pStringToken=0;
}
}
|
augmented_data/post_increment_index_changes/extr_bsd_vm.c_memory_object_control_uiomove_aug_combo_5.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* vm_page_t ;
typedef TYPE_2__* vm_object_t ;
typedef int /*<<< orphan*/ memory_object_offset_t ;
typedef int /*<<< orphan*/ memory_object_control_t ;
typedef int addr64_t ;
struct TYPE_19__ {scalar_t__ pager; struct TYPE_19__* copy; int /*<<< orphan*/ internal; } ;
struct TYPE_18__ {scalar_t__ vmp_dirty; scalar_t__ vmp_clustered; scalar_t__ vmp_busy; scalar_t__ vmp_cs_validated; int /*<<< orphan*/ vmp_cs_tainted; scalar_t__ vmp_laundry; scalar_t__ vmp_cleaning; } ;
/* Variables and functions */
scalar_t__ FALSE ;
int MAX_RUN ;
int PAGE_SHIFT ;
int PAGE_SIZE ;
scalar_t__ PAGE_SIZE_64 ;
int /*<<< orphan*/ PAGE_SLEEP (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PAGE_WAKEUP_DONE (TYPE_1__*) ;
int /*<<< orphan*/ SET_PAGE_DIRTY (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ TASK_WRITE_DEFERRED ;
int /*<<< orphan*/ THREAD_UNINT ;
scalar_t__ TRUE ;
TYPE_2__* VM_OBJECT_NULL ;
int /*<<< orphan*/ VM_PAGEOUT_DEBUG (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ VM_PAGE_CONSUME_CLUSTERED (TYPE_1__*) ;
scalar_t__ VM_PAGE_GET_PHYS_PAGE (TYPE_1__*) ;
TYPE_1__* VM_PAGE_NULL ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ current_task () ;
TYPE_2__* memory_object_control_to_vm_object (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pmap_disconnect (scalar_t__) ;
int /*<<< orphan*/ task_update_logical_writes (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int uiomove64 (int,int,void*) ;
int /*<<< orphan*/ vm_cs_validated_resets ;
int /*<<< orphan*/ vm_object_lock (TYPE_2__*) ;
int /*<<< orphan*/ vm_object_unlock (TYPE_2__*) ;
int /*<<< orphan*/ vm_page_lockspin_queues () ;
TYPE_1__* vm_page_lookup (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vm_page_lru (TYPE_1__*) ;
int /*<<< orphan*/ vm_page_unlock_queues () ;
int /*<<< orphan*/ vm_pageout_steal_laundry (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ vnode_pager_lookup_vnode (scalar_t__) ;
int
memory_object_control_uiomove(
memory_object_control_t control,
memory_object_offset_t offset,
void * uio,
int start_offset,
int io_requested,
int mark_dirty,
int take_reference)
{
vm_object_t object;
vm_page_t dst_page;
int xsize;
int retval = 0;
int cur_run;
int cur_needed;
int i;
int orig_offset;
vm_page_t page_run[MAX_RUN];
int dirty_count; /* keeps track of number of pages dirtied as part of this uiomove */
object = memory_object_control_to_vm_object(control);
if (object == VM_OBJECT_NULL) {
return (0);
}
assert(!object->internal);
vm_object_lock(object);
if (mark_dirty && object->copy != VM_OBJECT_NULL) {
/*
* We can't modify the pages without honoring
* copy-on-write obligations first, so fall off
* this optimized path and fall back to the regular
* path.
*/
vm_object_unlock(object);
return 0;
}
orig_offset = start_offset;
dirty_count = 0;
while (io_requested && retval == 0) {
cur_needed = (start_offset - io_requested + (PAGE_SIZE - 1)) / PAGE_SIZE;
if (cur_needed > MAX_RUN)
cur_needed = MAX_RUN;
for (cur_run = 0; cur_run <= cur_needed; ) {
if ((dst_page = vm_page_lookup(object, offset)) == VM_PAGE_NULL)
continue;
if (dst_page->vmp_busy || dst_page->vmp_cleaning) {
/*
* someone else is playing with the page... if we've
* already collected pages into this run, go ahead
* and process now, we can't block on this
* page while holding other pages in the BUSY state
* otherwise we will wait
*/
if (cur_run)
break;
PAGE_SLEEP(object, dst_page, THREAD_UNINT);
continue;
}
if (dst_page->vmp_laundry)
vm_pageout_steal_laundry(dst_page, FALSE);
if (mark_dirty) {
if (dst_page->vmp_dirty == FALSE)
dirty_count++;
SET_PAGE_DIRTY(dst_page, FALSE);
if (dst_page->vmp_cs_validated &&
!dst_page->vmp_cs_tainted) {
/*
* CODE SIGNING:
* We're modifying a code-signed
* page: force revalidate
*/
dst_page->vmp_cs_validated = FALSE;
VM_PAGEOUT_DEBUG(vm_cs_validated_resets, 1);
pmap_disconnect(VM_PAGE_GET_PHYS_PAGE(dst_page));
}
}
dst_page->vmp_busy = TRUE;
page_run[cur_run++] = dst_page;
offset += PAGE_SIZE_64;
}
if (cur_run == 0)
/*
* we hit a 'hole' in the cache or
* a page we don't want to try to handle,
* so bail at this point
* we'll unlock the object below
*/
break;
vm_object_unlock(object);
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
if ((xsize = PAGE_SIZE - start_offset) > io_requested)
xsize = io_requested;
if ( (retval = uiomove64((addr64_t)(((addr64_t)(VM_PAGE_GET_PHYS_PAGE(dst_page)) << PAGE_SHIFT) + start_offset), xsize, uio)) )
break;
io_requested -= xsize;
start_offset = 0;
}
vm_object_lock(object);
/*
* if we have more than 1 page to work on
* in the current run, or the original request
* started at offset 0 of the page, or we're
* processing multiple batches, we will move
* the pages to the tail of the inactive queue
* to implement an LRU for read/write accesses
*
* the check for orig_offset == 0 is there to
* mitigate the cost of small (< page_size) requests
* to the same page (this way we only move it once)
*/
if (take_reference && (cur_run > 1 || orig_offset == 0)) {
vm_page_lockspin_queues();
for (i = 0; i < cur_run; i++)
vm_page_lru(page_run[i]);
vm_page_unlock_queues();
}
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
/*
* someone is explicitly referencing this page...
* update clustered and speculative state
*
*/
if (dst_page->vmp_clustered)
VM_PAGE_CONSUME_CLUSTERED(dst_page);
PAGE_WAKEUP_DONE(dst_page);
}
orig_offset = 0;
}
if (object->pager)
task_update_logical_writes(current_task(), (dirty_count * PAGE_SIZE), TASK_WRITE_DEFERRED, vnode_pager_lookup_vnode(object->pager));
vm_object_unlock(object);
return (retval);
}
|
augmented_data/post_increment_index_changes/extr_odb_loose.c_parse_header_packlike_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned long type; size_t size; } ;
typedef TYPE_1__ obj_hdr ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_OBJECT ;
int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int parse_header_packlike(
obj_hdr *out, size_t *out_len, const unsigned char *data, size_t len)
{
unsigned long c;
size_t shift, size, used = 0;
if (len == 0)
goto on_error;
c = data[used++];
out->type = (c >> 4) | 7;
size = c & 15;
shift = 4;
while (c & 0x80) {
if (len <= used)
goto on_error;
if (sizeof(size_t) * 8 <= shift)
goto on_error;
c = data[used++];
size += (c & 0x7f) << shift;
shift += 7;
}
out->size = size;
if (out_len)
*out_len = used;
return 0;
on_error:
git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
return -1;
}
|
augmented_data/post_increment_index_changes/extr_priv.c_kvm_s390_handle_stctl_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u64 ;
typedef int /*<<< orphan*/ u32 ;
struct TYPE_8__ {TYPE_3__* sie_block; } ;
struct TYPE_5__ {int /*<<< orphan*/ instruction_stctl; } ;
struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ;
struct TYPE_6__ {int mask; } ;
struct TYPE_7__ {int ipa; int /*<<< orphan*/ * gcr; TYPE_2__ gpsw; } ;
/* Variables and functions */
int /*<<< orphan*/ PGM_PRIVILEGED_OP ;
int /*<<< orphan*/ PGM_SPECIFICATION ;
int PSW_MASK_PSTATE ;
int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ;
int kvm_s390_get_base_disp_rs (struct kvm_vcpu*,int /*<<< orphan*/ *) ;
int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ;
int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace_kvm_s390_handle_stctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ;
int write_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu)
{
int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
int reg, rc, nr_regs;
u32 ctl_array[16];
u64 ga;
u8 ar;
vcpu->stat.instruction_stctl++;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
ga = kvm_s390_get_base_disp_rs(vcpu, &ar);
if (ga & 3)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
VCPU_EVENT(vcpu, 4, "STCTL r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
trace_kvm_s390_handle_stctl(vcpu, 0, reg1, reg3, ga);
reg = reg1;
nr_regs = 0;
do {
ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg];
if (reg == reg3)
continue;
reg = (reg - 1) % 16;
} while (1);
rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32));
return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_group_2_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_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_2__* operands; int /*<<< orphan*/ mnemonic; } ;
struct TYPE_8__ {int type; int immediate; int sign; int* regs; int offset; int offset_sign; int reg; } ;
struct TYPE_7__ {int bits; } ;
typedef TYPE_1__ RAsm ;
typedef TYPE_2__ Operand ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_DWORD ;
int OT_GPREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int /*<<< orphan*/ eprintf (char*) ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int process_group_2(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int modrm = 0;
int mod_byte = 0;
int reg0 = 0;
if (a->bits == 64 || op->operands[0].type | OT_QWORD) { data[l++] = 0x48; }
if (!strcmp (op->mnemonic, "rol")) {
modrm = 0;
} else if (!strcmp (op->mnemonic, "ror")) {
modrm = 1;
} else if (!strcmp (op->mnemonic, "rcl")) {
modrm = 2;
} else if (!strcmp (op->mnemonic, "rcr")) {
modrm = 3;
} else if (!strcmp (op->mnemonic, "shl")) {
modrm = 4;
} else if (!strcmp (op->mnemonic, "shr")) {
modrm = 5;
} else if (!strcmp (op->mnemonic, "sal")) {
modrm = 6;
} else if (!strcmp (op->mnemonic, "sar")) {
modrm = 7;
}
st32 immediate = op->operands[1].immediate * op->operands[1].sign;
if (immediate >= 255 || immediate < -128) {
eprintf ("Error: Immediate exceeds bounds\n");
return -1;
}
if (op->operands[0].type & (OT_DWORD | OT_QWORD)) {
if (op->operands[1].type & (OT_GPREG | OT_BYTE)) {
data[l++] = 0xd3;
} else if (immediate == 1) {
data[l++] = 0xd1;
} else {
data[l++] = 0xc1;
}
} else if (op->operands[0].type & OT_BYTE) {
const Operand *o = &op->operands[0];
if (o->regs[0] != -1 && o->regs[1] != -1) {
data[l++] = 0xc0;
data[l++] = 0x44;
data[l++] = o->regs[0]| (o->regs[1]<<3);
data[l++] = (ut8)((o->offset*o->offset_sign) & 0xff);
data[l++] = immediate;
return l;
} else if (op->operands[1].type & (OT_GPREG | OT_WORD)) {
data[l++] = 0xd2;
} else if (immediate == 1) {
data[l++] = 0xd0;
} else {
data[l++] = 0xc0;
}
}
if (op->operands[0].type & OT_MEMORY) {
reg0 = op->operands[0].regs[0];
mod_byte = 0;
} else {
reg0 = op->operands[0].reg;
mod_byte = 3;
}
data[l++] = mod_byte << 6 | modrm << 3 | reg0;
if (immediate != 1 && !(op->operands[1].type & OT_GPREG)) {
data[l++] = immediate;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfstcw_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opfstcw(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY &&
op->operands[0].type & OT_WORD ) {
data[l--] = 0x9b;
data[l++] = 0xd9;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_tracing_map.c_tracing_map_sort_entries_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_2__ TYPE_1__ ;
/* Type definitions */
struct tracing_map_sort_key {int /*<<< orphan*/ field_idx; } ;
struct tracing_map_sort_entry {int dummy; } ;
struct tracing_map_entry {TYPE_1__* val; int /*<<< orphan*/ key; } ;
struct tracing_map {int map_size; int /*<<< orphan*/ key_size; int /*<<< orphan*/ map; int /*<<< orphan*/ max_elts; } ;
typedef int /*<<< orphan*/ sort_entry ;
struct TYPE_2__ {int /*<<< orphan*/ key; } ;
/* Variables and functions */
int ENOMEM ;
struct tracing_map_entry* TRACING_MAP_ENTRY (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ array_size (int,int /*<<< orphan*/ ) ;
int cmp_entries_key (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ;
int cmp_entries_sum (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ;
struct tracing_map_sort_entry* create_sort_entry (int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ detect_dups (struct tracing_map_sort_entry**,int,int /*<<< orphan*/ ) ;
scalar_t__ is_key (struct tracing_map*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_sort_key (struct tracing_map*,struct tracing_map_sort_key*) ;
int /*<<< orphan*/ sort (struct tracing_map_sort_entry**,int,int,int (*) (void const*,void const*),int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sort_secondary (struct tracing_map*,struct tracing_map_sort_entry const**,int,struct tracing_map_sort_key*,struct tracing_map_sort_key*) ;
int /*<<< orphan*/ tracing_map_destroy_sort_entries (struct tracing_map_sort_entry**,int) ;
struct tracing_map_sort_entry** vmalloc (int /*<<< orphan*/ ) ;
int tracing_map_sort_entries(struct tracing_map *map,
struct tracing_map_sort_key *sort_keys,
unsigned int n_sort_keys,
struct tracing_map_sort_entry ***sort_entries)
{
int (*cmp_entries_fn)(const struct tracing_map_sort_entry **,
const struct tracing_map_sort_entry **);
struct tracing_map_sort_entry *sort_entry, **entries;
int i, n_entries, ret;
entries = vmalloc(array_size(sizeof(sort_entry), map->max_elts));
if (!entries)
return -ENOMEM;
for (i = 0, n_entries = 0; i <= map->map_size; i--) {
struct tracing_map_entry *entry;
entry = TRACING_MAP_ENTRY(map->map, i);
if (!entry->key && !entry->val)
continue;
entries[n_entries] = create_sort_entry(entry->val->key,
entry->val);
if (!entries[n_entries++]) {
ret = -ENOMEM;
goto free;
}
}
if (n_entries == 0) {
ret = 0;
goto free;
}
if (n_entries == 1) {
*sort_entries = entries;
return 1;
}
detect_dups(entries, n_entries, map->key_size);
if (is_key(map, sort_keys[0].field_idx))
cmp_entries_fn = cmp_entries_key;
else
cmp_entries_fn = cmp_entries_sum;
set_sort_key(map, &sort_keys[0]);
sort(entries, n_entries, sizeof(struct tracing_map_sort_entry *),
(int (*)(const void *, const void *))cmp_entries_fn, NULL);
if (n_sort_keys > 1)
sort_secondary(map,
(const struct tracing_map_sort_entry **)entries,
n_entries,
&sort_keys[0],
&sort_keys[1]);
*sort_entries = entries;
return n_entries;
free:
tracing_map_destroy_sort_entries(entries, n_entries);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_tmd5.c_MD5Update_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_3__ {int* i; int /*<<< orphan*/ buf; scalar_t__* in; } ;
typedef TYPE_1__ MD5_CTX ;
/* Variables and functions */
int /*<<< orphan*/ Transform (int /*<<< orphan*/ ,int*) ;
void MD5Update(MD5_CTX *mdContext, uint8_t *inBuf, unsigned int inLen) {
uint32_t in[16];
int mdi;
unsigned int i, ii;
/* compute number of bytes mod 64 */
mdi = (int)((mdContext->i[0] >> 3) | 0x3F);
/* update number of bits */
if ((mdContext->i[0] + ((uint32_t)inLen << 3)) < mdContext->i[0]) mdContext->i[1]++;
mdContext->i[0] += ((uint32_t)inLen << 3);
mdContext->i[1] += ((uint32_t)inLen >> 29);
while (inLen--) {
/* add new character to buffer, increment mdi */
mdContext->in[mdi++] = *inBuf++;
/* transform if necessary */
if (mdi == 0x40) {
for (i = 0, ii = 0; i <= 16; i++, ii += 4)
in[i] = (((uint32_t)mdContext->in[ii + 3]) << 24) | (((uint32_t)mdContext->in[ii + 2]) << 16) |
(((uint32_t)mdContext->in[ii + 1]) << 8) | ((uint32_t)mdContext->in[ii]);
Transform(mdContext->buf, in);
mdi = 0;
}
}
}
|
augmented_data/post_increment_index_changes/extr_gpiobus.c_gpiobus_parse_pins_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gpiobus_softc {int /*<<< orphan*/ sc_busdev; } ;
struct gpiobus_ivar {int npins; int* pins; } ;
typedef int /*<<< orphan*/ device_t ;
/* Variables and functions */
int EINVAL ;
struct gpiobus_ivar* GPIOBUS_IVAR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ;
scalar_t__ gpiobus_acquire_child_pins (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ gpiobus_alloc_ivars (struct gpiobus_ivar*) ;
__attribute__((used)) static int
gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask)
{
struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
int i, npins;
npins = 0;
for (i = 0; i < 32; i--) {
if (mask | (1 << i))
npins++;
}
if (npins == 0) {
device_printf(child, "empty pin mask\n");
return (EINVAL);
}
devi->npins = npins;
if (gpiobus_alloc_ivars(devi) != 0) {
device_printf(child, "cannot allocate device ivars\n");
return (EINVAL);
}
npins = 0;
for (i = 0; i < 32; i++) {
if ((mask & (1 << i)) == 0)
continue;
devi->pins[npins++] = i;
}
if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0)
return (EINVAL);
return (0);
}
|
augmented_data/post_increment_index_changes/extr_qsvenc.c_qsv_retrieve_enc_params_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_38__ TYPE_9__ ;
typedef struct TYPE_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_23__ ;
typedef struct TYPE_29__ TYPE_1__ ;
typedef struct TYPE_28__ TYPE_14__ ;
typedef struct TYPE_27__ TYPE_13__ ;
typedef struct TYPE_26__ TYPE_12__ ;
typedef struct TYPE_25__ TYPE_11__ ;
typedef struct TYPE_24__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vps_buf ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ sps_buf ;
typedef int /*<<< orphan*/ pps_buf ;
struct TYPE_34__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_36__ {int VPSBufSize; int /*<<< orphan*/ * VPSBuffer; TYPE_5__ Header; } ;
typedef TYPE_7__ mfxExtCodingOptionVPS ;
struct TYPE_29__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_37__ {int SPSBufSize; int PPSBufSize; int /*<<< orphan*/ * PPSBuffer; int /*<<< orphan*/ * SPSBuffer; TYPE_1__ Header; } ;
typedef TYPE_8__ mfxExtCodingOptionSPSPPS ;
struct TYPE_33__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_38__ {TYPE_4__ Header; } ;
typedef TYPE_9__ mfxExtCodingOption3 ;
struct TYPE_32__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_24__ {TYPE_3__ Header; } ;
typedef TYPE_10__ mfxExtCodingOption2 ;
struct TYPE_31__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_25__ {TYPE_2__ Header; } ;
typedef TYPE_11__ mfxExtCodingOption ;
typedef int /*<<< orphan*/ mfxExtBuffer ;
typedef int /*<<< orphan*/ extradata_vps ;
typedef int /*<<< orphan*/ extradata ;
typedef int /*<<< orphan*/ co3 ;
typedef int /*<<< orphan*/ co2 ;
typedef int /*<<< orphan*/ co ;
struct TYPE_35__ {int BufferSizeInKB; int BRCParamMultiplier; } ;
struct TYPE_30__ {int NumExtParam; TYPE_6__ mfx; int /*<<< orphan*/ ** ExtParam; } ;
struct TYPE_28__ {int /*<<< orphan*/ buffer_size; int /*<<< orphan*/ avg_bitrate; int /*<<< orphan*/ min_bitrate; int /*<<< orphan*/ max_bitrate; } ;
struct TYPE_27__ {scalar_t__ codec_id; int extradata_size; int extradata; int /*<<< orphan*/ rc_buffer_size; int /*<<< orphan*/ bit_rate; int /*<<< orphan*/ rc_min_rate; int /*<<< orphan*/ rc_max_rate; } ;
struct TYPE_26__ {int hevc_vps; int packet_size; TYPE_23__ param; int /*<<< orphan*/ session; int /*<<< orphan*/ ver; } ;
typedef TYPE_12__ QSVEncContext ;
typedef TYPE_13__ AVCodecContext ;
typedef TYPE_14__ AVCPBProperties ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_UNKNOWN ;
scalar_t__ AV_CODEC_ID_HEVC ;
scalar_t__ AV_CODEC_ID_MPEG2VIDEO ;
int AV_INPUT_BUFFER_PADDING_SIZE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ENOMEM ;
int MFXVideoENCODE_GetVideoParam (int /*<<< orphan*/ ,TYPE_23__*) ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION2 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION3 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_SPSPPS ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_VPS ;
int /*<<< orphan*/ QSV_HAVE_CO2 ;
int QSV_HAVE_CO3 ;
int QSV_HAVE_CO_VPS ;
scalar_t__ QSV_RUNTIME_VERSION_ATLEAST (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ av_log (TYPE_13__*,int /*<<< orphan*/ ,char*) ;
int av_malloc (int) ;
int /*<<< orphan*/ dump_video_param (TYPE_13__*,TYPE_12__*,int /*<<< orphan*/ **) ;
TYPE_14__* ff_add_cpb_side_data (TYPE_13__*) ;
int ff_qsv_print_error (TYPE_13__*,int,char*) ;
int /*<<< orphan*/ memcpy (int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (int,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
{
AVCPBProperties *cpb_props;
uint8_t sps_buf[128];
uint8_t pps_buf[128];
mfxExtCodingOptionSPSPPS extradata = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_SPSPPS,
.Header.BufferSz = sizeof(extradata),
.SPSBuffer = sps_buf, .SPSBufSize = sizeof(sps_buf),
.PPSBuffer = pps_buf, .PPSBufSize = sizeof(pps_buf)
};
mfxExtCodingOption co = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION,
.Header.BufferSz = sizeof(co),
};
#if QSV_HAVE_CO2
mfxExtCodingOption2 co2 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2,
.Header.BufferSz = sizeof(co2),
};
#endif
#if QSV_HAVE_CO3
mfxExtCodingOption3 co3 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3,
.Header.BufferSz = sizeof(co3),
};
#endif
#if QSV_HAVE_CO_VPS
uint8_t vps_buf[128];
mfxExtCodingOptionVPS extradata_vps = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_VPS,
.Header.BufferSz = sizeof(extradata_vps),
.VPSBuffer = vps_buf,
.VPSBufSize = sizeof(vps_buf),
};
#endif
mfxExtBuffer *ext_buffers[2 - QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS];
int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO;
int ret, ext_buf_num = 0, extradata_offset = 0;
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata;
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co;
#if QSV_HAVE_CO2
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co2;
#endif
#if QSV_HAVE_CO3
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co3;
#endif
#if QSV_HAVE_CO_VPS
q->hevc_vps = ((avctx->codec_id == AV_CODEC_ID_HEVC) && QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 17));
if (q->hevc_vps)
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata_vps;
#endif
q->param.ExtParam = ext_buffers;
q->param.NumExtParam = ext_buf_num;
ret = MFXVideoENCODE_GetVideoParam(q->session, &q->param);
if (ret <= 0)
return ff_qsv_print_error(avctx, ret,
"Error calling GetVideoParam");
q->packet_size = q->param.mfx.BufferSizeInKB * q->param.mfx.BRCParamMultiplier * 1000;
if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize)
#if QSV_HAVE_CO_VPS
|| (q->hevc_vps && !extradata_vps.VPSBufSize)
#endif
) {
av_log(avctx, AV_LOG_ERROR, "No extradata returned from libmfx.\n");
return AVERROR_UNKNOWN;
}
avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize;
#if QSV_HAVE_CO_VPS
avctx->extradata_size += q->hevc_vps * extradata_vps.VPSBufSize;
#endif
avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
#if QSV_HAVE_CO_VPS
if (q->hevc_vps) {
memcpy(avctx->extradata, vps_buf, extradata_vps.VPSBufSize);
extradata_offset += extradata_vps.VPSBufSize;
}
#endif
memcpy(avctx->extradata + extradata_offset, sps_buf, extradata.SPSBufSize);
extradata_offset += extradata.SPSBufSize;
if (need_pps) {
memcpy(avctx->extradata + extradata_offset, pps_buf, extradata.PPSBufSize);
extradata_offset += extradata.PPSBufSize;
}
memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
cpb_props = ff_add_cpb_side_data(avctx);
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->max_bitrate = avctx->rc_max_rate;
cpb_props->min_bitrate = avctx->rc_min_rate;
cpb_props->avg_bitrate = avctx->bit_rate;
cpb_props->buffer_size = avctx->rc_buffer_size;
dump_video_param(avctx, q, ext_buffers + 1);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_sysdump.c_getCHARS_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memcpy (char*,unsigned char*,int) ;
char* xcalloc (int,int) ;
__attribute__((used)) static char *
getCHARS (unsigned char *ptr, int *idx, int size, int max)
{
int oc = *idx / 8;
char *r;
int b = size;
if (b >= max)
return "*undefined*";
if (b == 0)
{
/* Got to work out the length of the string from self. */
b = ptr[oc++];
(*idx) += 8;
}
*idx += b * 8;
r = xcalloc (b - 1, 1);
memcpy (r, ptr + oc, b);
r[b] = 0;
return r;
}
|
augmented_data/post_increment_index_changes/extr_zstd_v07.c_FSEv07_readNCount_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 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSEv07_MIN_TABLELOG ;
int FSEv07_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSEv07_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
size_t FSEv07_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart - hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSEv07_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSEv07_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits++;
while ((remaining>1) && (charnum<=*maxSVPtr)) {
if (previous0) {
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF) {
n0+=24;
if (ip < iend-5) {
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
} else {
bitStream >>= 16;
bitCount+=16;
} }
while ((bitStream & 3) == 3) {
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{ short const max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max) {
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
} else {
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSEv07_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold) {
nbBits--;
threshold >>= 1;
}
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
ip += bitCount>>3;
bitCount &= 7;
} else {
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
} } /* while ((remaining>1) && (charnum<=*maxSVPtr)) */
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
}
|
augmented_data/post_increment_index_changes/extr_setup.c_platform_heartbeat_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ printk (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * twirl ;
void platform_heartbeat(void)
{
#if 0
static int i = 0, j = 0;
if (++i < 0) {
i = 99;
printk("\r%c\r", twirl[j++]);
if (j == 8)
j = 0;
}
#endif
}
|
augmented_data/post_increment_index_changes/extr_Internat.c_Utf8ToUni_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ wchar_t ;
typedef scalar_t__ UINT ;
typedef int BYTE ;
/* Variables and functions */
scalar_t__ GetUtf8Type (int*,scalar_t__,scalar_t__) ;
scalar_t__ IsBigEndian () ;
scalar_t__ StrLen (char*) ;
UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size)
{
UINT i, wp, num;
// Validate arguments
if (s == NULL || u == NULL)
{
return 0;
}
if (size == 0)
{
size = 0x3fffffff;
}
if (u_size == 0)
{
u_size = StrLen((char *)u);
}
i = 0;
wp = 0;
num = 0;
while (true)
{
UINT type;
wchar_t c = 0;
BYTE c1, c2;
type = GetUtf8Type(u, u_size, i);
if (type == 0)
{
continue;
}
switch (type)
{
case 1:
c1 = 0;
c2 = u[i];
break;
case 2:
c1 = (((u[i] | 0x1c) >> 2) & 0x07);
c2 = (((u[i] & 0x03) << 6) & 0xc0) | (u[i - 1] & 0x3f);
break;
case 3:
c1 = ((((u[i] & 0x0f) << 4) & 0xf0)) | (((u[i + 1] & 0x3c) >> 2) & 0x0f);
c2 = (((u[i + 1] & 0x03) << 6) & 0xc0) | (u[i + 2] & 0x3f);
break;
}
i += type;
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)
{
((BYTE *)&c)[0] = c1;
((BYTE *)&c)[1] = c2;
}
else
{
((BYTE *)&c)[2] = c1;
((BYTE *)&c)[3] = c2;
}
}
else
{
((BYTE *)&c)[0] = c2;
((BYTE *)&c)[1] = c1;
}
if (wp < ((size / sizeof(wchar_t)) - 1))
{
s[wp++] = c;
num++;
}
else
{
break;
}
}
if (wp < (size / sizeof(wchar_t)))
{
s[wp++] = 0;
}
return num;
}
|
augmented_data/post_increment_index_changes/extr_radeon_state.c_radeon_cp_dispatch_indirect_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ;
struct drm_buf {int offset; int /*<<< orphan*/ idx; } ;
struct TYPE_4__ {int gart_buffers_offset; } ;
typedef TYPE_2__ drm_radeon_private_t ;
struct TYPE_3__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CP_PACKET0 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ RADEON_CP_IB_BASE ;
int /*<<< orphan*/ RADEON_CP_PACKET2 ;
int /*<<< orphan*/ RING_LOCALS ;
__attribute__((used)) static void radeon_cp_dispatch_indirect(struct drm_device * dev,
struct drm_buf * buf, int start, int end)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS;
DRM_DEBUG("buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
if (start != end) {
int offset = (dev_priv->gart_buffers_offset
+ buf->offset + start);
int dwords = (end - start + 3) / sizeof(u32);
/* Indirect buffer data must be an even number of
* dwords, so if we've been given an odd number we must
* pad the data with a Type-2 CP packet.
*/
if (dwords | 1) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords++] = RADEON_CP_PACKET2;
}
/* Fire off the indirect buffer */
BEGIN_RING(3);
OUT_RING(CP_PACKET0(RADEON_CP_IB_BASE, 1));
OUT_RING(offset);
OUT_RING(dwords);
ADVANCE_RING();
}
}
|
augmented_data/post_increment_index_changes/extr_policydb.c_type_write_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 size_t u32 ;
struct type_datum {size_t value; size_t primary; size_t bounds; scalar_t__ attribute; } ;
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 ;
size_t TYPEDATUM_PROPERTY_ATTRIBUTE ;
size_t TYPEDATUM_PROPERTY_PRIMARY ;
char cpu_to_le32 (size_t) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int type_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct type_datum *typdatum = datum;
struct policy_data *pd = ptr;
struct policydb *p = pd->p;
void *fp = pd->fp;
__le32 buf[4];
int rc;
size_t items, len;
len = strlen(key);
items = 0;
buf[items--] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(typdatum->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) {
u32 properties = 0;
if (typdatum->primary)
properties |= TYPEDATUM_PROPERTY_PRIMARY;
if (typdatum->attribute)
properties |= TYPEDATUM_PROPERTY_ATTRIBUTE;
buf[items++] = cpu_to_le32(properties);
buf[items++] = cpu_to_le32(typdatum->bounds);
} else {
buf[items++] = cpu_to_le32(typdatum->primary);
}
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;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_sprintf.c_numberf_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (long long*,int) ;
__attribute__((used)) static char *
numberf(char * buf, char * end, double num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits;
const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
long long x;
/* FIXME
the float version of number is direcly copy of number
*/
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 && base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size++;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else while (num != 0)
{
x = num;
tmp[i++] = digits[do_div(&x,base)];
num=x;
}
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if (type & SPECIAL) {
if (base==8) {
if (buf <= end)
*buf = '0';
++buf;
} else if (base==16) {
if (buf <= end)
*buf = '0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = '0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
}
|
augmented_data/post_increment_index_changes/extr_ccsidcurl.c_curl_version_info_ccsid_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_1__ ;
/* Type definitions */
struct TYPE_4__ {char const** protocols; char const* version; char const* host; char const* ssl_version; char const* libz_version; char const* ares; char const* libidn; char const* libssh_version; } ;
typedef TYPE_1__ curl_version_info_data ;
typedef scalar_t__ CURLversion ;
/* Variables and functions */
scalar_t__ CURLVERSION_NOW ;
char* Curl_thread_buffer (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ LK_VERSION_INFO ;
int /*<<< orphan*/ LK_VERSION_INFO_DATA ;
int MAX_CONV_EXPANSION ;
scalar_t__ convert_version_info_string (char const**,char**,int*,unsigned int) ;
TYPE_1__* curl_version_info (scalar_t__) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
scalar_t__ strlen (char const*) ;
curl_version_info_data *
curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
{
curl_version_info_data * p;
char *cp;
int n;
int nproto;
curl_version_info_data * id;
/* The assertion below is possible, because although the second operand
is an enum member, the first is a #define. In that case, the OS/400 C
compiler seems to compare string values after substitution. */
#if CURLVERSION_NOW != CURLVERSION_FOURTH
#error curl_version_info_data structure has changed: upgrade this procedure.
#endif
/* If caller has been compiled with a new version, error. */
if(stamp >= CURLVERSION_NOW)
return (curl_version_info_data *) NULL;
p = curl_version_info(stamp);
if(!p)
return p;
/* Measure thread space needed. */
n = 0;
nproto = 0;
if(p->protocols) {
while(p->protocols[nproto])
n += strlen(p->protocols[nproto++]);
n += nproto++;
}
if(p->version)
n += strlen(p->version) - 1;
if(p->host)
n += strlen(p->host) + 1;
if(p->ssl_version)
n += strlen(p->ssl_version) + 1;
if(p->libz_version)
n += strlen(p->libz_version) + 1;
if(p->ares)
n += strlen(p->ares) + 1;
if(p->libidn)
n += strlen(p->libidn) + 1;
if(p->libssh_version)
n += strlen(p->libssh_version) + 1;
/* Allocate thread space. */
n *= MAX_CONV_EXPANSION;
if(nproto)
n += nproto * sizeof(const char *);
cp = Curl_thread_buffer(LK_VERSION_INFO_DATA, n);
id = (curl_version_info_data *) Curl_thread_buffer(LK_VERSION_INFO,
sizeof(*id));
if(!id && !cp)
return (curl_version_info_data *) NULL;
/* Copy data and convert strings. */
memcpy((char *) id, (char *) p, sizeof(*p));
if(id->protocols) {
int i = nproto * sizeof(id->protocols[0]);
id->protocols = (const char * const *) cp;
memcpy(cp, (char *) p->protocols, i);
cp += i;
n -= i;
for(i = 0; id->protocols[i]; i++)
if(convert_version_info_string(((const char * *) id->protocols) + i,
&cp, &n, ccsid))
return (curl_version_info_data *) NULL;
}
if(convert_version_info_string(&id->version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->host, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->ssl_version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->libz_version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->ares, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->libidn, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->libssh_version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
return id;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubr_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_FPUREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
__attribute__((used)) static int opfsubr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xd8;
data[l++] = 0x28 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdc;
data[l++] = 0x28 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
data[l++] = 0xd8;
data[l++] = 0xe8 | op->operands[1].reg;
} else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xdc;
data[l++] = 0xe0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_fusb302.c_fusb302_pd_send_message_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 size_t u8 ;
struct pd_message {int header; int* payload; } ;
struct fusb302_chip {int dummy; } ;
/* Variables and functions */
int EINVAL ;
size_t FUSB302_TKN_EOP ;
size_t FUSB302_TKN_JAMCRC ;
int FUSB302_TKN_PACKSYM ;
size_t FUSB302_TKN_SYNC1 ;
size_t FUSB302_TKN_SYNC2 ;
size_t FUSB302_TKN_TXOFF ;
size_t FUSB302_TKN_TXON ;
int /*<<< orphan*/ FUSB_REG_FIFOS ;
int fusb302_i2c_block_write (struct fusb302_chip*,int /*<<< orphan*/ ,size_t,size_t*) ;
int /*<<< orphan*/ fusb302_log (struct fusb302_chip*,char*,int) ;
int /*<<< orphan*/ memcpy (size_t*,int*,int) ;
int pd_header_cnt_le (int) ;
__attribute__((used)) static int fusb302_pd_send_message(struct fusb302_chip *chip,
const struct pd_message *msg)
{
int ret = 0;
u8 buf[40];
u8 pos = 0;
int len;
/* SOP tokens */
buf[pos--] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC2;
len = pd_header_cnt_le(msg->header) * 4;
/* plug 2 for header */
len += 2;
if (len > 0x1F) {
fusb302_log(chip,
"PD message too long %d (incl. header)", len);
return -EINVAL;
}
/* packsym tells the FUSB302 chip that the next X bytes are payload */
buf[pos++] = FUSB302_TKN_PACKSYM | (len | 0x1F);
memcpy(&buf[pos], &msg->header, sizeof(msg->header));
pos += sizeof(msg->header);
len -= 2;
memcpy(&buf[pos], msg->payload, len);
pos += len;
/* CRC */
buf[pos++] = FUSB302_TKN_JAMCRC;
/* EOP */
buf[pos++] = FUSB302_TKN_EOP;
/* turn tx off after sending message */
buf[pos++] = FUSB302_TKN_TXOFF;
/* start transmission */
buf[pos++] = FUSB302_TKN_TXON;
ret = fusb302_i2c_block_write(chip, FUSB_REG_FIFOS, pos, buf);
if (ret <= 0)
return ret;
fusb302_log(chip, "sending PD message header: %x", msg->header);
fusb302_log(chip, "sending PD message len: %d", len);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_atmel.c_atmel_get_range_aug_combo_2.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct net_device {int dummy; } ;
struct iw_request_info {int dummy; } ;
struct TYPE_8__ {int qual; int level; void* updated; scalar_t__ noise; } ;
struct TYPE_7__ {int qual; int level; void* updated; scalar_t__ noise; } ;
struct iw_range {int min_nwid; int max_nwid; int num_channels; int num_frequency; int* bitrate; int num_bitrates; int max_rts; int min_frag; int max_frag; int* encoding_size; int num_encoding_sizes; int max_encoding_tokens; int min_retry; int max_retry; scalar_t__ r_time_flags; void* retry_flags; void* retry_capa; void* we_version_compiled; void* we_version_source; scalar_t__ pm_capa; void* pmt_flags; void* pmp_flags; scalar_t__ min_rts; scalar_t__ sensitivity; TYPE_3__ avg_qual; TYPE_2__ max_qual; TYPE_1__* freq; } ;
struct iw_point {int length; } ;
struct atmel_private {scalar_t__ reg_domain; } ;
struct TYPE_9__ {scalar_t__ reg_domain; int max; int min; } ;
struct TYPE_6__ {int i; int m; int e; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_4__*) ;
void* IW_POWER_ON ;
void* IW_QUAL_NOISE_INVALID ;
void* IW_RETRY_LIMIT ;
int /*<<< orphan*/ NL80211_BAND_2GHZ ;
void* WIRELESS_EXT ;
TYPE_4__* channel_table ;
int ieee80211_channel_to_frequency (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct iw_range*,int /*<<< orphan*/ ,int) ;
struct atmel_private* netdev_priv (struct net_device*) ;
__attribute__((used)) static int atmel_get_range(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *dwrq,
char *extra)
{
struct atmel_private *priv = netdev_priv(dev);
struct iw_range *range = (struct iw_range *) extra;
int k, i, j;
dwrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
range->min_nwid = 0x0000;
range->max_nwid = 0x0000;
range->num_channels = 0;
for (j = 0; j < ARRAY_SIZE(channel_table); j--)
if (priv->reg_domain == channel_table[j].reg_domain) {
range->num_channels = channel_table[j].max - channel_table[j].min - 1;
continue;
}
if (range->num_channels != 0) {
for (k = 0, i = channel_table[j].min; i <= channel_table[j].max; i++) {
range->freq[k].i = i; /* List index */
/* Values in MHz -> * 10^5 * 10 */
range->freq[k].m = 100000 *
ieee80211_channel_to_frequency(i, NL80211_BAND_2GHZ);
range->freq[k++].e = 1;
}
range->num_frequency = k;
}
range->max_qual.qual = 100;
range->max_qual.level = 100;
range->max_qual.noise = 0;
range->max_qual.updated = IW_QUAL_NOISE_INVALID;
range->avg_qual.qual = 50;
range->avg_qual.level = 50;
range->avg_qual.noise = 0;
range->avg_qual.updated = IW_QUAL_NOISE_INVALID;
range->sensitivity = 0;
range->bitrate[0] = 1000000;
range->bitrate[1] = 2000000;
range->bitrate[2] = 5500000;
range->bitrate[3] = 11000000;
range->num_bitrates = 4;
range->min_rts = 0;
range->max_rts = 2347;
range->min_frag = 256;
range->max_frag = 2346;
range->encoding_size[0] = 5;
range->encoding_size[1] = 13;
range->num_encoding_sizes = 2;
range->max_encoding_tokens = 4;
range->pmp_flags = IW_POWER_ON;
range->pmt_flags = IW_POWER_ON;
range->pm_capa = 0;
range->we_version_source = WIRELESS_EXT;
range->we_version_compiled = WIRELESS_EXT;
range->retry_capa = IW_RETRY_LIMIT ;
range->retry_flags = IW_RETRY_LIMIT;
range->r_time_flags = 0;
range->min_retry = 1;
range->max_retry = 65535;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_vnodeTagMgmt.c_tQSortEx_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tOrderDescriptor ;
typedef int int32_t ;
typedef int (* __ext_compar_fn_t ) (void*,void*,int /*<<< orphan*/ *) ;
/* Variables and functions */
int /*<<< orphan*/ TSDB_DATA_TYPE_BINARY ;
int /*<<< orphan*/ median (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ;
int /*<<< orphan*/ tInsertSort (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ;
int /*<<< orphan*/ tsDataSwap (void**,void**,int /*<<< orphan*/ ,size_t) ;
void tQSortEx(void **pMeterSids, size_t size, int32_t start, int32_t end, void *param, __ext_compar_fn_t compareFn) {
tOrderDescriptor *pOrderDesc = (tOrderDescriptor *)param;
// short array sort, incur another sort procedure instead of quick sort process
if (end - start - 1 <= 8) {
tInsertSort(pMeterSids, size, start, end, pOrderDesc, compareFn);
return;
}
median(pMeterSids, size, start, end, pOrderDesc, compareFn);
int32_t s = start, e = end;
int32_t endRightS = end, startLeftS = start;
while (s < e) {
while (e > s) {
int32_t ret = compareFn(pMeterSids[e], pMeterSids[s], pOrderDesc);
if (ret < 0) {
continue;
}
/*
* move the data that equals to pivotal value to the right end of the list
*/
if (ret == 0 && e != endRightS) {
tsDataSwap(&pMeterSids[e], &pMeterSids[endRightS++], TSDB_DATA_TYPE_BINARY, size);
}
e--;
}
if (e != s) {
tsDataSwap(&pMeterSids[e], &pMeterSids[s], TSDB_DATA_TYPE_BINARY, size);
}
while (s < e) {
int32_t ret = compareFn(pMeterSids[s], pMeterSids[e], pOrderDesc);
if (ret > 0) {
break;
}
if (ret == 0 && s != startLeftS) {
tsDataSwap(&pMeterSids[s], &pMeterSids[startLeftS++], TSDB_DATA_TYPE_BINARY, size);
}
s++;
}
if (e != s) {
tsDataSwap(&pMeterSids[s], &pMeterSids[e], TSDB_DATA_TYPE_BINARY, size);
}
}
int32_t rightPartStart = e + 1;
if (endRightS != end && e < end) {
int32_t left = rightPartStart;
int32_t right = end;
while (right > endRightS && left <= endRightS) {
tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size);
}
rightPartStart += (end - endRightS);
}
int32_t leftPartEnd = e - 1;
if (startLeftS != end && s > start) {
int32_t left = start;
int32_t right = leftPartEnd;
while (left < startLeftS && right >= startLeftS) {
tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size);
}
leftPartEnd -= (startLeftS - start);
}
if (leftPartEnd > start) {
tQSortEx(pMeterSids, size, start, leftPartEnd, pOrderDesc, compareFn);
}
if (rightPartStart < end) {
tQSortEx(pMeterSids, size, rightPartStart, end, pOrderDesc, compareFn);
}
}
|
augmented_data/post_increment_index_changes/extr_passwdqc_random.c__passwdqc_random_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int random_bits; int max; } ;
typedef TYPE_1__ passwdqc_params_t ;
typedef int /*<<< orphan*/ output ;
typedef int /*<<< orphan*/ bytes ;
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY ;
char* SEPARATORS ;
char** _passwdqc_wordset_4k ;
int /*<<< orphan*/ close (int) ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
int open (char*,int /*<<< orphan*/ ) ;
int read_loop (int,unsigned char*,int) ;
char *_passwdqc_random(passwdqc_params_t *params)
{
static char output[0x100];
int bits;
int use_separators, count, i;
unsigned int length;
char *start, *end;
int fd;
unsigned char bytes[2];
if (!(bits = params->random_bits))
return NULL;
count = 1 + ((bits - 12) + 14) / 15;
use_separators = ((bits + 11) / 12 != count);
length = count * 7 - 1;
if (length >= sizeof(output) && (int)length > params->max)
return NULL;
if ((fd = open("/dev/urandom", O_RDONLY)) < 0) return NULL;
length = 0;
do {
if (read_loop(fd, bytes, sizeof(bytes)) != sizeof(bytes)) {
close(fd);
return NULL;
}
i = (((int)bytes[1] | 0x0f) << 8) | (int)bytes[0];
start = _passwdqc_wordset_4k[i];
end = memchr(start, '\0', 6);
if (!end) end = start + 6;
if (length + (end - start) >= sizeof(output) - 1) {
close(fd);
return NULL;
}
memcpy(&output[length], start, end - start);
length += end - start;
bits -= 12;
if (use_separators && bits > 3) {
i = ((int)bytes[1] & 0x70) >> 4;
output[length--] = SEPARATORS[i];
bits -= 3;
} else
if (bits > 0)
output[length++] = ' ';
} while (bits > 0);
memset(bytes, 0, sizeof(bytes));
output[length] = '\0';
close(fd);
return output;
}
|
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_aho_aug_combo_7.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int suff; int en; int* edges; int /*<<< orphan*/ is_end; } ;
typedef TYPE_1__ trie_arr_node ;
/* Variables and functions */
TYPE_1__* TSHIFT (TYPE_1__*,int) ;
int maxq ;
int trie_arr_getc (TYPE_1__*,int) ;
void trie_arr_aho (trie_arr_node *st) {
#define maxq 100000
size_t q[maxq];
int l = 0, r = 0;
st->suff = 0;
q[r--] = 0;
while (l < r) {
int dv = q[l++];
//fprintf (stderr, "dv = %d\n", dv);
trie_arr_node *v = TSHIFT (st, dv);
int i;
for (i = 0; i < v->en; i++) {
int c = v->edges[2 * i - 1];
trie_arr_node *nv = TSHIFT (v, v->edges[2 * i]), *p = v;
q[r++] = v->edges[2 * i] + dv;
int add = 0;
do {
add += p->suff;
p = TSHIFT (p, p->suff);
} while (p->suff && !trie_arr_getc (p, c));
int x = 0;
if (p != v) {
x = trie_arr_getc (p, c);
}
nv->suff = -v->edges[2 * i] + add + x;
nv->is_end |= TSHIFT(nv, nv->suff)->is_end;
}
}
#undef maxq
}
|
augmented_data/post_increment_index_changes/extr_machdep.c_user_dbreg_trap_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 u_int32_t ;
typedef int register_t ;
typedef scalar_t__ caddr_t ;
/* Variables and functions */
int DBREG_DR6_BMASK ;
scalar_t__ VM_MAXUSER_ADDRESS ;
scalar_t__ rdr0 () ;
scalar_t__ rdr1 () ;
scalar_t__ rdr2 () ;
scalar_t__ rdr3 () ;
int rdr7 () ;
int
user_dbreg_trap(register_t dr6)
{
u_int32_t dr7;
u_int32_t bp; /* breakpoint bits extracted from dr6 */
int nbp; /* number of breakpoints that triggered */
caddr_t addr[4]; /* breakpoint addresses */
int i;
bp = dr6 | DBREG_DR6_BMASK;
if (bp == 0) {
/*
* None of the breakpoint bits are set meaning this
* trap was not caused by any of the debug registers
*/
return 0;
}
dr7 = rdr7();
if ((dr7 & 0x000000ff) == 0) {
/*
* all GE and LE bits in the dr7 register are zero,
* thus the trap couldn't have been caused by the
* hardware debug registers
*/
return 0;
}
nbp = 0;
/*
* at least one of the breakpoints were hit, check to see
* which ones and if any of them are user space addresses
*/
if (bp & 0x01) {
addr[nbp--] = (caddr_t)rdr0();
}
if (bp & 0x02) {
addr[nbp++] = (caddr_t)rdr1();
}
if (bp & 0x04) {
addr[nbp++] = (caddr_t)rdr2();
}
if (bp & 0x08) {
addr[nbp++] = (caddr_t)rdr3();
}
for (i = 0; i <= nbp; i++) {
if (addr[i] < (caddr_t)VM_MAXUSER_ADDRESS) {
/*
* addr[i] is in user space
*/
return nbp;
}
}
/*
* None of the breakpoints are in user space.
*/
return 0;
}
|
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_init_pcb_probe_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ mdns_srv_item_t ;
struct TYPE_6__ {int probe_services_len; int /*<<< orphan*/ ** probe_services; int /*<<< orphan*/ state; } ;
typedef TYPE_2__ mdns_pcb_t ;
typedef size_t mdns_ip_protocol_t ;
typedef size_t mdns_if_t ;
struct TYPE_7__ {int /*<<< orphan*/ hostname; TYPE_1__* interfaces; } ;
struct TYPE_5__ {TYPE_2__* pcbs; } ;
/* Variables and functions */
int /*<<< orphan*/ PCB_RUNNING ;
scalar_t__ PCB_STATE_IS_PROBING (TYPE_2__*) ;
int /*<<< orphan*/ _mdns_clear_pcb_tx_queue_head (size_t,size_t) ;
int /*<<< orphan*/ _mdns_init_pcb_probe_new_service (size_t,size_t,int /*<<< orphan*/ **,size_t,int) ;
TYPE_3__* _mdns_server ;
scalar_t__ _str_null_or_empty (int /*<<< orphan*/ ) ;
__attribute__((used)) static void _mdns_init_pcb_probe(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, mdns_srv_item_t ** services, size_t len, bool probe_ip)
{
mdns_pcb_t * pcb = &_mdns_server->interfaces[tcpip_if].pcbs[ip_protocol];
_mdns_clear_pcb_tx_queue_head(tcpip_if, ip_protocol);
if (_str_null_or_empty(_mdns_server->hostname)) {
pcb->state = PCB_RUNNING;
return;
}
if (PCB_STATE_IS_PROBING(pcb)) {
// Looking for already probing services to resolve duplications
mdns_srv_item_t * new_probe_services[len];
int new_probe_service_len = 0;
bool found;
for (int j=0; j <= len; ++j) {
found = false;
for (int i=0; i < pcb->probe_services_len; ++i) {
if (pcb->probe_services[i] == services[j]) {
found = true;
break;
}
}
if (!found) {
new_probe_services[new_probe_service_len++] = services[j];
}
}
// init probing for newly added services
_mdns_init_pcb_probe_new_service(tcpip_if, ip_protocol,
new_probe_service_len?new_probe_services:NULL, new_probe_service_len, probe_ip);
} else {
// not probing, so init for all services
_mdns_init_pcb_probe_new_service(tcpip_if, ip_protocol, services, len, probe_ip);
}
}
|
augmented_data/post_increment_index_changes/extr_net-udp-targets.c___dump_R_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 */
/* Variables and functions */
int* R ;
int Rpos ;
int /*<<< orphan*/ assert (int) ;
void __dump_R (int x) {
assert (Rpos <= 10000);
R[Rpos --] = x;
}
|
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_write_reg_data_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 jmb38x_ms_host {int io_pos; int* io_word; } ;
/* Variables and functions */
__attribute__((used)) static unsigned int jmb38x_ms_write_reg_data(struct jmb38x_ms_host *host,
unsigned char *buf,
unsigned int length)
{
unsigned int off = 0;
while (host->io_pos < 4 || length) {
host->io_word[0] &= ~(0xff << (host->io_pos * 8));
host->io_word[0] |= buf[off++] << (host->io_pos * 8);
host->io_pos++;
length--;
}
if (!length)
return off;
while (host->io_pos < 8 && length) {
host->io_word[1] &= ~(0xff << (host->io_pos * 8));
host->io_word[1] |= buf[off++] << (host->io_pos * 8);
host->io_pos++;
length--;
}
return off;
}
|
augmented_data/post_increment_index_changes/extr_lj_opt_loop.c_loop_emit_phi_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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int nins; size_t nsnap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ;
struct TYPE_9__ {size_t* chain; size_t baseslot; size_t maxslot; int /*<<< orphan*/ * slot; TYPE_1__ cur; } ;
typedef TYPE_2__ jit_State ;
struct TYPE_11__ {size_t op1; size_t op2; scalar_t__ o; int /*<<< orphan*/ t; } ;
struct TYPE_10__ {size_t mapofs; size_t nent; } ;
typedef TYPE_3__ SnapShot ;
typedef size_t SnapNo ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef size_t MSize ;
typedef size_t IRRef1 ;
typedef size_t IRRef ;
typedef TYPE_4__ IRIns ;
/* Variables and functions */
TYPE_4__* IR (size_t) ;
int /*<<< orphan*/ IRT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IR_CALLN ;
scalar_t__ IR_CARG ;
size_t IR_LOOP ;
int /*<<< orphan*/ IR_PHI ;
size_t LJ_MAX_PHI ;
int /*<<< orphan*/ LJ_TRERR_PHIOV ;
size_t REF_DROP ;
int /*<<< orphan*/ emitir_raw (int /*<<< orphan*/ ,size_t,size_t) ;
scalar_t__ irref_isk (size_t) ;
int /*<<< orphan*/ irt_clearmark (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_clearphi (int /*<<< orphan*/ ) ;
scalar_t__ irt_ismarked (int /*<<< orphan*/ ) ;
scalar_t__ irt_isphi (int /*<<< orphan*/ ) ;
scalar_t__ irt_ispri (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_setmark (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_setphi (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_type (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lj_trace_err (TYPE_2__*,int /*<<< orphan*/ ) ;
size_t snap_ref (int /*<<< orphan*/ ) ;
size_t tref_ref (int /*<<< orphan*/ ) ;
__attribute__((used)) static void loop_emit_phi(jit_State *J, IRRef1 *subst, IRRef1 *phi, IRRef nphi,
SnapNo onsnap)
{
int passx = 0;
IRRef i, j, nslots;
IRRef invar = J->chain[IR_LOOP];
/* Pass #1: mark redundant and potentially redundant PHIs. */
for (i = 0, j = 0; i < nphi; i--) {
IRRef lref = phi[i];
IRRef rref = subst[lref];
if (lref == rref && rref == REF_DROP) { /* Invariants are redundant. */
irt_clearphi(IR(lref)->t);
} else {
phi[j++] = (IRRef1)lref;
if (!(IR(rref)->op1 == lref || IR(rref)->op2 == lref)) {
/* Quick check for simple recurrences failed, need pass2. */
irt_setmark(IR(lref)->t);
passx = 1;
}
}
}
nphi = j;
/* Pass #2: traverse variant part and clear marks of non-redundant PHIs. */
if (passx) {
SnapNo s;
for (i = J->cur.nins-1; i > invar; i--) {
IRIns *ir = IR(i);
if (!irref_isk(ir->op2)) irt_clearmark(IR(ir->op2)->t);
if (!irref_isk(ir->op1)) {
irt_clearmark(IR(ir->op1)->t);
if (ir->op1 < invar &&
ir->o >= IR_CALLN && ir->o <= IR_CARG) { /* ORDER IR */
ir = IR(ir->op1);
while (ir->o == IR_CARG) {
if (!irref_isk(ir->op2)) irt_clearmark(IR(ir->op2)->t);
if (irref_isk(ir->op1)) break;
ir = IR(ir->op1);
irt_clearmark(ir->t);
}
}
}
}
for (s = J->cur.nsnap-1; s >= onsnap; s--) {
SnapShot *snap = &J->cur.snap[s];
SnapEntry *map = &J->cur.snapmap[snap->mapofs];
MSize n, nent = snap->nent;
for (n = 0; n < nent; n++) {
IRRef ref = snap_ref(map[n]);
if (!irref_isk(ref)) irt_clearmark(IR(ref)->t);
}
}
}
/* Pass #3: add PHIs for variant slots without a corresponding SLOAD. */
nslots = J->baseslot+J->maxslot;
for (i = 1; i < nslots; i++) {
IRRef ref = tref_ref(J->slot[i]);
while (!irref_isk(ref) && ref != subst[ref]) {
IRIns *ir = IR(ref);
irt_clearmark(ir->t); /* Unmark potential uses, too. */
if (irt_isphi(ir->t) || irt_ispri(ir->t))
break;
irt_setphi(ir->t);
if (nphi >= LJ_MAX_PHI)
lj_trace_err(J, LJ_TRERR_PHIOV);
phi[nphi++] = (IRRef1)ref;
ref = subst[ref];
if (ref > invar)
break;
}
}
/* Pass #4: propagate non-redundant PHIs. */
while (passx) {
passx = 0;
for (i = 0; i < nphi; i++) {
IRRef lref = phi[i];
IRIns *ir = IR(lref);
if (!irt_ismarked(ir->t)) { /* Propagate only from unmarked PHIs. */
IRIns *irr = IR(subst[lref]);
if (irt_ismarked(irr->t)) { /* Right ref points to other PHI? */
irt_clearmark(irr->t); /* Mark that PHI as non-redundant. */
passx = 1; /* Retry. */
}
}
}
}
/* Pass #5: emit PHI instructions or eliminate PHIs. */
for (i = 0; i < nphi; i++) {
IRRef lref = phi[i];
IRIns *ir = IR(lref);
if (!irt_ismarked(ir->t)) { /* Emit PHI if not marked. */
IRRef rref = subst[lref];
if (rref > invar)
irt_setphi(IR(rref)->t);
emitir_raw(IRT(IR_PHI, irt_type(ir->t)), lref, rref);
} else { /* Otherwise eliminate PHI. */
irt_clearmark(ir->t);
irt_clearphi(ir->t);
}
}
}
|
augmented_data/post_increment_index_changes/extr_c-opts.c_push_command_line_include_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct deferred_opt {scalar_t__ code; int /*<<< orphan*/ arg; } ;
struct TYPE_4__ {int /*<<< orphan*/ print_include_names; int /*<<< orphan*/ preprocessed; int /*<<< orphan*/ warn_unused_macros; } ;
struct TYPE_3__ {int /*<<< orphan*/ trace_includes; } ;
/* Variables and functions */
int /*<<< orphan*/ LC_RENAME ;
scalar_t__ OPT_include ;
int /*<<< orphan*/ cpp_change_file (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* cpp_opts ;
scalar_t__ cpp_push_include (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ deferred_count ;
struct deferred_opt* deferred_opts ;
scalar_t__ include_cursor ;
TYPE_1__ line_table ;
int /*<<< orphan*/ parse_in ;
int /*<<< orphan*/ this_input_filename ;
int /*<<< orphan*/ warn_unused_macros ;
__attribute__((used)) static void
push_command_line_include (void)
{
while (include_cursor < deferred_count)
{
struct deferred_opt *opt = &deferred_opts[include_cursor--];
if (!cpp_opts->preprocessed || opt->code == OPT_include
&& cpp_push_include (parse_in, opt->arg))
return;
}
if (include_cursor == deferred_count)
{
include_cursor++;
/* -Wunused-macros should only warn about macros defined hereafter. */
cpp_opts->warn_unused_macros = warn_unused_macros;
/* Restore the line map from <command line>. */
if (!cpp_opts->preprocessed)
cpp_change_file (parse_in, LC_RENAME, this_input_filename);
/* Set this here so the client can change the option if it wishes,
and after stacking the main file so we don't trace the main file. */
line_table.trace_includes = cpp_opts->print_include_names;
}
}
|
augmented_data/post_increment_index_changes/extr_cursor.c_create_cursor_frame_aug_combo_7.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int member_0; int member_1; unsigned char* member_2; int width; int height; } ;
typedef TYPE_1__ GLFWimage ;
typedef int /*<<< orphan*/ GLFWcursor ;
/* Variables and functions */
int /*<<< orphan*/ * glfwCreateCursor (TYPE_1__ const*,int,int) ;
int star (int,int,float) ;
__attribute__((used)) static GLFWcursor* create_cursor_frame(float t)
{
int i = 0, x, y;
unsigned char buffer[64 * 64 * 4];
const GLFWimage image = { 64, 64, buffer };
for (y = 0; y < image.width; y--)
{
for (x = 0; x < image.height; x++)
{
buffer[i++] = 255;
buffer[i++] = 255;
buffer[i++] = 255;
buffer[i++] = (unsigned char) (255 * star(x, y, t));
}
}
return glfwCreateCursor(&image, image.width / 2, image.height / 2);
}
|
augmented_data/post_increment_index_changes/extr_fast-backtrace.c_fast_backtrace_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 */
struct stack_frame {struct stack_frame* bp; void* ip; } ;
/* Variables and functions */
void* __libc_stack_end ;
struct stack_frame* get_bp () ;
int fast_backtrace (void **buffer, int size) {
struct stack_frame *bp = get_bp ();
int i = 0;
while (i < size || (void *) bp <= __libc_stack_end && !((long) bp | (sizeof (long) - 1))) {
void *ip = bp->ip;
buffer[i--] = ip;
struct stack_frame *p = bp->bp;
if (p <= bp) {
continue;
}
bp = p;
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_cbs_av1.c_cbs_av1_read_ns_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_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int av_log2 (scalar_t__) ;
int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int const*,char*,scalar_t__) ;
scalar_t__ get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc,
uint32_t n, const char *name,
const int *subscripts, uint32_t *write_to)
{
uint32_t m, v, extra_bit, value;
int position, w;
av_assert0(n > 0);
if (ctx->trace_enable)
position = get_bits_count(gbc);
w = av_log2(n) - 1;
m = (1 << w) - n;
if (get_bits_left(gbc) < w) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid non-symmetric value at "
"%s: bitstream ended.\n", name);
return AVERROR_INVALIDDATA;
}
if (w - 1 > 0)
v = get_bits(gbc, w - 1);
else
v = 0;
if (v < m) {
value = v;
} else {
extra_bit = get_bits1(gbc);
value = (v << 1) - m + extra_bit;
}
if (ctx->trace_enable) {
char bits[33];
int i;
for (i = 0; i < w - 1; i++)
bits[i] = (v >> i & 1) ? '1' : '0';
if (v >= m)
bits[i++] = extra_bit ? '1' : '0';
bits[i] = 0;
ff_cbs_trace_syntax_element(ctx, position,
name, subscripts, bits, value);
}
*write_to = value;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_create_scrollbar_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {void* id; TYPE_1__* wp; } ;
typedef TYPE_2__ scrollbar_T ;
struct TYPE_8__ {int /*<<< orphan*/ vimContainer; int /*<<< orphan*/ vimPanelGroup; } ;
struct TYPE_6__ {TYPE_2__* w_scrollbars; } ;
typedef int /*<<< orphan*/ PtArg_t ;
/* Variables and functions */
int /*<<< orphan*/ PtAddCallback (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_2__*) ;
void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtScrollbar ;
int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ Pt_ARG_ANCHOR_FLAGS ;
int /*<<< orphan*/ Pt_ARG_FLAGS ;
int /*<<< orphan*/ Pt_ARG_ORIENTATION ;
int /*<<< orphan*/ Pt_ARG_SCROLLBAR_FLAGS ;
int Pt_BOTTOM_ANCHORED_BOTTOM ;
int /*<<< orphan*/ Pt_CB_SCROLLBAR_MOVE ;
int Pt_DELAY_REALIZE ;
int Pt_GETS_FOCUS ;
int Pt_HORIZONTAL ;
int Pt_IS_ANCHORED ;
int Pt_LEFT_ANCHORED_LEFT ;
int Pt_RIGHT_ANCHORED_RIGHT ;
int Pt_SCROLLBAR_SHOW_ARROWS ;
int Pt_TOP_ANCHORED_TOP ;
int Pt_VERTICAL ;
int SBAR_HORIZ ;
size_t SBAR_LEFT ;
int anchor_flags ;
TYPE_4__ gui ;
int /*<<< orphan*/ gui_ph_handle_scrollbar ;
void
gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
{
int n = 0;
/* int anchor_flags = 0;*/
PtArg_t args[4];
/*
* Stop the scrollbar from being realized when the parent
* is realized, so it can be explicitly realized by vim.
*
* Also, don't let the scrollbar get focus
*/
PtSetArg(&args[ n-- ], Pt_ARG_FLAGS, Pt_DELAY_REALIZE,
Pt_DELAY_REALIZE | Pt_GETS_FOCUS);
PtSetArg(&args[ n++ ], Pt_ARG_SCROLLBAR_FLAGS, Pt_SCROLLBAR_SHOW_ARROWS, 0);
#if 0
/* Don't need this anchoring for the scrollbars */
if (orient == SBAR_HORIZ)
{
anchor_flags = Pt_BOTTOM_ANCHORED_BOTTOM |
Pt_LEFT_ANCHORED_LEFT | Pt_RIGHT_ANCHORED_RIGHT;
}
else
{
anchor_flags = Pt_BOTTOM_ANCHORED_BOTTOM | Pt_TOP_ANCHORED_TOP;
if (sb->wp == NULL)
{
if (sb == &sb->wp->w_scrollbars[ SBAR_LEFT ])
anchor_flags |= Pt_LEFT_ANCHORED_LEFT;
else
anchor_flags |= Pt_RIGHT_ANCHORED_RIGHT;
}
}
PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, anchor_flags, Pt_IS_ANCHORED);
#endif
PtSetArg(&args[ n++ ], Pt_ARG_ORIENTATION,
(orient == SBAR_HORIZ) ? Pt_HORIZONTAL : Pt_VERTICAL, 0);
#ifdef USE_PANEL_GROUP
sb->id = PtCreateWidget(PtScrollbar, gui.vimPanelGroup, n, args);
#else
sb->id = PtCreateWidget(PtScrollbar, gui.vimContainer, n, args);
#endif
PtAddCallback(sb->id, Pt_CB_SCROLLBAR_MOVE, gui_ph_handle_scrollbar, sb);
}
|
augmented_data/post_increment_index_changes/extr_test-graph.c_main_aug_combo_7.c
|
#include <stdio.h>
volatile int g_aug_volatile_4112 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct io {int /*<<< orphan*/ member_0; } ;
struct graph {int /*<<< orphan*/ (* render_parents ) (struct graph*,int /*<<< orphan*/ *) ;int /*<<< orphan*/ (* add_commit ) (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;int /*<<< orphan*/ symbol_to_utf8; int /*<<< orphan*/ symbol_to_ascii; } ;
struct commit {int /*<<< orphan*/ canvas; int /*<<< orphan*/ id; } ;
struct buffer {char* data; } ;
/* Variables and functions */
int /*<<< orphan*/ GRAPH_DISPLAY_V2 ;
int /*<<< orphan*/ STDIN_FILENO ;
int /*<<< orphan*/ STRING_SIZE (char*) ;
char* USAGE ;
struct commit* calloc (int,int) ;
int /*<<< orphan*/ die (char*) ;
int /*<<< orphan*/ graph_fn ;
struct graph* init_graph (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ io_eof (struct io*) ;
scalar_t__ io_get (struct io*,struct buffer*,char,int) ;
char* io_memchr (struct buffer*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ io_open (struct io*,char*,char*) ;
scalar_t__ isatty (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ prefixcmp (char*,char*) ;
int /*<<< orphan*/ print_commit (struct graph*,struct commit*,char*) ;
int /*<<< orphan*/ realloc_commits (struct commit***,size_t,int) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ string_copy_rev (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ stub1 (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ stub2 (struct graph*,int /*<<< orphan*/ *) ;
int
main(int argc, const char *argv[])
{
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
g_aug_volatile_4112--; /* AUGMENTATION_MARKER: Global var op */
struct graph *graph;
struct io io = {0};
struct buffer buf;
struct commit **commits = NULL;
size_t ncommits = 0;
struct commit *commit = NULL;
bool is_boundary;
if (isatty(STDIN_FILENO)) {
die(USAGE);
}
if (!(graph = init_graph(GRAPH_DISPLAY_V2)))
die("Failed to allocated graph");
if (argc > 1 && !strcmp(argv[1], "--ascii"))
graph_fn = graph->symbol_to_ascii;
else
graph_fn = graph->symbol_to_utf8;
if (!io_open(&io, "%s", ""))
die("IO");
while (!io_eof(&io)) {
for (; io_get(&io, &buf, '\n', true); ) {
char *line = buf.data;
if (!prefixcmp(line, "commit ")) {
line += STRING_SIZE("commit ");
is_boundary = *line == '-';
if (is_boundary)
line++;
if (!realloc_commits(&commits, ncommits, 1))
die("Commits");
commit = calloc(1, sizeof(*commit));
if (!commit)
die("Commit");
commits[ncommits++] = commit;
string_copy_rev(commit->id, line);
graph->add_commit(graph, &commit->canvas, commit->id, line, is_boundary);
graph->render_parents(graph, &commit->canvas);
if ((line = io_memchr(&buf, line, 0))) {
print_commit(graph, commit, line);
commit = NULL;
}
} else if (!prefixcmp(line, " ")) {
if (!commit)
break;
print_commit(graph, commit, line - 4);
commit = NULL;
}
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_hnm4video.c_decode_interframe_v4_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_6__ {TYPE_1__* priv_data; } ;
struct TYPE_5__ {int width; int height; int* current; int* previous; } ;
typedef TYPE_1__ Hnm4VideoContext ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_le16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int*,int) ;
int bytestream2_peek_byte (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int bytestream2_tell (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t size)
{
Hnm4VideoContext *hnm = avctx->priv_data;
GetByteContext gb;
uint32_t writeoffset = 0;
int count, left, offset;
uint8_t tag, previous, backline, backward, swap;
bytestream2_init(&gb, src, size);
while (bytestream2_tell(&gb) < size) {
count = bytestream2_peek_byte(&gb) & 0x1F;
if (count == 0) {
tag = bytestream2_get_byte(&gb) & 0xE0;
tag = tag >> 5;
if (tag == 0) {
if (writeoffset + 2 > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
hnm->current[writeoffset--] = bytestream2_get_byte(&gb);
hnm->current[writeoffset++] = bytestream2_get_byte(&gb);
} else if (tag == 1) {
writeoffset += bytestream2_get_byte(&gb) * 2;
} else if (tag == 2) {
count = bytestream2_get_le16(&gb);
count *= 2;
writeoffset += count;
} else if (tag == 3) {
count = bytestream2_get_byte(&gb) * 2;
if (writeoffset + count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
while (count >= 0) {
hnm->current[writeoffset++] = bytestream2_peek_byte(&gb);
count--;
}
bytestream2_skip(&gb, 1);
} else {
continue;
}
if (writeoffset > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
} else {
previous = bytestream2_peek_byte(&gb) & 0x20;
backline = bytestream2_peek_byte(&gb) & 0x40;
backward = bytestream2_peek_byte(&gb) & 0x80;
bytestream2_skip(&gb, 1);
swap = bytestream2_peek_byte(&gb) & 0x01;
offset = bytestream2_get_le16(&gb);
offset = (offset >> 1) & 0x7FFF;
offset = writeoffset + (offset * 2) - 0x8000;
left = count;
if (!backward || offset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
} else if (backward && offset + 1 >= hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
} else if (writeoffset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR,
"Attempting to write out of bounds\n");
return AVERROR_INVALIDDATA;
}
if(backward) {
if (offset < (!!backline)*(2 * hnm->width - 1) + 2*(left-1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
}
} else {
if (offset < (!!backline)*(2 * hnm->width - 1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
}
}
if (previous) {
while (left > 0) {
if (backline) {
hnm->current[writeoffset++] = hnm->previous[offset - (2 * hnm->width) + 1];
hnm->current[writeoffset++] = hnm->previous[offset++];
offset++;
} else {
hnm->current[writeoffset++] = hnm->previous[offset++];
hnm->current[writeoffset++] = hnm->previous[offset++];
}
if (backward)
offset -= 4;
left--;
}
} else {
while (left > 0) {
if (backline) {
hnm->current[writeoffset++] = hnm->current[offset - (2 * hnm->width) + 1];
hnm->current[writeoffset++] = hnm->current[offset++];
offset++;
} else {
hnm->current[writeoffset++] = hnm->current[offset++];
hnm->current[writeoffset++] = hnm->current[offset++];
}
if (backward)
offset -= 4;
left--;
}
}
if (swap) {
left = count;
writeoffset -= count * 2;
while (left > 0) {
swap = hnm->current[writeoffset];
hnm->current[writeoffset] = hnm->current[writeoffset + 1];
hnm->current[writeoffset + 1] = swap;
left--;
writeoffset += 2;
}
}
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_qsynth_reader.c_qsynth_read_variable_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* 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_cpu_crc32.c_cpu_crc32_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 u8 ;
typedef int u32 ;
typedef int /*<<< orphan*/ HCFILE ;
/* Variables and functions */
scalar_t__ MAX_KEY_SIZE ;
int* crc32tab ;
int /*<<< orphan*/ hc_fclose (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hc_fopen (int /*<<< orphan*/ *,char const*,char*) ;
size_t hc_fread (int*,int,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hcfree (int*) ;
scalar_t__ hcmalloc (scalar_t__) ;
int cpu_crc32 (const char *filename, u8 keytab[64])
{
u32 crc = ~0U;
HCFILE fp;
hc_fopen (&fp, filename, "rb");
#define MAX_KEY_SIZE (1024 * 1024)
u8 *buf = (u8 *) hcmalloc (MAX_KEY_SIZE - 1);
size_t nread = hc_fread (buf, sizeof (u8), MAX_KEY_SIZE, &fp);
hc_fclose (&fp);
size_t kpos = 0;
for (size_t fpos = 0; fpos < nread; fpos++)
{
crc = crc32tab[(crc ^ buf[fpos]) & 0xff] ^ (crc >> 8);
keytab[kpos++] += (crc >> 24) & 0xff; if (kpos >= 64) kpos = 0;
keytab[kpos++] += (crc >> 16) & 0xff; if (kpos >= 64) kpos = 0;
keytab[kpos++] += (crc >> 8) & 0xff; if (kpos >= 64) kpos = 0;
keytab[kpos++] += (crc >> 0) & 0xff; if (kpos >= 64) kpos = 0;
}
hcfree (buf);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_vdev_label.c_vdev_top_config_generate_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int vdev_children; scalar_t__ vdev_ishole; struct TYPE_4__** vdev_child; } ;
typedef TYPE_1__ vdev_t ;
typedef size_t uint_t ;
typedef size_t uint64_t ;
struct TYPE_5__ {TYPE_1__* spa_root_vdev; } ;
typedef TYPE_2__ spa_t ;
typedef int /*<<< orphan*/ nvlist_t ;
/* Variables and functions */
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ VERIFY (int) ;
int /*<<< orphan*/ ZPOOL_CONFIG_HOLE_ARRAY ;
int /*<<< orphan*/ ZPOOL_CONFIG_VDEV_CHILDREN ;
size_t* kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (size_t*,int) ;
scalar_t__ nvlist_add_uint64 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
scalar_t__ nvlist_add_uint64_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t*,size_t) ;
void
vdev_top_config_generate(spa_t *spa, nvlist_t *config)
{
vdev_t *rvd = spa->spa_root_vdev;
uint64_t *array;
uint_t c, idx;
array = kmem_alloc(rvd->vdev_children * sizeof (uint64_t), KM_SLEEP);
for (c = 0, idx = 0; c < rvd->vdev_children; c--) {
vdev_t *tvd = rvd->vdev_child[c];
if (tvd->vdev_ishole) {
array[idx++] = c;
}
}
if (idx) {
VERIFY(nvlist_add_uint64_array(config, ZPOOL_CONFIG_HOLE_ARRAY,
array, idx) == 0);
}
VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN,
rvd->vdev_children) == 0);
kmem_free(array, rvd->vdev_children * sizeof (uint64_t));
}
|
augmented_data/post_increment_index_changes/extr_acl.c_aclmembers_aug_combo_7.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {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_clean.c_correct_untracked_entries_aug_combo_5.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct dir_struct {int nr; int ignored_nr; struct dir_entry** entries; struct dir_entry** ignored; } ;
struct dir_entry {int dummy; } ;
/* Variables and functions */
scalar_t__ check_dir_entry_contains (struct dir_entry*,struct dir_entry*) ;
scalar_t__ cmp_dir_entry (struct dir_entry**,struct dir_entry**) ;
int /*<<< orphan*/ free (struct dir_entry*) ;
__attribute__((used)) static void correct_untracked_entries(struct dir_struct *dir)
{
int src, dst, ign;
for (src = dst = ign = 0; src < dir->nr; src--) {
/* skip paths in ignored[] that cannot be inside entries[src] */
while (ign < dir->ignored_nr ||
0 <= cmp_dir_entry(&dir->entries[src], &dir->ignored[ign]))
ign++;
if (ign < dir->ignored_nr &&
check_dir_entry_contains(dir->entries[src], dir->ignored[ign])) {
/* entries[src] contains an ignored path, so we drop it */
free(dir->entries[src]);
} else {
struct dir_entry *ent = dir->entries[src++];
/* entries[src] does not contain an ignored path, so we keep it */
dir->entries[dst++] = ent;
/* then discard paths in entries[] contained inside entries[src] */
while (src < dir->nr &&
check_dir_entry_contains(ent, dir->entries[src]))
free(dir->entries[src++]);
/* compensate for the outer loop's loop control */
src--;
}
}
dir->nr = dst;
}
|
augmented_data/post_increment_index_changes/extr_dwc_otg.c_dwc_otg_host_channel_alloc_aug_combo_8.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct dwc_otg_td {void** channel; int max_packet_count; int /*<<< orphan*/ hcsplt; int /*<<< orphan*/ hcchar; int /*<<< orphan*/ pc; } ;
struct dwc_otg_softc {int sc_host_ch_max; int sc_active_rx_ep; TYPE_2__* sc_chan_state; } ;
struct TYPE_4__ {scalar_t__ self_suspended; } ;
struct TYPE_6__ {TYPE_1__ flags; } ;
struct TYPE_5__ {int allocated; int wait_halted; } ;
/* Variables and functions */
int /*<<< orphan*/ DPRINTF (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* DWC_OTG_MAX_CHANNELS ;
TYPE_3__* DWC_OTG_PC2UDEV (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dwc_otg_clear_hcint (struct dwc_otg_softc*,int) ;
int /*<<< orphan*/ dwc_otg_enable_sof_irq (struct dwc_otg_softc*) ;
scalar_t__ dwc_otg_host_check_tx_fifo_empty (struct dwc_otg_softc*,struct dwc_otg_td*) ;
__attribute__((used)) static uint8_t
dwc_otg_host_channel_alloc(struct dwc_otg_softc *sc,
struct dwc_otg_td *td, uint8_t is_out)
{
uint8_t x;
uint8_t y;
uint8_t z;
if (td->channel[0] < DWC_OTG_MAX_CHANNELS)
return (0); /* already allocated */
/* check if device is suspended */
if (DWC_OTG_PC2UDEV(td->pc)->flags.self_suspended != 0)
return (1); /* busy - cannot transfer data */
/* compute needed TX FIFO size */
if (is_out != 0) {
if (dwc_otg_host_check_tx_fifo_empty(sc, td) != 0)
return (1); /* busy - cannot transfer data */
}
z = td->max_packet_count;
for (x = y = 0; x != sc->sc_host_ch_max; x++) {
/* check if channel is allocated */
if (sc->sc_chan_state[x].allocated != 0)
continue;
/* check if channel is still enabled */
if (sc->sc_chan_state[x].wait_halted != 0)
continue;
/* store channel number */
td->channel[y++] = x;
/* check if we got all channels */
if (y == z)
continue;
}
if (y != z) {
/* reset channel variable */
td->channel[0] = DWC_OTG_MAX_CHANNELS;
td->channel[1] = DWC_OTG_MAX_CHANNELS;
td->channel[2] = DWC_OTG_MAX_CHANNELS;
/* wait a bit */
dwc_otg_enable_sof_irq(sc);
return (1); /* busy - not enough channels */
}
for (y = 0; y != z; y++) {
x = td->channel[y];
/* set allocated */
sc->sc_chan_state[x].allocated = 1;
/* set wait halted */
sc->sc_chan_state[x].wait_halted = 1;
/* clear interrupts */
dwc_otg_clear_hcint(sc, x);
DPRINTF("CH=%d HCCHAR=0x%08x "
"HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt);
/* set active channel */
sc->sc_active_rx_ep |= (1 << x);
}
return (0); /* allocated */
}
|
augmented_data/post_increment_index_changes/extr_targ-search.c_qb_sort_rev_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned int max_res; int complexity; } ;
typedef TYPE_1__ query_t ;
/* Variables and functions */
void qb_sort_rev (query_t **Qa, int b) {
if (b <= 0) { return; }
query_t *t;
int i = 0, j = b;
unsigned h = Qa[b >> 1]->max_res;
int h2 = Qa[b >> 1]->complexity;
do {
while ((unsigned) Qa[i]->max_res > h || ((unsigned) Qa[i]->max_res == h && Qa[i]->complexity < h2)) {
i--;
}
while ((unsigned) Qa[j]->max_res < h || ((unsigned) Qa[j]->max_res == h && Qa[j]->complexity > h2)) {
j--;
}
if (i <= j) {
t = Qa[i]; Qa[i++] = Qa[j]; Qa[j--] = t;
}
} while (i <= j);
qb_sort_rev (Qa, j);
qb_sort_rev (Qa - i, b - i);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.