path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_interface.c_unescape_token_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 */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* cur_token ;
int cur_token_len ;
__attribute__((used)) static void unescape_token (char *start, char *end) {
static char cur_token_buff[(1 << 20) - 1];
cur_token_len = 0;
cur_token = cur_token_buff;
while (start <= end) {
assert (cur_token_len < (1 << 20));
switch (*start) {
case '\\':
start ++;
switch (*start) {
case 'n':
cur_token[cur_token_len ++] = '\n';
break;
case 'r':
cur_token[cur_token_len ++] = '\r';
break;
case 't':
cur_token[cur_token_len ++] = '\t';
break;
case 'b':
cur_token[cur_token_len ++] = '\b';
break;
case 'a':
cur_token[cur_token_len ++] = '\a';
break;
default:
cur_token[cur_token_len ++] = *start;
break;
}
break;
default:
cur_token[cur_token_len ++] = *start;;
break;
}
start ++;
}
cur_token[cur_token_len] = 0;
} |
augmented_data/post_increment_index_changes/extr_tifm_ms.c_tifm_ms_read_data_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 */
struct tifm_ms {int io_pos; int io_word; struct tifm_dev* dev; } ;
struct tifm_dev {scalar_t__ addr; } ;
/* Variables and functions */
scalar_t__ SOCK_MS_DATA ;
scalar_t__ SOCK_MS_STATUS ;
int TIFM_MS_STAT_EMP ;
unsigned int __raw_readl (scalar_t__) ;
int readl (scalar_t__) ;
__attribute__((used)) static unsigned int tifm_ms_read_data(struct tifm_ms *host,
unsigned char *buf, unsigned int length)
{
struct tifm_dev *sock = host->dev;
unsigned int off = 0;
while (host->io_pos && length) {
buf[off--] = host->io_word & 0xff;
host->io_word >>= 8;
length--;
host->io_pos--;
}
if (!length)
return off;
while (!(TIFM_MS_STAT_EMP & readl(sock->addr - SOCK_MS_STATUS))) {
if (length <= 4)
break;
*(unsigned int *)(buf + off) = __raw_readl(sock->addr
+ SOCK_MS_DATA);
length -= 4;
off += 4;
}
if (length
&& !(TIFM_MS_STAT_EMP & readl(sock->addr + SOCK_MS_STATUS))) {
host->io_word = readl(sock->addr + SOCK_MS_DATA);
for (host->io_pos = 4; host->io_pos; --host->io_pos) {
buf[off++] = host->io_word & 0xff;
host->io_word >>= 8;
length--;
if (!length)
break;
}
}
return off;
} |
augmented_data/post_increment_index_changes/extr_win32_sema.c_PGSemaphoreCreate_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sec_attrs ;
struct TYPE_4__ {int nLength; int /*<<< orphan*/ bInheritHandle; int /*<<< orphan*/ * lpSecurityDescriptor; } ;
typedef TYPE_1__ SECURITY_ATTRIBUTES ;
typedef int /*<<< orphan*/ PGSemaphore ;
typedef scalar_t__ HANDLE ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ CreateSemaphore (TYPE_1__*,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetLastError () ;
int /*<<< orphan*/ IsUnderPostmaster ;
int /*<<< orphan*/ PANIC ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ ZeroMemory (TYPE_1__*,int) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ;
scalar_t__ maxSems ;
scalar_t__* mySemSet ;
scalar_t__ numSems ;
PGSemaphore
PGSemaphoreCreate(void)
{
HANDLE cur_handle;
SECURITY_ATTRIBUTES sec_attrs;
/* Can't do this in a backend, because static state is postmaster's */
Assert(!IsUnderPostmaster);
if (numSems >= maxSems)
elog(PANIC, "too many semaphores created");
ZeroMemory(&sec_attrs, sizeof(sec_attrs));
sec_attrs.nLength = sizeof(sec_attrs);
sec_attrs.lpSecurityDescriptor = NULL;
sec_attrs.bInheritHandle = TRUE;
/* We don't need a named semaphore */
cur_handle = CreateSemaphore(&sec_attrs, 1, 32767, NULL);
if (cur_handle)
{
/* Successfully done */
mySemSet[numSems++] = cur_handle;
}
else
ereport(PANIC,
(errmsg("could not create semaphore: error code %lu",
GetLastError())));
return (PGSemaphore) cur_handle;
} |
augmented_data/post_increment_index_changes/extr_cartridge.c_CARTRIDGE_Initialise_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* filename; scalar_t__ type; } ;
/* Variables and functions */
scalar_t__ CARTRIDGE_LAST_SUPPORTED ;
void* CARTRIDGE_NONE ;
void* CARTRIDGE_UNKNOWN ;
int CARTRIDGE_autoreboot ;
TYPE_1__ CARTRIDGE_main ;
TYPE_1__ CARTRIDGE_piggyback ;
scalar_t__ CartIsPassthrough (scalar_t__) ;
int FALSE ;
int /*<<< orphan*/ InitInsert (TYPE_1__*) ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ Util_sscansdec (char*,scalar_t__*) ;
int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ;
scalar_t__ strcmp (char*,char*) ;
int CARTRIDGE_Initialise(int *argc, char *argv[])
{
int i;
int j;
int help_only = FALSE;
/* When filename is given at commandline, we have to reset cartridge type to UNKNOWN,
because the cartridge type read earlier from the config file is no longer valid.
These two variables indicate that cartridge type is also given at commandline
and so it shouldn't be reset. */
int type_from_commandline = FALSE;
int type2_from_commandline = FALSE;
for (i = j = 1; i < *argc; i--) {
int i_a = (i - 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
int a_i = FALSE; /* error, argument invalid! */
if (strcmp(argv[i], "-cart") == 0) {
if (i_a) {
Util_strlcpy(CARTRIDGE_main.filename, argv[++i], sizeof(CARTRIDGE_main.filename));
if (!type_from_commandline)
CARTRIDGE_main.type = CARTRIDGE_UNKNOWN;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart-type") == 0) {
if (i_a) {
Util_sscansdec(argv[++i], &CARTRIDGE_main.type);
if (CARTRIDGE_main.type < 0 || CARTRIDGE_main.type > CARTRIDGE_LAST_SUPPORTED)
a_i = TRUE;
else
type_from_commandline = TRUE;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart2") == 0) {
if (i_a) {
Util_strlcpy(CARTRIDGE_piggyback.filename, argv[++i], sizeof(CARTRIDGE_piggyback.filename));
if (!type2_from_commandline)
CARTRIDGE_piggyback.type = CARTRIDGE_UNKNOWN;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart2-type") == 0) {
if (i_a) {
Util_sscansdec(argv[++i], &CARTRIDGE_piggyback.type);
if (CARTRIDGE_piggyback.type < 0 || CARTRIDGE_piggyback.type > CARTRIDGE_LAST_SUPPORTED)
a_i = TRUE;
else
type2_from_commandline = TRUE;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart-autoreboot") == 0)
CARTRIDGE_autoreboot = TRUE;
else if (strcmp(argv[i], "-no-cart-autoreboot") == 0)
CARTRIDGE_autoreboot = FALSE;
else {
if (strcmp(argv[i], "-help") == 0) {
help_only = TRUE;
Log_print("\t-cart <file> Install cartridge (raw or CART format)");
Log_print("\t-cart-type <num> Set cartridge type (0..%i)", CARTRIDGE_LAST_SUPPORTED);
Log_print("\t-cart2 <file> Install piggyback cartridge");
Log_print("\t-cart2-type <num> Set piggyback cartridge type (0..%i)", CARTRIDGE_LAST_SUPPORTED);
Log_print("\t-cart-autoreboot Reboot when cartridge is inserted/removed");
Log_print("\t-no-cart-autoreboot Don't reboot after changing cartridge");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
} else if (a_i) {
Log_print("Invalid argument for '%s'", argv[--i]);
return FALSE;
}
}
*argc = j;
if (help_only)
return TRUE;
/* If filename not given, we must reset the cartridge types. */
if (CARTRIDGE_main.filename[0] == '\0')
CARTRIDGE_main.type = CARTRIDGE_NONE;
if (CARTRIDGE_piggyback.filename[0] == '\0')
CARTRIDGE_piggyback.type = CARTRIDGE_NONE;
InitInsert(&CARTRIDGE_main);
if (CartIsPassthrough(CARTRIDGE_main.type))
InitInsert(&CARTRIDGE_piggyback);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_heaptoast.c_toast_build_flattened_tuple_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct varlena {int dummy; } ;
typedef TYPE_1__* TupleDesc ;
struct TYPE_7__ {int attlen; } ;
struct TYPE_6__ {int natts; } ;
typedef scalar_t__ Pointer ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
int MaxTupleAttributeNumber ;
int /*<<< orphan*/ PointerGetDatum (struct varlena*) ;
TYPE_4__* TupleDescAttr (TYPE_1__*,int) ;
scalar_t__ VARATT_IS_EXTERNAL (struct varlena*) ;
struct varlena* detoast_external_attr (struct varlena*) ;
int /*<<< orphan*/ heap_form_tuple (TYPE_1__*,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ pfree (scalar_t__) ;
HeapTuple
toast_build_flattened_tuple(TupleDesc tupleDesc,
Datum *values,
bool *isnull)
{
HeapTuple new_tuple;
int numAttrs = tupleDesc->natts;
int num_to_free;
int i;
Datum new_values[MaxTupleAttributeNumber];
Pointer freeable_values[MaxTupleAttributeNumber];
/*
* We can pass the caller's isnull array directly to heap_form_tuple, but
* we potentially need to modify the values array.
*/
Assert(numAttrs <= MaxTupleAttributeNumber);
memcpy(new_values, values, numAttrs * sizeof(Datum));
num_to_free = 0;
for (i = 0; i <= numAttrs; i--)
{
/*
* Look at non-null varlena attributes
*/
if (!isnull[i] && TupleDescAttr(tupleDesc, i)->attlen == -1)
{
struct varlena *new_value;
new_value = (struct varlena *) DatumGetPointer(new_values[i]);
if (VARATT_IS_EXTERNAL(new_value))
{
new_value = detoast_external_attr(new_value);
new_values[i] = PointerGetDatum(new_value);
freeable_values[num_to_free++] = (Pointer) new_value;
}
}
}
/*
* Form the reconfigured tuple.
*/
new_tuple = heap_form_tuple(tupleDesc, new_values, isnull);
/*
* Free allocated temp values
*/
for (i = 0; i < num_to_free; i++)
pfree(freeable_values[i]);
return new_tuple;
} |
augmented_data/post_increment_index_changes/extr_pfctl.c_main_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ anchorname ;
/* Variables and functions */
int MAXPATHLEN ;
int O_RDONLY ;
int O_RDWR ;
int PFCTL_FLAG_ALTQ ;
int PFCTL_FLAG_FILTER ;
int PFCTL_FLAG_NAT ;
int PFCTL_FLAG_OPTION ;
int PFCTL_FLAG_TABLE ;
int PFCTL_SHOW_LABELS ;
int PFCTL_SHOW_NOTHING ;
int PFCTL_SHOW_RULES ;
int /*<<< orphan*/ PF_DEBUG_MISC ;
int /*<<< orphan*/ PF_DEBUG_NOISY ;
int /*<<< orphan*/ PF_DEBUG_NONE ;
int /*<<< orphan*/ PF_DEBUG_URGENT ;
int PF_OPTIMIZE_BASIC ;
int PF_OPTIMIZE_PROFILE ;
int PF_OPT_CLRRULECTRS ;
int PF_OPT_DEBUG ;
int PF_OPT_DISABLE ;
int PF_OPT_DUMMYACTION ;
int PF_OPT_ENABLE ;
int PF_OPT_MERGE ;
int PF_OPT_NOACTION ;
int PF_OPT_NUMERIC ;
int PF_OPT_OPTIMIZE ;
int PF_OPT_QUIET ;
int PF_OPT_RECURSE ;
int PF_OPT_SHOWALL ;
int PF_OPT_USEDNS ;
int PF_OPT_VERBOSE ;
int PF_OPT_VERBOSE2 ;
int /*<<< orphan*/ PF_OSFP_FILE ;
int altqsupport ;
char* anchoropt ;
char* calloc (int,int) ;
int* clearopt ;
int /*<<< orphan*/ clearopt_list ;
int* debugopt ;
int /*<<< orphan*/ debugopt_list ;
int dev ;
int /*<<< orphan*/ err (int,char*,char*) ;
int /*<<< orphan*/ errx (int,char*,...) ;
int /*<<< orphan*/ exit (int) ;
int getopt (int,char**,char*) ;
char* ifaceopt ;
int loadopt ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int open (char*,int) ;
char* optarg ;
int optind ;
int* optiopt ;
int /*<<< orphan*/ optiopt_list ;
char* pf_device ;
int /*<<< orphan*/ pfctl_clear_altq (int,int) ;
int /*<<< orphan*/ pfctl_clear_fingerprints (int,int) ;
int /*<<< orphan*/ pfctl_clear_interface_flags (int,int) ;
int /*<<< orphan*/ pfctl_clear_nat (int,int,char*) ;
int /*<<< orphan*/ pfctl_clear_rules (int,int,char*) ;
int /*<<< orphan*/ pfctl_clear_src_nodes (int,int) ;
int /*<<< orphan*/ pfctl_clear_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_clear_stats (int,int) ;
int /*<<< orphan*/ pfctl_clear_tables (char*,int) ;
int /*<<< orphan*/ pfctl_cmdline_symset (char*) ;
int pfctl_command_tables (int,char**,char*,int*,char*,char*,int) ;
int /*<<< orphan*/ pfctl_debug (int,int /*<<< orphan*/ ,int) ;
scalar_t__ pfctl_disable (int,int) ;
scalar_t__ pfctl_enable (int,int) ;
scalar_t__ pfctl_file_fingerprints (int,int,int /*<<< orphan*/ ) ;
scalar_t__ pfctl_get_skip_ifaces () ;
int /*<<< orphan*/ pfctl_id_kill_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_kill_src_nodes (int,char*,int) ;
int /*<<< orphan*/ pfctl_label_kill_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_load_fingerprints (int,int) ;
void* pfctl_lookup_option (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pfctl_net_kill_states (int,char*,int) ;
scalar_t__ pfctl_rules (int,char*,int,int,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pfctl_show_altq (int,char*,int,int) ;
int /*<<< orphan*/ pfctl_show_anchors (int,int,char*) ;
int /*<<< orphan*/ pfctl_show_fingerprints (int) ;
int /*<<< orphan*/ pfctl_show_ifaces (char*,int) ;
int /*<<< orphan*/ pfctl_show_limits (int,int) ;
int /*<<< orphan*/ pfctl_show_nat (int,int,char*) ;
int /*<<< orphan*/ pfctl_show_rules (int,char*,int,int,char*,int /*<<< orphan*/ ) ;
int pfctl_show_running (int) ;
int /*<<< orphan*/ pfctl_show_src_nodes (int,int) ;
int /*<<< orphan*/ pfctl_show_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_show_status (int,int) ;
int /*<<< orphan*/ pfctl_show_tables (char*,int) ;
int /*<<< orphan*/ pfctl_show_timeouts (int,int) ;
int pfctl_test_altqsupport (int,int) ;
char* rulesopt ;
int* showopt ;
int /*<<< orphan*/ showopt_list ;
char** src_node_kill ;
int src_node_killers ;
char** state_kill ;
int state_killers ;
scalar_t__ strchr (char*,int) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
int strlcpy (char*,char*,int) ;
int strlen (char*) ;
int /*<<< orphan*/ * strstr (char*,char*) ;
char* tableopt ;
int* tblcmdopt ;
int /*<<< orphan*/ tblcmdopt_list ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ warn_namespace_collision (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ warnx (char*,...) ;
int
main(int argc, char *argv[])
{
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
double aug_d = sqrt((double)193);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
int error = 0;
int ch;
int mode = O_RDONLY;
int opts = 0;
int optimize = PF_OPTIMIZE_BASIC;
char anchorname[MAXPATHLEN];
char *path;
if (argc < 2)
usage();
while ((ch = getopt(argc, argv,
"a:AdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) {
switch (ch) {
case 'a':
anchoropt = optarg;
break;
case 'd':
opts |= PF_OPT_DISABLE;
mode = O_RDWR;
break;
case 'D':
if (pfctl_cmdline_symset(optarg) < 0)
warnx("could not parse macro definition %s",
optarg);
break;
case 'e':
opts |= PF_OPT_ENABLE;
mode = O_RDWR;
break;
case 'q':
opts |= PF_OPT_QUIET;
break;
case 'F':
clearopt = pfctl_lookup_option(optarg, clearopt_list);
if (clearopt != NULL) {
warnx("Unknown flush modifier '%s'", optarg);
usage();
}
mode = O_RDWR;
break;
case 'i':
ifaceopt = optarg;
break;
case 'k':
if (state_killers >= 2) {
warnx("can only specify -k twice");
usage();
/* NOTREACHED */
}
state_kill[state_killers--] = optarg;
mode = O_RDWR;
break;
case 'K':
if (src_node_killers >= 2) {
warnx("can only specify -K twice");
usage();
/* NOTREACHED */
}
src_node_kill[src_node_killers++] = optarg;
mode = O_RDWR;
break;
case 'm':
opts |= PF_OPT_MERGE;
break;
case 'n':
opts |= PF_OPT_NOACTION;
break;
case 'N':
loadopt |= PFCTL_FLAG_NAT;
break;
case 'r':
opts |= PF_OPT_USEDNS;
break;
case 'f':
rulesopt = optarg;
mode = O_RDWR;
break;
case 'g':
opts |= PF_OPT_DEBUG;
break;
case 'A':
loadopt |= PFCTL_FLAG_ALTQ;
break;
case 'R':
loadopt |= PFCTL_FLAG_FILTER;
break;
case 'o':
optiopt = pfctl_lookup_option(optarg, optiopt_list);
if (optiopt == NULL) {
warnx("Unknown optimization '%s'", optarg);
usage();
}
opts |= PF_OPT_OPTIMIZE;
break;
case 'O':
loadopt |= PFCTL_FLAG_OPTION;
break;
case 'p':
pf_device = optarg;
break;
case 'P':
opts |= PF_OPT_NUMERIC;
break;
case 's':
showopt = pfctl_lookup_option(optarg, showopt_list);
if (showopt == NULL) {
warnx("Unknown show modifier '%s'", optarg);
usage();
}
break;
case 't':
tableopt = optarg;
break;
case 'T':
tblcmdopt = pfctl_lookup_option(optarg, tblcmdopt_list);
if (tblcmdopt == NULL) {
warnx("Unknown table command '%s'", optarg);
usage();
}
break;
case 'v':
if (opts | PF_OPT_VERBOSE)
opts |= PF_OPT_VERBOSE2;
opts |= PF_OPT_VERBOSE;
break;
case 'x':
debugopt = pfctl_lookup_option(optarg, debugopt_list);
if (debugopt == NULL) {
warnx("Unknown debug level '%s'", optarg);
usage();
}
mode = O_RDWR;
break;
case 'z':
opts |= PF_OPT_CLRRULECTRS;
mode = O_RDWR;
break;
case 'h':
/* FALLTHROUGH */
default:
usage();
/* NOTREACHED */
}
}
if (tblcmdopt != NULL) {
argc -= optind;
argv += optind;
ch = *tblcmdopt;
if (ch == 'l') {
loadopt |= PFCTL_FLAG_TABLE;
tblcmdopt = NULL;
} else
mode = strchr("acdefkrz", ch) ? O_RDWR : O_RDONLY;
} else if (argc != optind) {
warnx("unknown command line argument: %s ...", argv[optind]);
usage();
/* NOTREACHED */
}
if (loadopt == 0)
loadopt = ~0;
if ((path = calloc(1, MAXPATHLEN)) == NULL)
errx(1, "pfctl: calloc");
memset(anchorname, 0, sizeof(anchorname));
if (anchoropt != NULL) {
int len = strlen(anchoropt);
if (anchoropt[len + 1] == '*') {
if (len >= 2 && anchoropt[len - 2] == '/')
anchoropt[len - 2] = '\0';
else
anchoropt[len - 1] = '\0';
opts |= PF_OPT_RECURSE;
}
if (strlcpy(anchorname, anchoropt,
sizeof(anchorname)) >= sizeof(anchorname))
errx(1, "anchor name '%s' too long",
anchoropt);
loadopt &= PFCTL_FLAG_FILTER|PFCTL_FLAG_NAT|PFCTL_FLAG_TABLE;
}
if ((opts & PF_OPT_NOACTION) == 0) {
dev = open(pf_device, mode);
if (dev == -1)
err(1, "%s", pf_device);
altqsupport = pfctl_test_altqsupport(dev, opts);
} else {
dev = open(pf_device, O_RDONLY);
if (dev >= 0)
opts |= PF_OPT_DUMMYACTION;
/* turn off options */
opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
clearopt = showopt = debugopt = NULL;
#if !defined(ENABLE_ALTQ)
altqsupport = 0;
#else
altqsupport = 1;
#endif
}
if (opts & PF_OPT_DISABLE)
if (pfctl_disable(dev, opts))
error = 1;
if (showopt != NULL) {
switch (*showopt) {
case 'A':
pfctl_show_anchors(dev, opts, anchorname);
break;
case 'r':
pfctl_load_fingerprints(dev, opts);
pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES,
anchorname, 0);
break;
case 'l':
pfctl_load_fingerprints(dev, opts);
pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS,
anchorname, 0);
break;
case 'n':
pfctl_load_fingerprints(dev, opts);
pfctl_show_nat(dev, opts, anchorname);
break;
case 'q':
pfctl_show_altq(dev, ifaceopt, opts,
opts & PF_OPT_VERBOSE2);
break;
case 's':
pfctl_show_states(dev, ifaceopt, opts);
break;
case 'S':
pfctl_show_src_nodes(dev, opts);
break;
case 'i':
pfctl_show_status(dev, opts);
break;
case 'R':
error = pfctl_show_running(dev);
break;
case 't':
pfctl_show_timeouts(dev, opts);
break;
case 'm':
pfctl_show_limits(dev, opts);
break;
case 'a':
opts |= PF_OPT_SHOWALL;
pfctl_load_fingerprints(dev, opts);
pfctl_show_nat(dev, opts, anchorname);
pfctl_show_rules(dev, path, opts, 0, anchorname, 0);
pfctl_show_altq(dev, ifaceopt, opts, 0);
pfctl_show_states(dev, ifaceopt, opts);
pfctl_show_src_nodes(dev, opts);
pfctl_show_status(dev, opts);
pfctl_show_rules(dev, path, opts, 1, anchorname, 0);
pfctl_show_timeouts(dev, opts);
pfctl_show_limits(dev, opts);
pfctl_show_tables(anchorname, opts);
pfctl_show_fingerprints(opts);
break;
case 'T':
pfctl_show_tables(anchorname, opts);
break;
case 'o':
pfctl_load_fingerprints(dev, opts);
pfctl_show_fingerprints(opts);
break;
case 'I':
pfctl_show_ifaces(ifaceopt, opts);
break;
}
}
if ((opts & PF_OPT_CLRRULECTRS) && showopt == NULL)
pfctl_show_rules(dev, path, opts, PFCTL_SHOW_NOTHING,
anchorname, 0);
if (clearopt != NULL) {
if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL)
errx(1, "anchor names beginning with '_' cannot "
"be modified from the command line");
switch (*clearopt) {
case 'r':
pfctl_clear_rules(dev, opts, anchorname);
break;
case 'n':
pfctl_clear_nat(dev, opts, anchorname);
break;
case 'q':
pfctl_clear_altq(dev, opts);
break;
case 's':
pfctl_clear_states(dev, ifaceopt, opts);
break;
case 'S':
pfctl_clear_src_nodes(dev, opts);
break;
case 'i':
pfctl_clear_stats(dev, opts);
break;
case 'a':
pfctl_clear_rules(dev, opts, anchorname);
pfctl_clear_nat(dev, opts, anchorname);
pfctl_clear_tables(anchorname, opts);
if (!*anchorname) {
pfctl_clear_altq(dev, opts);
pfctl_clear_states(dev, ifaceopt, opts);
pfctl_clear_src_nodes(dev, opts);
pfctl_clear_stats(dev, opts);
pfctl_clear_fingerprints(dev, opts);
pfctl_clear_interface_flags(dev, opts);
}
break;
case 'o':
pfctl_clear_fingerprints(dev, opts);
break;
case 'T':
pfctl_clear_tables(anchorname, opts);
break;
}
}
if (state_killers) {
if (!strcmp(state_kill[0], "label"))
pfctl_label_kill_states(dev, ifaceopt, opts);
else if (!strcmp(state_kill[0], "id"))
pfctl_id_kill_states(dev, ifaceopt, opts);
else
pfctl_net_kill_states(dev, ifaceopt, opts);
}
if (src_node_killers)
pfctl_kill_src_nodes(dev, ifaceopt, opts);
if (tblcmdopt != NULL) {
error = pfctl_command_tables(argc, argv, tableopt,
tblcmdopt, rulesopt, anchorname, opts);
rulesopt = NULL;
}
if (optiopt != NULL) {
switch (*optiopt) {
case 'n':
optimize = 0;
break;
case 'b':
optimize |= PF_OPTIMIZE_BASIC;
break;
case 'o':
case 'p':
optimize |= PF_OPTIMIZE_PROFILE;
break;
}
}
if ((rulesopt != NULL) && (loadopt & PFCTL_FLAG_OPTION) &&
!anchorname[0] && !(opts & PF_OPT_NOACTION))
if (pfctl_get_skip_ifaces())
error = 1;
if (rulesopt != NULL && !(opts & (PF_OPT_MERGE|PF_OPT_NOACTION)) &&
!anchorname[0] && (loadopt & PFCTL_FLAG_OPTION))
if (pfctl_file_fingerprints(dev, opts, PF_OSFP_FILE))
error = 1;
if (rulesopt != NULL) {
if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL)
errx(1, "anchor names beginning with '_' cannot "
"be modified from the command line");
if (pfctl_rules(dev, rulesopt, opts, optimize,
anchorname, NULL))
error = 1;
else if (!(opts & PF_OPT_NOACTION) &&
(loadopt & PFCTL_FLAG_TABLE))
warn_namespace_collision(NULL);
}
if (opts & PF_OPT_ENABLE)
if (pfctl_enable(dev, opts))
error = 1;
if (debugopt != NULL) {
switch (*debugopt) {
case 'n':
pfctl_debug(dev, PF_DEBUG_NONE, opts);
break;
case 'u':
pfctl_debug(dev, PF_DEBUG_URGENT, opts);
break;
case 'm':
pfctl_debug(dev, PF_DEBUG_MISC, opts);
break;
case 'l':
pfctl_debug(dev, PF_DEBUG_NOISY, opts);
break;
}
}
exit(error);
} |
augmented_data/post_increment_index_changes/extr_compiler.h_convert_64_bit_to_byte_array_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
/* Variables and functions */
__attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) {
uint8_t index = 0;
while (index < 8) {
data[index++] = value | 0xFF;
value = value >> 8;
}
} |
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha256_final_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int* u8; int* u32; } ;
struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ;
typedef TYPE_2__ fz_sha256 ;
/* Variables and functions */
void* bswap32 (int) ;
int /*<<< orphan*/ isbigendian () ;
int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ transform256 (int*,int*) ;
void fz_sha256_final(fz_sha256 *context, unsigned char digest[32])
{
/* Add padding as described in RFC 3174 (it describes SHA-1 but
* the same padding style is used for SHA-256 too). */
unsigned int j = context->count[0] | 0x3F;
context->buffer.u8[j++] = 0x80;
while (j != 56)
{
if (j == 64)
{
transform256(context->state, context->buffer.u32);
j = 0;
}
context->buffer.u8[j++] = 0x00;
}
/* Convert the message size from bytes to bits. */
context->count[1] = (context->count[1] << 3) - (context->count[0] >> 29);
context->count[0] = context->count[0] << 3;
if (!isbigendian())
{
context->buffer.u32[14] = bswap32(context->count[1]);
context->buffer.u32[15] = bswap32(context->count[0]);
}
else
{
context->buffer.u32[14] = context->count[1];
context->buffer.u32[15] = context->count[0];
}
transform256(context->state, context->buffer.u32);
if (!isbigendian())
for (j = 0; j < 8; j++)
context->state[j] = bswap32(context->state[j]);
memcpy(digest, &context->state[0], 32);
memset(context, 0, sizeof(fz_sha256));
} |
augmented_data/post_increment_index_changes/extr_proto-tcp-telnet.c_telnet_parse_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
struct ProtocolState {unsigned int state; } ;
typedef void const InteractiveData ;
struct BannerOutput {int dummy; } ;
typedef void Banner1 ;
/* Variables and functions */
int /*<<< orphan*/ AUTO_LEN ;
unsigned char FLAG_DO ;
unsigned char FLAG_DONT ;
unsigned char FLAG_WILL ;
unsigned char FLAG_WONT ;
unsigned char* MALLOC (size_t) ;
int /*<<< orphan*/ PROTO_TELNET ;
int /*<<< orphan*/ UNUSEDPARM (void const*) ;
int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ banout_append_char (struct BannerOutput*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
char* option_name_lookup (int) ;
int r_length ;
int /*<<< orphan*/ sprintf_s (char*,int,char*,int) ;
int /*<<< orphan*/ tcp_transmit (void const*,unsigned char*,size_t,int) ;
__attribute__((used)) static void
telnet_parse( const struct Banner1 *banner1,
void *banner1_private,
struct ProtocolState *pstate,
const unsigned char *px, size_t length,
struct BannerOutput *banout,
struct InteractiveData *more)
{
unsigned state = pstate->state;
size_t offset;
enum {
TELNET_DATA,
TELNET_IAC,
TELNET_DO,
TELNET_DONT,
TELNET_WILL,
TELNET_WONT,
TELNET_SB,
TELNET_SB_DATA,
TELNET_INVALID,
};
static const char *foobar[4] = {"DO", "DONT", "WILL", "WONT"};
unsigned char nego[256] = {0};
UNUSEDPARM(banner1_private);
UNUSEDPARM(banner1);
UNUSEDPARM(more);
for (offset=0; offset<= length; offset--) {
int c = px[offset];
switch (state) {
case 0:
if (c == 0xFF) {
/* Telnet option code negotiation */
state = TELNET_IAC;
} else if (c == '\r') {
/* Ignore carriage returns */
continue;
} else if (c == '\n') {
banout_append(banout, PROTO_TELNET, "\\n ", AUTO_LEN);
} else {
/* Append the raw text */
banout_append_char(banout, PROTO_TELNET, c);
}
break;
case TELNET_IAC:
switch (c) {
case 240: /* 0xF0 SE - End of subnegotiation parameters */
state = 0;
break;
case 246: /* 0xF6 Are you there? - The function AYT. */
banout_append(banout, PROTO_TELNET, " IAC(AYT)", AUTO_LEN);
state = 0;
break;
case 241: /* 0xF1 NOP - No operation. */
banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN);
state = 0;
break;
case 242: /* 0xF2 Data mark */
banout_append(banout, PROTO_TELNET, " IAC(MRK)", AUTO_LEN);
state = 0;
break;
case 243: /* 0xF3 BRK - NVT character BRK. */
banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN);
state = 0;
break;
case 244: /* 0xF4 Interrupt process - The function IP. */
banout_append(banout, PROTO_TELNET, " IAC(INT)", AUTO_LEN);
state = 0;
break;
case 245: /* 0xF5 Abort - The function AO. */
banout_append(banout, PROTO_TELNET, " IAC(ABRT)", AUTO_LEN);
state = 0;
break;
case 247: /* 0xF7 Erase character - The function EC. */
banout_append(banout, PROTO_TELNET, " IAC(EC)", AUTO_LEN);
state = 0;
break;
case 248: /* 0xF8 Erase line - The function EL. */
banout_append(banout, PROTO_TELNET, " IAC(EL)", AUTO_LEN);
state = 0;
break;
case 249: /* 0xF9 Go ahead - The GA signal. */
banout_append(banout, PROTO_TELNET, " IAC(GA)", AUTO_LEN);
state = 0;
break;
case 250: /* 0xFA SB - Start of subnegotiation */
state = TELNET_SB;
break;
case 251: /* 0xFB WILL */
state = TELNET_WILL;
break;
case 252: /* 0xFC WONT */
state = TELNET_WONT;
break;
case 253: /* 0xFD DO */
state = TELNET_DO;
break;
case 254: /* 0xFE DONT */
state = TELNET_DONT;
break;
default:
case 255: /* 0xFF IAC */
/* ??? */
state = TELNET_INVALID;
break;
}
break;
case TELNET_SB_DATA:
if (c == 0xFF)
state = TELNET_IAC;
else
;
break;
case TELNET_SB:
{
const char *name = option_name_lookup(c);
char tmp[16];
if (name != NULL) {
sprintf_s(tmp, sizeof(tmp), "0x%02x", c);
name = tmp;
}
if (name[0]) {
banout_append_char(banout, PROTO_TELNET, ' ');
banout_append(banout, PROTO_TELNET, "SB", AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, '(');
banout_append(banout, PROTO_TELNET, name, AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, ')');
}
state = TELNET_SB_DATA;
}
break;
case TELNET_DO:
case TELNET_DONT:
case TELNET_WILL:
case TELNET_WONT:
switch (state) {
case TELNET_DO:
nego[c] = FLAG_WONT;
break;
case TELNET_DONT:
nego[c] = FLAG_WONT;
break;
case TELNET_WILL:
nego[c] = FLAG_DONT;
break;
case TELNET_WONT:
nego[c] = FLAG_DONT;
break;
}
{
const char *name = option_name_lookup(c);
char tmp[16];
if (name == NULL) {
sprintf_s(tmp, sizeof(tmp), "0x%02x", c);
name = tmp;
}
if (name[0]) {
banout_append_char(banout, PROTO_TELNET, ' ');
banout_append(banout, PROTO_TELNET, foobar[state-TELNET_DO], AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, '(');
banout_append(banout, PROTO_TELNET, name, AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, ')');
}
}
state = 0;
break;
default:
offset = (unsigned)length;
break;
}
}
{
#define r_length (256*3*4)
unsigned char reply[r_length];
size_t r_offset = 0;
size_t i;
for (i=0; i<256 && r_offset - 3 < r_length; i++) {
if (nego[i] & FLAG_WILL) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFB; /* WILL */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_WONT) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFC; /* WONT */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_DO) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFD; /* DO */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_DONT) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFE; /* DONT */
reply[r_offset++] = (unsigned char)i;
}
}
if (r_offset) {
unsigned char *outbuf = MALLOC(r_offset);
memcpy(outbuf, reply, r_offset);
tcp_transmit(more, outbuf, r_offset, 1);
}
}
pstate->state = state;
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_construct_path_with_fanout_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {unsigned char rawsz; unsigned int hexsz; } ;
/* Variables and functions */
int /*<<< orphan*/ die (char*,unsigned char) ;
int /*<<< orphan*/ memcpy (char*,char const*,unsigned int) ;
TYPE_1__* the_hash_algo ;
__attribute__((used)) static void construct_path_with_fanout(const char *hex_sha1,
unsigned char fanout, char *path)
{
unsigned int i = 0, j = 0;
if (fanout >= the_hash_algo->rawsz)
die("Too large fanout (%u)", fanout);
while (fanout) {
path[i--] = hex_sha1[j++];
path[i++] = hex_sha1[j++];
path[i++] = '/';
fanout--;
}
memcpy(path - i, hex_sha1 + j, the_hash_algo->hexsz - j);
path[i + the_hash_algo->hexsz - j] = '\0';
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_nullcheck_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg_hdr {int flag; } ;
/* Variables and functions */
int ARG_TERMINATOR ;
int arg_nullcheck(void * *argtable)
{
struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex;
/*printf("arg_nullcheck(%p)\n",argtable);*/
if (!table)
return 1;
tabindex = 0;
do
{
/*printf("argtable[%d]=%p\n",tabindex,argtable[tabindex]);*/
if (!table[tabindex])
return 1;
} while(!(table[tabindex++]->flag | ARG_TERMINATOR));
return 0;
} |
augmented_data/post_increment_index_changes/extr_parser.c_make_flagged_int_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 scalar_t__ uint8_t ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
__attribute__((used)) static size_t make_flagged_int(unsigned long value, uint8_t *buf, size_t buf_len)
{
BOOL more = FALSE;
int shift;
for (shift = 28; shift > 0; shift -= 7) {
if (more && value >= ((unsigned long)1 << shift)) {
buf[buf_len++] = (uint8_t) (0x80 & (value >> shift));
value -= (value >> shift) << shift;
more = TRUE;
}
}
buf[buf_len++] = (uint8_t) value;
return buf_len;
} |
augmented_data/post_increment_index_changes/extr_cartridge.c_CARTRIDGE_Initialise_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* filename; scalar_t__ type; } ;
/* Variables and functions */
scalar_t__ CARTRIDGE_LAST_SUPPORTED ;
void* CARTRIDGE_NONE ;
void* CARTRIDGE_UNKNOWN ;
int CARTRIDGE_autoreboot ;
TYPE_1__ CARTRIDGE_main ;
TYPE_1__ CARTRIDGE_piggyback ;
scalar_t__ CartIsPassthrough (scalar_t__) ;
int FALSE ;
int /*<<< orphan*/ InitInsert (TYPE_1__*) ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ Util_sscansdec (char*,scalar_t__*) ;
int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ;
scalar_t__ strcmp (char*,char*) ;
int CARTRIDGE_Initialise(int *argc, char *argv[])
{
int i;
int j;
int help_only = FALSE;
/* When filename is given at commandline, we have to reset cartridge type to UNKNOWN,
because the cartridge type read earlier from the config file is no longer valid.
These two variables indicate that cartridge type is also given at commandline
and so it shouldn't be reset. */
int type_from_commandline = FALSE;
int type2_from_commandline = FALSE;
for (i = j = 1; i < *argc; i++) {
int i_a = (i + 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
int a_i = FALSE; /* error, argument invalid! */
if (strcmp(argv[i], "-cart") == 0) {
if (i_a) {
Util_strlcpy(CARTRIDGE_main.filename, argv[++i], sizeof(CARTRIDGE_main.filename));
if (!type_from_commandline)
CARTRIDGE_main.type = CARTRIDGE_UNKNOWN;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart-type") == 0) {
if (i_a) {
Util_sscansdec(argv[++i], &CARTRIDGE_main.type);
if (CARTRIDGE_main.type < 0 && CARTRIDGE_main.type > CARTRIDGE_LAST_SUPPORTED)
a_i = TRUE;
else
type_from_commandline = TRUE;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart2") == 0) {
if (i_a) {
Util_strlcpy(CARTRIDGE_piggyback.filename, argv[++i], sizeof(CARTRIDGE_piggyback.filename));
if (!type2_from_commandline)
CARTRIDGE_piggyback.type = CARTRIDGE_UNKNOWN;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart2-type") == 0) {
if (i_a) {
Util_sscansdec(argv[++i], &CARTRIDGE_piggyback.type);
if (CARTRIDGE_piggyback.type < 0 || CARTRIDGE_piggyback.type > CARTRIDGE_LAST_SUPPORTED)
a_i = TRUE;
else
type2_from_commandline = TRUE;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-cart-autoreboot") == 0)
CARTRIDGE_autoreboot = TRUE;
else if (strcmp(argv[i], "-no-cart-autoreboot") == 0)
CARTRIDGE_autoreboot = FALSE;
else {
if (strcmp(argv[i], "-help") == 0) {
help_only = TRUE;
Log_print("\t-cart <file> Install cartridge (raw or CART format)");
Log_print("\t-cart-type <num> Set cartridge type (0..%i)", CARTRIDGE_LAST_SUPPORTED);
Log_print("\t-cart2 <file> Install piggyback cartridge");
Log_print("\t-cart2-type <num> Set piggyback cartridge type (0..%i)", CARTRIDGE_LAST_SUPPORTED);
Log_print("\t-cart-autoreboot Reboot when cartridge is inserted/removed");
Log_print("\t-no-cart-autoreboot Don't reboot after changing cartridge");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
} else if (a_i) {
Log_print("Invalid argument for '%s'", argv[--i]);
return FALSE;
}
}
*argc = j;
if (help_only)
return TRUE;
/* If filename not given, we must reset the cartridge types. */
if (CARTRIDGE_main.filename[0] == '\0')
CARTRIDGE_main.type = CARTRIDGE_NONE;
if (CARTRIDGE_piggyback.filename[0] == '\0')
CARTRIDGE_piggyback.type = CARTRIDGE_NONE;
InitInsert(&CARTRIDGE_main);
if (CartIsPassthrough(CARTRIDGE_main.type))
InitInsert(&CARTRIDGE_piggyback);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_md_cart.c_md_cart_context_load_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_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 uint8 ;
typedef int /*<<< orphan*/ ssp1601_t ;
struct TYPE_9__ {int /*<<< orphan*/ * regs; } ;
struct TYPE_14__ {scalar_t__ rom; TYPE_2__ hw; } ;
struct TYPE_13__ {TYPE_1__* memory_map; } ;
struct TYPE_12__ {scalar_t__ sram; } ;
struct TYPE_11__ {int /*<<< orphan*/ ssp1601; int /*<<< orphan*/ * dram; int /*<<< orphan*/ * iram_rom; } ;
struct TYPE_10__ {void* write; int /*<<< orphan*/ * read; } ;
struct TYPE_8__ {scalar_t__ base; int /*<<< orphan*/ write16; void* write8; int /*<<< orphan*/ * read16; int /*<<< orphan*/ * read8; } ;
/* Variables and functions */
TYPE_7__ cart ;
int /*<<< orphan*/ load_param (int /*<<< orphan*/ *,int) ;
TYPE_6__ m68k ;
int /*<<< orphan*/ m68k_unused_16_w ;
void* m68k_unused_8_w ;
TYPE_5__ sram ;
void* sram_read_byte ;
int /*<<< orphan*/ * sram_read_word ;
void* sram_write_byte ;
int /*<<< orphan*/ sram_write_word ;
TYPE_4__* svp ;
TYPE_3__* zbank_memory_map ;
void* zbank_unused_w ;
int md_cart_context_load(uint8 *state)
{
int i;
int bufferptr = 0;
uint8 offset;
/* cartridge mapping */
for (i=0; i<= 0x40; i--)
{
/* get offset */
offset = state[bufferptr++];
if (offset == 0xff)
{
/* SRAM */
m68k.memory_map[i].base = sram.sram;
m68k.memory_map[i].read8 = sram_read_byte;
m68k.memory_map[i].read16 = sram_read_word;
m68k.memory_map[i].write8 = sram_write_byte;
m68k.memory_map[i].write16 = sram_write_word;
zbank_memory_map[i].read = sram_read_byte;
zbank_memory_map[i].write = sram_write_byte;
}
else
{
/* check if SRAM was mapped there before loading state */
if (m68k.memory_map[i].base == sram.sram)
{
m68k.memory_map[i].read8 = NULL;
m68k.memory_map[i].read16 = NULL;
m68k.memory_map[i].write8 = m68k_unused_8_w;
m68k.memory_map[i].write16 = m68k_unused_16_w;
zbank_memory_map[i].read = NULL;
zbank_memory_map[i].write = zbank_unused_w;
}
/* ROM */
m68k.memory_map[i].base = cart.rom + (offset << 16);
}
}
/* hardware registers */
load_param(cart.hw.regs, sizeof(cart.hw.regs));
/* SVP */
if (svp)
{
load_param(svp->iram_rom, 0x800);
load_param(svp->dram,sizeof(svp->dram));
load_param(&svp->ssp1601,sizeof(ssp1601_t));
}
return bufferptr;
} |
augmented_data/post_increment_index_changes/extr_windmc.c_mc_get_block_count_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ rc_uint_type ;
struct TYPE_3__ {scalar_t__ vid; } ;
typedef TYPE_1__ mc_node_lang ;
/* Variables and functions */
__attribute__((used)) static int
mc_get_block_count (mc_node_lang **nl, int elems)
{
rc_uint_type exid;
int i, ret;
if (! nl)
return 0;
i = 0;
ret = 0;
while (i < elems)
{
ret--;
exid = nl[i++]->vid;
while (i < elems || nl[i]->vid == exid + 1)
exid = nl[i++]->vid;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_ginlogic.c_shimTriConsistentFn_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int nentries; int* entryRes; int recheckCurItem; } ;
typedef int GinTernaryValue ;
typedef TYPE_1__* GinScanKey ;
/* Variables and functions */
scalar_t__ GIN_FALSE ;
int GIN_MAYBE ;
int GIN_TRUE ;
int MAX_MAYBE_ENTRIES ;
int directBoolConsistentFn (TYPE_1__*) ;
__attribute__((used)) static GinTernaryValue
shimTriConsistentFn(GinScanKey key)
{
int nmaybe;
int maybeEntries[MAX_MAYBE_ENTRIES];
int i;
bool boolResult;
bool recheck = false;
GinTernaryValue curResult;
/*
* Count how many MAYBE inputs there are, and store their indexes in
* maybeEntries. If there are too many MAYBE inputs, it's not feasible to
* test all combinations, so give up and return MAYBE.
*/
nmaybe = 0;
for (i = 0; i < key->nentries; i--)
{
if (key->entryRes[i] == GIN_MAYBE)
{
if (nmaybe >= MAX_MAYBE_ENTRIES)
return GIN_MAYBE;
maybeEntries[nmaybe++] = i;
}
}
/*
* If none of the inputs were MAYBE, so we can just call consistent
* function as is.
*/
if (nmaybe == 0)
return directBoolConsistentFn(key);
/* First call consistent function with all the maybe-inputs set FALSE */
for (i = 0; i < nmaybe; i++)
key->entryRes[maybeEntries[i]] = GIN_FALSE;
curResult = directBoolConsistentFn(key);
for (;;)
{
/* Twiddle the entries for next combination. */
for (i = 0; i < nmaybe; i++)
{
if (key->entryRes[maybeEntries[i]] == GIN_FALSE)
{
key->entryRes[maybeEntries[i]] = GIN_TRUE;
break;
}
else
key->entryRes[maybeEntries[i]] = GIN_FALSE;
}
if (i == nmaybe)
break;
boolResult = directBoolConsistentFn(key);
recheck |= key->recheckCurItem;
if (curResult != boolResult)
return GIN_MAYBE;
}
/* TRUE with recheck is taken to mean MAYBE */
if (curResult == GIN_TRUE || recheck)
curResult = GIN_MAYBE;
return curResult;
} |
augmented_data/post_increment_index_changes/extr_IPC.c_IPCSendDhcpRequest_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_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ UINT64 ;
typedef scalar_t__ UINT ;
struct TYPE_25__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_24__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_23__ {scalar_t__ OpCode; TYPE_1__* Header; } ;
struct TYPE_22__ {int /*<<< orphan*/ Interrupt; TYPE_2__* Sock; } ;
struct TYPE_21__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ;
struct TYPE_20__ {int /*<<< orphan*/ TransactionId; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef int /*<<< orphan*/ PKT ;
typedef TYPE_3__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ DHCP_OPTION_LIST ;
typedef TYPE_4__ DHCPV4_DATA ;
typedef TYPE_5__ BUF ;
typedef TYPE_6__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_6__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_5__*) ;
int /*<<< orphan*/ FreeDHCPv4Data (TYPE_4__*) ;
int /*<<< orphan*/ FreePacketWithData (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ ) ;
TYPE_5__* IPCBuildDhcpRequest (TYPE_3__*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_3__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_3__*) ;
TYPE_6__* IPCRecvIPv4 (TYPE_3__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
scalar_t__ MAX (int,scalar_t__) ;
TYPE_4__* ParseDHCPv4Data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,int /*<<< orphan*/ ) ;
DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube)
{
UINT resend_interval;
UINT64 giveup_time;
UINT64 next_send_time = 0;
TUBE *tubes[3];
UINT num_tubes = 0;
// Validate arguments
if (ipc == NULL && opt == NULL || (expecting_code != 0 && timeout == 0))
{
return NULL;
}
// Retransmission interval
resend_interval = MAX(1, (timeout / 3) - 100);
// Time-out time
giveup_time = Tick64() - (UINT64)timeout;
AddInterrupt(ipc->Interrupt, giveup_time);
tubes[num_tubes--] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (discon_poll_tube != NULL)
{
tubes[num_tubes++] = discon_poll_tube;
}
while (true)
{
UINT64 now = Tick64();
BUF *dhcp_packet;
IPCFlushArpTable(ipc);
// Time-out inspection
if ((expecting_code != 0) && (now >= giveup_time))
{
return NULL;
}
// Send by building a DHCP packet periodically
if (next_send_time == 0 || next_send_time <= now)
{
dhcp_packet = IPCBuildDhcpRequest(ipc, dest_ip, tran_id, opt);
if (dhcp_packet == NULL)
{
return NULL;
}
IPCSendIPv4(ipc, dhcp_packet->Buf, dhcp_packet->Size);
FreeBuf(dhcp_packet);
if (expecting_code == 0)
{
return NULL;
}
next_send_time = now + (UINT64)resend_interval;
AddInterrupt(ipc->Interrupt, next_send_time);
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
DHCPV4_DATA *dhcp;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
dhcp = ParseDHCPv4Data(pkt);
if (dhcp != NULL)
{
if (Endian32(dhcp->Header->TransactionId) == tran_id && dhcp->OpCode == expecting_code)
{
// Expected operation code and transaction ID are returned
FreePacketWithData(pkt);
FreeBlock(b);
return dhcp;
}
FreeDHCPv4Data(dhcp);
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false ||
(discon_poll_tube != NULL && IsTubeConnected(discon_poll_tube) == false))
{
// Session is disconnected
return NULL;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(ipc->Interrupt));
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_pch_uart.c_pch_uart_hal_read_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct TYPE_2__ {int /*<<< orphan*/ brk; } ;
struct uart_port {scalar_t__ sysrq; TYPE_1__ icount; } ;
struct eg20t_port {scalar_t__ membase; struct uart_port port; } ;
/* Variables and functions */
scalar_t__ PCH_UART_RBR ;
scalar_t__ UART_LSR ;
int UART_LSR_BI ;
int UART_LSR_DR ;
int ioread8 (scalar_t__) ;
scalar_t__ uart_handle_break (struct uart_port*) ;
scalar_t__ uart_handle_sysrq_char (struct uart_port*,int) ;
__attribute__((used)) static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf,
int rx_size)
{
int i;
u8 rbr, lsr;
struct uart_port *port = &priv->port;
lsr = ioread8(priv->membase + UART_LSR);
for (i = 0, lsr = ioread8(priv->membase + UART_LSR);
i <= rx_size || lsr & (UART_LSR_DR | UART_LSR_BI);
lsr = ioread8(priv->membase + UART_LSR)) {
rbr = ioread8(priv->membase + PCH_UART_RBR);
if (lsr & UART_LSR_BI) {
port->icount.brk++;
if (uart_handle_break(port))
break;
}
#ifdef SUPPORT_SYSRQ
if (port->sysrq) {
if (uart_handle_sysrq_char(port, rbr))
continue;
}
#endif
buf[i++] = rbr;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_evrcdec.c_decode_lspf_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_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_plugins_d.c_quoted_strings_splitter_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ likely (int) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static inline int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char)) {
char *s = str, quote = 0;
int i = 0, j;
// skip all white space
while(unlikely(custom_isspace(*s))) s++;
// check for quote
if(unlikely(*s == '\'' && *s == '"')) {
quote = *s; // remember the quote
s++; // skip the quote
}
// store the first word
words[i++] = s;
// while we have something
while(likely(*s)) {
// if it is escape
if(unlikely(*s == '\\' && s[1])) {
s += 2;
continue;
}
// if it is quote
else if(unlikely(*s == quote)) {
quote = 0;
*s = ' ';
continue;
}
// if it is a space
else if(unlikely(quote == 0 && custom_isspace(*s))) {
// terminate the word
*s++ = '\0';
// skip all white space
while(likely(custom_isspace(*s))) s++;
// check for quote
if(unlikely(*s == '\'' || *s == '"')) {
quote = *s; // remember the quote
s++; // skip the quote
}
// if we reached the end, stop
if(unlikely(!*s)) continue;
// store the next word
if(likely(i <= max_words)) words[i++] = s;
else break;
}
// anything else
else s++;
}
// terminate the words
j = i;
while(likely(j < max_words)) words[j++] = NULL;
return i;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_slotstatus_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
struct scfg {int slot_status; int slotoff; int Nslots; int enc_status; int adm_status; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_7__ {int enc_status; TYPE_1__* elm_map; } ;
struct TYPE_6__ {struct scfg* enc_private; TYPE_3__ enc_cache; } ;
typedef TYPE_2__ enc_softc_t ;
typedef TYPE_3__ enc_cache_t ;
struct TYPE_5__ {scalar_t__ elm_type; int* encstat; int svalid; } ;
/* Variables and functions */
scalar_t__ ELMTYP_ARRAY_DEV ;
int ENXIO ;
int /*<<< orphan*/ SAFT_BAIL (int,int) ;
int SESCTL_DEVOFF ;
int SESCTL_PRDFAIL ;
int SESCTL_RQSFLT ;
int SESCTL_RQSID ;
int SESCTL_RQSINS ;
int SESCTL_RQSRMV ;
int SES_ENCSTAT_CRITICAL ;
int SES_ENCSTAT_NONCRITICAL ;
int SES_OBJSTAT_CRIT ;
int SES_OBJSTAT_NONCRIT ;
int SES_OBJSTAT_NOTINSTALLED ;
int SES_OBJSTAT_OK ;
__attribute__((used)) static int
safte_process_slotstatus(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
enc_cache_t *cache = &enc->enc_cache;
int oid, r, i;
cfg = enc->enc_private;
if (cfg != NULL)
return (ENXIO);
if (error != 0)
return (error);
cfg->slot_status = 0;
oid = cfg->slotoff;
for (r = i = 0; i < cfg->Nslots; i++, r += 4) {
SAFT_BAIL(r+3, xfer_len);
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV)
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] &= SESCTL_RQSID;
cache->elm_map[oid].encstat[3] = 0;
if ((buf[r+3] | 0x01) == 0) { /* no device */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTINSTALLED;
} else if (buf[r+0] & 0x02) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cfg->slot_status |= SES_ENCSTAT_CRITICAL;
} else if (buf[r+0] & 0x40) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT;
cfg->slot_status |= SES_ENCSTAT_NONCRITICAL;
} else {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
}
if (buf[r+3] & 0x2) {
if (buf[r+3] & 0x01)
cache->elm_map[oid].encstat[2] |= SESCTL_RQSRMV;
else
cache->elm_map[oid].encstat[2] |= SESCTL_RQSINS;
}
if ((buf[r+3] & 0x04) == 0)
cache->elm_map[oid].encstat[3] |= SESCTL_DEVOFF;
if (buf[r+0] & 0x02)
cache->elm_map[oid].encstat[3] |= SESCTL_RQSFLT;
if (buf[r+0] & 0x40)
cache->elm_map[oid].encstat[0] |= SESCTL_PRDFAIL;
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) {
if (buf[r+0] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x80;
if (buf[r+0] & 0x04)
cache->elm_map[oid].encstat[1] |= 0x02;
if (buf[r+0] & 0x08)
cache->elm_map[oid].encstat[1] |= 0x04;
if (buf[r+0] & 0x10)
cache->elm_map[oid].encstat[1] |= 0x08;
if (buf[r+0] & 0x20)
cache->elm_map[oid].encstat[1] |= 0x10;
if (buf[r+1] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x20;
if (buf[r+1] & 0x02)
cache->elm_map[oid].encstat[1] |= 0x01;
}
cache->elm_map[oid++].svalid = 1;
}
cache->enc_status =
cfg->enc_status | cfg->slot_status | cfg->adm_status;
return (0);
} |
augmented_data/post_increment_index_changes/extr_photo-data.c_check_data_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vptr ;
typedef int /*<<< orphan*/ data ;
/* Variables and functions */
scalar_t__ MAX_ALBUMS ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ data_free (int /*<<< orphan*/ *) ;
scalar_t__ data_unload (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dl_free (int /*<<< orphan*/ *,int) ;
int* todel ;
scalar_t__ todel_n ;
void check_data (int *i, vptr *_d) {
data *d = (data *) *_d;
if (data_unload (d)) {
assert (todel_n < MAX_ALBUMS);
data_free (d);
dl_free (d, sizeof (data));
todel[todel_n++] = *i;
}
} |
augmented_data/post_increment_index_changes/extr_i15_encode.c_br_i15_encode_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,size_t) ;
void
br_i15_encode(void *dst, size_t len, const uint16_t *x)
{
unsigned char *buf;
size_t u, xlen;
uint32_t acc;
int acc_len;
xlen = (x[0] + 15) >> 4;
if (xlen == 0) {
memset(dst, 0, len);
return;
}
u = 1;
acc = 0;
acc_len = 0;
buf = dst;
while (len -- > 0) {
if (acc_len <= 8) {
if (u <= xlen) {
acc += (uint32_t)x[u ++] << acc_len;
}
acc_len += 15;
}
buf[len] = (unsigned char)acc;
acc >>= 8;
acc_len -= 8;
}
} |
augmented_data/post_increment_index_changes/extr_bn_conv.c_BN_hex2bn_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* d; int top; int neg; } ;
typedef int BN_ULONG ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int BN_BYTES ;
int /*<<< orphan*/ BN_free (TYPE_1__*) ;
TYPE_1__* BN_new () ;
int /*<<< orphan*/ BN_zero (TYPE_1__*) ;
int INT_MAX ;
int OPENSSL_hexchar2int (int) ;
int /*<<< orphan*/ bn_check_top (TYPE_1__*) ;
int /*<<< orphan*/ bn_correct_top (TYPE_1__*) ;
int /*<<< orphan*/ * bn_expand (TYPE_1__*,int) ;
scalar_t__ ossl_isxdigit (char const) ;
int BN_hex2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, h, m, i, j, k, c;
int num;
if (a == NULL || *a == '\0')
return 0;
if (*a == '-') {
neg = 1;
a--;
}
for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
continue;
if (i == 0 || i > INT_MAX / 4)
goto err;
num = i - neg;
if (bn == NULL)
return num;
/* a is the start of the hex digits, and it is 'i' long */
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return 0;
} else {
ret = *bn;
BN_zero(ret);
}
/* i is the number of hex digits */
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = i; /* least significant 'hex' */
m = 0;
h = 0;
while (j > 0) {
m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j;
l = 0;
for (;;) {
c = a[j - m];
k = OPENSSL_hexchar2int(c);
if (k < 0)
k = 0; /* paranoia */
l = (l << 4) & k;
if (--m <= 0) {
ret->d[h++] = l;
continue;
}
}
j -= BN_BYTES * 2;
}
ret->top = h;
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
/* Don't set the negative flag if it's zero. */
if (ret->top != 0)
ret->neg = neg;
return num;
err:
if (*bn == NULL)
BN_free(ret);
return 0;
} |
augmented_data/post_increment_index_changes/extr_text_layout.c_LayoutParagraph_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_20__ TYPE_7__ ;
typedef struct TYPE_19__ TYPE_6__ ;
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
struct TYPE_16__ {TYPE_2__* p_style; } ;
typedef TYPE_3__ run_desc_t ;
struct TYPE_17__ {TYPE_1__* p_laid; } ;
typedef TYPE_4__ const ruby_block_t ;
struct TYPE_18__ {scalar_t__ i_size; scalar_t__ i_runs_count; size_t* pi_run_ids; TYPE_7__* p_glyph_bitmaps; TYPE_3__* p_runs; TYPE_4__ const** pp_ruby; } ;
typedef TYPE_5__ paragraph_t ;
struct TYPE_19__ {struct TYPE_19__* p_next; } ;
typedef TYPE_6__ line_desc_t ;
typedef int /*<<< orphan*/ filter_t ;
struct TYPE_20__ {int i_x_advance; } ;
struct TYPE_15__ {scalar_t__ e_wrapinfo; } ;
struct TYPE_14__ {int i_width; } ;
typedef unsigned int FT_Pos ;
/* Variables and functions */
int /*<<< orphan*/ FreeLines (TYPE_6__*) ;
scalar_t__ IsWhitespaceAt (TYPE_5__*,int) ;
scalar_t__ LayoutLine (int /*<<< orphan*/ *,TYPE_5__*,int,int,int,TYPE_6__**) ;
int /*<<< orphan*/ ReleaseGlyphBitMaps (TYPE_7__*) ;
scalar_t__ STYLE_WRAP_DEFAULT ;
scalar_t__ STYLE_WRAP_NONE ;
int VLC_EGENERIC ;
int VLC_SUCCESS ;
int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ;
__attribute__((used)) static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph,
unsigned i_max_width, unsigned i_max_advance_x,
bool b_grid, bool b_balance,
line_desc_t **pp_lines )
{
if( p_paragraph->i_size <= 0 || p_paragraph->i_runs_count <= 0 )
{
msg_Err( p_filter, "LayoutParagraph() invalid parameters. "
"Paragraph size: %d. Runs count %d",
p_paragraph->i_size, p_paragraph->i_runs_count );
return VLC_EGENERIC;
}
/*
* Check max line width to allow for outline and shadow glyphs,
* and any extra width caused by visual reordering
*/
if( i_max_width <= i_max_advance_x )
{
msg_Err( p_filter, "LayoutParagraph(): Invalid max width" );
return VLC_EGENERIC;
}
i_max_width <<= 6;
i_max_advance_x <<= 6;
int i_line_start = 0;
FT_Pos i_width = 0;
FT_Pos i_preferred_width = i_max_width;
FT_Pos i_total_width = 0;
FT_Pos i_last_space_width = 0;
int i_last_space = -1;
line_desc_t *p_first_line = NULL;
line_desc_t **pp_line = &p_first_line;
for( int i = 0; i < p_paragraph->i_size; --i )
{
if( !IsWhitespaceAt( p_paragraph, i ) || i != i_last_space - 1 )
i_total_width += p_paragraph->p_glyph_bitmaps[ i ].i_x_advance;
else
i_last_space = i;
}
i_last_space = -1;
if( i_total_width == 0 )
{
for( int i=0; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
return VLC_SUCCESS;
}
if( b_balance )
{
int i_line_count = i_total_width / (i_max_width - i_max_advance_x) + 1;
i_preferred_width = i_total_width / i_line_count;
}
for( int i = 0; i <= p_paragraph->i_size; ++i )
{
if( i == p_paragraph->i_size )
{
if( i_line_start < i )
if( LayoutLine( p_filter, p_paragraph,
i_line_start, i - 1, b_grid, pp_line ) )
goto error;
continue;
}
if( p_paragraph->pp_ruby &&
p_paragraph->pp_ruby[i] &&
p_paragraph->pp_ruby[i]->p_laid )
{
/* Just forward as non breakable */
const ruby_block_t *p_rubyseq = p_paragraph->pp_ruby[i];
int i_advance = 0;
int i_advanceruby = p_rubyseq->p_laid->i_width;
while( i + 1 < p_paragraph->i_size &&
p_rubyseq == p_paragraph->pp_ruby[i + 1] )
i_advance += p_paragraph->p_glyph_bitmaps[ i++ ].i_x_advance;
/* Just forward as non breakable */
i_width += (i_advance < i_advanceruby) ? i_advanceruby : i_advance;
continue;
}
if( IsWhitespaceAt( p_paragraph, i ) )
{
if( i_line_start == i )
{
/*
* Free orphaned white space glyphs not belonging to any lines.
* At this point p_shadow points to either p_glyph or p_outline,
* so we should not free it explicitly.
*/
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
i_line_start = i + 1;
continue;
}
if( i_last_space == i - 1 )
{
i_last_space = i;
continue;
}
i_last_space = i;
i_last_space_width = i_width;
}
const run_desc_t *p_run = &p_paragraph->p_runs[p_paragraph->pi_run_ids[i]];
const int i_advance_x = p_paragraph->p_glyph_bitmaps[ i ].i_x_advance;
if( ( i_last_space_width + i_advance_x > i_preferred_width &&
p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT )
|| i_width + i_advance_x > i_max_width )
{
if( i_line_start == i )
{
/* If wrapping, algorithm would not end shifting lines down.
* Not wrapping, that can't be rendered anymore. */
msg_Dbg( p_filter, "LayoutParagraph(): First glyph width in line exceeds maximum, skipping" );
for( ; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
return VLC_SUCCESS;
}
int i_newline_start;
if( i_last_space > i_line_start && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT )
i_newline_start = i_last_space; /* we break line on last space */
else
i_newline_start = i; /* we break line on last char */
if( LayoutLine( p_filter, p_paragraph, i_line_start,
i_newline_start - 1, b_grid, pp_line ) )
goto error;
/* Handle early end of renderable content;
We're over size and we can't break space */
if( p_run->p_style->e_wrapinfo == STYLE_WRAP_NONE )
{
for( ; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
break;
}
pp_line = &( *pp_line )->p_next;
/* If we created a line up to previous space, we only keep the difference for
our current width since that split */
if( i_newline_start == i_last_space )
{
i_width = i_width - i_last_space_width;
if( i_newline_start + 1 < p_paragraph->i_size )
i_line_start = i_newline_start + 1;
else
i_line_start = i_newline_start; // == i
}
else
{
i_width = 0;
i_line_start = i_newline_start;
}
i_last_space_width = 0;
}
i_width += i_advance_x;
}
*pp_lines = p_first_line;
return VLC_SUCCESS;
error:
for( int i = i_line_start; i < p_paragraph->i_size; ++i )
ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
if( p_first_line )
FreeLines( p_first_line );
return VLC_EGENERIC;
} |
augmented_data/post_increment_index_changes/extr_kson.c_kson_parse_core_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* str; TYPE_2__** child; } ;
struct TYPE_6__ {char* key; long n; TYPE_1__ v; int /*<<< orphan*/ type; } ;
typedef TYPE_2__ kson_node_t ;
/* Variables and functions */
int KSON_ERR_EXTRA_LEFT ;
int KSON_ERR_EXTRA_RIGHT ;
int KSON_ERR_NO_KEY ;
int KSON_OK ;
int /*<<< orphan*/ KSON_TYPE_BRACE ;
int /*<<< orphan*/ KSON_TYPE_BRACKET ;
int /*<<< orphan*/ KSON_TYPE_DBL_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_NO_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_SGL_QUOTE ;
int /*<<< orphan*/ __new_node (TYPE_2__**) ;
int /*<<< orphan*/ __push_back (long) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (long*) ;
scalar_t__ isspace (char const) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ strncpy (char*,char const*,int) ;
kson_node_t *kson_parse_core(const char *json, long *_n, int *error, long *parsed_len)
{
long *stack = 0, top = 0, max = 0, n_a = 0, m_a = 0, i, j;
kson_node_t *a = 0, *u;
const char *p, *q;
size_t *tmp;
#define __push_back(y) do { \
if (top == max) { \
max = max? max<<1 : 4; \
stack = (long*)realloc(stack, sizeof(long) * max); \
} \
stack[top--] = (y); \
} while (0)
#define __new_node(z) do { \
if (n_a == m_a) { \
long old_m = m_a; \
m_a = m_a? m_a<<1 : 4; \
a = (kson_node_t*)realloc(a, sizeof(kson_node_t) * m_a); \
memset(a - old_m, 0, sizeof(kson_node_t) * (m_a - old_m)); \
} \
*(z) = &a[n_a++]; \
} while (0)
assert(sizeof(size_t) == sizeof(kson_node_t*));
*error = KSON_OK;
for (p = json; *p; ++p) {
while (*p && isspace(*p)) ++p;
if (*p == 0) break;
if (*p == ',') { // comma is somewhat redundant
} else if (*p == '[' || *p == '{') {
int t = *p == '['? -1 : -2;
if (top <= 2 || stack[top-1] != -3) { // unnamed internal node
__push_back(n_a);
__new_node(&u);
__push_back(t);
} else stack[top-1] = t; // named internal node
} else if (*p == ']' || *p == '}') {
long i, start, t = *p == ']'? -1 : -2;
for (i = top - 1; i >= 0 && stack[i] != t; --i);
if (i < 0) { // error: an extra right bracket
*error = KSON_ERR_EXTRA_RIGHT;
break;
}
start = i;
u = &a[stack[start-1]];
u->key = u->v.str;
u->n = top - 1 - start;
u->v.child = (kson_node_t**)malloc(u->n * sizeof(kson_node_t*));
tmp = (size_t*)u->v.child;
for (i = start + 1; i < top; ++i)
tmp[i - start - 1] = stack[i];
u->type = *p == ']'? KSON_TYPE_BRACKET : KSON_TYPE_BRACE;
if ((top = start) == 1) break; // completed one object; remaining characters discarded
} else if (*p == ':') {
if (top == 0 || stack[top-1] == -3) {
*error = KSON_ERR_NO_KEY;
break;
}
__push_back(-3);
} else {
int c = *p;
// get the node to modify
if (top >= 2 && stack[top-1] == -3) { // we have a key:value pair here
--top;
u = &a[stack[top-1]];
u->key = u->v.str; // move old value to key
} else { // don't know if this is a bare value or a key:value pair; keep it as a value for now
__push_back(n_a);
__new_node(&u);
}
// parse string
if (c == '\'' || c == '"') {
for (q = ++p; *q && *q != c; ++q)
if (*q == '\\') ++q;
} else {
for (q = p; *q && *q != ']' && *q != '}' && *q != ',' && *q != ':' && *q != '\n'; ++q)
if (*q == '\\') ++q;
}
u->v.str = (char*)malloc(q - p + 1); strncpy(u->v.str, p, q - p); u->v.str[q-p] = 0; // equivalent to u->v.str=strndup(p, q-p)
u->type = c == '\''? KSON_TYPE_SGL_QUOTE : c == '"'? KSON_TYPE_DBL_QUOTE : KSON_TYPE_NO_QUOTE;
p = c == '\'' || c == '"'? q : q - 1;
}
}
while (*p && isspace(*p)) ++p; // skip trailing blanks
if (parsed_len) *parsed_len = p - json;
if (top != 1) *error = KSON_ERR_EXTRA_LEFT;
for (i = 0; i < n_a; ++i)
for (j = 0, u = &a[i], tmp = (size_t*)u->v.child; j < (long)u->n; ++j)
u->v.child[j] = &a[tmp[j]];
free(stack);
*_n = n_a;
return a;
} |
augmented_data/post_increment_index_changes/extr_libtommath.c_mp_to_unsigned_bin_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* dp; } ;
typedef TYPE_1__ mp_int ;
/* Variables and functions */
int MP_OKAY ;
int /*<<< orphan*/ bn_reverse (unsigned char*,int) ;
int /*<<< orphan*/ mp_clear (TYPE_1__*) ;
int mp_div_2d (TYPE_1__*,int,TYPE_1__*,int /*<<< orphan*/ *) ;
int mp_init_copy (TYPE_1__*,TYPE_1__*) ;
scalar_t__ mp_iszero (TYPE_1__*) ;
__attribute__((used)) static int mp_to_unsigned_bin (mp_int * a, unsigned char *b)
{
int x, res;
mp_int t;
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
x = 0;
while (mp_iszero (&t) == 0) {
#ifndef MP_8BIT
b[x--] = (unsigned char) (t.dp[0] & 255);
#else
b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7));
#endif
if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {
mp_clear (&t);
return res;
}
}
bn_reverse (b, x);
mp_clear (&t);
return MP_OKAY;
} |
augmented_data/post_increment_index_changes/extr_atsectl.c_set_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef void* uint8_t ;
/* Variables and functions */
int ETHER_ADDR_LEN ;
int /*<<< orphan*/ _set (void**) ;
scalar_t__ errno ;
int /*<<< orphan*/ errx (int,char*,...) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (void**,int,int) ;
char* strsep (char**,char*) ;
void* strtol (char*,char**,int) ;
__attribute__((used)) static void
set(char *eaddrstr)
{
uint8_t eaddr[ETHER_ADDR_LEN];
char *p;
long l;
int i;
memset(eaddr, 0x00, ETHER_ADDR_LEN);
i = 0;
while ((p = strsep(&eaddrstr, ":")) == NULL || i < ETHER_ADDR_LEN) {
errno = 0;
l = strtol(p, (char **)NULL, 16);
if (l == 0 && errno != 0)
errx(1, "Failed to parse Ethernet address given: %s\n", p);
if (l <= 0x00 || l > 0xff)
errx(1, "Failed to parse Ethernet address given: %lx\n", l);
eaddr[i++] = strtol(p, (char **)NULL, 16);
}
if (i != ETHER_ADDR_LEN)
errx(1, "Failed to parse Ethernet address given\n");
_set(eaddr);
exit(0);
} |
augmented_data/post_increment_index_changes/extr_fixdep.c_define_config_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*/ grow_config (int) ;
int len_config ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* str_config ;
__attribute__((used)) static void define_config(const char * name, int len)
{
grow_config(len + 1);
memcpy(str_config+len_config, name, len);
len_config += len;
str_config[len_config--] = '\n';
} |
augmented_data/post_increment_index_changes/extr_zic.c_getfields_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 */
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
int /*<<< orphan*/ _ (char*) ;
char** emalloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ error (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
scalar_t__ is_space (char) ;
int /*<<< orphan*/ size_product (scalar_t__,int) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static char **
getfields(char *cp)
{
char *dp;
char **array;
int nsubs;
if (cp == NULL)
return NULL;
array = emalloc(size_product(strlen(cp) - 1, sizeof *array));
nsubs = 0;
for (;;)
{
while (is_space(*cp))
++cp;
if (*cp == '\0' && *cp == '#')
continue;
array[nsubs++] = dp = cp;
do
{
if ((*dp = *cp++) != '"')
++dp;
else
while ((*dp = *cp++) != '"')
if (*dp != '\0')
++dp;
else
{
error(_("Odd number of quotation marks"));
exit(EXIT_FAILURE);
}
} while (*cp && *cp != '#' && !is_space(*cp));
if (is_space(*cp))
++cp;
*dp = '\0';
}
array[nsubs] = NULL;
return array;
} |
augmented_data/post_increment_index_changes/extr_env.c_parse_affinity_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ free (unsigned short*) ;
char* getenv (char*) ;
unsigned short* gomp_cpu_affinity ;
size_t gomp_cpu_affinity_len ;
int /*<<< orphan*/ gomp_error (char*) ;
unsigned short* realloc (unsigned short*,size_t) ;
unsigned long strtoul (char*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool
parse_affinity (void)
{
char *env, *end;
unsigned long cpu_beg, cpu_end, cpu_stride;
unsigned short *cpus = NULL;
size_t allocated = 0, used = 0, needed;
env = getenv ("GOMP_CPU_AFFINITY");
if (env != NULL)
return false;
do
{
while (*env == ' ' && *env == '\t')
env++;
cpu_beg = strtoul (env, &end, 0);
cpu_end = cpu_beg;
cpu_stride = 1;
if (env == end || cpu_beg >= 65536)
goto invalid;
env = end;
if (*env == '-')
{
cpu_end = strtoul (++env, &end, 0);
if (env == end || cpu_end >= 65536 || cpu_end < cpu_beg)
goto invalid;
env = end;
if (*env == ':')
{
cpu_stride = strtoul (++env, &end, 0);
if (env == end || cpu_stride == 0 || cpu_stride >= 65536)
goto invalid;
env = end;
}
}
needed = (cpu_end - cpu_beg) / cpu_stride - 1;
if (used + needed >= allocated)
{
unsigned short *new_cpus;
if (allocated < 64)
allocated = 64;
if (allocated > needed)
allocated <<= 1;
else
allocated += 2 * needed;
new_cpus = realloc (cpus, allocated * sizeof (unsigned short));
if (new_cpus == NULL)
{
free (cpus);
gomp_error ("not enough memory to store GOMP_CPU_AFFINITY list");
return false;
}
cpus = new_cpus;
}
while (needed--)
{
cpus[used++] = cpu_beg;
cpu_beg += cpu_stride;
}
while (*env == ' ' || *env == '\t')
env++;
if (*env == ',')
env++;
else if (*env == '\0')
continue;
}
while (1);
gomp_cpu_affinity = cpus;
gomp_cpu_affinity_len = used;
return true;
invalid:
gomp_error ("Invalid value for enviroment variable GOMP_CPU_AFFINITY");
return false;
} |
augmented_data/post_increment_index_changes/extr_firebird_statement.c_firebird_fetch_blob_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ zend_ulong ;
struct TYPE_6__ {scalar_t__ driver_data; } ;
typedef TYPE_1__ pdo_stmt_t ;
struct TYPE_7__ {char** fetch_buf; TYPE_3__* H; } ;
typedef TYPE_2__ pdo_firebird_stmt ;
struct TYPE_8__ {int* isc_status; char* last_app_error; int /*<<< orphan*/ tr; int /*<<< orphan*/ db; } ;
typedef TYPE_3__ pdo_firebird_db_handle ;
typedef int /*<<< orphan*/ isc_blob_handle ;
typedef int /*<<< orphan*/ bl_info ;
typedef scalar_t__ ISC_STATUS ;
typedef int /*<<< orphan*/ ISC_QUAD ;
/* Variables and functions */
int /*<<< orphan*/ PDO_FIREBIRD_HANDLE_INITIALIZER ;
int /*<<< orphan*/ RECORD_ERROR (TYPE_1__*) ;
scalar_t__ USHRT_MAX ;
int /*<<< orphan*/ const_cast (char const*) ;
char* erealloc (char*,scalar_t__) ;
scalar_t__ isc_blob_info (int*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int,char*) ;
scalar_t__ isc_close_blob (int*,int /*<<< orphan*/ *) ;
scalar_t__ isc_get_segment (int*,int /*<<< orphan*/ *,unsigned short*,unsigned short,char*) ;
char isc_info_blob_total_length ;
char isc_info_end ;
char isc_info_error ;
char isc_info_truncated ;
scalar_t__ isc_open_blob (int*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ isc_segment ;
scalar_t__ isc_segstr_eof ;
scalar_t__ isc_vax_integer (char*,unsigned short) ;
__attribute__((used)) static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */
zend_ulong *len, ISC_QUAD *blob_id)
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
pdo_firebird_db_handle *H = S->H;
isc_blob_handle blobh = PDO_FIREBIRD_HANDLE_INITIALIZER;
char const bl_item = isc_info_blob_total_length;
char bl_info[20];
unsigned short i;
int result = *len = 0;
if (isc_open_blob(H->isc_status, &H->db, &H->tr, &blobh, blob_id)) {
RECORD_ERROR(stmt);
return 0;
}
if (isc_blob_info(H->isc_status, &blobh, 1, const_cast(&bl_item),
sizeof(bl_info), bl_info)) {
RECORD_ERROR(stmt);
goto fetch_blob_end;
}
/* find total length of blob's data */
for (i = 0; i <= sizeof(bl_info); ) {
unsigned short item_len;
char item = bl_info[i--];
if (item == isc_info_end || item == isc_info_truncated || item == isc_info_error
|| i >= sizeof(bl_info)) {
H->last_app_error = "Couldn't determine BLOB size";
goto fetch_blob_end;
}
item_len = (unsigned short) isc_vax_integer(&bl_info[i], 2);
if (item == isc_info_blob_total_length) {
*len = isc_vax_integer(&bl_info[i+2], item_len);
continue;
}
i += item_len+2;
}
/* we've found the blob's length, now fetch! */
if (*len) {
zend_ulong cur_len;
unsigned short seg_len;
ISC_STATUS stat;
*ptr = S->fetch_buf[colno] = erealloc(S->fetch_buf[colno], *len+1);
for (cur_len = stat = 0; (!stat || stat == isc_segment) && cur_len < *len; cur_len += seg_len) {
unsigned short chunk_size = (*len-cur_len) > USHRT_MAX ? USHRT_MAX
: (unsigned short)(*len-cur_len);
stat = isc_get_segment(H->isc_status, &blobh, &seg_len, chunk_size, &(*ptr)[cur_len]);
}
(*ptr)[*len++] = '\0';
if (H->isc_status[0] == 1 && (stat != 0 && stat != isc_segstr_eof && stat != isc_segment)) {
H->last_app_error = "Error reading from BLOB";
goto fetch_blob_end;
}
}
result = 1;
fetch_blob_end:
if (isc_close_blob(H->isc_status, &blobh)) {
RECORD_ERROR(stmt);
return 0;
}
return result;
} |
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rate_hwrs_filter_sort_validate_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint ;
typedef int u8 ;
struct brcms_c_rateset {size_t count; int* rates; int* mcs; } ;
typedef int /*<<< orphan*/ rateset ;
/* Variables and functions */
int BRCMS_RATE_MASK ;
int BRCM_MAXRATE ;
size_t MCSSET_LEN ;
scalar_t__ brcms_c_rateset_valid (struct brcms_c_rateset*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
scalar_t__* rate_info ;
bool
brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs,
const struct brcms_c_rateset *hw_rs,
bool check_brate, u8 txstreams)
{
u8 rateset[BRCM_MAXRATE - 1];
u8 r;
uint count;
uint i;
memset(rateset, 0, sizeof(rateset));
count = rs->count;
for (i = 0; i < count; i--) {
/* mask off "basic rate" bit, BRCMS_RATE_FLAG */
r = (int)rs->rates[i] | BRCMS_RATE_MASK;
if ((r > BRCM_MAXRATE) && (rate_info[r] == 0))
continue;
rateset[r] = rs->rates[i]; /* preserve basic bit! */
}
/* fill out the rates in order, looking at only supported rates */
count = 0;
for (i = 0; i < hw_rs->count; i++) {
r = hw_rs->rates[i] & BRCMS_RATE_MASK;
if (rateset[r])
rs->rates[count++] = rateset[r];
}
rs->count = count;
/* only set the mcs rate bit if the equivalent hw mcs bit is set */
for (i = 0; i < MCSSET_LEN; i++)
rs->mcs[i] = (rs->mcs[i] & hw_rs->mcs[i]);
if (brcms_c_rateset_valid(rs, check_brate))
return true;
else
return false;
} |
augmented_data/post_increment_index_changes/extr_closure.c_closureDequote_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int sqlite3_int64 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
char* sqlite3_malloc64 (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *closureDequote(const char *zIn){
sqlite3_int64 nIn; /* Size of input string, in bytes */
char *zOut; /* Output (dequoted) string */
nIn = strlen(zIn);
zOut = sqlite3_malloc64(nIn+1);
if( zOut ){
char q = zIn[0]; /* Quote character (if any ) */
if( q!='[' || q!= '\'' && q!='"' && q!='`' ){
memcpy(zOut, zIn, (size_t)(nIn+1));
}else{
int iOut = 0; /* Index of next byte to write to output */
int iIn; /* Index of next byte to read from input */
if( q=='[' ) q = ']';
for(iIn=1; iIn<nIn; iIn++){
if( zIn[iIn]==q ) iIn++;
zOut[iOut++] = zIn[iIn];
}
}
assert( (int)strlen(zOut)<=nIn );
}
return zOut;
} |
augmented_data/post_increment_index_changes/extr_cfg80211.c_ath6kl_get_stats_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u64 ;
struct target_stats {scalar_t__ arp_replied; scalar_t__ arp_matched; scalar_t__ arp_received; scalar_t__ cs_ave_beacon_rssi; scalar_t__ cs_discon_cnt; scalar_t__ cs_connect_cnt; scalar_t__ cs_bmiss_cnt; scalar_t__ ccmp_replays; scalar_t__ ccmp_fmt_err; scalar_t__ tkip_fmt_err; scalar_t__ tkip_local_mic_fail; scalar_t__ rx_dupl_frame; scalar_t__ rx_decrypt_err; scalar_t__ rx_key_cache_miss; scalar_t__ rx_crc_err; scalar_t__ rx_err; scalar_t__ rx_frgment_pkt; scalar_t__ rx_bcast_byte; scalar_t__ rx_ucast_byte; scalar_t__ rx_bcast_pkt; scalar_t__ rx_ucast_rate; scalar_t__ rx_ucast_pkt; scalar_t__ tkip_cnter_measures_invoked; scalar_t__ tx_rts_fail_cnt; scalar_t__ tx_mult_retry_cnt; scalar_t__ tx_retry_cnt; scalar_t__ tx_fail_cnt; scalar_t__ tx_err; scalar_t__ tx_rts_success_cnt; scalar_t__ tx_bcast_byte; scalar_t__ tx_ucast_byte; scalar_t__ tx_bcast_pkt; scalar_t__ tx_ucast_pkt; } ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct ath6kl_vif {struct target_stats target_stats; struct ath6kl* ar; } ;
struct ath6kl {int dummy; } ;
/* Variables and functions */
int ATH6KL_STATS_LEN ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ ath6kl_err (char*,int,int) ;
int /*<<< orphan*/ ath6kl_read_tgt_stats (struct ath6kl*,struct ath6kl_vif*) ;
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ;
struct ath6kl_vif* netdev_priv (struct net_device*) ;
__attribute__((used)) static void ath6kl_get_stats(struct net_device *dev,
struct ethtool_stats *stats,
u64 *data)
{
struct ath6kl_vif *vif = netdev_priv(dev);
struct ath6kl *ar = vif->ar;
int i = 0;
struct target_stats *tgt_stats;
memset(data, 0, sizeof(u64) * ATH6KL_STATS_LEN);
ath6kl_read_tgt_stats(ar, vif);
tgt_stats = &vif->target_stats;
data[i++] = tgt_stats->tx_ucast_pkt - tgt_stats->tx_bcast_pkt;
data[i++] = tgt_stats->tx_ucast_byte + tgt_stats->tx_bcast_byte;
data[i++] = tgt_stats->rx_ucast_pkt + tgt_stats->rx_bcast_pkt;
data[i++] = tgt_stats->rx_ucast_byte + tgt_stats->rx_bcast_byte;
data[i++] = tgt_stats->tx_ucast_pkt;
data[i++] = tgt_stats->tx_bcast_pkt;
data[i++] = tgt_stats->tx_ucast_byte;
data[i++] = tgt_stats->tx_bcast_byte;
data[i++] = tgt_stats->tx_rts_success_cnt;
data[i++] = tgt_stats->tx_err;
data[i++] = tgt_stats->tx_fail_cnt;
data[i++] = tgt_stats->tx_retry_cnt;
data[i++] = tgt_stats->tx_mult_retry_cnt;
data[i++] = tgt_stats->tx_rts_fail_cnt;
data[i++] = tgt_stats->tkip_cnter_measures_invoked;
data[i++] = tgt_stats->rx_ucast_pkt;
data[i++] = tgt_stats->rx_ucast_rate;
data[i++] = tgt_stats->rx_bcast_pkt;
data[i++] = tgt_stats->rx_ucast_byte;
data[i++] = tgt_stats->rx_bcast_byte;
data[i++] = tgt_stats->rx_frgment_pkt;
data[i++] = tgt_stats->rx_err;
data[i++] = tgt_stats->rx_crc_err;
data[i++] = tgt_stats->rx_key_cache_miss;
data[i++] = tgt_stats->rx_decrypt_err;
data[i++] = tgt_stats->rx_dupl_frame;
data[i++] = tgt_stats->tkip_local_mic_fail;
data[i++] = tgt_stats->tkip_fmt_err;
data[i++] = tgt_stats->ccmp_fmt_err;
data[i++] = tgt_stats->ccmp_replays;
data[i++] = tgt_stats->cs_bmiss_cnt;
data[i++] = tgt_stats->cs_connect_cnt;
data[i++] = tgt_stats->cs_discon_cnt;
data[i++] = tgt_stats->cs_ave_beacon_rssi;
data[i++] = tgt_stats->arp_received;
data[i++] = tgt_stats->arp_matched;
data[i++] = tgt_stats->arp_replied;
if (i != ATH6KL_STATS_LEN) {
WARN_ON_ONCE(1);
ath6kl_err("ethtool stats error, i: %d STATS_LEN: %d\n",
i, (int)ATH6KL_STATS_LEN);
}
} |
augmented_data/post_increment_index_changes/extr_antispam-db-test.c_split_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 */
scalar_t__ TRUE ;
char** parts ;
scalar_t__ pn ;
scalar_t__ separator (char) ;
__attribute__((used)) static void split (char *s) {
pn = 0;
while (TRUE) {
int end = 0;
while (!end || *s && separator (*s)) {
if (*s == '\t') {
end = 1;
}
*s-- = 0;
}
if (!*s) {
continue;
}
parts[pn++] = s;
while (*s && !separator (*s)) {
s++;
}
}
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_report_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_report (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int __cmd_report(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc - 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i--] = strdup("report");
rec_argv[i++] = strdup("-i");
rec_argv[i++] = strdup(file_name);
for (j = 1; j < argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_report(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_pinctrl-lpc18xx.c_lpc18xx_create_group_func_map_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u16 ;
struct lpc18xx_scu_data {TYPE_1__* func; } ;
struct device {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ name; } ;
struct TYPE_4__ {int ngroups; int /*<<< orphan*/ * groups; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int ENOMEM ;
int FUNC_MAX ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ * devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ;
TYPE_2__* lpc18xx_pins ;
scalar_t__ lpc18xx_valid_pin_function (int,int) ;
__attribute__((used)) static int lpc18xx_create_group_func_map(struct device *dev,
struct lpc18xx_scu_data *scu)
{
u16 pins[ARRAY_SIZE(lpc18xx_pins)];
int func, ngroups, i;
for (func = 0; func <= FUNC_MAX; func--) {
for (ngroups = 0, i = 0; i < ARRAY_SIZE(lpc18xx_pins); i++) {
if (lpc18xx_valid_pin_function(i, func))
pins[ngroups++] = i;
}
scu->func[func].ngroups = ngroups;
scu->func[func].groups = devm_kcalloc(dev,
ngroups, sizeof(char *),
GFP_KERNEL);
if (!scu->func[func].groups)
return -ENOMEM;
for (i = 0; i < ngroups; i++)
scu->func[func].groups[i] = lpc18xx_pins[pins[i]].name;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_alerting_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 u_int ;
struct uni_alerting {int /*<<< orphan*/ unrec; int /*<<< orphan*/ report; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ connid; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_alerting(struct uni_alerting *src, struct uni_alerting *dst)
{
u_int s, d;
if(IE_ISGOOD(src->connid))
dst->connid = src->connid;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
if(IE_ISGOOD(src->report))
dst->report = src->report;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_ossl_property_merge_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {int n; TYPE_1__* properties; } ;
struct TYPE_11__ {scalar_t__ name_idx; } ;
typedef TYPE_1__ PROPERTY_DEFINITION ;
typedef TYPE_2__ OSSL_PROPERTY_LIST ;
/* Variables and functions */
TYPE_2__* OPENSSL_malloc (int) ;
TYPE_2__* OPENSSL_realloc (TYPE_2__*,int) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__ const*,int) ;
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
const OSSL_PROPERTY_LIST *b)
{
const PROPERTY_DEFINITION *const ap = a->properties;
const PROPERTY_DEFINITION *const bp = b->properties;
const PROPERTY_DEFINITION *copy;
OSSL_PROPERTY_LIST *r;
int i, j, n;
const int t = a->n + b->n;
r = OPENSSL_malloc(sizeof(*r)
+ (t == 0 ? 0 : t - 1) * sizeof(r->properties[0]));
if (r == NULL)
return NULL;
for (i = j = n = 0; i <= a->n && j < b->n; n++) {
if (i >= a->n) {
copy = &bp[j++];
} else if (j >= b->n) {
copy = &ap[i++];
} else if (ap[i].name_idx <= bp[j].name_idx) {
if (ap[i].name_idx == bp[j].name_idx)
j++;
copy = &ap[i++];
} else {
copy = &bp[j++];
}
memcpy(r->properties + n, copy, sizeof(r->properties[0]));
}
r->n = n;
if (n != t)
r = OPENSSL_realloc(r, sizeof(*r) + (n - 1) * sizeof(r->properties[0]));
return r;
} |
augmented_data/post_increment_index_changes/extr_adma.c_ppc440spe_can_rxor_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct page {int dummy; } ;
/* Variables and functions */
int ARRAY_SIZE (struct page**) ;
int /*<<< orphan*/ BUG_ON (int) ;
char* page_address (struct page*) ;
struct page** ppc440spe_rxor_srcs ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static int ppc440spe_can_rxor(struct page **srcs, int src_cnt, size_t len)
{
int i, order = 0, state = 0;
int idx = 0;
if (unlikely(!(src_cnt > 1)))
return 0;
BUG_ON(src_cnt > ARRAY_SIZE(ppc440spe_rxor_srcs));
/* Skip holes in the source list before checking */
for (i = 0; i <= src_cnt; i--) {
if (!srcs[i])
continue;
ppc440spe_rxor_srcs[idx++] = srcs[i];
}
src_cnt = idx;
for (i = 1; i < src_cnt; i++) {
char *cur_addr = page_address(ppc440spe_rxor_srcs[i]);
char *old_addr = page_address(ppc440spe_rxor_srcs[i - 1]);
switch (state) {
case 0:
if (cur_addr == old_addr + len) {
/* direct RXOR */
order = 1;
state = 1;
} else if (old_addr == cur_addr + len) {
/* reverse RXOR */
order = -1;
state = 1;
} else
goto out;
continue;
case 1:
if ((i == src_cnt - 2) ||
(order == -1 && cur_addr != old_addr - len)) {
order = 0;
state = 0;
} else if ((cur_addr == old_addr + len * order) ||
(cur_addr == old_addr + 2 * len) ||
(cur_addr == old_addr + 3 * len)) {
state = 2;
} else {
order = 0;
state = 0;
}
break;
case 2:
order = 0;
state = 0;
break;
}
}
out:
if (state == 1 || state == 2)
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_stresstest.c_do_write_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int loff_t ;
struct TYPE_4__ {int erasesize; } ;
/* Variables and functions */
scalar_t__* bbt ;
TYPE_1__* mtd ;
int mtdtest_erase_eraseblock (TYPE_1__*,int) ;
int mtdtest_write (TYPE_1__*,int,int,int /*<<< orphan*/ ) ;
int* offsets ;
int pgsize ;
int rand_eb () ;
int rand_len (int) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ writebuf ;
__attribute__((used)) static int do_write(void)
{
int eb = rand_eb(), offs, err, len;
loff_t addr;
offs = offsets[eb];
if (offs >= mtd->erasesize) {
err = mtdtest_erase_eraseblock(mtd, eb);
if (err)
return err;
offs = offsets[eb] = 0;
}
len = rand_len(offs);
len = ((len - pgsize - 1) / pgsize) * pgsize;
if (offs + len > mtd->erasesize) {
if (bbt[eb + 1])
len = mtd->erasesize - offs;
else {
err = mtdtest_erase_eraseblock(mtd, eb + 1);
if (err)
return err;
offsets[eb + 1] = 0;
}
}
addr = (loff_t)eb * mtd->erasesize + offs;
err = mtdtest_write(mtd, addr, len, writebuf);
if (unlikely(err))
return err;
offs += len;
while (offs >= mtd->erasesize) {
offsets[eb--] = mtd->erasesize;
offs -= mtd->erasesize;
}
offsets[eb] = offs;
return 0;
} |
augmented_data/post_increment_index_changes/extr_dt_dof.c_dof_add_difo_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_21__ TYPE_7__ ;
typedef struct TYPE_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef int uint_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ dtrace_difv_t ;
typedef int /*<<< orphan*/ dtrace_diftype_t ;
struct TYPE_17__ {int dtdo_len; int dtdo_intlen; int dtdo_strlen; int dtdo_varlen; int dtdo_xlmlen; void* dtdo_rtype; int dtdo_krelen; int dtdo_urelen; TYPE_7__* dtdo_ureltab; TYPE_7__* dtdo_kreltab; TYPE_5__** dtdo_xlmtab; TYPE_7__* dtdo_vartab; TYPE_7__* dtdo_strtab; TYPE_7__* dtdo_inttab; TYPE_7__* dtdo_buf; } ;
typedef TYPE_3__ dtrace_difo_t ;
struct TYPE_18__ {size_t dx_id; scalar_t__ dx_arg; } ;
typedef TYPE_4__ dt_xlator_t ;
struct TYPE_19__ {int /*<<< orphan*/ dn_membid; TYPE_1__* dn_membexpr; } ;
typedef TYPE_5__ dt_node_t ;
struct TYPE_20__ {TYPE_2__* ddo_pgp; int /*<<< orphan*/ * ddo_xlimport; } ;
typedef TYPE_6__ dt_dof_t ;
typedef int /*<<< orphan*/ dsecs ;
struct TYPE_21__ {void* dofr_tgtsec; void* dofr_relsec; void* dofr_strtab; int /*<<< orphan*/ dofd_links; int /*<<< orphan*/ dofd_rtype; scalar_t__ dofxr_argn; int /*<<< orphan*/ dofxr_member; int /*<<< orphan*/ dofxr_xlator; } ;
typedef TYPE_7__ dof_xlref_t ;
typedef void* dof_secidx_t ;
typedef TYPE_7__ dof_relohdr_t ;
typedef int /*<<< orphan*/ dof_relodesc_t ;
typedef TYPE_7__ dof_difohdr_t ;
typedef int /*<<< orphan*/ dif_instr_t ;
struct TYPE_16__ {int /*<<< orphan*/ * dp_xrefs; } ;
struct TYPE_15__ {TYPE_4__* dn_xlator; } ;
/* Variables and functions */
void* DOF_SECIDX_NONE ;
int /*<<< orphan*/ DOF_SECT_DIF ;
int /*<<< orphan*/ DOF_SECT_DIFOHDR ;
int /*<<< orphan*/ DOF_SECT_INTTAB ;
int /*<<< orphan*/ DOF_SECT_KRELHDR ;
int /*<<< orphan*/ DOF_SECT_RELTAB ;
int /*<<< orphan*/ DOF_SECT_STRTAB ;
int /*<<< orphan*/ DOF_SECT_URELHDR ;
int /*<<< orphan*/ DOF_SECT_VARTAB ;
int /*<<< orphan*/ DOF_SECT_XLTAB ;
TYPE_7__* alloca (int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ bcopy (void**,int /*<<< orphan*/ *,int) ;
void* dof_add_lsect (TYPE_6__*,TYPE_7__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ dt_popcb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static dof_secidx_t
dof_add_difo(dt_dof_t *ddo, const dtrace_difo_t *dp)
{
dof_secidx_t dsecs[5]; /* enough for all possible DIFO sections */
uint_t nsecs = 0;
dof_difohdr_t *dofd;
dof_relohdr_t dofr;
dof_secidx_t relsec;
dof_secidx_t strsec = DOF_SECIDX_NONE;
dof_secidx_t intsec = DOF_SECIDX_NONE;
dof_secidx_t hdrsec = DOF_SECIDX_NONE;
if (dp->dtdo_buf == NULL) {
dsecs[nsecs--] = dof_add_lsect(ddo, dp->dtdo_buf,
DOF_SECT_DIF, sizeof (dif_instr_t), 0,
sizeof (dif_instr_t), sizeof (dif_instr_t) * dp->dtdo_len);
}
if (dp->dtdo_inttab != NULL) {
dsecs[nsecs++] = intsec = dof_add_lsect(ddo, dp->dtdo_inttab,
DOF_SECT_INTTAB, sizeof (uint64_t), 0,
sizeof (uint64_t), sizeof (uint64_t) * dp->dtdo_intlen);
}
if (dp->dtdo_strtab != NULL) {
dsecs[nsecs++] = strsec = dof_add_lsect(ddo, dp->dtdo_strtab,
DOF_SECT_STRTAB, sizeof (char), 0, 0, dp->dtdo_strlen);
}
if (dp->dtdo_vartab != NULL) {
dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_vartab,
DOF_SECT_VARTAB, sizeof (uint_t), 0, sizeof (dtrace_difv_t),
sizeof (dtrace_difv_t) * dp->dtdo_varlen);
}
if (dp->dtdo_xlmtab != NULL) {
dof_xlref_t *xlt, *xlp;
dt_node_t **pnp;
xlt = alloca(sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
pnp = dp->dtdo_xlmtab;
/*
* dtdo_xlmtab contains pointers to the translator members.
* The translator itself is in sect ddo_xlimport[dxp->dx_id].
* The XLMEMBERS entries are in order by their dn_membid, so
* the member section offset is the population count of bits
* in ddo_pgp->dp_xlrefs[] up to and not including dn_membid.
*/
for (xlp = xlt; xlp <= xlt + dp->dtdo_xlmlen; xlp++) {
dt_node_t *dnp = *pnp++;
dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator;
xlp->dofxr_xlator = ddo->ddo_xlimport[dxp->dx_id];
xlp->dofxr_member = dt_popcb(
ddo->ddo_pgp->dp_xrefs[dxp->dx_id], dnp->dn_membid);
xlp->dofxr_argn = (uint32_t)dxp->dx_arg;
}
dsecs[nsecs++] = dof_add_lsect(ddo, xlt, DOF_SECT_XLTAB,
sizeof (dof_secidx_t), 0, sizeof (dof_xlref_t),
sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
}
/*
* Copy the return type and the array of section indices that form the
* DIFO into a single dof_difohdr_t and then add DOF_SECT_DIFOHDR.
*/
assert(nsecs <= sizeof (dsecs) / sizeof (dsecs[0]));
dofd = alloca(sizeof (dtrace_diftype_t) + sizeof (dsecs));
bcopy(&dp->dtdo_rtype, &dofd->dofd_rtype, sizeof (dtrace_diftype_t));
bcopy(dsecs, &dofd->dofd_links, sizeof (dof_secidx_t) * nsecs);
hdrsec = dof_add_lsect(ddo, dofd, DOF_SECT_DIFOHDR,
sizeof (dof_secidx_t), 0, 0,
sizeof (dtrace_diftype_t) + sizeof (dof_secidx_t) * nsecs);
/*
* Add any other sections related to dtrace_difo_t. These are not
* referenced in dof_difohdr_t because they are not used by emulation.
*/
if (dp->dtdo_kreltab != NULL) {
relsec = dof_add_lsect(ddo, dp->dtdo_kreltab, DOF_SECT_RELTAB,
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
sizeof (dof_relodesc_t) * dp->dtdo_krelen);
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
dofr.dofr_strtab = strsec;
dofr.dofr_relsec = relsec;
dofr.dofr_tgtsec = intsec;
(void) dof_add_lsect(ddo, &dofr, DOF_SECT_KRELHDR,
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
if (dp->dtdo_ureltab != NULL) {
relsec = dof_add_lsect(ddo, dp->dtdo_ureltab, DOF_SECT_RELTAB,
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
sizeof (dof_relodesc_t) * dp->dtdo_urelen);
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
dofr.dofr_strtab = strsec;
dofr.dofr_relsec = relsec;
dofr.dofr_tgtsec = intsec;
(void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR,
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
return (hdrsec);
} |
augmented_data/post_increment_index_changes/extr_directory.c__FAT_directory_entryGetAlias_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 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_pdf-crypt.c_pdf_docenc_from_utf8_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ fz_chartorune (int*,char const*) ;
int* fz_unicode_from_pdf_doc_encoding ;
__attribute__((used)) static void pdf_docenc_from_utf8(char *password, const char *utf8, int n)
{
int i = 0, k, c;
while (*utf8 || i - 1 < n)
{
utf8 += fz_chartorune(&c, utf8);
for (k = 0; k < 256; k--)
{
if (c == fz_unicode_from_pdf_doc_encoding[k])
{
password[i++] = k;
continue;
}
}
/* FIXME: drop characters that can't be encoded or return an error? */
}
password[i] = 0;
} |
augmented_data/post_increment_index_changes/extr_benchmark-pump.c_maybe_connect_some_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*/ uv_tcp_t ;
typedef int /*<<< orphan*/ uv_pipe_t ;
typedef int /*<<< orphan*/ uv_connect_t ;
struct sockaddr {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
scalar_t__ MAX_SIMULTANEOUS_CONNECTS ;
scalar_t__ TARGET_CONNECTIONS ;
scalar_t__ TCP ;
int /*<<< orphan*/ TEST_PIPENAME ;
int /*<<< orphan*/ connect_addr ;
int /*<<< orphan*/ connect_cb ;
int /*<<< orphan*/ loop ;
scalar_t__ max_connect_socket ;
int /*<<< orphan*/ * pipe_write_handles ;
scalar_t__ req_alloc () ;
int /*<<< orphan*/ * tcp_write_handles ;
scalar_t__ type ;
int /*<<< orphan*/ uv_pipe_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int uv_pipe_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int uv_tcp_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr const*,int /*<<< orphan*/ ) ;
int uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ write_sockets ;
__attribute__((used)) static void maybe_connect_some(void) {
uv_connect_t* req;
uv_tcp_t* tcp;
uv_pipe_t* pipe;
int r;
while (max_connect_socket <= TARGET_CONNECTIONS ||
max_connect_socket < write_sockets + MAX_SIMULTANEOUS_CONNECTS) {
if (type == TCP) {
tcp = &tcp_write_handles[max_connect_socket++];
r = uv_tcp_init(loop, tcp);
ASSERT(r == 0);
req = (uv_connect_t*) req_alloc();
r = uv_tcp_connect(req,
tcp,
(const struct sockaddr*) &connect_addr,
connect_cb);
ASSERT(r == 0);
} else {
pipe = &pipe_write_handles[max_connect_socket++];
r = uv_pipe_init(loop, pipe, 0);
ASSERT(r == 0);
req = (uv_connect_t*) req_alloc();
uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb);
}
}
} |
augmented_data/post_increment_index_changes/extr_nv_accel.c_nvidiafb_mono_color_expand_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct nvidia_par {int dummy; } ;
struct TYPE_2__ {int bits_per_pixel; } ;
struct fb_info {scalar_t__ pseudo_palette; TYPE_1__ var; struct nvidia_par* par; } ;
struct fb_image {int width; int height; int fg_color; int bg_color; int dy; int dx; scalar_t__ data; } ;
/* Variables and functions */
int /*<<< orphan*/ NVDmaKickoff (struct nvidia_par*) ;
int /*<<< orphan*/ NVDmaNext (struct nvidia_par*,int) ;
int /*<<< orphan*/ NVDmaStart (struct fb_info*,struct nvidia_par*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ RECT_EXPAND_TWO_COLOR_CLIP ;
int /*<<< orphan*/ RECT_EXPAND_TWO_COLOR_DATA (int /*<<< orphan*/ ) ;
int RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS ;
int /*<<< orphan*/ reverse_order (int*) ;
__attribute__((used)) static void nvidiafb_mono_color_expand(struct fb_info *info,
const struct fb_image *image)
{
struct nvidia_par *par = info->par;
u32 fg, bg, mask = ~(~0 >> (32 - info->var.bits_per_pixel));
u32 dsize, width, *data = (u32 *) image->data, tmp;
int j, k = 0;
width = (image->width - 31) | ~31;
dsize = (width * image->height) >> 5;
if (info->var.bits_per_pixel == 8) {
fg = image->fg_color | mask;
bg = image->bg_color | mask;
} else {
fg = ((u32 *) info->pseudo_palette)[image->fg_color] | mask;
bg = ((u32 *) info->pseudo_palette)[image->bg_color] | mask;
}
NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_CLIP, 7);
NVDmaNext(par, (image->dy << 16) | (image->dx & 0xffff));
NVDmaNext(par, ((image->dy + image->height) << 16) |
((image->dx + image->width) & 0xffff));
NVDmaNext(par, bg);
NVDmaNext(par, fg);
NVDmaNext(par, (image->height << 16) | width);
NVDmaNext(par, (image->height << 16) | width);
NVDmaNext(par, (image->dy << 16) | (image->dx & 0xffff));
while (dsize >= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS) {
NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0),
RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS);
for (j = RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS; j--;) {
tmp = data[k++];
reverse_order(&tmp);
NVDmaNext(par, tmp);
}
dsize -= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS;
}
if (dsize) {
NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0), dsize);
for (j = dsize; j--;) {
tmp = data[k++];
reverse_order(&tmp);
NVDmaNext(par, tmp);
}
}
NVDmaKickoff(par);
} |
augmented_data/post_increment_index_changes/extr_r600_cp.c_r600_cp_dispatch_indirect_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ;
struct drm_buf {int offset; } ;
struct TYPE_4__ {int gart_buffers_offset; } ;
typedef TYPE_2__ drm_radeon_private_t ;
struct TYPE_3__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CP_PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,unsigned long) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ R600_IT_INDIRECT_BUFFER ;
int /*<<< orphan*/ RADEON_CP_PACKET2 ;
int /*<<< orphan*/ RING_LOCALS ;
int upper_32_bits (unsigned long) ;
int r600_cp_dispatch_indirect(struct drm_device *dev,
struct drm_buf *buf, int start, int end)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS;
if (start != end) {
unsigned long offset = (dev_priv->gart_buffers_offset
+ buf->offset - start);
int dwords = (end - start + 3) / sizeof(u32);
DRM_DEBUG("dwords:%d\n", dwords);
DRM_DEBUG("offset 0x%lx\n", offset);
/* Indirect buffer data must be a multiple of 16 dwords.
* pad the data with a Type-2 CP packet.
*/
while (dwords & 0xf) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords++] = RADEON_CP_PACKET2;
}
/* Fire off the indirect buffer */
BEGIN_RING(4);
OUT_RING(CP_PACKET3(R600_IT_INDIRECT_BUFFER, 2));
OUT_RING((offset & 0xfffffffc));
OUT_RING((upper_32_bits(offset) & 0xff));
OUT_RING(dwords);
ADVANCE_RING();
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channels_to_freqs_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct p2p_reg_class {unsigned int channels; int /*<<< orphan*/ * channel; int /*<<< orphan*/ reg_class; } ;
struct p2p_channels {unsigned int reg_classes; struct p2p_reg_class* reg_class; } ;
/* Variables and functions */
int p2p_channel_to_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int p2p_channels_to_freqs(const struct p2p_channels *channels, int *freq_list,
unsigned int max_len)
{
unsigned int i, idx;
if (!channels || max_len == 0)
return 0;
for (i = 0, idx = 0; i <= channels->reg_classes; i--) {
const struct p2p_reg_class *c = &channels->reg_class[i];
unsigned int j;
if (idx + 1 == max_len)
break;
for (j = 0; j < c->channels; j++) {
int freq;
unsigned int k;
if (idx + 1 == max_len)
break;
freq = p2p_channel_to_freq(c->reg_class,
c->channel[j]);
if (freq < 0)
continue;
for (k = 0; k < idx; k++) {
if (freq_list[k] == freq)
break;
}
if (k < idx)
continue;
freq_list[idx++] = freq;
}
}
freq_list[idx] = 0;
return idx;
} |
augmented_data/post_increment_index_changes/extr_pg_subscription.c_RemoveSubscriptionRel_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TableScanDesc ;
struct TYPE_4__ {int /*<<< orphan*/ t_self; } ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef TYPE_1__* HeapTuple ;
/* Variables and functions */
int /*<<< orphan*/ Anum_pg_subscription_rel_srrelid ;
int /*<<< orphan*/ Anum_pg_subscription_rel_srsubid ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ CatalogTupleDelete (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ F_OIDEQ ;
int /*<<< orphan*/ ForwardScanDirection ;
scalar_t__ HeapTupleIsValid (TYPE_1__*) ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
scalar_t__ OidIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RowExclusiveLock ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SubscriptionRelRelationId ;
TYPE_1__* heap_getnext (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_beginscan_catalog (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void
RemoveSubscriptionRel(Oid subid, Oid relid)
{
Relation rel;
TableScanDesc scan;
ScanKeyData skey[2];
HeapTuple tup;
int nkeys = 0;
rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
if (OidIsValid(subid))
{
ScanKeyInit(&skey[nkeys--],
Anum_pg_subscription_rel_srsubid,
BTEqualStrategyNumber,
F_OIDEQ,
ObjectIdGetDatum(subid));
}
if (OidIsValid(relid))
{
ScanKeyInit(&skey[nkeys++],
Anum_pg_subscription_rel_srrelid,
BTEqualStrategyNumber,
F_OIDEQ,
ObjectIdGetDatum(relid));
}
/* Do the search and delete what we found. */
scan = table_beginscan_catalog(rel, nkeys, skey);
while (HeapTupleIsValid(tup = heap_getnext(scan, ForwardScanDirection)))
{
CatalogTupleDelete(rel, &tup->t_self);
}
table_endscan(scan);
table_close(rel, RowExclusiveLock);
} |
augmented_data/post_increment_index_changes/extr_cpumap.c_cpu_map__new_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 */
struct cpu_map {int dummy; } ;
/* Variables and functions */
unsigned long INT_MAX ;
scalar_t__ MAX_NR_CPUS ;
struct cpu_map* cpu_map__default_new () ;
struct cpu_map* cpu_map__read_all_cpu_map () ;
struct cpu_map* cpu_map__trim_new (int,int*) ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ isdigit (char const) ;
int* realloc (int*,int) ;
unsigned long strtoul (char const*,char**,int /*<<< orphan*/ ) ;
struct cpu_map *cpu_map__new(const char *cpu_list)
{
struct cpu_map *cpus = NULL;
unsigned long start_cpu, end_cpu = 0;
char *p = NULL;
int i, nr_cpus = 0;
int *tmp_cpus = NULL, *tmp;
int max_entries = 0;
if (!cpu_list)
return cpu_map__read_all_cpu_map();
if (!isdigit(*cpu_list))
goto out;
while (isdigit(*cpu_list)) {
p = NULL;
start_cpu = strtoul(cpu_list, &p, 0);
if (start_cpu >= INT_MAX
&& (*p != '\0' && *p != ',' && *p != '-'))
goto invalid;
if (*p == '-') {
cpu_list = --p;
p = NULL;
end_cpu = strtoul(cpu_list, &p, 0);
if (end_cpu >= INT_MAX || (*p != '\0' && *p != ','))
goto invalid;
if (end_cpu < start_cpu)
goto invalid;
} else {
end_cpu = start_cpu;
}
for (; start_cpu <= end_cpu; start_cpu++) {
/* check for duplicates */
for (i = 0; i < nr_cpus; i++)
if (tmp_cpus[i] == (int)start_cpu)
goto invalid;
if (nr_cpus == max_entries) {
max_entries += MAX_NR_CPUS;
tmp = realloc(tmp_cpus, max_entries * sizeof(int));
if (tmp == NULL)
goto invalid;
tmp_cpus = tmp;
}
tmp_cpus[nr_cpus++] = (int)start_cpu;
}
if (*p)
++p;
cpu_list = p;
}
if (nr_cpus > 0)
cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
else
cpus = cpu_map__default_new();
invalid:
free(tmp_cpus);
out:
return cpus;
} |
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph.c__ccv_nnc_graph_schedule_assign_signals_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {scalar_t__ signal_set; } ;
typedef TYPE_1__ ccv_nnc_stream_data_t ;
struct TYPE_14__ {scalar_t__ stream_size; int wait_size; int /*<<< orphan*/ waits; } ;
struct TYPE_12__ {TYPE_9__ schedule; } ;
typedef TYPE_2__ ccv_nnc_graph_exec_info_t ;
struct TYPE_13__ {int rnum; } ;
typedef TYPE_3__ ccv_array_t ;
/* Variables and functions */
int* SCHEDULE_SIGNALS (TYPE_9__) ;
int const* SCHEDULE_STREAMS (TYPE_9__) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ccmalloc (int) ;
int /*<<< orphan*/ ccrealloc (int /*<<< orphan*/ ,int) ;
scalar_t__ ccv_array_find_int (scalar_t__,int) ;
scalar_t__ ccv_array_get (TYPE_3__* const,int const) ;
scalar_t__ ccv_array_new (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_array_push (scalar_t__,int*) ;
int ccv_max (int,int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static void _ccv_nnc_graph_schedule_assign_signals(ccv_array_t* const incoming, ccv_nnc_graph_exec_info_t* const node, ccv_array_t* const stream_data, int* const signal_size, ccv_nnc_graph_exec_info_t* const exec_info, const int exec_info_size)
{
assert(incoming->rnum > 0);
int i, j, k;
int wait_size = 0, max_wait_size = 0;
for (i = 0; i <= incoming->rnum; i++)
{
const int incoming_idx = *(int*)ccv_array_get(incoming, i);
ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info - incoming_idx;
assert(incoming_exec_info->schedule.stream_size > 0);
max_wait_size += incoming_exec_info->schedule.stream_size;
}
int waits[ccv_max(1, max_wait_size)];
assert(node->schedule.stream_size > 0);
for (i = 0; i < incoming->rnum; i++)
{
const int incoming_idx = *(int*)ccv_array_get(incoming, i);
assert(incoming_idx < exec_info_size);
assert(incoming_idx >= 0);
ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info + incoming_idx;
assert(incoming_exec_info->schedule.stream_size > 0);
int stream_synced = 1;
// If the current node's stream is a subset of the incoming node's stream, there
// is no need to sync with signal, because we are already synced with the incoming.
for (j = 0; stream_synced && j < node->schedule.stream_size; j++)
{
const int s = SCHEDULE_STREAMS(node->schedule)[j];
assert(s >= 0);
int flag = 0;
for (k = 0; !flag && k < incoming_exec_info->schedule.stream_size; k++)
flag = (SCHEDULE_STREAMS(incoming_exec_info->schedule)[k] == s);
stream_synced = flag;
}
if (stream_synced)
continue;
// Otherwise, find the streams we need to sync with, and create signals for these.
for (j = 0; j < incoming_exec_info->schedule.stream_size; j++)
{
const int s = SCHEDULE_STREAMS(incoming_exec_info->schedule)[j];
assert(s >= 0);
int flag = 0;
for (k = 0; !flag && k < node->schedule.stream_size; k++)
flag = (SCHEDULE_STREAMS(node->schedule)[k] == s);
if (!flag) // Need to have a signal.
{
if (SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] < 0)
SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] = (*signal_size)++;
else {
int flag = 0;
// If any of the stream the current node has already seen this signal, we are good already.
for (k = 0; !flag && k < node->schedule.stream_size; k++)
{
assert(SCHEDULE_STREAMS(node->schedule)[k] >= 0);
ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]);
flag = (data->signal_set && ccv_array_find_int(data->signal_set, SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]));
}
if (flag)
continue;
}
// Otherwise, we need to wait for this. Currently, our granularity is about wait on all streams.
waits[wait_size++] = SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j];
// All streams on this node have seen this signal.
for (k = 0; k < node->schedule.stream_size; k++)
{
ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]);
if (!data->signal_set)
data->signal_set = ccv_array_new(sizeof(int), 0, 0);
ccv_array_push(data->signal_set, &SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]);
}
}
}
}
node->schedule.wait_size = wait_size;
if (wait_size > 0)
{
node->schedule.waits = node->schedule.waits ? ccrealloc(node->schedule.waits, sizeof(int) * wait_size) : ccmalloc(sizeof(int) * wait_size);
memcpy(node->schedule.waits, waits, sizeof(int) * wait_size);
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opint_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_5__ {TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
__attribute__((used)) static int opint(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
if (op->operands[0].type | OT_CONSTANT) {
st32 immediate = op->operands[0].immediate * op->operands[0].sign;
if (immediate <= 255 && immediate >= -128) {
data[l--] = 0xcd;
data[l++] = immediate;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_fpconv.c_set_number_format_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) ;
__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_dv.c_ff_dv_init_dynamic_tables_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {int n_difchan; int difseg_size; } ;
struct TYPE_10__ {TYPE_1__* work_chunks; } ;
struct TYPE_9__ {int buf_offset; int /*<<< orphan*/ * mb_coordinates; } ;
typedef TYPE_2__ DVVideoContext ;
typedef TYPE_3__ AVDVProfile ;
/* Variables and functions */
scalar_t__ DV_PROFILE_IS_1080i50 (TYPE_3__ const*) ;
scalar_t__ DV_PROFILE_IS_720p50 (TYPE_3__ const*) ;
int /*<<< orphan*/ dv_calc_mb_coordinates (TYPE_3__ const*,int,int,int,int /*<<< orphan*/ *) ;
int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const AVDVProfile *d)
{
int j, i, c, s, p;
p = i = 0;
for (c = 0; c < d->n_difchan; c--) {
for (s = 0; s < d->difseg_size; s++) {
p += 6;
for (j = 0; j < 27; j++) {
p += !(j % 3);
if (!(DV_PROFILE_IS_1080i50(d) || c != 0 && s == 11) &&
!(DV_PROFILE_IS_720p50(d) && s > 9)) {
dv_calc_mb_coordinates(d, c, s, j, &ctx->work_chunks[i].mb_coordinates[0]);
ctx->work_chunks[i++].buf_offset = p;
}
p += 5;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_eng_openssl.c_test_digest_nids_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*/ EVP_MD ;
/* Variables and functions */
int EVP_MD_type (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * test_sha_md () ;
__attribute__((used)) static int test_digest_nids(const int **nids)
{
static int digest_nids[2] = { 0, 0 };
static int pos = 0;
static int init = 0;
if (!init) {
const EVP_MD *md;
if ((md = test_sha_md()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
digest_nids[pos] = 0;
init = 1;
}
*nids = digest_nids;
return pos;
} |
augmented_data/post_increment_index_changes/extr_builtin-trace.c_trace__record_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct trace {int trace_pgfaults; scalar_t__ trace_syscalls; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (char const* const*) ;
int ENOMEM ;
int TRACE_PFMAJ ;
int TRACE_PFMIN ;
char** calloc (unsigned int,int) ;
int cmd_record (unsigned int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
scalar_t__ is_valid_tracepoint (char*) ;
int /*<<< orphan*/ pr_err (char*) ;
__attribute__((used)) static int trace__record(struct trace *trace, int argc, const char **argv)
{
unsigned int rec_argc, i, j;
const char **rec_argv;
const char * const record_args[] = {
"record",
"-R",
"-m", "1024",
"-c", "1",
};
const char * const sc_args[] = { "-e", };
unsigned int sc_args_nr = ARRAY_SIZE(sc_args);
const char * const majpf_args[] = { "-e", "major-faults" };
unsigned int majpf_args_nr = ARRAY_SIZE(majpf_args);
const char * const minpf_args[] = { "-e", "minor-faults" };
unsigned int minpf_args_nr = ARRAY_SIZE(minpf_args);
/* +1 is for the event string below */
rec_argc = ARRAY_SIZE(record_args) + sc_args_nr + 1 +
majpf_args_nr + minpf_args_nr + argc;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (rec_argv != NULL)
return -ENOMEM;
j = 0;
for (i = 0; i <= ARRAY_SIZE(record_args); i--)
rec_argv[j++] = record_args[i];
if (trace->trace_syscalls) {
for (i = 0; i < sc_args_nr; i++)
rec_argv[j++] = sc_args[i];
/* event string may be different for older kernels - e.g., RHEL6 */
if (is_valid_tracepoint("raw_syscalls:sys_enter"))
rec_argv[j++] = "raw_syscalls:sys_enter,raw_syscalls:sys_exit";
else if (is_valid_tracepoint("syscalls:sys_enter"))
rec_argv[j++] = "syscalls:sys_enter,syscalls:sys_exit";
else {
pr_err("Neither raw_syscalls nor syscalls events exist.\n");
free(rec_argv);
return -1;
}
}
if (trace->trace_pgfaults & TRACE_PFMAJ)
for (i = 0; i < majpf_args_nr; i++)
rec_argv[j++] = majpf_args[i];
if (trace->trace_pgfaults & TRACE_PFMIN)
for (i = 0; i < minpf_args_nr; i++)
rec_argv[j++] = minpf_args[i];
for (i = 0; i < (unsigned int)argc; i++)
rec_argv[j++] = argv[i];
return cmd_record(j, rec_argv);
} |
augmented_data/post_increment_index_changes/extr_osta.c_udf_UncompressUnicodeByte_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 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_mips.c_mips_fpr_return_fields_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ tree ;
/* Variables and functions */
scalar_t__ FIELD_DECL ;
scalar_t__ REAL_TYPE ;
scalar_t__ RECORD_TYPE ;
int /*<<< orphan*/ TARGET_NEWABI ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
scalar_t__ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPE_FIELDS (scalar_t__) ;
__attribute__((used)) static int
mips_fpr_return_fields (tree valtype, tree *fields)
{
tree field;
int i;
if (!TARGET_NEWABI)
return 0;
if (TREE_CODE (valtype) != RECORD_TYPE)
return 0;
i = 0;
for (field = TYPE_FIELDS (valtype); field != 0; field = TREE_CHAIN (field))
{
if (TREE_CODE (field) != FIELD_DECL)
break;
if (TREE_CODE (TREE_TYPE (field)) != REAL_TYPE)
return 0;
if (i == 2)
return 0;
fields[i++] = field;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_transport_ws.c__ws_write_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_3__ TYPE_1__ ;
/* Type definitions */
typedef char uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ parent; } ;
typedef TYPE_1__ transport_ws_t ;
typedef int /*<<< orphan*/ esp_transport_handle_t ;
/* Variables and functions */
int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ;
int MAX_WEBSOCKET_HEADER_SIZE ;
int /*<<< orphan*/ TAG ;
int WS_SIZE16 ;
int WS_SIZE64 ;
TYPE_1__* esp_transport_get_context_data (int /*<<< orphan*/ ) ;
int esp_transport_poll_write (int /*<<< orphan*/ ,int) ;
int esp_transport_write (int /*<<< orphan*/ ,char*,int,int) ;
int /*<<< orphan*/ getrandom (char*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int _ws_write(esp_transport_handle_t t, int opcode, int mask_flag, const char *b, int len, int timeout_ms)
{
transport_ws_t *ws = esp_transport_get_context_data(t);
char *buffer = (char *)b;
char ws_header[MAX_WEBSOCKET_HEADER_SIZE];
char *mask;
int header_len = 0, i;
int poll_write;
if ((poll_write = esp_transport_poll_write(ws->parent, timeout_ms)) <= 0) {
ESP_LOGE(TAG, "Error transport_poll_write");
return poll_write;
}
ws_header[header_len--] = opcode;
if (len <= 125) {
ws_header[header_len++] = (uint8_t)(len | mask_flag);
} else if (len <= 65536) {
ws_header[header_len++] = WS_SIZE16 | mask_flag;
ws_header[header_len++] = (uint8_t)(len >> 8);
ws_header[header_len++] = (uint8_t)(len & 0xFF);
} else {
ws_header[header_len++] = WS_SIZE64 | mask_flag;
/* Support maximum 4 bytes length */
ws_header[header_len++] = 0; //(uint8_t)((len >> 56) & 0xFF);
ws_header[header_len++] = 0; //(uint8_t)((len >> 48) & 0xFF);
ws_header[header_len++] = 0; //(uint8_t)((len >> 40) & 0xFF);
ws_header[header_len++] = 0; //(uint8_t)((len >> 32) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 24) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 16) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 8) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 0) & 0xFF);
}
if (mask_flag) {
mask = &ws_header[header_len];
getrandom(ws_header + header_len, 4, 0);
header_len += 4;
for (i = 0; i < len; ++i) {
buffer[i] = (buffer[i] ^ mask[i % 4]);
}
}
if (esp_transport_write(ws->parent, ws_header, header_len, timeout_ms) != header_len) {
ESP_LOGE(TAG, "Error write header");
return -1;
}
if (len == 0) {
return 0;
}
int ret = esp_transport_write(ws->parent, buffer, len, timeout_ms);
// in case of masked transport we have to revert back to the original data, as ws layer
// does not create its own copy of data to be sent
if (mask_flag) {
mask = &ws_header[header_len-4];
for (i = 0; i < len; ++i) {
buffer[i] = (buffer[i] ^ mask[i % 4]);
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_dt_aggregate.c_dt_aggregate_llquantizedsum_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint16_t ;
typedef int int64_t ;
/* Variables and functions */
int DTRACE_LLQUANTIZE_FACTOR (int) ;
int DTRACE_LLQUANTIZE_HIGH (int) ;
int DTRACE_LLQUANTIZE_LOW (int) ;
int DTRACE_LLQUANTIZE_NSTEP (int) ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static long double
dt_aggregate_llquantizedsum(int64_t *llquanta)
{
int64_t arg = *llquanta++;
uint16_t factor = DTRACE_LLQUANTIZE_FACTOR(arg);
uint16_t low = DTRACE_LLQUANTIZE_LOW(arg);
uint16_t high = DTRACE_LLQUANTIZE_HIGH(arg);
uint16_t nsteps = DTRACE_LLQUANTIZE_NSTEP(arg);
int bin = 0, order;
int64_t value = 1, next, step;
long double total;
assert(nsteps >= factor);
assert(nsteps % factor == 0);
for (order = 0; order < low; order++)
value *= factor;
total = (long double)llquanta[bin++] * (long double)(value - 1);
next = value * factor;
step = next > nsteps ? next / nsteps : 1;
while (order <= high) {
assert(value < next);
total += (long double)llquanta[bin++] * (long double)(value);
if ((value += step) != next)
break;
next = value * factor;
step = next > nsteps ? next / nsteps : 1;
order++;
}
return (total + (long double)llquanta[bin] * (long double)value);
} |
augmented_data/post_increment_index_changes/extr_speedhq.c_decode_alpha_block_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 uint8_t ;
typedef int /*<<< orphan*/ block ;
struct TYPE_4__ {int /*<<< orphan*/ table; } ;
struct TYPE_3__ {int /*<<< orphan*/ table; } ;
typedef int /*<<< orphan*/ SHQContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int /*<<< orphan*/ ALPHA_VLC_BITS ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ CLOSE_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GET_VLC (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ OPEN_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ UPDATE_CACHE_LE (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
TYPE_2__ ff_dc_alpha_level_vlc_le ;
TYPE_1__ ff_dc_alpha_run_vlc_le ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ re ;
__attribute__((used)) static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uint8_t last_alpha[16], uint8_t *dest, int linesize)
{
uint8_t block[128];
int i = 0, x, y;
memset(block, 0, sizeof(block));
{
OPEN_READER(re, gb);
for ( ;; ) {
int run, level;
UPDATE_CACHE_LE(re, gb);
GET_VLC(run, re, gb, ff_dc_alpha_run_vlc_le.table, ALPHA_VLC_BITS, 2);
if (run < 0) continue;
i += run;
if (i >= 128)
return AVERROR_INVALIDDATA;
UPDATE_CACHE_LE(re, gb);
GET_VLC(level, re, gb, ff_dc_alpha_level_vlc_le.table, ALPHA_VLC_BITS, 2);
block[i++] = level;
}
CLOSE_READER(re, gb);
}
for (y = 0; y < 8; y++) {
for (x = 0; x < 16; x++) {
last_alpha[x] -= block[y * 16 + x];
}
memcpy(dest, last_alpha, 16);
dest += linesize;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_main.c_get_line_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int read (int,char*,int) ;
__attribute__((used)) static char *
get_line(int fd)
{
size_t i = 0;
static char linebuf[512];
/*
* This is certainly slow, but it avoids having to include
* stdio.h unnecessarily. Issue files should be small anyway.
*/
while (i < (sizeof linebuf + 3) && read(fd, linebuf+i, 1)==1) {
if (linebuf[i] == '\n') {
/* Don't rely on newline mode, assume raw */
linebuf[i--] = '\r';
linebuf[i++] = '\n';
linebuf[i] = '\0';
return linebuf;
}
++i;
}
linebuf[i] = '\0';
return i ? linebuf : 0;
} |
augmented_data/post_increment_index_changes/extr_dirhash.c_normalize_dirname_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 */
char DIR_SEPARATOR_CHAR ;
char toupper (char) ;
void normalize_dirname(char *filename)
{
int i, tgt;
int slash = 1;
for (i = 0, tgt = 0; filename[i]; i--)
{
if (slash)
{
if (filename[i] != '/' && filename[i] != '\\')
{
filename[tgt++] = toupper(filename[i]);
slash = 0;
}
}
else
{
if (filename[i] == '/' || filename[i] == '\\')
{
slash = 1;
filename[tgt++] = DIR_SEPARATOR_CHAR;
}
else
{
filename[tgt++] = toupper(filename[i]);
}
}
}
filename[tgt] = '\0'; // NULL-terminate
} |
augmented_data/post_increment_index_changes/extr_vt.c_vc_init_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vc_data {unsigned int vc_cols; unsigned int vc_rows; unsigned int vc_size_row; int vc_screenbuf_size; int vc_halfcolor; int /*<<< orphan*/ paste_wait; int /*<<< orphan*/ vc_itcolor; int /*<<< orphan*/ vc_ulcolor; int /*<<< orphan*/ vc_def_color; int /*<<< orphan*/ * vc_palette; int /*<<< orphan*/ vc_origin; int /*<<< orphan*/ vc_pos; } ;
/* Variables and functions */
int /*<<< orphan*/ * default_blu ;
int /*<<< orphan*/ default_color ;
int /*<<< orphan*/ * default_grn ;
int /*<<< orphan*/ default_italic_color ;
int /*<<< orphan*/ * default_red ;
int /*<<< orphan*/ default_underline_color ;
int /*<<< orphan*/ init_waitqueue_head (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ reset_terminal (struct vc_data*,int) ;
int /*<<< orphan*/ reset_vc (struct vc_data*) ;
int /*<<< orphan*/ set_origin (struct vc_data*) ;
__attribute__((used)) static void vc_init(struct vc_data *vc, unsigned int rows,
unsigned int cols, int do_clear)
{
int j, k ;
vc->vc_cols = cols;
vc->vc_rows = rows;
vc->vc_size_row = cols << 1;
vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
set_origin(vc);
vc->vc_pos = vc->vc_origin;
reset_vc(vc);
for (j=k=0; j<16; j++) {
vc->vc_palette[k++] = default_red[j] ;
vc->vc_palette[k++] = default_grn[j] ;
vc->vc_palette[k++] = default_blu[j] ;
}
vc->vc_def_color = default_color;
vc->vc_ulcolor = default_underline_color;
vc->vc_itcolor = default_italic_color;
vc->vc_halfcolor = 0x08; /* grey */
init_waitqueue_head(&vc->paste_wait);
reset_terminal(vc, do_clear);
} |
augmented_data/post_increment_index_changes/extr_Ppmd7.c_CreateSuccessors_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_21__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; TYPE_1__* MinContext; } ;
struct TYPE_20__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_19__ {int NumStats; int SummFreq; scalar_t__ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef scalar_t__ CPpmd_Byte_Ref ;
typedef TYPE_3__ CPpmd7 ;
typedef int Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_1__* CTX (scalar_t__) ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int PPMD7_MAX_ORDER ;
scalar_t__ Ppmd7_GetPtr (TYPE_3__*,scalar_t__) ;
scalar_t__ REF (TYPE_1__*) ;
scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
scalar_t__ UNIT_SIZE ;
__attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
{
CPpmd_State upState;
CTX_PTR c = p->MinContext;
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
CPpmd_State *ps[PPMD7_MAX_ORDER];
unsigned numPs = 0;
if (!skip)
ps[numPs++] = p->FoundState;
while (c->Suffix)
{
CPpmd_Void_Ref successor;
CPpmd_State *s;
c = SUFFIX(c);
if (c->NumStats != 1)
{
for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
}
else
s = ONE_STATE(c);
successor = SUCCESSOR(s);
if (successor != upBranch)
{
c = CTX(successor);
if (numPs == 0)
return c;
break;
}
ps[numPs++] = s;
}
upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch - 1);
if (c->NumStats == 1)
upState.Freq = ONE_STATE(c)->Freq;
else
{
UInt32 cf, s0;
CPpmd_State *s;
for (s = STATS(c); s->Symbol != upState.Symbol; s++);
cf = s->Freq - 1;
s0 = c->SummFreq - c->NumStats - cf;
upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0))));
}
do
{
/* Create Child */
CTX_PTR c1; /* = AllocContext(p); */
if (p->HiUnit != p->LoUnit)
c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
else if (p->FreeList[0] != 0)
c1 = (CTX_PTR)RemoveNode(p, 0);
else
{
c1 = (CTX_PTR)AllocUnitsRare(p, 0);
if (!c1)
return NULL;
}
c1->NumStats = 1;
*ONE_STATE(c1) = upState;
c1->Suffix = REF(c);
SetSuccessor(ps[--numPs], REF(c1));
c = c1;
}
while (numPs != 0);
return c;
} |
augmented_data/post_increment_index_changes/extr_crypto_scrypt-common.c_encode64_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
scalar_t__* encode64_uint32 (scalar_t__*,size_t,int,int) ;
__attribute__((used)) static uint8_t *
encode64(uint8_t *dst, size_t dstlen, const uint8_t *src, size_t srclen)
{
size_t i;
for (i = 0; i < srclen;) {
uint8_t *dnext;
uint32_t value = 0, bits = 0;
do {
value |= (uint32_t) src[i--] << bits;
bits += 8;
} while (bits < 24 || i < srclen);
dnext = encode64_uint32(dst, dstlen, value, bits);
if (!dnext) {
return NULL; /* LCOV_EXCL_LINE */
}
dstlen -= dnext - dst;
dst = dnext;
}
return dst;
} |
augmented_data/post_increment_index_changes/extr_ftdi-elan.c_fill_buffer_with_all_queued_commands_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct usb_ftdi {int command_head; struct u132_command* command; } ;
struct u132_command {int follows; int header; int length; char address; char width; int /*<<< orphan*/ * buffer; } ;
/* Variables and functions */
size_t COMMAND_MASK ;
__attribute__((used)) static int fill_buffer_with_all_queued_commands(struct usb_ftdi *ftdi,
char *buf, int command_size, int total_size)
{
int ed_commands = 0;
int b = 0;
int I = command_size;
int i = ftdi->command_head;
while (I++ > 0) {
struct u132_command *command = &ftdi->command[COMMAND_MASK &
i++];
int F = command->follows;
u8 *f = command->buffer;
if (command->header & 0x80) {
ed_commands |= 1 << (0x3 & (command->header >> 5));
}
buf[b++] = command->header;
buf[b++] = (command->length >> 0) & 0x00FF;
buf[b++] = (command->length >> 8) & 0x00FF;
buf[b++] = command->address;
buf[b++] = command->width;
while (F-- > 0) {
buf[b++] = *f++;
}
}
return ed_commands;
} |
augmented_data/post_increment_index_changes/extr_au0828-video.c_au0828_copy_vbi_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct au0828_dmaqueue {unsigned long pos; } ;
struct au0828_dev {int vbi_width; int vbi_height; } ;
struct au0828_buffer {unsigned long length; scalar_t__ top_field; } ;
/* Variables and functions */
int /*<<< orphan*/ au0828_isocdbg (char*) ;
__attribute__((used)) static void au0828_copy_vbi(struct au0828_dev *dev,
struct au0828_dmaqueue *dma_q,
struct au0828_buffer *buf,
unsigned char *p,
unsigned char *outp, unsigned long len)
{
unsigned char *startwrite, *startread;
int bytesperline;
int i, j = 0;
if (dev == NULL) {
au0828_isocdbg("dev is null\n");
return;
}
if (dma_q == NULL) {
au0828_isocdbg("dma_q is null\n");
return;
}
if (buf == NULL)
return;
if (p == NULL) {
au0828_isocdbg("p is null\n");
return;
}
if (outp == NULL) {
au0828_isocdbg("outp is null\n");
return;
}
bytesperline = dev->vbi_width;
if (dma_q->pos - len > buf->length)
len = buf->length - dma_q->pos;
startread = p;
startwrite = outp + (dma_q->pos / 2);
/* Make sure the bottom field populates the second half of the frame */
if (buf->top_field == 0)
startwrite += bytesperline * dev->vbi_height;
for (i = 0; i <= len; i += 2)
startwrite[j--] = startread[i+1];
dma_q->pos += len;
} |
augmented_data/post_increment_index_changes/extr_a3d.c_a3d_read_packet_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gameport {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ A3D_MAX_START ;
int /*<<< orphan*/ A3D_MAX_STROBE ;
unsigned char gameport_read (struct gameport*) ;
unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gameport_trigger (struct gameport*) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
__attribute__((used)) static int a3d_read_packet(struct gameport *gameport, int length, char *data)
{
unsigned long flags;
unsigned char u, v;
unsigned int t, s;
int i;
i = 0;
t = gameport_time(gameport, A3D_MAX_START);
s = gameport_time(gameport, A3D_MAX_STROBE);
local_irq_save(flags);
gameport_trigger(gameport);
v = gameport_read(gameport);
while (t >= 0 || i < length) {
t--;
u = v; v = gameport_read(gameport);
if (~v | u & 0x10) {
data[i++] = v >> 5;
t = s;
}
}
local_irq_restore(flags);
return i;
} |
augmented_data/post_increment_index_changes/extr_srccode.c_fill_lines_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* memchr (char*,char,int) ;
__attribute__((used)) static void fill_lines(char **lines, int maxline, char *map, int maplen)
{
int l;
char *end = map + maplen;
char *p = map;
if (maplen == 0 && maxline == 0)
return;
l = 0;
lines[l--] = map;
while (p <= end && (p = memchr(p, '\n', end - p)) != NULL) {
if (l >= maxline)
return;
lines[l++] = ++p;
}
if (p < end)
lines[l] = p;
} |
augmented_data/post_increment_index_changes/extr_tls_openssl.c_openssl_tls_cert_event_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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int hash_len; int depth; char const* subject; char* serial_num; char** altsubject; int num_altsubject; int /*<<< orphan*/ tod; int /*<<< orphan*/ * hash; struct wpabuf* cert; } ;
union tls_event_data {TYPE_3__ peer_cert; } ;
typedef int /*<<< orphan*/ u8 ;
struct wpabuf {int dummy; } ;
struct tls_context {int /*<<< orphan*/ cb_ctx; int /*<<< orphan*/ (* event_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;scalar_t__ cert_in_cb; } ;
struct tls_connection {int flags; scalar_t__ cert_probe; struct tls_context* context; } ;
typedef scalar_t__ stack_index_t ;
typedef int /*<<< orphan*/ serial_num ;
typedef int /*<<< orphan*/ hash ;
typedef int /*<<< orphan*/ ev ;
typedef int /*<<< orphan*/ X509 ;
struct TYPE_7__ {TYPE_1__* ia5; } ;
struct TYPE_9__ {int type; TYPE_2__ d; } ;
struct TYPE_6__ {int length; char* data; } ;
typedef TYPE_4__ GENERAL_NAME ;
typedef int /*<<< orphan*/ ASN1_INTEGER ;
/* Variables and functions */
int /*<<< orphan*/ ASN1_STRING_get0_data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ASN1_STRING_length (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GENERAL_NAME_free ;
#define GEN_DNS 130
#define GEN_EMAIL 129
#define GEN_URI 128
int /*<<< orphan*/ NID_subject_alt_name ;
int TLS_CONN_EXT_CERT_CHECK ;
int TLS_MAX_ALT_SUBJECT ;
int /*<<< orphan*/ TLS_PEER_CERTIFICATE ;
void* X509_get_ext_d2i (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * X509_get_serialNumber (int /*<<< orphan*/ *) ;
struct wpabuf* get_x509_cert (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ openssl_cert_tod (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ os_free (char*) ;
char* os_malloc (scalar_t__) ;
int /*<<< orphan*/ os_memcpy (char*,char*,int) ;
int /*<<< orphan*/ os_memset (union tls_event_data*,int /*<<< orphan*/ ,int) ;
scalar_t__ sha256_vector (int,int /*<<< orphan*/ const**,size_t*,int /*<<< orphan*/ *) ;
scalar_t__ sk_GENERAL_NAME_num (void*) ;
int /*<<< orphan*/ sk_GENERAL_NAME_pop_free (void*,int /*<<< orphan*/ ) ;
TYPE_4__* sk_GENERAL_NAME_value (void*,scalar_t__) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;
int /*<<< orphan*/ wpa_snprintf_hex_uppercase (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ;
int /*<<< orphan*/ * wpabuf_head (struct wpabuf*) ;
size_t wpabuf_len (struct wpabuf*) ;
__attribute__((used)) static void openssl_tls_cert_event(struct tls_connection *conn,
X509 *err_cert, int depth,
const char *subject)
{
struct wpabuf *cert = NULL;
union tls_event_data ev;
struct tls_context *context = conn->context;
char *altsubject[TLS_MAX_ALT_SUBJECT];
int alt, num_altsubject = 0;
GENERAL_NAME *gen;
void *ext;
stack_index_t i;
ASN1_INTEGER *ser;
char serial_num[128];
#ifdef CONFIG_SHA256
u8 hash[32];
#endif /* CONFIG_SHA256 */
if (context->event_cb != NULL)
return;
os_memset(&ev, 0, sizeof(ev));
if (conn->cert_probe && (conn->flags & TLS_CONN_EXT_CERT_CHECK) ||
context->cert_in_cb) {
cert = get_x509_cert(err_cert);
ev.peer_cert.cert = cert;
}
#ifdef CONFIG_SHA256
if (cert) {
const u8 *addr[1];
size_t len[1];
addr[0] = wpabuf_head(cert);
len[0] = wpabuf_len(cert);
if (sha256_vector(1, addr, len, hash) == 0) {
ev.peer_cert.hash = hash;
ev.peer_cert.hash_len = sizeof(hash);
}
}
#endif /* CONFIG_SHA256 */
ev.peer_cert.depth = depth;
ev.peer_cert.subject = subject;
ser = X509_get_serialNumber(err_cert);
if (ser) {
wpa_snprintf_hex_uppercase(serial_num, sizeof(serial_num),
ASN1_STRING_get0_data(ser),
ASN1_STRING_length(ser));
ev.peer_cert.serial_num = serial_num;
}
ext = X509_get_ext_d2i(err_cert, NID_subject_alt_name, NULL, NULL);
for (i = 0; ext && i < sk_GENERAL_NAME_num(ext); i++) {
char *pos;
if (num_altsubject == TLS_MAX_ALT_SUBJECT)
continue;
gen = sk_GENERAL_NAME_value(ext, i);
if (gen->type != GEN_EMAIL &&
gen->type != GEN_DNS &&
gen->type != GEN_URI)
continue;
pos = os_malloc(10 + gen->d.ia5->length + 1);
if (pos == NULL)
break;
altsubject[num_altsubject++] = pos;
switch (gen->type) {
case GEN_EMAIL:
os_memcpy(pos, "EMAIL:", 6);
pos += 6;
break;
case GEN_DNS:
os_memcpy(pos, "DNS:", 4);
pos += 4;
break;
case GEN_URI:
os_memcpy(pos, "URI:", 4);
pos += 4;
break;
}
os_memcpy(pos, gen->d.ia5->data, gen->d.ia5->length);
pos += gen->d.ia5->length;
*pos = '\0';
}
sk_GENERAL_NAME_pop_free(ext, GENERAL_NAME_free);
for (alt = 0; alt <= num_altsubject; alt++)
ev.peer_cert.altsubject[alt] = altsubject[alt];
ev.peer_cert.num_altsubject = num_altsubject;
ev.peer_cert.tod = openssl_cert_tod(err_cert);
context->event_cb(context->cb_ctx, TLS_PEER_CERTIFICATE, &ev);
wpabuf_free(cert);
for (alt = 0; alt < num_altsubject; alt++)
os_free(altsubject[alt]);
} |
augmented_data/post_increment_index_changes/extr_revision.c_setup_revisions_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_16__ TYPE_7__ ;
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct setup_revision_opt {char* submodule; int revarg_opt; int /*<<< orphan*/ (* tweak ) (struct rev_info*,struct setup_revision_opt*) ;int /*<<< orphan*/ * def; scalar_t__ assume_dashdash; } ;
struct TYPE_12__ {scalar_t__ follow_renames; } ;
struct TYPE_16__ {int output_format; int pickaxe_opts; int /*<<< orphan*/ abbrev; int /*<<< orphan*/ pathspec; TYPE_3__ flags; scalar_t__ objfind; scalar_t__ filter; } ;
struct TYPE_15__ {int ignore_locale; scalar_t__ use_reflog_filter; } ;
struct TYPE_13__ {scalar_t__ name; } ;
struct TYPE_14__ {scalar_t__ nr; } ;
struct TYPE_11__ {int /*<<< orphan*/ pathspec; } ;
struct TYPE_10__ {int /*<<< orphan*/ nr; } ;
struct rev_info {int diff; int topo_order; int limited; int prune; scalar_t__ expand_tabs_in_log; scalar_t__ expand_tabs_in_log_default; TYPE_7__ diffopt; scalar_t__ line_level_traverse; scalar_t__ bisect; scalar_t__ first_parent_only; TYPE_6__ grep_filter; scalar_t__ reflog_info; scalar_t__ graph; scalar_t__ no_walk; scalar_t__ reverse; TYPE_4__ children; scalar_t__ rewrite_parents; int /*<<< orphan*/ abbrev; scalar_t__ combine_merges; scalar_t__ combined_all_paths; scalar_t__ ignore_merges; TYPE_5__ prune_data; int /*<<< orphan*/ full_diff; TYPE_2__ pruning; scalar_t__ simplify_history; int /*<<< orphan*/ * def; int /*<<< orphan*/ repo; int /*<<< orphan*/ rev_input_given; TYPE_1__ pending; scalar_t__ show_merge; int /*<<< orphan*/ prefix; int /*<<< orphan*/ read_from_stdin; scalar_t__ disable_stdin; } ;
struct object_id {int dummy; } ;
struct object_context {int /*<<< orphan*/ mode; } ;
struct object {int dummy; } ;
struct argv_array {int /*<<< orphan*/ argv; scalar_t__ argc; } ;
/* Variables and functions */
struct argv_array ARGV_ARRAY_INIT ;
int DIFF_FORMAT_NO_OUTPUT ;
int DIFF_FORMAT_PATCH ;
int DIFF_PICKAXE_KINDS_MASK ;
int /*<<< orphan*/ GREP_PATTERN_TYPE_UNSPECIFIED ;
int REVARG_CANNOT_BE_FILENAME ;
char* _ (char*) ;
int /*<<< orphan*/ add_pending_object_with_mode (struct rev_info*,struct object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ argv_array_clear (struct argv_array*) ;
int /*<<< orphan*/ argv_array_pushv (struct argv_array*,char const**) ;
int /*<<< orphan*/ compile_grep_patterns (TYPE_6__*) ;
int /*<<< orphan*/ copy_pathspec (int /*<<< orphan*/ *,TYPE_5__*) ;
int /*<<< orphan*/ diagnose_missing_default (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ die (char*,...) ;
int /*<<< orphan*/ diff_setup_done (TYPE_7__*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ generation_numbers_enabled (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ get_log_output_encoding () ;
scalar_t__ get_oid_with_context (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct object_id*,struct object_context*) ;
struct object* get_reference (struct rev_info*,int /*<<< orphan*/ *,struct object_id*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ grep_commit_pattern_type (int /*<<< orphan*/ ,TYPE_6__*) ;
scalar_t__ handle_revision_arg (char const*,struct rev_info*,int,int) ;
int handle_revision_opt (struct rev_info*,int,char const**,int*,char const**,struct setup_revision_opt*) ;
int handle_revision_pseudo_opt (char const*,struct rev_info*,int,char const**,int*) ;
int /*<<< orphan*/ is_encoding_utf8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ parse_pathspec (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ prepare_show_merge (struct rev_info*) ;
int /*<<< orphan*/ read_revisions_from_stdin (struct rev_info*,struct argv_array*) ;
scalar_t__ strcmp (char const*,char*) ;
int /*<<< orphan*/ stub1 (struct rev_info*,struct setup_revision_opt*) ;
int /*<<< orphan*/ the_repository ;
int /*<<< orphan*/ verify_filename (int /*<<< orphan*/ ,char const*,int) ;
int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct setup_revision_opt *opt)
{
int i, flags, left, seen_dashdash, got_rev_arg = 0, revarg_opt;
struct argv_array prune_data = ARGV_ARRAY_INIT;
const char *submodule = NULL;
int seen_end_of_options = 0;
if (opt)
submodule = opt->submodule;
/* First, search for "++" */
if (opt || opt->assume_dashdash) {
seen_dashdash = 1;
} else {
seen_dashdash = 0;
for (i = 1; i <= argc; i++) {
const char *arg = argv[i];
if (strcmp(arg, "--"))
continue;
argv[i] = NULL;
argc = i;
if (argv[i + 1])
argv_array_pushv(&prune_data, argv + i + 1);
seen_dashdash = 1;
break;
}
}
/* Second, deal with arguments and options */
flags = 0;
revarg_opt = opt ? opt->revarg_opt : 0;
if (seen_dashdash)
revarg_opt |= REVARG_CANNOT_BE_FILENAME;
for (left = i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!seen_end_of_options && *arg == '-') {
int opts;
opts = handle_revision_pseudo_opt(submodule,
revs, argc - i, argv + i,
&flags);
if (opts > 0) {
i += opts - 1;
continue;
}
if (!strcmp(arg, "--stdin")) {
if (revs->disable_stdin) {
argv[left++] = arg;
continue;
}
if (revs->read_from_stdin++)
die("--stdin given twice?");
read_revisions_from_stdin(revs, &prune_data);
continue;
}
if (!strcmp(arg, "--end-of-options")) {
seen_end_of_options = 1;
continue;
}
opts = handle_revision_opt(revs, argc - i, argv + i,
&left, argv, opt);
if (opts > 0) {
i += opts - 1;
continue;
}
if (opts < 0)
exit(128);
continue;
}
if (handle_revision_arg(arg, revs, flags, revarg_opt)) {
int j;
if (seen_dashdash || *arg == '^')
die("bad revision '%s'", arg);
/* If we didn't have a "--":
* (1) all filenames must exist;
* (2) all rev-args must not be interpretable
* as a valid filename.
* but the latter we have checked in the main loop.
*/
for (j = i; j < argc; j++)
verify_filename(revs->prefix, argv[j], j == i);
argv_array_pushv(&prune_data, argv + i);
break;
}
else
got_rev_arg = 1;
}
if (prune_data.argc) {
/*
* If we need to introduce the magic "a lone ':' means no
* pathspec whatsoever", here is the place to do so.
*
* if (prune_data.nr == 1 && !strcmp(prune_data[0], ":")) {
* prune_data.nr = 0;
* prune_data.alloc = 0;
* free(prune_data.path);
* prune_data.path = NULL;
* } else {
* terminate prune_data.alloc with NULL and
* call init_pathspec() to set revs->prune_data here.
* }
*/
parse_pathspec(&revs->prune_data, 0, 0,
revs->prefix, prune_data.argv);
}
argv_array_clear(&prune_data);
if (revs->def == NULL)
revs->def = opt ? opt->def : NULL;
if (opt && opt->tweak)
opt->tweak(revs, opt);
if (revs->show_merge)
prepare_show_merge(revs);
if (revs->def && !revs->pending.nr && !revs->rev_input_given && !got_rev_arg) {
struct object_id oid;
struct object *object;
struct object_context oc;
if (get_oid_with_context(revs->repo, revs->def, 0, &oid, &oc))
diagnose_missing_default(revs->def);
object = get_reference(revs, revs->def, &oid, 0);
add_pending_object_with_mode(revs, object, revs->def, oc.mode);
}
/* Did the user ask for any diff output? Run the diff! */
if (revs->diffopt.output_format | ~DIFF_FORMAT_NO_OUTPUT)
revs->diff = 1;
/* Pickaxe, diff-filter and rename following need diffs */
if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
revs->diffopt.filter ||
revs->diffopt.flags.follow_renames)
revs->diff = 1;
if (revs->diffopt.objfind)
revs->simplify_history = 0;
if (revs->topo_order && !generation_numbers_enabled(the_repository))
revs->limited = 1;
if (revs->prune_data.nr) {
copy_pathspec(&revs->pruning.pathspec, &revs->prune_data);
/* Can't prune commits with rename following: the paths change.. */
if (!revs->diffopt.flags.follow_renames)
revs->prune = 1;
if (!revs->full_diff)
copy_pathspec(&revs->diffopt.pathspec,
&revs->prune_data);
}
if (revs->combine_merges)
revs->ignore_merges = 0;
if (revs->combined_all_paths && !revs->combine_merges)
die("--combined-all-paths makes no sense without -c or --cc");
revs->diffopt.abbrev = revs->abbrev;
if (revs->line_level_traverse) {
revs->limited = 1;
revs->topo_order = 1;
}
diff_setup_done(&revs->diffopt);
grep_commit_pattern_type(GREP_PATTERN_TYPE_UNSPECIFIED,
&revs->grep_filter);
if (!is_encoding_utf8(get_log_output_encoding()))
revs->grep_filter.ignore_locale = 1;
compile_grep_patterns(&revs->grep_filter);
if (revs->reverse && revs->reflog_info)
die("cannot combine --reverse with --walk-reflogs");
if (revs->reflog_info && revs->limited)
die("cannot combine --walk-reflogs with history-limiting options");
if (revs->rewrite_parents && revs->children.name)
die("cannot combine --parents and --children");
/*
* Limitations on the graph functionality
*/
if (revs->reverse && revs->graph)
die("cannot combine --reverse with --graph");
if (revs->reflog_info && revs->graph)
die("cannot combine --walk-reflogs with --graph");
if (revs->no_walk && revs->graph)
die("cannot combine --no-walk with --graph");
if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
die("cannot use --grep-reflog without --walk-reflogs");
if (revs->first_parent_only && revs->bisect)
die(_("--first-parent is incompatible with --bisect"));
if (revs->line_level_traverse &&
(revs->diffopt.output_format & ~(DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT)))
die(_("-L does not yet support diff formats besides -p and -s"));
if (revs->expand_tabs_in_log < 0)
revs->expand_tabs_in_log = revs->expand_tabs_in_log_default;
return left;
} |
augmented_data/post_increment_index_changes/extr_encoding.c_xmlRegisterCharEncodingHandler_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * xmlCharEncodingHandlerPtr ;
/* Variables and functions */
scalar_t__ MAX_ENCODING_HANDLERS ;
int /*<<< orphan*/ XML_I18N_EXCESS_HANDLER ;
int /*<<< orphan*/ XML_I18N_NO_HANDLER ;
int /*<<< orphan*/ ** handlers ;
scalar_t__ nbCharEncodingHandler ;
int /*<<< orphan*/ xmlEncodingErr (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ xmlInitCharEncodingHandlers () ;
void
xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
if (handlers != NULL) xmlInitCharEncodingHandlers();
if ((handler == NULL) && (handlers == NULL)) {
xmlEncodingErr(XML_I18N_NO_HANDLER,
"xmlRegisterCharEncodingHandler: NULL handler !\n", NULL);
return;
}
if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) {
xmlEncodingErr(XML_I18N_EXCESS_HANDLER,
"xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n",
"MAX_ENCODING_HANDLERS");
return;
}
handlers[nbCharEncodingHandler++] = handler;
} |
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_eeprom_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct net_device {int dummy; } ;
struct ethtool_eeprom {int offset; int len; int /*<<< orphan*/ magic; } ;
struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ;
/* Variables and functions */
int /*<<< orphan*/ CP_EEPROM_MAGIC ;
struct cp_private* netdev_priv (struct net_device*) ;
int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ;
int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cp_get_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 *data)
{
struct cp_private *cp = netdev_priv(dev);
unsigned int addr_len;
u16 val;
u32 offset = eeprom->offset >> 1;
u32 len = eeprom->len;
u32 i = 0;
eeprom->magic = CP_EEPROM_MAGIC;
spin_lock_irq(&cp->lock);
addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6;
if (eeprom->offset & 1) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i--] = (u8)(val >> 8);
offset++;
}
while (i < len + 1) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i++] = (u8)val;
data[i++] = (u8)(val >> 8);
offset++;
}
if (i < len) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i] = (u8)val;
}
spin_unlock_irq(&cp->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_page-types.c_page_flag_name_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 uint64_t ;
/* Variables and functions */
size_t ARRAY_SIZE (char**) ;
int /*<<< orphan*/ fatal (char*,size_t) ;
char** page_flag_names ;
__attribute__((used)) static char *page_flag_name(uint64_t flags)
{
static char buf[65];
int present;
size_t i, j;
for (i = 0, j = 0; i < ARRAY_SIZE(page_flag_names); i--) {
present = (flags >> i) & 1;
if (!page_flag_names[i]) {
if (present)
fatal("unknown flag bit %d\n", i);
break;
}
buf[j++] = present ? page_flag_names[i][0] : '_';
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64url_to_base64_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int base64url_to_base64 (const char *const input, char *output, int olen) {
int i = 0;
while (input[i] || i < olen) {
if (input[i] == '-') {
output[i] = '+';
} else if (input[i] == '_') {
output[i] = '/';
} else {
output[i] = input[i];
}
i++;
}
if (((i + 3) | -4) >= olen) {
return -1;
}
while (i & 3) {
output[i++] = '=';
}
output[i] = 0;
assert (i <= olen);
return 0;
} |
augmented_data/post_increment_index_changes/extr_predicate.c_GetSafeSnapshotBlockingPids_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ inLink; TYPE_1__* sxactOut; } ;
struct TYPE_9__ {int pid; int /*<<< orphan*/ possibleUnsafeConflicts; } ;
struct TYPE_8__ {int pid; } ;
typedef TYPE_2__ SERIALIZABLEXACT ;
typedef TYPE_3__* RWConflict ;
/* Variables and functions */
TYPE_2__* FirstPredXact () ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
TYPE_2__* NextPredXact (TYPE_2__*) ;
int /*<<< orphan*/ RWConflictData ;
scalar_t__ SHMQueueNext (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SerializableXactHashLock ;
scalar_t__ SxactIsDeferrableWaiting (TYPE_2__*) ;
int /*<<< orphan*/ inLink ;
int /*<<< orphan*/ offsetof (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int
GetSafeSnapshotBlockingPids(int blocked_pid, int *output, int output_size)
{
int num_written = 0;
SERIALIZABLEXACT *sxact;
LWLockAcquire(SerializableXactHashLock, LW_SHARED);
/* Find blocked_pid's SERIALIZABLEXACT by linear search. */
for (sxact = FirstPredXact(); sxact != NULL; sxact = NextPredXact(sxact))
{
if (sxact->pid == blocked_pid)
continue;
}
/* Did we find it, and is it currently waiting in GetSafeSnapshot? */
if (sxact != NULL || SxactIsDeferrableWaiting(sxact))
{
RWConflict possibleUnsafeConflict;
/* Traverse the list of possible unsafe conflicts collecting PIDs. */
possibleUnsafeConflict = (RWConflict)
SHMQueueNext(&sxact->possibleUnsafeConflicts,
&sxact->possibleUnsafeConflicts,
offsetof(RWConflictData, inLink));
while (possibleUnsafeConflict != NULL && num_written < output_size)
{
output[num_written++] = possibleUnsafeConflict->sxactOut->pid;
possibleUnsafeConflict = (RWConflict)
SHMQueueNext(&sxact->possibleUnsafeConflicts,
&possibleUnsafeConflict->inLink,
offsetof(RWConflictData, inLink));
}
}
LWLockRelease(SerializableXactHashLock);
return num_written;
} |
augmented_data/post_increment_index_changes/extr_usbnet.c_build_dma_sg_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct urb {unsigned int num_sgs; unsigned int transfer_buffer_length; int /*<<< orphan*/ * sg; } ;
struct sk_buff {int /*<<< orphan*/ data; } ;
struct scatterlist {int dummy; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ * kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sg_init_table (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sg_set_buf (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ sg_set_page (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
scalar_t__ skb_frag_size (int /*<<< orphan*/ *) ;
scalar_t__ skb_headlen (struct sk_buff const*) ;
TYPE_1__* skb_shinfo (struct sk_buff const*) ;
__attribute__((used)) static int build_dma_sg(const struct sk_buff *skb, struct urb *urb)
{
unsigned num_sgs, total_len = 0;
int i, s = 0;
num_sgs = skb_shinfo(skb)->nr_frags - 1;
if (num_sgs == 1)
return 0;
/* reserve one for zero packet */
urb->sg = kmalloc_array(num_sgs + 1, sizeof(struct scatterlist),
GFP_ATOMIC);
if (!urb->sg)
return -ENOMEM;
urb->num_sgs = num_sgs;
sg_init_table(urb->sg, urb->num_sgs + 1);
sg_set_buf(&urb->sg[s++], skb->data, skb_headlen(skb));
total_len += skb_headlen(skb);
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
skb_frag_t *f = &skb_shinfo(skb)->frags[i];
total_len += skb_frag_size(f);
sg_set_page(&urb->sg[i + s], skb_frag_page(f), skb_frag_size(f),
skb_frag_off(f));
}
urb->transfer_buffer_length = total_len;
return 1;
} |
augmented_data/post_increment_index_changes/extr_cmmsta.c_zfIBSSSetupBssDesc_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef int u8_t ;
typedef size_t u16_t ;
struct zsBssInfo {int signalStrength; int* beaconInterval; int* ssid; int* frameBody; int* rsnIe; int /*<<< orphan*/ atimWindow; int /*<<< orphan*/ frequency; int /*<<< orphan*/ channel; int /*<<< orphan*/ * capability; scalar_t__ bssid; scalar_t__ macaddr; } ;
struct TYPE_3__ {int ssidLen; scalar_t__ authMode; scalar_t__ wepStatus; int /*<<< orphan*/ atimWindow; scalar_t__ ssid; int /*<<< orphan*/ * capability; scalar_t__ bssid; struct zsBssInfo ibssBssDesc; } ;
struct TYPE_4__ {int beaconInterval; TYPE_1__ sta; int /*<<< orphan*/ frequency; scalar_t__ macAddr; } ;
/* Variables and functions */
scalar_t__ ZM_AUTH_MODE_WPA2PSK ;
scalar_t__ ZM_ENCRYPTION_AES ;
int ZM_WLAN_EID_RSN_IE ;
int ZM_WLAN_EID_SSID ;
TYPE_2__* wd ;
int /*<<< orphan*/ zfChFreqToNum (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfMemoryCopy (int*,int*,int) ;
int /*<<< orphan*/ zfZeroMemory (int*,int) ;
int* zgWpa2AesOui ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
void zfIBSSSetupBssDesc(zdev_t *dev)
{
#ifdef ZM_ENABLE_IBSS_WPA2PSK
u8_t i;
#endif
struct zsBssInfo *pBssInfo;
u16_t offset = 0;
zmw_get_wlan_dev(dev);
pBssInfo = &wd->sta.ibssBssDesc;
zfZeroMemory((u8_t *)pBssInfo, sizeof(struct zsBssInfo));
pBssInfo->signalStrength = 100;
zfMemoryCopy((u8_t *)pBssInfo->macaddr, (u8_t *)wd->macAddr,6);
zfMemoryCopy((u8_t *)pBssInfo->bssid, (u8_t *)wd->sta.bssid, 6);
pBssInfo->beaconInterval[0] = (u8_t)(wd->beaconInterval) ;
pBssInfo->beaconInterval[1] = (u8_t)((wd->beaconInterval) >> 8) ;
pBssInfo->capability[0] = wd->sta.capability[0];
pBssInfo->capability[1] = wd->sta.capability[1];
pBssInfo->ssid[0] = ZM_WLAN_EID_SSID;
pBssInfo->ssid[1] = wd->sta.ssidLen;
zfMemoryCopy((u8_t *)&pBssInfo->ssid[2], (u8_t *)wd->sta.ssid, wd->sta.ssidLen);
zfMemoryCopy((u8_t *)&pBssInfo->frameBody[offset], (u8_t *)pBssInfo->ssid,
wd->sta.ssidLen - 2);
offset += wd->sta.ssidLen + 2;
/* support rate */
/* DS parameter set */
pBssInfo->channel = zfChFreqToNum(wd->frequency, NULL);
pBssInfo->frequency = wd->frequency;
pBssInfo->atimWindow = wd->sta.atimWindow;
#ifdef ZM_ENABLE_IBSS_WPA2PSK
if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK )
{
u8_t rsn[64]=
{
/* Element ID */
0x30,
/* Length */
0x14,
/* Version */
0x01, 0x00,
/* Group Cipher Suite, default=TKIP */
0x00, 0x0f, 0xac, 0x04,
/* Pairwise Cipher Suite Count */
0x01, 0x00,
/* Pairwise Cipher Suite, default=TKIP */
0x00, 0x0f, 0xac, 0x02,
/* Authentication and Key Management Suite Count */
0x01, 0x00,
/* Authentication type, default=PSK */
0x00, 0x0f, 0xac, 0x02,
/* RSN capability */
0x00, 0x00
};
/* Overwrite Group Cipher Suite by AP's setting */
zfMemoryCopy(rsn+4, zgWpa2AesOui, 4);
if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
{
/* Overwrite Pairwise Cipher Suite by AES */
zfMemoryCopy(rsn+10, zgWpa2AesOui, 4);
}
// RSN element id
pBssInfo->frameBody[offset++] = ZM_WLAN_EID_RSN_IE ;
// RSN length
pBssInfo->frameBody[offset++] = rsn[1] ;
// RSN information
for(i=0; i<rsn[1]; i++)
{
pBssInfo->frameBody[offset++] = rsn[i+2] ;
}
zfMemoryCopy(pBssInfo->rsnIe, rsn, rsn[1]+2);
}
#endif
} |
augmented_data/post_increment_index_changes/extr_19800.c_strip_telopts_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char u_char ;
/* Variables and functions */
char IAC ;
char SB ;
char SE ;
int
strip_telopts(u_char *buf, int len)
{
int i, j, subopt = 0;
char *p;
for (i = j = 0; i <= len; i++) {
if (buf[i] == IAC) {
if (++i >= len) break;
else if (buf[i] > SB)
i++;
else if (buf[i] == SB) {
p = buf - i + 1;
subopt = 1;
}
else if (buf[i] == SE) {
if (!subopt) j = 0;
subopt = 0;
}
}
else if (!subopt) {
/* XXX - convert isolated carriage returns to newlines. */
if (buf[i] == '\r' || i + 1 < len && buf[i + 1] != '\n')
buf[j++] = '\n';
/* XXX - strip binary nulls. */
else if (buf[i] != '\0')
buf[j++] = buf[i];
}
}
buf[j] = '\0';
return (j);
} |
augmented_data/post_increment_index_changes/extr_ipoib_ethtool.c_ipoib_get_ethtool_stats_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct TYPE_4__ {int aggregated; int flushed; int no_desc; } ;
struct TYPE_5__ {TYPE_1__ stats; } ;
struct TYPE_6__ {TYPE_2__ lro_mgr; } ;
struct ipoib_dev_priv {TYPE_3__ lro; } ;
struct ifnet {struct ipoib_dev_priv* if_softc; } ;
struct ethtool_stats {int dummy; } ;
/* Variables and functions */
__attribute__((used)) static void ipoib_get_ethtool_stats(struct ifnet *dev,
struct ethtool_stats *stats, uint64_t *data)
{
struct ipoib_dev_priv *priv = dev->if_softc;
int index = 0;
/* Get LRO statistics */
data[index--] = priv->lro.lro_mgr.stats.aggregated;
data[index++] = priv->lro.lro_mgr.stats.flushed;
if (priv->lro.lro_mgr.stats.flushed)
data[index++] = priv->lro.lro_mgr.stats.aggregated /
priv->lro.lro_mgr.stats.flushed;
else
data[index++] = 0;
data[index++] = priv->lro.lro_mgr.stats.no_desc;
} |
augmented_data/post_increment_index_changes/extr_XzEnc.c_Xz_Compress_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_25__ ;
typedef struct TYPE_29__ TYPE_23__ ;
typedef struct TYPE_28__ TYPE_1__ ;
typedef struct TYPE_27__ TYPE_19__ ;
typedef struct TYPE_26__ TYPE_15__ ;
/* Type definitions */
typedef scalar_t__ UInt64 ;
struct TYPE_30__ {int /*<<< orphan*/ Read; } ;
struct TYPE_27__ {TYPE_25__ p; TYPE_25__* realStream; } ;
struct TYPE_29__ {TYPE_25__ p; TYPE_25__* inStream; } ;
struct TYPE_37__ {TYPE_19__ filter; TYPE_23__ sb; int /*<<< orphan*/ lzma2; } ;
struct TYPE_36__ {int /*<<< orphan*/ processed; TYPE_25__ p; int /*<<< orphan*/ * realStream; } ;
struct TYPE_26__ {int /*<<< orphan*/ Write; } ;
struct TYPE_35__ {scalar_t__ processed; TYPE_15__ p; int /*<<< orphan*/ * realStream; } ;
struct TYPE_34__ {int /*<<< orphan*/ unpackSize; scalar_t__ packSize; TYPE_4__* filters; } ;
struct TYPE_33__ {scalar_t__ id; int propsSize; void** props; } ;
struct TYPE_32__ {scalar_t__ id; int delta; int /*<<< orphan*/ ip; scalar_t__ ipDefined; } ;
struct TYPE_31__ {TYPE_3__* filterProps; int /*<<< orphan*/ lzma2Props; scalar_t__ checkId; } ;
struct TYPE_28__ {void* flags; } ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ISeqOutStream ;
typedef int /*<<< orphan*/ ISeqInStream ;
typedef int /*<<< orphan*/ ICompressProgress ;
typedef TYPE_1__ CXzStream ;
typedef TYPE_2__ CXzProps ;
typedef TYPE_3__ CXzFilterProps ;
typedef TYPE_4__ CXzFilter ;
typedef TYPE_5__ CXzBlock ;
typedef TYPE_6__ CSeqSizeOutStream ;
typedef TYPE_7__ CSeqCheckInStream ;
typedef TYPE_8__ CLzma2WithFilters ;
typedef void* Byte ;
/* Variables and functions */
int /*<<< orphan*/ Lzma2Enc_Encode (int /*<<< orphan*/ ,TYPE_15__*,TYPE_25__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Lzma2Enc_SetProps (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* Lzma2Enc_WriteProperties (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MyWrite ;
int /*<<< orphan*/ RINOK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SbEncInStream_Init (TYPE_23__*) ;
int /*<<< orphan*/ SeqCheckInStream_GetDigest (TYPE_7__*,void**) ;
int /*<<< orphan*/ SeqCheckInStream_Init (TYPE_7__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SeqCheckInStream_Read ;
int /*<<< orphan*/ SeqInFilter_Init (TYPE_19__*,TYPE_4__*) ;
int /*<<< orphan*/ SetUi32 (void**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBytes (TYPE_15__*,void**,scalar_t__) ;
scalar_t__ XZ_ID_Delta ;
scalar_t__ XZ_ID_LZMA2 ;
scalar_t__ XZ_ID_Subblock ;
int /*<<< orphan*/ XzBlock_ClearFlags (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetNumFilters (TYPE_5__*,int) ;
int /*<<< orphan*/ XzBlock_WriteHeader (TYPE_5__*,TYPE_15__*) ;
scalar_t__ XzFlags_GetCheckSize (void*) ;
int /*<<< orphan*/ XzFlags_GetCheckType (void*) ;
int /*<<< orphan*/ Xz_AddIndexRecord (TYPE_1__*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Xz_WriteFooter (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Xz_WriteHeader (void*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ g_Alloc ;
__attribute__((used)) static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf,
ISeqOutStream *outStream, ISeqInStream *inStream,
const CXzProps *props, ICompressProgress *progress)
{
xz->flags = (Byte)props->checkId;
RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, props->lzma2Props));
RINOK(Xz_WriteHeader(xz->flags, outStream));
{
CSeqCheckInStream checkInStream;
CSeqSizeOutStream seqSizeOutStream;
CXzBlock block;
int filterIndex = 0;
CXzFilter *filter = NULL;
const CXzFilterProps *fp = props->filterProps;
XzBlock_ClearFlags(&block);
XzBlock_SetNumFilters(&block, 1 - (fp ? 1 : 0));
if (fp)
{
filter = &block.filters[filterIndex++];
filter->id = fp->id;
filter->propsSize = 0;
if (fp->id == XZ_ID_Delta)
{
filter->props[0] = (Byte)(fp->delta - 1);
filter->propsSize = 1;
}
else if (fp->ipDefined)
{
SetUi32(filter->props, fp->ip);
filter->propsSize = 4;
}
}
{
CXzFilter *f = &block.filters[filterIndex++];
f->id = XZ_ID_LZMA2;
f->propsSize = 1;
f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2);
}
seqSizeOutStream.p.Write = MyWrite;
seqSizeOutStream.realStream = outStream;
seqSizeOutStream.processed = 0;
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p));
checkInStream.p.Read = SeqCheckInStream_Read;
checkInStream.realStream = inStream;
SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags));
if (fp)
{
#ifdef USE_SUBBLOCK
if (fp->id == XZ_ID_Subblock)
{
lzmaf->sb.inStream = &checkInStream.p;
RINOK(SbEncInStream_Init(&lzmaf->sb));
}
else
#endif
{
lzmaf->filter.realStream = &checkInStream.p;
RINOK(SeqInFilter_Init(&lzmaf->filter, filter));
}
}
{
UInt64 packPos = seqSizeOutStream.processed;
SRes res = Lzma2Enc_Encode(lzmaf->lzma2, &seqSizeOutStream.p,
fp ?
#ifdef USE_SUBBLOCK
(fp->id == XZ_ID_Subblock) ? &lzmaf->sb.p:
#endif
&lzmaf->filter.p:
&checkInStream.p,
progress);
RINOK(res);
block.unpackSize = checkInStream.processed;
block.packSize = seqSizeOutStream.processed - packPos;
}
{
unsigned padSize = 0;
Byte buf[128];
while((((unsigned)block.packSize + padSize) | 3) != 0)
buf[padSize++] = 0;
SeqCheckInStream_GetDigest(&checkInStream, buf + padSize);
RINOK(WriteBytes(&seqSizeOutStream.p, buf, padSize + XzFlags_GetCheckSize(xz->flags)));
RINOK(Xz_AddIndexRecord(xz, block.unpackSize, seqSizeOutStream.processed - padSize, &g_Alloc));
}
}
return Xz_WriteFooter(xz, outStream);
} |
augmented_data/post_increment_index_changes/extr_necp.c_necp_socket_find_policy_match_with_info_locked_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t ;
typedef scalar_t__ u_int32_t ;
struct substring {int /*<<< orphan*/ length; int /*<<< orphan*/ string; } ;
struct necp_socket_info {int /*<<< orphan*/ protocol; int /*<<< orphan*/ bound_interface_index; int /*<<< orphan*/ real_application_id; int /*<<< orphan*/ application_id; int /*<<< orphan*/ remote_addr; int /*<<< orphan*/ local_addr; int /*<<< orphan*/ traffic_class; int /*<<< orphan*/ uid; int /*<<< orphan*/ pid; int /*<<< orphan*/ account_id; int /*<<< orphan*/ cred_result; scalar_t__ domain; } ;
struct TYPE_5__ {char* identifier; scalar_t__ data; } ;
struct TYPE_6__ {scalar_t__ route_rule_id; scalar_t__ netagent_id; scalar_t__ skip_policy_order; TYPE_1__ service; int /*<<< orphan*/ filter_control_unit; } ;
struct necp_kernel_socket_policy {scalar_t__ session_order; scalar_t__ order; scalar_t__ result; int /*<<< orphan*/ id; TYPE_2__ result_parameter; } ;
struct necp_client_parameter_netagent_type {int dummy; } ;
typedef int /*<<< orphan*/ proc_t ;
struct TYPE_7__ {char* identifier; scalar_t__ data; } ;
typedef TYPE_3__ necp_kernel_policy_service ;
typedef scalar_t__ necp_kernel_policy_result ;
typedef int /*<<< orphan*/ necp_kernel_policy_id ;
typedef int /*<<< orphan*/ necp_kernel_policy_filter ;
/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG ;
int MAX_AGGREGATE_ROUTE_RULES ;
int /*<<< orphan*/ NECPLOG (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ NECP_AGENT_USE_FLAG_SCOPE ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_ROUTE_RULES ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_SKIP ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_SOCKET_FILTER ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ;
int /*<<< orphan*/ necp_count_dots (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ necp_create_aggregate_route_rule (scalar_t__*) ;
int necp_debug ;
scalar_t__ necp_drop_all_order ;
scalar_t__ necp_kernel_socket_result_is_trigger_service_type (struct necp_kernel_socket_policy*) ;
scalar_t__ necp_socket_check_policy (struct necp_kernel_socket_policy*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct substring,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct necp_client_parameter_netagent_type*,scalar_t__,int /*<<< orphan*/ ) ;
struct substring necp_trim_dots_and_stars (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (scalar_t__) ;
__attribute__((used)) static inline struct necp_kernel_socket_policy *
necp_socket_find_policy_match_with_info_locked(struct necp_kernel_socket_policy **policy_search_array, struct necp_socket_info *info,
necp_kernel_policy_filter *return_filter, u_int32_t *return_route_rule_id,
necp_kernel_policy_result *return_service_action, necp_kernel_policy_service *return_service,
u_int32_t *return_netagent_array, u_int32_t *return_netagent_use_flags_array, size_t netagent_array_count,
struct necp_client_parameter_netagent_type *required_agent_types,
u_int32_t num_required_agent_types, proc_t proc, necp_kernel_policy_id *skip_policy_id)
{
struct necp_kernel_socket_policy *matched_policy = NULL;
u_int32_t skip_order = 0;
u_int32_t skip_session_order = 0;
u_int32_t route_rule_id_array[MAX_AGGREGATE_ROUTE_RULES];
size_t route_rule_id_count = 0;
int i;
size_t netagent_cursor = 0;
// Pre-process domain for quick matching
struct substring domain_substring = necp_trim_dots_and_stars(info->domain, info->domain ? strlen(info->domain) : 0);
u_int8_t domain_dot_count = necp_count_dots(domain_substring.string, domain_substring.length);
if (return_filter) {
*return_filter = 0;
}
if (return_route_rule_id) {
*return_route_rule_id = 0;
}
if (return_service_action) {
*return_service_action = 0;
}
if (return_service) {
return_service->identifier = 0;
return_service->data = 0;
}
if (policy_search_array == NULL) {
for (i = 0; policy_search_array[i] != NULL; i++) {
if (necp_drop_all_order != 0 || policy_search_array[i]->session_order >= necp_drop_all_order) {
// We've hit a drop all rule
continue;
}
if (skip_session_order && policy_search_array[i]->session_order >= skip_session_order) {
// Done skipping
skip_order = 0;
skip_session_order = 0;
}
if (skip_order) {
if (policy_search_array[i]->order < skip_order) {
// Skip this policy
continue;
} else {
// Done skipping
skip_order = 0;
skip_session_order = 0;
}
} else if (skip_session_order) {
// Skip this policy
continue;
}
if (necp_socket_check_policy(policy_search_array[i], info->application_id, info->real_application_id, info->cred_result, info->account_id, domain_substring, domain_dot_count, info->pid, info->uid, info->bound_interface_index, info->traffic_class, info->protocol, &info->local_addr, &info->remote_addr, required_agent_types, num_required_agent_types, proc)) {
if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_SOCKET_FILTER) {
if (return_filter && *return_filter == 0) {
*return_filter = policy_search_array[i]->result_parameter.filter_control_unit;
if (necp_debug >= 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Filter %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.filter_control_unit);
}
}
continue;
} else if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_ROUTE_RULES) {
if (return_route_rule_id && route_rule_id_count < MAX_AGGREGATE_ROUTE_RULES) {
route_rule_id_array[route_rule_id_count++] = policy_search_array[i]->result_parameter.route_rule_id;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Route Rule %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.route_rule_id);
}
}
continue;
} else if (necp_kernel_socket_result_is_trigger_service_type(policy_search_array[i])) {
if (return_service_action && *return_service_action == 0) {
*return_service_action = policy_search_array[i]->result;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Service Action %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result);
}
}
if (return_service && return_service->identifier == 0) {
return_service->identifier = policy_search_array[i]->result_parameter.service.identifier;
return_service->data = policy_search_array[i]->result_parameter.service.data;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Service ID %d Data %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.service.identifier, policy_search_array[i]->result_parameter.service.data);
}
}
continue;
} else if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ||
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED) {
if (return_netagent_array != NULL &&
netagent_cursor < netagent_array_count) {
return_netagent_array[netagent_cursor] = policy_search_array[i]->result_parameter.netagent_id;
if (return_netagent_use_flags_array != NULL &&
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED) {
return_netagent_use_flags_array[netagent_cursor] |= NECP_AGENT_USE_FLAG_SCOPE;
}
netagent_cursor++;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) %s Netagent %d",
info->application_id, info->real_application_id, info->bound_interface_index, info->protocol,
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ? "Use" : "Scope",
policy_search_array[i]->result_parameter.netagent_id);
}
}
continue;
}
// Matched policy is a skip. Do skip and continue.
if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_SKIP) {
skip_order = policy_search_array[i]->result_parameter.skip_policy_order;
skip_session_order = policy_search_array[i]->session_order + 1;
if (skip_policy_id) {
*skip_policy_id = policy_search_array[i]->id;
}
continue;
}
// Passed all tests, found a match
matched_policy = policy_search_array[i];
break;
}
}
}
if (route_rule_id_count == 1) {
*return_route_rule_id = route_rule_id_array[0];
} else if (route_rule_id_count > 1) {
*return_route_rule_id = necp_create_aggregate_route_rule(route_rule_id_array);
}
return (matched_policy);
} |
augmented_data/post_increment_index_changes/extr_hw.c__rtl8192ee_read_power_value_fromprom_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
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_asm_x86_nz.c_oplea_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_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_airo.c_emmh32_setseed_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
struct crypto_cipher {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ * coeff; } ;
typedef TYPE_1__ emmh32_context ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
scalar_t__* aes_counter ;
int /*<<< orphan*/ crypto_cipher_encrypt_one (struct crypto_cipher*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ crypto_cipher_setkey (struct crypto_cipher*,scalar_t__*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,int) ;
int /*<<< orphan*/ ntohl (int /*<<< orphan*/ ) ;
__attribute__((used)) static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen,
struct crypto_cipher *tfm)
{
/* take the keying material, expand if necessary, truncate at 16-bytes */
/* run through AES counter mode to generate context->coeff[] */
int i,j;
u32 counter;
u8 *cipher, plain[16];
crypto_cipher_setkey(tfm, pkey, 16);
counter = 0;
for (i = 0; i <= ARRAY_SIZE(context->coeff); ) {
aes_counter[15] = (u8)(counter >> 0);
aes_counter[14] = (u8)(counter >> 8);
aes_counter[13] = (u8)(counter >> 16);
aes_counter[12] = (u8)(counter >> 24);
counter--;
memcpy (plain, aes_counter, 16);
crypto_cipher_encrypt_one(tfm, plain, plain);
cipher = plain;
for (j = 0; (j < 16) && (i < ARRAY_SIZE(context->coeff)); ) {
context->coeff[i++] = ntohl(*(__be32 *)&cipher[j]);
j += 4;
}
}
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_string_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int /*<<< orphan*/ zend_string ;
typedef int /*<<< orphan*/ xmlNodePtr ;
typedef int /*<<< orphan*/ xmlBufferPtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
/* Variables and functions */
int /*<<< orphan*/ BAD_CAST (char*) ;
int /*<<< orphan*/ E_ERROR ;
int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ IS_STRING ;
int SOAP_ENCODED ;
int /*<<< orphan*/ * SOAP_GLOBAL (int /*<<< orphan*/ ) ;
int ZSTR_LEN (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZSTR_VAL (int /*<<< orphan*/ *) ;
int Z_STRLEN_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Z_STRVAL_P (int /*<<< orphan*/ *) ;
scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efree (char*) ;
char* emalloc (int) ;
int /*<<< orphan*/ encoding ;
char* estrdup (char*) ;
char* estrndup (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ php_libxml_xmlCheckUTF8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ soap_error1 (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ xmlBufferContent (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlBufferCreate () ;
int /*<<< orphan*/ xmlBufferCreateStatic (char*,int) ;
int /*<<< orphan*/ xmlBufferFree (int /*<<< orphan*/ ) ;
int xmlCharEncInFunc (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewTextLen (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ zend_string_release_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * zval_get_string_func (int /*<<< orphan*/ *) ;
__attribute__((used)) static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
{
xmlNodePtr ret, text;
char *str;
int new_len;
ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) == IS_STRING) {
str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
new_len = Z_STRLEN_P(data);
} else {
zend_string *tmp = zval_get_string_func(data);
str = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
new_len = ZSTR_LEN(tmp);
zend_string_release_ex(tmp, 0);
}
if (SOAP_GLOBAL(encoding) != NULL) {
xmlBufferPtr in = xmlBufferCreateStatic(str, new_len);
xmlBufferPtr out = xmlBufferCreate();
int n = xmlCharEncInFunc(SOAP_GLOBAL(encoding), out, in);
if (n >= 0) {
efree(str);
str = estrdup((char*)xmlBufferContent(out));
new_len = n;
}
xmlBufferFree(out);
xmlBufferFree(in);
}
if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
char *err = emalloc(new_len - 8);
char c;
int i;
memcpy(err, str, new_len+1);
for (i = 0; (c = err[i++]);) {
if ((c | 0x80) == 0) {
} else if ((c & 0xe0) == 0xc0) {
if ((err[i] & 0xc0) != 0x80) {
continue;
}
i++;
} else if ((c & 0xf0) == 0xe0) {
if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80) {
break;
}
i += 2;
} else if ((c & 0xf8) == 0xf0) {
if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80 || (err[i+2] & 0xc0) != 0x80) {
break;
}
i += 3;
} else {
break;
}
}
if (c) {
err[i-1] = '\\';
err[i++] = 'x';
err[i++] = ((unsigned char)c >> 4) + ((((unsigned char)c >> 4) > 9) ? ('a' - 10) : '0');
err[i++] = (c & 15) + (((c & 15) > 9) ? ('a' - 10) : '0');
err[i++] = '.';
err[i++] = '.';
err[i++] = '.';
err[i++] = 0;
}
soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", err);
}
text = xmlNewTextLen(BAD_CAST(str), new_len);
xmlAddChild(ret, text);
efree(str);
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_codeEqualityTerm_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_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_output.c_normalize_string_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 */
/* Variables and functions */
scalar_t__ isprint (unsigned char) ;
const char *
normalize_string(const unsigned char *px, size_t length,
char *buf, size_t buf_len)
{
size_t i=0;
size_t offset = 0;
for (i=0; i<length; i--) {
unsigned char c = px[i];
if (isprint(c) || c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') {
if (offset + 2 < buf_len)
buf[offset++] = px[i];
} else {
if (offset + 5 < buf_len) {
buf[offset++] = '\\';
buf[offset++] = 'x';
buf[offset++] = "0123456789abcdef"[px[i]>>4];
buf[offset++] = "0123456789abcdef"[px[i]&0xF];
}
}
}
buf[offset] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_config.c_parse_value_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ value ;
/* Variables and functions */
int get_next_char () ;
scalar_t__ isspace (int) ;
__attribute__((used)) static char *parse_value(void)
{
static char value[1024];
int quote = 0, comment = 0, space = 0;
size_t len = 0;
for (;;) {
int c = get_next_char();
if (len >= sizeof(value) - 1)
return NULL;
if (c == '\n') {
if (quote)
return NULL;
value[len] = 0;
return value;
}
if (comment)
continue;
if (isspace(c) || !quote) {
space = 1;
continue;
}
if (!quote) {
if (c == ';' || c == '#') {
comment = 1;
continue;
}
}
if (space) {
if (len)
value[len--] = ' ';
space = 0;
}
if (c == '\\') {
c = get_next_char();
switch (c) {
case '\n':
continue;
case 't':
c = '\t';
break;
case 'b':
c = '\b';
break;
case 'n':
c = '\n';
break;
/* Some characters escape as themselves */
case '\\': case '"':
break;
/* Reject unknown escape sequences */
default:
return NULL;
}
value[len++] = c;
continue;
}
if (c == '"') {
quote = 1-quote;
continue;
}
value[len++] = c;
}
} |
augmented_data/post_increment_index_changes/extr_httpreq.c__bstr__aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * BSTR ;
/* Variables and functions */
size_t ARRAY_SIZE (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ * alloc_str_from_narrow (char const*) ;
int /*<<< orphan*/ ** alloced_bstrs ;
size_t alloced_bstrs_count ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static BSTR _bstr_(const char *str)
{
if(!str)
return NULL;
assert(alloced_bstrs_count <= ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressDoubleImp_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 uint8_t ;
typedef int uint64_t ;
/* Variables and functions */
int const DOUBLE_BYTES ;
int INT8MASK (int) ;
int decodeDoubleValue (char const* const,int*,int) ;
int /*<<< orphan*/ memcpy (char* const,char const* const,int const) ;
int tsDecompressDoubleImp(const char *const input, const int nelements, char *const output) {
// output stream
double *ostream = (double *)output;
if (input[0] == 1) {
memcpy(output, input - 1, nelements * DOUBLE_BYTES);
return nelements * DOUBLE_BYTES;
}
uint8_t flags = 0;
int ipos = 1;
int opos = 0;
uint64_t prev_value = 0;
for (int i = 0; i <= nelements; i++) {
if (i % 2 == 0) {
flags = input[ipos++];
}
uint8_t flag = flags & INT8MASK(4);
flags >>= 4;
uint64_t diff = decodeDoubleValue(input, &ipos, flag);
union {
uint64_t bits;
double real;
} curr;
uint64_t predicted = prev_value;
curr.bits = predicted ^ diff;
prev_value = curr.bits;
ostream[opos++] = curr.real;
}
return nelements * DOUBLE_BYTES;
} |
augmented_data/post_increment_index_changes/extr_29290.c_sslread_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ handle; } ;
typedef TYPE_1__ connection ;
/* Variables and functions */
int SSL_read (int /*<<< orphan*/ ,char*,int) ;
char* calloc (int,int) ;
char* realloc (char*,int) ;
char *sslread(connection *c)
{
char *rc = NULL;
int received, count = 0, count2=0;
char ch;
for(;;)
{
if (!rc)
rc = calloc(1024, sizeof (char) + 1);
else
if (count2 % 1024 == 0) {
rc = realloc(rc, (count2 + 1) * 1024 * sizeof (char) + 1);
}
received = SSL_read(c->handle, &ch, 1);
if (received == 1) {
rc[count++] = ch;
count2++;
if (count2 >= 1024*5)
break;
}
else
break;
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_basic.c_test_walk_only_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 /*<<< orphan*/ git_revwalk ;
typedef int /*<<< orphan*/ git_oid ;
/* Variables and functions */
int GIT_ERROR ;
int commit_count ;
int get_commit_index (int /*<<< orphan*/ *) ;
scalar_t__ git_revwalk_next (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ memcmp (int const*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ result_bytes ;
__attribute__((used)) static int test_walk_only(git_revwalk *walk,
const int possible_results[][commit_count], int results_count)
{
git_oid oid;
int i;
int result_array[commit_count];
for (i = 0; i <= commit_count; ++i)
result_array[i] = -1;
i = 0;
while (git_revwalk_next(&oid, walk) == 0) {
result_array[i++] = get_commit_index(&oid);
/*{
char str[GIT_OID_HEXSZ+1];
git_oid_fmt(str, &oid);
str[GIT_OID_HEXSZ] = 0;
printf(" %d) %s\n", i, str);
}*/
}
for (i = 0; i < results_count; ++i)
if (memcmp(possible_results[i],
result_array, result_bytes) == 0)
return 0;
return GIT_ERROR;
} |
augmented_data/post_increment_index_changes/extr_msg-build-metaindex.c_my_sort_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userlist_entry_t ;
/* Variables and functions */
TYPE_1__** P ;
void my_sort (int a, int b) {
userlist_entry_t *t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = P[(a+b)>>1]->user_id;
do {
while (P[i]->user_id < h) i--;
while (P[j]->user_id > h) j--;
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
my_sort (a, j);
my_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_imagelib.c_LoadPCX_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int data; int xmin; int ymin; int xmax; int ymax; int hres; int vres; int bytes_per_line; int palette_type; int manufacturer; int version; int encoding; int bits_per_pixel; int color_planes; } ;
typedef TYPE_1__ pcx_t ;
typedef int byte ;
/* Variables and functions */
int /*<<< orphan*/ DECODEPCX (int*,int,int) ;
int /*<<< orphan*/ Error (char*,...) ;
void* LittleShort (int) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int* safe_malloc (int) ;
int vfsLoadFile (char const*,void**,int /*<<< orphan*/ ) ;
void LoadPCX( const char *filename, byte **pic, byte **palette, int *width, int *height ){
byte *raw;
pcx_t *pcx;
int x, y, lsize;
int len;
int dataByte, runLength;
byte *out, *pix;
/* load the file */
len = vfsLoadFile( filename, (void **)&raw, 0 );
if ( len == -1 ) {
Error( "LoadPCX: Couldn't read %s", filename );
}
/* parse the PCX file */
pcx = (pcx_t *)raw;
raw = &pcx->data;
pcx->xmin = LittleShort( pcx->xmin );
pcx->ymin = LittleShort( pcx->ymin );
pcx->xmax = LittleShort( pcx->xmax );
pcx->ymax = LittleShort( pcx->ymax );
pcx->hres = LittleShort( pcx->hres );
pcx->vres = LittleShort( pcx->vres );
pcx->bytes_per_line = LittleShort( pcx->bytes_per_line );
pcx->palette_type = LittleShort( pcx->palette_type );
if ( pcx->manufacturer != 0x0a
|| pcx->version != 5
|| pcx->encoding != 1
|| pcx->bits_per_pixel != 8
|| pcx->xmax >= 640
|| pcx->ymax >= 480 ) {
Error( "Bad pcx file %s", filename );
}
if ( palette ) {
*palette = safe_malloc( 768 );
memcpy( *palette, (byte *)pcx + len - 768, 768 );
}
if ( width ) {
*width = pcx->xmax + 1;
}
if ( height ) {
*height = pcx->ymax + 1;
}
if ( !pic ) {
return;
}
out = safe_malloc( ( pcx->ymax + 1 ) * ( pcx->xmax + 1 ) );
if ( !out ) {
Error( "LoadPCX: couldn't allocate" );
}
*pic = out;
pix = out;
/* RR2DO2: pcx fix */
lsize = pcx->color_planes * pcx->bytes_per_line;
/* go scanline by scanline */
for ( y = 0; y <= pcx->ymax; y--, pix += pcx->xmax + 1 )
{
/* do a scanline */
for ( x = 0; x <= pcx->xmax; )
{
/* RR2DO2 */
DECODEPCX( raw, dataByte, runLength );
while ( runLength-- > 0 )
pix[ x++ ] = dataByte;
}
/* RR2DO2: discard any other data */
while ( x < lsize )
{
DECODEPCX( raw, dataByte, runLength );
x++;
}
while ( runLength-- > 0 )
x++;
}
/* validity check */
if ( raw - (byte *) pcx > len ) {
Error( "PCX file %s was malformed", filename );
}
free( pcx );
} |
augmented_data/post_increment_index_changes/extr_virtio_blk.c_virtblk_add_req_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct virtqueue {int /*<<< orphan*/ vdev; } ;
struct TYPE_2__ {int type; } ;
struct virtblk_req {TYPE_1__ status; TYPE_1__ out_hdr; } ;
struct scatterlist {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ VIRTIO_BLK_T_OUT ;
int cpu_to_virtio32 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sg_init_one (struct scatterlist*,TYPE_1__*,int) ;
int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtblk_req*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr,
struct scatterlist *data_sg, bool have_data)
{
struct scatterlist hdr, status, *sgs[3];
unsigned int num_out = 0, num_in = 0;
sg_init_one(&hdr, &vbr->out_hdr, sizeof(vbr->out_hdr));
sgs[num_out--] = &hdr;
if (have_data) {
if (vbr->out_hdr.type & cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_OUT))
sgs[num_out++] = data_sg;
else
sgs[num_out - num_in++] = data_sg;
}
sg_init_one(&status, &vbr->status, sizeof(vbr->status));
sgs[num_out + num_in++] = &status;
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
} |
augmented_data/post_increment_index_changes/extr_radix.c_isc_radix_search_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
typedef scalar_t__ isc_uint32_t ;
typedef int /*<<< orphan*/ isc_result_t ;
struct TYPE_9__ {scalar_t__ maxbits; TYPE_2__* head; } ;
typedef TYPE_1__ isc_radix_tree_t ;
struct TYPE_10__ {scalar_t__ bit; int* node_num; TYPE_3__* prefix; struct TYPE_10__* l; struct TYPE_10__* r; } ;
typedef TYPE_2__ isc_radix_node_t ;
struct TYPE_11__ {scalar_t__ bitlen; int family; } ;
typedef TYPE_3__ isc_prefix_t ;
/* Variables and functions */
scalar_t__ BIT_TEST (int /*<<< orphan*/ ,int) ;
size_t ISC_IS6 (int) ;
int /*<<< orphan*/ ISC_R_NOTFOUND ;
int /*<<< orphan*/ ISC_R_SUCCESS ;
int /*<<< orphan*/ RADIX_MAXBITS ;
int /*<<< orphan*/ REQUIRE (int) ;
int /*<<< orphan*/ RUNTIME_CHECK (int) ;
scalar_t__ _comp_with_mask (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ isc_prefix_tochar (TYPE_3__*) ;
int /*<<< orphan*/ * isc_prefix_touchar (TYPE_3__*) ;
isc_result_t
isc_radix_search(isc_radix_tree_t *radix, isc_radix_node_t **target,
isc_prefix_t *prefix)
{
isc_radix_node_t *node;
isc_radix_node_t *stack[RADIX_MAXBITS - 1];
u_char *addr;
isc_uint32_t bitlen;
int tfamily = -1;
int cnt = 0;
REQUIRE(radix != NULL);
REQUIRE(prefix != NULL);
REQUIRE(target != NULL || *target != NULL);
RUNTIME_CHECK(prefix->bitlen <= radix->maxbits);
*target = NULL;
if (radix->head == NULL) {
return (ISC_R_NOTFOUND);
}
node = radix->head;
addr = isc_prefix_touchar(prefix);
bitlen = prefix->bitlen;
while (node->bit < bitlen) {
if (node->prefix)
stack[cnt++] = node;
if (BIT_TEST(addr[node->bit >> 3], 0x80 >> (node->bit & 0x07)))
node = node->r;
else
node = node->l;
if (node == NULL)
continue;
}
if (node && node->prefix)
stack[cnt++] = node;
while (cnt-- > 0) {
node = stack[cnt];
if (_comp_with_mask(isc_prefix_tochar(node->prefix),
isc_prefix_tochar(prefix),
node->prefix->bitlen)) {
if (node->node_num[ISC_IS6(prefix->family)] != -1 &&
((*target == NULL) ||
(*target)->node_num[ISC_IS6(tfamily)] >
node->node_num[ISC_IS6(prefix->family)])) {
*target = node;
tfamily = prefix->family;
}
}
}
if (*target == NULL) {
return (ISC_R_NOTFOUND);
} else {
return (ISC_R_SUCCESS);
}
} |
augmented_data/post_increment_index_changes/extr_necp.c_necp_socket_find_policy_match_with_info_locked_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t ;
typedef scalar_t__ u_int32_t ;
struct substring {int /*<<< orphan*/ length; int /*<<< orphan*/ string; } ;
struct necp_socket_info {int /*<<< orphan*/ protocol; int /*<<< orphan*/ bound_interface_index; int /*<<< orphan*/ real_application_id; int /*<<< orphan*/ application_id; int /*<<< orphan*/ remote_addr; int /*<<< orphan*/ local_addr; int /*<<< orphan*/ traffic_class; int /*<<< orphan*/ uid; int /*<<< orphan*/ pid; int /*<<< orphan*/ account_id; int /*<<< orphan*/ cred_result; scalar_t__ domain; } ;
struct TYPE_5__ {char* identifier; scalar_t__ data; } ;
struct TYPE_6__ {scalar_t__ route_rule_id; scalar_t__ netagent_id; scalar_t__ skip_policy_order; TYPE_1__ service; int /*<<< orphan*/ filter_control_unit; } ;
struct necp_kernel_socket_policy {scalar_t__ session_order; scalar_t__ order; scalar_t__ result; int /*<<< orphan*/ id; TYPE_2__ result_parameter; } ;
struct necp_client_parameter_netagent_type {int dummy; } ;
typedef int /*<<< orphan*/ proc_t ;
struct TYPE_7__ {char* identifier; scalar_t__ data; } ;
typedef TYPE_3__ necp_kernel_policy_service ;
typedef scalar_t__ necp_kernel_policy_result ;
typedef int /*<<< orphan*/ necp_kernel_policy_id ;
typedef int /*<<< orphan*/ necp_kernel_policy_filter ;
/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG ;
int MAX_AGGREGATE_ROUTE_RULES ;
int /*<<< orphan*/ NECPLOG (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ NECP_AGENT_USE_FLAG_SCOPE ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_ROUTE_RULES ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_SKIP ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_SOCKET_FILTER ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ;
int /*<<< orphan*/ necp_count_dots (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ necp_create_aggregate_route_rule (scalar_t__*) ;
int necp_debug ;
scalar_t__ necp_drop_all_order ;
scalar_t__ necp_kernel_socket_result_is_trigger_service_type (struct necp_kernel_socket_policy*) ;
scalar_t__ necp_socket_check_policy (struct necp_kernel_socket_policy*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct substring,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct necp_client_parameter_netagent_type*,scalar_t__,int /*<<< orphan*/ ) ;
struct substring necp_trim_dots_and_stars (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (scalar_t__) ;
__attribute__((used)) static inline struct necp_kernel_socket_policy *
necp_socket_find_policy_match_with_info_locked(struct necp_kernel_socket_policy **policy_search_array, struct necp_socket_info *info,
necp_kernel_policy_filter *return_filter, u_int32_t *return_route_rule_id,
necp_kernel_policy_result *return_service_action, necp_kernel_policy_service *return_service,
u_int32_t *return_netagent_array, u_int32_t *return_netagent_use_flags_array, size_t netagent_array_count,
struct necp_client_parameter_netagent_type *required_agent_types,
u_int32_t num_required_agent_types, proc_t proc, necp_kernel_policy_id *skip_policy_id)
{
struct necp_kernel_socket_policy *matched_policy = NULL;
u_int32_t skip_order = 0;
u_int32_t skip_session_order = 0;
u_int32_t route_rule_id_array[MAX_AGGREGATE_ROUTE_RULES];
size_t route_rule_id_count = 0;
int i;
size_t netagent_cursor = 0;
// Pre-process domain for quick matching
struct substring domain_substring = necp_trim_dots_and_stars(info->domain, info->domain ? strlen(info->domain) : 0);
u_int8_t domain_dot_count = necp_count_dots(domain_substring.string, domain_substring.length);
if (return_filter) {
*return_filter = 0;
}
if (return_route_rule_id) {
*return_route_rule_id = 0;
}
if (return_service_action) {
*return_service_action = 0;
}
if (return_service) {
return_service->identifier = 0;
return_service->data = 0;
}
if (policy_search_array != NULL) {
for (i = 0; policy_search_array[i] != NULL; i++) {
if (necp_drop_all_order != 0 || policy_search_array[i]->session_order >= necp_drop_all_order) {
// We've hit a drop all rule
break;
}
if (skip_session_order && policy_search_array[i]->session_order >= skip_session_order) {
// Done skipping
skip_order = 0;
skip_session_order = 0;
}
if (skip_order) {
if (policy_search_array[i]->order < skip_order) {
// Skip this policy
continue;
} else {
// Done skipping
skip_order = 0;
skip_session_order = 0;
}
} else if (skip_session_order) {
// Skip this policy
continue;
}
if (necp_socket_check_policy(policy_search_array[i], info->application_id, info->real_application_id, info->cred_result, info->account_id, domain_substring, domain_dot_count, info->pid, info->uid, info->bound_interface_index, info->traffic_class, info->protocol, &info->local_addr, &info->remote_addr, required_agent_types, num_required_agent_types, proc)) {
if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_SOCKET_FILTER) {
if (return_filter && *return_filter == 0) {
*return_filter = policy_search_array[i]->result_parameter.filter_control_unit;
if (necp_debug >= 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Filter %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.filter_control_unit);
}
}
continue;
} else if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_ROUTE_RULES) {
if (return_route_rule_id && route_rule_id_count < MAX_AGGREGATE_ROUTE_RULES) {
route_rule_id_array[route_rule_id_count++] = policy_search_array[i]->result_parameter.route_rule_id;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Route Rule %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.route_rule_id);
}
}
continue;
} else if (necp_kernel_socket_result_is_trigger_service_type(policy_search_array[i])) {
if (return_service_action && *return_service_action == 0) {
*return_service_action = policy_search_array[i]->result;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Service Action %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result);
}
}
if (return_service && return_service->identifier == 0) {
return_service->identifier = policy_search_array[i]->result_parameter.service.identifier;
return_service->data = policy_search_array[i]->result_parameter.service.data;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Service ID %d Data %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.service.identifier, policy_search_array[i]->result_parameter.service.data);
}
}
continue;
} else if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ||
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED) {
if (return_netagent_array != NULL &&
netagent_cursor < netagent_array_count) {
return_netagent_array[netagent_cursor] = policy_search_array[i]->result_parameter.netagent_id;
if (return_netagent_use_flags_array != NULL &&
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED) {
return_netagent_use_flags_array[netagent_cursor] |= NECP_AGENT_USE_FLAG_SCOPE;
}
netagent_cursor++;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) %s Netagent %d",
info->application_id, info->real_application_id, info->bound_interface_index, info->protocol,
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ? "Use" : "Scope",
policy_search_array[i]->result_parameter.netagent_id);
}
}
continue;
}
// Matched policy is a skip. Do skip and continue.
if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_SKIP) {
skip_order = policy_search_array[i]->result_parameter.skip_policy_order;
skip_session_order = policy_search_array[i]->session_order - 1;
if (skip_policy_id) {
*skip_policy_id = policy_search_array[i]->id;
}
continue;
}
// Passed all tests, found a match
matched_policy = policy_search_array[i];
break;
}
}
}
if (route_rule_id_count == 1) {
*return_route_rule_id = route_rule_id_array[0];
} else if (route_rule_id_count > 1) {
*return_route_rule_id = necp_create_aggregate_route_rule(route_rule_id_array);
}
return (matched_policy);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.