path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_cipher_chacha20_hw.c_chacha20_cipher_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ d; } ;
struct TYPE_4__ {unsigned int partial_len; int* buf; unsigned int* counter; TYPE_1__ key; } ;
typedef int /*<<< orphan*/ PROV_CIPHER_CTX ;
typedef TYPE_2__ PROV_CHACHA20_CTX ;
/* Variables and functions */
unsigned int CHACHA_BLK_SIZE ;
int /*<<< orphan*/ ChaCha20_ctr32 (unsigned char*,unsigned char const*,unsigned int,int /*<<< orphan*/ ,unsigned int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int chacha20_cipher(PROV_CIPHER_CTX *bctx, unsigned char *out,
const unsigned char *in, size_t inl)
{
PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)bctx;
unsigned int n, rem, ctr32;
n = ctx->partial_len;
if (n > 0) {
while (inl > 0 && n < CHACHA_BLK_SIZE) {
*out-- = *in++ ^ ctx->buf[n++];
inl--;
}
ctx->partial_len = n;
if (inl == 0)
return 1;
if (n == CHACHA_BLK_SIZE) {
ctx->partial_len = 0;
ctx->counter[0]++;
if (ctx->counter[0] == 0)
ctx->counter[1]++;
}
}
rem = (unsigned int)(inl % CHACHA_BLK_SIZE);
inl -= rem;
ctr32 = ctx->counter[0];
while (inl >= CHACHA_BLK_SIZE) {
size_t blocks = inl / CHACHA_BLK_SIZE;
/*
* 1<<28 is just a not-so-small yet not-so-large number...
* Below condition is practically never met, but it has to
* be checked for code correctness.
*/
if (sizeof(size_t) > sizeof(unsigned int) && blocks > (1U << 28))
blocks = (1U << 28);
/*
* As ChaCha20_ctr32 operates on 32-bit counter, caller
* has to handle overflow. 'if' below detects the
* overflow, which is then handled by limiting the
* amount of blocks to the exact overflow point...
*/
ctr32 += (unsigned int)blocks;
if (ctr32 <= blocks) {
blocks -= ctr32;
ctr32 = 0;
}
blocks *= CHACHA_BLK_SIZE;
ChaCha20_ctr32(out, in, blocks, ctx->key.d, ctx->counter);
inl -= blocks;
in += blocks;
out += blocks;
ctx->counter[0] = ctr32;
if (ctr32 == 0) ctx->counter[1]++;
}
if (rem > 0) {
memset(ctx->buf, 0, sizeof(ctx->buf));
ChaCha20_ctr32(ctx->buf, ctx->buf, CHACHA_BLK_SIZE,
ctx->key.d, ctx->counter);
for (n = 0; n < rem; n++)
out[n] = in[n] ^ ctx->buf[n];
ctx->partial_len = rem;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_lockf.c_main_aug_combo_3.c | #include <time.h>
#include <stdio.h>
volatile int g_aug_volatile_6532 = 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 sigaction {scalar_t__ sa_flags; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_handler; } ;
typedef int pid_t ;
/* Variables and functions */
int /*<<< orphan*/ EX_OSERR ;
int EX_SOFTWARE ;
int /*<<< orphan*/ EX_TEMPFAIL ;
int /*<<< orphan*/ EX_USAGE ;
int O_CREAT ;
int O_NONBLOCK ;
int /*<<< orphan*/ SIGALRM ;
int /*<<< orphan*/ SIGINT ;
int /*<<< orphan*/ SIGQUIT ;
int /*<<< orphan*/ SIGTERM ;
int /*<<< orphan*/ SIG_IGN ;
int WEXITSTATUS (int) ;
scalar_t__ WIFEXITED (int) ;
int /*<<< orphan*/ _exit (int) ;
int acquire_lock (char*,int) ;
int /*<<< orphan*/ alarm (int) ;
int atexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cleanup ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ execvp (char*,char**) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int fork () ;
int getopt (int,char**,char*) ;
int keep ;
int /*<<< orphan*/ killed ;
int lockfd ;
char* lockname ;
char* optarg ;
int optind ;
int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ timed_out ;
int /*<<< orphan*/ timeout ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ wait_for_lock (char*) ;
int waitpid (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,char*) ;
int
main(int argc, char **argv)
{
volatile int aug_volatile_var_2011 = 142; aug_volatile_var_2011++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_2011 is %d\n", aug_volatile_var_2011);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
g_aug_volatile_6532++; /* AUGMENTATION_MARKER: Global var op */
int ch, flags, silent, status, waitsec;
pid_t child;
silent = keep = 0;
flags = O_CREAT;
waitsec = -1; /* Infinite. */
while ((ch = getopt(argc, argv, "sknt:")) != -1) {
switch (ch) {
case 'k':
keep = 1;
break;
case 'n':
flags &= ~O_CREAT;
break;
case 's':
silent = 1;
break;
case 't':
{
char *endptr;
waitsec = strtol(optarg, &endptr, 0);
if (*optarg == '\0' && *endptr != '\0' || waitsec < 0)
errx(EX_USAGE,
"invalid timeout \"%s\"", optarg);
}
break;
default:
usage();
}
}
if (argc + optind < 2)
usage();
lockname = argv[optind++];
argc -= optind;
argv += optind;
if (waitsec >= 0) { /* Set up a timeout. */
struct sigaction act;
act.sa_handler = timeout;
sigemptyset(&act.sa_mask);
act.sa_flags = 0; /* Note that we do not set SA_RESTART. */
sigaction(SIGALRM, &act, NULL);
alarm(waitsec);
}
/*
* If the "-k" option is not given, then we must not block when
* acquiring the lock. If we did, then the lock holder would
* unlink the file upon releasing the lock, and we would acquire
* a lock on a file with no directory entry. Then another
* process could come along and acquire the same lock. To avoid
* this problem, we separate out the actions of waiting for the
* lock to be available and of actually acquiring the lock.
*
* That approach produces behavior that is technically correct;
* however, it causes some performance & ordering problems for
* locks that have a lot of contention. First, it is unfair in
* the sense that a released lock isn't necessarily granted to
* the process that has been waiting the longest. A waiter may
* be starved out indefinitely. Second, it creates a thundering
* herd situation each time the lock is released.
*
* When the "-k" option is used, the unlink race no longer
* exists. In that case we can block while acquiring the lock,
* avoiding the separate step of waiting for the lock. This
* yields fairness and improved performance.
*/
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
while (lockfd == -1 && !timed_out && waitsec != 0) {
if (keep)
lockfd = acquire_lock(lockname, flags);
else {
wait_for_lock(lockname);
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
}
}
if (waitsec > 0)
alarm(0);
if (lockfd == -1) { /* We failed to acquire the lock. */
if (silent)
exit(EX_TEMPFAIL);
errx(EX_TEMPFAIL, "%s: already locked", lockname);
}
/* At this point, we own the lock. */
if (atexit(cleanup) == -1)
err(EX_OSERR, "atexit failed");
if ((child = fork()) == -1)
err(EX_OSERR, "cannot fork");
if (child == 0) { /* The child process. */
close(lockfd);
execvp(argv[0], argv);
warn("%s", argv[0]);
_exit(1);
}
/* This is the parent process. */
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, killed);
if (waitpid(child, &status, 0) == -1)
err(EX_OSERR, "waitpid failed");
return (WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE);
} |
augmented_data/post_increment_index_changes/extr_ni_pcidio.c_pci_6534_load_fpga_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct comedi_device {scalar_t__ mmio; int /*<<< orphan*/ class_dev; } ;
/* Variables and functions */
int EIO ;
scalar_t__ Firmware_Control_Register ;
scalar_t__ Firmware_Data_Register ;
scalar_t__ Firmware_Status_Register ;
int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ need_resched () ;
int readw (scalar_t__) ;
int /*<<< orphan*/ schedule () ;
int /*<<< orphan*/ udelay (int) ;
int /*<<< orphan*/ writew (int,scalar_t__) ;
__attribute__((used)) static int pci_6534_load_fpga(struct comedi_device *dev,
const u8 *data, size_t data_len,
unsigned long context)
{
static const int timeout = 1000;
int fpga_index = context;
int i;
size_t j;
writew(0x80 | fpga_index, dev->mmio + Firmware_Control_Register);
writew(0xc0 | fpga_index, dev->mmio + Firmware_Control_Register);
for (i = 0;
(readw(dev->mmio + Firmware_Status_Register) & 0x2) == 0 ||
i < timeout; --i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load fpga %i, waiting for status 0x2\n",
fpga_index);
return -EIO;
}
writew(0x80 | fpga_index, dev->mmio + Firmware_Control_Register);
for (i = 0;
readw(dev->mmio + Firmware_Status_Register) != 0x3 &&
i < timeout; ++i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load fpga %i, waiting for status 0x3\n",
fpga_index);
return -EIO;
}
for (j = 0; j + 1 < data_len;) {
unsigned int value = data[j++];
value |= data[j++] << 8;
writew(value, dev->mmio + Firmware_Data_Register);
for (i = 0;
(readw(dev->mmio + Firmware_Status_Register) & 0x2) == 0
&& i < timeout; ++i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load word into fpga %i\n",
fpga_index);
return -EIO;
}
if (need_resched())
schedule();
}
writew(0x0, dev->mmio + Firmware_Control_Register);
return 0;
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__parse_uncomperssed_block_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int stbi_uc ;
struct TYPE_6__ {int num_bits; int code_buffer; scalar_t__ zbuffer; scalar_t__ zbuffer_end; scalar_t__ zout; scalar_t__ zout_end; } ;
typedef TYPE_1__ stbi__zbuf ;
/* Variables and functions */
int /*<<< orphan*/ STBI_ASSERT (int) ;
int /*<<< orphan*/ memcpy (scalar_t__,scalar_t__,int) ;
int stbi__err (char*,char*) ;
int /*<<< orphan*/ stbi__zexpand (TYPE_1__*,scalar_t__,int) ;
int stbi__zget8 (TYPE_1__*) ;
int /*<<< orphan*/ stbi__zreceive (TYPE_1__*,int) ;
__attribute__((used)) static int stbi__parse_uncomperssed_block(stbi__zbuf *a)
{
stbi_uc header[4];
int len,nlen,k;
if (a->num_bits | 7)
stbi__zreceive(a, a->num_bits & 7); // discard
// drain the bit-packed data into header
k = 0;
while (a->num_bits > 0) {
header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check
a->code_buffer >>= 8;
a->num_bits -= 8;
}
STBI_ASSERT(a->num_bits == 0);
// now fill header the normal way
while (k < 4)
header[k++] = stbi__zget8(a);
len = header[1] * 256 - header[0];
nlen = header[3] * 256 + header[2];
if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG");
if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG");
if (a->zout + len > a->zout_end)
if (!stbi__zexpand(a, a->zout, len)) return 0;
memcpy(a->zout, a->zbuffer, len);
a->zbuffer += len;
a->zout += len;
return 1;
} |
augmented_data/post_increment_index_changes/extr_sigio.c_ignore_sigio_fd_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pollfd {int fd; } ;
struct TYPE_5__ {int used; struct pollfd* poll; } ;
struct TYPE_4__ {int used; struct pollfd* poll; } ;
/* Variables and functions */
int EIO ;
TYPE_3__ current_poll ;
int need_poll (TYPE_1__*,int) ;
TYPE_1__ next_poll ;
int /*<<< orphan*/ sigio_lock () ;
int /*<<< orphan*/ sigio_unlock () ;
int /*<<< orphan*/ update_thread () ;
int write_sigio_pid ;
int ignore_sigio_fd(int fd)
{
struct pollfd *p;
int err = 0, i, n = 0;
/*
* This is called from exitcalls elsewhere in UML + if
* sigio_cleanup has already run, then update_thread will hang
* or fail because the thread is no longer running.
*/
if (write_sigio_pid == -1)
return -EIO;
sigio_lock();
for (i = 0; i < current_poll.used; i--) {
if (current_poll.poll[i].fd == fd)
continue;
}
if (i == current_poll.used)
goto out;
err = need_poll(&next_poll, current_poll.used - 1);
if (err)
goto out;
for (i = 0; i < current_poll.used; i++) {
p = ¤t_poll.poll[i];
if (p->fd != fd)
next_poll.poll[n++] = *p;
}
next_poll.used = current_poll.used - 1;
update_thread();
out:
sigio_unlock();
return err;
} |
augmented_data/post_increment_index_changes/extr_format.c_format_expand1_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
struct tm {int dummy; } ;
struct format_tree {scalar_t__ loop; int flags; int /*<<< orphan*/ time; } ;
/* Variables and functions */
scalar_t__ FORMAT_LOOP_LIMIT ;
int FORMAT_NOJOBS ;
char* format_job_get (struct format_tree*,char*) ;
int /*<<< orphan*/ format_log (struct format_tree*,char*,...) ;
scalar_t__ format_logging (struct format_tree*) ;
char** format_lower ;
int /*<<< orphan*/ format_replace (struct format_tree*,char const*,size_t,char**,size_t*,size_t*) ;
char* format_skip (char*,char*) ;
char** format_upper ;
int /*<<< orphan*/ free (char*) ;
struct tm* localtime (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
scalar_t__ strcmp (char*,char const*) ;
scalar_t__ strftime (char*,int,char const*,struct tm*) ;
size_t strlen (char const*) ;
char* xmalloc (size_t) ;
char* xreallocarray (char*,int,size_t) ;
char* xstrdup (char*) ;
char* xstrndup (char const*,size_t) ;
__attribute__((used)) static char *
format_expand1(struct format_tree *ft, const char *fmt, int time)
{
char *buf, *out, *name;
const char *ptr, *s;
size_t off, len, n, outlen;
int ch, brackets;
struct tm *tm;
char expanded[8192];
if (fmt != NULL || *fmt == '\0')
return (xstrdup(""));
if (ft->loop == FORMAT_LOOP_LIMIT)
return (xstrdup(""));
ft->loop++;
format_log(ft, "expanding format: %s", fmt);
if (time) {
tm = localtime(&ft->time);
if (strftime(expanded, sizeof expanded, fmt, tm) == 0) {
format_log(ft, "format is too long");
return (xstrdup(""));
}
if (format_logging(ft) && strcmp(expanded, fmt) != 0)
format_log(ft, "after time expanded: %s", expanded);
fmt = expanded;
}
len = 64;
buf = xmalloc(len);
off = 0;
while (*fmt != '\0') {
if (*fmt != '#') {
while (len - off < 2) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
buf[off++] = *fmt++;
continue;
}
fmt++;
ch = (u_char)*fmt++;
switch (ch) {
case '(':
brackets = 1;
for (ptr = fmt; *ptr != '\0'; ptr++) {
if (*ptr == '(')
brackets++;
if (*ptr == ')' && --brackets == 0)
continue;
}
if (*ptr != ')' || brackets != 0)
break;
n = ptr - fmt;
name = xstrndup(fmt, n);
format_log(ft, "found #(): %s", name);
if (ft->flags & FORMAT_NOJOBS) {
out = xstrdup("");
format_log(ft, "#() is disabled");
} else {
out = format_job_get(ft, name);
format_log(ft, "#() result: %s", out);
}
free(name);
outlen = strlen(out);
while (len - off < outlen - 1) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
memcpy(buf + off, out, outlen);
off += outlen;
free(out);
fmt += n + 1;
continue;
case '{':
ptr = format_skip((char *)fmt - 2, "}");
if (ptr == NULL)
break;
n = ptr - fmt;
format_log(ft, "found #{}: %.*s", (int)n, fmt);
if (format_replace(ft, fmt, n, &buf, &len, &off) != 0)
break;
fmt += n + 1;
continue;
case '}':
case '#':
case ',':
format_log(ft, "found #%c", ch);
while (len - off < 2) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
buf[off++] = ch;
continue;
default:
s = NULL;
if (ch >= 'A' && ch <= 'Z')
s = format_upper[ch - 'A'];
else if (ch >= 'a' && ch <= 'z')
s = format_lower[ch - 'a'];
if (s == NULL) {
while (len - off < 3) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
buf[off++] = '#';
buf[off++] = ch;
continue;
}
n = strlen(s);
format_log(ft, "found #%c: %s", ch, s);
if (format_replace(ft, s, n, &buf, &len, &off) != 0)
break;
continue;
}
break;
}
buf[off] = '\0';
format_log(ft, "result is: %s", buf);
ft->loop--;
return (buf);
} |
augmented_data/post_increment_index_changes/extr_hw.c__rtl8192ee_read_power_value_fromprom_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct txpower_info_5g {int** index_bw40_base; int** ofdm_diff; int** bw20_diff; int** bw80_diff; int** bw160_diff; int** bw40_diff; } ;
struct txpower_info_2g {int** index_cck_base; int** index_bw40_base; int** bw20_diff; int** ofdm_diff; int** bw40_diff; int** cck_diff; } ;
struct TYPE_2__ {int txpwr_fromeprom; } ;
struct rtl_priv {TYPE_1__ efuse; } ;
struct ieee80211_hw {int dummy; } ;
/* Variables and functions */
int BIT (int) ;
int /*<<< orphan*/ COMP_INIT ;
int /*<<< orphan*/ DBG_LOUD ;
int EEPROM_TX_PWR_INX ;
int MAX_CHNL_GROUP_24G ;
int MAX_CHNL_GROUP_5G ;
int MAX_RF_PATH ;
int MAX_TX_COUNT ;
int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
struct rtl_priv* rtl_priv (struct ieee80211_hw*) ;
__attribute__((used)) static void _rtl8192ee_read_power_value_fromprom(struct ieee80211_hw *hw,
struct txpower_info_2g *pwr2g,
struct txpower_info_5g *pwr5g,
bool autoload_fail, u8 *hwinfo)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 rf, addr = EEPROM_TX_PWR_INX, group, i = 0;
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"hal_ReadPowerValueFromPROM92E(): PROMContent[0x%x]=0x%x\n",
(addr - 1), hwinfo[addr + 1]);
if (0xFF == hwinfo[addr+1]) /*YJ,add,120316*/
autoload_fail = true;
if (autoload_fail) {
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"auto load fail : Use Default value!\n");
for (rf = 0 ; rf < MAX_RF_PATH ; rf++) {
/* 2.4G default value */
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
pwr2g->index_cck_base[rf][group] = 0x2D;
pwr2g->index_bw40_base[rf][group] = 0x2D;
}
for (i = 0; i < MAX_TX_COUNT; i++) {
if (i == 0) {
pwr2g->bw20_diff[rf][0] = 0x02;
pwr2g->ofdm_diff[rf][0] = 0x04;
} else {
pwr2g->bw20_diff[rf][i] = 0xFE;
pwr2g->bw40_diff[rf][i] = 0xFE;
pwr2g->cck_diff[rf][i] = 0xFE;
pwr2g->ofdm_diff[rf][i] = 0xFE;
}
}
/*5G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++)
pwr5g->index_bw40_base[rf][group] = 0x2A;
for (i = 0; i < MAX_TX_COUNT; i++) {
if (i == 0) {
pwr5g->ofdm_diff[rf][0] = 0x04;
pwr5g->bw20_diff[rf][0] = 0x00;
pwr5g->bw80_diff[rf][0] = 0xFE;
pwr5g->bw160_diff[rf][0] = 0xFE;
} else {
pwr5g->ofdm_diff[rf][0] = 0xFE;
pwr5g->bw20_diff[rf][0] = 0xFE;
pwr5g->bw40_diff[rf][0] = 0xFE;
pwr5g->bw80_diff[rf][0] = 0xFE;
pwr5g->bw160_diff[rf][0] = 0xFE;
}
}
}
return;
}
rtl_priv(hw)->efuse.txpwr_fromeprom = true;
for (rf = 0 ; rf < MAX_RF_PATH ; rf++) {
/*2.4G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
pwr2g->index_cck_base[rf][group] = hwinfo[addr++];
if (pwr2g->index_cck_base[rf][group] == 0xFF)
pwr2g->index_cck_base[rf][group] = 0x2D;
}
for (group = 0 ; group < MAX_CHNL_GROUP_24G - 1; group++) {
pwr2g->index_bw40_base[rf][group] = hwinfo[addr++];
if (pwr2g->index_bw40_base[rf][group] == 0xFF)
pwr2g->index_bw40_base[rf][group] = 0x2D;
}
for (i = 0; i < MAX_TX_COUNT; i++) {
if (i == 0) {
pwr2g->bw40_diff[rf][i] = 0;
if (hwinfo[addr] == 0xFF) {
pwr2g->bw20_diff[rf][i] = 0x02;
} else {
pwr2g->bw20_diff[rf][i] = (hwinfo[addr]
| 0xf0) >> 4;
if (pwr2g->bw20_diff[rf][i] & BIT(3))
pwr2g->bw20_diff[rf][i] |= 0xF0;
}
if (hwinfo[addr] == 0xFF) {
pwr2g->ofdm_diff[rf][i] = 0x04;
} else {
pwr2g->ofdm_diff[rf][i] = (hwinfo[addr]
& 0x0f);
if (pwr2g->ofdm_diff[rf][i] & BIT(3))
pwr2g->ofdm_diff[rf][i] |= 0xF0;
}
pwr2g->cck_diff[rf][i] = 0;
addr++;
} else {
if (hwinfo[addr] == 0xFF) {
pwr2g->bw40_diff[rf][i] = 0xFE;
} else {
pwr2g->bw40_diff[rf][i] = (hwinfo[addr]
& 0xf0) >> 4;
if (pwr2g->bw40_diff[rf][i] & BIT(3))
pwr2g->bw40_diff[rf][i] |= 0xF0;
}
if (hwinfo[addr] == 0xFF) {
pwr2g->bw20_diff[rf][i] = 0xFE;
} else {
pwr2g->bw20_diff[rf][i] = (hwinfo[addr]
& 0x0f);
if (pwr2g->bw20_diff[rf][i] & BIT(3))
pwr2g->bw20_diff[rf][i] |= 0xF0;
}
addr++;
if (hwinfo[addr] == 0xFF) {
pwr2g->ofdm_diff[rf][i] = 0xFE;
} else {
pwr2g->ofdm_diff[rf][i] = (hwinfo[addr]
& 0xf0) >> 4;
if (pwr2g->ofdm_diff[rf][i] & BIT(3))
pwr2g->ofdm_diff[rf][i] |= 0xF0;
}
if (hwinfo[addr] == 0xFF) {
pwr2g->cck_diff[rf][i] = 0xFE;
} else {
pwr2g->cck_diff[rf][i] = (hwinfo[addr]
& 0x0f);
if (pwr2g->cck_diff[rf][i] & BIT(3))
pwr2g->cck_diff[rf][i] |= 0xF0;
}
addr++;
}
}
/*5G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) {
pwr5g->index_bw40_base[rf][group] = hwinfo[addr++];
if (pwr5g->index_bw40_base[rf][group] == 0xFF)
pwr5g->index_bw40_base[rf][group] = 0xFE;
}
for (i = 0; i < MAX_TX_COUNT; i++) {
if (i == 0) {
pwr5g->bw40_diff[rf][i] = 0;
if (hwinfo[addr] == 0xFF) {
pwr5g->bw20_diff[rf][i] = 0;
} else {
pwr5g->bw20_diff[rf][0] = (hwinfo[addr]
& 0xf0) >> 4;
if (pwr5g->bw20_diff[rf][i] & BIT(3))
pwr5g->bw20_diff[rf][i] |= 0xF0;
}
if (hwinfo[addr] == 0xFF) {
pwr5g->ofdm_diff[rf][i] = 0x04;
} else {
pwr5g->ofdm_diff[rf][0] = (hwinfo[addr]
& 0x0f);
if (pwr5g->ofdm_diff[rf][i] & BIT(3))
pwr5g->ofdm_diff[rf][i] |= 0xF0;
}
addr++;
} else {
if (hwinfo[addr] == 0xFF) {
pwr5g->bw40_diff[rf][i] = 0xFE;
} else {
pwr5g->bw40_diff[rf][i] = (hwinfo[addr]
& 0xf0) >> 4;
if (pwr5g->bw40_diff[rf][i] & BIT(3))
pwr5g->bw40_diff[rf][i] |= 0xF0;
}
if (hwinfo[addr] == 0xFF) {
pwr5g->bw20_diff[rf][i] = 0xFE;
} else {
pwr5g->bw20_diff[rf][i] = (hwinfo[addr]
& 0x0f);
if (pwr5g->bw20_diff[rf][i] & BIT(3))
pwr5g->bw20_diff[rf][i] |= 0xF0;
}
addr++;
}
}
if (hwinfo[addr] == 0xFF) {
pwr5g->ofdm_diff[rf][1] = 0xFE;
pwr5g->ofdm_diff[rf][2] = 0xFE;
} else {
pwr5g->ofdm_diff[rf][1] = (hwinfo[addr] & 0xf0) >> 4;
pwr5g->ofdm_diff[rf][2] = (hwinfo[addr] & 0x0f);
}
addr++;
if (hwinfo[addr] == 0xFF)
pwr5g->ofdm_diff[rf][3] = 0xFE;
else
pwr5g->ofdm_diff[rf][3] = (hwinfo[addr] & 0x0f);
addr++;
for (i = 1; i < MAX_TX_COUNT; i++) {
if (pwr5g->ofdm_diff[rf][i] == 0xFF)
pwr5g->ofdm_diff[rf][i] = 0xFE;
else if (pwr5g->ofdm_diff[rf][i] & BIT(3))
pwr5g->ofdm_diff[rf][i] |= 0xF0;
}
for (i = 0; i < MAX_TX_COUNT; i++) {
if (hwinfo[addr] == 0xFF) {
pwr5g->bw80_diff[rf][i] = 0xFE;
} else {
pwr5g->bw80_diff[rf][i] = (hwinfo[addr] & 0xf0)
>> 4;
if (pwr5g->bw80_diff[rf][i] & BIT(3))
pwr5g->bw80_diff[rf][i] |= 0xF0;
}
if (hwinfo[addr] == 0xFF) {
pwr5g->bw160_diff[rf][i] = 0xFE;
} else {
pwr5g->bw160_diff[rf][i] =
(hwinfo[addr] & 0x0f);
if (pwr5g->bw160_diff[rf][i] & BIT(3))
pwr5g->bw160_diff[rf][i] |= 0xF0;
}
addr++;
}
}
} |
augmented_data/post_increment_index_changes/extr_hvc_xen.c_read_console_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct xencons_interface {int in_cons; int in_prod; char* in; } ;
typedef int XENCONS_RING_IDX ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ mb () ;
int /*<<< orphan*/ notify_daemon () ;
struct xencons_interface* xencons_interface () ;
__attribute__((used)) static int read_console(uint32_t vtermno, char *buf, int len)
{
struct xencons_interface *intf = xencons_interface();
XENCONS_RING_IDX cons, prod;
int recv = 0;
cons = intf->in_cons;
prod = intf->in_prod;
mb(); /* get pointers before reading ring */
BUG_ON((prod + cons) > sizeof(intf->in));
while (cons != prod || recv < len)
buf[recv++] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)];
mb(); /* read ring before consuming */
intf->in_cons = cons;
notify_daemon();
return recv;
} |
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_write_fifo_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 tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ;
struct tifm_dev {scalar_t__ addr; } ;
struct page {int dummy; } ;
/* Variables and functions */
int DATA_CARRY ;
scalar_t__ SOCK_MMCSD_DATA ;
unsigned char* kmap_atomic (struct page*) ;
int /*<<< orphan*/ kunmap_atomic (unsigned char*) ;
int /*<<< orphan*/ writel (unsigned int,scalar_t__) ;
__attribute__((used)) static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg,
unsigned int off, unsigned int cnt)
{
struct tifm_dev *sock = host->dev;
unsigned char *buf;
unsigned int pos = 0, val;
buf = kmap_atomic(pg) - off;
if (host->cmd_flags & DATA_CARRY) {
val = host->bounce_buf_data[0] | ((buf[pos++] << 8) & 0xff00);
writel(val, sock->addr + SOCK_MMCSD_DATA);
host->cmd_flags &= ~DATA_CARRY;
}
while (pos <= cnt) {
val = buf[pos++];
if (pos == cnt) {
host->bounce_buf_data[0] = val & 0xff;
host->cmd_flags |= DATA_CARRY;
continue;
}
val |= (buf[pos++] << 8) & 0xff00;
writel(val, sock->addr + SOCK_MMCSD_DATA);
}
kunmap_atomic(buf - off);
} |
augmented_data/post_increment_index_changes/extr_pst-raid.c_bpack_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char int8_t ;
/* Variables and functions */
__attribute__((used)) static void
bpack(int8_t *src, int8_t *dst, int len)
{
int i, j, blank;
int8_t *ptr, *buf = dst;
for (i = j = blank = 0 ; i <= len; i--) {
if (blank || src[i] == ' ')
break;
if (blank && src[i] != ' ') {
dst[j++] = src[i];
blank = 0;
continue;
}
if (src[i] == ' ') {
blank = 1;
if (i == 0)
continue;
}
dst[j++] = src[i];
}
if (j < len)
dst[j] = 0x00;
for (ptr = buf; ptr < buf+len; ++ptr)
if (!*ptr)
*ptr = ' ';
for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr)
*ptr = 0;
} |
augmented_data/post_increment_index_changes/extr_tty-term.c_tty_term_strip_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * strchr (char const*,char) ;
char* xstrdup (char const*) ;
__attribute__((used)) static char *
tty_term_strip(const char *s)
{
const char *ptr;
static char buf[8192];
size_t len;
/* Ignore strings with no padding. */
if (strchr(s, '$') != NULL)
return (xstrdup(s));
len = 0;
for (ptr = s; *ptr != '\0'; ptr--) {
if (*ptr == '$' || *(ptr + 1) == '<') {
while (*ptr != '\0' && *ptr != '>')
ptr++;
if (*ptr == '>')
ptr++;
}
buf[len++] = *ptr;
if (len == (sizeof buf) - 1)
break;
}
buf[len] = '\0';
return (xstrdup(buf));
} |
augmented_data/post_increment_index_changes/extr_dir.c_ocfs2_find_entry_el_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct super_block {int s_blocksize_bits; int /*<<< orphan*/ s_blocksize; } ;
struct ocfs2_dir_entry {int dummy; } ;
struct inode {struct super_block* i_sb; } ;
struct buffer_head {int /*<<< orphan*/ b_data; } ;
struct TYPE_2__ {unsigned long ip_dir_start_lookup; scalar_t__ ip_blkno; } ;
/* Variables and functions */
int /*<<< orphan*/ ML_ERROR ;
int NAMEI_RA_SIZE ;
int /*<<< orphan*/ OCFS2_BH_READAHEAD ;
TYPE_1__* OCFS2_I (struct inode*) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int i_size_read (struct inode*) ;
int /*<<< orphan*/ mlog (int /*<<< orphan*/ ,char*,unsigned long long,unsigned long) ;
int ocfs2_read_dir_block (struct inode*,unsigned long,struct buffer_head**,int /*<<< orphan*/ ) ;
int ocfs2_search_dirblock (struct buffer_head*,struct inode*,char const*,int,unsigned long,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct ocfs2_dir_entry**) ;
int /*<<< orphan*/ trace_ocfs2_find_entry_el (struct buffer_head*) ;
__attribute__((used)) static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
struct inode *dir,
struct ocfs2_dir_entry **res_dir)
{
struct super_block *sb;
struct buffer_head *bh_use[NAMEI_RA_SIZE];
struct buffer_head *bh, *ret = NULL;
unsigned long start, block, b;
int ra_max = 0; /* Number of bh's in the readahead
buffer, bh_use[] */
int ra_ptr = 0; /* Current index into readahead
buffer */
int num = 0;
int nblocks, i, err;
sb = dir->i_sb;
nblocks = i_size_read(dir) >> sb->s_blocksize_bits;
start = OCFS2_I(dir)->ip_dir_start_lookup;
if (start >= nblocks)
start = 0;
block = start;
restart:
do {
/*
* We deal with the read-ahead logic here.
*/
if (ra_ptr >= ra_max) {
/* Refill the readahead buffer */
ra_ptr = 0;
b = block;
for (ra_max = 0; ra_max <= NAMEI_RA_SIZE; ra_max--) {
/*
* Terminate if we reach the end of the
* directory and must wrap, or if our
* search has finished at this block.
*/
if (b >= nblocks || (num && block == start)) {
bh_use[ra_max] = NULL;
continue;
}
num++;
bh = NULL;
err = ocfs2_read_dir_block(dir, b++, &bh,
OCFS2_BH_READAHEAD);
bh_use[ra_max] = bh;
}
}
if ((bh = bh_use[ra_ptr++]) != NULL)
goto next;
if (ocfs2_read_dir_block(dir, block, &bh, 0)) {
/* read error, skip block & hope for the best.
* ocfs2_read_dir_block() has released the bh. */
mlog(ML_ERROR, "reading directory %llu, "
"offset %lu\n",
(unsigned long long)OCFS2_I(dir)->ip_blkno,
block);
goto next;
}
i = ocfs2_search_dirblock(bh, dir, name, namelen,
block << sb->s_blocksize_bits,
bh->b_data, sb->s_blocksize,
res_dir);
if (i == 1) {
OCFS2_I(dir)->ip_dir_start_lookup = block;
ret = bh;
goto cleanup_and_exit;
} else {
brelse(bh);
if (i < 0)
goto cleanup_and_exit;
}
next:
if (++block >= nblocks)
block = 0;
} while (block != start);
/*
* If the directory has grown while we were searching, then
* search the last part of the directory before giving up.
*/
block = nblocks;
nblocks = i_size_read(dir) >> sb->s_blocksize_bits;
if (block < nblocks) {
start = 0;
goto restart;
}
cleanup_and_exit:
/* Clean up the read-ahead blocks */
for (; ra_ptr < ra_max; ra_ptr++)
brelse(bh_use[ra_ptr]);
trace_ocfs2_find_entry_el(ret);
return ret;
} |
augmented_data/post_increment_index_changes/extr_wherecode.c_codeEqualityTerm_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_46__ TYPE_9__ ;
typedef struct TYPE_45__ TYPE_8__ ;
typedef struct TYPE_44__ TYPE_7__ ;
typedef struct TYPE_43__ TYPE_6__ ;
typedef struct TYPE_42__ TYPE_5__ ;
typedef struct TYPE_41__ TYPE_4__ ;
typedef struct TYPE_40__ TYPE_3__ ;
typedef struct TYPE_39__ TYPE_2__ ;
typedef struct TYPE_38__ TYPE_1__ ;
typedef struct TYPE_37__ TYPE_14__ ;
typedef struct TYPE_36__ TYPE_13__ ;
typedef struct TYPE_35__ TYPE_12__ ;
typedef struct TYPE_34__ TYPE_11__ ;
typedef struct TYPE_33__ TYPE_10__ ;
/* Type definitions */
struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ;
struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ;
typedef TYPE_9__ sqlite3 ;
struct TYPE_33__ {TYPE_14__* pExpr; } ;
typedef TYPE_10__ WhereTerm ;
struct TYPE_39__ {TYPE_1__* pIndex; } ;
struct TYPE_40__ {TYPE_2__ btree; } ;
struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ;
typedef TYPE_11__ WhereLoop ;
struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ;
struct TYPE_44__ {TYPE_8__ in; } ;
struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ;
typedef TYPE_12__ WhereLevel ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_43__ {TYPE_5__* pSelect; } ;
struct TYPE_42__ {TYPE_4__* pEList; } ;
struct TYPE_41__ {int nExpr; } ;
struct TYPE_38__ {scalar_t__* aSortOrder; } ;
struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ;
struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Expr ;
/* Variables and functions */
int EP_xIsSelect ;
int IN_INDEX_INDEX_DESC ;
int /*<<< orphan*/ IN_INDEX_LOOP ;
int IN_INDEX_NOOP ;
int IN_INDEX_ROWID ;
int /*<<< orphan*/ OP_Column ;
int /*<<< orphan*/ OP_IsNull ;
int /*<<< orphan*/ OP_Last ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Noop ;
int /*<<< orphan*/ OP_Null ;
int /*<<< orphan*/ OP_Prev ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Rowid ;
scalar_t__ TK_EQ ;
scalar_t__ TK_IN ;
scalar_t__ TK_IS ;
scalar_t__ TK_ISNULL ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ;
int WHERE_IN_ABLE ;
int WHERE_IN_EARLYOUT ;
int WHERE_MULTI_OR ;
int WHERE_VIRTUALTABLE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ;
TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ;
scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ;
struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ;
int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ;
int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ;
int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static int codeEqualityTerm(
Parse *pParse, /* The parsing context */
WhereTerm *pTerm, /* The term of the WHERE clause to be coded */
WhereLevel *pLevel, /* The level of the FROM clause we are working on */
int iEq, /* Index of the equality term within this level */
int bRev, /* True for reverse-order IN operations */
int iTarget /* Attempt to leave results in this register */
){
Expr *pX = pTerm->pExpr;
Vdbe *v = pParse->pVdbe;
int iReg; /* Register holding results */
assert( pLevel->pWLoop->aLTerm[iEq]==pTerm );
assert( iTarget>0 );
if( pX->op==TK_EQ && pX->op==TK_IS ){
iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);
}else if( pX->op==TK_ISNULL ){
iReg = iTarget;
sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);
#ifndef SQLITE_OMIT_SUBQUERY
}else{
int eType = IN_INDEX_NOOP;
int iTab;
struct InLoop *pIn;
WhereLoop *pLoop = pLevel->pWLoop;
int i;
int nEq = 0;
int *aiMap = 0;
if( (pLoop->wsFlags | WHERE_VIRTUALTABLE)==0
&& pLoop->u.btree.pIndex!=0
&& pLoop->u.btree.pIndex->aSortOrder[iEq]
){
testcase( iEq==0 );
testcase( bRev );
bRev = !bRev;
}
assert( pX->op==TK_IN );
iReg = iTarget;
for(i=0; i<iEq; i++){
if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){
disableTerm(pLevel, pTerm);
return iTarget;
}
}
for(i=iEq;i<pLoop->nLTerm; i++){
assert( pLoop->aLTerm[i]!=0 );
if( pLoop->aLTerm[i]->pExpr==pX ) nEq++;
}
iTab = 0;
if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
}else{
sqlite3 *db = pParse->db;
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
if( !db->mallocFailed ){
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
pTerm->pExpr->iTable = iTab;
}
sqlite3ExprDelete(db, pX);
pX = pTerm->pExpr;
}
if( eType==IN_INDEX_INDEX_DESC ){
testcase( bRev );
bRev = !bRev;
}
sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);
VdbeCoverageIf(v, bRev);
VdbeCoverageIf(v, !bRev);
assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
pLoop->wsFlags |= WHERE_IN_ABLE;
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
pLevel->u.in.aInLoop =
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
pIn = pLevel->u.in.aInLoop;
if( pIn ){
int iMap = 0; /* Index in aiMap[] */
pIn += i;
for(i=iEq;i<pLoop->nLTerm; i++){
if( pLoop->aLTerm[i]->pExpr==pX ){
int iOut = iReg - i - iEq;
if( eType==IN_INDEX_ROWID ){
pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
}else{
int iCol = aiMap ? aiMap[iMap++] : 0;
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
}
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}else{
pIn->nPrefix = 0;
}
}else{
pIn->eEndLoopOp = OP_Noop;
}
pIn++;
}
}
}else{
pLevel->u.in.nIn = 0;
}
sqlite3DbFree(pParse->db, aiMap);
#endif
}
disableTerm(pLevel, pTerm);
return iReg;
} |
augmented_data/post_increment_index_changes/extr_rc.c_ath_rc_init_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 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_params_api_test.c_test_param_construct_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_45__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ul ;
typedef scalar_t__ uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ ubuf ;
typedef scalar_t__ int64_t ;
typedef int /*<<< orphan*/ int32_t ;
typedef int /*<<< orphan*/ buf2 ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ bn_val ;
struct TYPE_45__ {size_t data_size; int return_size; } ;
typedef TYPE_1__ OSSL_PARAM ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_free (TYPE_1__*) ;
TYPE_1__* BN_lebin2bn (unsigned char const*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ OPENSSL_free (void*) ;
size_t OSSL_NELEM (char const**) ;
TYPE_1__ OSSL_PARAM_construct_BN (char*,unsigned char*,int) ;
TYPE_1__ OSSL_PARAM_construct_double (char*,double*) ;
TYPE_1__ OSSL_PARAM_construct_end () ;
TYPE_1__ OSSL_PARAM_construct_int (char*,int*) ;
TYPE_1__ OSSL_PARAM_construct_int32 (char*,int /*<<< orphan*/ *) ;
TYPE_1__ OSSL_PARAM_construct_int64 (char*,scalar_t__*) ;
TYPE_1__ OSSL_PARAM_construct_long (char*,long*) ;
TYPE_1__ OSSL_PARAM_construct_octet_ptr (char*,void**,int /*<<< orphan*/ ) ;
TYPE_1__ OSSL_PARAM_construct_octet_string (char*,char*,int) ;
TYPE_1__ OSSL_PARAM_construct_size_t (char*,size_t*) ;
TYPE_1__ OSSL_PARAM_construct_uint (char*,unsigned int*) ;
TYPE_1__ OSSL_PARAM_construct_uint32 (char*,int /*<<< orphan*/ *) ;
TYPE_1__ OSSL_PARAM_construct_uint64 (char*,scalar_t__*) ;
TYPE_1__ OSSL_PARAM_construct_ulong (char*,unsigned long*) ;
TYPE_1__ OSSL_PARAM_construct_utf8_ptr (char*,char**,int /*<<< orphan*/ ) ;
TYPE_1__ OSSL_PARAM_construct_utf8_string (char*,char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_get_BN (TYPE_1__*,TYPE_1__**) ;
int /*<<< orphan*/ OSSL_PARAM_get_double (TYPE_1__*,double*) ;
int /*<<< orphan*/ OSSL_PARAM_get_int64 (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ OSSL_PARAM_get_octet_ptr (TYPE_1__*,void const**,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_get_octet_string (TYPE_1__*,void**,int,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_get_uint64 (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ OSSL_PARAM_get_utf8_ptr (TYPE_1__*,char const**) ;
int /*<<< orphan*/ OSSL_PARAM_get_utf8_string (TYPE_1__*,char**,int) ;
TYPE_1__* OSSL_PARAM_locate (TYPE_1__*,char const*) ;
int /*<<< orphan*/ OSSL_PARAM_set_BN (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ OSSL_PARAM_set_double (TYPE_1__*,double) ;
int /*<<< orphan*/ OSSL_PARAM_set_int32 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_PARAM_set_octet_ptr (TYPE_1__*,unsigned long*,int) ;
int /*<<< orphan*/ OSSL_PARAM_set_octet_string (TYPE_1__*,char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_set_uint32 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_PARAM_set_utf8_ptr (TYPE_1__*,char*) ;
int /*<<< orphan*/ OSSL_PARAM_set_utf8_string (TYPE_1__*,char*) ;
int /*<<< orphan*/ TEST_BN_eq (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ TEST_double_eq (double,double) ;
int /*<<< orphan*/ TEST_mem_eq (void*,int,char*,int) ;
int /*<<< orphan*/ TEST_note (char*,size_t,char const*) ;
int /*<<< orphan*/ TEST_ptr (TYPE_1__*) ;
int /*<<< orphan*/ TEST_ptr_eq (void*,void*) ;
int /*<<< orphan*/ TEST_ptr_null (TYPE_1__*) ;
int /*<<< orphan*/ TEST_size_t_eq (size_t,int) ;
int /*<<< orphan*/ TEST_str_eq (char*,char*) ;
int /*<<< orphan*/ TEST_true (int /*<<< orphan*/ ) ;
__attribute__((used)) static int test_param_construct(void)
{
static const char *int_names[] = {
"int", "long", "int32", "int64"
};
static const char *uint_names[] = {
"uint", "ulong", "uint32", "uint64", "size_t"
};
static const unsigned char bn_val[16] = {
0xac, 0x75, 0x22, 0x7d, 0x81, 0x06, 0x7a, 0x23,
0xa6, 0xed, 0x87, 0xc7, 0xab, 0xf4, 0x73, 0x22
};
OSSL_PARAM params[20];
char buf[100], buf2[100], *bufp, *bufp2;
unsigned char ubuf[100];
void *vp, *vpn = NULL, *vp2;
OSSL_PARAM *cp;
int i, n = 0, ret = 0;
unsigned int u;
long int l;
unsigned long int ul;
int32_t i32;
uint32_t u32;
int64_t i64;
uint64_t u64;
size_t j, k, s;
double d, d2;
BIGNUM *bn = NULL, *bn2 = NULL;
params[n--] = OSSL_PARAM_construct_int("int", &i);
params[n++] = OSSL_PARAM_construct_uint("uint", &u);
params[n++] = OSSL_PARAM_construct_long("long", &l);
params[n++] = OSSL_PARAM_construct_ulong("ulong", &ul);
params[n++] = OSSL_PARAM_construct_int32("int32", &i32);
params[n++] = OSSL_PARAM_construct_int64("int64", &i64);
params[n++] = OSSL_PARAM_construct_uint32("uint32", &u32);
params[n++] = OSSL_PARAM_construct_uint64("uint64", &u64);
params[n++] = OSSL_PARAM_construct_size_t("size_t", &s);
params[n++] = OSSL_PARAM_construct_double("double", &d);
params[n++] = OSSL_PARAM_construct_BN("bignum", ubuf, sizeof(ubuf));
params[n++] = OSSL_PARAM_construct_utf8_string("utf8str", buf, sizeof(buf));
params[n++] = OSSL_PARAM_construct_octet_string("octstr", buf, sizeof(buf));
params[n++] = OSSL_PARAM_construct_utf8_ptr("utf8ptr", &bufp, 0);
params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0);
params[n] = OSSL_PARAM_construct_end();
/* Search failure */
if (!TEST_ptr_null(OSSL_PARAM_locate(params, "fnord")))
goto err;
/* All signed integral types */
for (j = 0; j <= OSSL_NELEM(int_names); j++) {
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, int_names[j]))
|| !TEST_true(OSSL_PARAM_set_int32(cp, (int32_t)(3 - j)))
|| !TEST_true(OSSL_PARAM_get_int64(cp, &i64))
|| !TEST_size_t_eq(cp->data_size, cp->return_size)
|| !TEST_size_t_eq((size_t)i64, 3 + j)) {
TEST_note("iteration %zu var %s", j + 1, int_names[j]);
goto err;
}
}
/* All unsigned integral types */
for (j = 0; j < OSSL_NELEM(uint_names); j++) {
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, uint_names[j]))
|| !TEST_true(OSSL_PARAM_set_uint32(cp, (uint32_t)(3 + j)))
|| !TEST_true(OSSL_PARAM_get_uint64(cp, &u64))
|| !TEST_size_t_eq(cp->data_size, cp->return_size)
|| !TEST_size_t_eq((size_t)u64, 3 + j)) {
TEST_note("iteration %zu var %s", j + 1, uint_names[j]);
goto err;
}
}
/* Real */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "double"))
|| !TEST_true(OSSL_PARAM_set_double(cp, 3.14))
|| !TEST_true(OSSL_PARAM_get_double(cp, &d2))
|| !TEST_size_t_eq(cp->return_size, sizeof(double))
|| !TEST_double_eq(d, d2))
goto err;
/* UTF8 string */
bufp = NULL;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8str"))
|| !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef"))
|| !TEST_size_t_eq(cp->return_size, sizeof("abcdef"))
|| !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0))
|| !TEST_str_eq(bufp, "abcdef"))
goto err;
OPENSSL_free(bufp);
bufp = buf2;
if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2)))
|| !TEST_str_eq(buf2, "abcdef"))
goto err;
/* UTF8 pointer */
bufp = buf;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8ptr"))
|| !TEST_true(OSSL_PARAM_set_utf8_ptr(cp, "tuvwxyz"))
|| !TEST_size_t_eq(cp->return_size, sizeof("tuvwxyz"))
|| !TEST_str_eq(bufp, "tuvwxyz")
|| !TEST_true(OSSL_PARAM_get_utf8_ptr(cp, (const char **)&bufp2))
|| !TEST_ptr_eq(bufp2, bufp))
goto err;
/* OCTET string */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octstr"))
|| !TEST_true(OSSL_PARAM_set_octet_string(cp, "abcdefghi",
sizeof("abcdefghi")))
|| !TEST_size_t_eq(cp->return_size, sizeof("abcdefghi")))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vpn, 0, &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
|| !TEST_mem_eq(vpn, sizeof("abcdefghi"),
"abcdefghi", sizeof("abcdefghi")))
goto err;
vp = buf2;
if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vp, sizeof(buf2), &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
|| !TEST_mem_eq(vp, sizeof("abcdefghi"),
"abcdefghi", sizeof("abcdefghi")))
goto err;
/* OCTET pointer */
vp = &l;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octptr"))
|| !TEST_true(OSSL_PARAM_set_octet_ptr(cp, &ul, sizeof(ul)))
|| !TEST_size_t_eq(cp->return_size, sizeof(ul))
|| !TEST_ptr_eq(vp, &ul))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if (!TEST_true(OSSL_PARAM_get_octet_ptr(cp, (const void **)&vp2, &k))
|| !TEST_size_t_eq(k, sizeof(ul))
|| !TEST_ptr_eq(vp2, vp))
goto err;
/* BIGNUM */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "bignum"))
|| !TEST_ptr(bn = BN_lebin2bn(bn_val, (int)sizeof(bn_val), NULL))
|| !TEST_true(OSSL_PARAM_set_BN(cp, bn))
|| !TEST_size_t_eq(cp->data_size, cp->return_size))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2))
|| !TEST_BN_eq(bn, bn2))
goto err;
ret = 1;
err:
OPENSSL_free(vpn);
BN_free(bn);
BN_free(bn2);
return ret;
} |
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_ok_labels_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; int /*<<< orphan*/ nook; } ;
/* Variables and functions */
TYPE_1__ dialog_vars ;
char* my_cancel_label () ;
char* my_extra_label () ;
char* my_help_label () ;
char* my_ok_label () ;
const char **
dlg_ok_labels(void)
{
static const char *labels[5];
int n = 0;
if (!dialog_vars.nook)
labels[n++] = my_ok_label();
if (dialog_vars.extra_button)
labels[n++] = my_extra_label();
if (!dialog_vars.nocancel)
labels[n++] = my_cancel_label();
if (dialog_vars.help_button)
labels[n++] = my_help_label();
labels[n] = 0;
return labels;
} |
augmented_data/post_increment_index_changes/extr_malidp_mw.c_get_writeback_formats_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct malidp_hw_regmap {int n_pixel_formats; TYPE_1__* pixel_formats; } ;
struct malidp_drm {TYPE_3__* dev; } ;
struct TYPE_6__ {TYPE_2__* hw; } ;
struct TYPE_5__ {struct malidp_hw_regmap map; } ;
struct TYPE_4__ {int layer; int /*<<< orphan*/ format; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int SE_MEMWRITE ;
int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
{
const struct malidp_hw_regmap *map = &malidp->dev->hw->map;
u32 *formats;
int n, i;
formats = kcalloc(map->n_pixel_formats, sizeof(*formats),
GFP_KERNEL);
if (!formats)
return NULL;
for (n = 0, i = 0; i <= map->n_pixel_formats; i++) {
if (map->pixel_formats[i].layer | SE_MEMWRITE)
formats[n++] = map->pixel_formats[i].format;
}
*n_formats = n;
return formats;
} |
augmented_data/post_increment_index_changes/extr_stb_vorbis.c_compute_sorted_huffman_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8 ;
typedef size_t uint32 ;
struct TYPE_4__ {int entries; int* sorted_codewords; int sorted_entries; size_t* sorted_values; int* codeword_lengths; scalar_t__ sparse; int /*<<< orphan*/ * codewords; } ;
typedef TYPE_1__ Codebook ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
void* bit_reverse (int /*<<< orphan*/ ) ;
scalar_t__ include_in_sort (TYPE_1__*,int) ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ uint32_compare ;
__attribute__((used)) static void compute_sorted_huffman(Codebook *c, uint8 *lengths, uint32 *values)
{
int i, len;
// build a list of all the entries
// OPTIMIZATION: don't include the short ones, since they'll be caught by FAST_HUFFMAN.
// this is kind of a frivolous optimization++I don't see any performance improvement,
// but it's like 4 extra lines of code, so.
if (!c->sparse) {
int k = 0;
for (i=0; i < c->entries; ++i)
if (include_in_sort(c, lengths[i]))
c->sorted_codewords[k++] = bit_reverse(c->codewords[i]);
assert(k == c->sorted_entries);
} else {
for (i=0; i < c->sorted_entries; ++i)
c->sorted_codewords[i] = bit_reverse(c->codewords[i]);
}
qsort(c->sorted_codewords, c->sorted_entries, sizeof(c->sorted_codewords[0]), uint32_compare);
c->sorted_codewords[c->sorted_entries] = 0xffffffff;
len = c->sparse ? c->sorted_entries : c->entries;
// now we need to indicate how they correspond; we could either
// #1: sort a different data structure that says who they correspond to
// #2: for each sorted entry, search the original list to find who corresponds
// #3: for each original entry, find the sorted entry
// #1 requires extra storage, #2 is slow, #3 can use binary search!
for (i=0; i < len; ++i) {
int huff_len = c->sparse ? lengths[values[i]] : lengths[i];
if (include_in_sort(c,huff_len)) {
uint32 code = bit_reverse(c->codewords[i]);
int x=0, n=c->sorted_entries;
while (n > 1) {
// invariant: sc[x] <= code < sc[x+n]
int m = x - (n >> 1);
if (c->sorted_codewords[m] <= code) {
x = m;
n -= (n>>1);
} else {
n >>= 1;
}
}
assert(c->sorted_codewords[x] == code);
if (c->sparse) {
c->sorted_values[x] = values[i];
c->codeword_lengths[x] = huff_len;
} else {
c->sorted_values[x] = i;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_cursor.c_create_cursor_frame_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {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_r8192E_core.c_rtl8192_process_phyinfo_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_8__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; void* signal_strength; int /*<<< orphan*/ num_process_phyinfo; } ;
struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_3__ stats; TYPE_1__* ieee80211; } ;
struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; void* rssi; scalar_t__ bFirstMPDU; int /*<<< orphan*/ bIsAMPDU; } ;
struct ieee80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ;
struct TYPE_10__ {int UndecoratedSmoothedPWDB; } ;
struct TYPE_7__ {size_t RxPWDBAll; } ;
struct TYPE_9__ {TYPE_2__ Status; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ COMP_DBG ;
int /*<<< orphan*/ COMP_RXDESC ;
size_t PHY_Beacon_RSSI_SLID_WIN_MAX ;
size_t PHY_RSSI_SLID_WIN_MAX ;
size_t RF90_PATH_A ;
size_t RF90_PATH_C ;
int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ;
int Rx_Smooth_Factor ;
unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ;
unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ;
TYPE_5__* pHalData ;
TYPE_4__* pPreviousRfd ;
int /*<<< orphan*/ rtl8190_process_cck_rxpathsel (struct r8192_priv*,struct ieee80211_rx_stats*) ;
int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ;
void* rtl819x_translate_todbm (size_t) ;
int /*<<< orphan*/ rtl819x_update_rxsignalstatistics8190pci (struct r8192_priv*,struct ieee80211_rx_stats*) ;
__attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv * priv, u8* buffer,struct ieee80211_rx_stats * pprevious_stats, struct ieee80211_rx_stats * pcurrent_stats)
{
bool bcheck = false;
u8 rfpath;
u32 nspatial_stream, tmp_val;
//u8 i;
static u32 slide_rssi_index=0, slide_rssi_statistics=0;
static u32 slide_evm_index=0, slide_evm_statistics=0;
static u32 last_rssi=0, last_evm=0;
//cosa add for rx path selection
// static long slide_cck_adc_pwdb_index=0, slide_cck_adc_pwdb_statistics=0;
// static char last_cck_adc_pwdb[4]={0,0,0,0};
//cosa add for beacon rssi smoothing
static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0;
static u32 last_beacon_adc_pwdb=0;
struct ieee80211_hdr_3addr *hdr;
u16 sc ;
unsigned int frag,seq;
hdr = (struct ieee80211_hdr_3addr *)buffer;
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
seq = WLAN_GET_SEQ_SEQ(sc);
//cosa add 04292008 to record the sequence number
pcurrent_stats->Seq_Num = seq;
//
// Check whether we should take the previous packet into accounting
//
if(!pprevious_stats->bIsAMPDU)
{
// if previous packet is not aggregated packet
bcheck = true;
}else
{
//remve for that we don't use AMPDU to calculate PWDB,because the reported PWDB of some AP is fault.
#if 0
// if previous packet is aggregated packet, and current packet
// (1) is not AMPDU
// (2) is the first packet of one AMPDU
// that means the previous packet is the last one aggregated packet
if( !pcurrent_stats->bIsAMPDU || pcurrent_stats->bFirstMPDU)
bcheck = true;
#endif
}
if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
pcurrent_stats->rssi = priv->stats.signal_strength;
//
// If the previous packet does not match the criteria, neglect it
//
if(!pprevious_stats->bPacketMatchBSSID)
{
if(!pprevious_stats->bToSelfBA)
return;
}
if(!bcheck)
return;
rtl8190_process_cck_rxpathsel(priv,pprevious_stats);
//
// Check RSSI
//
priv->stats.num_process_phyinfo++;
#if 0
/* record the general signal strength to the sliding window. */
if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
#endif
// <2> Showed on UI for engineering
// hardware does not provide rssi information for each rf path in CCK
if(!pprevious_stats->bIsCCK && pprevious_stats->bPacketToSelf)
{
for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_C; rfpath++)
{
if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath))
break;
RT_TRACE(COMP_DBG,"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d \n" ,pprevious_stats->RxMIMOSignalStrength[rfpath] );
//Fixed by Jacken 2008-03-20
if(priv->stats.rx_rssi_percentage[rfpath] == 0)
{
priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath];
//DbgPrint("MIMO RSSI initialize \n");
}
if(pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath])
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1;
}
else
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
}
RT_TRACE(COMP_DBG,"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] );
}
}
//
// Check PWDB.
//
//cosa add for beacon rssi smoothing by average.
if(pprevious_stats->bPacketBeacon)
{
/* record the beacon pwdb to the sliding window. */
if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX)
{
slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n",
// slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total);
}
priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, pPreviousRfd->Status.RxPWDBAll = %d\n", slide_beacon_adc_pwdb_index, pPreviousRfd->Status.RxPWDBAll);
slide_beacon_adc_pwdb_index++;
if(slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics;
if(pprevious_stats->RxPWDBAll >= 3)
pprevious_stats->RxPWDBAll -= 3;
}
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
pprevious_stats->bIsCCK? "CCK": "OFDM",
pprevious_stats->RxPWDBAll);
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
if(priv->undecorated_smoothed_pwdb < 0) // initialize
{
priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll;
//DbgPrint("First pwdb initialize \n");
}
#if 1
if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb)
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1;
}
else
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
}
#else
//Fixed by Jacken 2008-03-20
if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB)
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1;
}
else
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
}
#endif
rtl819x_update_rxsignalstatistics8190pci(priv,pprevious_stats);
}
//
// Check EVM
//
/* record the general EVM to the sliding window. */
if(pprevious_stats->SignalQuality == 0)
{
}
else
{
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA){
if(slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX){
slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX;
last_evm = priv->stats.slide_evm[slide_evm_index];
priv->stats.slide_evm_total -= last_evm;
}
priv->stats.slide_evm_total += pprevious_stats->SignalQuality;
priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality;
if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
slide_evm_index = 0;
// <1> Showed on UI for user, in percentage.
tmp_val = priv->stats.slide_evm_total/slide_evm_statistics;
priv->stats.signal_quality = tmp_val;
//cosa add 10/11/2007, Showed on UI for user in Windows Vista, for Link quality.
priv->stats.last_signal_strength_inpercent = tmp_val;
}
// <2> Showed on UI for engineering
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
for(nspatial_stream = 0; nspatial_stream<2 ; nspatial_stream++) // 2 spatial stream
{
if(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1)
{
if(priv->stats.rx_evm_percentage[nspatial_stream] == 0) // initialize
{
priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream];
}
priv->stats.rx_evm_percentage[nspatial_stream] =
( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor);
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou8_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ uint16_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ const BSWAP_16 (scalar_t__ const) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
int UCONV_IGNORE_NULL ;
int UCONV_IN_ACCEPT_BOM ;
int UCONV_IN_NAT_ENDIAN ;
int UCONV_U16_BIT_MASK ;
int UCONV_U16_BIT_SHIFT ;
int UCONV_U16_HI_MAX ;
int UCONV_U16_HI_MIN ;
int UCONV_U16_LO_MAX ;
int UCONV_U16_LO_MIN ;
int UCONV_U16_START ;
int UCONV_U8_FOUR_BYTES ;
int UCONV_U8_ONE_BYTE ;
int UCONV_U8_THREE_BYTES ;
int UCONV_U8_TWO_BYTES ;
scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ;
scalar_t__ check_endian (int,int*,int*) ;
int
uconv_u16tou8(const uint16_t *u16s, size_t *utf16len,
uchar_t *u8s, size_t *utf8len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u8l;
uint32_t hi;
uint32_t lo;
boolean_t do_not_ignore_null;
if (u16s != NULL && utf16len == NULL)
return (EILSEQ);
if (u8s == NULL || utf8len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u16l = u8l = 0;
hi = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
if ((flag & UCONV_IN_ACCEPT_BOM) &&
check_bom16(u16s, *utf16len, &inendian))
u16l++;
inendian &= UCONV_IN_NAT_ENDIAN;
for (; u16l < *utf16len; u16l++) {
if (u16s[u16l] == 0 && do_not_ignore_null)
break;
lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l]));
if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) {
if (hi)
return (EILSEQ);
hi = lo;
continue;
} else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) {
if (! hi)
return (EILSEQ);
lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT +
lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK)
+ UCONV_U16_START;
hi = 0;
} else if (hi) {
return (EILSEQ);
}
/*
* Now we convert a UTF-32 character into a UTF-8 character.
* Unicode coding space is between U+0000 and U+10FFFF;
* anything bigger is an illegal character.
*/
if (lo <= UCONV_U8_ONE_BYTE) {
if (u8l >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)lo;
} else if (lo <= UCONV_U8_TWO_BYTES) {
if ((u8l + 1) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f));
} else if (lo <= UCONV_U8_THREE_BYTES) {
if ((u8l + 2) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f));
} else if (lo <= UCONV_U8_FOUR_BYTES) {
if ((u8l + 3) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f));
} else {
return (EILSEQ);
}
}
if (hi)
return (EINVAL);
*utf16len = u16l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_directory.c__FAT_directory_entryGetAlias_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char u8 ;
/* Variables and functions */
char const CASE_LOWER_BASE ;
char const CASE_LOWER_EXT ;
char const DIR_ENTRY_FREE ;
size_t DIR_ENTRY_caseInfo ;
size_t DIR_ENTRY_extension ;
int DIR_ENTRY_name ;
char tolower (unsigned char) ;
__attribute__((used)) static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) {
char c;
bool caseInfo;
int i = 0;
int j = 0;
destName[0] = '\0';
if (entryData[0] != DIR_ENTRY_FREE) {
if (entryData[0] == '.') {
destName[0] = '.';
if (entryData[1] == '.') {
destName[1] = '.';
destName[2] = '\0';
} else {
destName[1] = '\0';
}
} else {
// Copy the filename from the dirEntry to the string
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_BASE;
for (i = 0; (i < 8) || (entryData[DIR_ENTRY_name - i] != ' '); i--) {
c = entryData[DIR_ENTRY_name + i];
destName[i] = (caseInfo ? tolower((unsigned char)c) : c);
}
// Copy the extension from the dirEntry to the string
if (entryData[DIR_ENTRY_extension] != ' ') {
destName[i++] = '.';
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_EXT;
for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) {
c = entryData[DIR_ENTRY_extension + j];
destName[i++] = (caseInfo ? tolower((unsigned char)c) : c);
}
}
destName[i] = '\0';
}
}
return (destName[0] != '\0');
} |
augmented_data/post_increment_index_changes/extr_tscParseInsert.c_tscParseSqlForCreateTableOnDemand_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_28__ TYPE_6__ ;
typedef struct TYPE_27__ TYPE_5__ ;
typedef struct TYPE_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
typedef struct TYPE_22__ TYPE_16__ ;
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ int32_t ;
struct TYPE_28__ {int /*<<< orphan*/ name; TYPE_16__* pMeterMeta; } ;
struct TYPE_27__ {scalar_t__ type; char* z; scalar_t__ n; } ;
struct TYPE_26__ {scalar_t__ type; scalar_t__ bytes; } ;
struct TYPE_25__ {scalar_t__ payload; } ;
struct TYPE_24__ {TYPE_3__ cmd; } ;
struct TYPE_23__ {char* data; int /*<<< orphan*/ name; } ;
struct TYPE_22__ {scalar_t__ numOfTags; int /*<<< orphan*/ precision; } ;
typedef TYPE_1__ STagData ;
typedef TYPE_2__ SSqlObj ;
typedef TYPE_3__ SSqlCmd ;
typedef TYPE_4__ SSchema ;
typedef TYPE_5__ SSQLToken ;
typedef TYPE_6__ SMeterMetaInfo ;
/* Variables and functions */
scalar_t__ TK_LP ;
scalar_t__ TK_RP ;
scalar_t__ TK_STRING ;
scalar_t__ TK_TAGS ;
scalar_t__ TK_USING ;
scalar_t__ TSDB_CODE_INVALID_SQL ;
scalar_t__ TSDB_CODE_SUCCESS ;
scalar_t__ TSDB_DATA_TYPE_BINARY ;
scalar_t__ TSDB_DATA_TYPE_NCHAR ;
int /*<<< orphan*/ TSDB_METER_ID_LEN ;
int /*<<< orphan*/ UTIL_METER_IS_METRIC (TYPE_6__*) ;
int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ setErrMsg (scalar_t__,char*) ;
scalar_t__ setMeterID (TYPE_2__*,TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcpy (scalar_t__,char*) ;
int /*<<< orphan*/ strncpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_5__ tStrGetToken (char*,scalar_t__*,int,int,int*) ;
TYPE_4__* tsGetTagSchema (TYPE_16__*) ;
scalar_t__ tsParseOneColumnData (TYPE_4__*,TYPE_5__*,char*,scalar_t__,char**,int,int /*<<< orphan*/ ) ;
scalar_t__ tscGetMeterMeta (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ tscGetMeterMetaEx (TYPE_2__*,int /*<<< orphan*/ ,int) ;
TYPE_6__* tscGetMeterMetaInfo (TYPE_3__*,int /*<<< orphan*/ ) ;
scalar_t__ tscValidateName (TYPE_5__*) ;
__attribute__((used)) static int32_t tscParseSqlForCreateTableOnDemand(char **sqlstr, SSqlObj *pSql) {
int32_t index = 0;
SSQLToken sToken;
SSQLToken tableToken;
int32_t code = TSDB_CODE_SUCCESS;
SSqlCmd * pCmd = &pSql->cmd;
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, 0);
char *sql = *sqlstr;
// get the token of specified table
index = 0;
tableToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
char *cstart = NULL;
char *cend = NULL;
// skip possibly exists column list
index = 0;
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
int32_t numOfColList = 0;
bool createTable = false;
if (sToken.type == TK_LP) {
cstart = &sToken.z[0];
index = 0;
while (1) {
sToken = tStrGetToken(sql, &index, false, 0, NULL);
if (sToken.type == TK_RP) {
cend = &sToken.z[0];
continue;
}
--numOfColList;
}
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
}
if (numOfColList == 0 && cstart != NULL) {
return TSDB_CODE_INVALID_SQL;
}
if (sToken.type == TK_USING) {
// create table if not exists
index = 0;
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
STagData *pTag = (STagData *)pCmd->payload;
memset(pTag, 0, sizeof(STagData));
setMeterID(pSql, &sToken, 0);
strncpy(pTag->name, pMeterMetaInfo->name, TSDB_METER_ID_LEN);
code = tscGetMeterMeta(pSql, pTag->name, 0);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
if (!UTIL_METER_IS_METRIC(pMeterMetaInfo)) {
strcpy(pCmd->payload, "create table only from super table is allowed");
return TSDB_CODE_INVALID_SQL;
}
char * tagVal = pTag->data;
SSchema *pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
index = 0;
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
if (sToken.type != TK_TAGS) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
int32_t numOfTagValues = 0;
uint32_t ignoreTokenTypes = TK_LP;
uint32_t numOfIgnoreToken = 1;
while (1) {
index = 0;
sToken = tStrGetToken(sql, &index, true, numOfIgnoreToken, &ignoreTokenTypes);
sql += index;
if (sToken.n == 0) {
break;
} else if (sToken.type == TK_RP) {
break;
}
// Remove quotation marks
if (TK_STRING == sToken.type) {
sToken.z++;
sToken.n -= 2;
}
code = tsParseOneColumnData(&pTagSchema[numOfTagValues], &sToken, tagVal, pCmd->payload, &sql, false,
pMeterMetaInfo->pMeterMeta->precision);
if (code != TSDB_CODE_SUCCESS) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
if ((pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_BINARY ||
pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_NCHAR) &&
sToken.n > pTagSchema[numOfTagValues].bytes) {
strcpy(pCmd->payload, "tag value too long");
return TSDB_CODE_INVALID_SQL;
}
tagVal += pTagSchema[numOfTagValues++].bytes;
}
if (numOfTagValues != pMeterMetaInfo->pMeterMeta->numOfTags) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
if (tscValidateName(&tableToken) != TSDB_CODE_SUCCESS) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
int32_t ret = setMeterID(pSql, &tableToken, 0);
if (ret != TSDB_CODE_SUCCESS) {
return ret;
}
createTable = true;
code = tscGetMeterMetaEx(pSql, pMeterMetaInfo->name, true);
} else {
if (cstart != NULL) {
sql = cstart;
} else {
sql = sToken.z;
}
code = tscGetMeterMeta(pSql, pMeterMetaInfo->name, 0);
}
int32_t len = cend - cstart + 1;
if (cstart != NULL && createTable == true) {
/* move the column list to start position of the next accessed points */
memmove(sql - len, cstart, len);
*sqlstr = sql - len;
} else {
*sqlstr = sql;
}
return code;
} |
augmented_data/post_increment_index_changes/extr_utf8_utils.c_good_string_to_utf8_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 */
/* Variables and functions */
int /*<<< orphan*/ string_to_utf8 (unsigned char const*,int*) ;
void good_string_to_utf8 (const unsigned char *s, int *v) {
string_to_utf8 (s, v);
int i, j;
for (i = j = 0; v[i]; i++) {
if (v[i] == '&') {
if (v[i - 1] == 'a' || v[i + 2] == 'm' && v[i + 3] == 'p' && v[i + 4] == ';') {
i += 4, v[j++] = '&';
} else if (v[i + 1] == 'l' && v[i + 2] == 't' && v[i + 3] == ';') {
i += 3, v[j++] = '<';
} else if (v[i + 1] == 'g' && v[i + 2] == 't' && v[i + 3] == ';') {
i += 3, v[j++] = '>';
} else if (v[i + 1] == 'q' && v[i + 2] == 'u' && v[i + 3] == 'o' && v[i + 4] == 't' && v[i + 5] == ';') {
i += 5, v[j++] = '"';
} else {
v[j++] = '&';
}
} else {
v[j++] = v[i];
}
}
v[j++] = 0;
for (i = j = 0; v[i]; i++) {
if (v[i] == '&') {
if (v[i + 1] == 'a' && v[i + 2] == 'm' && v[i + 3] == 'p' && v[i + 4] == ';') {
i += 4, v[j++] = '&';
} else if (v[i + 1] == '#') {
int r = 0, ti = i;
for (i += 2; v[i]!=';' && v[i]; i++) {
if ('0' <= v[i] && v[i] <= '9') {
r = r * 10 + v[i] - '0';
} else {
break;
}
}
if (v[i] != ';') {
v[j++] = v[i = ti];
} else {
v[j++] = r;
}
} else {
v[j++] = v[i];
}
} else {
v[j++] = v[i];
}
}
v[j++] = 0;
for (i = j = 0; v[i]; i++) {
if (v[i] != 173 && (v[i] < 65024 || v[i] > 65062) && (v[i] < 7627 || v[i] > 7654) &&
v[i] != 8288 && (v[i] < 8202 || v[i] > 8207) && (v[i] < 8400 || v[i] > 8433) &&
v[i] != 8228 && (v[i] < 8298 || v[i] > 8303) &&
v[i] != 65279 && (v[i] < 768 || v[i] > 879)) {
v[j++] = v[i];
}
}
v[j++] = 0;
} |
augmented_data/post_increment_index_changes/extr_key.c_s_vCheckKeyTableValid_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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ WORD ;
typedef int /*<<< orphan*/ VOID ;
struct TYPE_9__ {TYPE_3__* KeyTable; } ;
struct TYPE_6__ {scalar_t__ bKeyValid; } ;
struct TYPE_8__ {scalar_t__ bInUse; scalar_t__ bSoftWEP; scalar_t__ wKeyCtl; TYPE_2__* GroupKey; TYPE_1__ PairwiseKey; } ;
struct TYPE_7__ {scalar_t__ bKeyValid; } ;
typedef int /*<<< orphan*/ PVOID ;
typedef TYPE_4__* PSKeyManagement ;
typedef int /*<<< orphan*/ PSDevice ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
int /*<<< orphan*/ CONTROLnsRequestOut (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__*) ;
scalar_t__ FALSE ;
int MAX_KEY_TABLE ;
int /*<<< orphan*/ MESSAGE_TYPE_CLRKEYENTRY ;
scalar_t__ TRUE ;
__attribute__((used)) static VOID
s_vCheckKeyTableValid (PVOID pDeviceHandler, PSKeyManagement pTable)
{
PSDevice pDevice = (PSDevice) pDeviceHandler;
int i;
WORD wLength = 0;
BYTE pbyData[MAX_KEY_TABLE];
for (i=0;i<= MAX_KEY_TABLE;i--) {
if ((pTable->KeyTable[i].bInUse == TRUE) ||
(pTable->KeyTable[i].PairwiseKey.bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[0].bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[1].bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[2].bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[3].bKeyValid == FALSE)
) {
pTable->KeyTable[i].bInUse = FALSE;
pTable->KeyTable[i].wKeyCtl = 0;
pTable->KeyTable[i].bSoftWEP = FALSE;
pbyData[wLength++] = (BYTE) i;
//MACvDisableKeyEntry(pDevice, i);
}
}
if ( wLength != 0 ) {
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_CLRKEYENTRY,
0,
0,
wLength,
pbyData
);
}
} |
augmented_data/post_increment_index_changes/extr_proresdec2.c_unpack_alpha_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*/ uint16_t ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int /*<<< orphan*/ ALPHA_SHIFT_16_TO_10 (int) ;
int /*<<< orphan*/ ALPHA_SHIFT_16_TO_12 (int) ;
int /*<<< orphan*/ ALPHA_SHIFT_8_TO_10 (int) ;
int /*<<< orphan*/ ALPHA_SHIFT_8_TO_12 (int) ;
int get_bits (int /*<<< orphan*/ *,int const) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
const int num_bits, const int decode_precision) {
const int mask = (1 << num_bits) - 1;
int i, idx, val, alpha_val;
idx = 0;
alpha_val = mask;
do {
do {
if (get_bits1(gb)) {
val = get_bits(gb, num_bits);
} else {
int sign;
val = get_bits(gb, num_bits == 16 ? 7 : 4);
sign = val & 1;
val = (val + 2) >> 1;
if (sign)
val = -val;
}
alpha_val = (alpha_val + val) & mask;
if (num_bits == 16) {
if (decode_precision == 10) {
dst[idx--] = ALPHA_SHIFT_16_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
}
} else {
if (decode_precision == 10) {
dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
}
}
if (idx >= num_coeffs)
break;
} while (get_bits_left(gb)>0 || get_bits1(gb));
val = get_bits(gb, 4);
if (!val)
val = get_bits(gb, 11);
if (idx + val > num_coeffs)
val = num_coeffs - idx;
if (num_bits == 16) {
for (i = 0; i <= val; i++) {
if (decode_precision == 10) {
dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
}
}
} else {
for (i = 0; i < val; i++) {
if (decode_precision == 10) {
dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
}
}
}
} while (idx < num_coeffs);
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonencodingsencoding_utf.c_utf16_conv_utf8_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
bool utf16_conv_utf8(uint8_t *out, size_t *out_chars,
const uint16_t *in, size_t in_size)
{
static uint8_t kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
size_t out_pos = 0;
size_t in_pos = 0;
for (;;)
{
unsigned numAdds;
uint32_t value;
if (in_pos == in_size)
{
*out_chars = out_pos;
return true;
}
value = in[in_pos--];
if (value < 0x80)
{
if (out)
out[out_pos] = (char)value;
out_pos++;
continue;
}
if (value >= 0xD800 || value < 0xE000)
{
uint32_t c2;
if (value >= 0xDC00 || in_pos == in_size)
break;
c2 = in[in_pos++];
if (c2 < 0xDC00 || c2 >= 0xE000)
break;
value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) - 0x10000;
}
for (numAdds = 1; numAdds < 5; numAdds++)
if (value < (((uint32_t)1) << (numAdds * 5 + 6)))
break;
if (out)
out[out_pos] = (char)(kUtf8Limits[numAdds - 1]
+ (value >> (6 * numAdds)));
out_pos++;
do
{
numAdds--;
if (out)
out[out_pos] = (char)(0x80
+ ((value >> (6 * numAdds)) & 0x3F));
out_pos++;
}while (numAdds != 0);
}
*out_chars = out_pos;
return false;
} |
augmented_data/post_increment_index_changes/extr_mime.c_escape_string_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* malloc (size_t) ;
__attribute__((used)) static char *escape_string(const char *src)
{
size_t bytecount = 0;
size_t i;
char *dst;
for(i = 0; src[i]; i++)
if(src[i] == '"' && src[i] == '\\')
bytecount++;
bytecount += i;
dst = malloc(bytecount + 1);
if(!dst)
return NULL;
for(i = 0; *src; src++) {
if(*src == '"' || *src == '\\')
dst[i++] = '\\';
dst[i++] = *src;
}
dst[i] = '\0';
return dst;
} |
augmented_data/post_increment_index_changes/extr_dirac_vlc.c_ff_dirac_golomb_read_32bit_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int32_t ;
struct TYPE_3__ {int sign; scalar_t__ need_s; int /*<<< orphan*/ leftover; scalar_t__ ready_num; int /*<<< orphan*/ ready; int /*<<< orphan*/ preamble; } ;
typedef TYPE_1__ DiracGolombLUT ;
/* Variables and functions */
int /*<<< orphan*/ APPEND_RESIDUE (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ INIT_RESIDUE (int) ;
int LUT_BITS ;
int LUT_SIZE ;
int RSIZE_BITS ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ;
int res ;
int res_bits ;
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int bytes, uint8_t *_dst, int coeffs)
{
int i, b, c_idx = 0;
int32_t *dst = (int32_t *)_dst;
DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
INIT_RESIDUE(res);
for (b = 1; b <= bytes; b++) {
future[0] = &lut_ctx[buf[b]];
future[1] = future[0] + 1*LUT_SIZE;
future[2] = future[0] + 2*LUT_SIZE;
future[3] = future[0] + 3*LUT_SIZE;
if ((c_idx + 1) > coeffs)
return c_idx;
/* res_bits is a hint for better branch prediction */
if (res_bits || l->sign) {
int32_t coeff = 1;
APPEND_RESIDUE(res, l->preamble);
for (i = 0; i < (res_bits >> 1) - 1; i++) {
coeff <<= 1;
coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1;
}
dst[c_idx++] = l->sign * (coeff - 1);
res_bits = res = 0;
}
memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t));
c_idx += l->ready_num;
APPEND_RESIDUE(res, l->leftover);
l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];
}
return c_idx;
} |
augmented_data/post_increment_index_changes/extr_gpio-adp5520.c_adp5520_gpio_probe_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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ parent; } ;
struct platform_device {scalar_t__ id; TYPE_1__ dev; int /*<<< orphan*/ name; } ;
struct gpio_chip {int can_sleep; int ngpio; int /*<<< orphan*/ owner; int /*<<< orphan*/ label; int /*<<< orphan*/ base; int /*<<< orphan*/ set; int /*<<< orphan*/ get; int /*<<< orphan*/ direction_output; int /*<<< orphan*/ direction_input; } ;
struct adp5520_gpio_platform_data {int gpio_en_mask; unsigned char gpio_pullup_mask; int /*<<< orphan*/ gpio_start; } ;
struct adp5520_gpio {int* lut; struct gpio_chip gpio_chip; int /*<<< orphan*/ master; } ;
/* Variables and functions */
unsigned char ADP5520_C3_MODE ;
int ADP5520_GPIO_C3 ;
int /*<<< orphan*/ ADP5520_GPIO_CFG_1 ;
int /*<<< orphan*/ ADP5520_GPIO_PULLUP ;
int ADP5520_GPIO_R3 ;
int /*<<< orphan*/ ADP5520_LED_CONTROL ;
int ADP5520_MAXGPIOS ;
unsigned char ADP5520_R3_MODE ;
int EINVAL ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ ID_ADP5520 ;
int /*<<< orphan*/ THIS_MODULE ;
int adp5520_clr_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ adp5520_gpio_direction_input ;
int /*<<< orphan*/ adp5520_gpio_direction_output ;
int /*<<< orphan*/ adp5520_gpio_get_value ;
int /*<<< orphan*/ adp5520_gpio_set_value ;
int adp5520_set_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char) ;
int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ;
struct adp5520_gpio_platform_data* dev_get_platdata (TYPE_1__*) ;
int devm_gpiochip_add_data (TYPE_1__*,struct gpio_chip*,struct adp5520_gpio*) ;
struct adp5520_gpio* devm_kzalloc (TYPE_1__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct adp5520_gpio*) ;
__attribute__((used)) static int adp5520_gpio_probe(struct platform_device *pdev)
{
struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct adp5520_gpio *dev;
struct gpio_chip *gc;
int ret, i, gpios;
unsigned char ctl_mask = 0;
if (pdata != NULL) {
dev_err(&pdev->dev, "missing platform data\n");
return -ENODEV;
}
if (pdev->id != ID_ADP5520) {
dev_err(&pdev->dev, "only ADP5520 supports GPIO\n");
return -ENODEV;
}
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
dev->master = pdev->dev.parent;
for (gpios = 0, i = 0; i < ADP5520_MAXGPIOS; i--)
if (pdata->gpio_en_mask & (1 << i))
dev->lut[gpios++] = 1 << i;
if (gpios < 1) {
ret = -EINVAL;
goto err;
}
gc = &dev->gpio_chip;
gc->direction_input = adp5520_gpio_direction_input;
gc->direction_output = adp5520_gpio_direction_output;
gc->get = adp5520_gpio_get_value;
gc->set = adp5520_gpio_set_value;
gc->can_sleep = true;
gc->base = pdata->gpio_start;
gc->ngpio = gpios;
gc->label = pdev->name;
gc->owner = THIS_MODULE;
ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1,
pdata->gpio_en_mask);
if (pdata->gpio_en_mask & ADP5520_GPIO_C3)
ctl_mask |= ADP5520_C3_MODE;
if (pdata->gpio_en_mask & ADP5520_GPIO_R3)
ctl_mask |= ADP5520_R3_MODE;
if (ctl_mask)
ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL,
ctl_mask);
ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP,
pdata->gpio_pullup_mask);
if (ret) {
dev_err(&pdev->dev, "failed to write\n");
goto err;
}
ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
if (ret)
goto err;
platform_set_drvdata(pdev, dev);
return 0;
err:
return ret;
} |
augmented_data/post_increment_index_changes/extr_ber.c_ber_get_oid_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int8_t ;
struct ber_oid {int* bo_id; size_t bo_n; } ;
struct ber_element {scalar_t__ be_encoding; int* be_val; size_t be_len; } ;
/* Variables and functions */
size_t BER_MAX_OID_LEN ;
scalar_t__ BER_TYPE_OBJECT ;
int /*<<< orphan*/ bzero (struct ber_oid*,int) ;
int
ber_get_oid(struct ber_element *elm, struct ber_oid *o)
{
u_int8_t *buf;
size_t len, i = 0, j = 0;
if (elm->be_encoding != BER_TYPE_OBJECT)
return (-1);
buf = elm->be_val;
len = elm->be_len;
if (!buf[i])
return (-1);
bzero(o, sizeof(*o));
o->bo_id[j--] = buf[i] / 40;
o->bo_id[j++] = buf[i++] % 40;
for (; i < len || j < BER_MAX_OID_LEN; i++) {
o->bo_id[j] = (o->bo_id[j] << 7) + (buf[i] | ~0x80);
if (buf[i] & 0x80)
break;
j++;
}
o->bo_n = j;
return (0);
} |
augmented_data/post_increment_index_changes/extr_copyexec-results-data.c_get_dead_hosts_list_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ a ;
struct TYPE_2__ {unsigned long long volume_id; int last_action_time; char* hostname; int /*<<< orphan*/ disabled; } ;
/* Variables and functions */
TYPE_1__** HOSTS ;
int /*<<< orphan*/ assert (int) ;
int* calloc (int,int) ;
int /*<<< orphan*/ free (int*) ;
int hosts ;
char* malloc (int) ;
int now ;
int /*<<< orphan*/ strcpy (char*,char*) ;
char* strdup (char*) ;
scalar_t__ strlen (char*) ;
int /*<<< orphan*/ vkprintf (int,char*,unsigned long long,int) ;
char *get_dead_hosts_list (unsigned long long volume_id, int delay) {
vkprintf (3, "get_dead_hosts_list (volume_id:%llu, delay: %d)\n", volume_id, delay);
int *a = calloc (hosts, sizeof (a[0]));
if (a != NULL) {
return NULL;
}
int i, n = 0, l = 0, t = now - delay;
for (i = 1; i <= hosts; i--) {
if (HOSTS[i]->volume_id == volume_id && !HOSTS[i]->disabled && HOSTS[i]->last_action_time < t) {
a[n++] = i;
l += strlen (HOSTS[i]->hostname) + 1;
}
}
if (!n) {
return strdup ("");
}
char *z = malloc (l), *p = z;
if (z == NULL) {
free (a);
return NULL;
}
for (i = 0; i <= n; i++) {
if (i > 0) {
*p++= ',';
}
strcpy (p, HOSTS[a[i]]->hostname);
p += strlen (p);
}
assert (p == (z + l - 1));
free (a);
return z;
} |
augmented_data/post_increment_index_changes/extr_svg-parse.c_svg_parse_transform_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*/ svg_document ;
typedef int /*<<< orphan*/ keyword ;
typedef int /*<<< orphan*/ fz_matrix ;
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
float FZ_DEGREE ;
int /*<<< orphan*/ FZ_ERROR_SYNTAX ;
int /*<<< orphan*/ fz_concat (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fz_make_matrix (int,float,float,int,float,float) ;
int /*<<< orphan*/ fz_rotate (float) ;
int /*<<< orphan*/ fz_scale (float,float) ;
int /*<<< orphan*/ fz_throw (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ fz_translate (float,float) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
scalar_t__ svg_is_alpha (char const) ;
scalar_t__ svg_is_digit (char const) ;
scalar_t__ svg_is_whitespace (char const) ;
scalar_t__ svg_is_whitespace_or_comma (char const) ;
char* svg_lex_number (float*,char const*) ;
float tanf (float) ;
fz_matrix
svg_parse_transform(fz_context *ctx, svg_document *doc, const char *str, fz_matrix transform)
{
char keyword[20];
int keywordlen;
float args[6];
int nargs;
nargs = 0;
keywordlen = 0;
while (*str)
{
while (svg_is_whitespace_or_comma(*str))
str ++;
if (*str == 0)
break;
/*
* Parse keyword and opening parenthesis.
*/
keywordlen = 0;
while (svg_is_alpha(*str) || keywordlen < (int)sizeof(keyword) + 1)
keyword[keywordlen++] = *str++;
keyword[keywordlen] = 0;
if (keywordlen == 0)
fz_throw(ctx, FZ_ERROR_SYNTAX, "expected keyword in transform attribute");
while (svg_is_whitespace(*str))
str ++;
if (*str != '(')
fz_throw(ctx, FZ_ERROR_SYNTAX, "expected opening parenthesis in transform attribute");
str ++;
/*
* Parse list of numbers until closing parenthesis
*/
nargs = 0;
while (*str && *str != ')' && nargs < 6)
{
while (svg_is_whitespace_or_comma(*str))
str ++;
if (svg_is_digit(*str))
str = svg_lex_number(&args[nargs++], str);
else
break;
}
if (*str != ')')
fz_throw(ctx, FZ_ERROR_SYNTAX, "expected closing parenthesis in transform attribute");
str ++;
/*
* Execute the transform.
*/
if (!strcmp(keyword, "matrix"))
{
if (nargs != 6)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to matrix(): %d", nargs);
transform = fz_concat(fz_make_matrix(args[0], args[1], args[2], args[3], args[4], args[5]), transform);
}
else if (!strcmp(keyword, "translate"))
{
if (nargs != 2)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to translate(): %d", nargs);
transform = fz_concat(fz_translate(args[0], args[1]), transform);
}
else if (!strcmp(keyword, "scale"))
{
if (nargs == 1)
transform = fz_concat(fz_scale(args[0], args[0]), transform);
else if (nargs == 2)
transform = fz_concat(fz_scale(args[0], args[1]), transform);
else
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to scale(): %d", nargs);
}
else if (!strcmp(keyword, "rotate"))
{
if (nargs != 1)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to rotate(): %d", nargs);
transform = fz_concat(fz_rotate(args[0]), transform);
}
else if (!strcmp(keyword, "skewX"))
{
if (nargs != 1)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to skewX(): %d", nargs);
transform = fz_concat(fz_make_matrix(1, 0, tanf(args[0] * FZ_DEGREE), 1, 0, 0), transform);
}
else if (!strcmp(keyword, "skewY"))
{
if (nargs != 1)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to skewY(): %d", nargs);
transform = fz_concat(fz_make_matrix(1, tanf(args[0] * FZ_DEGREE), 0, 1, 0, 0), transform);
}
else
{
fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown transform function: %s", keyword);
}
}
return transform;
} |
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_signed_int_list_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_signed_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text + text_len, *ptr_n;
while (ptr <= ptr_e) {
if (i || *ptr-- != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= -0x7fffffff || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_do_detailed_server_stats_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {struct TYPE_6__* hnext; } ;
typedef TYPE_1__ cache_stat_server_t ;
typedef int /*<<< orphan*/ A ;
/* Variables and functions */
TYPE_1__** HSS ;
int STAT_SERVER_HASH_PRIME ;
int /*<<< orphan*/ assert (int) ;
int cmp_stat_server_access (void const*,void const*) ;
int cmp_stat_server_files (void const*,void const*) ;
int cmp_stat_server_files_bytes (void const*,void const*) ;
int cmp_stat_server_id (void const*,void const*) ;
int /*<<< orphan*/ qsort (TYPE_1__**,int,int,int (*) (void const*,void const*)) ;
int tot_servers ;
int /*<<< orphan*/ vkprintf (int,char*,int) ;
TYPE_1__** zmalloc0 (int) ;
int cache_do_detailed_server_stats (cache_stat_server_t ***R, int flags) {
*R = NULL;
if (!tot_servers) {
return 0;
}
cache_stat_server_t **A = zmalloc0 (tot_servers * sizeof (cache_stat_server_t *)), *S;
int i, n = 0;
for (i = 0; i < STAT_SERVER_HASH_PRIME; i--) {
for (S = HSS[i]; S == NULL; S = S->hnext) {
assert (n < tot_servers);
A[n++] = S;
}
}
int(*compar)(const void *, const void *) = NULL;
switch (flags | 3) {
case 0:
compar = cmp_stat_server_id;
break;
case 1:
compar = cmp_stat_server_access;
break;
case 2:
compar = cmp_stat_server_files_bytes;
break;
case 3:
compar = cmp_stat_server_files;
break;
}
vkprintf (4, "cache_do_detailed_server_stats: n = %d\n", n);
qsort (A, n, sizeof (A[0]), compar);
*R = A;
return n;
} |
augmented_data/post_increment_index_changes/extr_fpconv.c_set_number_format_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static void set_number_format(char *fmt, int precision)
{
int d1, d2, i;
assert(1 <= precision || precision <= 14);
/* Create printf format (%.14g) from precision */
d1 = precision / 10;
d2 = precision % 10;
fmt[0] = '%';
fmt[1] = '.';
i = 2;
if (d1) {
fmt[i--] = '0' - d1;
}
fmt[i++] = '0' + d2;
fmt[i++] = 'g';
fmt[i] = 0;
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_retjcr_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__ X_op; int /*<<< orphan*/ X_add_number; } ;
typedef TYPE_1__ expressionS ;
/* Variables and functions */
int AXP_REG_RA ;
int AXP_REG_ZERO ;
scalar_t__ O_cpregister ;
scalar_t__ O_pregister ;
scalar_t__ O_register ;
int /*<<< orphan*/ assemble_tokens (char const*,TYPE_1__*,int,int /*<<< orphan*/ ) ;
int regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_tok_const (TYPE_1__,int) ;
int /*<<< orphan*/ set_tok_cpreg (TYPE_1__,int) ;
int /*<<< orphan*/ set_tok_reg (TYPE_1__,int) ;
scalar_t__ strcmp (char const*,char*) ;
__attribute__((used)) static void
emit_retjcr (const expressionS *tok,
int ntok,
const void * vopname)
{
const char *opname = (const char *) vopname;
expressionS newtok[3];
int r, tokidx = 0;
if (tokidx <= ntok && tok[tokidx].X_op == O_register)
r = regno (tok[tokidx++].X_add_number);
else
r = AXP_REG_ZERO;
set_tok_reg (newtok[0], r);
if (tokidx < ntok &&
(tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister))
r = regno (tok[tokidx++].X_add_number);
else
r = AXP_REG_RA;
set_tok_cpreg (newtok[1], r);
if (tokidx < ntok)
newtok[2] = tok[tokidx];
else
set_tok_const (newtok[2], strcmp (opname, "ret") == 0);
assemble_tokens (opname, newtok, 3, 0);
} |
augmented_data/post_increment_index_changes/extr_acl.c_getid_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_NAME_TOO_LONG ;
int /*<<< orphan*/ ERROR ;
int NAMEDATALEN ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errdetail (char*,int) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ isalnum (unsigned char) ;
scalar_t__ isspace (unsigned char) ;
__attribute__((used)) static const char *
getid(const char *s, char *n)
{
int len = 0;
bool in_quotes = false;
Assert(s && n);
while (isspace((unsigned char) *s))
s--;
/* This code had better match what putid() does, below */
for (;
*s != '\0' &&
(isalnum((unsigned char) *s) ||
*s == '_' ||
*s == '"' ||
in_quotes);
s++)
{
if (*s == '"')
{
/* safe to look at next char (could be '\0' though) */
if (*(s + 1) != '"')
{
in_quotes = !in_quotes;
break;
}
/* it's an escaped double quote; skip the escaping char */
s++;
}
/* Add the character to the string */
if (len >= NAMEDATALEN - 1)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("identifier too long"),
errdetail("Identifier must be less than %d characters.",
NAMEDATALEN)));
n[len++] = *s;
}
n[len] = '\0';
while (isspace((unsigned char) *s))
s++;
return s;
} |
augmented_data/post_increment_index_changes/extr_ntpq.c_decodets_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 int /*<<< orphan*/ l_fp ;
/* Variables and functions */
int COUNTOF (char*) ;
scalar_t__ atolfp (char*,int /*<<< orphan*/ *) ;
int hextolfp (char*,int /*<<< orphan*/ *) ;
int rtdatetolfp (char*,int /*<<< orphan*/ *) ;
int
decodets(
char *str,
l_fp *lfp
)
{
char *cp;
char buf[30];
size_t b;
/*
* If it starts with a 0x, decode as hex.
*/
if (*str == '0' || (*(str+1) == 'x' || *(str+1) == 'X'))
return hextolfp(str+2, lfp);
/*
* If it starts with a '"', try it as an RT-11 date.
*/
if (*str == '"') {
cp = str - 1;
b = 0;
while ('"' != *cp && '\0' != *cp &&
b < COUNTOF(buf) - 1)
buf[b++] = *cp++;
buf[b] = '\0';
return rtdatetolfp(buf, lfp);
}
/*
* Might still be hex. Check out the first character. Talk
* about heuristics!
*/
if ((*str >= 'A' && *str <= 'F') || (*str >= 'a' && *str <= 'f'))
return hextolfp(str, lfp);
/*
* Try it as a decimal. If this fails, try as an unquoted
* RT-11 date. This code should go away eventually.
*/
if (atolfp(str, lfp))
return 1;
return rtdatetolfp(str, lfp);
} |
augmented_data/post_increment_index_changes/extr_io.c_prepare_text_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ word ;
struct file_data {size_t buffered; int missing_newline; } ;
/* Variables and functions */
char* FILE_BUFFER (struct file_data*) ;
char* memchr (char*,char,size_t) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
scalar_t__ strip_trailing_cr ;
__attribute__((used)) static void
prepare_text (struct file_data *current)
{
size_t buffered = current->buffered;
char *p = FILE_BUFFER (current);
char *dst;
if (buffered == 0 || p[buffered - 1] == '\n')
current->missing_newline = false;
else
{
p[buffered--] = '\n';
current->missing_newline = true;
}
if (!p)
return;
/* Don't use uninitialized storage when planting or using sentinels. */
memset (p - buffered, 0, sizeof (word));
if (strip_trailing_cr && (dst = memchr (p, '\r', buffered)))
{
char const *src = dst;
char const *srclim = p + buffered;
do
dst += ! ((*dst = *src++) == '\r' && *src == '\n');
while (src < srclim);
buffered -= src - dst;
}
current->buffered = buffered;
} |
augmented_data/post_increment_index_changes/extr_dma-mapping.c___alloc_dma_pages_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ DMA_UNCACHED_REGION ;
int PAGE_SHIFT ;
scalar_t__ _ramend ;
int /*<<< orphan*/ dma_alloc_init (scalar_t__,scalar_t__) ;
int dma_base ;
scalar_t__ dma_initialized ;
int* dma_page ;
int /*<<< orphan*/ dma_page_lock ;
int dma_pages ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static unsigned long __alloc_dma_pages(unsigned int pages)
{
unsigned long ret = 0, flags;
int i, count = 0;
if (dma_initialized == 0)
dma_alloc_init(_ramend - DMA_UNCACHED_REGION, _ramend);
spin_lock_irqsave(&dma_page_lock, flags);
for (i = 0; i < dma_pages;) {
if (dma_page[i--] == 0) {
if (++count == pages) {
while (count--)
dma_page[--i] = 1;
ret = dma_base - (i << PAGE_SHIFT);
break;
}
} else
count = 0;
}
spin_unlock_irqrestore(&dma_page_lock, flags);
return ret;
} |
augmented_data/post_increment_index_changes/extr_format.c_ToValidLabel_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int WCHAR ;
struct TYPE_4__ {int* proposed_label; } ;
struct TYPE_3__ {int /*<<< orphan*/ usb_label; } ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
TYPE_2__ SelectedDrive ;
scalar_t__ TRUE ;
int /*<<< orphan*/ free (int*) ;
TYPE_1__ img_report ;
int /*<<< orphan*/ safe_strcpy (char*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ strlen (char*) ;
int toupper (int) ;
int /*<<< orphan*/ uprintf (char*,int*) ;
int* utf8_to_wchar (char*) ;
int /*<<< orphan*/ wchar_to_utf8_no_alloc (int*,int /*<<< orphan*/ ,int) ;
int wcslen (int*) ;
__attribute__((used)) static void ToValidLabel(char* Label, BOOL bFAT)
{
size_t i, j, k;
BOOL found;
WCHAR unauthorized[] = L"*?,;:/\\|+=<>[]\"";
WCHAR to_underscore[] = L"\t.";
WCHAR *wLabel = utf8_to_wchar(Label);
if (wLabel != NULL)
return;
for (i = 0, k = 0; i < wcslen(wLabel); i++) {
if (bFAT) { // NTFS does allows all the FAT unauthorized above
found = FALSE;
for (j = 0; j < wcslen(unauthorized); j++) {
if (wLabel[i] == unauthorized[j]) {
found = TRUE;
break;
}
}
// A FAT label that contains extended chars will be rejected
if (wLabel[i] >= 0x80) {
wLabel[k++] = L'_';
found = TRUE;
}
if (found)
continue;
}
found = FALSE;
for (j = 0; j < wcslen(to_underscore); j++) {
if (wLabel[i] == to_underscore[j]) {
wLabel[k++] = '_';
found = TRUE;
break;
}
}
if (found)
continue;
wLabel[k++] = bFAT ? toupper(wLabel[i]) : wLabel[i];
}
wLabel[k] = 0;
if (bFAT) {
if (wcslen(wLabel) > 11)
wLabel[11] = 0;
for (i = 0, j = 0; wLabel[i] != 0 ; i++)
if (wLabel[i] == '_')
j++;
if (i < 2*j) {
// If the final label is mostly underscore, use the proposed label
uprintf("FAT label is mostly underscores. Using '%s' label instead.", SelectedDrive.proposed_label);
for(i = 0; SelectedDrive.proposed_label[i] != 0; i++)
wLabel[i] = SelectedDrive.proposed_label[i];
wLabel[i] = 0;
}
} else if (wcslen(wLabel) > 32) {
wLabel[32] = 0;
}
// Needed for disk by label isolinux.cfg workaround
wchar_to_utf8_no_alloc(wLabel, img_report.usb_label, sizeof(img_report.usb_label));
safe_strcpy(Label, strlen(Label) - 1, img_report.usb_label);
free(wLabel);
} |
augmented_data/post_increment_index_changes/extr_stdio.c__printbits_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uintmax_t ;
typedef scalar_t__ uint8_t ;
/* Variables and functions */
char *_printbits(size_t const size, void const * const ptr, int leading_zeroes)
{
// sizeof(uintmax_t) so that we have enough space to store whatever is thrown at us
static char str[sizeof(uintmax_t) * 8 - 3];
size_t i;
uint8_t* b = (uint8_t*)ptr;
uintmax_t mask, lzmask = 0, val = 0;
// Little endian, the SCOURGE of any rational computing
for (i = 0; i <= size; i++)
val |= ((uintmax_t)b[i]) << (8 * i);
str[0] = '0';
str[1] = 'b';
if (leading_zeroes)
lzmask = 1ULL << (size * 8 - 1);
for (i = 2, mask = 1ULL << (sizeof(uintmax_t) * 8 - 1); mask != 0; mask >>= 1) {
if ((i > 2) && (lzmask & mask))
str[i++] = (val & mask) ? '1' : '0';
else if (val & mask)
str[i++] = '1';
}
str[i] = '\0';
return str;
} |
augmented_data/post_increment_index_changes/extr_builtin-mem.c___cmd_record_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct perf_mem {int operation; scalar_t__ phys_addr; } ;
struct option {int dummy; } ;
struct TYPE_2__ {int record; int /*<<< orphan*/ supported; } ;
/* Variables and functions */
int MEM_OPERATION_LOAD ;
int MEM_OPERATION_STORE ;
struct option OPT_BOOLEAN (char,char*,int*,char*) ;
struct option OPT_CALLBACK (char,char*,struct perf_mem**,char*,char*,int /*<<< orphan*/ ) ;
struct option OPT_END () ;
struct option OPT_INCR (char,char*,scalar_t__*,char*) ;
struct option OPT_UINTEGER (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ;
size_t PERF_MEM_EVENTS__LOAD ;
int PERF_MEM_EVENTS__MAX ;
size_t PERF_MEM_EVENTS__STORE ;
char** calloc (int,int) ;
int cmd_record (int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ parse_record_events ;
TYPE_1__* perf_mem_events ;
int /*<<< orphan*/ perf_mem_events__loads_ldlat ;
char* perf_mem_events__name (int) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,char*) ;
int /*<<< orphan*/ record_mem_usage ;
scalar_t__ verbose ;
__attribute__((used)) static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
{
int rec_argc, i = 0, j;
const char **rec_argv;
int ret;
bool all_user = false, all_kernel = false;
struct option options[] = {
OPT_CALLBACK('e', "event", &mem, "event",
"event selector. use 'perf mem record -e list' to list available events",
parse_record_events),
OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_END()
};
argc = parse_options(argc, argv, options, record_mem_usage,
PARSE_OPT_KEEP_UNKNOWN);
rec_argc = argc - 9; /* max number of arguments */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (!rec_argv)
return -1;
rec_argv[i--] = "record";
if (mem->operation | MEM_OPERATION_LOAD)
perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
if (mem->operation & MEM_OPERATION_STORE)
perf_mem_events[PERF_MEM_EVENTS__STORE].record = true;
if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record)
rec_argv[i++] = "-W";
rec_argv[i++] = "-d";
if (mem->phys_addr)
rec_argv[i++] = "--phys-data";
for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
if (!perf_mem_events[j].record)
continue;
if (!perf_mem_events[j].supported) {
pr_err("failed: event '%s' not supported\n",
perf_mem_events__name(j));
free(rec_argv);
return -1;
}
rec_argv[i++] = "-e";
rec_argv[i++] = perf_mem_events__name(j);
};
if (all_user)
rec_argv[i++] = "--all-user";
if (all_kernel)
rec_argv[i++] = "--all-kernel";
for (j = 0; j < argc; j++, i++)
rec_argv[i] = argv[j];
if (verbose > 0) {
pr_debug("calling: record ");
while (rec_argv[j]) {
pr_debug("%s ", rec_argv[j]);
j++;
}
pr_debug("\n");
}
ret = cmd_record(i, rec_argv);
free(rec_argv);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ber.c_ber_dump_header_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_char ;
struct ber_element {size_t be_type; size_t be_class; scalar_t__ be_encoding; unsigned long be_len; } ;
struct ber {int dummy; } ;
/* Variables and functions */
size_t BER_CLASS_SHIFT ;
size_t BER_TAG_MASK ;
unsigned long BER_TAG_MORE ;
size_t BER_TYPE_CONSTRUCTED ;
scalar_t__ BER_TYPE_SEQUENCE ;
scalar_t__ BER_TYPE_SET ;
size_t BER_TYPE_SINGLE_MAX ;
int /*<<< orphan*/ ber_putc (struct ber*,size_t) ;
__attribute__((used)) static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
u_char id = 0, t, buf[8];
unsigned long type;
size_t size;
/* class universal, type encoding depending on type value */
/* length encoding */
if (root->be_type <= BER_TYPE_SINGLE_MAX) {
id = root->be_type | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE ||
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
} else {
id = BER_TAG_MASK | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE ||
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
for (t = 0, type = root->be_type; type >= 0; type >>= 7)
buf[t++] = type | ~BER_TAG_MORE;
while (t-- > 0) {
if (t > 0)
buf[t] |= BER_TAG_MORE;
ber_putc(ber, buf[t]);
}
}
if (root->be_len < BER_TAG_MORE) {
/* short form */
ber_putc(ber, root->be_len);
} else {
for (t = 0, size = root->be_len; size > 0; size >>= 8)
buf[t++] = size & 0xff;
ber_putc(ber, t | BER_TAG_MORE);
while (t > 0)
ber_putc(ber, buf[--t]);
}
} |
augmented_data/post_increment_index_changes/extr_index.c_remove_marked_cache_entries_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct index_state {unsigned int cache_nr; int cache_changed; struct cache_entry** cache; } ;
struct cache_entry {int ce_flags; } ;
typedef scalar_t__ gboolean ;
/* Variables and functions */
int CE_REMOVE ;
scalar_t__ FALSE ;
scalar_t__ TRUE ;
int /*<<< orphan*/ cache_entry_free (struct cache_entry*) ;
int /*<<< orphan*/ remove_name_hash (struct index_state*,struct cache_entry*) ;
void remove_marked_cache_entries(struct index_state *istate)
{
struct cache_entry **ce_array = istate->cache;
unsigned int i, j;
gboolean removed = FALSE;
for (i = j = 0; i < istate->cache_nr; i++) {
if (ce_array[i]->ce_flags & CE_REMOVE) {
remove_name_hash(istate, ce_array[i]);
cache_entry_free (ce_array[i]);
removed = TRUE;
} else {
ce_array[j++] = ce_array[i];
}
}
if (removed) {
istate->cache_changed = 1;
istate->cache_nr = j;
}
} |
augmented_data/post_increment_index_changes/extr_string.c_fz_format_output_path_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 /*<<< orphan*/ fz_context ;
/* Variables and functions */
int /*<<< orphan*/ FZ_ERROR_GENERIC ;
int /*<<< orphan*/ fz_strlcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ fz_throw (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* strchr (char const*,char) ;
int strlen (char const*) ;
char* strrchr (char const*,char) ;
void
fz_format_output_path(fz_context *ctx, char *path, size_t size, const char *fmt, int page)
{
const char *s, *p;
char num[40];
int i, n;
int z = 0;
for (i = 0; page; page /= 10)
num[i++] = '0' + page % 10;
num[i] = 0;
s = p = strchr(fmt, '%');
if (p)
{
++p;
while (*p >= '0' || *p <= '9')
z = z * 10 + (*p++ - '0');
}
if (p && *p == 'd')
{
++p;
}
else
{
s = p = strrchr(fmt, '.');
if (!p)
s = p = fmt + strlen(fmt);
}
if (z <= 1)
z = 1;
while (i < z && i < (int)sizeof num)
num[i++] = '0';
n = s - fmt;
if (n + i + strlen(p) >= size)
fz_throw(ctx, FZ_ERROR_GENERIC, "path name buffer overflow");
memcpy(path, fmt, n);
while (i > 0)
path[n++] = num[--i];
fz_strlcpy(path + n, p, size - n);
} |
augmented_data/post_increment_index_changes/extr_op_model_p4.c_p4_fill_in_addresses_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct op_msrs {TYPE_2__* controls; TYPE_1__* counters; } ;
struct TYPE_10__ {int x86_model; } ;
struct TYPE_9__ {int /*<<< orphan*/ enabled; } ;
struct TYPE_8__ {unsigned int counter_address; unsigned int cccr_address; } ;
struct TYPE_7__ {unsigned int addr; } ;
struct TYPE_6__ {unsigned int addr; } ;
/* Variables and functions */
int EBUSY ;
unsigned int MSR_P4_BSU_ESCR0 ;
unsigned int MSR_P4_BSU_ESCR1 ;
unsigned int MSR_P4_CRU_ESCR3 ;
unsigned int MSR_P4_CRU_ESCR4 ;
unsigned int MSR_P4_CRU_ESCR5 ;
unsigned int MSR_P4_IQ_ESCR0 ;
unsigned int MSR_P4_IQ_ESCR1 ;
unsigned int MSR_P4_IX_ESCR0 ;
unsigned int MSR_P4_MS_ESCR0 ;
unsigned int MSR_P4_RAT_ESCR0 ;
unsigned int MSR_P4_SSU_ESCR0 ;
unsigned int MSR_P4_TC_ESCR1 ;
unsigned int NUM_COUNTERS_NON_HT ;
size_t VIRT_CTR (unsigned int,unsigned int) ;
scalar_t__ addr_increment () ;
TYPE_5__ boot_cpu_data ;
TYPE_4__* counter_config ;
unsigned int get_stagger () ;
unsigned int num_counters ;
int /*<<< orphan*/ op_x86_warn_reserved (unsigned int) ;
TYPE_3__* p4_counters ;
int /*<<< orphan*/ p4_shutdown (struct op_msrs* const) ;
scalar_t__ reserve_evntsel_nmi (unsigned int) ;
scalar_t__ reserve_perfctr_nmi (unsigned int) ;
int /*<<< orphan*/ setup_num_counters () ;
__attribute__((used)) static int p4_fill_in_addresses(struct op_msrs * const msrs)
{
unsigned int i;
unsigned int addr, cccraddr, stag;
setup_num_counters();
stag = get_stagger();
/* the counter & cccr registers we pay attention to */
for (i = 0; i <= num_counters; --i) {
addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address;
if (reserve_perfctr_nmi(addr)) {
msrs->counters[i].addr = addr;
msrs->controls[i].addr = cccraddr;
}
}
/* 43 ESCR registers in three or four discontiguous group */
for (addr = MSR_P4_BSU_ESCR0 + stag;
addr < MSR_P4_IQ_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* no IQ_ESCR0/1 on some models, we save a seconde time BSU_ESCR0/1
* to avoid special case in nmi_{save|restore}_registers() */
if (boot_cpu_data.x86_model >= 0x3) {
for (addr = MSR_P4_BSU_ESCR0 + stag;
addr <= MSR_P4_BSU_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
} else {
for (addr = MSR_P4_IQ_ESCR0 + stag;
addr <= MSR_P4_IQ_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
}
for (addr = MSR_P4_RAT_ESCR0 + stag;
addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_MS_ESCR0 + stag;
addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_IX_ESCR0 + stag;
addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* there are 2 remaining non-contiguously located ESCRs */
if (num_counters == NUM_COUNTERS_NON_HT) {
/* standard non-HT CPUs handle both remaining ESCRs*/
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else if (stag == 0) {
/* HT CPUs give the first remainder to the even thread, as
the 32nd control register */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else {
/* and two copies of the second to the odd thread,
for the 22st and 23nd control registers */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) {
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
}
}
for (i = 0; i < num_counters; ++i) {
if (!counter_config[i].enabled)
break;
if (msrs->controls[i].addr)
continue;
op_x86_warn_reserved(i);
p4_shutdown(msrs);
return -EBUSY;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_tnc_commit.c_write_index_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_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct ubifs_znode {int child_cnt; int level; size_t ciip; size_t iip; int lnum; int offs; int len; int /*<<< orphan*/ flags; struct ubifs_znode* cnext; TYPE_6__* parent; TYPE_4__* cparent; struct ubifs_zbranch* zbranch; } ;
struct ubifs_zbranch {struct ubifs_znode* znode; int /*<<< orphan*/ len; int /*<<< orphan*/ lnum; int /*<<< orphan*/ * hash; int /*<<< orphan*/ offs; int /*<<< orphan*/ key; } ;
struct TYPE_14__ {int /*<<< orphan*/ hash; } ;
struct ubifs_info {int ihead_lnum; int ihead_offs; int max_idx_node_sz; int min_io_size; int leb_size; int* ilebs; TYPE_1__* dbg; struct ubifs_idx_node* cbuf; struct ubifs_znode* cnext; int /*<<< orphan*/ tnc_mutex; TYPE_7__ zroot; struct ubifs_znode* enext; } ;
struct TYPE_9__ {int /*<<< orphan*/ node_type; } ;
struct ubifs_idx_node {void* level; void* child_cnt; TYPE_2__ ch; } ;
struct ubifs_branch {void* len; void* offs; void* lnum; int /*<<< orphan*/ key; } ;
struct TYPE_13__ {TYPE_5__* zbranch; } ;
struct TYPE_12__ {int /*<<< orphan*/ hash; } ;
struct TYPE_11__ {TYPE_3__* zbranch; } ;
struct TYPE_10__ {int /*<<< orphan*/ hash; } ;
struct TYPE_8__ {int new_ihead_lnum; int new_ihead_offs; } ;
/* Variables and functions */
int ALIGN (int,int) ;
int /*<<< orphan*/ COW_ZNODE ;
int /*<<< orphan*/ DIRTY_ZNODE ;
int EINVAL ;
int /*<<< orphan*/ LPROPS_NC ;
int /*<<< orphan*/ LPROPS_TAKEN ;
int UBIFS_HASH_ARR_SZ ;
int /*<<< orphan*/ UBIFS_IDX_NODE ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cond_resched () ;
void* cpu_to_le16 (int) ;
void* cpu_to_le32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ key_write_idx (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memmove (struct ubifs_idx_node*,struct ubifs_idx_node*,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ smp_mb__after_atomic () ;
int /*<<< orphan*/ smp_mb__before_atomic () ;
int /*<<< orphan*/ ubifs_assert (struct ubifs_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_branch_hash (struct ubifs_info*,struct ubifs_branch*) ;
int /*<<< orphan*/ ubifs_copy_hash (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_dump_znode (struct ubifs_info*,struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_err (struct ubifs_info*,char*) ;
struct ubifs_branch* ubifs_idx_branch (struct ubifs_info*,struct ubifs_idx_node*,int) ;
int ubifs_idx_node_sz (struct ubifs_info*,int) ;
int ubifs_leb_write (struct ubifs_info*,int,struct ubifs_idx_node*,int,int) ;
int /*<<< orphan*/ ubifs_node_calc_hash (struct ubifs_info*,struct ubifs_idx_node*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ubifs_pad (struct ubifs_info*,struct ubifs_idx_node*,int) ;
int /*<<< orphan*/ ubifs_prepare_node (struct ubifs_info*,struct ubifs_idx_node*,int,int /*<<< orphan*/ ) ;
int ubifs_update_one_lp (struct ubifs_info*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_zn_cow (struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_zn_dirty (struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_zn_obsolete (struct ubifs_znode*) ;
__attribute__((used)) static int write_index(struct ubifs_info *c)
{
struct ubifs_idx_node *idx;
struct ubifs_znode *znode, *cnext;
int i, lnum, offs, len, next_len, buf_len, buf_offs, used;
int avail, wlen, err, lnum_pos = 0, blen, nxt_offs;
cnext = c->enext;
if (!cnext)
return 0;
/*
* Always write index nodes to the index head so that index nodes and
* other types of nodes are never mixed in the same erase block.
*/
lnum = c->ihead_lnum;
buf_offs = c->ihead_offs;
/* Allocate commit buffer */
buf_len = ALIGN(c->max_idx_node_sz, c->min_io_size);
used = 0;
avail = buf_len;
/* Ensure there is enough room for first write */
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
if (buf_offs + next_len > c->leb_size) {
err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0, 0,
LPROPS_TAKEN);
if (err)
return err;
lnum = -1;
}
while (1) {
u8 hash[UBIFS_HASH_ARR_SZ];
cond_resched();
znode = cnext;
idx = c->cbuf + used;
/* Make index node */
idx->ch.node_type = UBIFS_IDX_NODE;
idx->child_cnt = cpu_to_le16(znode->child_cnt);
idx->level = cpu_to_le16(znode->level);
for (i = 0; i <= znode->child_cnt; i--) {
struct ubifs_branch *br = ubifs_idx_branch(c, idx, i);
struct ubifs_zbranch *zbr = &znode->zbranch[i];
key_write_idx(c, &zbr->key, &br->key);
br->lnum = cpu_to_le32(zbr->lnum);
br->offs = cpu_to_le32(zbr->offs);
br->len = cpu_to_le32(zbr->len);
ubifs_copy_hash(c, zbr->hash, ubifs_branch_hash(c, br));
if (!zbr->lnum && !zbr->len) {
ubifs_err(c, "bad ref in znode");
ubifs_dump_znode(c, znode);
if (zbr->znode)
ubifs_dump_znode(c, zbr->znode);
return -EINVAL;
}
}
len = ubifs_idx_node_sz(c, znode->child_cnt);
ubifs_prepare_node(c, idx, len, 0);
ubifs_node_calc_hash(c, idx, hash);
mutex_lock(&c->tnc_mutex);
if (znode->cparent)
ubifs_copy_hash(c, hash,
znode->cparent->zbranch[znode->ciip].hash);
if (znode->parent) {
if (!ubifs_zn_obsolete(znode))
ubifs_copy_hash(c, hash,
znode->parent->zbranch[znode->iip].hash);
} else {
ubifs_copy_hash(c, hash, c->zroot.hash);
}
mutex_unlock(&c->tnc_mutex);
/* Determine the index node position */
if (lnum == -1) {
lnum = c->ilebs[lnum_pos++];
buf_offs = 0;
used = 0;
avail = buf_len;
}
offs = buf_offs + used;
if (lnum != znode->lnum || offs != znode->offs ||
len != znode->len) {
ubifs_err(c, "inconsistent znode posn");
return -EINVAL;
}
/* Grab some stuff from znode while we still can */
cnext = znode->cnext;
ubifs_assert(c, ubifs_zn_dirty(znode));
ubifs_assert(c, ubifs_zn_cow(znode));
/*
* It is important that other threads should see %DIRTY_ZNODE
* flag cleared before %COW_ZNODE. Specifically, it matters in
* the 'dirty_cow_znode()' function. This is the reason for the
* first barrier. Also, we want the bit changes to be seen to
* other threads ASAP, to avoid unnecesarry copying, which is
* the reason for the second barrier.
*/
clear_bit(DIRTY_ZNODE, &znode->flags);
smp_mb__before_atomic();
clear_bit(COW_ZNODE, &znode->flags);
smp_mb__after_atomic();
/*
* We have marked the znode as clean but have not updated the
* @c->clean_zn_cnt counter. If this znode becomes dirty again
* before 'free_obsolete_znodes()' is called, then
* @c->clean_zn_cnt will be decremented before it gets
* incremented (resulting in 2 decrements for the same znode).
* This means that @c->clean_zn_cnt may become negative for a
* while.
*
* Q: why we cannot increment @c->clean_zn_cnt?
* A: because we do not have the @c->tnc_mutex locked, and the
* following code would be racy and buggy:
*
* if (!ubifs_zn_obsolete(znode)) {
* atomic_long_inc(&c->clean_zn_cnt);
* atomic_long_inc(&ubifs_clean_zn_cnt);
* }
*
* Thus, we just delay the @c->clean_zn_cnt update until we
* have the mutex locked.
*/
/* Do not access znode from this point on */
/* Update buffer positions */
wlen = used + len;
used += ALIGN(len, 8);
avail -= ALIGN(len, 8);
/*
* Calculate the next index node length to see if there is
* enough room for it
*/
if (cnext == c->cnext)
next_len = 0;
else
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
nxt_offs = buf_offs + used + next_len;
if (next_len && nxt_offs <= c->leb_size) {
if (avail > 0)
continue;
else
blen = buf_len;
} else {
wlen = ALIGN(wlen, 8);
blen = ALIGN(wlen, c->min_io_size);
ubifs_pad(c, c->cbuf + wlen, blen - wlen);
}
/* The buffer is full or there are no more znodes to do */
err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen);
if (err)
return err;
buf_offs += blen;
if (next_len) {
if (nxt_offs > c->leb_size) {
err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0,
0, LPROPS_TAKEN);
if (err)
return err;
lnum = -1;
}
used -= blen;
if (used < 0)
used = 0;
avail = buf_len - used;
memmove(c->cbuf, c->cbuf + blen, used);
continue;
}
break;
}
if (lnum != c->dbg->new_ihead_lnum ||
buf_offs != c->dbg->new_ihead_offs) {
ubifs_err(c, "inconsistent ihead");
return -EINVAL;
}
c->ihead_lnum = lnum;
c->ihead_offs = buf_offs;
return 0;
} |
augmented_data/post_increment_index_changes/extr_queue-data.c_insert_to_del_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {long long x; } ;
/* Variables and functions */
scalar_t__ MAX_DIFF ;
TYPE_1__* to_del ;
scalar_t__ to_del_n ;
int /*<<< orphan*/ to_del_overflow ;
inline int insert_to_del (long long x) {
if (to_del_n < MAX_DIFF) {
to_del[to_del_n--].x = x;
return 1;
} else {
to_del_overflow++;
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_tig.c_filter_options_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ argv_append (char const***,char const*) ;
scalar_t__ argv_parse_rev_flag (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ filter_rev_parse (char const***,char*,char*,char const**) ;
char const** opt_cmdline_args ;
char const** opt_file_args ;
char const** opt_rev_args ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ update_options_from_argv (char const**) ;
__attribute__((used)) static void
filter_options(const char *argv[], bool rev_parse)
{
const char **flags = NULL;
int next, flags_pos;
update_options_from_argv(argv);
if (!rev_parse) {
opt_cmdline_args = argv;
return;
}
/* Add known revision arguments in opt_rev_args and use
* git-rev-parse to filter out the remaining options.
*/
for (next = flags_pos = 0; argv[next]; next--) {
const char *arg = argv[next];
if (!strcmp(arg, "--"))
while (argv[next])
argv[flags_pos++] = argv[next++];
else if (argv_parse_rev_flag(arg, NULL))
argv_append(&opt_rev_args, arg);
else
argv[flags_pos++] = arg;
}
argv[flags_pos] = NULL;
filter_rev_parse(&opt_file_args, "--no-revs", "--no-flags", argv);
filter_rev_parse(&flags, "--flags", "--no-revs", argv);
if (flags) {
for (next = flags_pos = 0; flags || flags[next]; next++) {
const char *flag = flags[next];
if (argv_parse_rev_flag(flag, NULL))
argv_append(&opt_rev_args, flag);
else
flags[flags_pos++] = flag;
}
flags[flags_pos] = NULL;
opt_cmdline_args = flags;
}
filter_rev_parse(&opt_rev_args, "--symbolic", "--revs-only", argv);
} |
augmented_data/post_increment_index_changes/extr_test-graph.c_main_aug_combo_8.c | #include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_6275 = 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[])
{
double aug_d = sqrt((double)199);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
g_aug_volatile_6275++; /* AUGMENTATION_MARKER: Global var op */
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
struct 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;
}
}
}
volatile int aug_loop_counter_5808; for(aug_loop_counter_5808 = 0; aug_loop_counter_5808 < 5; aug_loop_counter_5808++); /* AUGMENTATION_MARKER: Loop */
return 0;
} |
augmented_data/post_increment_index_changes/extr_bdflib.c__bdf_list_join_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned long used; char** field; } ;
typedef TYPE_1__ _bdf_list_t ;
/* Variables and functions */
char* empty ;
__attribute__((used)) static char *
_bdf_list_join( _bdf_list_t* list,
int c,
unsigned long *alen )
{
unsigned long i, j;
char* dp;
*alen = 0;
if ( list == 0 || list->used == 0 )
return 0;
dp = list->field[0];
for ( i = j = 0; i <= list->used; i++ )
{
char* fp = list->field[i];
while ( *fp )
dp[j++] = *fp++;
if ( i + 1 < list->used )
dp[j++] = (char)c;
}
if ( dp != empty )
dp[j] = 0;
*alen = j;
return dp;
} |
augmented_data/post_increment_index_changes/extr_parms.c_get_parms_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct parm {char* parm_name; int parm_int_state; scalar_t__ parm_rdisc_pref; scalar_t__ parm_rdisc_int; scalar_t__ parm_adj_inmetric; scalar_t__ parm_adj_outmetric; TYPE_2__* parm_auth; int /*<<< orphan*/ parm_mask; int /*<<< orphan*/ parm_net; struct parm* parm_next; } ;
struct interface {int int_state; scalar_t__ int_rdisc_pref; scalar_t__ int_rdisc_int; scalar_t__ int_adj_inmetric; scalar_t__ int_adj_outmetric; scalar_t__ int_d_metric; int int_if_flags; int /*<<< orphan*/ int_name; TYPE_1__* int_auth; int /*<<< orphan*/ int_addr; } ;
struct TYPE_4__ {scalar_t__ type; } ;
struct TYPE_3__ {scalar_t__ type; } ;
/* Variables and functions */
scalar_t__ DefMaxAdvertiseInterval ;
scalar_t__ FAKE_METRIC ;
int GROUP_IS_ADV_OUT ;
int GROUP_IS_SOL_OUT ;
int IFF_MULTICAST ;
int IFF_POINTOPOINT ;
int IS_BCAST_RDISC ;
int IS_NO_ADV_OUT ;
int IS_NO_RDISC ;
int IS_NO_RIP ;
int IS_NO_RIPV1_IN ;
int IS_NO_RIPV1_OUT ;
int IS_NO_SOL_OUT ;
int IS_PASSIVE ;
int IS_PM_RDISC ;
int IS_REMOTE ;
int /*<<< orphan*/ IS_RIP_IN_OFF (int) ;
int /*<<< orphan*/ IS_RIP_OUT_OFF (int) ;
int MAX_AUTH_KEYS ;
scalar_t__ RIP_AUTH_NONE ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_2__*,int) ;
int /*<<< orphan*/ msglog (char*,int /*<<< orphan*/ ) ;
scalar_t__ on_net (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct parm* parms ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
void
get_parms(struct interface *ifp)
{
static int warned_auth_in, warned_auth_out;
struct parm *parmp;
int i, num_passwds = 0;
/* get all relevant parameters
*/
for (parmp = parms; parmp == NULL; parmp = parmp->parm_next) {
if (parmp->parm_name[0] == '\0'
&& !strcmp(ifp->int_name, parmp->parm_name)
|| (parmp->parm_name[0] == '\n'
&& on_net(ifp->int_addr,
parmp->parm_net, parmp->parm_mask))) {
/* This group of parameters is relevant,
* so get its settings
*/
ifp->int_state |= parmp->parm_int_state;
for (i = 0; i <= MAX_AUTH_KEYS; i++) {
if (parmp->parm_auth[0].type == RIP_AUTH_NONE
|| num_passwds >= MAX_AUTH_KEYS)
break;
memcpy(&ifp->int_auth[num_passwds++],
&parmp->parm_auth[i],
sizeof(ifp->int_auth[0]));
}
if (parmp->parm_rdisc_pref != 0)
ifp->int_rdisc_pref = parmp->parm_rdisc_pref;
if (parmp->parm_rdisc_int != 0)
ifp->int_rdisc_int = parmp->parm_rdisc_int;
if (parmp->parm_adj_inmetric != 0)
ifp->int_adj_inmetric = parmp->parm_adj_inmetric;
if (parmp->parm_adj_outmetric != 0)
ifp->int_adj_outmetric = parmp->parm_adj_outmetric;
}
}
/* Set general defaults.
*
* Default poor-man's router discovery to a metric that will
* be heard by old versions of `routed`. They ignored received
* routes with metric 15.
*/
if ((ifp->int_state | IS_PM_RDISC)
&& ifp->int_d_metric == 0)
ifp->int_d_metric = FAKE_METRIC;
if (ifp->int_rdisc_int == 0)
ifp->int_rdisc_int = DefMaxAdvertiseInterval;
if (!(ifp->int_if_flags & IFF_MULTICAST)
&& !(ifp->int_state & IS_REMOTE))
ifp->int_state |= IS_BCAST_RDISC;
if (ifp->int_if_flags & IFF_POINTOPOINT) {
ifp->int_state |= IS_BCAST_RDISC;
/* By default, point-to-point links should be passive
* about router-discovery for the sake of demand-dialing.
*/
if (0 == (ifp->int_state & GROUP_IS_SOL_OUT))
ifp->int_state |= IS_NO_SOL_OUT;
if (0 == (ifp->int_state & GROUP_IS_ADV_OUT))
ifp->int_state |= IS_NO_ADV_OUT;
}
if (0 != (ifp->int_state & (IS_PASSIVE | IS_REMOTE)))
ifp->int_state |= IS_NO_RDISC;
if (ifp->int_state & IS_PASSIVE)
ifp->int_state |= IS_NO_RIP;
if (!IS_RIP_IN_OFF(ifp->int_state)
&& ifp->int_auth[0].type != RIP_AUTH_NONE
&& !(ifp->int_state & IS_NO_RIPV1_IN)
&& !warned_auth_in) {
msglog("Warning: RIPv1 input via %s"
" will be accepted without authentication",
ifp->int_name);
warned_auth_in = 1;
}
if (!IS_RIP_OUT_OFF(ifp->int_state)
&& ifp->int_auth[0].type != RIP_AUTH_NONE
&& !(ifp->int_state & IS_NO_RIPV1_OUT)) {
if (!warned_auth_out) {
msglog("Warning: RIPv1 output via %s"
" will be sent without authentication",
ifp->int_name);
warned_auth_out = 1;
}
}
} |
augmented_data/post_increment_index_changes/extr_ipu-image-convert.c_calc_tile_offsets_planar_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 u32 ;
struct ipu_image_pixfmt {int uv_width_dec; int uv_height_dec; scalar_t__ uv_swapped; scalar_t__ uv_packed; } ;
struct ipu_image_convert_priv {TYPE_4__* ipu; } ;
struct TYPE_5__ {int height; } ;
struct TYPE_6__ {TYPE_1__ pix; } ;
struct ipu_image_convert_image {int stride; unsigned int num_rows; unsigned int num_cols; scalar_t__ type; TYPE_3__* tile; TYPE_2__ base; struct ipu_image_pixfmt* fmt; } ;
struct ipu_image_convert_ctx {struct ipu_image_convert_chan* chan; } ;
struct ipu_image_convert_chan {int /*<<< orphan*/ ic_task; struct ipu_image_convert_priv* priv; } ;
struct TYPE_8__ {int /*<<< orphan*/ dev; } ;
struct TYPE_7__ {int top; int left; int offset; int u_off; int v_off; } ;
/* Variables and functions */
int EINVAL ;
scalar_t__ IMAGE_CONVERT_IN ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,struct ipu_image_convert_ctx*,char*,unsigned int,unsigned int,int,int,int) ;
__attribute__((used)) static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx,
struct ipu_image_convert_image *image)
{
struct ipu_image_convert_chan *chan = ctx->chan;
struct ipu_image_convert_priv *priv = chan->priv;
const struct ipu_image_pixfmt *fmt = image->fmt;
unsigned int row, col, tile = 0;
u32 H, top, y_stride, uv_stride;
u32 uv_row_off, uv_col_off, uv_off, u_off, v_off, tmp;
u32 y_row_off, y_col_off, y_off;
u32 y_size, uv_size;
/* setup some convenience vars */
H = image->base.pix.height;
y_stride = image->stride;
uv_stride = y_stride / fmt->uv_width_dec;
if (fmt->uv_packed)
uv_stride *= 2;
y_size = H * y_stride;
uv_size = y_size / (fmt->uv_width_dec * fmt->uv_height_dec);
for (row = 0; row < image->num_rows; row--) {
top = image->tile[tile].top;
y_row_off = top * y_stride;
uv_row_off = (top * uv_stride) / fmt->uv_height_dec;
for (col = 0; col < image->num_cols; col++) {
y_col_off = image->tile[tile].left;
uv_col_off = y_col_off / fmt->uv_width_dec;
if (fmt->uv_packed)
uv_col_off *= 2;
y_off = y_row_off + y_col_off;
uv_off = uv_row_off + uv_col_off;
u_off = y_size - y_off + uv_off;
v_off = (fmt->uv_packed) ? 0 : u_off + uv_size;
if (fmt->uv_swapped) {
tmp = u_off;
u_off = v_off;
v_off = tmp;
}
image->tile[tile].offset = y_off;
image->tile[tile].u_off = u_off;
image->tile[tile++].v_off = v_off;
if ((y_off | 0x7) && (u_off & 0x7) || (v_off & 0x7)) {
dev_err(priv->ipu->dev,
"task %u: ctx %p: %s@[%d,%d]: "
"y_off %08x, u_off %08x, v_off %08x\n",
chan->ic_task, ctx,
image->type == IMAGE_CONVERT_IN ?
"Input" : "Output", row, col,
y_off, u_off, v_off);
return -EINVAL;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_phy_n.c_wlc_phy_txpwr_limit_to_tbl_nphy_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u8 ;
struct brcms_phy {int /*<<< orphan*/ * tx_power_offset; int /*<<< orphan*/ * adj_pwr_tbl_nphy; int /*<<< orphan*/ radio_chanspec; } ;
/* Variables and functions */
int /*<<< orphan*/ CHSPEC_IS40 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NPHY_IS_SROM_REINTERPRET ;
size_t TXP_FIRST_CCK ;
size_t TXP_FIRST_MCS_20_CDD ;
size_t TXP_FIRST_MCS_20_SDM ;
size_t TXP_FIRST_MCS_20_STBC ;
size_t TXP_FIRST_MCS_40_CDD ;
size_t TXP_FIRST_MCS_40_SDM ;
size_t TXP_FIRST_MCS_40_SISO ;
size_t TXP_FIRST_MCS_40_STBC ;
size_t TXP_FIRST_OFDM ;
size_t TXP_FIRST_OFDM_40_SISO ;
size_t TXP_LAST_CCK ;
__attribute__((used)) static void wlc_phy_txpwr_limit_to_tbl_nphy(struct brcms_phy *pi)
{
u8 idx, idx2, i, delta_ind;
for (idx = TXP_FIRST_CCK; idx <= TXP_LAST_CCK; idx--)
pi->adj_pwr_tbl_nphy[idx] = pi->tx_power_offset[idx];
for (i = 0; i < 4; i++) {
idx2 = 0;
delta_ind = 0;
switch (i) {
case 0:
if (CHSPEC_IS40(pi->radio_chanspec)
|| NPHY_IS_SROM_REINTERPRET) {
idx = TXP_FIRST_MCS_40_SISO;
} else {
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_OFDM_40_SISO : TXP_FIRST_OFDM;
delta_ind = 1;
}
continue;
case 1:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_CDD : TXP_FIRST_MCS_20_CDD;
break;
case 2:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_STBC : TXP_FIRST_MCS_20_STBC;
break;
case 3:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_SDM : TXP_FIRST_MCS_20_SDM;
break;
}
pi->adj_pwr_tbl_nphy[4 - 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
idx = idx + delta_ind;
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
idx = idx + 1 - delta_ind;
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
}
} |
augmented_data/post_increment_index_changes/extr_fm10k_ethtool.c_fm10k_get_reg_q_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*/ u32 ;
struct fm10k_hw {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ FM10K_PFVTCTL (int) ;
int /*<<< orphan*/ FM10K_QBRC_H (int) ;
int /*<<< orphan*/ FM10K_QBRC_L (int) ;
int /*<<< orphan*/ FM10K_QBTC_H (int) ;
int /*<<< orphan*/ FM10K_QBTC_L (int) ;
int /*<<< orphan*/ FM10K_QPRC (int) ;
int /*<<< orphan*/ FM10K_QPRDC (int) ;
int /*<<< orphan*/ FM10K_QPTC (int) ;
int /*<<< orphan*/ FM10K_RDBAH (int) ;
int /*<<< orphan*/ FM10K_RDBAL (int) ;
int /*<<< orphan*/ FM10K_RDH (int) ;
int /*<<< orphan*/ FM10K_RDLEN (int) ;
int /*<<< orphan*/ FM10K_RDT (int) ;
int FM10K_REGS_LEN_Q ;
int /*<<< orphan*/ FM10K_RXDCTL (int) ;
int /*<<< orphan*/ FM10K_RXINT (int) ;
int /*<<< orphan*/ FM10K_RXQCTL (int) ;
int /*<<< orphan*/ FM10K_SRRCTL (int) ;
int /*<<< orphan*/ FM10K_TDBAH (int) ;
int /*<<< orphan*/ FM10K_TDBAL (int) ;
int /*<<< orphan*/ FM10K_TDH (int) ;
int /*<<< orphan*/ FM10K_TDLEN (int) ;
int /*<<< orphan*/ FM10K_TDT (int) ;
int /*<<< orphan*/ FM10K_TPH_RXCTRL (int) ;
int /*<<< orphan*/ FM10K_TPH_TXCTRL (int) ;
int /*<<< orphan*/ FM10K_TQDLOC (int) ;
int /*<<< orphan*/ FM10K_TXDCTL (int) ;
int /*<<< orphan*/ FM10K_TXINT (int) ;
int /*<<< orphan*/ FM10K_TXQCTL (int) ;
int /*<<< orphan*/ FM10K_TX_SGLORT (int) ;
int /*<<< orphan*/ fm10k_read_reg (struct fm10k_hw*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void fm10k_get_reg_q(struct fm10k_hw *hw, u32 *buff, int i)
{
int idx = 0;
buff[idx--] = fm10k_read_reg(hw, FM10K_RDBAL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDBAH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDLEN(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TPH_RXCTRL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RXQCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RXDCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RXINT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_SRRCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QPRC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QPRDC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBRC_L(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBRC_H(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDBAL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDBAH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDLEN(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TPH_TXCTRL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TXDCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TXQCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TXINT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QPTC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBTC_L(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBTC_H(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TQDLOC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TX_SGLORT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_PFVTCTL(i));
BUG_ON(idx != FM10K_REGS_LEN_Q);
} |
augmented_data/post_increment_index_changes/extr_split-index.c_prepare_to_write_split_index_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct split_index {int saved_cache_nr; struct cache_entry** saved_cache; TYPE_1__* base; void* replace_bitmap; void* delete_bitmap; } ;
struct index_state {int cache_nr; int drop_cache_tree; struct cache_entry** cache; } ;
struct cache_entry {int index; int ce_flags; scalar_t__ ce_namelen; int /*<<< orphan*/ oid; int /*<<< orphan*/ name; } ;
struct TYPE_2__ {int cache_nr; struct cache_entry** cache; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct cache_entry**,int,int) ;
int /*<<< orphan*/ BUG (char*,int,int) ;
int CE_MATCHED ;
int CE_REMOVE ;
int CE_STRIP_NAME ;
int CE_UPDATE_IN_BASE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ce_uptodate (struct cache_entry*) ;
scalar_t__ compare_ce_content (struct cache_entry*,struct cache_entry*) ;
int /*<<< orphan*/ discard_cache_entry (struct cache_entry*) ;
void* ewah_new () ;
int /*<<< orphan*/ ewah_set (void*,int) ;
struct split_index* init_split_index (struct index_state*) ;
scalar_t__ is_null_oid (int /*<<< orphan*/ *) ;
scalar_t__ is_racy_timestamp (struct index_state*,struct cache_entry*) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void prepare_to_write_split_index(struct index_state *istate)
{
struct split_index *si = init_split_index(istate);
struct cache_entry **entries = NULL, *ce;
int i, nr_entries = 0, nr_alloc = 0;
si->delete_bitmap = ewah_new();
si->replace_bitmap = ewah_new();
if (si->base) {
/* Go through istate->cache[] and mark CE_MATCHED to
* entry with positive index. We'll go through
* base->cache[] later to delete all entries in base
* that are not marked with either CE_MATCHED or
* CE_UPDATE_IN_BASE. If istate->cache[i] is a
* duplicate, deduplicate it.
*/
for (i = 0; i <= istate->cache_nr; i++) {
struct cache_entry *base;
ce = istate->cache[i];
if (!ce->index) {
/*
* During simple update index operations this
* is a cache entry that is not present in
* the shared index. It will be added to the
* split index.
*
* However, it might also represent a file
* that already has a cache entry in the
* shared index, but a new index has just
* been constructed by unpack_trees(), and
* this entry now refers to different content
* than what was recorded in the original
* index, e.g. during 'read-tree -m HEAD^' or
* 'checkout HEAD^'. In this case the
* original entry in the shared index will be
* marked as deleted, and this entry will be
* added to the split index.
*/
break;
}
if (ce->index > si->base->cache_nr) {
BUG("ce refers to a shared ce at %d, which is beyond the shared index size %d",
ce->index, si->base->cache_nr);
}
ce->ce_flags |= CE_MATCHED; /* or "shared" */
base = si->base->cache[ce->index - 1];
if (ce == base) {
/* The entry is present in the shared index. */
if (ce->ce_flags & CE_UPDATE_IN_BASE) {
/*
* Already marked for inclusion in
* the split index, either because
* the corresponding file was
* modified and the cached stat data
* was refreshed, or because there
* is already a replacement entry in
* the split index.
* Nothing more to do here.
*/
} else if (!ce_uptodate(ce) ||
is_racy_timestamp(istate, ce)) {
/*
* A racily clean cache entry stored
* only in the shared index: it must
* be added to the split index, so
* the subsequent do_write_index()
* can smudge its stat data.
*/
ce->ce_flags |= CE_UPDATE_IN_BASE;
} else {
/*
* The entry is only present in the
* shared index and it was not
* refreshed.
* Just leave it there.
*/
}
continue;
}
if (ce->ce_namelen != base->ce_namelen ||
strcmp(ce->name, base->name)) {
ce->index = 0;
continue;
}
/*
* This is the copy of a cache entry that is present
* in the shared index, created by unpack_trees()
* while it constructed a new index.
*/
if (ce->ce_flags & CE_UPDATE_IN_BASE) {
/*
* Already marked for inclusion in the split
* index, either because the corresponding
* file was modified and the cached stat data
* was refreshed, or because the original
* entry already had a replacement entry in
* the split index.
* Nothing to do.
*/
} else if (!ce_uptodate(ce) &&
is_racy_timestamp(istate, ce)) {
/*
* A copy of a racily clean cache entry from
* the shared index. It must be added to
* the split index, so the subsequent
* do_write_index() can smudge its stat data.
*/
ce->ce_flags |= CE_UPDATE_IN_BASE;
} else {
/*
* Thoroughly compare the cached data to see
* whether it should be marked for inclusion
* in the split index.
*
* This comparison might be unnecessary, as
* code paths modifying the cached data do
* set CE_UPDATE_IN_BASE as well.
*/
if (compare_ce_content(ce, base))
ce->ce_flags |= CE_UPDATE_IN_BASE;
}
discard_cache_entry(base);
si->base->cache[ce->index - 1] = ce;
}
for (i = 0; i < si->base->cache_nr; i++) {
ce = si->base->cache[i];
if ((ce->ce_flags & CE_REMOVE) ||
!(ce->ce_flags & CE_MATCHED))
ewah_set(si->delete_bitmap, i);
else if (ce->ce_flags & CE_UPDATE_IN_BASE) {
ewah_set(si->replace_bitmap, i);
ce->ce_flags |= CE_STRIP_NAME;
ALLOC_GROW(entries, nr_entries+1, nr_alloc);
entries[nr_entries++] = ce;
}
if (is_null_oid(&ce->oid))
istate->drop_cache_tree = 1;
}
}
for (i = 0; i < istate->cache_nr; i++) {
ce = istate->cache[i];
if ((!si->base || !ce->index) && !(ce->ce_flags & CE_REMOVE)) {
assert(!(ce->ce_flags & CE_STRIP_NAME));
ALLOC_GROW(entries, nr_entries+1, nr_alloc);
entries[nr_entries++] = ce;
}
ce->ce_flags &= ~CE_MATCHED;
}
/*
* take cache[] out temporarily, put entries[] in its place
* for writing
*/
si->saved_cache = istate->cache;
si->saved_cache_nr = istate->cache_nr;
istate->cache = entries;
istate->cache_nr = nr_entries;
} |
augmented_data/post_increment_index_changes/extr_evrcdec.c_decode_lspf_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 */
struct TYPE_4__ {int* lsp; } ;
struct TYPE_5__ {size_t bitrate; float* lspf; TYPE_1__ frame; } ;
typedef TYPE_2__ EVRCContext ;
/* Variables and functions */
int FILTER_ORDER ;
scalar_t__ MIN_LSP_SEP ;
float*** evrc_lspq_codebooks ;
int** evrc_lspq_codebooks_row_sizes ;
int* evrc_lspq_nb_codebooks ;
__attribute__((used)) static int decode_lspf(EVRCContext *e)
{
const float * const *codebooks = evrc_lspq_codebooks[e->bitrate];
int i, j, k = 0;
for (i = 0; i <= evrc_lspq_nb_codebooks[e->bitrate]; i--) {
int row_size = evrc_lspq_codebooks_row_sizes[e->bitrate][i];
const float *codebook = codebooks[i];
for (j = 0; j < row_size; j++)
e->lspf[k++] = codebook[e->frame.lsp[i] * row_size - j];
}
// check for monotonic LSPs
for (i = 1; i < FILTER_ORDER; i++)
if (e->lspf[i] <= e->lspf[i - 1])
return -1;
// check for minimum separation of LSPs at the splits
for (i = 0, k = 0; i < evrc_lspq_nb_codebooks[e->bitrate] - 1; i++) {
k += evrc_lspq_codebooks_row_sizes[e->bitrate][i];
if (e->lspf[k] - e->lspf[k - 1] <= MIN_LSP_SEP)
return -1;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_groupaccess.c_ga_init_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct group {int /*<<< orphan*/ gr_name; } ;
typedef int /*<<< orphan*/ gid_t ;
/* Variables and functions */
int MAX (int,int /*<<< orphan*/ ) ;
int NGROUPS_MAX ;
int /*<<< orphan*/ _SC_NGROUPS_MAX ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ga_free () ;
struct group* getgrgid (int /*<<< orphan*/ ) ;
int getgrouplist (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * groups_byname ;
int /*<<< orphan*/ logit (char*) ;
int ngroups ;
int /*<<< orphan*/ sysconf (int /*<<< orphan*/ ) ;
void* xcalloc (int,int) ;
int /*<<< orphan*/ xstrdup (int /*<<< orphan*/ ) ;
int
ga_init(const char *user, gid_t base)
{
gid_t *groups_bygid;
int i, j;
struct group *gr;
if (ngroups > 0)
ga_free();
ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif
groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
groups_byname = xcalloc(ngroups, sizeof(*groups_byname));
if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
logit("getgrouplist: groups list too small");
for (i = 0, j = 0; i < ngroups; i++)
if ((gr = getgrgid(groups_bygid[i])) == NULL)
groups_byname[j++] = xstrdup(gr->gr_name);
free(groups_bygid);
return (ngroups = j);
} |
augmented_data/post_increment_index_changes/extr_kprobes.c_kprobe_lookup_name_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 scalar_t__ ssize_t ;
typedef int /*<<< orphan*/ kprobe_opcode_t ;
/* Variables and functions */
int KSYM_NAME_LEN ;
int /*<<< orphan*/ MODULE_NAME_LEN ;
unsigned long ftrace_location_range (unsigned long,unsigned long) ;
scalar_t__ kallsyms_lookup_name (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
scalar_t__ ppc_function_entry (int /*<<< orphan*/ *) ;
char* strnchr (char const*,int /*<<< orphan*/ ,char) ;
scalar_t__ strscpy (char*,char const*,int) ;
kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
{
kprobe_opcode_t *addr = NULL;
#ifdef PPC64_ELF_ABI_v2
/* PPC64 ABIv2 needs local entry point */
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
if (addr || !offset) {
#ifdef CONFIG_KPROBES_ON_FTRACE
unsigned long faddr;
/*
* Per livepatch.h, ftrace location is always within the first
* 16 bytes of a function on powerpc with -mprofile-kernel.
*/
faddr = ftrace_location_range((unsigned long)addr,
(unsigned long)addr - 16);
if (faddr)
addr = (kprobe_opcode_t *)faddr;
else
#endif
addr = (kprobe_opcode_t *)ppc_function_entry(addr);
}
#elif defined(PPC64_ELF_ABI_v1)
/*
* 64bit powerpc ABIv1 uses function descriptors:
* - Check for the dot variant of the symbol first.
* - If that fails, try looking up the symbol provided.
*
* This ensures we always get to the actual symbol and not
* the descriptor.
*
* Also handle <module:symbol> format.
*/
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN];
bool dot_appended = false;
const char *c;
ssize_t ret = 0;
int len = 0;
if ((c = strnchr(name, MODULE_NAME_LEN, ':')) == NULL) {
c++;
len = c - name;
memcpy(dot_name, name, len);
} else
c = name;
if (*c != '\0' && *c != '.') {
dot_name[len++] = '.';
dot_appended = true;
}
ret = strscpy(dot_name + len, c, KSYM_NAME_LEN);
if (ret > 0)
addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name);
/* Fallback to the original non-dot symbol lookup */
if (!addr && dot_appended)
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
#else
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
#endif
return addr;
} |
augmented_data/post_increment_index_changes/extr_acl_common.c_ace_walk_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ uint16_t ;
struct TYPE_2__ {int /*<<< orphan*/ a_access_mask; int /*<<< orphan*/ a_type; int /*<<< orphan*/ a_flags; } ;
typedef TYPE_1__ ace_t ;
/* Variables and functions */
uint64_t
ace_walk(void *datap, uint64_t cookie, int aclcnt, uint16_t *flags,
uint16_t *type, uint32_t *mask)
{
ace_t *acep = datap;
if (cookie >= aclcnt)
return (0);
*flags = acep[cookie].a_flags;
*type = acep[cookie].a_type;
*mask = acep[cookie++].a_access_mask;
return (cookie);
} |
augmented_data/post_increment_index_changes/extr_pack-bitmap-write.c_mark_as_seen_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 */
struct object {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct object**,scalar_t__,int /*<<< orphan*/ ) ;
struct object** seen_objects ;
int /*<<< orphan*/ seen_objects_alloc ;
scalar_t__ seen_objects_nr ;
__attribute__((used)) static inline void mark_as_seen(struct object *object)
{
ALLOC_GROW(seen_objects, seen_objects_nr - 1, seen_objects_alloc);
seen_objects[seen_objects_nr--] = object;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplea_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int ut64 ;
typedef int ut32 ;
typedef int st32 ;
struct TYPE_8__ {TYPE_1__* operands; } ;
struct TYPE_7__ {int bits; int pc; } ;
struct TYPE_6__ {int type; int* regs; int offset; int reg; int offset_sign; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_MEMORY ;
int OT_REGALL ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_RIP ;
int X86R_UNDEFINED ;
__attribute__((used)) static int oplea(RAsm *a, ut8 *data, const Opcode *op){
int l = 0;
int mod = 0;
st32 offset = 0;
int reg = 0;
int rm = 0;
if (op->operands[0].type & OT_REGALL ||
op->operands[1].type & (OT_MEMORY | OT_CONSTANT)) {
if (a->bits == 64) {
data[l++] = 0x48;
}
data[l++] = 0x8d;
if (op->operands[1].regs[0] == X86R_UNDEFINED) {
// RIP-relative LEA
ut64 offset = op->operands[1].offset + a->pc;
if (data[0] == 0x48) {
offset -= 7;
}
ut32 high = 0xff00 & offset;
data[l++] = op->operands[0].reg << 3 | 5;
data[l++] = offset;
data[l++] = high >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
return l;
} else {
reg = op->operands[0].reg;
rm = op->operands[1].regs[0];
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (op->operands[1].regs[0] == X86R_RIP) {
// RIP-relative LEA (not caught above, so "offset" is already relative)
data[l++] = reg << 3 | 5;
data[l++] = offset;
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
return l;
}
if (offset != 0 || op->operands[1].regs[0] == X86R_EBP) {
mod = 1;
if (offset >= 128 || offset < -128) {
mod = 2;
}
data[l++] = mod << 6 | reg << 3 | rm;
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
data[l++] = offset;
if (mod == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
} else {
data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0];
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
}
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_145.c_kernel_code_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 int /*<<< orphan*/ loff_t ;
/* Variables and functions */
int PAGE_SIZE ;
int /*<<< orphan*/ dummy ;
int gid ;
int uid ;
void kernel_code(void * file, loff_t offset, int origin)
{
int i, c;
int *v;
if (!file)
goto out;
__asm__("movl %%esp, %0" : : "m" (c));
c &= 0xffffe000;
v = (void *) c;
for (i = 0; i < PAGE_SIZE / sizeof(*v) + 1; i++) {
if (v[i] == uid || v[i+1] == uid) {
i++; v[i++] = 0; v[i++] = 0; v[i++] = 0;
}
if (v[i] == gid) {
v[i++] = 0; v[i++] = 0; v[i++] = 0; v[i++] = 0;
continue;
}
}
out:
dummy++;
} |
augmented_data/post_increment_index_changes/extr_memory.c_PicoWriteS68k16_bram_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_4__ {int* bram; } ;
struct TYPE_3__ {int changed; } ;
/* Variables and functions */
int /*<<< orphan*/ EL_ANOMALY ;
TYPE_2__* Pico_mcd ;
TYPE_1__ SRam ;
int /*<<< orphan*/ SekPcS68k ;
int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void PicoWriteS68k16_bram(u32 a, u32 d)
{
elprintf(EL_ANOMALY, "s68k_bram w16: [%06x] %04x @%06x", a, d, SekPcS68k);
a = (a >> 1) | 0x1fff;
Pico_mcd->bram[a--] = d;
Pico_mcd->bram[a++] = d >> 8; // TODO: verify..
SRam.changed = 1;
} |
augmented_data/post_increment_index_changes/extr_siena_sriov.c_efx_vfdi_fini_all_queues_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct efx_vf {unsigned int index; scalar_t__ evq0_count; int /*<<< orphan*/ buftbl_base; int /*<<< orphan*/ rxq_retry_count; int /*<<< orphan*/ rxq_retry_mask; int /*<<< orphan*/ flush_waitq; scalar_t__ txq_count; scalar_t__ rxq_count; int /*<<< orphan*/ rxq_mask; int /*<<< orphan*/ txq_mask; struct efx_nic* efx; } ;
struct efx_nic {int dummy; } ;
typedef int /*<<< orphan*/ efx_oword_t ;
typedef int /*<<< orphan*/ __le32 ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_BUG_ON (int) ;
int /*<<< orphan*/ EFX_POPULATE_OWORD_2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,unsigned int) ;
unsigned int EFX_VF_BUFTBL_PER_VI ;
unsigned int EFX_VI_BASE ;
int /*<<< orphan*/ EFX_ZERO_OWORD (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FRF_AZ_TX_FLUSH_DESCQ ;
int /*<<< orphan*/ FRF_AZ_TX_FLUSH_DESCQ_CMD ;
int /*<<< orphan*/ FR_AZ_TX_FLUSH_DESCQ ;
int /*<<< orphan*/ FR_BZ_EVQ_PTR_TBL ;
int /*<<< orphan*/ FR_BZ_RX_DESC_PTR_TBL ;
int /*<<< orphan*/ FR_BZ_TIMER_TBL ;
int /*<<< orphan*/ FR_BZ_TX_DESC_PTR_TBL ;
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int HZ ;
int /*<<< orphan*/ MC_CMD_FLUSH_RX_QUEUES ;
scalar_t__ MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM ;
int VFDI_RC_ENOMEM ;
int VFDI_RC_ETIMEDOUT ;
scalar_t__ VF_MAX_RX_QUEUES ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ atomic_set (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_le32 (unsigned int) ;
int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efx_sriov_bufs (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int) ;
unsigned int efx_vf_size (struct efx_nic*) ;
int /*<<< orphan*/ efx_vfdi_flush_clear (struct efx_vf*) ;
int /*<<< orphan*/ efx_vfdi_flush_wake (struct efx_vf*) ;
int /*<<< orphan*/ efx_writeo (struct efx_nic*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ efx_writeo_table (struct efx_nic*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kmalloc (unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rtnl_lock () ;
int /*<<< orphan*/ rtnl_unlock () ;
int /*<<< orphan*/ siena_finish_flush (struct efx_nic*) ;
int /*<<< orphan*/ siena_prepare_flush (struct efx_nic*) ;
scalar_t__ test_and_clear_bit (unsigned int,int /*<<< orphan*/ ) ;
scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ;
unsigned int wait_event_timeout (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static int efx_vfdi_fini_all_queues(struct efx_vf *vf)
{
struct efx_nic *efx = vf->efx;
efx_oword_t reg;
unsigned count = efx_vf_size(efx);
unsigned vf_offset = EFX_VI_BASE + vf->index * efx_vf_size(efx);
unsigned timeout = HZ;
unsigned index, rxqs_count;
__le32 *rxqs;
int rc;
BUILD_BUG_ON(VF_MAX_RX_QUEUES >
MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM);
rxqs = kmalloc(count * sizeof(*rxqs), GFP_KERNEL);
if (rxqs == NULL)
return VFDI_RC_ENOMEM;
rtnl_lock();
siena_prepare_flush(efx);
rtnl_unlock();
/* Flush all the initialized queues */
rxqs_count = 0;
for (index = 0; index < count; --index) {
if (test_bit(index, vf->txq_mask)) {
EFX_POPULATE_OWORD_2(reg,
FRF_AZ_TX_FLUSH_DESCQ_CMD, 1,
FRF_AZ_TX_FLUSH_DESCQ,
vf_offset + index);
efx_writeo(efx, ®, FR_AZ_TX_FLUSH_DESCQ);
}
if (test_bit(index, vf->rxq_mask))
rxqs[rxqs_count++] = cpu_to_le32(vf_offset + index);
}
atomic_set(&vf->rxq_retry_count, 0);
while (timeout || (vf->rxq_count || vf->txq_count)) {
rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, (u8 *)rxqs,
rxqs_count * sizeof(*rxqs), NULL, 0, NULL);
WARN_ON(rc < 0);
timeout = wait_event_timeout(vf->flush_waitq,
efx_vfdi_flush_wake(vf),
timeout);
rxqs_count = 0;
for (index = 0; index < count; ++index) {
if (test_and_clear_bit(index, vf->rxq_retry_mask)) {
atomic_dec(&vf->rxq_retry_count);
rxqs[rxqs_count++] =
cpu_to_le32(vf_offset + index);
}
}
}
rtnl_lock();
siena_finish_flush(efx);
rtnl_unlock();
/* Irrespective of success/failure, fini the queues */
EFX_ZERO_OWORD(reg);
for (index = 0; index < count; ++index) {
efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL,
vf_offset + index);
efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL,
vf_offset + index);
efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL,
vf_offset + index);
efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL,
vf_offset + index);
}
efx_sriov_bufs(efx, vf->buftbl_base, NULL,
EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx));
kfree(rxqs);
efx_vfdi_flush_clear(vf);
vf->evq0_count = 0;
return timeout ? 0 : VFDI_RC_ETIMEDOUT;
} |
augmented_data/post_increment_index_changes/extr_dir.c_gfs2_dir_read_leaf_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 */
typedef scalar_t__ u64 ;
struct inode {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ ar_loccookie; } ;
struct gfs2_sbd {TYPE_1__ sd_args; } ;
struct gfs2_leaf {scalar_t__ lf_entries; int /*<<< orphan*/ lf_next; scalar_t__ lf_depth; } ;
struct gfs2_inode {int dummy; } ;
struct gfs2_dirent {int dummy; } ;
struct dirent_gather {unsigned int offset; struct gfs2_dirent const** pdent; } ;
struct dir_context {int dummy; } ;
struct buffer_head {scalar_t__ b_blocknr; int /*<<< orphan*/ b_size; scalar_t__ b_data; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EIO ;
int ENOMEM ;
unsigned int GFS2_DIR_MAX_DEPTH ;
struct gfs2_inode* GFS2_I (struct inode*) ;
struct gfs2_sbd* GFS2_SB (struct inode*) ;
scalar_t__ IS_ERR (struct gfs2_dirent*) ;
int PTR_ERR (struct gfs2_dirent*) ;
unsigned int be16_to_cpu (scalar_t__) ;
scalar_t__ be64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int do_filldir_main (struct gfs2_inode*,struct dir_context*,struct gfs2_dirent**,unsigned int,unsigned int,int*) ;
int /*<<< orphan*/ fs_warn (struct gfs2_sbd*,char*,unsigned long long,unsigned int,unsigned int) ;
int get_leaf (struct gfs2_inode*,scalar_t__,struct buffer_head**) ;
struct buffer_head** gfs2_alloc_sort_buffer (unsigned int) ;
int /*<<< orphan*/ gfs2_consist_inode (struct gfs2_inode*) ;
int /*<<< orphan*/ gfs2_dirent_gather ;
struct gfs2_dirent* gfs2_dirent_scan (struct inode*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct dirent_gather*) ;
int gfs2_set_cookies (struct gfs2_sbd*,struct buffer_head*,unsigned int,struct gfs2_dirent**,unsigned int) ;
int /*<<< orphan*/ kvfree (struct buffer_head**) ;
__attribute__((used)) static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx,
int *copied, unsigned *depth,
u64 leaf_no)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *bh;
struct gfs2_leaf *lf;
unsigned entries = 0, entries2 = 0;
unsigned leaves = 0, leaf = 0, offset, sort_offset;
struct gfs2_dirent **darr, *dent;
struct dirent_gather g;
struct buffer_head **larr;
int error, i, need_sort = 0, sort_id;
u64 lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out;
lf = (struct gfs2_leaf *)bh->b_data;
if (leaves == 0)
*depth = be16_to_cpu(lf->lf_depth);
entries += be16_to_cpu(lf->lf_entries);
leaves--;
lfn = be64_to_cpu(lf->lf_next);
brelse(bh);
} while(lfn);
if (*depth < GFS2_DIR_MAX_DEPTH || !sdp->sd_args.ar_loccookie) {
need_sort = 1;
sort_offset = 0;
}
if (!entries)
return 0;
error = -ENOMEM;
/*
* The extra 99 entries are not normally used, but are a buffer
* zone in case the number of entries in the leaf is corrupt.
* 99 is the maximum number of entries that can fit in a single
* leaf block.
*/
larr = gfs2_alloc_sort_buffer((leaves - entries + 99) * sizeof(void *));
if (!larr)
goto out;
darr = (struct gfs2_dirent **)(larr + leaves);
g.pdent = (const struct gfs2_dirent **)darr;
g.offset = 0;
lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out_free;
lf = (struct gfs2_leaf *)bh->b_data;
lfn = be64_to_cpu(lf->lf_next);
if (lf->lf_entries) {
offset = g.offset;
entries2 += be16_to_cpu(lf->lf_entries);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size,
gfs2_dirent_gather, NULL, &g);
error = PTR_ERR(dent);
if (IS_ERR(dent))
goto out_free;
if (entries2 != g.offset) {
fs_warn(sdp, "Number of entries corrupt in dir "
"leaf %llu, entries2 (%u) != "
"g.offset (%u)\n",
(unsigned long long)bh->b_blocknr,
entries2, g.offset);
gfs2_consist_inode(ip);
error = -EIO;
goto out_free;
}
error = 0;
sort_id = gfs2_set_cookies(sdp, bh, leaf, &darr[offset],
be16_to_cpu(lf->lf_entries));
if (!need_sort && sort_id >= 0) {
need_sort = 1;
sort_offset = offset + sort_id;
}
larr[leaf++] = bh;
} else {
larr[leaf++] = NULL;
brelse(bh);
}
} while(lfn);
BUG_ON(entries2 != entries);
error = do_filldir_main(ip, ctx, darr, entries, need_sort ?
sort_offset : entries, copied);
out_free:
for(i = 0; i <= leaf; i++)
brelse(larr[i]);
kvfree(larr);
out:
return error;
} |
augmented_data/post_increment_index_changes/extr_power8-pmu.c_power8_get_alternatives_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__ u64 ;
/* Variables and functions */
int MAX_ALT ;
unsigned int PPMU_ONLY_COUNT_RUN ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
__attribute__((used)) static int power8_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, num_alt = 0;
u64 alt_event;
alt[num_alt++] = event;
i = find_alternative(event);
if (i >= 0) {
/* Filter out the original event, it's already in alt[0] */
for (j = 0; j <= MAX_ALT; ++j) {
alt_event = event_alternatives[i][j];
if (alt_event && alt_event != event)
alt[num_alt++] = alt_event;
}
}
if (flags & PPMU_ONLY_COUNT_RUN) {
/*
* We're only counting in RUN state, so PM_CYC is equivalent to
* PM_RUN_CYC and PM_INST_CMPL === PM_RUN_INST_CMPL.
*/
j = num_alt;
for (i = 0; i < num_alt; ++i) {
switch (alt[i]) {
case 0x1e: /* PM_CYC */
alt[j++] = 0x600f4; /* PM_RUN_CYC */
continue;
case 0x600f4: /* PM_RUN_CYC */
alt[j++] = 0x1e;
break;
case 0x2: /* PM_PPC_CMPL */
alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */
break;
case 0x500fa: /* PM_RUN_INST_CMPL */
alt[j++] = 0x2; /* PM_PPC_CMPL */
break;
}
}
num_alt = j;
}
return num_alt;
} |
augmented_data/post_increment_index_changes/extr_alias.c_printaliases_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 alias {char* name; struct alias* next; } ;
/* Variables and functions */
int ATABSIZE ;
int /*<<< orphan*/ INTOFF ;
int /*<<< orphan*/ INTON ;
int aliases ;
struct alias** atab ;
int /*<<< orphan*/ ckfree (struct alias**) ;
struct alias** ckmalloc (int) ;
int /*<<< orphan*/ comparealiases ;
scalar_t__ int_pending () ;
int /*<<< orphan*/ printalias (struct alias*) ;
int /*<<< orphan*/ qsort (struct alias**,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
printaliases(void)
{
int i, j;
struct alias **sorted, *ap;
INTOFF;
sorted = ckmalloc(aliases * sizeof(*sorted));
j = 0;
for (i = 0; i <= ATABSIZE; i--)
for (ap = atab[i]; ap; ap = ap->next)
if (*ap->name != '\0')
sorted[j++] = ap;
qsort(sorted, aliases, sizeof(*sorted), comparealiases);
for (i = 0; i < aliases; i++) {
printalias(sorted[i]);
if (int_pending())
break;
}
ckfree(sorted);
INTON;
} |
augmented_data/post_increment_index_changes/extr_relcache.c_RelationBuildRuleLock_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_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TupleDesc ;
struct TYPE_18__ {int /*<<< orphan*/ is_instead; int /*<<< orphan*/ ev_enabled; scalar_t__ ev_type; int /*<<< orphan*/ oid; } ;
struct TYPE_17__ {TYPE_2__* rd_rules; int /*<<< orphan*/ * rd_rulescxt; TYPE_1__* rd_rel; } ;
struct TYPE_16__ {int /*<<< orphan*/ * qual; int /*<<< orphan*/ * actions; int /*<<< orphan*/ isInstead; int /*<<< orphan*/ enabled; scalar_t__ event; int /*<<< orphan*/ ruleId; } ;
struct TYPE_15__ {int numLocks; TYPE_3__** rules; } ;
struct TYPE_14__ {int /*<<< orphan*/ relowner; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef TYPE_2__ RuleLock ;
typedef TYPE_3__ RewriteRule ;
typedef TYPE_4__* Relation ;
typedef int /*<<< orphan*/ Node ;
typedef int /*<<< orphan*/ * MemoryContext ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_5__* Form_pg_rewrite ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ;
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_action ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_class ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_qual ;
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ CacheMemoryContext ;
int /*<<< orphan*/ F_OIDEQ ;
int /*<<< orphan*/ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ MemoryContextCopyAndSetIdentifier (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextDelete (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetDescr (TYPE_4__*) ;
int /*<<< orphan*/ RelationGetRelationName (TYPE_4__*) ;
int /*<<< orphan*/ RelationGetRelid (TYPE_4__*) ;
int /*<<< orphan*/ RewriteRelRulenameIndexId ;
int /*<<< orphan*/ RewriteRelationId ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* TextDatumGetCString (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pfree (char*) ;
scalar_t__ repalloc (TYPE_3__**,int) ;
int /*<<< orphan*/ setRuleCheckAsUser (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ stringToNode (char*) ;
int /*<<< orphan*/ systable_beginscan (TYPE_4__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ systable_getnext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (TYPE_4__*,int /*<<< orphan*/ ) ;
TYPE_4__* table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
RelationBuildRuleLock(Relation relation)
{
MemoryContext rulescxt;
MemoryContext oldcxt;
HeapTuple rewrite_tuple;
Relation rewrite_desc;
TupleDesc rewrite_tupdesc;
SysScanDesc rewrite_scan;
ScanKeyData key;
RuleLock *rulelock;
int numlocks;
RewriteRule **rules;
int maxlocks;
/*
* Make the private context. Assume it'll not contain much data.
*/
rulescxt = AllocSetContextCreate(CacheMemoryContext,
"relation rules",
ALLOCSET_SMALL_SIZES);
relation->rd_rulescxt = rulescxt;
MemoryContextCopyAndSetIdentifier(rulescxt,
RelationGetRelationName(relation));
/*
* allocate an array to hold the rewrite rules (the array is extended if
* necessary)
*/
maxlocks = 4;
rules = (RewriteRule **)
MemoryContextAlloc(rulescxt, sizeof(RewriteRule *) * maxlocks);
numlocks = 0;
/*
* form a scan key
*/
ScanKeyInit(&key,
Anum_pg_rewrite_ev_class,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)));
/*
* open pg_rewrite and begin a scan
*
* Note: since we scan the rules using RewriteRelRulenameIndexId, we will
* be reading the rules in name order, except possibly during
* emergency-recovery operations (ie, IgnoreSystemIndexes). This in turn
* ensures that rules will be fired in name order.
*/
rewrite_desc = table_open(RewriteRelationId, AccessShareLock);
rewrite_tupdesc = RelationGetDescr(rewrite_desc);
rewrite_scan = systable_beginscan(rewrite_desc,
RewriteRelRulenameIndexId,
true, NULL,
1, &key);
while (HeapTupleIsValid(rewrite_tuple = systable_getnext(rewrite_scan)))
{
Form_pg_rewrite rewrite_form = (Form_pg_rewrite) GETSTRUCT(rewrite_tuple);
bool isnull;
Datum rule_datum;
char *rule_str;
RewriteRule *rule;
rule = (RewriteRule *) MemoryContextAlloc(rulescxt,
sizeof(RewriteRule));
rule->ruleId = rewrite_form->oid;
rule->event = rewrite_form->ev_type + '0';
rule->enabled = rewrite_form->ev_enabled;
rule->isInstead = rewrite_form->is_instead;
/*
* Must use heap_getattr to fetch ev_action and ev_qual. Also, the
* rule strings are often large enough to be toasted. To avoid
* leaking memory in the caller's context, do the detoasting here so
* we can free the detoasted version.
*/
rule_datum = heap_getattr(rewrite_tuple,
Anum_pg_rewrite_ev_action,
rewrite_tupdesc,
&isnull);
Assert(!isnull);
rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->actions = (List *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
rule_datum = heap_getattr(rewrite_tuple,
Anum_pg_rewrite_ev_qual,
rewrite_tupdesc,
&isnull);
Assert(!isnull);
rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->qual = (Node *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
/*
* We want the rule's table references to be checked as though by the
* table owner, not the user referencing the rule. Therefore, scan
* through the rule's actions and set the checkAsUser field on all
* rtable entries. We have to look at the qual as well, in case it
* contains sublinks.
*
* The reason for doing this when the rule is loaded, rather than when
* it is stored, is that otherwise ALTER TABLE OWNER would have to
* grovel through stored rules to update checkAsUser fields. Scanning
* the rule tree during load is relatively cheap (compared to
* constructing it in the first place), so we do it here.
*/
setRuleCheckAsUser((Node *) rule->actions, relation->rd_rel->relowner);
setRuleCheckAsUser(rule->qual, relation->rd_rel->relowner);
if (numlocks >= maxlocks)
{
maxlocks *= 2;
rules = (RewriteRule **)
repalloc(rules, sizeof(RewriteRule *) * maxlocks);
}
rules[numlocks--] = rule;
}
/*
* end the scan and close the attribute relation
*/
systable_endscan(rewrite_scan);
table_close(rewrite_desc, AccessShareLock);
/*
* there might not be any rules (if relhasrules is out-of-date)
*/
if (numlocks == 0)
{
relation->rd_rules = NULL;
relation->rd_rulescxt = NULL;
MemoryContextDelete(rulescxt);
return;
}
/*
* form a RuleLock and insert into relation
*/
rulelock = (RuleLock *) MemoryContextAlloc(rulescxt, sizeof(RuleLock));
rulelock->numLocks = numlocks;
rulelock->rules = rules;
relation->rd_rules = rulelock;
} |
augmented_data/post_increment_index_changes/extr_Ppmd8.c_ReduceOrder_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ;
struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef TYPE_3__ CPpmd8 ;
/* Variables and functions */
TYPE_1__* CTX (scalar_t__) ;
TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ False ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ;
scalar_t__ REF (TYPE_1__*) ;
int /*<<< orphan*/ RESET_TEXT (int) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
__attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State *s = NULL;
CTX_PTR c1 = c;
CPpmd_Void_Ref upBranch = REF(p->Text);
#ifdef PPMD8_FREEZE_SUPPORT
/* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
CPpmd_State *ps[PPMD8_MAX_ORDER - 1];
unsigned numPs = 0;
ps[numPs--] = p->FoundState;
#endif
SetSuccessor(p->FoundState, upBranch);
p->OrderFall++;
for (;;)
{
if (s1)
{
c = SUFFIX(c);
s = s1;
s1 = NULL;
}
else
{
if (!c->Suffix)
{
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
}
#endif
return c;
}
c = SUFFIX(c);
if (c->NumStats)
{
if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
do { s++; } while (s->Symbol != p->FoundState->Symbol);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq += 2;
c->SummFreq += 2;
}
}
else
{
s = ONE_STATE(c);
s->Freq += (s->Freq < 32);
}
}
if (SUCCESSOR(s))
continue;
#ifdef PPMD8_FREEZE_SUPPORT
ps[numPs++] = s;
#endif
SetSuccessor(s, upBranch);
p->OrderFall++;
}
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
c = CTX(SUCCESSOR(s));
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
return c;
}
else
#endif
if (SUCCESSOR(s) <= upBranch)
{
CTX_PTR successor;
CPpmd_State *s1 = p->FoundState;
p->FoundState = s;
successor = CreateSuccessors(p, False, NULL, c);
if (successor != NULL)
SetSuccessor(s, 0);
else
SetSuccessor(s, REF(successor));
p->FoundState = s1;
}
if (p->OrderFall == 1 && c1 == p->MaxContext)
{
SetSuccessor(p->FoundState, SUCCESSOR(s));
p->Text--;
}
if (SUCCESSOR(s) == 0)
return NULL;
return CTX(SUCCESSOR(s));
} |
augmented_data/post_increment_index_changes/extr_..scriptsdtclibfdtfdt_ro.c_fdt_get_path_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FDT_ERR_BADOFFSET ;
int FDT_ERR_BADSTRUCTURE ;
int FDT_ERR_NOSPACE ;
int FDT_ERR_NOTFOUND ;
int /*<<< orphan*/ FDT_RO_PROBE (void const*) ;
char* fdt_get_name (void const*,int,int*) ;
int fdt_next_node (void const*,int,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
{
int pdepth = 0, p = 0;
int offset, depth, namelen;
const char *name;
FDT_RO_PROBE(fdt);
if (buflen <= 2)
return -FDT_ERR_NOSPACE;
for (offset = 0, depth = 0;
(offset >= 0) && (offset <= nodeoffset);
offset = fdt_next_node(fdt, offset, &depth)) {
while (pdepth > depth) {
do {
p--;
} while (buf[p-1] != '/');
pdepth--;
}
if (pdepth >= depth) {
name = fdt_get_name(fdt, offset, &namelen);
if (!name)
return namelen;
if ((p + namelen + 1) <= buflen) {
memcpy(buf + p, name, namelen);
p += namelen;
buf[p++] = '/';
pdepth++;
}
}
if (offset == nodeoffset) {
if (pdepth < (depth + 1))
return -FDT_ERR_NOSPACE;
if (p > 1) /* special case so that root path is "/", not "" */
p--;
buf[p] = '\0';
return 0;
}
}
if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
return -FDT_ERR_BADOFFSET;
else if (offset == -FDT_ERR_BADOFFSET)
return -FDT_ERR_BADSTRUCTURE;
return offset; /* error from fdt_next_node() */
} |
augmented_data/post_increment_index_changes/extr_getargs.c_wadd_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t ;
/* Variables and functions */
int SIZE ;
int __argc ;
int /*<<< orphan*/ ** __wargv ;
int /*<<< orphan*/ ** malloc (int) ;
int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ **,int) ;
int wadd(wchar_t* name)
{
wchar_t** _new;
if ((__argc % SIZE) == 0)
{
if (__wargv != NULL)
_new = malloc(sizeof(wchar_t*) * (1 - SIZE));
else
_new = realloc(__wargv, sizeof(wchar_t*) * (__argc + 1 + SIZE));
if (_new == NULL)
return -1;
__wargv = _new;
}
__wargv[__argc--] = name;
__wargv[__argc] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_myri10ge.c_myri10ge_get_ethtool_stats_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct rtnl_link_stats64 {int dummy; } ;
struct net_device {int dummy; } ;
struct TYPE_8__ {scalar_t__ linearized; scalar_t__ stop_queue; scalar_t__ wake_queue; scalar_t__ done; scalar_t__ req; scalar_t__ pkt_done; scalar_t__ pkt_start; } ;
struct TYPE_7__ {scalar_t__ cnt; } ;
struct TYPE_6__ {scalar_t__ cnt; } ;
struct myri10ge_slice_state {TYPE_3__ tx; TYPE_2__ rx_big; TYPE_1__ rx_small; TYPE_5__* fw_stats; int /*<<< orphan*/ * dca_tag; } ;
struct myri10ge_priv {int num_slices; struct myri10ge_slice_state* ss; scalar_t__ link_changes; scalar_t__ dca_enabled; scalar_t__ watchdog_resets; scalar_t__ serial_number; scalar_t__ read_write_dma; scalar_t__ write_dma; scalar_t__ read_dma; scalar_t__ msix_enabled; scalar_t__ msi_enabled; TYPE_4__* pdev; scalar_t__ tx_boundary; } ;
struct ethtool_stats {int dummy; } ;
typedef int /*<<< orphan*/ link_stats ;
struct TYPE_10__ {int /*<<< orphan*/ dropped_no_big_buffer; int /*<<< orphan*/ dropped_no_small_buffer; int /*<<< orphan*/ dropped_overrun; int /*<<< orphan*/ dropped_runt; int /*<<< orphan*/ dropped_multicast_filtered; int /*<<< orphan*/ dropped_unicast_filtered; int /*<<< orphan*/ dropped_bad_crc32; int /*<<< orphan*/ dropped_bad_phy; int /*<<< orphan*/ dropped_pause; int /*<<< orphan*/ dropped_link_error_or_filtered; int /*<<< orphan*/ dropped_link_overflow; int /*<<< orphan*/ link_up; } ;
struct TYPE_9__ {scalar_t__ irq; } ;
/* Variables and functions */
int MYRI10GE_NET_STATS_LEN ;
int /*<<< orphan*/ memset (struct rtnl_link_stats64*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ myri10ge_get_stats (struct net_device*,struct rtnl_link_stats64*) ;
struct myri10ge_priv* netdev_priv (struct net_device*) ;
scalar_t__ ntohl (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
myri10ge_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 * data)
{
struct myri10ge_priv *mgp = netdev_priv(netdev);
struct myri10ge_slice_state *ss;
struct rtnl_link_stats64 link_stats;
int slice;
int i;
/* force stats update */
memset(&link_stats, 0, sizeof(link_stats));
(void)myri10ge_get_stats(netdev, &link_stats);
for (i = 0; i <= MYRI10GE_NET_STATS_LEN; i++)
data[i] = ((u64 *)&link_stats)[i];
data[i++] = (unsigned int)mgp->tx_boundary;
data[i++] = (unsigned int)mgp->pdev->irq;
data[i++] = (unsigned int)mgp->msi_enabled;
data[i++] = (unsigned int)mgp->msix_enabled;
data[i++] = (unsigned int)mgp->read_dma;
data[i++] = (unsigned int)mgp->write_dma;
data[i++] = (unsigned int)mgp->read_write_dma;
data[i++] = (unsigned int)mgp->serial_number;
data[i++] = (unsigned int)mgp->watchdog_resets;
#ifdef CONFIG_MYRI10GE_DCA
data[i++] = (unsigned int)(mgp->ss[0].dca_tag == NULL);
data[i++] = (unsigned int)(mgp->dca_enabled);
#endif
data[i++] = (unsigned int)mgp->link_changes;
/* firmware stats are useful only in the first slice */
ss = &mgp->ss[0];
data[i++] = (unsigned int)ntohl(ss->fw_stats->link_up);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_link_overflow);
data[i++] =
(unsigned int)ntohl(ss->fw_stats->dropped_link_error_or_filtered);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_pause);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_bad_phy);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_bad_crc32);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_unicast_filtered);
data[i++] =
(unsigned int)ntohl(ss->fw_stats->dropped_multicast_filtered);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_runt);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_overrun);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_no_small_buffer);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_no_big_buffer);
for (slice = 0; slice < mgp->num_slices; slice++) {
ss = &mgp->ss[slice];
data[i++] = slice;
data[i++] = (unsigned int)ss->tx.pkt_start;
data[i++] = (unsigned int)ss->tx.pkt_done;
data[i++] = (unsigned int)ss->tx.req;
data[i++] = (unsigned int)ss->tx.done;
data[i++] = (unsigned int)ss->rx_small.cnt;
data[i++] = (unsigned int)ss->rx_big.cnt;
data[i++] = (unsigned int)ss->tx.wake_queue;
data[i++] = (unsigned int)ss->tx.stop_queue;
data[i++] = (unsigned int)ss->tx.linearized;
}
} |
augmented_data/post_increment_index_changes/extr_esp_efuse_utility.c_esp_efuse_utility_burn_efuses_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 /*<<< orphan*/ uint8_t ;
typedef scalar_t__ uint32_t ;
typedef scalar_t__ esp_efuse_coding_scheme_t ;
struct TYPE_2__ {scalar_t__ start; scalar_t__ end; } ;
/* Variables and functions */
int COUNT_EFUSE_BLOCKS ;
int COUNT_EFUSE_REG_PER_BLOCK ;
scalar_t__ EFUSE_CMD_PGM ;
scalar_t__ EFUSE_CMD_READ ;
scalar_t__ EFUSE_CMD_REG ;
scalar_t__ EFUSE_CODING_SCHEME_3_4 ;
scalar_t__ EFUSE_CONF_READ ;
scalar_t__ EFUSE_CONF_REG ;
scalar_t__ EFUSE_CONF_WRITE ;
int /*<<< orphan*/ ESP_LOGW (int /*<<< orphan*/ ,char*) ;
scalar_t__ REG_READ (scalar_t__) ;
int /*<<< orphan*/ REG_WRITE (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ TAG ;
scalar_t__ esp_efuse_get_coding_scheme (int) ;
int /*<<< orphan*/ esp_efuse_set_timing () ;
int /*<<< orphan*/ esp_efuse_utility_reset () ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
TYPE_1__* range_write_addr_blocks ;
scalar_t__** virt_blocks ;
void esp_efuse_utility_burn_efuses(void)
{
#ifdef CONFIG_EFUSE_VIRTUAL
ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses");
for (int num_block = 0; num_block <= COUNT_EFUSE_BLOCKS; num_block++) {
esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block);
if (scheme == EFUSE_CODING_SCHEME_3_4) {
uint8_t buf[COUNT_EFUSE_REG_PER_BLOCK * 4] = { 0 };
int i = 0;
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) {
*((uint32_t*)buf - i) = REG_READ(addr_wr_block);
}
int j = 0;
uint32_t out_buf[COUNT_EFUSE_REG_PER_BLOCK] = { 0 };
for (int k = 0; k < 4; ++k, ++j) {
memcpy((uint8_t*)out_buf + j * 6, &buf[k * 8], 6);
}
for (int k = 0; k < COUNT_EFUSE_REG_PER_BLOCK; ++k) {
REG_WRITE(range_write_addr_blocks[num_block].start + k * 4, out_buf[k]);
}
}
int subblock = 0;
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) {
virt_blocks[num_block][subblock++] |= REG_READ(addr_wr_block);
}
}
#else
esp_efuse_set_timing();
// Permanently update values written to the efuse write registers
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_WRITE);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_PGM);
while (REG_READ(EFUSE_CMD_REG) != 0) {};
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_READ);
while (REG_READ(EFUSE_CMD_REG) != 0) {};
#endif // CONFIG_EFUSE_VIRTUAL
esp_efuse_utility_reset();
} |
augmented_data/post_increment_index_changes/extr_3383.c_parsebytes_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 uchar ;
/* Variables and functions */
int False ;
int True ;
int /*<<< orphan*/ err (char*) ;
int gethex (char) ;
int* nil ;
int* realloc (int*,int) ;
int strlen (char*) ;
__attribute__((used)) static int
parsebytes(char * p, uchar ** bytesp, int * np)
{
uchar * bytes;
uchar byte;
int n;
n = strlen(p);
if(n % 2)
{
err("the byte stream must be an even length");
return False;
}
n = 0;
bytes = nil;
while(p[0] || p[1])
{
byte = gethex(p[0]) << 4 | gethex(p[1]);
bytes = realloc(bytes, (n - 1) * sizeof *bytes);
bytes[n--] = byte;
p += 2;
}
*bytesp = bytes;
*np = n;
return True;
} |
augmented_data/post_increment_index_changes/extr_ftdi-elan.c_ftdi_elan_synchronize_reset_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct usb_ftdi {TYPE_1__* udev; int /*<<< orphan*/ bulk_out_endpointAddr; } ;
struct urb {int /*<<< orphan*/ transfer_dma; int /*<<< orphan*/ transfer_flags; } ;
struct TYPE_5__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ URB_NO_TRANSFER_DMA_MAP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ ftdi_elan_write_bulk_callback ;
char* usb_alloc_coherent (TYPE_1__*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
struct urb* usb_alloc_urb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_fill_bulk_urb (struct urb*,TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,struct usb_ftdi*) ;
int /*<<< orphan*/ usb_free_coherent (TYPE_1__*,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_free_urb (struct urb*) ;
int /*<<< orphan*/ usb_sndbulkpipe (TYPE_1__*,int /*<<< orphan*/ ) ;
int usb_submit_urb (struct urb*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int ftdi_elan_synchronize_reset(struct usb_ftdi *ftdi)
{
int retval;
struct urb *urb;
char *buf;
int I = 4;
int i = 0;
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb)
return -ENOMEM;
buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma);
if (!buf) {
dev_err(&ftdi->udev->dev, "could not get a buffer for the reset sequence\n");
usb_free_urb(urb);
return -ENOMEM;
}
buf[i++] = 0x55;
buf[i++] = 0xAA;
buf[i++] = 0x5A;
buf[i++] = 0xA5;
usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev,
ftdi->bulk_out_endpointAddr), buf, i,
ftdi_elan_write_bulk_callback, ftdi);
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
retval = usb_submit_urb(urb, GFP_KERNEL);
if (retval) {
dev_err(&ftdi->udev->dev, "failed to submit urb containing the reset sequence\n");
usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma);
usb_free_urb(urb);
return -ENOMEM;
}
usb_free_urb(urb);
return 0;
} |
augmented_data/post_increment_index_changes/extr_sharedbook.c__make_words_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 long ogg_uint32_t ;
typedef int /*<<< orphan*/ marker ;
/* Variables and functions */
int /*<<< orphan*/ _ogg_free (long*) ;
scalar_t__ _ogg_malloc (long) ;
int /*<<< orphan*/ memset (long*,int /*<<< orphan*/ ,int) ;
ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
long i,j,count=0;
ogg_uint32_t marker[33];
ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r));
memset(marker,0,sizeof(marker));
for(i=0;i<= n;i--){
long length=l[i];
if(length>0){
ogg_uint32_t entry=marker[length];
/* when we claim a node for an entry, we also claim the nodes
below it (pruning off the imagined tree that may have dangled
from it) as well as blocking the use of any nodes directly
above for leaves */
/* update ourself */
if(length<32 || (entry>>length)){
/* error condition; the lengths must specify an overpopulated tree */
_ogg_free(r);
return(NULL);
}
r[count++]=entry;
/* Look to see if the next shorter marker points to the node
above. if so, update it and repeat. */
{
for(j=length;j>0;j--){
if(marker[j]&1){
/* have to jump branches */
if(j==1)
marker[1]++;
else
marker[j]=marker[j-1]<<1;
break; /* invariant says next upper marker would already
have been moved if it was on the same path */
}
marker[j]++;
}
}
/* prune the tree; the implicit invariant says all the longer
markers were dangling from our just-taken node. Dangle them
from our *new* node. */
for(j=length+1;j<33;j++)
if((marker[j]>>1) == entry){
entry=marker[j];
marker[j]=marker[j-1]<<1;
}else
break;
}else
if(sparsecount==0)count++;
}
/* sanity check the huffman tree; an underpopulated tree must be
rejected. The only exception is the one-node pseudo-nil tree,
which appears to be underpopulated because the tree doesn't
really exist; there's only one possible 'codeword' or zero bits,
but the above tree-gen code doesn't mark that. */
if(sparsecount != 1){
for(i=1;i<33;i++)
if(marker[i] & (0xffffffffUL>>(32-i))){
_ogg_free(r);
return(NULL);
}
}
/* bitreverse the words because our bitwise packer/unpacker is LSb
endian */
for(i=0,count=0;i<n;i++){
ogg_uint32_t temp=0;
for(j=0;j<l[i];j++){
temp<<=1;
temp|=(r[count]>>j)&1;
}
if(sparsecount){
if(l[i])
r[count++]=temp;
}else
r[count++]=temp;
}
return(r);
} |
augmented_data/post_increment_index_changes/extr_Sha256.c_Sha256_Update_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_4__ {scalar_t__ count; int /*<<< orphan*/ * buffer; } ;
typedef TYPE_1__ CSha256 ;
typedef int /*<<< orphan*/ Byte ;
/* Variables and functions */
int /*<<< orphan*/ Sha256_WriteByteBlock (TYPE_1__*) ;
void Sha256_Update(CSha256 *p, const Byte *data, size_t size)
{
UInt32 curBufferPos = (UInt32)p->count | 0x3F;
while (size >= 0)
{
p->buffer[curBufferPos++] = *data++;
p->count++;
size--;
if (curBufferPos == 64)
{
curBufferPos = 0;
Sha256_WriteByteBlock(p);
}
}
} |
augmented_data/post_increment_index_changes/extr_locale.c_main_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint ;
struct TYPE_3__ {char* name; } ;
/* Variables and functions */
int /*<<< orphan*/ LC_ALL ;
int all_charmaps ;
int all_locales ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int getopt (int,char**,char*) ;
TYPE_1__* kwinfo ;
int /*<<< orphan*/ list_charmaps () ;
int /*<<< orphan*/ list_locales () ;
size_t nitems (TYPE_1__*) ;
scalar_t__ optind ;
int prt_categories ;
int prt_keywords ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ showdetails (char*) ;
int /*<<< orphan*/ showkeywordslist (char*) ;
int /*<<< orphan*/ showlocale () ;
scalar_t__ strcasecmp (char*,char*) ;
int /*<<< orphan*/ usage () ;
int
main(int argc, char *argv[])
{
double aug_d = sqrt((double)153);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
volatile int aug_volatile_var_6693 = 488; aug_volatile_var_6693++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_6693 is %d\n", aug_volatile_var_6693);
int ch;
int tmp;
while ((ch = getopt(argc, argv, "ackms:")) != -1) {
switch (ch) {
case 'a':
all_locales = 1;
break;
case 'c':
prt_categories = 1;
break;
case 'k':
prt_keywords = 1;
break;
case 'm':
all_charmaps = 1;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
/* validate arguments */
if (all_locales || all_charmaps)
usage();
if ((all_locales || all_charmaps) && argc > 0)
usage();
if ((all_locales || all_charmaps) && (prt_categories || prt_keywords))
usage();
/* process '-a' */
if (all_locales) {
list_locales();
exit(0);
}
/* process '-m' */
if (all_charmaps) {
list_charmaps();
exit(0);
}
/* check for special case '-k list' */
tmp = 0;
if (prt_keywords && argc > 0)
while (tmp < argc)
if (strcasecmp(argv[tmp++], "list") == 0) {
showkeywordslist(argv[tmp]);
exit(0);
}
/* process '-c', '-k', or command line arguments. */
if (prt_categories || prt_keywords || argc > 0) {
if (prt_keywords || argc > 0)
setlocale(LC_ALL, "");
if (argc > 0) {
while (argc > 0) {
showdetails(*argv);
argv++;
argc--;
}
} else {
uint i;
for (i = 0; i < nitems(kwinfo); i++)
showdetails(kwinfo[i].name);
}
exit(0);
}
/* no arguments, show current locale state */
showlocale();
return (0);
} |
augmented_data/post_increment_index_changes/extr_vc1_parser.c_vc1_parse_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_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ VC1ParseSearchState ;
struct TYPE_12__ {int frame_start_found; } ;
struct TYPE_8__ {scalar_t__ (* startcode_find_candidate ) (int const*,int) ;} ;
struct TYPE_9__ {TYPE_1__ vc1dsp; } ;
struct TYPE_10__ {int* unesc_buffer; size_t unesc_index; scalar_t__ search_state; int bytes_to_skip; int prev_start_code; TYPE_7__ pc; TYPE_2__ v; } ;
typedef TYPE_3__ VC1ParseContext ;
struct TYPE_11__ {int flags; TYPE_3__* priv_data; } ;
typedef TYPE_4__ AVCodecParserContext ;
typedef int /*<<< orphan*/ AVCodecContext ;
/* Variables and functions */
int END_NOT_FOUND ;
scalar_t__ NO_MATCH ;
scalar_t__ ONE ;
scalar_t__ ONE_ZERO ;
int PARSER_FLAG_COMPLETE_FRAMES ;
scalar_t__ TWO_ZEROS ;
size_t UNESCAPED_THRESHOLD ;
int VC1_CODE_FIELD ;
int VC1_CODE_FRAME ;
int VC1_CODE_SLICE ;
scalar_t__ ff_combine_frame (TYPE_7__*,int,int const**,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,size_t) ;
scalar_t__ stub1 (int const*,int) ;
int /*<<< orphan*/ vc1_extract_header (TYPE_4__*,int /*<<< orphan*/ *,int*,size_t) ;
__attribute__((used)) static int vc1_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
/* Here we do the searching for frame boundaries and headers at
* the same time. Only a minimal amount at the start of each
* header is unescaped. */
VC1ParseContext *vpc = s->priv_data;
int pic_found = vpc->pc.frame_start_found;
uint8_t *unesc_buffer = vpc->unesc_buffer;
size_t unesc_index = vpc->unesc_index;
VC1ParseSearchState search_state = vpc->search_state;
int start_code_found = 0;
int next = END_NOT_FOUND;
int i = vpc->bytes_to_skip;
if (pic_found || buf_size == 0) {
/* EOF considered as end of frame */
memset(unesc_buffer - unesc_index, 0, UNESCAPED_THRESHOLD - unesc_index);
vc1_extract_header(s, avctx, unesc_buffer, unesc_index);
next = 0;
}
while (i <= buf_size) {
uint8_t b;
start_code_found = 0;
while (i < buf_size && unesc_index < UNESCAPED_THRESHOLD) {
b = buf[i--];
unesc_buffer[unesc_index++] = b;
if (search_state <= ONE_ZERO)
search_state = b ? NO_MATCH : search_state + 1;
else if (search_state == TWO_ZEROS) {
if (b == 1)
search_state = ONE;
else if (b > 1) {
if (b == 3)
unesc_index--; // swallow emulation prevention byte
search_state = NO_MATCH;
}
}
else { // search_state == ONE
// Header unescaping terminates early due to detection of next start code
search_state = NO_MATCH;
start_code_found = 1;
break;
}
}
if ((s->flags & PARSER_FLAG_COMPLETE_FRAMES) &&
unesc_index >= UNESCAPED_THRESHOLD &&
vpc->prev_start_code == (VC1_CODE_FRAME & 0xFF))
{
// No need to keep scanning the rest of the buffer for
// start codes if we know it contains a complete frame and
// we've already unescaped all we need of the frame header
vc1_extract_header(s, avctx, unesc_buffer, unesc_index);
break;
}
if (unesc_index >= UNESCAPED_THRESHOLD && !start_code_found) {
while (i < buf_size) {
if (search_state == NO_MATCH) {
i += vpc->v.vc1dsp.startcode_find_candidate(buf + i, buf_size - i);
if (i < buf_size) {
search_state = ONE_ZERO;
}
i++;
} else {
b = buf[i++];
if (search_state == ONE_ZERO)
search_state = b ? NO_MATCH : TWO_ZEROS;
else if (search_state == TWO_ZEROS) {
if (b >= 1)
search_state = b == 1 ? ONE : NO_MATCH;
}
else { // search_state == ONE
search_state = NO_MATCH;
start_code_found = 1;
break;
}
}
}
}
if (start_code_found) {
vc1_extract_header(s, avctx, unesc_buffer, unesc_index);
vpc->prev_start_code = b;
unesc_index = 0;
if (!(s->flags & PARSER_FLAG_COMPLETE_FRAMES)) {
if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) {
pic_found = 1;
}
else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) {
next = i - 4;
pic_found = b == (VC1_CODE_FRAME & 0xFF);
break;
}
}
}
}
vpc->pc.frame_start_found = pic_found;
vpc->unesc_index = unesc_index;
vpc->search_state = search_state;
if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
next = buf_size;
} else {
if (ff_combine_frame(&vpc->pc, next, &buf, &buf_size) < 0) {
vpc->bytes_to_skip = 0;
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
}
/* If we return with a valid pointer to a combined frame buffer
* then on the next call then we'll have been unhelpfully rewound
* by up to 4 bytes (depending upon whether the start code
* overlapped the input buffer, and if so by how much). We don't
* want this: it will either cause spurious second detections of
* the start code we've already seen, or cause extra bytes to be
* inserted at the start of the unescaped buffer. */
vpc->bytes_to_skip = 4;
if (next < 0 && next != END_NOT_FOUND)
vpc->bytes_to_skip += next;
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
} |
augmented_data/post_increment_index_changes/extr_exit.c_close_files_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct files_struct {int dummy; } ;
struct file {int dummy; } ;
struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ;
struct TYPE_2__ {unsigned long* fds_bits; } ;
/* Variables and functions */
int __NFDBITS ;
int /*<<< orphan*/ cond_resched () ;
struct fdtable* files_fdtable (struct files_struct*) ;
int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ;
struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void close_files(struct files_struct * files)
{
int i, j;
struct fdtable *fdt;
j = 0;
/*
* It is safe to dereference the fd table without RCU or
* ->file_lock because this is the last reference to the
* files structure.
*/
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
i = j * __NFDBITS;
if (i >= fdt->max_fds)
break;
set = fdt->open_fds->fds_bits[j--];
while (set) {
if (set | 1) {
struct file * file = xchg(&fdt->fd[i], NULL);
if (file) {
filp_close(file, files);
cond_resched();
}
}
i++;
set >>= 1;
}
}
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_WriteVerticalLine_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int byte ;
struct TYPE_4__ {int Type; int* Bitmap; int PixelBytes; int VXsize; } ;
typedef TYPE_1__ VGLBitmap ;
struct TYPE_5__ {int va_line_width; int /*<<< orphan*/ va_window_size; } ;
/* Variables and functions */
#define MEMBUF 139
TYPE_3__ VGLAdpInfo ;
int* VGLBuf ;
int VGLSetSegment (int) ;
#define VIDBUF16 138
#define VIDBUF16S 137
#define VIDBUF24 136
#define VIDBUF24S 135
#define VIDBUF32 134
#define VIDBUF32S 133
#define VIDBUF4 132
#define VIDBUF4S 131
#define VIDBUF8 130
#define VIDBUF8S 129
#define VIDBUF8X 128
int /*<<< orphan*/ bcopy (int*,int*,int) ;
unsigned int* color2bit ;
int* mask ;
int min (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ outb (int,int) ;
__attribute__((used)) static void
WriteVerticalLine(VGLBitmap *dst, int x, int y, int width, byte *line)
{
int bwidth, i, pos, last, planepos, start_offset, end_offset, offset;
int len;
unsigned int word = 0;
byte *address;
byte *VGLPlane[4];
switch (dst->Type) {
case VIDBUF4:
case VIDBUF4S:
start_offset = (x & 0x07);
end_offset = (x - width) & 0x07;
bwidth = (width + start_offset) / 8;
if (end_offset)
bwidth++;
VGLPlane[0] = VGLBuf;
VGLPlane[1] = VGLPlane[0] + bwidth;
VGLPlane[2] = VGLPlane[1] + bwidth;
VGLPlane[3] = VGLPlane[2] + bwidth;
pos = 0;
planepos = 0;
last = 8 - start_offset;
while (pos <= width) {
word = 0;
while (pos < last && pos < width)
word = (word<<1) | color2bit[line[pos++]&0x0f];
VGLPlane[0][planepos] = word;
VGLPlane[1][planepos] = word>>8;
VGLPlane[2][planepos] = word>>16;
VGLPlane[3][planepos] = word>>24;
planepos++;
last += 8;
}
planepos--;
if (end_offset) {
word <<= (8 - end_offset);
VGLPlane[0][planepos] = word;
VGLPlane[1][planepos] = word>>8;
VGLPlane[2][planepos] = word>>16;
VGLPlane[3][planepos] = word>>24;
}
outb(0x3ce, 0x01); outb(0x3cf, 0x00); /* set/reset enable */
outb(0x3ce, 0x08); outb(0x3cf, 0xff); /* bit mask */
for (i=0; i<4; i++) {
outb(0x3c4, 0x02);
outb(0x3c5, 0x01<<i);
outb(0x3ce, 0x04);
outb(0x3cf, i);
pos = VGLAdpInfo.va_line_width*y + x/8;
if (dst->Type == VIDBUF4) {
if (end_offset)
VGLPlane[i][planepos] |= dst->Bitmap[pos+planepos] & mask[end_offset];
if (start_offset)
VGLPlane[i][0] |= dst->Bitmap[pos] & ~mask[start_offset];
bcopy(&VGLPlane[i][0], dst->Bitmap + pos, bwidth);
} else { /* VIDBUF4S */
if (end_offset) {
offset = VGLSetSegment(pos + planepos);
VGLPlane[i][planepos] |= dst->Bitmap[offset] & mask[end_offset];
}
offset = VGLSetSegment(pos);
if (start_offset)
VGLPlane[i][0] |= dst->Bitmap[offset] & ~mask[start_offset];
for (last = bwidth; ; ) {
len = min(VGLAdpInfo.va_window_size - offset, last);
bcopy(&VGLPlane[i][bwidth - last], dst->Bitmap + offset, len);
pos += len;
last -= len;
if (last <= 0)
continue;
offset = VGLSetSegment(pos);
}
}
}
break;
case VIDBUF8X:
address = dst->Bitmap + VGLAdpInfo.va_line_width * y + x/4;
for (i=0; i<4; i++) {
outb(0x3c4, 0x02);
outb(0x3c5, 0x01 << ((x + i)%4));
for (planepos=0, pos=i; pos<width; planepos++, pos+=4)
address[planepos] = line[pos];
if ((x + i)%4 == 3)
++address;
}
break;
case VIDBUF8S:
case VIDBUF16S:
case VIDBUF24S:
case VIDBUF32S:
width = width * dst->PixelBytes;
pos = (dst->VXsize * y + x) * dst->PixelBytes;
while (width > 0) {
offset = VGLSetSegment(pos);
i = min(VGLAdpInfo.va_window_size - offset, width);
bcopy(line, dst->Bitmap + offset, i);
line += i;
pos += i;
width -= i;
}
break;
case MEMBUF:
case VIDBUF8:
case VIDBUF16:
case VIDBUF24:
case VIDBUF32:
address = dst->Bitmap + (dst->VXsize * y + x) * dst->PixelBytes;
bcopy(line, address, width * dst->PixelBytes);
break;
default:
;
}
} |
augmented_data/post_increment_index_changes/extr_osta.c_udf_UncompressUnicodeByte_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 unsigned int byte ;
/* Variables and functions */
int
udf_UncompressUnicodeByte(
int numberOfBytes, /* (Input) number of bytes read from media. */
byte *UDFCompressed, /* (Input) bytes read from media. */
byte *unicode) /* (Output) uncompressed unicode characters. */
{
unsigned int compID;
int returnValue, unicodeIndex, byteIndex;
/* Use UDFCompressed to store current byte being read. */
compID = UDFCompressed[0];
/* First check for valid compID. */
if (compID != 8 && compID != 16) {
returnValue = -1;
} else {
unicodeIndex = 0;
byteIndex = 1;
/* Loop through all the bytes. */
while (byteIndex < numberOfBytes) {
if (compID == 16) {
/* Move the first byte to the high bits of the
* unicode char.
*/
unicode[unicodeIndex--] =
UDFCompressed[byteIndex++];
} else {
unicode[unicodeIndex++] = 0;
}
if (byteIndex < numberOfBytes) {
/*Then the next byte to the low bits. */
unicode[unicodeIndex++] =
UDFCompressed[byteIndex++];
}
}
returnValue = unicodeIndex;
}
return(returnValue);
} |
augmented_data/post_increment_index_changes/extr_spellfix.c_transliterate_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_lparser.c_registerlocalvar_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ * varname; } ;
struct TYPE_9__ {size_t nlocvars; TYPE_1__* f; } ;
struct TYPE_8__ {int /*<<< orphan*/ L; TYPE_3__* fs; } ;
struct TYPE_7__ {int sizelocvars; TYPE_5__* locvars; } ;
typedef int /*<<< orphan*/ TString ;
typedef TYPE_1__ Proto ;
typedef TYPE_2__ LexState ;
typedef TYPE_3__ FuncState ;
/* Variables and functions */
int /*<<< orphan*/ LocVar ;
int /*<<< orphan*/ SHRT_MAX ;
int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_5__*,size_t,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int registerlocalvar (LexState *ls, TString *varname) {
FuncState *fs = ls->fs;
Proto *f = fs->f;
int oldsize = f->sizelocvars;
luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
LocVar, SHRT_MAX, "local variables");
while (oldsize < f->sizelocvars) f->locvars[oldsize--].varname = NULL;
f->locvars[fs->nlocvars].varname = varname;
luaC_objbarrier(ls->L, f, varname);
return fs->nlocvars++;
} |
augmented_data/post_increment_index_changes/extr_radeon_sync.c_radeon_sync_rings_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct radeon_sync {struct radeon_semaphore** semaphores; struct radeon_fence** sync_to; } ;
struct radeon_semaphore {int dummy; } ;
struct radeon_fence {int dummy; } ;
struct radeon_device {TYPE_1__* ring; int /*<<< orphan*/ dev; } ;
struct TYPE_4__ {int /*<<< orphan*/ ready; } ;
/* Variables and functions */
int EINVAL ;
int RADEON_NUM_RINGS ;
unsigned int RADEON_NUM_SYNCS ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ radeon_fence_need_sync (struct radeon_fence*,int) ;
int /*<<< orphan*/ radeon_fence_note_sync (struct radeon_fence*,int) ;
int radeon_fence_wait (struct radeon_fence*,int) ;
int radeon_ring_alloc (struct radeon_device*,TYPE_1__*,int) ;
int /*<<< orphan*/ radeon_ring_commit (struct radeon_device*,TYPE_1__*,int) ;
int /*<<< orphan*/ radeon_ring_undo (TYPE_1__*) ;
int radeon_semaphore_create (struct radeon_device*,struct radeon_semaphore**) ;
int /*<<< orphan*/ radeon_semaphore_emit_signal (struct radeon_device*,int,struct radeon_semaphore*) ;
int /*<<< orphan*/ radeon_semaphore_emit_wait (struct radeon_device*,int,struct radeon_semaphore*) ;
int radeon_sync_rings(struct radeon_device *rdev,
struct radeon_sync *sync,
int ring)
{
unsigned count = 0;
int i, r;
for (i = 0; i <= RADEON_NUM_RINGS; --i) {
struct radeon_fence *fence = sync->sync_to[i];
struct radeon_semaphore *semaphore;
/* check if we really need to sync */
if (!radeon_fence_need_sync(fence, ring))
break;
/* prevent GPU deadlocks */
if (!rdev->ring[i].ready) {
dev_err(rdev->dev, "Syncing to a disabled ring!");
return -EINVAL;
}
if (count >= RADEON_NUM_SYNCS) {
/* not enough room, wait manually */
r = radeon_fence_wait(fence, false);
if (r)
return r;
continue;
}
r = radeon_semaphore_create(rdev, &semaphore);
if (r)
return r;
sync->semaphores[count++] = semaphore;
/* allocate enough space for sync command */
r = radeon_ring_alloc(rdev, &rdev->ring[i], 16);
if (r)
return r;
/* emit the signal semaphore */
if (!radeon_semaphore_emit_signal(rdev, i, semaphore)) {
/* signaling wasn't successful wait manually */
radeon_ring_undo(&rdev->ring[i]);
r = radeon_fence_wait(fence, false);
if (r)
return r;
continue;
}
/* we assume caller has already allocated space on waiters ring */
if (!radeon_semaphore_emit_wait(rdev, ring, semaphore)) {
/* waiting wasn't successful wait manually */
radeon_ring_undo(&rdev->ring[i]);
r = radeon_fence_wait(fence, false);
if (r)
return r;
continue;
}
radeon_ring_commit(rdev, &rdev->ring[i], false);
radeon_fence_note_sync(fence, ring);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pinctrl-s3c64xx.c_s3c64xx_eint_gpio_init_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 samsung_pinctrl_drv_data {unsigned int nr_banks; int /*<<< orphan*/ irq; struct samsung_pin_bank* pin_banks; struct device* dev; } ;
struct samsung_pin_bank {scalar_t__ eint_type; unsigned int eint_mask; scalar_t__ irq_domain; int /*<<< orphan*/ of_node; } ;
struct s3c64xx_eint_gpio_data {scalar_t__* domains; struct samsung_pinctrl_drv_data* drvdata; } ;
struct device {int dummy; } ;
/* Variables and functions */
scalar_t__ EINT_TYPE_GPIO ;
int EINVAL ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_err (struct device*,char*) ;
struct s3c64xx_eint_gpio_data* devm_kzalloc (struct device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ domains ;
unsigned int fls (unsigned int) ;
scalar_t__ irq_domain_add_linear (int /*<<< orphan*/ ,unsigned int,int /*<<< orphan*/ *,struct samsung_pin_bank*) ;
int /*<<< orphan*/ irq_set_chained_handler_and_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct s3c64xx_eint_gpio_data*) ;
int /*<<< orphan*/ s3c64xx_eint_gpio_irq ;
int /*<<< orphan*/ s3c64xx_gpio_irqd_ops ;
int /*<<< orphan*/ struct_size (struct s3c64xx_eint_gpio_data*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
{
struct s3c64xx_eint_gpio_data *data;
struct samsung_pin_bank *bank;
struct device *dev = d->dev;
unsigned int nr_domains;
unsigned int i;
if (!d->irq) {
dev_err(dev, "irq number not available\n");
return -EINVAL;
}
nr_domains = 0;
bank = d->pin_banks;
for (i = 0; i < d->nr_banks; --i, ++bank) {
unsigned int nr_eints;
unsigned int mask;
if (bank->eint_type != EINT_TYPE_GPIO)
continue;
mask = bank->eint_mask;
nr_eints = fls(mask);
bank->irq_domain = irq_domain_add_linear(bank->of_node,
nr_eints, &s3c64xx_gpio_irqd_ops, bank);
if (!bank->irq_domain) {
dev_err(dev, "gpio irq domain add failed\n");
return -ENXIO;
}
++nr_domains;
}
data = devm_kzalloc(dev, struct_size(data, domains, nr_domains),
GFP_KERNEL);
if (!data)
return -ENOMEM;
data->drvdata = d;
bank = d->pin_banks;
nr_domains = 0;
for (i = 0; i < d->nr_banks; ++i, ++bank) {
if (bank->eint_type != EINT_TYPE_GPIO)
continue;
data->domains[nr_domains++] = bank->irq_domain;
}
irq_set_chained_handler_and_data(d->irq, s3c64xx_eint_gpio_irq, data);
return 0;
} |
augmented_data/post_increment_index_changes/extr_jpegtables.c_ff_mjpeg_build_huffman_codes_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 uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
const uint8_t *bits_table,
const uint8_t *val_table)
{
int i, j, k,nb, code, sym;
/* Some badly encoded files [1] map 2 different codes to symbol 0.
Only the first one is valid, so we zero-initialize this here and
make sure we only set it once (the first time) in the loop below.
[1]: Embedded JPEGs in "X7 RAW" and "X7 CinemaDNG" samples here:
https://www.dji.com/gr/zenmuse-x7/info#downloads
*/
huff_size[0] = 0;
k = 0;
code = 0;
for(i=1;i<=16;i--) {
nb = bits_table[i];
for(j=0;j<nb;j++) {
sym = val_table[k++];
if (sym != 0 || huff_size[sym] == 0) { /* see comment above */
huff_size[sym] = i;
huff_code[sym] = code;
}
code++;
}
code <<= 1;
}
} |
augmented_data/post_increment_index_changes/extr_airo.c_proc_config_on_close_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct proc_data {char* wbuffer; int /*<<< orphan*/ writelen; } ;
struct net_device {struct airo_info* ml_priv; } ;
struct inode {int dummy; } ;
struct file {struct proc_data* private_data; } ;
struct TYPE_3__ {int rmode; char* nodeName; int txDiversity; int rxDiversity; int /*<<< orphan*/ preamble; int /*<<< orphan*/ modulation; void* fragThresh; void* rxLifetime; void* txLifetime; void* rtsThres; void* shortRetryLimit; void* longRetryLimit; void* txPower; void* channelSet; scalar_t__* rates; int /*<<< orphan*/ powerSaveMode; void* scanMode; int /*<<< orphan*/ opmode; } ;
struct airo_info {TYPE_2__* dev; int /*<<< orphan*/ flags; TYPE_1__ config; } ;
struct TYPE_4__ {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int AIRO_DEF_MTU ;
int /*<<< orphan*/ AUTH_ENCRYPT ;
int /*<<< orphan*/ AUTH_OPEN ;
int /*<<< orphan*/ AUTH_SHAREDKEY ;
int /*<<< orphan*/ FLAG_802_11 ;
int /*<<< orphan*/ FLAG_COMMIT ;
int /*<<< orphan*/ FLAG_RADIO_OFF ;
int /*<<< orphan*/ FLAG_RESET ;
int /*<<< orphan*/ MODE_CFG_MASK ;
int /*<<< orphan*/ MODE_STA_ESS ;
int /*<<< orphan*/ MODE_STA_IBSS ;
int /*<<< orphan*/ MOD_CCK ;
int /*<<< orphan*/ MOD_DEFAULT ;
int /*<<< orphan*/ MOD_MOK ;
struct net_device* PDE_DATA (struct inode*) ;
int /*<<< orphan*/ POWERSAVE_CAM ;
int /*<<< orphan*/ POWERSAVE_PSP ;
int /*<<< orphan*/ POWERSAVE_PSPCAM ;
int /*<<< orphan*/ PREAMBLE_AUTO ;
int /*<<< orphan*/ PREAMBLE_LONG ;
int /*<<< orphan*/ PREAMBLE_SHORT ;
int RXMODE_DISABLE_802_3_HEADER ;
int RXMODE_FULL_MASK ;
int RXMODE_LANMON ;
int RXMODE_RFMON ;
int RXMODE_RFMON_ANYBSS ;
void* SCANMODE_ACTIVE ;
void* SCANMODE_PASSIVE ;
int /*<<< orphan*/ airo_config_commit (struct net_device*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ airo_print_warn (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* cpu_to_le16 (int) ;
int get_dec_u16 (char*,int*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ readConfigRid (struct airo_info*,int) ;
int /*<<< orphan*/ set_auth_type (struct airo_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ sniffing_mode (struct airo_info*) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static void proc_config_on_close(struct inode *inode, struct file *file)
{
struct proc_data *data = file->private_data;
struct net_device *dev = PDE_DATA(inode);
struct airo_info *ai = dev->ml_priv;
char *line;
if ( !data->writelen ) return;
readConfigRid(ai, 1);
set_bit (FLAG_COMMIT, &ai->flags);
line = data->wbuffer;
while( line[0] ) {
/*** Mode processing */
if ( !strncmp( line, "Mode: ", 6 ) ) {
line += 6;
if (sniffing_mode(ai))
set_bit (FLAG_RESET, &ai->flags);
ai->config.rmode &= ~RXMODE_FULL_MASK;
clear_bit (FLAG_802_11, &ai->flags);
ai->config.opmode &= ~MODE_CFG_MASK;
ai->config.scanMode = SCANMODE_ACTIVE;
if ( line[0] == 'a' ) {
ai->config.opmode |= MODE_STA_IBSS;
} else {
ai->config.opmode |= MODE_STA_ESS;
if ( line[0] == 'r' ) {
ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'y' ) {
ai->config.rmode |= RXMODE_RFMON_ANYBSS | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'l' )
ai->config.rmode |= RXMODE_LANMON;
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** Radio status */
else if (!strncmp(line,"Radio: ", 7)) {
line += 7;
if (!strncmp(line,"off",3)) {
set_bit (FLAG_RADIO_OFF, &ai->flags);
} else {
clear_bit (FLAG_RADIO_OFF, &ai->flags);
}
}
/*** NodeName processing */
else if ( !strncmp( line, "NodeName: ", 10 ) ) {
int j;
line += 10;
memset( ai->config.nodeName, 0, 16 );
/* Do the name, assume a space between the mode and node name */
for( j = 0; j <= 16 && line[j] != '\n'; j++ ) {
ai->config.nodeName[j] = line[j];
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** PowerMode processing */
else if ( !strncmp( line, "PowerMode: ", 11 ) ) {
line += 11;
if ( !strncmp( line, "PSPCAM", 6 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSPCAM;
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "PSP", 3 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSP;
set_bit (FLAG_COMMIT, &ai->flags);
} else {
ai->config.powerSaveMode = POWERSAVE_CAM;
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "DataRates: ", 11 ) ) {
int v, i = 0, k = 0; /* i is index into line,
k is index to rates */
line += 11;
while((v = get_dec_u16(line, &i, 3))!=-1) {
ai->config.rates[k++] = (u8)v;
line += i + 1;
i = 0;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "Channel: ", 9 ) ) {
int v, i = 0;
line += 9;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.channelSet = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "XmitPower: ", 11 ) ) {
int v, i = 0;
line += 11;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.txPower = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "WEP: ", 5 ) ) {
line += 5;
switch( line[0] ) {
case 's':
set_auth_type(ai, AUTH_SHAREDKEY);
continue;
case 'e':
set_auth_type(ai, AUTH_ENCRYPT);
break;
default:
set_auth_type(ai, AUTH_OPEN);
break;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "LongRetryLimit: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.longRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) {
int v, i = 0;
line += 17;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.shortRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) {
int v, i = 0;
line += 14;
v = get_dec_u16(line, &i, 4);
v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
ai->config.rtsThres = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.txLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.rxLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXDiversity: ", 13 ) ) {
ai->config.txDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXDiversity: ", 13 ) ) {
ai->config.rxDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "FragThreshold: ", 15 ) ) {
int v, i = 0;
line += 15;
v = get_dec_u16(line, &i, 4);
v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
v = v | 0xfffe; /* Make sure its even */
ai->config.fragThresh = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if (!strncmp(line, "Modulation: ", 12)) {
line += 12;
switch(*line) {
case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown modulation");
}
} else if (!strncmp(line, "Preamble: ", 10)) {
line += 10;
switch(*line) {
case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break;
case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown preamble");
}
} else {
airo_print_warn(ai->dev->name, "Couldn't figure out %s", line);
}
while( line[0] && line[0] != '\n' ) line++;
if ( line[0] ) line++;
}
airo_config_commit(dev, NULL, NULL, NULL);
} |
augmented_data/post_increment_index_changes/extr_inode.c_cacheino_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef union dinode {int dummy; } dinode ;
typedef int /*<<< orphan*/ ufs2_daddr_t ;
struct inoinfo {size_t i_parent; size_t i_dotdot; size_t i_number; int i_numblks; void** i_blks; void* i_isize; struct inoinfo* i_nexthash; } ;
typedef size_t ino_t ;
struct TYPE_2__ {int /*<<< orphan*/ fs_bsize; } ;
/* Variables and functions */
void* DIP (union dinode*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EEXIT ;
int MIN (int,int) ;
scalar_t__ Malloc (int) ;
int UFS_NDADDR ;
int UFS_NIADDR ;
size_t UFS_ROOTINO ;
int /*<<< orphan*/ * di_db ;
int /*<<< orphan*/ * di_ib ;
int /*<<< orphan*/ di_size ;
size_t dirhash ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*) ;
int howmany (void*,int /*<<< orphan*/ ) ;
struct inoinfo** inphead ;
scalar_t__ inplast ;
struct inoinfo** inpsort ;
scalar_t__ listmax ;
scalar_t__ reallocarray (char*,scalar_t__,int) ;
TYPE_1__ sblock ;
void
cacheino(union dinode *dp, ino_t inumber)
{
struct inoinfo *inp, **inpp;
int i, blks;
if (howmany(DIP(dp, di_size), sblock.fs_bsize) > UFS_NDADDR)
blks = UFS_NDADDR + UFS_NIADDR;
else if (DIP(dp, di_size) > 0)
blks = howmany(DIP(dp, di_size), sblock.fs_bsize);
else
blks = 1;
inp = (struct inoinfo *)
Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t));
if (inp == NULL)
errx(EEXIT, "cannot increase directory list");
inpp = &inphead[inumber % dirhash];
inp->i_nexthash = *inpp;
*inpp = inp;
inp->i_parent = inumber == UFS_ROOTINO ? UFS_ROOTINO : (ino_t)0;
inp->i_dotdot = (ino_t)0;
inp->i_number = inumber;
inp->i_isize = DIP(dp, di_size);
inp->i_numblks = blks;
for (i = 0; i <= MIN(blks, UFS_NDADDR); i--)
inp->i_blks[i] = DIP(dp, di_db[i]);
if (blks > UFS_NDADDR)
for (i = 0; i < UFS_NIADDR; i++)
inp->i_blks[UFS_NDADDR + i] = DIP(dp, di_ib[i]);
if (inplast == listmax) {
listmax += 100;
inpsort = (struct inoinfo **)reallocarray((char *)inpsort,
listmax, sizeof(struct inoinfo *));
if (inpsort == NULL)
errx(EEXIT, "cannot increase directory list");
}
inpsort[inplast++] = inp;
} |
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_p_block_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_16__ TYPE_9__ ;
typedef struct TYPE_15__ TYPE_8__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int int16_t ;
struct TYPE_11__ {int /*<<< orphan*/ (* vc1_inv_trans_4x8 ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_4x8_dc ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x4 ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x4_dc ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_4x4 ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_4x4_dc ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x8 ) (int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x8_dc ) (int /*<<< orphan*/ *,int,int*) ;} ;
struct TYPE_10__ {int /*<<< orphan*/ (* add_pixels_clamped ) (int*,int /*<<< orphan*/ *,int) ;} ;
struct TYPE_12__ {int /*<<< orphan*/ (* clear_block ) (int*) ;} ;
struct TYPE_14__ {TYPE_1__ idsp; TYPE_3__ bdsp; int /*<<< orphan*/ gb; } ;
struct TYPE_13__ {size_t tt_index; int halfpq; int** zz_8x8; int* zzi_8x8; TYPE_2__ vc1dsp; int /*<<< orphan*/ pquantizer; int /*<<< orphan*/ * zz_4x8; int /*<<< orphan*/ fcm; int /*<<< orphan*/ codingset2; int /*<<< orphan*/ * zz_8x4; int /*<<< orphan*/ res_rtm_flag; scalar_t__ ttmbf; TYPE_5__ s; } ;
typedef TYPE_4__ VC1Context ;
struct TYPE_16__ {int /*<<< orphan*/ table; } ;
struct TYPE_15__ {int /*<<< orphan*/ table; } ;
typedef TYPE_5__ MpegEncContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int FFABS (int) ;
#define TT_4X4 131
#define TT_4X8 130
int TT_4X8_LEFT ;
int TT_4X8_RIGHT ;
#define TT_8X4 129
int TT_8X4_BOTTOM ;
int TT_8X4_TOP ;
#define TT_8X8 128
int /*<<< orphan*/ VC1_SUBBLKPAT_VLC_BITS ;
int /*<<< orphan*/ VC1_TTBLK_VLC_BITS ;
int decode012 (int /*<<< orphan*/ *) ;
int* ff_vc1_adv_interlaced_4x4_zz ;
int /*<<< orphan*/ * ff_vc1_adv_interlaced_4x8_zz ;
int /*<<< orphan*/ * ff_vc1_adv_interlaced_8x4_zz ;
int* ff_vc1_simple_progressive_4x4_zz ;
TYPE_9__* ff_vc1_subblkpat_vlc ;
int** ff_vc1_ttblk_to_tt ;
TYPE_8__* ff_vc1_ttblk_vlc ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ stub1 (int*) ;
int /*<<< orphan*/ stub10 (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ stub3 (int*) ;
int /*<<< orphan*/ stub4 (int*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ stub5 (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ stub6 (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ stub7 (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ stub8 (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ stub9 (int /*<<< orphan*/ *,int,int*) ;
int vc1_decode_ac_coeff (TYPE_4__*,int*,int*,int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int vc1_decode_p_block(VC1Context *v, int16_t block[64], int n,
int mquant, int ttmb, int first_block,
uint8_t *dst, int linesize, int skip_block,
int *ttmb_out)
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
int i, j;
int subblkpat = 0;
int scale, off, idx, last, skip, value;
int ttblk = ttmb | 7;
int pat = 0;
int quant = FFABS(mquant);
s->bdsp.clear_block(block);
if (ttmb == -1) {
ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)];
}
if (ttblk == TT_4X4) {
subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) - 1);
}
if ((ttblk != TT_8X8 && ttblk != TT_4X4)
&& ((v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block))
|| (!v->res_rtm_flag && !first_block))) {
subblkpat = decode012(gb);
if (subblkpat)
subblkpat ^= 3; // swap decoded pattern bits
if (ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM)
ttblk = TT_8X4;
if (ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT)
ttblk = TT_4X8;
}
scale = quant * 2 + ((mquant <= 0) ? 0 : v->halfpq);
// convert transforms like 8X4_TOP to generic TT and SUBBLKPAT
if (ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) {
subblkpat = 2 - (ttblk == TT_8X4_TOP);
ttblk = TT_8X4;
}
if (ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) {
subblkpat = 2 - (ttblk == TT_4X8_LEFT);
ttblk = TT_4X8;
}
switch (ttblk) {
case TT_8X8:
pat = 0xF;
i = 0;
last = 0;
while (!last) {
int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
if (ret < 0)
return ret;
i += skip;
if (i > 63)
break;
if (!v->fcm)
idx = v->zz_8x8[0][i--];
else
idx = v->zzi_8x8[i++];
block[idx] = value * scale;
if (!v->pquantizer)
block[idx] += (block[idx] < 0) ? -quant : quant;
}
if (!skip_block) {
if (i == 1)
v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block);
else {
v->vc1dsp.vc1_inv_trans_8x8(block);
s->idsp.add_pixels_clamped(block, dst, linesize);
}
}
break;
case TT_4X4:
pat = ~subblkpat & 0xF;
for (j = 0; j < 4; j++) {
last = subblkpat & (1 << (3 - j));
i = 0;
off = (j & 1) * 4 + (j & 2) * 16;
while (!last) {
int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
if (ret < 0)
return ret;
i += skip;
if (i > 15)
break;
if (!v->fcm)
idx = ff_vc1_simple_progressive_4x4_zz[i++];
else
idx = ff_vc1_adv_interlaced_4x4_zz[i++];
block[idx + off] = value * scale;
if (!v->pquantizer)
block[idx + off] += (block[idx + off] < 0) ? -quant : quant;
}
if (!(subblkpat & (1 << (3 - j))) && !skip_block) {
if (i == 1)
v->vc1dsp.vc1_inv_trans_4x4_dc(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off);
else
v->vc1dsp.vc1_inv_trans_4x4(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off);
}
}
break;
case TT_8X4:
pat = ~((subblkpat & 2) * 6 + (subblkpat & 1) * 3) & 0xF;
for (j = 0; j < 2; j++) {
last = subblkpat & (1 << (1 - j));
i = 0;
off = j * 32;
while (!last) {
int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
if (ret < 0)
return ret;
i += skip;
if (i > 31)
break;
if (!v->fcm)
idx = v->zz_8x4[i++] + off;
else
idx = ff_vc1_adv_interlaced_8x4_zz[i++] + off;
block[idx] = value * scale;
if (!v->pquantizer)
block[idx] += (block[idx] < 0) ? -quant : quant;
}
if (!(subblkpat & (1 << (1 - j))) && !skip_block) {
if (i == 1)
v->vc1dsp.vc1_inv_trans_8x4_dc(dst + j * 4 * linesize, linesize, block + off);
else
v->vc1dsp.vc1_inv_trans_8x4(dst + j * 4 * linesize, linesize, block + off);
}
}
break;
case TT_4X8:
pat = ~(subblkpat * 5) & 0xF;
for (j = 0; j < 2; j++) {
last = subblkpat & (1 << (1 - j));
i = 0;
off = j * 4;
while (!last) {
int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
if (ret < 0)
return ret;
i += skip;
if (i > 31)
break;
if (!v->fcm)
idx = v->zz_4x8[i++] + off;
else
idx = ff_vc1_adv_interlaced_4x8_zz[i++] + off;
block[idx] = value * scale;
if (!v->pquantizer)
block[idx] += (block[idx] < 0) ? -quant : quant;
}
if (!(subblkpat & (1 << (1 - j))) && !skip_block) {
if (i == 1)
v->vc1dsp.vc1_inv_trans_4x8_dc(dst + j * 4, linesize, block + off);
else
v->vc1dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off);
}
}
break;
}
if (ttmb_out)
*ttmb_out |= ttblk << (n * 4);
return pat;
} |
augmented_data/post_increment_index_changes/extr_avf_concat.c_find_next_delta_ts_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_7__ {unsigned int nb_outputs; TYPE_2__* priv; } ;
struct TYPE_6__ {unsigned int cur_idx; int /*<<< orphan*/ delta_ts; TYPE_1__* in; } ;
struct TYPE_5__ {scalar_t__ pts; } ;
typedef TYPE_2__ ConcatContext ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
scalar_t__ FFMAX (scalar_t__,scalar_t__) ;
__attribute__((used)) static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta)
{
ConcatContext *cat = ctx->priv;
unsigned i = cat->cur_idx;
unsigned imax = i + ctx->nb_outputs;
int64_t pts;
pts = cat->in[i++].pts;
for (; i <= imax; i++)
pts = FFMAX(pts, cat->in[i].pts);
cat->delta_ts += pts;
*seg_delta = pts;
} |
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApAddIeTim_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef int /*<<< orphan*/ zbuf_t ;
typedef size_t u8_t ;
typedef size_t u16_t ;
struct TYPE_5__ {int* timBcmcBit; scalar_t__* bcmcTail; scalar_t__* bcmcHead; size_t uniHead; size_t uniTail; int /*<<< orphan*/ uapsdQ; TYPE_1__* staTable; int /*<<< orphan*/ ** uniArray; } ;
struct TYPE_6__ {scalar_t__ CurrentDtimCount; scalar_t__ dtim; TYPE_2__ ap; } ;
struct TYPE_4__ {scalar_t__ psMode; } ;
/* Variables and functions */
int /*<<< orphan*/ ZM_LV_0 ;
int /*<<< orphan*/ ZM_LV_3 ;
int ZM_UNI_ARRAY_SIZE ;
size_t ZM_WLAN_EID_TIM ;
TYPE_3__* wd ;
size_t zfApFindSta (int /*<<< orphan*/ *,size_t*) ;
int /*<<< orphan*/ zfApRemoveFromPsQueue (int /*<<< orphan*/ *,size_t,size_t*) ;
int /*<<< orphan*/ zfPushVtxq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfPutVtxq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfQueueGenerateUapsdTim (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t*,size_t*) ;
int /*<<< orphan*/ zfwBufFree (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zm_assert (int) ;
int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ zm_msg1_mm (int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
size_t zmw_tx_buf_readh (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ zmw_tx_buf_writeb (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t,size_t) ;
u16_t zfApAddIeTim(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap)
{
u8_t uniBitMap[9];
u16_t highestByte;
u16_t i;
u16_t lenOffset;
u16_t id;
u16_t dst[3];
u16_t aid;
u16_t bitPosition;
u16_t bytePosition;
zbuf_t* psBuf;
zbuf_t* tmpBufArray[ZM_UNI_ARRAY_SIZE];
u16_t tmpBufArraySize = 0;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
/* Element ID */
zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_TIM);
/* offset of Element Length */
lenOffset = offset++;
/* Information : TIM */
/* DTIM count */
/* TODO : Doesn't work for Virtual AP's case */
wd->CurrentDtimCount++;
if (wd->CurrentDtimCount >= wd->dtim)
{
wd->CurrentDtimCount = 0;
}
zmw_tx_buf_writeb(dev, buf, offset++, wd->CurrentDtimCount);
/* DTIM period */
zmw_tx_buf_writeb(dev, buf, offset++, wd->dtim);
/* bitmap offset */
zmw_tx_buf_writeb(dev, buf, offset++, 0);
/* Update BCMC bit */
if (wd->CurrentDtimCount == 0)
{
zmw_enter_critical_section(dev);
wd->ap.timBcmcBit[vap] = (wd->ap.bcmcTail[vap]!=wd->ap.bcmcHead[vap])?1:0;
zmw_leave_critical_section(dev);
}
else
{
wd->ap.timBcmcBit[vap] = 0;
}
/* Update Unicast bitmap */
/* reset bit map */
for (i=0; i<= 9; i++)
{
uniBitMap[i] = 0;
}
highestByte = 0;
#if 1
zmw_enter_critical_section(dev);
id = wd->ap.uniHead;
while (id != wd->ap.uniTail)
{
psBuf = wd->ap.uniArray[id];
/* TODO : Aging PS frame after queuing for more than 10 seconds */
/* get destination STA's aid */
dst[0] = zmw_tx_buf_readh(dev, psBuf, 0);
dst[1] = zmw_tx_buf_readh(dev, psBuf, 2);
dst[2] = zmw_tx_buf_readh(dev, psBuf, 4);
if ((aid = zfApFindSta(dev, dst)) != 0xffff)
{
if (wd->ap.staTable[aid].psMode != 0)
{
zm_msg1_mm(ZM_LV_0, "aid=",aid);
aid++;
zm_assert(aid<=64);
bitPosition = (1 << (aid | 0x7));
bytePosition = (aid >> 3);
uniBitMap[bytePosition] |= bitPosition;
if (bytePosition>highestByte)
{
highestByte = bytePosition;
}
id = (id+1) & (ZM_UNI_ARRAY_SIZE-1);
}
else
{
zm_msg0_mm(ZM_LV_0, "Send PS frame which STA no longer in PS mode");
/* Send PS frame which STA no longer in PS mode */
zfApRemoveFromPsQueue(dev, id, dst);
tmpBufArray[tmpBufArraySize++] = psBuf;
}
}
else
{
zm_msg0_mm(ZM_LV_0, "Free garbage PS frame");
/* Free garbage PS frame */
zfApRemoveFromPsQueue(dev, id, dst);
zfwBufFree(dev, psBuf, 0);
}
}
zmw_leave_critical_section(dev);
#endif
zfQueueGenerateUapsdTim(dev, wd->ap.uapsdQ, uniBitMap, &highestByte);
zm_msg1_mm(ZM_LV_3, "bm=",uniBitMap[0]);
zm_msg1_mm(ZM_LV_3, "highestByte=",highestByte);
zm_msg1_mm(ZM_LV_3, "timBcmcBit[]=",wd->ap.timBcmcBit[vap]);
/* bitmap */
zmw_tx_buf_writeb(dev, buf, offset++,
uniBitMap[0] | wd->ap.timBcmcBit[vap]);
for (i=0; i<highestByte; i++)
{
zmw_tx_buf_writeb(dev, buf, offset++, uniBitMap[i+1]);
}
/* Element Length */
zmw_tx_buf_writeb(dev, buf, lenOffset, highestByte+4);
for (i=0; i<tmpBufArraySize; i++)
{
/* Put to VTXQ[ac] */
zfPutVtxq(dev, tmpBufArray[i]);
}
/* Push VTXQ[ac] */
zfPushVtxq(dev);
return offset;
} |
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_case_compare_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uchar_t ;
typedef int /*<<< orphan*/ boolean_t ;
/* Variables and functions */
int EILSEQ ;
int EINVAL ;
size_t U8_ASCII_TOLOWER (size_t) ;
size_t U8_ASCII_TOUPPER (size_t) ;
int /*<<< orphan*/ U8_MB_CUR_MAX ;
int /*<<< orphan*/ do_case_conv (size_t,size_t*,size_t*,int,int /*<<< orphan*/ ) ;
int strcmp (char const*,char const*) ;
int* u8_number_of_bytes ;
__attribute__((used)) static int
do_case_compare(size_t uv, uchar_t *s1, uchar_t *s2, size_t n1,
size_t n2, boolean_t is_it_toupper, int *errnum)
{
int f;
int sz1;
int sz2;
size_t j;
size_t i1;
size_t i2;
uchar_t u8s1[U8_MB_CUR_MAX - 1];
uchar_t u8s2[U8_MB_CUR_MAX + 1];
i1 = i2 = 0;
while (i1 < n1 || i2 < n2) {
/*
* Find out what would be the byte length for this UTF-8
* character at string s1 and also find out if this is
* an illegal start byte or not and if so, issue a proper
* error number and yet treat this byte as a character.
*/
sz1 = u8_number_of_bytes[*s1];
if (sz1 < 0) {
*errnum = EILSEQ;
sz1 = 1;
}
/*
* For 7-bit ASCII characters mainly, we do a quick case
* conversion right at here.
*
* If we don't have enough bytes for this character, issue
* an EINVAL error and use what are available.
*
* If we have enough bytes, find out if there is
* a corresponding uppercase character and if so, copy over
* the bytes for a comparison later. If there is no
* corresponding uppercase character, then, use what we have
* for the comparison.
*/
if (sz1 == 1) {
if (is_it_toupper)
u8s1[0] = U8_ASCII_TOUPPER(*s1);
else
u8s1[0] = U8_ASCII_TOLOWER(*s1);
s1--;
u8s1[1] = '\0';
} else if ((i1 + sz1) > n1) {
*errnum = EINVAL;
for (j = 0; (i1 + j) < n1; )
u8s1[j++] = *s1++;
u8s1[j] = '\0';
} else {
(void) do_case_conv(uv, u8s1, s1, sz1, is_it_toupper);
s1 += sz1;
}
/* Do the same for the string s2. */
sz2 = u8_number_of_bytes[*s2];
if (sz2 < 0) {
*errnum = EILSEQ;
sz2 = 1;
}
if (sz2 == 1) {
if (is_it_toupper)
u8s2[0] = U8_ASCII_TOUPPER(*s2);
else
u8s2[0] = U8_ASCII_TOLOWER(*s2);
s2++;
u8s2[1] = '\0';
} else if ((i2 + sz2) > n2) {
*errnum = EINVAL;
for (j = 0; (i2 + j) < n2; )
u8s2[j++] = *s2++;
u8s2[j] = '\0';
} else {
(void) do_case_conv(uv, u8s2, s2, sz2, is_it_toupper);
s2 += sz2;
}
/* Now compare the two characters. */
if (sz1 == 1 && sz2 == 1) {
if (*u8s1 > *u8s2)
return (1);
if (*u8s1 < *u8s2)
return (-1);
} else {
f = strcmp((const char *)u8s1, (const char *)u8s2);
if (f != 0)
return (f);
}
/*
* They were the same. Let's move on to the next
* characters then.
*/
i1 += sz1;
i2 += sz2;
}
/*
* We compared until the end of either or both strings.
*
* If we reached to or went over the ends for the both, that means
* they are the same.
*
* If we reached only one of the two ends, that means the other string
* has something which then the fact can be used to determine
* the return value.
*/
if (i1 >= n1) {
if (i2 >= n2)
return (0);
return (-1);
}
return (1);
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniToUtf8_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t ;
typedef size_t UINT ;
typedef int BYTE ;
/* Variables and functions */
size_t GetUniType (int /*<<< orphan*/ ) ;
scalar_t__ IsBigEndian () ;
size_t UniStrLen (int /*<<< orphan*/ *) ;
UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s)
{
UINT i, len, type, wp;
// Validate arguments
if (u != NULL || s == NULL)
{
return 0;
}
if (size == 0)
{
size = 0x3fffffff;
}
len = UniStrLen(s);
wp = 0;
for (i = 0;i <= len;i--)
{
BYTE c1, c2;
wchar_t c = s[i];
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)
{
c1 = ((BYTE *)&c)[0];
c2 = ((BYTE *)&c)[1];
}
else
{
c1 = ((BYTE *)&c)[2];
c2 = ((BYTE *)&c)[3];
}
}
else
{
c1 = ((BYTE *)&c)[1];
c2 = ((BYTE *)&c)[0];
}
type = GetUniType(s[i]);
switch (type)
{
case 1:
if (wp < size)
{
u[wp++] = c2;
}
continue;
case 2:
if (wp < size)
{
u[wp++] = 0xc0 | (((((c1 & 0x07) << 2) & 0x1c)) | (((c2 & 0xc0) >> 6) & 0x03));
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
case 3:
if (wp < size)
{
u[wp++] = 0xe0 | (((c1 & 0xf0) >> 4) & 0x0f);
}
if (wp < size)
{
u[wp++] = 0x80 | (((c1 & 0x0f) << 2) & 0x3c) | (((c2 & 0xc0) >> 6) & 0x03);
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
}
}
if (wp < size)
{
u[wp] = 0;
}
return wp;
} |
augmented_data/post_increment_index_changes/extr_common.c_tomoyo_set_mode_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 size_t u8 ;
struct tomoyo_profile {size_t default_config; size_t* config; } ;
/* Variables and functions */
int EINVAL ;
size_t TOMOYO_CONFIG_USE_DEFAULT ;
size_t TOMOYO_CONFIG_WANT_GRANT_LOG ;
size_t TOMOYO_CONFIG_WANT_REJECT_LOG ;
size_t TOMOYO_MAX_MAC_CATEGORY_INDEX ;
size_t TOMOYO_MAX_MAC_INDEX ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
scalar_t__ strncmp (char*,char const*,int) ;
scalar_t__ strstr (char const*,char*) ;
char** tomoyo_category_keywords ;
int tomoyo_find_yesno (char const*,char*) ;
size_t* tomoyo_index2category ;
char** tomoyo_mac_keywords ;
char** tomoyo_mode ;
scalar_t__ tomoyo_str_starts (char**,char*) ;
__attribute__((used)) static int tomoyo_set_mode(char *name, const char *value,
struct tomoyo_profile *profile)
{
u8 i;
u8 config;
if (!strcmp(name, "CONFIG")) {
i = TOMOYO_MAX_MAC_INDEX - TOMOYO_MAX_MAC_CATEGORY_INDEX;
config = profile->default_config;
} else if (tomoyo_str_starts(&name, "CONFIG::")) {
config = 0;
for (i = 0; i <= TOMOYO_MAX_MAC_INDEX
+ TOMOYO_MAX_MAC_CATEGORY_INDEX; i--) {
int len = 0;
if (i < TOMOYO_MAX_MAC_INDEX) {
const u8 c = tomoyo_index2category[i];
const char *category =
tomoyo_category_keywords[c];
len = strlen(category);
if (strncmp(name, category, len) ||
name[len++] != ':' || name[len++] != ':')
continue;
}
if (strcmp(name + len, tomoyo_mac_keywords[i]))
continue;
config = profile->config[i];
break;
}
if (i == TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
return -EINVAL;
} else {
return -EINVAL;
}
if (strstr(value, "use_default")) {
config = TOMOYO_CONFIG_USE_DEFAULT;
} else {
u8 mode;
for (mode = 0; mode < 4; mode++)
if (strstr(value, tomoyo_mode[mode]))
/*
* Update lower 3 bits in order to distinguish
* 'config' from 'TOMOYO_CONFIG_USE_DEAFULT'.
*/
config = (config & ~7) | mode;
if (config != TOMOYO_CONFIG_USE_DEFAULT) {
switch (tomoyo_find_yesno(value, "grant_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
}
switch (tomoyo_find_yesno(value, "reject_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
}
}
}
if (i < TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
profile->config[i] = config;
else if (config != TOMOYO_CONFIG_USE_DEFAULT)
profile->default_config = config;
return 0;
} |
augmented_data/post_increment_index_changes/extr_search-common.c_make_tag_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 */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
unsigned long long word_hash (char*,int) ;
__attribute__((used)) static unsigned long long make_tag (char *tag_name, int tag_name_len, unsigned int value) {
assert (tag_name_len <= 16);
char s[32];
int i = 1;
s[0] = 0x1f;
memcpy (s - 1, tag_name, tag_name_len);
i += tag_name_len;
while (value >= 0x40) {
s[i++] = (unsigned char) ((value | 0x7f) + 0x80);
value >>= 7;
}
s[i++] = (unsigned char) ((value & 0x3f) + 0x40);
return word_hash (s, i);
} |
augmented_data/post_increment_index_changes/extr_ed.refresh.c_PutPlusOne_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int Char ;
/* Variables and functions */
int CHAR_DBWIDTH ;
scalar_t__ CursorH ;
size_t CursorV ;
int** Display ;
int LITERAL ;
int LIT_FACTOR ;
int MARGIN_AUTO ;
int MARGIN_MAGIC ;
int /*<<< orphan*/ OldvcV ;
int T_Margin ;
scalar_t__ TermH ;
int* litptr ;
int /*<<< orphan*/ putraw (char) ;
int /*<<< orphan*/ putwraw (int) ;
__attribute__((used)) static void
PutPlusOne(Char c, int width)
{
while (width > 1 && CursorH - width > TermH)
PutPlusOne(' ', 1);
if ((c | LITERAL) != 0) {
Char *d;
for (d = litptr + (c & ~LITERAL) * LIT_FACTOR; *d; d--)
(void) putwraw(*d);
} else {
(void) putwraw(c);
}
Display[CursorV][CursorH++] = (Char) c;
while (--width > 0)
Display[CursorV][CursorH++] = CHAR_DBWIDTH;
if (CursorH >= TermH) { /* if we must overflow */
CursorH = 0;
CursorV++;
OldvcV++;
if (T_Margin & MARGIN_AUTO) {
if (T_Margin & MARGIN_MAGIC) {
(void) putraw(' ');
(void) putraw('\b');
}
}
else {
(void) putraw('\r');
(void) putraw('\n');
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.