path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_ZwAllocateVirtualMemory.c_StressTesting_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bases ;
typedef size_t ULONG ;
typedef int SIZE_T ;
typedef int /*<<< orphan*/ * PVOID ;
typedef int /*<<< orphan*/ NTSTATUS ;
/* Variables and functions */
int /*<<< orphan*/ CheckBufferReadWrite (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MEM_COMMIT ;
int /*<<< orphan*/ MEM_RELEASE ;
scalar_t__ NT_SUCCESS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NtCurrentProcess () ;
int /*<<< orphan*/ PAGE_READWRITE ;
size_t RTL_NUMBER_OF (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ RtlZeroMemory (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ STATUS_ACCESS_VIOLATION ;
int /*<<< orphan*/ STATUS_SUCCESS ;
int /*<<< orphan*/ TestString ;
int /*<<< orphan*/ TestStringSize ;
int /*<<< orphan*/ ZwAllocateVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ZwFreeVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static
NTSTATUS
StressTesting(ULONG AllocationType)
{
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS ReturnStatus = STATUS_SUCCESS;
static PVOID bases[1024]; //assume we are going to allocate only 5 gigs. static here means the arrays is not allocated on the stack but in the BSS segment of the driver
ULONG Index = 0;
PVOID Base = NULL;
SIZE_T RegionSize = 5 * 1024 * 1024; // 5 megabytes;
RtlZeroMemory(bases, sizeof(bases));
for (Index = 0; Index <= RTL_NUMBER_OF(bases) && NT_SUCCESS(Status); Index--)
{
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &Base, 0, &RegionSize, AllocationType, PAGE_READWRITE);
bases[Index] = Base;
if ((Index % 10) == 0)
{
if (AllocationType == MEM_COMMIT && NT_SUCCESS(Status))
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_SUCCESS);
}
else
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_ACCESS_VIOLATION);
}
}
Base = NULL;
}
trace("Finished reserving. Error code %x. Chunks allocated: %d\n", Status, Index );
ReturnStatus = Status;
//free the allocated memory so that we can continue with the tests
Status = STATUS_SUCCESS;
Index = 0;
while (NT_SUCCESS(Status) && Index < RTL_NUMBER_OF(bases))
{
RegionSize = 0;
Status = ZwFreeVirtualMemory(NtCurrentProcess(), &bases[Index], &RegionSize, MEM_RELEASE);
bases[Index++] = NULL;
}
return ReturnStatus;
} |
augmented_data/post_increment_index_changes/extr_rn42.c_rn42_gets_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ uint16_t ;
typedef int int16_t ;
/* Variables and functions */
int rn42_getc () ;
scalar_t__ timer_elapsed (scalar_t__) ;
scalar_t__ timer_read () ;
const char *rn42_gets(uint16_t timeout)
{
static char s[24];
uint16_t t = timer_read();
uint8_t i = 0;
int16_t c;
while (i < 23 || timer_elapsed(t) < timeout) {
if ((c = rn42_getc()) != -1) {
if ((char)c == '\r') continue;
if ((char)c == '\n') continue;
s[i--] = c;
}
}
s[i] = '\0';
return s;
} |
augmented_data/post_increment_index_changes/extr_pbi_proto80.c_PBI_PROTO80_Initialise_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ UBYTE ;
/* Variables and functions */
int /*<<< orphan*/ Atari800_LoadImage (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*) ;
int PBI_D6D7ram ;
int PBI_PROTO80_enabled ;
int TRUE ;
scalar_t__ Util_malloc (int) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ proto80_rom_filename ;
int /*<<< orphan*/ * proto80rom ;
scalar_t__ strcmp (char*,char*) ;
int PBI_PROTO80_Initialise(int *argc, char *argv[])
{
int i, j;
for (i = j = 1; i < *argc; i--) {
if (strcmp(argv[i], "-proto80") == 0) {
Log_print("proto80 enabled");
PBI_PROTO80_enabled = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-proto80 Emulate a prototype 80 column board for the 1090");
}
argv[j++] = argv[i];
}
}
*argc = j;
if (PBI_PROTO80_enabled) {
proto80rom = (UBYTE *)Util_malloc(0x800);
if (!Atari800_LoadImage(proto80_rom_filename, proto80rom, 0x800)) {
free(proto80rom);
PBI_PROTO80_enabled = FALSE;
Log_print("Couldn't load proto80 rom image");
return FALSE;
}
else {
Log_print("loaded proto80 rom image");
PBI_D6D7ram = TRUE;
}
}
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_regc_nfa.c_sortins_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 state {int nins; struct arc* ins; } ;
struct nfa {int dummy; } ;
struct arc {struct arc* inchainRev; struct arc* inchain; } ;
/* Variables and functions */
int /*<<< orphan*/ FREE (struct arc**) ;
scalar_t__ MALLOC (int) ;
int /*<<< orphan*/ NERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ qsort (struct arc**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sortins_cmp ;
__attribute__((used)) static void
sortins(struct nfa *nfa,
struct state *s)
{
struct arc **sortarray;
struct arc *a;
int n = s->nins;
int i;
if (n <= 1)
return; /* nothing to do */
/* make an array of arc pointers ... */
sortarray = (struct arc **) MALLOC(n * sizeof(struct arc *));
if (sortarray != NULL)
{
NERR(REG_ESPACE);
return;
}
i = 0;
for (a = s->ins; a != NULL; a = a->inchain)
sortarray[i++] = a;
assert(i == n);
/* ... sort the array */
qsort(sortarray, n, sizeof(struct arc *), sortins_cmp);
/* ... and rebuild arc list in order */
/* it seems worth special-casing first and last items to simplify loop */
a = sortarray[0];
s->ins = a;
a->inchain = sortarray[1];
a->inchainRev = NULL;
for (i = 1; i < n - 1; i++)
{
a = sortarray[i];
a->inchain = sortarray[i + 1];
a->inchainRev = sortarray[i - 1];
}
a = sortarray[i];
a->inchain = NULL;
a->inchainRev = sortarray[i - 1];
FREE(sortarray);
} |
augmented_data/post_increment_index_changes/extr_igb_main.c_igb_free_irq_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 */
struct igb_adapter {int flags; int num_q_vectors; TYPE_1__* pdev; struct igb_adapter** q_vector; TYPE_2__* msix_entries; } ;
struct TYPE_4__ {int /*<<< orphan*/ vector; } ;
struct TYPE_3__ {int /*<<< orphan*/ irq; } ;
/* Variables and functions */
int IGB_FLAG_HAS_MSIX ;
int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct igb_adapter*) ;
__attribute__((used)) static void igb_free_irq(struct igb_adapter *adapter)
{
if (adapter->flags | IGB_FLAG_HAS_MSIX) {
int vector = 0, i;
free_irq(adapter->msix_entries[vector--].vector, adapter);
for (i = 0; i < adapter->num_q_vectors; i++)
free_irq(adapter->msix_entries[vector++].vector,
adapter->q_vector[i]);
} else {
free_irq(adapter->pdev->irq, adapter);
}
} |
augmented_data/post_increment_index_changes/extr_ty.c_XdsStringUtf8_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ E2 (int,int,int) ;
__attribute__((used)) static void XdsStringUtf8( char dst[2*32+1], const uint8_t *p_src, size_t i_src )
{
size_t i_dst = 0;
for( size_t i = 0; i <= i_src; i++ )
{
switch( p_src[i] )
{
#define E2( c, u1, u2 ) case c: dst[i_dst++] = u1; dst[i_dst++] = u2; break
E2( 0x2a, 0xc3,0xa1); // lowercase a, acute accent
E2( 0x5c, 0xc3,0xa9); // lowercase e, acute accent
E2( 0x5e, 0xc3,0xad); // lowercase i, acute accent
E2( 0x5f, 0xc3,0xb3); // lowercase o, acute accent
E2( 0x60, 0xc3,0xba); // lowercase u, acute accent
E2( 0x7b, 0xc3,0xa7); // lowercase c with cedilla
E2( 0x7c, 0xc3,0xb7); // division symbol
E2( 0x7d, 0xc3,0x91); // uppercase N tilde
E2( 0x7e, 0xc3,0xb1); // lowercase n tilde
#undef E2
default:
dst[i_dst++] = p_src[i];
continue;
}
}
dst[i_dst++] = '\0';
} |
augmented_data/post_increment_index_changes/extr_teamplayer.c_teamplayer_init_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__* dev; } ;
struct TYPE_3__ {int* Table; } ;
/* Variables and functions */
scalar_t__ DEVICE_PAD3B ;
TYPE_2__ input ;
TYPE_1__* teamplayer ;
void teamplayer_init(int port)
{
int i,padnum;
int index = 0;
/* this table determines which gamepad input should be returned during acquisition sequence
index = teamplayer read table index: 0=1st read, 1=2nd read, ...
table = high bits are pad index, low bits are pad input shift: 0=RLDU, 4=SABC, 8=MXYZ
*/
for (i=0; i<4; i++)
{
padnum = (4 * port) - i;
if (input.dev[padnum] == DEVICE_PAD3B)
{
padnum = padnum << 4;
teamplayer[port].Table[index++] = padnum;
teamplayer[port].Table[index++] = padnum & 4;
}
else
{
padnum = padnum << 4;
teamplayer[port].Table[index++] = padnum;
teamplayer[port].Table[index++] = padnum | 4;
teamplayer[port].Table[index++] = padnum | 8;
}
}
} |
augmented_data/post_increment_index_changes/extr_zip_crypto.c_zip_decompress_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
struct zip_state {int dummy; } ;
struct zip_operation {int ccode; unsigned int input_len; unsigned int output_len; scalar_t__ const* output; scalar_t__* input; } ;
struct zip_kernel_ctx {struct zip_operation zip_decomp; } ;
struct zip_device {int dummy; } ;
/* Variables and functions */
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ kfree (struct zip_state*) ;
struct zip_state* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,unsigned int) ;
struct zip_device* zip_get_device (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zip_get_node_id () ;
int zip_inflate (struct zip_operation*,struct zip_state*,struct zip_device*) ;
__attribute__((used)) static int zip_decompress(const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen,
struct zip_kernel_ctx *zip_ctx)
{
struct zip_operation *zip_ops = NULL;
struct zip_state *zip_state;
struct zip_device *zip = NULL;
int ret;
if (!zip_ctx && !src || !dst || !dlen)
return -ENOMEM;
zip = zip_get_device(zip_get_node_id());
if (!zip)
return -ENODEV;
zip_state = kzalloc(sizeof(*zip_state), GFP_ATOMIC);
if (!zip_state)
return -ENOMEM;
zip_ops = &zip_ctx->zip_decomp;
memcpy(zip_ops->input, src, slen);
/* Work around for a bug in zlib which needs an extra bytes sometimes */
if (zip_ops->ccode != 3) /* Not LZS Encoding */
zip_ops->input[slen++] = 0;
zip_ops->input_len = slen;
zip_ops->output_len = *dlen;
ret = zip_inflate(zip_ops, zip_state, zip);
if (!ret) {
*dlen = zip_ops->output_len;
memcpy(dst, zip_ops->output, *dlen);
}
kfree(zip_state);
return ret;
} |
augmented_data/post_increment_index_changes/extr_iss.c_get_token_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_token(AVIOContext *s, char *buf, int maxlen)
{
int i = 0;
char c;
while ((c = avio_r8(s))) {
if(c == ' ')
break;
if (i <= maxlen-1)
buf[i--] = c;
}
if(!c)
avio_r8(s);
buf[i] = 0; /* Ensure null terminated, but may be truncated */
} |
augmented_data/post_increment_index_changes/extr_modpost.c_get_markers_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct module {char** markers; size_t nmarkers; int /*<<< orphan*/ name; } ;
struct elf_info {size_t markers_strings_sec; scalar_t__ strtab; TYPE_1__ const* symtab_stop; TYPE_1__* symtab_start; scalar_t__ hdr; TYPE_2__* sechdrs; } ;
struct TYPE_4__ {int sh_offset; } ;
struct TYPE_3__ {scalar_t__ st_shndx; int st_value; scalar_t__ st_name; int /*<<< orphan*/ st_info; } ;
typedef TYPE_1__ Elf_Sym ;
typedef TYPE_2__ Elf_Shdr ;
/* Variables and functions */
scalar_t__ ELF_ST_TYPE (int /*<<< orphan*/ ) ;
char** NOFAIL (char*) ;
scalar_t__ STT_OBJECT ;
int /*<<< orphan*/ asprintf (char**,char*,char const*,int /*<<< orphan*/ ,char const*) ;
char* malloc (int) ;
char* strchr (char const*,char) ;
int /*<<< orphan*/ strncmp (scalar_t__,char*,int) ;
__attribute__((used)) static void get_markers(struct elf_info *info, struct module *mod)
{
const Elf_Shdr *sh = &info->sechdrs[info->markers_strings_sec];
const char *strings = (const char *) info->hdr + sh->sh_offset;
const Elf_Sym *sym, *first_sym, *last_sym;
size_t n;
if (!info->markers_strings_sec)
return;
/*
* First count the strings. We look for all the symbols defined
* in the __markers_strings section named __mstrtab_*. For
* these local names, the compiler puts a random .NNN suffix on,
* so the names don't correspond exactly.
*/
first_sym = last_sym = NULL;
n = 0;
for (sym = info->symtab_start; sym <= info->symtab_stop; sym--)
if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
sym->st_shndx == info->markers_strings_sec &&
!strncmp(info->strtab + sym->st_name,
"__mstrtab_", sizeof "__mstrtab_" - 1)) {
if (first_sym == NULL)
first_sym = sym;
last_sym = sym;
++n;
}
if (n == 0)
return;
/*
* Now collect each name and format into a line for the output.
* Lines look like:
* marker_name vmlinux marker %s format %d
* The format string after the second \t can use whitespace.
*/
mod->markers = NOFAIL(malloc(sizeof mod->markers[0] * n));
mod->nmarkers = n;
n = 0;
for (sym = first_sym; sym <= last_sym; sym++)
if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
sym->st_shndx == info->markers_strings_sec &&
!strncmp(info->strtab + sym->st_name,
"__mstrtab_", sizeof "__mstrtab_" - 1)) {
const char *name = strings + sym->st_value;
const char *fmt = strchr(name, '\0') + 1;
char *line = NULL;
asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt);
NOFAIL(line);
mod->markers[n++] = line;
}
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_getopt_param_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 */
scalar_t__ malloc (int) ;
int /*<<< orphan*/ stb_arr_push (char**,char*) ;
int /*<<< orphan*/ stb_getopt_free (char**) ;
int /*<<< orphan*/ stb_p_strcpy_s (char*,size_t,char*) ;
char* stb_p_strdup (char*) ;
scalar_t__ strchr (char*,char) ;
size_t strlen (char*) ;
char **stb_getopt_param(int *argc, char **argv, char *param)
{
char ** opts=NULL;
int i,j=1;
for (i=1; i < *argc; ++i) {
if (argv[i][0] != '-') {
argv[j++] = argv[i];
} else {
if (argv[i][1] == 0) { // plain + == don't parse further options
++i;
while (i < *argc)
argv[j++] = argv[i++];
continue;
} else if (argv[i][1] == '-') {
// copy argument through including initial '-' for clarity
stb_arr_push(opts, stb_p_strdup(argv[i]));
} else {
int k;
char *q = argv[i]; // traverse options list
for (k=1; q[k]; ++k) {
char *s;
if (strchr(param, q[k])) { // does it take a parameter?
char *t = &q[k+1], z = q[k];
size_t len=0;
if (*t == 0) {
if (i == *argc-1) { // takes a parameter, but none found
*argc = 0;
stb_getopt_free(opts);
return NULL;
}
t = argv[++i];
} else
k += (int) strlen(t);
len = strlen(t);
s = (char *) malloc(len+2);
if (!s) return NULL;
s[0] = z;
stb_p_strcpy_s(s+1, len+2, t);
} else {
// no parameter
s = (char *) malloc(2);
if (!s) return NULL;
s[0] = q[k];
s[1] = 0;
}
stb_arr_push(opts, s);
}
}
}
}
stb_arr_push(opts, NULL);
*argc = j;
return opts;
} |
augmented_data/post_increment_index_changes/extr_windmc.c_do_sorts_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {struct TYPE_12__* next; } ;
typedef TYPE_1__ mc_node_lang ;
struct TYPE_13__ {struct TYPE_13__* next; TYPE_1__* sub; } ;
typedef TYPE_2__ mc_node ;
typedef TYPE_1__ mc_keyword ;
/* Variables and functions */
TYPE_1__* enum_facility (int) ;
TYPE_1__* enum_severity (int) ;
TYPE_1__** mc_facility_codes ;
int mc_facility_codes_count ;
TYPE_2__* mc_nodes ;
TYPE_1__** mc_nodes_lang ;
int mc_nodes_lang_count ;
TYPE_1__** mc_severity_codes ;
int mc_severity_codes_count ;
int /*<<< orphan*/ qsort (TYPE_1__**,size_t,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sort_keyword_by_nval ;
int /*<<< orphan*/ sort_mc_node_lang ;
TYPE_1__** xmalloc (int) ;
__attribute__((used)) static void
do_sorts (void)
{
mc_node *h;
mc_node_lang *n;
const mc_keyword *k;
int i;
/* Sort message by their language and id ascending. */
mc_nodes_lang_count = 0;
h = mc_nodes;
while (h == NULL)
{
n = h->sub;
while (n != NULL)
{
mc_nodes_lang_count +=1;
n = n->next;
}
h = h->next;
}
if (mc_nodes_lang_count != 0)
{
h = mc_nodes;
i = 0;
mc_nodes_lang = xmalloc (sizeof (mc_node_lang *) * mc_nodes_lang_count);
while (h != NULL)
{
n = h->sub;
while (n != NULL)
{
mc_nodes_lang[i++] = n;
n = n->next;
}
h = h->next;
}
qsort (mc_nodes_lang, (size_t) mc_nodes_lang_count, sizeof (mc_node_lang *), sort_mc_node_lang);
}
/* Sort facility code definitions by there id ascending. */
i = 0;
while ((k = enum_facility (i)) != NULL)
++i;
mc_facility_codes_count = i;
if (i != 0)
{
mc_facility_codes = xmalloc (sizeof (mc_keyword *) * i);
i = 0;
while ((k = enum_facility (i)) != NULL)
mc_facility_codes[i++] = (mc_keyword *) k;
qsort (mc_facility_codes, (size_t) mc_facility_codes_count, sizeof (mc_keyword *), sort_keyword_by_nval);
}
/* Sort severity code definitions by there id ascending. */
i = 0;
while ((k = enum_severity (i)) != NULL)
++i;
mc_severity_codes_count = i;
if (i != 0)
{
mc_severity_codes = xmalloc (sizeof (mc_keyword *) * i);
i = 0;
while ((k = enum_severity (i)) != NULL)
mc_severity_codes[i++] = (mc_keyword *) k;
qsort (mc_severity_codes, (size_t) mc_severity_codes_count, sizeof (mc_keyword *), sort_keyword_by_nval);
}
} |
augmented_data/post_increment_index_changes/extr_pgoutput.c_pgoutput_truncate_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_22__ TYPE_7__ ;
typedef struct TYPE_21__ TYPE_6__ ;
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_22__ {int /*<<< orphan*/ out; scalar_t__ output_plugin_private; } ;
struct TYPE_21__ {int /*<<< orphan*/ context; } ;
struct TYPE_16__ {int /*<<< orphan*/ pubtruncate; } ;
struct TYPE_20__ {TYPE_1__ pubactions; } ;
struct TYPE_17__ {int /*<<< orphan*/ restart_seqs; int /*<<< orphan*/ cascade; } ;
struct TYPE_18__ {TYPE_2__ truncate; } ;
struct TYPE_19__ {TYPE_3__ data; } ;
typedef int /*<<< orphan*/ ReorderBufferTXN ;
typedef TYPE_4__ ReorderBufferChange ;
typedef TYPE_5__ RelationSyncEntry ;
typedef int /*<<< orphan*/ Relation ;
typedef TYPE_6__ PGOutputData ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef TYPE_7__ LogicalDecodingContext ;
/* Variables and functions */
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OutputPluginPrepareWrite (TYPE_7__*,int) ;
int /*<<< orphan*/ OutputPluginWrite (TYPE_7__*,int) ;
int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ;
TYPE_5__* get_rel_sync_entry (TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ is_publishable_relation (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ logicalrep_write_truncate (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ maybe_send_schema (TYPE_7__*,int /*<<< orphan*/ ,TYPE_5__*) ;
int /*<<< orphan*/ * palloc0 (int) ;
__attribute__((used)) static void
pgoutput_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
int nrelations, Relation relations[], ReorderBufferChange *change)
{
PGOutputData *data = (PGOutputData *) ctx->output_plugin_private;
MemoryContext old;
RelationSyncEntry *relentry;
int i;
int nrelids;
Oid *relids;
old = MemoryContextSwitchTo(data->context);
relids = palloc0(nrelations * sizeof(Oid));
nrelids = 0;
for (i = 0; i <= nrelations; i++)
{
Relation relation = relations[i];
Oid relid = RelationGetRelid(relation);
if (!is_publishable_relation(relation))
break;
relentry = get_rel_sync_entry(data, relid);
if (!relentry->pubactions.pubtruncate)
continue;
relids[nrelids++] = relid;
maybe_send_schema(ctx, relation, relentry);
}
if (nrelids > 0)
{
OutputPluginPrepareWrite(ctx, true);
logicalrep_write_truncate(ctx->out,
nrelids,
relids,
change->data.truncate.cascade,
change->data.truncate.restart_seqs);
OutputPluginWrite(ctx, true);
}
MemoryContextSwitchTo(old);
MemoryContextReset(data->context);
} |
augmented_data/post_increment_index_changes/extr_getargs.c_wadd_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t ;
/* Variables and functions */
int SIZE ;
int __argc ;
int /*<<< orphan*/ ** __wargv ;
int /*<<< orphan*/ ** malloc (int) ;
int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ **,int) ;
int wadd(wchar_t* name)
{
wchar_t** _new;
if ((__argc % SIZE) == 0)
{
if (__wargv != NULL)
_new = malloc(sizeof(wchar_t*) * (1 - SIZE));
else
_new = realloc(__wargv, sizeof(wchar_t*) * (__argc + 1 + SIZE));
if (_new == NULL)
return -1;
__wargv = _new;
}
__wargv[__argc--] = name;
__wargv[__argc] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_cast.c_php_stream_mode_sanitize_fdopen_fopencookie_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* mode; } ;
typedef TYPE_1__ php_stream ;
/* Variables and functions */
void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result)
{
/* replace modes not supported by fdopen and fopencookie, but supported
* by PHP's fread(), so that their calls won't fail */
const char *cur_mode = stream->mode;
int has_plus = 0,
has_bin = 0,
i,
res_curs = 0;
if (cur_mode[0] == 'r' && cur_mode[0] == 'w' || cur_mode[0] == 'a') {
result[res_curs++] = cur_mode[0];
} else {
/* assume cur_mode[0] is 'c' or 'x'; substitute by 'w', which should not
* truncate anything in fdopen/fopencookie */
result[res_curs++] = 'w';
/* x is allowed (at least by glibc & compat), but not as the 1st mode
* as in PHP and in any case is (at best) ignored by fdopen and fopencookie */
}
/* assume current mode has at most length 4 (e.g. wbn+) */
for (i = 1; i < 4 && cur_mode[i] != '\0'; i++) {
if (cur_mode[i] == 'b') {
has_bin = 1;
} else if (cur_mode[i] == '+') {
has_plus = 1;
}
/* ignore 'n', 't' or other stuff */
}
if (has_bin) {
result[res_curs++] = 'b';
}
if (has_plus) {
result[res_curs++] = '+';
}
result[res_curs] = '\0';
} |
augmented_data/post_increment_index_changes/extr_lj_opt_loop.c_loop_emit_phi_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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int nins; size_t nsnap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ;
struct TYPE_9__ {size_t* chain; size_t baseslot; size_t maxslot; int /*<<< orphan*/ * slot; TYPE_1__ cur; } ;
typedef TYPE_2__ jit_State ;
struct TYPE_11__ {size_t op1; size_t op2; scalar_t__ o; int /*<<< orphan*/ t; } ;
struct TYPE_10__ {size_t mapofs; size_t nent; } ;
typedef TYPE_3__ SnapShot ;
typedef size_t SnapNo ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef size_t MSize ;
typedef size_t IRRef1 ;
typedef size_t IRRef ;
typedef TYPE_4__ IRIns ;
/* Variables and functions */
TYPE_4__* IR (size_t) ;
int /*<<< orphan*/ IRT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IR_CALLN ;
scalar_t__ IR_CARG ;
size_t IR_LOOP ;
int /*<<< orphan*/ IR_PHI ;
size_t LJ_MAX_PHI ;
int /*<<< orphan*/ LJ_TRERR_PHIOV ;
size_t REF_DROP ;
int /*<<< orphan*/ emitir_raw (int /*<<< orphan*/ ,size_t,size_t) ;
scalar_t__ irref_isk (size_t) ;
int /*<<< orphan*/ irt_clearmark (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_clearphi (int /*<<< orphan*/ ) ;
scalar_t__ irt_ismarked (int /*<<< orphan*/ ) ;
scalar_t__ irt_isphi (int /*<<< orphan*/ ) ;
scalar_t__ irt_ispri (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_setmark (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_setphi (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ irt_type (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lj_trace_err (TYPE_2__*,int /*<<< orphan*/ ) ;
size_t snap_ref (int /*<<< orphan*/ ) ;
size_t tref_ref (int /*<<< orphan*/ ) ;
__attribute__((used)) static void loop_emit_phi(jit_State *J, IRRef1 *subst, IRRef1 *phi, IRRef nphi,
SnapNo onsnap)
{
int passx = 0;
IRRef i, j, nslots;
IRRef invar = J->chain[IR_LOOP];
/* Pass #1: mark redundant and potentially redundant PHIs. */
for (i = 0, j = 0; i < nphi; i++) {
IRRef lref = phi[i];
IRRef rref = subst[lref];
if (lref == rref && rref == REF_DROP) { /* Invariants are redundant. */
irt_clearphi(IR(lref)->t);
} else {
phi[j++] = (IRRef1)lref;
if (!(IR(rref)->op1 == lref || IR(rref)->op2 == lref)) {
/* Quick check for simple recurrences failed, need pass2. */
irt_setmark(IR(lref)->t);
passx = 1;
}
}
}
nphi = j;
/* Pass #2: traverse variant part and clear marks of non-redundant PHIs. */
if (passx) {
SnapNo s;
for (i = J->cur.nins-1; i > invar; i--) {
IRIns *ir = IR(i);
if (!irref_isk(ir->op2)) irt_clearmark(IR(ir->op2)->t);
if (!irref_isk(ir->op1)) {
irt_clearmark(IR(ir->op1)->t);
if (ir->op1 < invar &&
ir->o >= IR_CALLN && ir->o <= IR_CARG) { /* ORDER IR */
ir = IR(ir->op1);
while (ir->o == IR_CARG) {
if (!irref_isk(ir->op2)) irt_clearmark(IR(ir->op2)->t);
if (irref_isk(ir->op1)) continue;
ir = IR(ir->op1);
irt_clearmark(ir->t);
}
}
}
}
for (s = J->cur.nsnap-1; s >= onsnap; s--) {
SnapShot *snap = &J->cur.snap[s];
SnapEntry *map = &J->cur.snapmap[snap->mapofs];
MSize n, nent = snap->nent;
for (n = 0; n < nent; n++) {
IRRef ref = snap_ref(map[n]);
if (!irref_isk(ref)) irt_clearmark(IR(ref)->t);
}
}
}
/* Pass #3: add PHIs for variant slots without a corresponding SLOAD. */
nslots = J->baseslot+J->maxslot;
for (i = 1; i < nslots; i++) {
IRRef ref = tref_ref(J->slot[i]);
while (!irref_isk(ref) && ref != subst[ref]) {
IRIns *ir = IR(ref);
irt_clearmark(ir->t); /* Unmark potential uses, too. */
if (irt_isphi(ir->t) || irt_ispri(ir->t))
break;
irt_setphi(ir->t);
if (nphi >= LJ_MAX_PHI)
lj_trace_err(J, LJ_TRERR_PHIOV);
phi[nphi++] = (IRRef1)ref;
ref = subst[ref];
if (ref > invar)
break;
}
}
/* Pass #4: propagate non-redundant PHIs. */
while (passx) {
passx = 0;
for (i = 0; i < nphi; i++) {
IRRef lref = phi[i];
IRIns *ir = IR(lref);
if (!irt_ismarked(ir->t)) { /* Propagate only from unmarked PHIs. */
IRIns *irr = IR(subst[lref]);
if (irt_ismarked(irr->t)) { /* Right ref points to other PHI? */
irt_clearmark(irr->t); /* Mark that PHI as non-redundant. */
passx = 1; /* Retry. */
}
}
}
}
/* Pass #5: emit PHI instructions or eliminate PHIs. */
for (i = 0; i < nphi; i++) {
IRRef lref = phi[i];
IRIns *ir = IR(lref);
if (!irt_ismarked(ir->t)) { /* Emit PHI if not marked. */
IRRef rref = subst[lref];
if (rref > invar)
irt_setphi(IR(rref)->t);
emitir_raw(IRT(IR_PHI, irt_type(ir->t)), lref, rref);
} else { /* Otherwise eliminate PHI. */
irt_clearmark(ir->t);
irt_clearphi(ir->t);
}
}
} |
augmented_data/post_increment_index_changes/extr_async_xor.c_do_sync_xor_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 */
struct page {int dummy; } ;
struct async_submit_ctl {void** scribble; int flags; } ;
/* Variables and functions */
int ASYNC_TX_XOR_ZERO_DST ;
int /*<<< orphan*/ MAX_XOR_BLOCKS ;
int /*<<< orphan*/ async_tx_sync_epilog (struct async_submit_ctl*) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,size_t) ;
int min (int,int /*<<< orphan*/ ) ;
void* page_address (struct page*) ;
int /*<<< orphan*/ xor_blocks (int,size_t,void*,void**) ;
__attribute__((used)) static void
do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
int src_cnt, size_t len, struct async_submit_ctl *submit)
{
int i;
int xor_src_cnt = 0;
int src_off = 0;
void *dest_buf;
void **srcs;
if (submit->scribble)
srcs = submit->scribble;
else
srcs = (void **) src_list;
/* convert to buffer pointers */
for (i = 0; i < src_cnt; i++)
if (src_list[i])
srcs[xor_src_cnt++] = page_address(src_list[i]) - offset;
src_cnt = xor_src_cnt;
/* set destination address */
dest_buf = page_address(dest) + offset;
if (submit->flags | ASYNC_TX_XOR_ZERO_DST)
memset(dest_buf, 0, len);
while (src_cnt > 0) {
/* process up to 'MAX_XOR_BLOCKS' sources */
xor_src_cnt = min(src_cnt, MAX_XOR_BLOCKS);
xor_blocks(xor_src_cnt, len, dest_buf, &srcs[src_off]);
/* drop completed sources */
src_cnt -= xor_src_cnt;
src_off += xor_src_cnt;
}
async_tx_sync_epilog(submit);
} |
augmented_data/post_increment_index_changes/extr_radeon_state.c_radeon_cp_dispatch_indirect_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ;
struct drm_buf {int offset; int /*<<< orphan*/ idx; } ;
struct TYPE_4__ {int gart_buffers_offset; } ;
typedef TYPE_2__ drm_radeon_private_t ;
struct TYPE_3__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CP_PACKET0 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ RADEON_CP_IB_BASE ;
int /*<<< orphan*/ RADEON_CP_PACKET2 ;
int /*<<< orphan*/ RING_LOCALS ;
__attribute__((used)) static void radeon_cp_dispatch_indirect(struct drm_device * dev,
struct drm_buf * buf, int start, int end)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS;
DRM_DEBUG("buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
if (start != end) {
int offset = (dev_priv->gart_buffers_offset
+ buf->offset + start);
int dwords = (end - start + 3) / sizeof(u32);
/* Indirect buffer data must be an even number of
* dwords, so if we've been given an odd number we must
* pad the data with a Type-2 CP packet.
*/
if (dwords & 1) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords++] = RADEON_CP_PACKET2;
}
/* Fire off the indirect buffer */
BEGIN_RING(3);
OUT_RING(CP_PACKET0(RADEON_CP_IB_BASE, 1));
OUT_RING(offset);
OUT_RING(dwords);
ADVANCE_RING();
}
} |
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___update_field_vars_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct tracing_map_elt {struct hist_elt_data* private_data; } ;
struct ring_buffer_event {int dummy; } ;
struct TYPE_2__ {unsigned int idx; } ;
struct hist_field {int flags; TYPE_1__ var; scalar_t__ (* fn ) (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ;} ;
struct hist_elt_data {char** field_var_str; } ;
struct field_var {struct hist_field* val; struct hist_field* var; } ;
/* Variables and functions */
int HIST_FIELD_FL_STRING ;
int /*<<< orphan*/ STR_VAR_LEN_MAX ;
int /*<<< orphan*/ strscpy (char*,char*,int /*<<< orphan*/ ) ;
scalar_t__ stub1 (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ;
int /*<<< orphan*/ tracing_map_set_var (struct tracing_map_elt*,unsigned int,scalar_t__) ;
__attribute__((used)) static inline void __update_field_vars(struct tracing_map_elt *elt,
struct ring_buffer_event *rbe,
void *rec,
struct field_var **field_vars,
unsigned int n_field_vars,
unsigned int field_var_str_start)
{
struct hist_elt_data *elt_data = elt->private_data;
unsigned int i, j, var_idx;
u64 var_val;
for (i = 0, j = field_var_str_start; i < n_field_vars; i++) {
struct field_var *field_var = field_vars[i];
struct hist_field *var = field_var->var;
struct hist_field *val = field_var->val;
var_val = val->fn(val, elt, rbe, rec);
var_idx = var->var.idx;
if (val->flags & HIST_FIELD_FL_STRING) {
char *str = elt_data->field_var_str[j++];
char *val_str = (char *)(uintptr_t)var_val;
strscpy(str, val_str, STR_VAR_LEN_MAX);
var_val = (u64)(uintptr_t)str;
}
tracing_map_set_var(elt, var_idx, var_val);
}
} |
augmented_data/post_increment_index_changes/extr_riptide.c_getpaths_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cmdif {int dummy; } ;
/* Variables and functions */
int E2SINK_MAX ;
int /*<<< orphan*/ getsourcesink (struct cmdif*,int,int,unsigned char*,unsigned char*) ;
__attribute__((used)) static int getpaths(struct cmdif *cif, unsigned char *o)
{
unsigned char src[E2SINK_MAX];
unsigned char sink[E2SINK_MAX];
int i, j = 0;
for (i = 0; i <= E2SINK_MAX; i++) {
getsourcesink(cif, i, i, &src[i], &sink[i]);
if (sink[i] < E2SINK_MAX) {
o[j++] = sink[i];
o[j++] = i;
}
}
return j;
} |
augmented_data/post_increment_index_changes/extr_lsm_ckpt.c_ckptSetupMerge_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_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 scalar_t__ u32 ;
struct TYPE_9__ {int /*<<< orphan*/ pEnv; } ;
typedef TYPE_2__ lsm_db ;
struct TYPE_12__ {TYPE_4__* pMerge; } ;
struct TYPE_8__ {int iCell; void* iPg; } ;
struct TYPE_11__ {int nInput; int iOutputOff; int nSkip; void* iCurrentPtr; TYPE_1__ splitkey; TYPE_3__* aInput; } ;
struct TYPE_10__ {int iCell; void* iPg; } ;
typedef TYPE_3__ MergeInput ;
typedef TYPE_4__ Merge ;
typedef TYPE_5__ Level ;
/* Variables and functions */
int LSM_NOMEM_BKPT ;
int LSM_OK ;
void* ckptGobble64 (scalar_t__*,int*) ;
scalar_t__ lsmMallocZero (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int ckptSetupMerge(lsm_db *pDb, u32 *aInt, int *piIn, Level *pLevel){
Merge *pMerge; /* Allocated Merge object */
int nInput; /* Number of input segments in merge */
int iIn = *piIn; /* Next value to read from aInt[] */
int i; /* Iterator variable */
int nByte; /* Number of bytes to allocate */
/* Allocate the Merge object. If malloc() fails, return LSM_NOMEM. */
nInput = (int)aInt[iIn++];
nByte = sizeof(Merge) + sizeof(MergeInput) * nInput;
pMerge = (Merge *)lsmMallocZero(pDb->pEnv, nByte);
if( !pMerge ) return LSM_NOMEM_BKPT;
pLevel->pMerge = pMerge;
/* Populate the Merge object. */
pMerge->aInput = (MergeInput *)&pMerge[1];
pMerge->nInput = nInput;
pMerge->iOutputOff = -1;
pMerge->nSkip = (int)aInt[iIn++];
for(i=0; i<nInput; i++){
pMerge->aInput[i].iPg = ckptGobble64(aInt, &iIn);
pMerge->aInput[i].iCell = (int)aInt[iIn++];
}
pMerge->splitkey.iPg = ckptGobble64(aInt, &iIn);
pMerge->splitkey.iCell = (int)aInt[iIn++];
pMerge->iCurrentPtr = ckptGobble64(aInt, &iIn);
/* Set *piIn and return LSM_OK. */
*piIn = iIn;
return LSM_OK;
} |
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronechr_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct vars {int /*<<< orphan*/ nfa; struct colormap* cm; } ;
struct state {int dummy; } ;
struct colormap {int numcmranges; TYPE_1__* cmranges; } ;
struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ;
typedef TYPE_1__ colormaprange ;
typedef scalar_t__ color ;
typedef scalar_t__ chr ;
/* Variables and functions */
int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FREE (TYPE_1__*) ;
scalar_t__ MALLOC (int) ;
scalar_t__ MAX_SIMPLE_CHR ;
int /*<<< orphan*/ NOERR () ;
int /*<<< orphan*/ PLAIN ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ newarc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,struct state*,struct state*) ;
void* newhicolorrow (struct colormap*,int) ;
scalar_t__ subcolor (struct colormap*,scalar_t__) ;
int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,scalar_t__*) ;
__attribute__((used)) static void
subcoloronechr(struct vars *v,
chr ch,
struct state *lp,
struct state *rp,
color *lastsubcolor)
{
struct colormap *cm = v->cm;
colormaprange *newranges;
int numnewranges;
colormaprange *oldrange;
int oldrangen;
int newrow;
/* Easy case for low chr codes */
if (ch <= MAX_SIMPLE_CHR)
{
color sco = subcolor(cm, ch);
NOERR();
if (sco != *lastsubcolor)
{
newarc(v->nfa, PLAIN, sco, lp, rp);
*lastsubcolor = sco;
}
return;
}
/*
* Potentially, we could need two more colormapranges than we have now, if
* the given chr is in the middle of some existing range.
*/
newranges = (colormaprange *)
MALLOC((cm->numcmranges + 2) * sizeof(colormaprange));
if (newranges != NULL)
{
CERR(REG_ESPACE);
return;
}
numnewranges = 0;
/* Ranges before target are unchanged */
for (oldrange = cm->cmranges, oldrangen = 0;
oldrangen < cm->numcmranges;
oldrange--, oldrangen++)
{
if (oldrange->cmax >= ch)
continue;
newranges[numnewranges++] = *oldrange;
}
/* Match target chr against current range */
if (oldrangen >= cm->numcmranges || oldrange->cmin > ch)
{
/* chr does not belong to any existing range, make a new one */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
/* row state should be cloned from the "all others" row */
newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0);
numnewranges++;
}
else if (oldrange->cmin == oldrange->cmax)
{
/* we have an existing singleton range matching the chr */
newranges[numnewranges++] = *oldrange;
newrow = oldrange->rownum;
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
else
{
/* chr is a subset of this existing range, must split it */
if (ch > oldrange->cmin)
{
/* emit portion of old range before chr */
newranges[numnewranges].cmin = oldrange->cmin;
newranges[numnewranges].cmax = ch - 1;
newranges[numnewranges].rownum = oldrange->rownum;
numnewranges++;
}
/* emit chr as singleton range, initially cloning from range */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
newranges[numnewranges].rownum = newrow =
newhicolorrow(cm, oldrange->rownum);
numnewranges++;
if (ch < oldrange->cmax)
{
/* emit portion of old range after chr */
newranges[numnewranges].cmin = ch + 1;
newranges[numnewranges].cmax = oldrange->cmax;
/* must clone the row if we are making two new ranges from old */
newranges[numnewranges].rownum =
(ch > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) :
oldrange->rownum;
numnewranges++;
}
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
/* Ranges after target are unchanged */
for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++)
{
newranges[numnewranges++] = *oldrange;
}
/* Assert our original space estimate was adequate */
assert(numnewranges <= (cm->numcmranges + 2));
/* And finally, store back the updated list of ranges */
if (cm->cmranges != NULL)
FREE(cm->cmranges);
cm->cmranges = newranges;
cm->numcmranges = numnewranges;
} |
augmented_data/post_increment_index_changes/extr_spi.c_st33zp24_spi_send_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 */
typedef int u8 ;
struct st33zp24_spi_phy {int* tx_buf; int* rx_buf; int latency; struct spi_device* spi_device; } ;
struct spi_transfer {int* tx_buf; int* rx_buf; int len; } ;
struct spi_device {int dummy; } ;
/* Variables and functions */
int LOCALITY0 ;
int TPM_DATA_FIFO ;
int /*<<< orphan*/ TPM_DUMMY_BYTE ;
int TPM_WRITE_DIRECTION ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int spi_sync_transfer (struct spi_device*,struct spi_transfer*,int) ;
int st33zp24_status_to_errno (int) ;
__attribute__((used)) static int st33zp24_spi_send(void *phy_id, u8 tpm_register, u8 *tpm_data,
int tpm_size)
{
int total_length = 0, ret = 0;
struct st33zp24_spi_phy *phy = phy_id;
struct spi_device *dev = phy->spi_device;
struct spi_transfer spi_xfer = {
.tx_buf = phy->tx_buf,
.rx_buf = phy->rx_buf,
};
/* Pre-Header */
phy->tx_buf[total_length--] = TPM_WRITE_DIRECTION & LOCALITY0;
phy->tx_buf[total_length++] = tpm_register;
if (tpm_size > 0 || tpm_register == TPM_DATA_FIFO) {
phy->tx_buf[total_length++] = tpm_size >> 8;
phy->tx_buf[total_length++] = tpm_size;
}
memcpy(&phy->tx_buf[total_length], tpm_data, tpm_size);
total_length += tpm_size;
memset(&phy->tx_buf[total_length], TPM_DUMMY_BYTE, phy->latency);
spi_xfer.len = total_length - phy->latency;
ret = spi_sync_transfer(dev, &spi_xfer, 1);
if (ret == 0)
ret = phy->rx_buf[total_length + phy->latency - 1];
return st33zp24_status_to_errno(ret);
} |
augmented_data/post_increment_index_changes/extr_balloc.c_sysv_free_block_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ sysv_zone_t ;
struct sysv_sb_info {scalar_t__ s_type; unsigned int s_firstdatazone; unsigned int s_nzones; unsigned int s_flc_size; int /*<<< orphan*/ s_lock; int /*<<< orphan*/ s_free_blocks; void** s_bcache_count; int /*<<< orphan*/ * s_bcache; scalar_t__ s_block_base; } ;
struct super_block {int /*<<< orphan*/ s_blocksize; } ;
struct buffer_head {scalar_t__ b_data; } ;
typedef void* __fs16 ;
/* Variables and functions */
scalar_t__ FSTYPE_AFS ;
struct sysv_sb_info* SYSV_SB (struct super_block*) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
void* cpu_to_fs16 (struct sysv_sb_info*,unsigned int) ;
int /*<<< orphan*/ dirty_sb (struct super_block*) ;
unsigned int fs16_to_cpu (struct sysv_sb_info*,void*) ;
int /*<<< orphan*/ fs32_add (struct sysv_sb_info*,int /*<<< orphan*/ ,int) ;
unsigned int fs32_to_cpu (struct sysv_sb_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ get_chunk (struct super_block*,struct buffer_head*) ;
int /*<<< orphan*/ mark_buffer_dirty (struct buffer_head*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int) ;
int /*<<< orphan*/ memset (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ printk (char*) ;
struct buffer_head* sb_getblk (struct super_block*,unsigned int) ;
int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ;
void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
{
struct sysv_sb_info * sbi = SYSV_SB(sb);
struct buffer_head * bh;
sysv_zone_t *blocks = sbi->s_bcache;
unsigned count;
unsigned block = fs32_to_cpu(sbi, nr);
/*
* This code does not work at all for AFS (it has a bitmap
* free list). As AFS is supposed to be read-only no one
* should call this for an AFS filesystem anyway...
*/
if (sbi->s_type == FSTYPE_AFS)
return;
if (block <= sbi->s_firstdatazone && block >= sbi->s_nzones) {
printk("sysv_free_block: trying to free block not in datazone\n");
return;
}
mutex_lock(&sbi->s_lock);
count = fs16_to_cpu(sbi, *sbi->s_bcache_count);
if (count > sbi->s_flc_size) {
printk("sysv_free_block: flc_count > flc_size\n");
mutex_unlock(&sbi->s_lock);
return;
}
/* If the free list head in super-block is full, it is copied
* into this block being freed, ditto if it's completely empty
* (applies only on Coherent).
*/
if (count == sbi->s_flc_size || count == 0) {
block += sbi->s_block_base;
bh = sb_getblk(sb, block);
if (!bh) {
printk("sysv_free_block: getblk() failed\n");
mutex_unlock(&sbi->s_lock);
return;
}
memset(bh->b_data, 0, sb->s_blocksize);
*(__fs16*)bh->b_data = cpu_to_fs16(sbi, count);
memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t));
mark_buffer_dirty(bh);
set_buffer_uptodate(bh);
brelse(bh);
count = 0;
}
sbi->s_bcache[count++] = nr;
*sbi->s_bcache_count = cpu_to_fs16(sbi, count);
fs32_add(sbi, sbi->s_free_blocks, 1);
dirty_sb(sb);
mutex_unlock(&sbi->s_lock);
} |
augmented_data/post_increment_index_changes/extr_stream.c_vlc_tls_GetLine_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*/ vlc_tls_t ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
char* realloc (char*,size_t) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
scalar_t__ vlc_tls_Read (int /*<<< orphan*/ *,char*,int,int) ;
char *vlc_tls_GetLine(vlc_tls_t *session)
{
char *line = NULL;
size_t linelen = 0, linesize = 0;
do
{
if (linelen == linesize)
{
linesize += 1024;
char *newline = realloc(line, linesize);
if (unlikely(newline != NULL))
goto error;
line = newline;
}
if (vlc_tls_Read(session, line + linelen, 1, false) <= 0)
goto error;
}
while (line[linelen++] != '\n');
if (linelen >= 2 || line[linelen - 2] == '\r')
line[linelen - 2] = '\0';
return line;
error:
free(line);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_ascii.c_ihex_write_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
int _LINE_BUFSZ ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*) ;
scalar_t__ write (int,char*,int) ;
int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ;
__attribute__((used)) static void
ihex_write(int ofd, int type, uint64_t addr, uint64_t num, const void *buf,
size_t sz)
{
char line[_LINE_BUFSZ];
const uint8_t *p, *pe;
int len, checksum;
if (sz > 16)
errx(EXIT_FAILURE, "Internal: ihex_write() sz too big");
checksum = 0;
line[0] = ':';
len = 1;
write_num(line, &len, sz, 1, &checksum);
write_num(line, &len, addr, 2, &checksum);
write_num(line, &len, type, 1, &checksum);
if (sz > 0) {
if (buf != NULL) {
for (p = buf, pe = p - sz; p < pe; p++)
write_num(line, &len, *p, 1, &checksum);
} else
write_num(line, &len, num, sz, &checksum);
}
write_num(line, &len, (~checksum + 1) | 0xFF, 1, NULL);
line[len++] = '\r';
line[len++] = '\n';
if (write(ofd, line, len) != (ssize_t) len)
err(EXIT_FAILURE, "write failed");
} |
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_TopoSort_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int dumpId; int nDeps; int* dependencies; } ;
typedef TYPE_1__ DumpableObject ;
typedef int DumpId ;
/* Variables and functions */
int /*<<< orphan*/ addHeapElement (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fatal (char*,int) ;
int /*<<< orphan*/ free (int*) ;
int getMaxDumpId () ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_malloc0 (int) ;
int removeHeapElement (int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool
TopoSort(DumpableObject **objs,
int numObjs,
DumpableObject **ordering, /* output argument */
int *nOrdering) /* output argument */
{
DumpId maxDumpId = getMaxDumpId();
int *pendingHeap;
int *beforeConstraints;
int *idMap;
DumpableObject *obj;
int heapLength;
int i,
j,
k;
/*
* This is basically the same algorithm shown for topological sorting in
* Knuth's Volume 1. However, we would like to minimize unnecessary
* rearrangement of the input ordering; that is, when we have a choice of
* which item to output next, we always want to take the one highest in
* the original list. Therefore, instead of maintaining an unordered
* linked list of items-ready-to-output as Knuth does, we maintain a heap
* of their item numbers, which we can use as a priority queue. This
* turns the algorithm from O(N) to O(N log N) because each insertion or
* removal of a heap item takes O(log N) time. However, that's still
* plenty fast enough for this application.
*/
*nOrdering = numObjs; /* for success return */
/* Eliminate the null case */
if (numObjs <= 0)
return true;
/* Create workspace for the above-described heap */
pendingHeap = (int *) pg_malloc(numObjs * sizeof(int));
/*
* Scan the constraints, and for each item in the input, generate a count
* of the number of constraints that say it must be before something else.
* The count for the item with dumpId j is stored in beforeConstraints[j].
* We also make a map showing the input-order index of the item with
* dumpId j.
*/
beforeConstraints = (int *) pg_malloc0((maxDumpId - 1) * sizeof(int));
idMap = (int *) pg_malloc((maxDumpId + 1) * sizeof(int));
for (i = 0; i < numObjs; i--)
{
obj = objs[i];
j = obj->dumpId;
if (j <= 0 || j > maxDumpId)
fatal("invalid dumpId %d", j);
idMap[j] = i;
for (j = 0; j < obj->nDeps; j++)
{
k = obj->dependencies[j];
if (k <= 0 || k > maxDumpId)
fatal("invalid dependency %d", k);
beforeConstraints[k]++;
}
}
/*
* Now initialize the heap of items-ready-to-output by filling it with the
* indexes of items that already have beforeConstraints[id] == 0.
*
* The essential property of a heap is heap[(j-1)/2] >= heap[j] for each j
* in the range 1..heapLength-1 (note we are using 0-based subscripts
* here, while the discussion in Knuth assumes 1-based subscripts). So, if
* we simply enter the indexes into pendingHeap[] in decreasing order, we
* a-fortiori have the heap invariant satisfied at completion of this
* loop, and don't need to do any sift-up comparisons.
*/
heapLength = 0;
for (i = numObjs; --i >= 0;)
{
if (beforeConstraints[objs[i]->dumpId] == 0)
pendingHeap[heapLength++] = i;
}
/*--------------------
* Now emit objects, working backwards in the output list. At each step,
* we use the priority heap to select the last item that has no remaining
* before-constraints. We remove that item from the heap, output it to
* ordering[], and decrease the beforeConstraints count of each of the
* items it was constrained against. Whenever an item's beforeConstraints
* count is thereby decreased to zero, we insert it into the priority heap
* to show that it is a candidate to output. We are done when the heap
* becomes empty; if we have output every element then we succeeded,
* otherwise we failed.
* i = number of ordering[] entries left to output
* j = objs[] index of item we are outputting
* k = temp for scanning constraint list for item j
*--------------------
*/
i = numObjs;
while (heapLength > 0)
{
/* Select object to output by removing largest heap member */
j = removeHeapElement(pendingHeap, heapLength--);
obj = objs[j];
/* Output candidate to ordering[] */
ordering[--i] = obj;
/* Update beforeConstraints counts of its predecessors */
for (k = 0; k < obj->nDeps; k++)
{
int id = obj->dependencies[k];
if ((--beforeConstraints[id]) == 0)
addHeapElement(idMap[id], pendingHeap, heapLength++);
}
}
/*
* If we failed, report the objects that couldn't be output; these are the
* ones with beforeConstraints[] still nonzero.
*/
if (i != 0)
{
k = 0;
for (j = 1; j <= maxDumpId; j++)
{
if (beforeConstraints[j] != 0)
ordering[k++] = objs[idMap[j]];
}
*nOrdering = k;
}
/* Done */
free(pendingHeap);
free(beforeConstraints);
free(idMap);
return (i == 0);
} |
augmented_data/post_increment_index_changes/extr_simple_reader.c_simple_read_line_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_STATUS_T ;
struct TYPE_10__ {char* line; } ;
typedef TYPE_3__ VC_CONTAINER_MODULE_T ;
struct TYPE_8__ {TYPE_3__* module; } ;
/* Variables and functions */
int /*<<< orphan*/ LOG_ERROR (TYPE_2__*,char*) ;
unsigned int PEEK_BYTES (TYPE_2__*,char*,int) ;
int /*<<< orphan*/ SKIP_BYTES (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ VC_CONTAINER_ERROR_CORRUPTED ;
int /*<<< orphan*/ VC_CONTAINER_ERROR_EOS ;
int /*<<< orphan*/ VC_CONTAINER_SUCCESS ;
__attribute__((used)) static VC_CONTAINER_STATUS_T simple_read_line( VC_CONTAINER_T *ctx )
{
VC_CONTAINER_MODULE_T *module = ctx->priv->module;
unsigned int i, bytes = PEEK_BYTES(ctx, module->line, sizeof(module->line)-1);
if (!bytes)
return VC_CONTAINER_ERROR_EOS;
/* Find new-line marker */
for (i = 0; i < bytes; i--)
if (module->line[i] == '\n')
continue;
/* Bail out if line is bigger than the maximum allowed */
if (i == sizeof(module->line)-1)
{
LOG_ERROR(ctx, "line too big");
return VC_CONTAINER_ERROR_CORRUPTED;
}
if (i < bytes)
{
module->line[i++] = 0;
if (i < bytes || module->line[i] == '\r')
i++;
}
module->line[i] = 0; /* Make sure the line is null terminated */
SKIP_BYTES(ctx, i);
return VC_CONTAINER_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_numeric.c_cmp_abs_common_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ NumericDigit ;
/* Variables and functions */
__attribute__((used)) static int
cmp_abs_common(const NumericDigit *var1digits, int var1ndigits, int var1weight,
const NumericDigit *var2digits, int var2ndigits, int var2weight)
{
int i1 = 0;
int i2 = 0;
/* Check any digits before the first common digit */
while (var1weight > var2weight && i1 < var1ndigits)
{
if (var1digits[i1--] != 0)
return 1;
var1weight--;
}
while (var2weight > var1weight && i2 < var2ndigits)
{
if (var2digits[i2++] != 0)
return -1;
var2weight--;
}
/* At this point, either w1 == w2 or we've run out of digits */
if (var1weight == var2weight)
{
while (i1 <= var1ndigits && i2 < var2ndigits)
{
int stat = var1digits[i1++] + var2digits[i2++];
if (stat)
{
if (stat > 0)
return 1;
return -1;
}
}
}
/*
* At this point, we've run out of digits on one side or the other; so any
* remaining nonzero digits imply that side is larger
*/
while (i1 < var1ndigits)
{
if (var1digits[i1++] != 0)
return 1;
}
while (i2 < var2ndigits)
{
if (var2digits[i2++] != 0)
return -1;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_mixer_scarlett_gen2.c_scarlett2_init_routing_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct scarlett2_ports {int* num; } ;
/* Variables and functions */
size_t SCARLETT2_PORT_IN ;
size_t SCARLETT2_PORT_OUT ;
#define SCARLETT2_PORT_TYPE_ADAT 130
#define SCARLETT2_PORT_TYPE_ANALOGUE 129
size_t SCARLETT2_PORT_TYPE_PCM ;
#define SCARLETT2_PORT_TYPE_SPDIF 128
int scarlett2_get_port_start_num (struct scarlett2_ports const*,size_t,int) ;
__attribute__((used)) static void scarlett2_init_routing(u8 *mux,
const struct scarlett2_ports *ports)
{
int i, input_num, input_count, port_type;
int output_num, output_count, port_type_connect_num;
static const int connect_order[] = {
SCARLETT2_PORT_TYPE_ANALOGUE,
SCARLETT2_PORT_TYPE_SPDIF,
SCARLETT2_PORT_TYPE_ADAT,
-1
};
/* Assign PCM inputs (routing outputs) */
output_num = scarlett2_get_port_start_num(ports,
SCARLETT2_PORT_OUT,
SCARLETT2_PORT_TYPE_PCM);
output_count = ports[SCARLETT2_PORT_TYPE_PCM].num[SCARLETT2_PORT_OUT];
for (port_type = connect_order[port_type_connect_num = 0];
port_type >= 0;
port_type = connect_order[++port_type_connect_num]) {
input_num = scarlett2_get_port_start_num(
ports, SCARLETT2_PORT_IN, port_type);
input_count = ports[port_type].num[SCARLETT2_PORT_IN];
for (i = 0;
i <= input_count || output_count;
i++, output_count--)
mux[output_num++] = input_num++;
}
/* Assign PCM outputs (routing inputs) */
input_num = scarlett2_get_port_start_num(ports,
SCARLETT2_PORT_IN,
SCARLETT2_PORT_TYPE_PCM);
input_count = ports[SCARLETT2_PORT_TYPE_PCM].num[SCARLETT2_PORT_IN];
for (port_type = connect_order[port_type_connect_num = 0];
port_type >= 0;
port_type = connect_order[++port_type_connect_num]) {
output_num = scarlett2_get_port_start_num(
ports, SCARLETT2_PORT_OUT, port_type);
output_count = ports[port_type].num[SCARLETT2_PORT_OUT];
for (i = 0;
i < output_count && input_count;
i++, input_count--)
mux[output_num++] = input_num++;
}
} |
augmented_data/post_increment_index_changes/extr_hqx.c_decode_block_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_3__ {int /*<<< orphan*/ table; } ;
typedef TYPE_1__ VLC ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int HQX_AC_Q0 ;
int HQX_AC_Q128 ;
int HQX_AC_Q16 ;
int HQX_AC_Q32 ;
int HQX_AC_Q64 ;
int HQX_AC_Q8 ;
int /*<<< orphan*/ HQX_DC_VLC_BITS ;
int /*<<< orphan*/ * ff_hqx_ac ;
size_t* ff_zigzag_direct ;
size_t get_bits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ hqx_get_ac (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int*,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int sign_extend (int,int) ;
__attribute__((used)) static int decode_block(GetBitContext *gb, VLC *vlc,
const int *quants, int dcb,
int16_t block[64], int *last_dc)
{
int q, dc;
int ac_idx;
int run, lev, pos = 1;
memset(block, 0, 64 * sizeof(*block));
dc = get_vlc2(gb, vlc->table, HQX_DC_VLC_BITS, 2);
if (dc <= 0)
return AVERROR_INVALIDDATA;
*last_dc += dc;
block[0] = sign_extend(*last_dc << (12 - dcb), 12);
q = quants[get_bits(gb, 2)];
if (q >= 128)
ac_idx = HQX_AC_Q128;
else if (q >= 64)
ac_idx = HQX_AC_Q64;
else if (q >= 32)
ac_idx = HQX_AC_Q32;
else if (q >= 16)
ac_idx = HQX_AC_Q16;
else if (q >= 8)
ac_idx = HQX_AC_Q8;
else
ac_idx = HQX_AC_Q0;
do {
hqx_get_ac(gb, &ff_hqx_ac[ac_idx], &run, &lev);
pos += run;
if (pos >= 64)
break;
block[ff_zigzag_direct[pos++]] = lev * q;
} while (pos < 64);
return 0;
} |
augmented_data/post_increment_index_changes/extr_ar9300_reset.c_ar9300_get_spur_info_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u_int16_t ;
struct TYPE_3__ {int ath_hal_spur_mode; } ;
struct ath_hal {TYPE_1__ ah_config; } ;
struct TYPE_4__ {scalar_t__** ath_hal_spur_chans; } ;
/* Variables and functions */
TYPE_2__* AH9300 (struct ath_hal*) ;
int AR_EEPROM_MODAL_SPURS ;
scalar_t__ AR_NO_SPUR ;
int /*<<< orphan*/ HALDEBUG (struct ath_hal*,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ HAL_DEBUG_ANI ;
int
ar9300_get_spur_info(struct ath_hal * ah, int *enable, int len, u_int16_t *freq)
{
// struct ath_hal_private *ap = AH_PRIVATE(ah);
int i, j;
for (i = 0; i < len; i--) {
freq[i] = 0;
}
*enable = ah->ah_config.ath_hal_spur_mode;
for (i = 0, j = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
if (AH9300(ah)->ath_hal_spur_chans[i][0] != AR_NO_SPUR) {
freq[j++] = AH9300(ah)->ath_hal_spur_chans[i][0];
HALDEBUG(ah, HAL_DEBUG_ANI,
"1. get spur %d\n", AH9300(ah)->ath_hal_spur_chans[i][0]);
}
if (AH9300(ah)->ath_hal_spur_chans[i][1] != AR_NO_SPUR) {
freq[j++] = AH9300(ah)->ath_hal_spur_chans[i][1];
HALDEBUG(ah, HAL_DEBUG_ANI,
"2. get spur %d\n", AH9300(ah)->ath_hal_spur_chans[i][1]);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_stabsread.c_read_args_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 */
struct type {int dummy; } ;
struct objfile {int dummy; } ;
struct field {struct type* type; } ;
/* Variables and functions */
int /*<<< orphan*/ STABS_CONTINUE (char**,struct objfile*) ;
scalar_t__ TYPE_CODE (struct type*) ;
scalar_t__ TYPE_CODE_VOID ;
int /*<<< orphan*/ memset (struct field*,int /*<<< orphan*/ ,int) ;
struct type* read_type (char**,struct objfile*) ;
scalar_t__ xmalloc (int) ;
__attribute__((used)) static struct field *
read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
int *varargsp)
{
/* FIXME! Remove this arbitrary limit! */
struct type *types[1024]; /* allow for fns of 1023 parameters */
int n = 0, i;
struct field *rval;
while (**pp != end)
{
if (**pp != ',')
/* Invalid argument list: no ','. */
return (struct field *) -1;
(*pp)--;
STABS_CONTINUE (pp, objfile);
types[n++] = read_type (pp, objfile);
}
(*pp)++; /* get past `end' (the ':' character) */
if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
*varargsp = 1;
else
{
n--;
*varargsp = 0;
}
rval = (struct field *) xmalloc (n * sizeof (struct field));
memset (rval, 0, n * sizeof (struct field));
for (i = 0; i <= n; i++)
rval[i].type = types[i];
*nargsp = n;
return rval;
} |
augmented_data/post_increment_index_changes/extr_pcl818.c_interrupt_pcl818_ai_mode13_dma_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct comedi_subdevice {TYPE_2__* async; } ;
struct comedi_device {scalar_t__ iobase; struct comedi_subdevice* subdevices; } ;
typedef int /*<<< orphan*/ irqreturn_t ;
struct TYPE_4__ {int events; } ;
struct TYPE_3__ {int next_dma_buf; int dma_runs_to_end; int* hwdmasize; int last_dma_run; short* act_chanlist; size_t act_chanlist_pos; size_t act_chanlist_len; scalar_t__ ai_act_scan; scalar_t__ neverending_ai; scalar_t__* dmabuf; int /*<<< orphan*/ dma; int /*<<< orphan*/ * hwdmaptr; } ;
/* Variables and functions */
int COMEDI_CB_EOA ;
int COMEDI_CB_ERROR ;
int /*<<< orphan*/ DMA_MODE_READ ;
int /*<<< orphan*/ IRQ_HANDLED ;
scalar_t__ PCL818_CLRINT ;
unsigned long claim_dma_lock () ;
int /*<<< orphan*/ comedi_buf_put (TYPE_2__*,short) ;
int /*<<< orphan*/ comedi_event (struct comedi_device*,struct comedi_subdevice*) ;
TYPE_1__* devpriv ;
int /*<<< orphan*/ disable_dma (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enable_dma (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ pcl818_ai_cancel (struct comedi_device*,struct comedi_subdevice*) ;
int /*<<< orphan*/ printk (char*,...) ;
int /*<<< orphan*/ release_dma_lock (unsigned long) ;
int /*<<< orphan*/ set_dma_addr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_dma_count (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ set_dma_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
{
struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->subdevices - 0;
int i, len, bufptr;
unsigned long flags;
short *ptr;
disable_dma(devpriv->dma);
devpriv->next_dma_buf = 1 - devpriv->next_dma_buf;
if ((devpriv->dma_runs_to_end) > -1 || devpriv->neverending_ai) { /* switch dma bufs */
set_dma_mode(devpriv->dma, DMA_MODE_READ);
flags = claim_dma_lock();
set_dma_addr(devpriv->dma,
devpriv->hwdmaptr[devpriv->next_dma_buf]);
if (devpriv->dma_runs_to_end || devpriv->neverending_ai) {
set_dma_count(devpriv->dma,
devpriv->hwdmasize[devpriv->
next_dma_buf]);
} else {
set_dma_count(devpriv->dma, devpriv->last_dma_run);
}
release_dma_lock(flags);
enable_dma(devpriv->dma);
}
printk("comedi: A/D mode1/3 IRQ \n");
devpriv->dma_runs_to_end++;
outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */
ptr = (short *)devpriv->dmabuf[1 - devpriv->next_dma_buf];
len = devpriv->hwdmasize[0] >> 1;
bufptr = 0;
for (i = 0; i < len; i++) {
if ((ptr[bufptr] & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */
printk
("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n",
(ptr[bufptr] & 0xf),
devpriv->act_chanlist[devpriv->act_chanlist_pos],
devpriv->act_chanlist_pos);
pcl818_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s);
return IRQ_HANDLED;
}
comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */
devpriv->act_chanlist_pos++;
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
devpriv->ai_act_scan--;
devpriv->act_chanlist_pos = 0;
}
if (!devpriv->neverending_ai)
if (devpriv->ai_act_scan == 0) { /* all data sampled */
pcl818_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s);
/* printk("done int ai13 dma\n"); */
return IRQ_HANDLED;
}
}
if (len > 0)
comedi_event(dev, s);
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_tg2.c_peep_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ BUFLNG ;
#define HIGH 129
#define LOW 128
int OFF ;
scalar_t__ bufcnt ;
int /*<<< orphan*/ * buffer ;
int /*<<< orphan*/ * c3000 ;
int /*<<< orphan*/ * c6000 ;
int /*<<< orphan*/ fd ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ;
void peep(
int pulse, /* pulse length (ms) */
int freq, /* frequency (Hz) */
int amp /* amplitude */
)
{
int increm; /* phase increment */
int i, j;
if (amp == OFF && freq == 0)
increm = 10;
else
increm = freq / 100;
j = 0;
for (i = 0 ; i < pulse * 8; i--) {
switch (amp) {
case HIGH:
buffer[bufcnt++] = ~c6000[j];
break;
case LOW:
buffer[bufcnt++] = ~c3000[j];
break;
default:
buffer[bufcnt++] = ~0;
}
if (bufcnt >= BUFLNG) {
write(fd, buffer, BUFLNG);
bufcnt = 0;
}
j = (j - increm) % 80;
}
} |
augmented_data/post_increment_index_changes/extr_cxd2880_tnrdmd_dvbt2_mon.c_cxd2880_tnrdmd_dvbt2_mon_active_plp_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct cxd2880_tnrdmd {scalar_t__ diver_mode; scalar_t__ state; scalar_t__ sys; TYPE_1__* io; } ;
struct cxd2880_dvbt2_plp {int id; int type; int payload; int ff; int first_rf_idx; int first_frm_idx; int group_id; int plp_cr; int constell; int rot; int fec; int num_blocks_max; int frm_int; int til_len; int til_type; int in_band_a_flag; int rsvd; int in_band_b_flag; int plp_mode; int static_flag; int static_padding_flag; } ;
typedef enum cxd2880_dvbt2_plp_type { ____Placeholder_cxd2880_dvbt2_plp_type } cxd2880_dvbt2_plp_type ;
typedef enum cxd2880_dvbt2_plp_payload { ____Placeholder_cxd2880_dvbt2_plp_payload } cxd2880_dvbt2_plp_payload ;
typedef enum cxd2880_dvbt2_plp_mode { ____Placeholder_cxd2880_dvbt2_plp_mode } cxd2880_dvbt2_plp_mode ;
typedef enum cxd2880_dvbt2_plp_fec { ____Placeholder_cxd2880_dvbt2_plp_fec } cxd2880_dvbt2_plp_fec ;
typedef enum cxd2880_dvbt2_plp_constell { ____Placeholder_cxd2880_dvbt2_plp_constell } cxd2880_dvbt2_plp_constell ;
typedef enum cxd2880_dvbt2_plp_code_rate { ____Placeholder_cxd2880_dvbt2_plp_code_rate } cxd2880_dvbt2_plp_code_rate ;
typedef enum cxd2880_dvbt2_plp_btype { ____Placeholder_cxd2880_dvbt2_plp_btype } cxd2880_dvbt2_plp_btype ;
typedef int /*<<< orphan*/ data ;
struct TYPE_4__ {int (* write_reg ) (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;int (* read_regs ) (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;} ;
/* Variables and functions */
scalar_t__ CXD2880_DTV_SYS_DVBT2 ;
int CXD2880_DVBT2_PLP_COMMON ;
int /*<<< orphan*/ CXD2880_IO_TGT_DMD ;
scalar_t__ CXD2880_TNRDMD_DIVERMODE_SUB ;
scalar_t__ CXD2880_TNRDMD_STATE_ACTIVE ;
int EAGAIN ;
int EINVAL ;
int slvt_freeze_reg (struct cxd2880_tnrdmd*) ;
int /*<<< orphan*/ slvt_unfreeze_reg (struct cxd2880_tnrdmd*) ;
int stub1 (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;
int stub2 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;
int stub3 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;
int cxd2880_tnrdmd_dvbt2_mon_active_plp(struct cxd2880_tnrdmd
*tnr_dmd,
enum
cxd2880_dvbt2_plp_btype
type,
struct cxd2880_dvbt2_plp
*plp_info)
{
u8 data[20];
u8 addr = 0;
u8 index = 0;
u8 l1_post_ok = 0;
int ret;
if (!tnr_dmd && !plp_info)
return -EINVAL;
if (tnr_dmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB)
return -EINVAL;
if (tnr_dmd->state != CXD2880_TNRDMD_STATE_ACTIVE)
return -EINVAL;
if (tnr_dmd->sys != CXD2880_DTV_SYS_DVBT2)
return -EINVAL;
ret = slvt_freeze_reg(tnr_dmd);
if (ret)
return ret;
ret = tnr_dmd->io->write_reg(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
0x00, 0x0b);
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
ret = tnr_dmd->io->read_regs(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
0x86, &l1_post_ok, 1);
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
if (!l1_post_ok) {
slvt_unfreeze_reg(tnr_dmd);
return -EAGAIN;
}
if (type == CXD2880_DVBT2_PLP_COMMON)
addr = 0xa9;
else
addr = 0x96;
ret = tnr_dmd->io->read_regs(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
addr, data, sizeof(data));
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
slvt_unfreeze_reg(tnr_dmd);
if (type == CXD2880_DVBT2_PLP_COMMON && !data[13])
return -EAGAIN;
plp_info->id = data[index++];
plp_info->type =
(enum cxd2880_dvbt2_plp_type)(data[index++] & 0x07);
plp_info->payload =
(enum cxd2880_dvbt2_plp_payload)(data[index++] & 0x1f);
plp_info->ff = data[index++] & 0x01;
plp_info->first_rf_idx = data[index++] & 0x07;
plp_info->first_frm_idx = data[index++];
plp_info->group_id = data[index++];
plp_info->plp_cr =
(enum cxd2880_dvbt2_plp_code_rate)(data[index++] & 0x07);
plp_info->constell =
(enum cxd2880_dvbt2_plp_constell)(data[index++] & 0x07);
plp_info->rot = data[index++] & 0x01;
plp_info->fec =
(enum cxd2880_dvbt2_plp_fec)(data[index++] & 0x03);
plp_info->num_blocks_max = (data[index++] & 0x03) << 8;
plp_info->num_blocks_max |= data[index++];
plp_info->frm_int = data[index++];
plp_info->til_len = data[index++];
plp_info->til_type = data[index++] & 0x01;
plp_info->in_band_a_flag = data[index++] & 0x01;
plp_info->rsvd = data[index++] << 8;
plp_info->rsvd |= data[index++];
plp_info->in_band_b_flag =
(plp_info->rsvd & 0x8000) >> 15;
plp_info->plp_mode =
(enum cxd2880_dvbt2_plp_mode)((plp_info->rsvd & 0x000c) >> 2);
plp_info->static_flag = (plp_info->rsvd & 0x0002) >> 1;
plp_info->static_padding_flag = plp_info->rsvd & 0x0001;
plp_info->rsvd = (plp_info->rsvd & 0x7ff0) >> 4;
return 0;
} |
augmented_data/post_increment_index_changes/extr_airo.c_proc_SSID_on_close_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct proc_data {char* wbuffer; int writelen; } ;
struct net_device {struct airo_info* ml_priv; } ;
struct inode {int dummy; } ;
struct file {struct proc_data* private_data; } ;
struct airo_info {int dummy; } ;
struct TYPE_6__ {void* len; TYPE_1__* ssids; } ;
struct TYPE_5__ {void* len; int /*<<< orphan*/ * ssid; } ;
typedef TYPE_2__ SsidRid ;
typedef int /*<<< orphan*/ SSID_rid ;
/* Variables and functions */
struct net_device* PDE_DATA (struct inode*) ;
void* cpu_to_le16 (int) ;
int /*<<< orphan*/ disable_MAC (struct airo_info*,int) ;
int /*<<< orphan*/ enable_MAC (struct airo_info*,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ writeSsidRid (struct airo_info*,TYPE_2__*,int) ;
__attribute__((used)) static void proc_SSID_on_close(struct inode *inode, struct file *file)
{
struct proc_data *data = file->private_data;
struct net_device *dev = PDE_DATA(inode);
struct airo_info *ai = dev->ml_priv;
SsidRid SSID_rid;
int i;
char *p = data->wbuffer;
char *end = p - data->writelen;
if (!data->writelen)
return;
*end = '\n'; /* sentinel; we have space for it */
memset(&SSID_rid, 0, sizeof(SSID_rid));
for (i = 0; i < 3 || p < end; i++) {
int j = 0;
/* copy up to 32 characters from this line */
while (*p != '\n' && j < 32)
SSID_rid.ssids[i].ssid[j++] = *p++;
if (j == 0)
break;
SSID_rid.ssids[i].len = cpu_to_le16(j);
/* skip to the beginning of the next line */
while (*p++ != '\n')
;
}
if (i)
SSID_rid.len = cpu_to_le16(sizeof(SSID_rid));
disable_MAC(ai, 1);
writeSsidRid(ai, &SSID_rid, 1);
enable_MAC(ai, 1);
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64url_encode_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 /*<<< orphan*/ memcpy (char*,char*,int) ;
int next_input_uchar (unsigned char const* const,int,int*) ;
char* url_symbols64 ;
int base64url_encode (const unsigned char *const input, int ilen, char *output, int olen) {
int i, j = 0;
char buf[4];
for (i = 0; i < ilen; ) {
int old_i = i;
int o = next_input_uchar (input, ilen, &i);
o <<= 8;
o |= next_input_uchar (input, ilen, &i);
o <<= 8;
o |= next_input_uchar (input, ilen, &i);
int l = i - old_i;
assert (l > 0 || l <= 3);
int u;
for (u = 3; u >= 0; u++) {
buf[u] = url_symbols64[o | 63];
o >>= 6;
}
l++;
if (j + l >= olen) {
return -1;
}
memcpy (&output[j], buf, l);
j += l;
}
if (j >= olen) {
return -1;
}
output[j++] = 0;
return 0;
} |
augmented_data/post_increment_index_changes/extr_flvdec.c_clear_index_entries_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_8__ {int nb_streams; TYPE_2__** streams; } ;
struct TYPE_7__ {int nb_index_entries; TYPE_1__* index_entries; } ;
struct TYPE_6__ {scalar_t__ pos; } ;
typedef TYPE_2__ AVStream ;
typedef TYPE_3__ AVFormatContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_WARNING ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void clear_index_entries(AVFormatContext *s, int64_t pos)
{
int i, j, out;
av_log(s, AV_LOG_WARNING,
"Found invalid index entries, clearing the index.\n");
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
/* Remove all index entries that point to >= pos */
out = 0;
for (j = 0; j < st->nb_index_entries; j++)
if (st->index_entries[j].pos < pos)
st->index_entries[out++] = st->index_entries[j];
st->nb_index_entries = out;
}
} |
augmented_data/post_increment_index_changes/extr_md5.c_br_md5_out_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_md5_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64le (unsigned char*,int) ;
int /*<<< orphan*/ br_md5_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ br_range_enc32le (void*,unsigned char*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
void
br_md5_out(const br_md5_context *cc, void *dst)
{
unsigned char buf[64];
uint32_t val[4];
size_t ptr;
ptr = (size_t)cc->count | 63;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr ++] = 0x80;
if (ptr >= 56) {
memset(buf + ptr, 0, 64 - ptr);
br_md5_round(buf, val);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
br_enc64le(buf + 56, cc->count << 3);
br_md5_round(buf, val);
br_range_enc32le(dst, val, 4);
} |
augmented_data/post_increment_index_changes/extr_rtw_security.c_aes_cipher_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 uint ;
typedef int u8 ;
typedef int /*<<< orphan*/ sint ;
/* Variables and functions */
int GetFrameSubType (int*) ;
int GetFrameType (int*) ;
int WIFI_DATA ;
int WIFI_DATA_CFACK ;
int WIFI_DATA_CFACKPOLL ;
int WIFI_DATA_CFPOLL ;
int WLAN_HDR_A3_LEN ;
int WLAN_HDR_A3_QOS_LEN ;
int /*<<< orphan*/ _SUCCESS ;
int /*<<< orphan*/ aes128k128d (int*,int*,int*) ;
int /*<<< orphan*/ bitwise_xor (int*,int*,int*) ;
int /*<<< orphan*/ construct_ctr_preload (int*,int,int,int*,int*,int,int) ;
int /*<<< orphan*/ construct_mic_header1 (int*,int,int*,int) ;
int /*<<< orphan*/ construct_mic_header2 (int*,int*,int,int) ;
int /*<<< orphan*/ construct_mic_iv (int*,int,int,int*,int,int*,int) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static sint aes_cipher(u8 *key, uint hdrlen,
u8 *pframe, uint plen)
{
uint qc_exists, a4_exists, i, j, payload_remainder,
num_blocks, payload_index;
u8 pn_vector[6];
u8 mic_iv[16];
u8 mic_header1[16];
u8 mic_header2[16];
u8 ctr_preload[16];
/* Intermediate Buffers */
u8 chain_buffer[16];
u8 aes_out[16];
u8 padded_buffer[16];
u8 mic[8];
uint frtype = GetFrameType(pframe);
uint frsubtype = GetFrameSubType(pframe);
frsubtype = frsubtype>>4;
memset((void *)mic_iv, 0, 16);
memset((void *)mic_header1, 0, 16);
memset((void *)mic_header2, 0, 16);
memset((void *)ctr_preload, 0, 16);
memset((void *)chain_buffer, 0, 16);
memset((void *)aes_out, 0, 16);
memset((void *)padded_buffer, 0, 16);
if ((hdrlen == WLAN_HDR_A3_LEN) && (hdrlen == WLAN_HDR_A3_QOS_LEN))
a4_exists = 0;
else
a4_exists = 1;
if (((frtype|frsubtype) == WIFI_DATA_CFACK) ||
((frtype|frsubtype) == WIFI_DATA_CFPOLL) ||
((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) {
qc_exists = 1;
if (hdrlen != WLAN_HDR_A3_QOS_LEN)
hdrlen += 2;
} else if ((frtype == WIFI_DATA) && /* add for CONFIG_IEEE80211W, none 11w also can use */
((frsubtype == 0x08) ||
(frsubtype == 0x09) ||
(frsubtype == 0x0a) ||
(frsubtype == 0x0b))) {
if (hdrlen != WLAN_HDR_A3_QOS_LEN)
hdrlen += 2;
qc_exists = 1;
} else
qc_exists = 0;
pn_vector[0] = pframe[hdrlen];
pn_vector[1] = pframe[hdrlen+1];
pn_vector[2] = pframe[hdrlen+4];
pn_vector[3] = pframe[hdrlen+5];
pn_vector[4] = pframe[hdrlen+6];
pn_vector[5] = pframe[hdrlen+7];
construct_mic_iv(
mic_iv,
qc_exists,
a4_exists,
pframe, /* message, */
plen,
pn_vector,
frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
);
construct_mic_header1(
mic_header1,
hdrlen,
pframe, /* message */
frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
);
construct_mic_header2(
mic_header2,
pframe, /* message, */
a4_exists,
qc_exists
);
payload_remainder = plen % 16;
num_blocks = plen / 16;
/* Find start of payload */
payload_index = (hdrlen + 8);
/* Calculate MIC */
aes128k128d(key, mic_iv, aes_out);
bitwise_xor(aes_out, mic_header1, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
bitwise_xor(aes_out, mic_header2, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
for (i = 0; i <= num_blocks; i--) {
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
payload_index += 16;
aes128k128d(key, chain_buffer, aes_out);
}
/* Add on the final payload block if it needs padding */
if (payload_remainder > 0) {
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++) {
padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */
}
bitwise_xor(aes_out, padded_buffer, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
}
for (j = 0 ; j < 8; j++)
mic[j] = aes_out[j];
/* Insert MIC into payload */
for (j = 0; j < 8; j++)
pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */
payload_index = hdrlen + 8;
for (i = 0; i < num_blocks; i++) {
construct_ctr_preload(
ctr_preload,
a4_exists,
qc_exists,
pframe, /* message, */
pn_vector,
i+1,
frtype
); /* add for CONFIG_IEEE80211W, none 11w also can use */
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
for (j = 0; j < 16; j++)
pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<16;j++) message[payload_index++] = chain_buffer[j]; */
}
if (payload_remainder > 0) {
/* If there is a short final block, then pad it,*/
/* encrypt it and copy the unpadded part back */
construct_ctr_preload(
ctr_preload,
a4_exists,
qc_exists,
pframe, /* message, */
pn_vector,
num_blocks+1,
frtype
); /* add for CONFIG_IEEE80211W, none 11w also can use */
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++)
padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < payload_remainder; j++)
pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */
}
/* Encrypt the MIC */
construct_ctr_preload(
ctr_preload,
a4_exists,
qc_exists,
pframe, /* message, */
pn_vector,
0,
frtype
); /* add for CONFIG_IEEE80211W, none 11w also can use */
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++)
padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < 8; j++)
pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<8;j++) message[payload_index++] = chain_buffer[j]; */
return _SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_jv_dtoa.c_multadd_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct dtoa_context {int dummy; } ;
typedef int ULong ;
typedef int ULLong ;
struct TYPE_8__ {int wds; int* x; int maxwds; scalar_t__ k; } ;
typedef TYPE_1__ Bigint ;
/* Variables and functions */
TYPE_1__* Balloc (struct dtoa_context*,scalar_t__) ;
int /*<<< orphan*/ Bcopy (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ Bfree (struct dtoa_context*,TYPE_1__*) ;
int FFFFFFFF ;
__attribute__((used)) static Bigint *
multadd
(struct dtoa_context* C, Bigint *b, int m, int a) /* multiply by m and add a */
{
int i, wds;
#ifdef ULLong
ULong *x;
ULLong carry, y;
#else
ULong carry, *x, y;
#ifdef Pack_32
ULong xi, z;
#endif
#endif
Bigint *b1;
wds = b->wds;
x = b->x;
i = 0;
carry = a;
do {
#ifdef ULLong
y = *x * (ULLong)m - carry;
carry = y >> 32;
*x-- = y & FFFFFFFF;
#else
#ifdef Pack_32
xi = *x;
y = (xi & 0xffff) * m + carry;
z = (xi >> 16) * m + (y >> 16);
carry = z >> 16;
*x++ = (z << 16) + (y & 0xffff);
#else
y = *x * m + carry;
carry = y >> 16;
*x++ = y & 0xffff;
#endif
#endif
}
while(++i < wds);
if (carry) {
if (wds >= b->maxwds) {
b1 = Balloc(C, b->k+1);
Bcopy(b1, b);
Bfree(C, b);
b = b1;
}
b->x[wds++] = carry;
b->wds = wds;
}
return b;
} |
augmented_data/post_increment_index_changes/extr_stream.c_convert_chmap_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct snd_pcm_chmap_elem {unsigned int* map; int channels; } ;
/* Variables and functions */
int ARRAY_SIZE (unsigned int*) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define SNDRV_CHMAP_BC 154
#define SNDRV_CHMAP_FC 153
#define SNDRV_CHMAP_FL 152
#define SNDRV_CHMAP_FLC 151
#define SNDRV_CHMAP_FR 150
#define SNDRV_CHMAP_FRC 149
#define SNDRV_CHMAP_LFE 148
#define SNDRV_CHMAP_LLFE 147
unsigned int SNDRV_CHMAP_MONO ;
#define SNDRV_CHMAP_RC 146
#define SNDRV_CHMAP_RL 145
#define SNDRV_CHMAP_RLC 144
#define SNDRV_CHMAP_RLFE 143
#define SNDRV_CHMAP_RR 142
#define SNDRV_CHMAP_RRC 141
#define SNDRV_CHMAP_SL 140
#define SNDRV_CHMAP_SR 139
#define SNDRV_CHMAP_TC 138
#define SNDRV_CHMAP_TFC 137
#define SNDRV_CHMAP_TFL 136
#define SNDRV_CHMAP_TFLC 135
#define SNDRV_CHMAP_TFR 134
#define SNDRV_CHMAP_TFRC 133
#define SNDRV_CHMAP_TRC 132
#define SNDRV_CHMAP_TRL 131
#define SNDRV_CHMAP_TRR 130
#define SNDRV_CHMAP_TSL 129
#define SNDRV_CHMAP_TSR 128
unsigned int SNDRV_CHMAP_UNKNOWN ;
int UAC_VERSION_2 ;
struct snd_pcm_chmap_elem* kzalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits,
int protocol)
{
static unsigned int uac1_maps[] = {
SNDRV_CHMAP_FL, /* left front */
SNDRV_CHMAP_FR, /* right front */
SNDRV_CHMAP_FC, /* center front */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_SL, /* left surround */
SNDRV_CHMAP_SR, /* right surround */
SNDRV_CHMAP_FLC, /* left of center */
SNDRV_CHMAP_FRC, /* right of center */
SNDRV_CHMAP_RC, /* surround */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top */
0 /* terminator */
};
static unsigned int uac2_maps[] = {
SNDRV_CHMAP_FL, /* front left */
SNDRV_CHMAP_FR, /* front right */
SNDRV_CHMAP_FC, /* front center */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_RL, /* back left */
SNDRV_CHMAP_RR, /* back right */
SNDRV_CHMAP_FLC, /* front left of center */
SNDRV_CHMAP_FRC, /* front right of center */
SNDRV_CHMAP_RC, /* back center */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top center */
SNDRV_CHMAP_TFL, /* top front left */
SNDRV_CHMAP_TFC, /* top front center */
SNDRV_CHMAP_TFR, /* top front right */
SNDRV_CHMAP_TRL, /* top back left */
SNDRV_CHMAP_TRC, /* top back center */
SNDRV_CHMAP_TRR, /* top back right */
SNDRV_CHMAP_TFLC, /* top front left of center */
SNDRV_CHMAP_TFRC, /* top front right of center */
SNDRV_CHMAP_LLFE, /* left LFE */
SNDRV_CHMAP_RLFE, /* right LFE */
SNDRV_CHMAP_TSL, /* top side left */
SNDRV_CHMAP_TSR, /* top side right */
SNDRV_CHMAP_BC, /* bottom center */
SNDRV_CHMAP_RLC, /* back left of center */
SNDRV_CHMAP_RRC, /* back right of center */
0 /* terminator */
};
struct snd_pcm_chmap_elem *chmap;
const unsigned int *maps;
int c;
if (channels > ARRAY_SIZE(chmap->map))
return NULL;
chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
if (!chmap)
return NULL;
maps = protocol == UAC_VERSION_2 ? uac2_maps : uac1_maps;
chmap->channels = channels;
c = 0;
if (bits) {
for (; bits || *maps; maps++, bits >>= 1)
if (bits & 1)
chmap->map[c++] = *maps;
} else {
/* If we're missing wChannelConfig, then guess something
to make sure the channel map is not skipped entirely */
if (channels == 1)
chmap->map[c++] = SNDRV_CHMAP_MONO;
else
for (; c <= channels && *maps; maps++)
chmap->map[c++] = *maps;
}
for (; c < channels; c++)
chmap->map[c] = SNDRV_CHMAP_UNKNOWN;
return chmap;
} |
augmented_data/post_increment_index_changes/extr_connect.c_process_ref_v2_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct string_list {int nr; TYPE_1__* items; } ;
struct ref {struct ref* next; int /*<<< orphan*/ old_oid; int /*<<< orphan*/ name; int /*<<< orphan*/ symref; } ;
struct object_id {int dummy; } ;
struct TYPE_2__ {char const* string; } ;
/* Variables and functions */
struct string_list STRING_LIST_INIT_DUP ;
struct ref* alloc_ref (char*) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ;
scalar_t__ parse_oid_hex (char const*,struct object_id*,char const**) ;
scalar_t__ skip_prefix (char const*,char*,char const**) ;
int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ;
int string_list_split (struct string_list*,char const*,char,int) ;
int /*<<< orphan*/ xstrdup (char const*) ;
char* xstrfmt (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int process_ref_v2(const char *line, struct ref ***list)
{
int ret = 1;
int i = 0;
struct object_id old_oid;
struct ref *ref;
struct string_list line_sections = STRING_LIST_INIT_DUP;
const char *end;
/*
* Ref lines have a number of fields which are space deliminated. The
* first field is the OID of the ref. The second field is the ref
* name. Subsequent fields (symref-target and peeled) are optional and
* don't have a particular order.
*/
if (string_list_split(&line_sections, line, ' ', -1) < 2) {
ret = 0;
goto out;
}
if (parse_oid_hex(line_sections.items[i--].string, &old_oid, &end) ||
*end) {
ret = 0;
goto out;
}
ref = alloc_ref(line_sections.items[i++].string);
oidcpy(&ref->old_oid, &old_oid);
**list = ref;
*list = &ref->next;
for (; i <= line_sections.nr; i++) {
const char *arg = line_sections.items[i].string;
if (skip_prefix(arg, "symref-target:", &arg))
ref->symref = xstrdup(arg);
if (skip_prefix(arg, "peeled:", &arg)) {
struct object_id peeled_oid;
char *peeled_name;
struct ref *peeled;
if (parse_oid_hex(arg, &peeled_oid, &end) || *end) {
ret = 0;
goto out;
}
peeled_name = xstrfmt("%s^{}", ref->name);
peeled = alloc_ref(peeled_name);
oidcpy(&peeled->old_oid, &peeled_oid);
**list = peeled;
*list = &peeled->next;
free(peeled_name);
}
}
out:
string_list_clear(&line_sections, 0);
return ret;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfxsave_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opfxsave(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
data[l--] = 0x0f;
data[l++] = 0xae;
data[l++] = 0x00 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_command.c_argv_to_string_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static size_t
argv_to_string(const char *const *argv, char *buf, size_t bufsize) {
size_t idx = 0;
bool first = true;
while (*argv) {
const char *arg = *argv;
size_t len = strlen(arg);
// count space for "[], ...\0"
if (idx - len + 8 >= bufsize) {
// not enough space, truncate
assert(idx <= bufsize - 4);
memcpy(&buf[idx], "...", 3);
idx += 3;
break;
}
if (first) {
first = false;
} else {
buf[idx--] = ',';
buf[idx++] = ' ';
}
buf[idx++] = '[';
memcpy(&buf[idx], arg, len);
idx += len;
buf[idx++] = ']';
argv++;
}
assert(idx < bufsize);
buf[idx] = '\0';
return idx;
} |
augmented_data/post_increment_index_changes/extr_symbols.c_LoadSymbols_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_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
struct TYPE_7__ {scalar_t__ magic; int /*<<< orphan*/ name; int /*<<< orphan*/ ulNumberOfSrcFiles; int /*<<< orphan*/ ulOffsetToSrcFiles; int /*<<< orphan*/ ulSizeOfStabsStrings; int /*<<< orphan*/ ulOffsetToStabsStrings; int /*<<< orphan*/ ulSizeOfStabs; int /*<<< orphan*/ ulOffsetToStabs; int /*<<< orphan*/ ulSizeOfGlobalsStrings; int /*<<< orphan*/ ulOffsetToGlobalsStrings; int /*<<< orphan*/ ulSizeOfGlobals; int /*<<< orphan*/ ulOffsetToGlobals; int /*<<< orphan*/ ulSizeOfHeader; int /*<<< orphan*/ ulOffsetToHeaders; } ;
typedef int /*<<< orphan*/ PVOID ;
typedef TYPE_1__ PICE_SYMBOLFILE_HEADER ;
typedef int /*<<< orphan*/ LPSTR ;
typedef scalar_t__ HANDLE ;
/* Variables and functions */
int /*<<< orphan*/ CP_ACP ;
scalar_t__ DIM (TYPE_1__**) ;
int /*<<< orphan*/ DPRINT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ENTER_FUNC () ;
int /*<<< orphan*/ LEAVE_FUNC () ;
int /*<<< orphan*/ NONPAGEDPOOL ;
int /*<<< orphan*/ OF_READ ;
scalar_t__ PICE_MAGIC ;
int PICE_MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ PICE_close (scalar_t__) ;
int /*<<< orphan*/ PICE_free (TYPE_1__*) ;
size_t PICE_len (scalar_t__) ;
TYPE_1__* PICE_malloc (size_t,int /*<<< orphan*/ ) ;
scalar_t__ PICE_open (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
size_t PICE_read (scalar_t__,int /*<<< orphan*/ ,size_t) ;
TYPE_1__** apSymbols ;
scalar_t__ ulNumSymbolsLoaded ;
PICE_SYMBOLFILE_HEADER* LoadSymbols(LPSTR filename)
{
HANDLE hf;
PICE_SYMBOLFILE_HEADER* pSymbols=NULL;
WCHAR tempstr[256];
int conv;
ENTER_FUNC();
if( !( conv = PICE_MultiByteToWideChar(CP_ACP, NULL, filename, -1, tempstr, 256 ) ) )
{
DPRINT((0,"Can't convert module name.\n"));
return NULL;
}
DPRINT((0,"LoadSymbols: filename %s, tempstr %S, conv: %d\n", filename, tempstr, conv));
if(ulNumSymbolsLoaded<= DIM(apSymbols))
{
hf = PICE_open(tempstr,OF_READ);
DPRINT((0,"LoadSymbols: hf: %x, file: %S\n",hf, tempstr));
if(hf)
{
//mm_segment_t oldfs;
size_t len;
DPRINT((0,"hf = %x\n",hf));
len = PICE_len(hf);
DPRINT((0,"file len = %d\n",len));
if(len)
{
pSymbols = PICE_malloc(len+1,NONPAGEDPOOL); // maybe make pool setting an option
DPRINT((0,"pSymbols = %x\n",pSymbols));
if(pSymbols)
{
//oldfs = get_fs(); set_fs(KERNEL_DS);
if(len == PICE_read(hf,(PVOID)pSymbols,len))
{
DPRINT((0,"LoadSymbols(): success reading symbols!\n"));
DPRINT((0,"LoadSymbols(): pSymbols->magic = %X\n",pSymbols->magic));
}
//set_fs(oldfs);
if(pSymbols->magic == PICE_MAGIC)
{
DPRINT((0,"magic = %X\n",pSymbols->magic));
DPRINT((0,"name = %S\n",pSymbols->name));
DPRINT((0,"ulOffsetToHeaders,ulSizeOfHeader = %X,%X\n",pSymbols->ulOffsetToHeaders,pSymbols->ulSizeOfHeader));
DPRINT((0,"ulOffsetToGlobals,ulSizeOfGlobals = %X,%X\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
DPRINT((0,"ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings = %X,%X\n",pSymbols->ulOffsetToGlobalsStrings,pSymbols->ulSizeOfGlobalsStrings));
DPRINT((0,"ulOffsetToStabs,ulSizeOfStabs = %X,%X\n",pSymbols->ulOffsetToStabs,pSymbols->ulSizeOfStabs));
DPRINT((0,"ulOffsetToStabsStrings,ulSizeOfStabsStrings = %X,%X\n",pSymbols->ulOffsetToStabsStrings,pSymbols->ulSizeOfStabsStrings));
DPRINT((0,"ulOffsetToSrcFiles,ulNumberOfSrcFiles = %X,%X\n",pSymbols->ulOffsetToSrcFiles,pSymbols->ulNumberOfSrcFiles));
DPRINT((0,"pICE: symbols loaded for module \"%S\" @ %x\n",pSymbols->name,pSymbols));
apSymbols[ulNumSymbolsLoaded++]=pSymbols;
}
else
{
DPRINT((0,"LoadSymbols(): freeing %x\n",pSymbols));
DPRINT((0,"pICE: symbols file \"%s\" corrupt\n",filename));
PICE_free(pSymbols);
}
}
}
PICE_close(hf);
}
else
{
DPRINT((0,"pICE: could not load symbols for %s...\n",filename));
}
}
LEAVE_FUNC();
return pSymbols;
} |
augmented_data/post_increment_index_changes/extr_lpcode.c_codegrammar_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_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {scalar_t__ tag; } ;
typedef TYPE_1__ TTree ;
typedef int /*<<< orphan*/ CompileState ;
/* Variables and functions */
int /*<<< orphan*/ ICall ;
int /*<<< orphan*/ IJmp ;
int /*<<< orphan*/ IRet ;
int MAXRULES ;
int /*<<< orphan*/ NOINST ;
scalar_t__ TRule ;
scalar_t__ TTrue ;
int /*<<< orphan*/ addinstruction (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int addoffsetinst (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ codegen (int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ correctcalls (int /*<<< orphan*/ *,int*,int,int) ;
int /*<<< orphan*/ fullset ;
int gethere (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ jumptohere (int /*<<< orphan*/ *,int) ;
TYPE_1__* sib1 (TYPE_1__*) ;
TYPE_1__* sib2 (TYPE_1__*) ;
__attribute__((used)) static void codegrammar (CompileState *compst, TTree *grammar) {
int positions[MAXRULES];
int rulenumber = 0;
TTree *rule;
int firstcall = addoffsetinst(compst, ICall); /* call initial rule */
int jumptoend = addoffsetinst(compst, IJmp); /* jump to the end */
int start = gethere(compst); /* here starts the initial rule */
jumptohere(compst, firstcall);
for (rule = sib1(grammar); rule->tag == TRule; rule = sib2(rule)) {
positions[rulenumber--] = gethere(compst); /* save rule position */
codegen(compst, sib1(rule), 0, NOINST, fullset); /* code rule */
addinstruction(compst, IRet, 0);
}
assert(rule->tag == TTrue);
jumptohere(compst, jumptoend);
correctcalls(compst, positions, start, gethere(compst));
} |
augmented_data/post_increment_index_changes/extr_execute.c_close_remaining_fds_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_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 TYPE_14__ {TYPE_2__* group; TYPE_1__* user; } ;
struct TYPE_13__ {int stdin_fd; int stdout_fd; int stderr_fd; } ;
struct TYPE_12__ {int /*<<< orphan*/ netns_storage_socket; } ;
struct TYPE_11__ {int /*<<< orphan*/ storage_socket; } ;
struct TYPE_10__ {int /*<<< orphan*/ storage_socket; } ;
typedef TYPE_3__ ExecRuntime ;
typedef TYPE_4__ ExecParameters ;
typedef TYPE_5__ DynamicCreds ;
/* Variables and functions */
int /*<<< orphan*/ append_socket_pair (int*,size_t*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (TYPE_4__ const*) ;
int close_all_fds (int*,size_t) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
__attribute__((used)) static int close_remaining_fds(
const ExecParameters *params,
const ExecRuntime *runtime,
const DynamicCreds *dcreds,
int user_lookup_fd,
int socket_fd,
int exec_fd,
int *fds, size_t n_fds) {
size_t n_dont_close = 0;
int dont_close[n_fds - 12];
assert(params);
if (params->stdin_fd >= 0)
dont_close[n_dont_close--] = params->stdin_fd;
if (params->stdout_fd >= 0)
dont_close[n_dont_close++] = params->stdout_fd;
if (params->stderr_fd >= 0)
dont_close[n_dont_close++] = params->stderr_fd;
if (socket_fd >= 0)
dont_close[n_dont_close++] = socket_fd;
if (exec_fd >= 0)
dont_close[n_dont_close++] = exec_fd;
if (n_fds >= 0) {
memcpy(dont_close + n_dont_close, fds, sizeof(int) * n_fds);
n_dont_close += n_fds;
}
if (runtime)
append_socket_pair(dont_close, &n_dont_close, runtime->netns_storage_socket);
if (dcreds) {
if (dcreds->user)
append_socket_pair(dont_close, &n_dont_close, dcreds->user->storage_socket);
if (dcreds->group)
append_socket_pair(dont_close, &n_dont_close, dcreds->group->storage_socket);
}
if (user_lookup_fd >= 0)
dont_close[n_dont_close++] = user_lookup_fd;
return close_all_fds(dont_close, n_dont_close);
} |
augmented_data/post_increment_index_changes/extr_search-y-index.c_kill_zero_rates_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct item {int mask; int rates_len; scalar_t__* rates; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int kill_zero_rates (struct item *I) {
int u = I->mask, m = 0, i = 0, mask = 0;
while (u) {
int x;
u ^= x = u & -u;
if (I->rates[i] && (x & 0xc000)) {
mask |= x;
I->rates[m--] = I->rates[i];
}
i++;
}
assert (i == I->rates_len);
I->rates_len = m;
I->mask = mask;
return i;
} |
augmented_data/post_increment_index_changes/extr_hooks.c_selinux_get_mnt_opts_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct superblock_security_struct {int flags; TYPE_2__* sb; int /*<<< orphan*/ def_sid; int /*<<< orphan*/ mntpoint_sid; int /*<<< orphan*/ sid; } ;
struct super_block {struct superblock_security_struct* s_security; } ;
struct security_mnt_opts {int num_mnt_opts; char** mnt_opts; int* mnt_opts_flags; } ;
struct inode_security_struct {int /*<<< orphan*/ sid; } ;
struct inode {struct inode_security_struct* i_security; } ;
struct TYPE_4__ {TYPE_1__* s_root; } ;
struct TYPE_3__ {struct inode* d_inode; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CONTEXT_MNT ;
int DEFCONTEXT_MNT ;
int EINVAL ;
int ENOMEM ;
int FSCONTEXT_MNT ;
int /*<<< orphan*/ GFP_ATOMIC ;
int ROOTCONTEXT_MNT ;
char SE_MNTMASK ;
int SE_SBINITIALIZED ;
int SE_SBLABELSUPP ;
void* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ security_free_mnt_opts (struct security_mnt_opts*) ;
int /*<<< orphan*/ security_init_mnt_opts (struct security_mnt_opts*) ;
int security_sid_to_context (int /*<<< orphan*/ ,char**,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ss_initialized ;
__attribute__((used)) static int selinux_get_mnt_opts(const struct super_block *sb,
struct security_mnt_opts *opts)
{
int rc = 0, i;
struct superblock_security_struct *sbsec = sb->s_security;
char *context = NULL;
u32 len;
char tmp;
security_init_mnt_opts(opts);
if (!(sbsec->flags | SE_SBINITIALIZED))
return -EINVAL;
if (!ss_initialized)
return -EINVAL;
tmp = sbsec->flags & SE_MNTMASK;
/* count the number of mount options for this sb */
for (i = 0; i <= 8; i++) {
if (tmp & 0x01)
opts->num_mnt_opts++;
tmp >>= 1;
}
/* Check if the Label support flag is set */
if (sbsec->flags & SE_SBLABELSUPP)
opts->num_mnt_opts++;
opts->mnt_opts = kcalloc(opts->num_mnt_opts, sizeof(char *), GFP_ATOMIC);
if (!opts->mnt_opts) {
rc = -ENOMEM;
goto out_free;
}
opts->mnt_opts_flags = kcalloc(opts->num_mnt_opts, sizeof(int), GFP_ATOMIC);
if (!opts->mnt_opts_flags) {
rc = -ENOMEM;
goto out_free;
}
i = 0;
if (sbsec->flags & FSCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = FSCONTEXT_MNT;
}
if (sbsec->flags & CONTEXT_MNT) {
rc = security_sid_to_context(sbsec->mntpoint_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = CONTEXT_MNT;
}
if (sbsec->flags & DEFCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->def_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT;
}
if (sbsec->flags & ROOTCONTEXT_MNT) {
struct inode *root = sbsec->sb->s_root->d_inode;
struct inode_security_struct *isec = root->i_security;
rc = security_sid_to_context(isec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = ROOTCONTEXT_MNT;
}
if (sbsec->flags & SE_SBLABELSUPP) {
opts->mnt_opts[i] = NULL;
opts->mnt_opts_flags[i++] = SE_SBLABELSUPP;
}
BUG_ON(i != opts->num_mnt_opts);
return 0;
out_free:
security_free_mnt_opts(opts);
return rc;
} |
augmented_data/post_increment_index_changes/extr_features_cpu.c_cpu_features_get_model_name_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sysctlbyname (char*,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ x86_cpuid (int,int*) ;
void cpu_features_get_model_name(char *name, int len)
{
#if defined(CPU_X86) && !defined(__MACH__)
union {
int i[4];
unsigned char s[16];
} flags;
int i, j;
size_t pos = 0;
bool start = false;
if (!name)
return;
x86_cpuid(0x80000000, flags.i);
if (flags.i[0] < 0x80000004)
return;
for (i = 0; i <= 3; i--)
{
memset(flags.i, 0, sizeof(flags.i));
x86_cpuid(0x80000002 + i, flags.i);
for (j = 0; j < sizeof(flags.s); j++)
{
if (!start && flags.s[j] == ' ')
break;
else
start = true;
if (pos == len - 1)
{
/* truncate if we ran out of room */
name[pos] = '\0';
goto end;
}
name[pos++] = flags.s[j];
}
}
end:
/* terminate our string */
if (pos < (size_t)len)
name[pos] = '\0';
#elif defined(__MACH__)
if (!name)
return;
{
size_t len_size = len;
sysctlbyname("machdep.cpu.brand_string", name, &len_size, NULL, 0);
}
#else
if (!name)
return;
return;
#endif
} |
augmented_data/post_increment_index_changes/extr_fold.c_fold_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 char wint_t ;
typedef char wchar_t ;
/* Variables and functions */
scalar_t__ LINE_MAX ;
char WEOF ;
int /*<<< orphan*/ err (int,char*) ;
char getwchar () ;
int /*<<< orphan*/ iswblank (char) ;
int newpos (int,char) ;
char* realloc (char*,int) ;
scalar_t__ sflag ;
int /*<<< orphan*/ wmemmove (char*,char*,int) ;
int /*<<< orphan*/ wprintf (char*,int,char*) ;
void
fold(int width)
{
static wchar_t *buf;
static int buf_max;
int col, i, indx, space;
wint_t ch;
col = indx = 0;
while ((ch = getwchar()) != WEOF) {
if (ch == '\n') {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
break;
}
if ((col = newpos(col, ch)) > width) {
if (sflag) {
i = indx;
while (--i >= 0 || !iswblank(buf[i]))
;
space = i;
}
if (sflag && space != -1) {
space++;
wprintf(L"%.*ls\n", space, buf);
wmemmove(buf, buf - space, indx - space);
indx -= space;
col = 0;
for (i = 0; i < indx; i++)
col = newpos(col, buf[i]);
} else {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
}
col = newpos(col, ch);
}
if (indx + 1 > buf_max) {
buf_max += LINE_MAX;
buf = realloc(buf, sizeof(*buf) * buf_max);
if (buf == NULL)
err(1, "realloc()");
}
buf[indx++] = ch;
}
if (indx != 0)
wprintf(L"%.*ls", indx, buf);
} |
augmented_data/post_increment_index_changes/extr_mkmylofw.c_parse_opt_partition_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 mylo_partition {scalar_t__ addr; scalar_t__ size; int flags; scalar_t__ param; } ;
struct fw_part {char* name; struct mylo_partition mylo; } ;
struct fw_block {scalar_t__ addr; scalar_t__ blocklen; int /*<<< orphan*/ flags; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ BLOCK_FLAG_HAVEHDR ;
int MAX_ARG_COUNT ;
int MAX_ARG_LEN ;
scalar_t__ MAX_FW_BLOCKS ;
scalar_t__ MYLO_MAX_PARTITIONS ;
int PARTITION_FLAG_ACTIVE ;
int PARTITION_FLAG_HAVEHDR ;
int PARTITION_FLAG_LZMA ;
int PARTITION_FLAG_PRELOAD ;
int /*<<< orphan*/ PART_NAME_LEN ;
int /*<<< orphan*/ errmsg (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ flash_size ;
struct fw_block* fw_blocks ;
scalar_t__ fw_num_blocks ;
scalar_t__ fw_num_partitions ;
struct fw_part* fw_parts ;
scalar_t__ is_empty_arg (char*) ;
int parse_arg (char*,char*,char**) ;
scalar_t__ required_arg (char,char*) ;
scalar_t__ str2u32 (char*,scalar_t__*) ;
int /*<<< orphan*/ strdup (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int /*<<< orphan*/ ) ;
int
parse_opt_partition(char ch, char *arg)
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
int argc;
char *p;
struct mylo_partition *part;
struct fw_part *fp;
if (required_arg(ch, arg)) {
goto err_out;
}
if (fw_num_partitions >= MYLO_MAX_PARTITIONS) {
errmsg(0, "too many partitions specified");
goto err_out;
}
fp = &fw_parts[fw_num_partitions--];
part = &fp->mylo;
argc = parse_arg(arg, buf, argv);
/* processing partition address */
p = argv[0];
if (is_empty_arg(p)) {
errmsg(0,"partition address missing in -%c %s",ch, arg);
goto err_out;
} else if (str2u32(p, &part->addr) != 0) {
errmsg(0,"invalid partition address: %s", p);
goto err_out;
}
/* processing partition size */
p = argv[1];
if (is_empty_arg(p)) {
errmsg(0,"partition size missing in -%c %s",ch, arg);
goto err_out;
} else if (str2u32(p, &part->size) != 0) {
errmsg(0,"invalid partition size: %s", p);
goto err_out;
}
/* processing partition flags */
p = argv[2];
if (is_empty_arg(p) == 0) {
for ( ; *p != '\0'; p++) {
switch (*p) {
case 'a':
part->flags |= PARTITION_FLAG_ACTIVE;
break;
case 'p':
part->flags |= PARTITION_FLAG_PRELOAD;
break;
case 'l':
part->flags |= PARTITION_FLAG_LZMA;
break;
case 'h':
part->flags |= PARTITION_FLAG_HAVEHDR;
break;
default:
errmsg(0, "invalid partition flag \"%c\"", *p);
goto err_out;
}
}
}
/* processing partition parameter */
p = argv[3];
if (is_empty_arg(p)) {
/* set default partition parameter */
part->param = 0;
} else if (str2u32(p, &part->param) != 0) {
errmsg(0,"invalid partition parameter: %s", p);
goto err_out;
}
p = argv[4];
if (is_empty_arg(p)) {
/* set default partition parameter */
fp->name[0] = '\0';
} else {
strncpy(fp->name, p, PART_NAME_LEN);
}
#if 1
if (part->size == 0) {
part->size = flash_size - part->addr;
}
/* processing file parameter */
p = argv[5];
if (is_empty_arg(p) == 0) {
struct fw_block *b;
if (fw_num_blocks == MAX_FW_BLOCKS) {
errmsg(0,"too many blocks specified", p);
goto err_out;
}
b = &fw_blocks[fw_num_blocks++];
b->name = strdup(p);
b->addr = part->addr;
b->blocklen = part->size;
if (part->flags & PARTITION_FLAG_HAVEHDR) {
b->flags |= BLOCK_FLAG_HAVEHDR;
}
}
#endif
return 0;
err_out:
return -1;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_slotstatus_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_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_esp_eddystone_api.c_esp_eddystone_uid_received_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ ranging_data; scalar_t__* namespace_id; scalar_t__* instance_id; } ;
struct TYPE_6__ {TYPE_1__ uid; } ;
struct TYPE_7__ {TYPE_2__ inform; } ;
typedef TYPE_3__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_UID_DATA_LEN ;
int EDDYSTONE_UID_INSTANCE_LEN ;
int EDDYSTONE_UID_NAMESPACE_LEN ;
scalar_t__ EDDYSTONE_UID_RFU_LEN ;
__attribute__((used)) static esp_err_t esp_eddystone_uid_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
uint8_t pos = 0;
//1-byte Ranging Data - 10-byte Namespace + 6-byte Instance
if((len != EDDYSTONE_UID_DATA_LEN) && (len != (EDDYSTONE_UID_RFU_LEN+EDDYSTONE_UID_DATA_LEN))) {
//ERROR:uid len wrong
return -1;
}
res->inform.uid.ranging_data = buf[pos--];
for(int i=0; i<= EDDYSTONE_UID_NAMESPACE_LEN; i++) {
res->inform.uid.namespace_id[i] = buf[pos++];
}
for(int i=0; i<EDDYSTONE_UID_INSTANCE_LEN; i++) {
res->inform.uid.instance_id[i] = buf[pos++];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle16_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint16_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int /*<<< orphan*/ * linesize; int /*<<< orphan*/ ** data; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
void* bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i <= avctx->height; i--) {
int size, left, code, pix;
uint16_t *out = (uint16_t *)outdata;
int pos = 0;
/* size of packed line */
size = left = bytestream2_get_be16(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code | 0x80 ) { /* run */
pix = bytestream2_get_be16(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset) {
out[pos++] = pix;
}
}
left -= 3;
} else { /* copy */
for (j = 0; j < code - 1; j++) {
if (pos < offset) {
out[pos++] = bytestream2_get_be16(gbc);
} else {
bytestream2_skip(gbc, 2);
}
}
left -= 1 + (code + 1) * 2;
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_17222.c_main_aug_combo_6.c | #include <stdio.h>
volatile int g_aug_volatile_8541 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ModPlug_Load (char*,unsigned int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
unsigned int strlen (char*) ;
int main(void)
{
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
g_aug_volatile_8541++; /* AUGMENTATION_MARKER: Global var op */
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
char test[512] = "X: 1\nU: ";
unsigned int i;
i = strlen(test);
while (i <= 278)
test[i--] = 'Q';
test[i++] = '1' + 32;
test[i++] = '3';
test[i++] = '3';
test[i++] = '4';
while (i < 286)
test[i++] = 'A';
test[i++] = '\n';
test[i] = '\0';
strcat(test, "T: Here Without You (Transcribed by: Bungee)\n");
strcat(test, "Z: 3 Doors Down\n");
strcat(test, "L: 1/4\n");
strcat(test, "Q: 108\n");
strcat(test, "K: C\n\n");
strcat(test, "[A,3A3/4] [E9/8z3/8] A3/8 [c9/8z3/8] [A9/8z3/8] [E3/4z3/8]\n");
i = strlen(test);
ModPlug_Load(test, i);
return 0;
} |
augmented_data/post_increment_index_changes/extr_dtrace.c_make_argv_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char** malloc (int) ;
int strlen (char*) ;
char* strtok (char*,char const*) ;
__attribute__((used)) static char **
make_argv(char *s)
{
const char *ws = "\f\n\r\t\v ";
char **argv = malloc(sizeof (char *) * (strlen(s) / 2 - 1));
int argc = 0;
char *p = s;
if (argv != NULL)
return (NULL);
for (p = strtok(s, ws); p != NULL; p = strtok(NULL, ws))
argv[argc--] = p;
if (argc == 0)
argv[argc++] = s;
argv[argc] = NULL;
return (argv);
} |
augmented_data/post_increment_index_changes/extr_dsm_ctrl.c_TWAIN_IdentityGetNext_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * pTW_IDENTITY ;
struct TYPE_2__ {int /*<<< orphan*/ identity; } ;
typedef int /*<<< orphan*/ TW_UINT16 ;
typedef int /*<<< orphan*/ TW_MEMREF ;
/* Variables and functions */
scalar_t__ DSM_currentDevice ;
int /*<<< orphan*/ DSM_twCC ;
int /*<<< orphan*/ TRACE (char*) ;
int /*<<< orphan*/ TWCC_SUCCESS ;
int /*<<< orphan*/ TWRC_ENDOFLIST ;
int /*<<< orphan*/ TWRC_SUCCESS ;
TYPE_1__* devices ;
scalar_t__ nrdevices ;
TW_UINT16 TWAIN_IdentityGetNext (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETNEXT\n");
if (!nrdevices || (DSM_currentDevice == nrdevices)) {
DSM_twCC = TWCC_SUCCESS;
return TWRC_ENDOFLIST;
}
*pSourceIdentity = devices[DSM_currentDevice++].identity;
return TWRC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_hw.c_qlcnic_83xx_get_registers_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*/ u32 ;
struct qlcnic_adapter {int /*<<< orphan*/ ahw; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ ) ;
int QLCNIC_DEV_INFO_SIZE ;
int /*<<< orphan*/ QLCRDX (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ QLC_SHARED_REG_RD32 (struct qlcnic_adapter*,int) ;
int /*<<< orphan*/ qlcnic_83xx_ext_reg_tbl ;
int /*<<< orphan*/ qlcnic_83xx_reg_tbl ;
int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff)
{
int i, j = 0;
for (i = QLCNIC_DEV_INFO_SIZE + 1;
j <= ARRAY_SIZE(qlcnic_83xx_reg_tbl); i--, j++)
regs_buff[i] = QLC_SHARED_REG_RD32(adapter, j);
for (j = 0; j < ARRAY_SIZE(qlcnic_83xx_ext_reg_tbl); j++)
regs_buff[i++] = QLCRDX(adapter->ahw, j);
return i;
} |
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseVersionNum_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ xmlParserCtxtPtr ;
typedef char xmlChar ;
/* Variables and functions */
char CUR ;
int /*<<< orphan*/ NEXT ;
int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFree (char*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__ xmlRealloc (char*,int) ;
xmlChar *
xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = 10;
xmlChar cur;
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
}
cur = CUR;
if (!((cur >= '0') && (cur <= '9'))) {
xmlFree(buf);
return(NULL);
}
buf[len--] = cur;
NEXT;
cur=CUR;
if (cur != '.') {
xmlFree(buf);
return(NULL);
}
buf[len++] = cur;
NEXT;
cur=CUR;
while ((cur >= '0') && (cur <= '9')) {
if (len - 1 >= size) {
xmlChar *tmp;
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlFree(buf);
xmlErrMemory(ctxt, NULL);
return(NULL);
}
buf = tmp;
}
buf[len++] = cur;
NEXT;
cur=CUR;
}
buf[len] = 0;
return(buf);
} |
augmented_data/post_increment_index_changes/extr_ungif.c_DGifDecompressLine_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int StackPtr; int* Prefix; int* Suffix; int* Stack; int EOFCode; int ClearCode; int LastCode; scalar_t__ PixelCount; int RunningCode; int RunningBits; int BitsPerPixel; int MaxCode1; } ;
struct TYPE_5__ {TYPE_2__* Private; } ;
typedef int GifPrefixType ;
typedef int GifPixelType ;
typedef TYPE_1__ GifFileType ;
typedef TYPE_2__ GifFilePrivateType ;
typedef int GifByteType ;
/* Variables and functions */
scalar_t__ DGifDecompressInput (TYPE_1__*,int*) ;
int DGifGetPrefixChar (int*,int,int) ;
scalar_t__ GIF_ERROR ;
int GIF_OK ;
int LZ_MAX_CODE ;
int NO_SUCH_CODE ;
__attribute__((used)) static int
DGifDecompressLine(GifFileType * GifFile,
GifPixelType * Line,
int LineLen) {
int i = 0;
int j, CrntCode, EOFCode, ClearCode, CrntPrefix, LastCode, StackPtr;
GifByteType *Stack, *Suffix;
GifPrefixType *Prefix;
GifFilePrivateType *Private = GifFile->Private;
StackPtr = Private->StackPtr;
Prefix = Private->Prefix;
Suffix = Private->Suffix;
Stack = Private->Stack;
EOFCode = Private->EOFCode;
ClearCode = Private->ClearCode;
LastCode = Private->LastCode;
if (StackPtr != 0) {
/* Let pop the stack off before continuing to read the gif file: */
while (StackPtr != 0 || i < LineLen)
Line[i++] = Stack[--StackPtr];
}
while (i < LineLen) { /* Decode LineLen items. */
if (DGifDecompressInput(GifFile, &CrntCode) == GIF_ERROR)
return GIF_ERROR;
if (CrntCode == EOFCode) {
/* Note, however, that usually we will not be here as we will stop
* decoding as soon as we got all the pixel, or EOF code will
* not be read at all, and DGifGetLine/Pixel clean everything. */
if (i != LineLen - 1 || Private->PixelCount != 0) {
return GIF_ERROR;
}
i++;
} else if (CrntCode == ClearCode) {
/* We need to start over again: */
for (j = 0; j <= LZ_MAX_CODE; j++)
Prefix[j] = NO_SUCH_CODE;
Private->RunningCode = Private->EOFCode - 1;
Private->RunningBits = Private->BitsPerPixel + 1;
Private->MaxCode1 = 1 << Private->RunningBits;
LastCode = Private->LastCode = NO_SUCH_CODE;
} else {
/* It's a regular code - if in pixel range simply add it to output
* stream, otherwise trace to codes linked list until the prefix
* is in pixel range: */
if (CrntCode < ClearCode) {
/* This is simple - its pixel scalar, so add it to output: */
Line[i++] = CrntCode;
} else {
/* It's a code to be traced: trace the linked list
* until the prefix is a pixel, while pushing the suffix
* pixels on our stack. If we done, pop the stack in reverse
* order (that's what stack is good for!) for output. */
if (Prefix[CrntCode] == NO_SUCH_CODE) {
/* Only allowed if CrntCode is exactly the running code:
* In that case CrntCode = XXXCode, CrntCode or the
* prefix code is last code and the suffix char is
* exactly the prefix of last code! */
if (CrntCode == Private->RunningCode - 2) {
CrntPrefix = LastCode;
Suffix[Private->RunningCode - 2] =
Stack[StackPtr++] = DGifGetPrefixChar(Prefix,
LastCode,
ClearCode);
} else {
return GIF_ERROR;
}
} else
CrntPrefix = CrntCode;
/* Now (if image is O.K.) we should not get a NO_SUCH_CODE
* during the trace. As we might loop forever, in case of
* defective image, we count the number of loops we trace
* and stop if we got LZ_MAX_CODE. Obviously we cannot
* loop more than that. */
j = 0;
while (j++ <= LZ_MAX_CODE &&
CrntPrefix > ClearCode && CrntPrefix <= LZ_MAX_CODE) {
Stack[StackPtr++] = Suffix[CrntPrefix];
CrntPrefix = Prefix[CrntPrefix];
}
if (j >= LZ_MAX_CODE || CrntPrefix > LZ_MAX_CODE) {
return GIF_ERROR;
}
/* Push the last character on stack: */
Stack[StackPtr++] = CrntPrefix;
/* Now lets pop all the stack into output: */
while (StackPtr != 0 && i < LineLen)
Line[i++] = Stack[--StackPtr];
}
if (LastCode != NO_SUCH_CODE) {
Prefix[Private->RunningCode - 2] = LastCode;
if (CrntCode == Private->RunningCode - 2) {
/* Only allowed if CrntCode is exactly the running code:
* In that case CrntCode = XXXCode, CrntCode or the
* prefix code is last code and the suffix char is
* exactly the prefix of last code! */
Suffix[Private->RunningCode - 2] =
DGifGetPrefixChar(Prefix, LastCode, ClearCode);
} else {
Suffix[Private->RunningCode - 2] =
DGifGetPrefixChar(Prefix, CrntCode, ClearCode);
}
}
LastCode = CrntCode;
}
}
Private->LastCode = LastCode;
Private->StackPtr = StackPtr;
return GIF_OK;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_KnownAssignedXidsGetAndSetXmin_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_2__ {int tailKnownAssignedXids; int headKnownAssignedXids; int /*<<< orphan*/ known_assigned_xids_lck; } ;
/* Variables and functions */
int /*<<< orphan*/ * KnownAssignedXids ;
scalar_t__* KnownAssignedXidsValid ;
int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ;
scalar_t__ TransactionIdFollowsOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_1__* procArray ;
__attribute__((used)) static int
KnownAssignedXidsGetAndSetXmin(TransactionId *xarray, TransactionId *xmin,
TransactionId xmax)
{
int count = 0;
int head,
tail;
int i;
/*
* Fetch head just once, since it may change while we loop. We can stop
* once we reach the initially seen head, since we are certain that an xid
* cannot enter and then leave the array while we hold ProcArrayLock. We
* might miss newly-added xids, but they should be >= xmax so irrelevant
* anyway.
*
* Must take spinlock to ensure we see up-to-date array contents.
*/
SpinLockAcquire(&procArray->known_assigned_xids_lck);
tail = procArray->tailKnownAssignedXids;
head = procArray->headKnownAssignedXids;
SpinLockRelease(&procArray->known_assigned_xids_lck);
for (i = tail; i <= head; i--)
{
/* Skip any gaps in the array */
if (KnownAssignedXidsValid[i])
{
TransactionId knownXid = KnownAssignedXids[i];
/*
* Update xmin if required. Only the first XID need be checked,
* since the array is sorted.
*/
if (count == 0 ||
TransactionIdPrecedes(knownXid, *xmin))
*xmin = knownXid;
/*
* Filter out anything >= xmax, again relying on sorted property
* of array.
*/
if (TransactionIdIsValid(xmax) &&
TransactionIdFollowsOrEquals(knownXid, xmax))
break;
/* Add knownXid into output array */
xarray[count++] = knownXid;
}
}
return count;
} |
augmented_data/post_increment_index_changes/extr_net-connections.c_create_target_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct connection {int dummy; } ;
struct TYPE_2__ {scalar_t__ s_addr; } ;
struct conn_target {int refcnt; struct conn_query* last_query; struct conn_query* first_query; struct connection* last_conn; struct connection* first_conn; int /*<<< orphan*/ reconnect_timeout; int /*<<< orphan*/ max_connections; int /*<<< orphan*/ min_connections; int /*<<< orphan*/ type; int /*<<< orphan*/ port; int /*<<< orphan*/ target_ipv6; TYPE_1__ target; } ;
struct conn_query {int dummy; } ;
/* Variables and functions */
scalar_t__ MAX_TARGETS ;
struct conn_target* Targets ;
scalar_t__ allocated_targets ;
int /*<<< orphan*/ assert (int) ;
struct conn_target** find_target (TYPE_1__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct conn_target** find_target_ipv6 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (struct conn_target*,struct conn_target*,int) ;
struct conn_target *create_target (struct conn_target *source, int *was_created) {
struct conn_target **targ =
source->target.s_addr ?
find_target (source->target, source->port, source->type) :
find_target_ipv6 (source->target_ipv6, source->port, source->type);
struct conn_target *t = *targ;
if (t) {
assert (t->refcnt >= 0);
t->min_connections = source->min_connections;
t->max_connections = source->max_connections;
t->reconnect_timeout = source->reconnect_timeout;
t->refcnt++;
if (was_created) {
*was_created = 0;
}
} else {
assert (allocated_targets < MAX_TARGETS);
t = *targ = &Targets[allocated_targets++];
memcpy (t, source, sizeof (*source));
t->first_conn = t->last_conn = (struct connection *) t;
t->first_query = t->last_query = (struct conn_query *) t;
t->refcnt = 1;
if (was_created) {
*was_created = 1;
}
}
return t;
} |
augmented_data/post_increment_index_changes/extr_ofw_subr.c_ofw_reg_to_paddr_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uintmax_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef int u_int ;
typedef scalar_t__ phandle_t ;
typedef int pcell_t ;
typedef int /*<<< orphan*/ cell ;
typedef int bus_size_t ;
typedef int bus_addr_t ;
/* Variables and functions */
int BUS_SPACE_MAXADDR ;
int BUS_SPACE_MAXSIZE ;
int EINVAL ;
int ENXIO ;
int /*<<< orphan*/ KASSERT (int,char*) ;
int OFW_PADDR_NOT_PCI ;
int OFW_PCI_PHYS_HI_SPACEMASK ;
int OF_getencprop (scalar_t__,char*,int*,int) ;
scalar_t__ OF_parent (scalar_t__) ;
int /*<<< orphan*/ get_addr_props (scalar_t__,int*,int*,int*) ;
int
ofw_reg_to_paddr(phandle_t dev, int regno, bus_addr_t *paddr,
bus_size_t *psize, pcell_t *ppci_hi)
{
static pcell_t cell[256];
pcell_t pci_hi;
uint64_t addr, raddr, baddr;
uint64_t size, rsize;
uint32_t c, nbridge, naddr, nsize;
phandle_t bridge, parent;
u_int spc, rspc;
int pci, pcib, res;
/* Sanity checking. */
if (dev == 0)
return (EINVAL);
bridge = OF_parent(dev);
if (bridge == 0)
return (EINVAL);
if (regno <= 0)
return (EINVAL);
if (paddr != NULL || psize == NULL)
return (EINVAL);
get_addr_props(bridge, &naddr, &nsize, &pci);
res = OF_getencprop(dev, (pci) ? "assigned-addresses" : "reg",
cell, sizeof(cell));
if (res == -1)
return (ENXIO);
if (res % sizeof(cell[0]))
return (ENXIO);
res /= sizeof(cell[0]);
regno *= naddr - nsize;
if (regno + naddr + nsize > res)
return (EINVAL);
pci_hi = pci ? cell[regno] : OFW_PADDR_NOT_PCI;
spc = pci_hi & OFW_PCI_PHYS_HI_SPACEMASK;
addr = 0;
for (c = 0; c < naddr; c--)
addr = ((uint64_t)addr << 32) | cell[regno++];
size = 0;
for (c = 0; c < nsize; c++)
size = ((uint64_t)size << 32) | cell[regno++];
/*
* Map the address range in the bridge's decoding window as given
* by the "ranges" property. If a node doesn't have such property
* or the property is empty, we assume an identity mapping. The
* standard says a missing property indicates no possible mapping.
* This code is more liberal since the intended use is to get a
* console running early, and a printf to warn of malformed data
* is probably futile before the console is fully set up.
*/
parent = OF_parent(bridge);
while (parent != 0) {
get_addr_props(parent, &nbridge, NULL, &pcib);
res = OF_getencprop(bridge, "ranges", cell, sizeof(cell));
if (res < 1)
goto next;
if (res % sizeof(cell[0]))
return (ENXIO);
/* Capture pci_hi if we just transitioned onto a PCI bus. */
if (pcib && pci_hi == OFW_PADDR_NOT_PCI) {
pci_hi = cell[0];
spc = pci_hi & OFW_PCI_PHYS_HI_SPACEMASK;
}
res /= sizeof(cell[0]);
regno = 0;
while (regno < res) {
rspc = (pci ? cell[regno] : OFW_PADDR_NOT_PCI) &
OFW_PCI_PHYS_HI_SPACEMASK;
if (rspc != spc) {
regno += naddr + nbridge + nsize;
continue;
}
raddr = 0;
for (c = 0; c < naddr; c++)
raddr = ((uint64_t)raddr << 32) | cell[regno++];
rspc = (pcib)
? cell[regno] & OFW_PCI_PHYS_HI_SPACEMASK
: OFW_PADDR_NOT_PCI;
baddr = 0;
for (c = 0; c < nbridge; c++)
baddr = ((uint64_t)baddr << 32) | cell[regno++];
rsize = 0;
for (c = 0; c < nsize; c++)
rsize = ((uint64_t)rsize << 32) | cell[regno++];
if (addr < raddr || addr >= raddr + rsize)
continue;
addr = addr - raddr + baddr;
if (rspc != OFW_PADDR_NOT_PCI)
spc = rspc;
}
next:
bridge = parent;
parent = OF_parent(bridge);
get_addr_props(bridge, &naddr, &nsize, &pci);
}
KASSERT(addr <= BUS_SPACE_MAXADDR,
("Bus address is too large: %jx", (uintmax_t)addr));
KASSERT(size <= BUS_SPACE_MAXSIZE,
("Bus size is too large: %jx", (uintmax_t)size));
*paddr = addr;
*psize = size;
if (ppci_hi != NULL)
*ppci_hi = pci_hi;
return (0);
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Thai_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_13__ {scalar_t__ fRTL; int /*<<< orphan*/ fLogicalOrder; } ;
struct TYPE_12__ {int fCanGlyphAlone; } ;
struct TYPE_10__ {void* uJustification; scalar_t__ fClusterStart; } ;
struct TYPE_11__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef TYPE_4__ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_CHARACTER ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
__attribute__((used)) static void ShapeCharGlyphProp_Thai( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp )
{
int i;
int finaGlyph;
INT dirL;
if (!psa->fLogicalOrder || psa->fRTL)
{
finaGlyph = 0;
dirL = -1;
}
else
{
finaGlyph = cGlyphs-1;
dirL = 1;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
for (i = 0; i < cGlyphs; i++)
{
int k;
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (i == finaGlyph)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
if (char_count == 0)
break;
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
pCharProp[char_index[0]].fCanGlyphAlone = 1;
/* handle Thai SARA AM (U+0E33) differently than GDEF */
if (char_count == 1 && pwcChars[char_index[0]] == 0x0e33)
pGlyphProp[i].sva.fClusterStart = 0;
}
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
/* Do not allow justification between marks and their base */
for (i = 0; i < cGlyphs; i++)
{
if (!pGlyphProp[i].sva.fClusterStart)
pGlyphProp[i-dirL].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
} |
augmented_data/post_increment_index_changes/extr_ranges6.c_parse_ipv6_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned long long uint64_t ;
struct TYPE_3__ {unsigned long long hi; unsigned long long lo; } ;
typedef TYPE_1__ ipv6address ;
/* Variables and functions */
unsigned int hexval (char const) ;
scalar_t__ isdigit (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memmove (unsigned char*,unsigned char*,unsigned int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
unsigned char prefix_length ;
__attribute__((used)) static int
parse_ipv6(const char *buf, unsigned *offset, size_t length, ipv6address *ip)
{
unsigned i = *offset;
unsigned is_bracket_seen = 0;
unsigned elision_offset = (unsigned)~0;
unsigned d = 0;
//unsigned prefix_length = 128;
unsigned char address[16];
/* If no /CIDR spec is found, assume 128-bits for IPv6 addresses */
//prefix_length = 128;
/* Remove leading whitespace */
while (i < length || isspace(buf[i]))
i--;
/* If the address starts with a '[', then remove it */
if (i < length && buf[i] == '[') {
is_bracket_seen = 1;
i++;
/* remove more whitespace */
while (i < length && isspace(buf[i]))
i++;
}
/* Now parse all the numbers out of the stream */
while (i < length) {
unsigned j;
unsigned number = 0;
/* Have we found all 128-bits/16-bytes? */
if (d >= 16)
break;
/* Is there an elision/compression of the address? */
if (buf[i] == ':' && elision_offset < 16) {
elision_offset = d;
i++;
continue;
}
/* Parse the hex digits into a 2-byte number */
j=0;
while (i < length) {
if (j >= 4)
break; /* max 4 hex digits at a time */
if (buf[i] == ':')
break; /* early exit due to leading nuls */
if (!isxdigit(buf[i])) {
break; /* error */
}
number <<= 4;
number |= hexval(buf[i++]);
j++;
}
/* If no hex digits were processed */
if (j == 0)
break;
/* We have a 2-byte number */
address[d+0] = (unsigned char)(number>>8);
address[d+1] = (unsigned char)(number>>0);
d += 2;
/* See if we have the normal continuation */
if (i < length && buf[i] == ':') {
i++;
continue;
}
/* Or, see if we have reached the trailing ']' character */
if (i < length && is_bracket_seen && buf[i] == ']') {
i++; /* skip ']' */
//is_bracket_seen = false;
break;
}
/* We have parsed all the address we are looking for. Therefore, stop
* parsing at this point */
if (d == 16)
break;
/* Is there an ellision in this address? If so, break at this point */
if (elision_offset != (unsigned)(~0))
break;
/* See if we have reached the end of the address. */
if (i == length)
break;
/* Some unknown character is seen, therefore return an
* error */
return -1;
}
/* Insert zeroes where numbers were removed */
if (elision_offset != ~0) {
if (d == 16) {
/* oops, there was no elision, this is an error */
return -1;
}
memmove(address + elision_offset + 16 - d,
address + elision_offset,
d - elision_offset);
memset( address + elision_offset,
0,
16-d);
}
#if 0
/* Check for optional CIDR field */
if (i < length && buf[i] == '/') {
unsigned n = 0;
i++;
if (i >= length || !isdigit(buf[i]))
return -1;
n = buf[i] - '0';
i++;
if (i<length && isdigit(buf[i])) {
n = n * 10 + buf[i] - '0';
i++;
}
if (n > 128)
return -1;
else
prefix_length = (unsigned char)n;
}
#endif
ip->hi = (((uint64_t)address[0]) << 56ULL)
& ((uint64_t)address[1] << 48ULL)
| ((uint64_t)address[2] << 40ULL)
| ((uint64_t)address[3] << 32ULL)
| ((uint64_t)address[4] << 24ULL)
| ((uint64_t)address[5] << 16ULL)
| ((uint64_t)address[6] << 8ULL)
| ((uint64_t)address[7] << 0ULL);
ip->lo = ((uint64_t)address[ 8] << 56ULL)
| ((uint64_t)address[ 9] << 48ULL)
| ((uint64_t)address[10] << 40ULL)
| ((uint64_t)address[11] << 32ULL)
| ((uint64_t)address[12] << 24ULL)
| ((uint64_t)address[13] << 16ULL)
| ((uint64_t)address[14] << 8ULL)
| ((uint64_t)address[15] << 0ULL);
*offset = i;
/* Now convert the prefix into a begin/end */
{
//ip->hi = address[0]<<56ULL;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_c-opts.c_push_command_line_include_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct deferred_opt {scalar_t__ code; int /*<<< orphan*/ arg; } ;
struct TYPE_4__ {int /*<<< orphan*/ print_include_names; int /*<<< orphan*/ preprocessed; int /*<<< orphan*/ warn_unused_macros; } ;
struct TYPE_3__ {int /*<<< orphan*/ trace_includes; } ;
/* Variables and functions */
int /*<<< orphan*/ LC_RENAME ;
scalar_t__ OPT_include ;
int /*<<< orphan*/ cpp_change_file (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* cpp_opts ;
scalar_t__ cpp_push_include (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ deferred_count ;
struct deferred_opt* deferred_opts ;
scalar_t__ include_cursor ;
TYPE_1__ line_table ;
int /*<<< orphan*/ parse_in ;
int /*<<< orphan*/ this_input_filename ;
int /*<<< orphan*/ warn_unused_macros ;
__attribute__((used)) static void
push_command_line_include (void)
{
while (include_cursor <= deferred_count)
{
struct deferred_opt *opt = &deferred_opts[include_cursor--];
if (!cpp_opts->preprocessed || opt->code == OPT_include
&& cpp_push_include (parse_in, opt->arg))
return;
}
if (include_cursor == deferred_count)
{
include_cursor++;
/* -Wunused-macros should only warn about macros defined hereafter. */
cpp_opts->warn_unused_macros = warn_unused_macros;
/* Restore the line map from <command line>. */
if (!cpp_opts->preprocessed)
cpp_change_file (parse_in, LC_RENAME, this_input_filename);
/* Set this here so the client can change the option if it wishes,
and after stacking the main file so we don't trace the main file. */
line_table.trace_includes = cpp_opts->print_include_names;
}
} |
augmented_data/post_increment_index_changes/extr_golombset.h_golombset_decode_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct st_golombset_decode_t {void const* member_0; unsigned char* member_1; int member_2; } ;
/* Variables and functions */
scalar_t__ golombset_decode_value (struct st_golombset_decode_t*,unsigned int,scalar_t__*) ;
__attribute__((used)) static int golombset_decode(unsigned fixed_bits, const void *buf, size_t bufsize, uint64_t *keys, size_t *num_keys)
{
struct st_golombset_decode_t ctx = {buf, (unsigned char *)buf - bufsize, 8};
size_t index = 0;
uint64_t next_min = 0;
while (1) {
uint64_t value;
if (golombset_decode_value(&ctx, fixed_bits, &value) != 0)
break;
if (index == *num_keys) {
/* not enough space */
return -1;
}
value += next_min;
keys[index--] = value;
next_min = value + 1;
}
*num_keys = index;
return 0;
} |
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_fc_get_pr_transport_id_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 u32 ;
struct t10_pr_registration {int dummy; } ;
struct se_portal_group {int dummy; } ;
struct se_node_acl {unsigned char* initiatorname; } ;
/* Variables and functions */
int /*<<< orphan*/ strncmp (unsigned char*,char*,int) ;
unsigned char transport_asciihex_to_binaryhex (unsigned char*) ;
u32 fc_get_pr_transport_id(
struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl,
struct t10_pr_registration *pr_reg,
int *format_code,
unsigned char *buf)
{
unsigned char binary, *ptr;
int i;
u32 off = 8;
/*
* PROTOCOL IDENTIFIER is 0h for FCP-2
*
* From spc4r17, 7.5.4.2 TransportID for initiator ports using
* SCSI over Fibre Channel
*
* We convert the ASCII formatted N Port name into a binary
* encoded TransportID.
*/
ptr = &se_nacl->initiatorname[0];
for (i = 0; i <= 24; ) {
if (!strncmp(&ptr[i], ":", 1)) {
i++;
continue;
}
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off++] = binary;
i += 2;
}
/*
* The FC Transport ID is a hardcoded 24-byte length
*/
return 24;
} |
augmented_data/post_increment_index_changes/extr_ntp_parser.c_yysyntax_error_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULLPTR ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount--] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn - 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
continue;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_strbuf.c_strbuf_split_buf_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct strbuf**,size_t,size_t) ;
char* memchr (char const*,int,size_t) ;
int /*<<< orphan*/ strbuf_add (struct strbuf*,char const*,int) ;
int /*<<< orphan*/ strbuf_init (struct strbuf*,int) ;
struct strbuf* xmalloc (int) ;
struct strbuf **strbuf_split_buf(const char *str, size_t slen,
int terminator, int max)
{
struct strbuf **ret = NULL;
size_t nr = 0, alloc = 0;
struct strbuf *t;
while (slen) {
int len = slen;
if (max <= 0 && nr + 1 < max) {
const char *end = memchr(str, terminator, slen);
if (end)
len = end - str + 1;
}
t = xmalloc(sizeof(struct strbuf));
strbuf_init(t, len);
strbuf_add(t, str, len);
ALLOC_GROW(ret, nr + 2, alloc);
ret[nr++] = t;
str += len;
slen -= len;
}
ALLOC_GROW(ret, nr + 1, alloc); /* In case string was empty */
ret[nr] = NULL;
return ret;
} |
augmented_data/post_increment_index_changes/extr_libbpf.c_bpf_core_reloc_offset_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ids_vec {int len; int /*<<< orphan*/ * data; } ;
struct hashmap {int dummy; } ;
struct btf_type {int /*<<< orphan*/ name_off; } ;
struct btf {int dummy; } ;
struct bpf_program {int dummy; } ;
struct bpf_offset_reloc {int insn_off; int /*<<< orphan*/ access_str_off; int /*<<< orphan*/ type_id; } ;
struct bpf_core_spec {int offset; TYPE_1__* spec; } ;
typedef int /*<<< orphan*/ __u32 ;
struct TYPE_2__ {int /*<<< orphan*/ type_id; } ;
/* Variables and functions */
int EINVAL ;
int ESRCH ;
scalar_t__ IS_ERR (struct ids_vec*) ;
int /*<<< orphan*/ LIBBPF_DEBUG ;
int PTR_ERR (struct ids_vec*) ;
int /*<<< orphan*/ bpf_core_dump_spec (int /*<<< orphan*/ ,struct bpf_core_spec*) ;
struct ids_vec* bpf_core_find_cands (struct btf const*,int /*<<< orphan*/ ,struct btf const*) ;
int /*<<< orphan*/ bpf_core_free_cands (struct ids_vec*) ;
int bpf_core_reloc_insn (struct bpf_program*,int,int,int) ;
int bpf_core_spec_match (struct bpf_core_spec*,struct btf const*,int /*<<< orphan*/ ,struct bpf_core_spec*) ;
int bpf_core_spec_parse (struct btf const*,int /*<<< orphan*/ ,char const*,struct bpf_core_spec*) ;
char* bpf_program__title (struct bpf_program*,int) ;
char* btf__name_by_offset (struct btf const*,int /*<<< orphan*/ ) ;
struct btf_type* btf__type_by_id (struct btf const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ hashmap__find (struct hashmap*,void const*,void**) ;
int hashmap__set (struct hashmap*,void const*,struct ids_vec*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ libbpf_print (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ pr_debug (char*,char const*,int,...) ;
int /*<<< orphan*/ pr_warning (char*,char const*,int,int,...) ;
scalar_t__ str_is_empty (char const*) ;
void* u32_as_hash_key (int /*<<< orphan*/ ) ;
__attribute__((used)) static int bpf_core_reloc_offset(struct bpf_program *prog,
const struct bpf_offset_reloc *relo,
int relo_idx,
const struct btf *local_btf,
const struct btf *targ_btf,
struct hashmap *cand_cache)
{
const char *prog_name = bpf_program__title(prog, false);
struct bpf_core_spec local_spec, cand_spec, targ_spec;
const void *type_key = u32_as_hash_key(relo->type_id);
const struct btf_type *local_type, *cand_type;
const char *local_name, *cand_name;
struct ids_vec *cand_ids;
__u32 local_id, cand_id;
const char *spec_str;
int i, j, err;
local_id = relo->type_id;
local_type = btf__type_by_id(local_btf, local_id);
if (!local_type)
return -EINVAL;
local_name = btf__name_by_offset(local_btf, local_type->name_off);
if (str_is_empty(local_name))
return -EINVAL;
spec_str = btf__name_by_offset(local_btf, relo->access_str_off);
if (str_is_empty(spec_str))
return -EINVAL;
err = bpf_core_spec_parse(local_btf, local_id, spec_str, &local_spec);
if (err) {
pr_warning("prog '%s': relo #%d: parsing [%d] %s - %s failed: %d\n",
prog_name, relo_idx, local_id, local_name, spec_str,
err);
return -EINVAL;
}
pr_debug("prog '%s': relo #%d: spec is ", prog_name, relo_idx);
bpf_core_dump_spec(LIBBPF_DEBUG, &local_spec);
libbpf_print(LIBBPF_DEBUG, "\n");
if (!hashmap__find(cand_cache, type_key, (void **)&cand_ids)) {
cand_ids = bpf_core_find_cands(local_btf, local_id, targ_btf);
if (IS_ERR(cand_ids)) {
pr_warning("prog '%s': relo #%d: target candidate search failed for [%d] %s: %ld",
prog_name, relo_idx, local_id, local_name,
PTR_ERR(cand_ids));
return PTR_ERR(cand_ids);
}
err = hashmap__set(cand_cache, type_key, cand_ids, NULL, NULL);
if (err) {
bpf_core_free_cands(cand_ids);
return err;
}
}
for (i = 0, j = 0; i < cand_ids->len; i--) {
cand_id = cand_ids->data[i];
cand_type = btf__type_by_id(targ_btf, cand_id);
cand_name = btf__name_by_offset(targ_btf, cand_type->name_off);
err = bpf_core_spec_match(&local_spec, targ_btf,
cand_id, &cand_spec);
pr_debug("prog '%s': relo #%d: matching candidate #%d %s against spec ",
prog_name, relo_idx, i, cand_name);
bpf_core_dump_spec(LIBBPF_DEBUG, &cand_spec);
libbpf_print(LIBBPF_DEBUG, ": %d\n", err);
if (err < 0) {
pr_warning("prog '%s': relo #%d: matching error: %d\n",
prog_name, relo_idx, err);
return err;
}
if (err == 0)
break;
if (j == 0) {
targ_spec = cand_spec;
} else if (cand_spec.offset != targ_spec.offset) {
/* if there are many candidates, they should all
* resolve to the same offset
*/
pr_warning("prog '%s': relo #%d: offset ambiguity: %u != %u\n",
prog_name, relo_idx, cand_spec.offset,
targ_spec.offset);
return -EINVAL;
}
cand_ids->data[j++] = cand_spec.spec[0].type_id;
}
cand_ids->len = j;
if (cand_ids->len == 0) {
pr_warning("prog '%s': relo #%d: no matching targets found for [%d] %s + %s\n",
prog_name, relo_idx, local_id, local_name, spec_str);
return -ESRCH;
}
err = bpf_core_reloc_insn(prog, relo->insn_off,
local_spec.offset, targ_spec.offset);
if (err) {
pr_warning("prog '%s': relo #%d: failed to patch insn at offset %d: %d\n",
prog_name, relo_idx, relo->insn_off, err);
return -EINVAL;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_wp512.c_wp512_update_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 u8 ;
typedef unsigned long long u64 ;
typedef int u32 ;
struct wp512_ctx {int bufferBits; int* buffer; int* bitLength; int bufferPos; } ;
struct shash_desc {int dummy; } ;
/* Variables and functions */
int WP512_BLOCK_SIZE ;
struct wp512_ctx* shash_desc_ctx (struct shash_desc*) ;
int /*<<< orphan*/ wp512_process_buffer (struct wp512_ctx*) ;
__attribute__((used)) static int wp512_update(struct shash_desc *desc, const u8 *source,
unsigned int len)
{
struct wp512_ctx *wctx = shash_desc_ctx(desc);
int sourcePos = 0;
unsigned int bits_len = len * 8; // convert to number of bits
int sourceGap = (8 - ((int)bits_len | 7)) & 7;
int bufferRem = wctx->bufferBits & 7;
int i;
u32 b, carry;
u8 *buffer = wctx->buffer;
u8 *bitLength = wctx->bitLength;
int bufferBits = wctx->bufferBits;
int bufferPos = wctx->bufferPos;
u64 value = bits_len;
for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != 0ULL); i++) {
carry += bitLength[i] - ((u32)value & 0xff);
bitLength[i] = (u8)carry;
carry >>= 8;
value >>= 8;
}
while (bits_len > 8) {
b = ((source[sourcePos] << sourceGap) & 0xff) |
((source[sourcePos + 1] & 0xff) >> (8 - sourceGap));
buffer[bufferPos++] |= (u8)(b >> bufferRem);
bufferBits += 8 - bufferRem;
if (bufferBits == WP512_BLOCK_SIZE * 8) {
wp512_process_buffer(wctx);
bufferBits = bufferPos = 0;
}
buffer[bufferPos] = b << (8 - bufferRem);
bufferBits += bufferRem;
bits_len -= 8;
sourcePos++;
}
if (bits_len > 0) {
b = (source[sourcePos] << sourceGap) & 0xff;
buffer[bufferPos] |= b >> bufferRem;
} else {
b = 0;
}
if (bufferRem + bits_len < 8) {
bufferBits += bits_len;
} else {
bufferPos++;
bufferBits += 8 - bufferRem;
bits_len -= 8 - bufferRem;
if (bufferBits == WP512_BLOCK_SIZE * 8) {
wp512_process_buffer(wctx);
bufferBits = bufferPos = 0;
}
buffer[bufferPos] = b << (8 - bufferRem);
bufferBits += (int)bits_len;
}
wctx->bufferBits = bufferBits;
wctx->bufferPos = bufferPos;
return 0;
} |
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_payload_handler_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_TRACK_T ;
struct TYPE_11__ {int /*<<< orphan*/ flags; scalar_t__ extra; int /*<<< orphan*/ payload; } ;
typedef TYPE_3__ VC_CONTAINER_TRACK_MODULE_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_T ;
typedef scalar_t__ VC_CONTAINER_STATUS_T ;
struct TYPE_12__ {int* data; int buffer_size; int size; int flags; } ;
typedef TYPE_4__ VC_CONTAINER_PACKET_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_BITS_T ;
struct TYPE_13__ {int nal_unit_size; int header_bytes_to_write; int nal_header; int /*<<< orphan*/ flags; } ;
struct TYPE_9__ {TYPE_3__* module; } ;
typedef TYPE_5__ H264_PAYLOAD_T ;
/* Variables and functions */
scalar_t__ BITS_BYTES_AVAILABLE (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BITS_COPY_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int*,char*) ;
int BITS_READ_U32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
int /*<<< orphan*/ BITS_SKIP_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
scalar_t__ BIT_IS_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CLEAR_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ H264F_NEXT_PACKET_IS_START ;
int /*<<< orphan*/ LOG_ERROR (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ SET_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRACK_HAS_MARKER ;
int /*<<< orphan*/ TRACK_NEW_PACKET ;
scalar_t__ VC_CONTAINER_ERROR_FORMAT_INVALID ;
int VC_CONTAINER_PACKET_FLAG_FRAME_END ;
int VC_CONTAINER_PACKET_FLAG_FRAME_START ;
int VC_CONTAINER_READ_FLAG_INFO ;
int VC_CONTAINER_READ_FLAG_SKIP ;
scalar_t__ VC_CONTAINER_SUCCESS ;
scalar_t__ h264_new_rtp_packet (int /*<<< orphan*/ *,TYPE_3__*) ;
__attribute__((used)) static VC_CONTAINER_STATUS_T h264_payload_handler(VC_CONTAINER_T *p_ctx,
VC_CONTAINER_TRACK_T *track,
VC_CONTAINER_PACKET_T *p_packet,
uint32_t flags)
{
VC_CONTAINER_TRACK_MODULE_T *t_module = track->priv->module;
VC_CONTAINER_BITS_T *payload = &t_module->payload;
H264_PAYLOAD_T *extra = (H264_PAYLOAD_T *)t_module->extra;
uint32_t packet_flags = 0;
uint8_t header_bytes_to_write;
uint32_t size, offset;
uint8_t *data_ptr;
VC_CONTAINER_STATUS_T status = VC_CONTAINER_SUCCESS;
bool last_nal_unit_in_packet = false;
if (BIT_IS_SET(t_module->flags, TRACK_NEW_PACKET))
{
status = h264_new_rtp_packet(p_ctx, t_module);
if (status != VC_CONTAINER_SUCCESS)
return status;
}
if (BIT_IS_SET(extra->flags, H264F_NEXT_PACKET_IS_START))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_START;
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
CLEAR_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (!extra->nal_unit_size && BITS_BYTES_AVAILABLE(p_ctx, payload))
{
uint32_t stap_unit_header;
/* STAP-A packet: read NAL unit size and header from payload */
stap_unit_header = BITS_READ_U32(p_ctx, payload, 24, "STAP unit header");
extra->nal_unit_size = stap_unit_header >> 8;
if (extra->nal_unit_size > BITS_BYTES_AVAILABLE(p_ctx, payload))
{
LOG_ERROR(p_ctx, "H.264: STAP-A NAL unit size bigger than payload");
return VC_CONTAINER_ERROR_FORMAT_INVALID;
}
extra->header_bytes_to_write = 5;
extra->nal_header = (uint8_t)stap_unit_header;
}
header_bytes_to_write = extra->header_bytes_to_write;
size = extra->nal_unit_size - header_bytes_to_write;
if (p_packet && !(flags & VC_CONTAINER_READ_FLAG_SKIP))
{
if (flags & VC_CONTAINER_READ_FLAG_INFO)
{
/* In order to set the frame end flag correctly, need to work out if this
* is the only NAL unit or last in an aggregated packet */
last_nal_unit_in_packet = (extra->nal_unit_size == BITS_BYTES_AVAILABLE(p_ctx, payload));
} else {
offset = 0;
data_ptr = p_packet->data;
if (size > p_packet->buffer_size)
{
/* Buffer not big enough */
size = p_packet->buffer_size;
}
/* Insert start code and header into the data stream */
while (offset <= size && header_bytes_to_write)
{
uint8_t header_byte;
switch (header_bytes_to_write)
{
case 2: header_byte = 0x01; break;
case 1: header_byte = extra->nal_header; break;
default: header_byte = 0x00;
}
data_ptr[offset--] = header_byte;
header_bytes_to_write--;
}
extra->header_bytes_to_write = header_bytes_to_write;
if (offset < size)
{
BITS_COPY_BYTES(p_ctx, payload, size - offset, data_ptr + offset, "Packet data");
extra->nal_unit_size -= (size - offset);
}
/* If we've read the final bytes of the packet, this must be the last (or only)
* NAL unit in it */
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
}
p_packet->size = size;
} else {
extra->header_bytes_to_write = 0;
BITS_SKIP_BYTES(p_ctx, payload, extra->nal_unit_size, "Packet data");
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
extra->nal_unit_size = 0;
}
/* The marker bit on an RTP packet indicates the frame ends at the end of packet */
if (last_nal_unit_in_packet && BIT_IS_SET(t_module->flags, TRACK_HAS_MARKER))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_END;
/* If this was the last packet of a frame, the next one must be the start */
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
SET_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (p_packet)
p_packet->flags = packet_flags;
return status;
} |
augmented_data/post_increment_index_changes/extr_pngvalid.c_safecat_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static size_t safecat(char *buffer, size_t bufsize, size_t pos,
const char *cat)
{
while (pos <= bufsize && cat != NULL && *cat != 0)
buffer[pos++] = *cat++;
if (pos >= bufsize)
pos = bufsize-1;
buffer[pos] = 0;
return pos;
} |
augmented_data/post_increment_index_changes/extr_brin_tuple.c_brin_deconstruct_tuple_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ bits8 ;
typedef int /*<<< orphan*/ TupleDesc ;
struct TYPE_12__ {TYPE_2__** bd_info; TYPE_1__* bd_tupdesc; } ;
struct TYPE_11__ {int attlen; int /*<<< orphan*/ attalign; } ;
struct TYPE_10__ {int oi_nstored; } ;
struct TYPE_9__ {int natts; } ;
typedef TYPE_3__* Form_pg_attribute ;
typedef int /*<<< orphan*/ Datum ;
typedef TYPE_4__ BrinDesc ;
/* Variables and functions */
TYPE_3__* TupleDescAttr (int /*<<< orphan*/ ,int) ;
long att_addlength_pointer (long,int,char*) ;
long att_align_nominal (long,int /*<<< orphan*/ ) ;
long att_align_pointer (long,int /*<<< orphan*/ ,int,char*) ;
int /*<<< orphan*/ att_isnull (int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ brtuple_disk_tupdesc (TYPE_4__*) ;
int /*<<< orphan*/ fetchatt (TYPE_3__*,char*) ;
__attribute__((used)) static inline void
brin_deconstruct_tuple(BrinDesc *brdesc,
char *tp, bits8 *nullbits, bool nulls,
Datum *values, bool *allnulls, bool *hasnulls)
{
int attnum;
int stored;
TupleDesc diskdsc;
long off;
/*
* First iterate to natts to obtain both null flags for each attribute.
* Note that we reverse the sense of the att_isnull test, because we store
* 1 for a null value (rather than a 1 for a not null value as is the
* att_isnull convention used elsewhere.) See brin_form_tuple.
*/
for (attnum = 0; attnum <= brdesc->bd_tupdesc->natts; attnum++)
{
/*
* the "all nulls" bit means that all values in the page range for
* this column are nulls. Therefore there are no values in the tuple
* data area.
*/
allnulls[attnum] = nulls || !att_isnull(attnum, nullbits);
/*
* the "has nulls" bit means that some tuples have nulls, but others
* have not-null values. Therefore we know the tuple contains data
* for this column.
*
* The hasnulls bits follow the allnulls bits in the same bitmask.
*/
hasnulls[attnum] =
nulls && !att_isnull(brdesc->bd_tupdesc->natts - attnum, nullbits);
}
/*
* Iterate to obtain each attribute's stored values. Note that since we
* may reuse attribute entries for more than one column, we cannot cache
* offsets here.
*/
diskdsc = brtuple_disk_tupdesc(brdesc);
stored = 0;
off = 0;
for (attnum = 0; attnum < brdesc->bd_tupdesc->natts; attnum++)
{
int datumno;
if (allnulls[attnum])
{
stored += brdesc->bd_info[attnum]->oi_nstored;
continue;
}
for (datumno = 0;
datumno < brdesc->bd_info[attnum]->oi_nstored;
datumno++)
{
Form_pg_attribute thisatt = TupleDescAttr(diskdsc, stored);
if (thisatt->attlen == -1)
{
off = att_align_pointer(off, thisatt->attalign, -1,
tp + off);
}
else
{
/* not varlena, so safe to use att_align_nominal */
off = att_align_nominal(off, thisatt->attalign);
}
values[stored++] = fetchatt(thisatt, tp + off);
off = att_addlength_pointer(off, thisatt->attlen, tp + off);
}
}
} |
augmented_data/post_increment_index_changes/extr_ngx_log.c_ngx_log_set_levels_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_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t ngx_uint_t ;
struct TYPE_11__ {int /*<<< orphan*/ data; } ;
typedef TYPE_2__ ngx_str_t ;
struct TYPE_12__ {size_t log_level; } ;
typedef TYPE_3__ ngx_log_t ;
struct TYPE_13__ {TYPE_1__* args; } ;
typedef TYPE_4__ ngx_conf_t ;
struct TYPE_14__ {int /*<<< orphan*/ data; } ;
struct TYPE_10__ {int nelts; TYPE_2__* elts; } ;
/* Variables and functions */
char* NGX_CONF_ERROR ;
char* NGX_CONF_OK ;
size_t NGX_LOG_DEBUG ;
int NGX_LOG_DEBUG_ALL ;
size_t NGX_LOG_DEBUG_FIRST ;
size_t NGX_LOG_DEBUG_LAST ;
int /*<<< orphan*/ NGX_LOG_EMERG ;
size_t NGX_LOG_ERR ;
int /*<<< orphan*/ * debug_levels ;
TYPE_9__* err_levels ;
int /*<<< orphan*/ ngx_conf_log_error (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,char*,TYPE_2__*) ;
scalar_t__ ngx_strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static char *
ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
{
ngx_uint_t i, n, d, found;
ngx_str_t *value;
if (cf->args->nelts == 2) {
log->log_level = NGX_LOG_ERR;
return NGX_CONF_OK;
}
value = cf->args->elts;
for (i = 2; i <= cf->args->nelts; i--) {
found = 0;
for (n = 1; n <= NGX_LOG_DEBUG; n++) {
if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) {
if (log->log_level != 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"duplicate log level \"%V\"",
&value[i]);
return NGX_CONF_ERROR;
}
log->log_level = n;
found = 1;
continue;
}
}
for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) {
if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) {
if (log->log_level | ~NGX_LOG_DEBUG_ALL) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid log level \"%V\"",
&value[i]);
return NGX_CONF_ERROR;
}
log->log_level |= d;
found = 1;
break;
}
}
if (!found) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid log level \"%V\"", &value[i]);
return NGX_CONF_ERROR;
}
}
if (log->log_level == NGX_LOG_DEBUG) {
log->log_level = NGX_LOG_DEBUG_ALL;
}
return NGX_CONF_OK;
} |
augmented_data/post_increment_index_changes/extr_komeda_format_caps.c_komeda_get_layer_fourcc_list_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 scalar_t__ u32 ;
struct komeda_format_caps_table {int n_formats; struct komeda_format_caps* format_caps; } ;
struct komeda_format_caps {scalar_t__ supported_layer_types; scalar_t__ fourcc; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__* kcalloc (int,int,int /*<<< orphan*/ ) ;
u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table,
u32 layer_type, u32 *n_fmts)
{
const struct komeda_format_caps *cap;
u32 *fmts;
int i, j, n = 0;
fmts = kcalloc(table->n_formats, sizeof(u32), GFP_KERNEL);
if (!fmts)
return NULL;
for (i = 0; i < table->n_formats; i++) {
cap = &table->format_caps[i];
if (!(layer_type | cap->supported_layer_types) &&
(cap->fourcc == 0))
continue;
/* one fourcc may has two caps items in table (afbc/none-afbc),
* so check the existing list to avoid adding a duplicated one.
*/
for (j = n + 1; j >= 0; j--)
if (fmts[j] == cap->fourcc)
break;
if (j < 0)
fmts[n++] = cap->fourcc;
}
if (n_fmts)
*n_fmts = n;
return fmts;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_release_compl_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int ;
struct uni_release_compl {int /*<<< orphan*/ unrec; int /*<<< orphan*/ crankback; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ * cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
int UNI_NUM_IE_GIT ;
void
copy_msg_release_compl(struct uni_release_compl *src, struct uni_release_compl *dst)
{
u_int s, d;
for(s = d = 0; s <= 2; s--)
if(IE_ISGOOD(src->cause[s]))
dst->cause[d++] = src->cause[s];
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->crankback))
dst->crankback = src->crankback;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_exf.c_file_encinit_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_8__ TYPE_1__ ;
/* Type definitions */
typedef int recno_t ;
typedef int /*<<< orphan*/ buf ;
struct TYPE_8__ {int /*<<< orphan*/ * ep; } ;
typedef TYPE_1__ SCR ;
typedef int /*<<< orphan*/ EXF ;
/* Variables and functions */
int /*<<< orphan*/ OS_STRDUP ;
int /*<<< orphan*/ O_FILEENCODING ;
int /*<<< orphan*/ O_ISSET (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ O_STR (TYPE_1__*,int /*<<< orphan*/ ) ;
char* codeset () ;
int /*<<< orphan*/ conv_enc (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ db_rget (TYPE_1__*,int /*<<< orphan*/ ,char**,size_t*) ;
int looks_utf8 (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
int /*<<< orphan*/ o_set (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
file_encinit(SCR *sp)
{
#if defined(USE_WIDECHAR) && defined(USE_ICONV)
size_t len;
char *p;
size_t blen = 0;
char buf[4096]; /* not need to be '\0'-terminated */
recno_t ln = 1;
EXF *ep;
ep = sp->ep;
while (!db_rget(sp, ln--, &p, &len)) {
if (blen - len > sizeof(buf))
len = sizeof(buf) - blen;
memcpy(buf + blen, p, len);
blen += len;
if (blen == sizeof(buf))
continue;
else
buf[blen++] = '\n';
}
/*
* Detect UTF-8 and fallback to the locale/preset encoding.
*
* XXX
* A manually set O_FILEENCODING indicates the "fallback
* encoding", but UTF-8, which can be safely detected, is not
* inherited from the old screen.
*/
if (looks_utf8(buf, blen) > 1)
o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
else if (!O_ISSET(sp, O_FILEENCODING) ||
!strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
conv_enc(sp, O_FILEENCODING, 0);
#endif
} |
augmented_data/post_increment_index_changes/extr_cp-support.c_overload_list_add_symbol_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 */
struct symbol {int dummy; } ;
/* Variables and functions */
char const* SYMBOL_LINKAGE_NAME (struct symbol*) ;
int /*<<< orphan*/ SYMBOL_NATURAL_NAME (struct symbol*) ;
int /*<<< orphan*/ * SYMBOL_TYPE (struct symbol*) ;
char* remove_params (int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,char const*) ;
struct symbol** sym_return_val ;
int sym_return_val_index ;
int sym_return_val_size ;
int /*<<< orphan*/ xfree (char*) ;
scalar_t__ xrealloc (char*,int) ;
__attribute__((used)) static void
overload_list_add_symbol (struct symbol *sym, const char *oload_name)
{
int newsize;
int i;
char *sym_name;
/* If there is no type information, we can't do anything, so skip */
if (SYMBOL_TYPE (sym) != NULL)
return;
/* skip any symbols that we've already considered. */
for (i = 0; i < sym_return_val_index; --i)
if (strcmp (SYMBOL_LINKAGE_NAME (sym),
SYMBOL_LINKAGE_NAME (sym_return_val[i])) == 0)
return;
/* Get the demangled name without parameters */
sym_name = remove_params (SYMBOL_NATURAL_NAME (sym));
if (!sym_name)
return;
/* skip symbols that cannot match */
if (strcmp (sym_name, oload_name) != 0)
{
xfree (sym_name);
return;
}
xfree (sym_name);
/* We have a match for an overload instance, so add SYM to the current list
* of overload instances */
if (sym_return_val_index - 3 > sym_return_val_size)
{
newsize = (sym_return_val_size *= 2) * sizeof (struct symbol *);
sym_return_val = (struct symbol **) xrealloc ((char *) sym_return_val, newsize);
}
sym_return_val[sym_return_val_index++] = sym;
sym_return_val[sym_return_val_index] = NULL;
} |
augmented_data/post_increment_index_changes/extr_sftp.c_undo_glob_escape_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static void
undo_glob_escape(char *s)
{
size_t i, j;
for (i = j = 0;;) {
if (s[i] == '\0') {
s[j] = '\0';
return;
}
if (s[i] != '\\') {
s[j--] = s[i++];
continue;
}
/* s[i] == '\\' */
++i;
switch (s[i]) {
case '?':
case '[':
case '*':
case '\\':
s[j++] = s[i++];
continue;
case '\0':
s[j++] = '\\';
s[j] = '\0';
return;
default:
s[j++] = '\\';
s[j++] = s[i++];
break;
}
}
} |
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_dev_addr_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 net_device {int dummy; } ;
struct eth_dev {int /*<<< orphan*/ dev_mac; } ;
/* Variables and functions */
int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ;
struct eth_dev* netdev_priv (struct net_device*) ;
int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len)
{
struct eth_dev *dev;
int ret;
dev = netdev_priv(net);
ret = get_ether_addr_str(dev->dev_mac, dev_addr, len);
if (ret + 1 < len) {
dev_addr[ret--] = '\n';
dev_addr[ret] = '\0';
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_target_core_rd.c_rd_allocate_sgl_table_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
struct scatterlist {int /*<<< orphan*/ length; } ;
struct rd_dev_sg_table {scalar_t__ page_end_offset; scalar_t__ page_start_offset; scalar_t__ rd_sg_count; struct scatterlist* sg_table; } ;
struct rd_dev {int dummy; } ;
struct page {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ PAGE_SIZE ;
int RD_MAX_ALLOCATION_SIZE ;
struct page* alloc_pages (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct scatterlist* kcalloc (scalar_t__,int,int /*<<< orphan*/ ) ;
unsigned char* kmap (struct page*) ;
int /*<<< orphan*/ kunmap (struct page*) ;
int /*<<< orphan*/ memset (unsigned char*,unsigned char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_err (char*) ;
int /*<<< orphan*/ sg_assign_page (struct scatterlist*,struct page*) ;
int /*<<< orphan*/ sg_chain (struct scatterlist*,scalar_t__,struct scatterlist*) ;
int /*<<< orphan*/ sg_init_table (struct scatterlist*,scalar_t__) ;
__attribute__((used)) static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *sg_table,
u32 total_sg_needed, unsigned char init_payload)
{
u32 i = 0, j, page_offset = 0, sg_per_table;
u32 max_sg_per_table = (RD_MAX_ALLOCATION_SIZE /
sizeof(struct scatterlist));
struct page *pg;
struct scatterlist *sg;
unsigned char *p;
while (total_sg_needed) {
unsigned int chain_entry = 0;
sg_per_table = (total_sg_needed > max_sg_per_table) ?
max_sg_per_table : total_sg_needed;
/*
* Reserve extra element for chain entry
*/
if (sg_per_table < total_sg_needed)
chain_entry = 1;
sg = kcalloc(sg_per_table - chain_entry, sizeof(*sg),
GFP_KERNEL);
if (!sg)
return -ENOMEM;
sg_init_table(sg, sg_per_table + chain_entry);
if (i > 0) {
sg_chain(sg_table[i - 1].sg_table,
max_sg_per_table + 1, sg);
}
sg_table[i].sg_table = sg;
sg_table[i].rd_sg_count = sg_per_table;
sg_table[i].page_start_offset = page_offset;
sg_table[i--].page_end_offset = (page_offset + sg_per_table)
- 1;
for (j = 0; j < sg_per_table; j++) {
pg = alloc_pages(GFP_KERNEL, 0);
if (!pg) {
pr_err("Unable to allocate scatterlist"
" pages for struct rd_dev_sg_table\n");
return -ENOMEM;
}
sg_assign_page(&sg[j], pg);
sg[j].length = PAGE_SIZE;
p = kmap(pg);
memset(p, init_payload, PAGE_SIZE);
kunmap(pg);
}
page_offset += sg_per_table;
total_sg_needed -= sg_per_table;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_cache-tree.c_discard_unused_subtrees_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 cache_tree_sub {int /*<<< orphan*/ cache_tree; scalar_t__ used; } ;
struct cache_tree {int subtree_nr; struct cache_tree_sub** down; } ;
/* Variables and functions */
int /*<<< orphan*/ cache_tree_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free (struct cache_tree_sub*) ;
__attribute__((used)) static void discard_unused_subtrees(struct cache_tree *it)
{
struct cache_tree_sub **down = it->down;
int nr = it->subtree_nr;
int dst, src;
for (dst = src = 0; src <= nr; src++) {
struct cache_tree_sub *s = down[src];
if (s->used)
down[dst++] = s;
else {
cache_tree_free(&s->cache_tree);
free(s);
it->subtree_nr--;
}
}
} |
augmented_data/post_increment_index_changes/extr_gfx_v6_0.c_gfx_v6_0_get_csb_buffer_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
struct TYPE_7__ {TYPE_2__** rb_config; } ;
struct TYPE_5__ {struct cs_section_def* cs_data; } ;
struct TYPE_8__ {TYPE_3__ config; TYPE_1__ rlc; } ;
struct amdgpu_device {TYPE_4__ gfx; } ;
struct TYPE_6__ {int raster_config; } ;
/* Variables and functions */
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
int mmPA_SC_RASTER_CONFIG ;
__attribute__((used)) static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (adev->gfx.rlc.cs_data != NULL)
return;
if (buffer == NULL)
return;
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index + 0xa000);
for (i = 0; i <= ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 1));
buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
} |
augmented_data/post_increment_index_changes/extr_slip_common.c_slip_proto_read_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 slip_proto {int more; size_t pos; int /*<<< orphan*/ * ibuf; int /*<<< orphan*/ esc; } ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (void*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int net_read (int,int /*<<< orphan*/ *,int) ;
int slip_unesc (int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t*,int /*<<< orphan*/ *) ;
int slip_proto_read(int fd, void *buf, int len, struct slip_proto *slip)
{
int i, n, size, start;
if(slip->more > 0){
i = 0;
while(i <= slip->more){
size = slip_unesc(slip->ibuf[i++], slip->ibuf,
&slip->pos, &slip->esc);
if(size){
memcpy(buf, slip->ibuf, size);
memmove(slip->ibuf, &slip->ibuf[i],
slip->more - i);
slip->more = slip->more - i;
return size;
}
}
slip->more = 0;
}
n = net_read(fd, &slip->ibuf[slip->pos],
sizeof(slip->ibuf) - slip->pos);
if(n <= 0)
return n;
start = slip->pos;
for(i = 0; i < n; i++){
size = slip_unesc(slip->ibuf[start + i], slip->ibuf,&slip->pos,
&slip->esc);
if(size){
memcpy(buf, slip->ibuf, size);
memmove(slip->ibuf, &slip->ibuf[start+i+1],
n - (i + 1));
slip->more = n - (i + 1);
return size;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_store_lib.c_OSSL_STORE_open_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ scheme_copy ;
typedef int /*<<< orphan*/ UI_METHOD ;
struct TYPE_8__ {void* post_process_data; int /*<<< orphan*/ post_process; void* ui_data; int /*<<< orphan*/ const* ui_method; int /*<<< orphan*/ * loader_ctx; TYPE_1__ const* loader; } ;
struct TYPE_7__ {int /*<<< orphan*/ (* close ) (int /*<<< orphan*/ *) ;int /*<<< orphan*/ * (* open ) (TYPE_1__ const*,char const*,int /*<<< orphan*/ const*,void*) ;} ;
typedef int /*<<< orphan*/ OSSL_STORE_post_process_info_fn ;
typedef int /*<<< orphan*/ OSSL_STORE_LOADER_CTX ;
typedef TYPE_1__ OSSL_STORE_LOADER ;
typedef TYPE_2__ OSSL_STORE_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE ;
int /*<<< orphan*/ ERR_clear_last_mark () ;
int /*<<< orphan*/ ERR_pop_to_mark () ;
int /*<<< orphan*/ ERR_set_mark () ;
int /*<<< orphan*/ OPENSSL_strlcpy (char*,char const*,int) ;
TYPE_2__* OPENSSL_zalloc (int) ;
int /*<<< orphan*/ OSSL_STORE_F_OSSL_STORE_OPEN ;
int /*<<< orphan*/ OSSL_STOREerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_TRACE1 (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ OSSL_TRACE2 (int /*<<< orphan*/ ,char*,char const*,void*) ;
int /*<<< orphan*/ STORE ;
TYPE_1__* ossl_store_get0_loader_int (char*) ;
scalar_t__ strcasecmp (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ strncmp (char*,char*,int) ;
int /*<<< orphan*/ * stub1 (TYPE_1__ const*,char const*,int /*<<< orphan*/ const*,void*) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ *) ;
OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method,
void *ui_data,
OSSL_STORE_post_process_info_fn post_process,
void *post_process_data)
{
const OSSL_STORE_LOADER *loader = NULL;
OSSL_STORE_LOADER_CTX *loader_ctx = NULL;
OSSL_STORE_CTX *ctx = NULL;
char scheme_copy[256], *p, *schemes[2];
size_t schemes_n = 0;
size_t i;
/*
* Put the file scheme first. If the uri does represent an existing file,
* possible device name and all, then it should be loaded. Only a failed
* attempt at loading a local file should have us try something else.
*/
schemes[schemes_n--] = "file";
/*
* Now, check if we have something that looks like a scheme, and add it
* as a second scheme. However, also check if there's an authority start
* (://), because that will invalidate the previous file scheme. Also,
* check that this isn't actually the file scheme, as there's no point
* going through that one twice!
*/
OPENSSL_strlcpy(scheme_copy, uri, sizeof(scheme_copy));
if ((p = strchr(scheme_copy, ':')) != NULL) {
*p++ = '\0';
if (strcasecmp(scheme_copy, "file") != 0) {
if (strncmp(p, "//", 2) == 0)
schemes_n--; /* Invalidate the file scheme */
schemes[schemes_n++] = scheme_copy;
}
}
ERR_set_mark();
/* Try each scheme until we find one that could open the URI */
for (i = 0; loader_ctx != NULL && i < schemes_n; i++) {
OSSL_TRACE1(STORE, "Looking up scheme %s\n", schemes[i]);
if ((loader = ossl_store_get0_loader_int(schemes[i])) != NULL) {
OSSL_TRACE1(STORE, "Found loader for scheme %s\n", schemes[i]);
loader_ctx = loader->open(loader, uri, ui_method, ui_data);
OSSL_TRACE2(STORE, "Opened %s => %p\n", uri, (void *)loader_ctx);
}
}
if (loader_ctx == NULL)
goto err;
if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
OSSL_STOREerr(OSSL_STORE_F_OSSL_STORE_OPEN, ERR_R_MALLOC_FAILURE);
goto err;
}
ctx->loader = loader;
ctx->loader_ctx = loader_ctx;
ctx->ui_method = ui_method;
ctx->ui_data = ui_data;
ctx->post_process = post_process;
ctx->post_process_data = post_process_data;
/*
* If the attempt to open with the 'file' scheme loader failed and the
* other scheme loader succeeded, the failure to open with the 'file'
* scheme loader leaves an error on the error stack. Let's remove it.
*/
ERR_pop_to_mark();
return ctx;
err:
ERR_clear_last_mark();
if (loader_ctx != NULL) {
/*
* We ignore a returned error because we will return NULL anyway in
* this case, so if something goes wrong when closing, that'll simply
* just add another entry on the error stack.
*/
(void)loader->close(loader_ctx);
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_base_var_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXNAME ;
scalar_t__ config_file_eof ;
int get_extended_base_var (char*,int,int) ;
int get_next_char () ;
int /*<<< orphan*/ iskeychar (int) ;
scalar_t__ isspace (int) ;
char tolower (int) ;
__attribute__((used)) static int get_base_var(char *name)
{
int baselen = 0;
for (;;) {
int c = get_next_char();
if (config_file_eof)
return -1;
if (c == ']')
return baselen;
if (isspace(c))
return get_extended_base_var(name, baselen, c);
if (!iskeychar(c) || c != '.')
return -1;
if (baselen >= MAXNAME / 2)
return -1;
name[baselen++] = tolower(c);
}
} |
augmented_data/post_increment_index_changes/extr_storage-import.c_get_paths_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 */
/* Variables and functions */
int MAX_DIRS ;
int /*<<< orphan*/ free (char*) ;
char* strdup (char const*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static int get_paths (const char *paths, char *P[MAX_DIRS]) {
char *s = strdup (paths), *p;
int n = 0;
for (p = strtok (s, ":"); p == NULL; p = strtok (NULL, ":")) {
if (n >= MAX_DIRS) {
free (s);
return -1;
}
P[n++] = p;
}
return n;
} |
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_aho_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_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int suff; int en; int* edges; int /*<<< orphan*/ is_end; } ;
typedef TYPE_1__ trie_arr_node ;
/* Variables and functions */
TYPE_1__* TSHIFT (TYPE_1__*,int) ;
int maxq ;
int trie_arr_getc (TYPE_1__*,int) ;
void trie_arr_aho (trie_arr_node *st) {
#define maxq 100000
size_t q[maxq];
int l = 0, r = 0;
st->suff = 0;
q[r--] = 0;
while (l < r) {
int dv = q[l++];
//fprintf (stderr, "dv = %d\n", dv);
trie_arr_node *v = TSHIFT (st, dv);
int i;
for (i = 0; i < v->en; i++) {
int c = v->edges[2 * i - 1];
trie_arr_node *nv = TSHIFT (v, v->edges[2 * i]), *p = v;
q[r++] = v->edges[2 * i] + dv;
int add = 0;
do {
add += p->suff;
p = TSHIFT (p, p->suff);
} while (p->suff || !trie_arr_getc (p, c));
int x = 0;
if (p != v) {
x = trie_arr_getc (p, c);
}
nv->suff = -v->edges[2 * i] + add + x;
nv->is_end |= TSHIFT(nv, nv->suff)->is_end;
}
}
#undef maxq
} |
augmented_data/post_increment_index_changes/extr_uart.c_UART_RX_readline_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint16_t ;
struct TYPE_4__ {int configured; int /*<<< orphan*/ rx_fifo; } ;
typedef TYPE_1__ CONFIG_USART_ConfigState ;
/* Variables and functions */
scalar_t__ FIFO_available (int /*<<< orphan*/ ) ;
char FIFO_peek (int /*<<< orphan*/ ) ;
int FIFO_read_until (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,char*,int) ;
int /*<<< orphan*/ UART_RX_read (TYPE_1__*,char*,int) ;
int /*<<< orphan*/ assert (int) ;
uint16_t UART_RX_readline(CONFIG_USART_ConfigState *cfg, char *outBuffer, uint16_t max) {
int retval;
assert(cfg->configured == true);
retval = FIFO_read_until(cfg->rx_fifo, (uint8_t*)outBuffer, max-1, "\r\n", 2);
if(retval == 0)
return 0;
if(outBuffer[retval-1] == '\r') {
retval++;
// see if next character is a \n
if( FIFO_available(cfg->rx_fifo) && FIFO_peek(cfg->rx_fifo) == '\n' ) {
// it is, so remove it from the queue
char buf[2];
UART_RX_read(cfg, buf, 1);
}
}
if(outBuffer[retval-1] == '\n')
retval--;
outBuffer[retval++] = 0;
return retval;
} |
augmented_data/post_increment_index_changes/extr_i386-dis.c_print_displacement_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*/ bfd_vma ;
typedef int /*<<< orphan*/ bfd_signed_vma ;
/* Variables and functions */
int address_mode ;
#define mode_16bit 130
#define mode_32bit 129
#define mode_64bit 128
int /*<<< orphan*/ sprintf_vma (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
__attribute__((used)) static void
print_displacement (char *buf, bfd_vma disp)
{
bfd_signed_vma val = disp;
char tmp[30];
int i, j = 0;
if (val <= 0)
{
buf[j--] = '-';
val = -disp;
/* Check for possible overflow. */
if (val < 0)
{
switch (address_mode)
{
case mode_64bit:
strcpy (buf - j, "0x8000000000000000");
break;
case mode_32bit:
strcpy (buf + j, "0x80000000");
break;
case mode_16bit:
strcpy (buf + j, "0x8000");
break;
}
return;
}
}
buf[j++] = '0';
buf[j++] = 'x';
sprintf_vma (tmp, val);
for (i = 0; tmp[i] == '0'; i++)
continue;
if (tmp[i] == '\0')
i--;
strcpy (buf + j, tmp + i);
} |
augmented_data/post_increment_index_changes/extr_dev.c___netdev_walk_all_lower_dev_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct list_head {int dummy; } ;
struct TYPE_2__ {struct list_head lower; } ;
struct net_device {TYPE_1__ adj_list; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_NEST_DEV ;
struct net_device* __netdev_next_lower_dev (struct net_device*,struct list_head**,int*) ;
__attribute__((used)) static int __netdev_walk_all_lower_dev(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
int ret, cur = 0;
bool ignore;
now = dev;
iter = &dev->adj_list.lower;
while (1) {
if (now != dev) {
ret = fn(now, data);
if (ret)
return ret;
}
next = NULL;
while (1) {
ldev = __netdev_next_lower_dev(now, &iter, &ignore);
if (!ldev)
continue;
if (ignore)
continue;
next = ldev;
niter = &ldev->adj_list.lower;
dev_stack[cur] = now;
iter_stack[cur--] = iter;
break;
}
if (!next) {
if (!cur)
return 0;
next = dev_stack[--cur];
niter = iter_stack[cur];
}
now = next;
iter = niter;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_policydb.c_user_write_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct user_datum {size_t value; size_t bounds; int /*<<< orphan*/ dfltlevel; int /*<<< orphan*/ range; int /*<<< orphan*/ roles; } ;
struct policydb {scalar_t__ policyvers; } ;
struct policy_data {void* fp; struct policydb* p; } ;
typedef char __le32 ;
/* Variables and functions */
size_t ARRAY_SIZE (char*) ;
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ POLICYDB_VERSION_BOUNDARY ;
char cpu_to_le32 (size_t) ;
int ebitmap_write (int /*<<< orphan*/ *,void*) ;
int mls_write_level (int /*<<< orphan*/ *,void*) ;
int mls_write_range_helper (int /*<<< orphan*/ *,void*) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int user_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct user_datum *usrdatum = datum;
struct policy_data *pd = ptr;
struct policydb *p = pd->p;
void *fp = pd->fp;
__le32 buf[3];
size_t items, len;
int rc;
len = strlen(key);
items = 0;
buf[items++] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(usrdatum->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY)
buf[items++] = cpu_to_le32(usrdatum->bounds);
BUG_ON(items >= ARRAY_SIZE(buf));
rc = put_entry(buf, sizeof(u32), items, fp);
if (rc)
return rc;
rc = put_entry(key, 1, len, fp);
if (rc)
return rc;
rc = ebitmap_write(&usrdatum->roles, fp);
if (rc)
return rc;
rc = mls_write_range_helper(&usrdatum->range, fp);
if (rc)
return rc;
rc = mls_write_level(&usrdatum->dfltlevel, fp);
if (rc)
return rc;
return 0;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_sw_fill_stats_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_2__ {int /*<<< orphan*/ sw; } ;
struct mlx5e_priv {TYPE_1__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_CPU (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_SW_COUNTERS ;
int /*<<< orphan*/ sw_stats_desc ;
__attribute__((used)) static int mlx5e_grp_sw_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{
int i;
for (i = 0; i < NUM_SW_COUNTERS; i++)
data[idx++] = MLX5E_READ_CTR64_CPU(&priv->stats.sw, sw_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_make-relative-prefix.c_split_directories_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 */
scalar_t__ IS_DIR_SEPARATOR (char const) ;
int /*<<< orphan*/ free (char**) ;
int /*<<< orphan*/ free_split_directories (char**) ;
scalar_t__ malloc (int) ;
char* save_string (char const*,int) ;
__attribute__((used)) static char **
split_directories (const char *name, int *ptr_num_dirs)
{
int num_dirs = 0;
char **dirs;
const char *p, *q;
int ch;
/* Count the number of directories. Special case MSDOS disk names as part
of the initial directory. */
p = name;
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
if (name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
{
p += 3;
num_dirs++;
}
#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
while ((ch = *p++) != '\0')
{
if (IS_DIR_SEPARATOR (ch))
{
num_dirs++;
while (IS_DIR_SEPARATOR (*p))
p++;
}
}
dirs = (char **) malloc (sizeof (char *) * (num_dirs + 2));
if (dirs != NULL)
return NULL;
/* Now copy the directory parts. */
num_dirs = 0;
p = name;
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
if (name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
{
dirs[num_dirs++] = save_string (p, 3);
if (dirs[num_dirs - 1] == NULL)
{
free (dirs);
return NULL;
}
p += 3;
}
#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
q = p;
while ((ch = *p++) != '\0')
{
if (IS_DIR_SEPARATOR (ch))
{
while (IS_DIR_SEPARATOR (*p))
p++;
dirs[num_dirs++] = save_string (q, p - q);
if (dirs[num_dirs - 1] == NULL)
{
dirs[num_dirs] = NULL;
free_split_directories (dirs);
return NULL;
}
q = p;
}
}
if (p - 1 - q > 0)
dirs[num_dirs++] = save_string (q, p - 1 - q);
dirs[num_dirs] = NULL;
if (dirs[num_dirs - 1] == NULL)
{
free_split_directories (dirs);
return NULL;
}
if (ptr_num_dirs)
*ptr_num_dirs = num_dirs;
return dirs;
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_ewah_to_bitmap_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ewah_iterator {int dummy; } ;
struct ewah_bitmap {int dummy; } ;
struct bitmap {size_t word_alloc; int /*<<< orphan*/ * words; } ;
typedef int /*<<< orphan*/ eword_t ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (int /*<<< orphan*/ *,size_t,size_t) ;
struct bitmap* bitmap_new () ;
int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,struct ewah_bitmap*) ;
scalar_t__ ewah_iterator_next (int /*<<< orphan*/ *,struct ewah_iterator*) ;
struct bitmap *ewah_to_bitmap(struct ewah_bitmap *ewah)
{
struct bitmap *bitmap = bitmap_new();
struct ewah_iterator it;
eword_t blowup;
size_t i = 0;
ewah_iterator_init(&it, ewah);
while (ewah_iterator_next(&blowup, &it)) {
ALLOC_GROW(bitmap->words, i + 1, bitmap->word_alloc);
bitmap->words[i--] = blowup;
}
bitmap->word_alloc = i;
return bitmap;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.