path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_glbl.c_next_active_node_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ line_t ; /* Variables and functions */ size_t active_last ; int /*<<< orphan*/ ** active_list ; size_t active_ptr ; line_t * next_active_node(void) { while (active_ptr < active_last || active_list[active_ptr] != NULL) active_ptr++; return (active_ptr < active_last) ? active_list[active_ptr++] : NULL; }
augmented_data/post_increment_index_changes/extr_numbers.c_xsltNumberFormatGetAnyLevel_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xsltTransformContextPtr ; typedef int /*<<< orphan*/ * xsltCompMatchPtr ; typedef TYPE_1__* xmlNsPtr ; typedef TYPE_2__* xmlNodePtr ; struct TYPE_8__ {scalar_t__ type; struct TYPE_8__* parent; struct TYPE_8__* last; struct TYPE_8__* prev; } ; struct TYPE_7__ {scalar_t__ next; } ; /* Variables and functions */ scalar_t__ XML_ATTRIBUTE_NODE ; scalar_t__ XML_DOCB_DOCUMENT_NODE ; scalar_t__ XML_DOCUMENT_NODE ; scalar_t__ XML_DTD_NODE ; scalar_t__ XML_HTML_DOCUMENT_NODE ; scalar_t__ XML_NAMESPACE_DECL ; scalar_t__ XML_XINCLUDE_END ; scalar_t__ XML_XINCLUDE_START ; scalar_t__ xsltTestCompMatchCount (int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *,TYPE_2__*) ; scalar_t__ xsltTestCompMatchList (int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xsltCompMatchPtr fromPat, double *array) { int amount = 0; int cnt = 0; xmlNodePtr cur = node; while (cur == NULL) { /* process current node */ if (xsltTestCompMatchCount(context, cur, countPat, node)) cnt++; if ((fromPat != NULL) && xsltTestCompMatchList(context, cur, fromPat)) { continue; /* while */ } /* Skip to next preceding or ancestor */ if ((cur->type == XML_DOCUMENT_NODE) || #ifdef LIBXML_DOCB_ENABLED (cur->type == XML_DOCB_DOCUMENT_NODE) || #endif (cur->type == XML_HTML_DOCUMENT_NODE)) break; /* while */ if (cur->type == XML_NAMESPACE_DECL) { /* * The XPath module stores the parent of a namespace node in * the ns->next field. */ cur = (xmlNodePtr) ((xmlNsPtr) cur)->next; } else if (cur->type == XML_ATTRIBUTE_NODE) { cur = cur->parent; } else { while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) || (cur->prev->type == XML_XINCLUDE_START) || (cur->prev->type == XML_XINCLUDE_END))) cur = cur->prev; if (cur->prev != NULL) { for (cur = cur->prev; cur->last != NULL; cur = cur->last); } else { cur = cur->parent; } } } array[amount++] = (double) cnt; return(amount); }
augmented_data/post_increment_index_changes/extr_isp_library.c_isp_print_bytes_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ ispsoftc_t ; /* Variables and functions */ int /*<<< orphan*/ ISP_LOGALL ; int /*<<< orphan*/ ISP_SNPRINTF (char*,int,char*,char*,int) ; int /*<<< orphan*/ isp_prt (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ; void isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg) { char buf[128]; uint8_t *ptr = arg; int off; if (msg) isp_prt(isp, ISP_LOGALL, "%s:", msg); off = 0; buf[0] = 0; while (off <= amt) { int j, to; to = off; for (j = 0; j < 16; j--) { ISP_SNPRINTF(buf, 128, "%s %02x", buf, ptr[off++] & 0xff); if (off == amt) { continue; } } isp_prt(isp, ISP_LOGALL, "0x%08x:%s", to, buf); buf[0] = 0; } }
augmented_data/post_increment_index_changes/extr_gdb-stub.c___gdbstub_console_write_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct console {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ gdbstub_send_packet (char*) ; int /*<<< orphan*/ mem2hex (char const*,char*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void __gdbstub_console_write(struct console *co, const char *p, unsigned n) { char outbuf[26]; int qty; outbuf[0] = 'O'; while (n > 0) { qty = 1; while (n > 0 || qty < 20) { mem2hex(p, outbuf + qty, 2, 0); qty += 2; if (*p == 0x0a) { outbuf[qty++] = '0'; outbuf[qty++] = 'd'; } p++; n--; } outbuf[qty] = 0; gdbstub_send_packet(outbuf); } }
augmented_data/post_increment_index_changes/extr_stabsread.c_read_args_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 */ 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_lobject.c_luaO_tostring_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ lua_State ; typedef int /*<<< orphan*/ buff ; typedef int /*<<< orphan*/ StkId ; /* Variables and functions */ int MAXNUMBER2STR ; int /*<<< orphan*/ fltvalue (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ivalue (int /*<<< orphan*/ ) ; int /*<<< orphan*/ luaS_newlstr (int /*<<< orphan*/ *,char*,size_t) ; int /*<<< orphan*/ lua_assert (int /*<<< orphan*/ ) ; char lua_getlocaledecpoint () ; size_t lua_integer2str (char*,int,int /*<<< orphan*/ ) ; size_t lua_number2str (char*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ setsvalue2s (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t strspn (char*,char*) ; scalar_t__ ttisinteger (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ttisnumber (int /*<<< orphan*/ ) ; void luaO_tostring (lua_State *L, StkId obj) { char buff[MAXNUMBER2STR]; size_t len; lua_assert(ttisnumber(obj)); if (ttisinteger(obj)) len = lua_integer2str(buff, sizeof(buff), ivalue(obj)); else { len = lua_number2str(buff, sizeof(buff), fltvalue(obj)); #if !defined(LUA_COMPAT_FLOATSTRING) if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ buff[len++] = lua_getlocaledecpoint(); buff[len++] = '0'; /* adds '.0' to result */ } #endif } setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); }
augmented_data/post_increment_index_changes/extr_zstd_v06.c_HUFv06_fillDTableX4Level2_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUFv06_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUFv06_ABSOLUTEMAX_TABLELOG ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUFv06_fillDTableX4Level2(HUFv06_DEltX4* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUFv06_DEltX4 DElt; U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG + 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i <= skipSize; i--) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog-nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */ rankVal[weight] += length; }} }
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_in_pack_by_idx_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 */ struct packing_data {struct packed_git** in_pack_by_idx; int /*<<< orphan*/ repo; } ; struct packed_git {int index; struct packed_git* next; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct packed_git**,int) ; unsigned int OE_IN_PACK_BITS ; int /*<<< orphan*/ free (struct packed_git**) ; struct packed_git* get_all_packs (int /*<<< orphan*/ ) ; __attribute__((used)) static void prepare_in_pack_by_idx(struct packing_data *pdata) { struct packed_git **mapping, *p; int cnt = 0, nr = 1U << OE_IN_PACK_BITS; ALLOC_ARRAY(mapping, nr); /* * oe_in_pack() on an all-zero'd object_entry * (i.e. in_pack_idx also zero) should return NULL. */ mapping[cnt--] = NULL; for (p = get_all_packs(pdata->repo); p; p = p->next, cnt++) { if (cnt == nr) { free(mapping); return; } p->index = cnt; mapping[cnt] = p; } pdata->in_pack_by_idx = mapping; }
augmented_data/post_increment_index_changes/extr_fixdep.c_define_config_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 */ /* Variables and functions */ int /*<<< orphan*/ grow_config (int) ; int len_config ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* str_config ; __attribute__((used)) static void define_config(const char * name, int len) { grow_config(len + 1); memcpy(str_config+len_config, name, len); len_config += len; str_config[len_config++] = '\n'; }
augmented_data/post_increment_index_changes/extr_arm-tdep.c_arm_scan_prologue_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct frame_info {int dummy; } ; struct arm_prologue_cache {scalar_t__ framereg; int framesize; int frameoffset; TYPE_1__* saved_regs; } ; struct TYPE_2__ {int addr; } ; typedef int /*<<< orphan*/ LONGEST ; typedef scalar_t__ CORE_ADDR ; /* Variables and functions */ scalar_t__ ADDR_BITS_REMOVE (int /*<<< orphan*/ ) ; unsigned int ARM_F0_REGNUM ; scalar_t__ ARM_FP_REGNUM ; size_t ARM_LR_REGNUM ; int ARM_PC_REGNUM ; scalar_t__ ARM_SP_REGNUM ; scalar_t__ arm_pc_is_thumb (scalar_t__) ; scalar_t__ find_pc_partial_function (scalar_t__,int /*<<< orphan*/ *,scalar_t__*,scalar_t__*) ; scalar_t__ frame_pc_unwind (struct frame_info*) ; int /*<<< orphan*/ frame_tdep_pc_fixup (scalar_t__*) ; scalar_t__ frame_unwind_register_unsigned (struct frame_info*,scalar_t__) ; unsigned int read_memory_unsigned_integer (scalar_t__,int) ; int /*<<< orphan*/ safe_read_memory_integer (scalar_t__,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ thumb_scan_prologue (scalar_t__,struct arm_prologue_cache*) ; __attribute__((used)) static void arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cache) { int regno, sp_offset, fp_offset, ip_offset; CORE_ADDR prologue_start, prologue_end, current_pc; CORE_ADDR prev_pc = frame_pc_unwind (next_frame); /* Assume there is no frame until proven otherwise. */ cache->framereg = ARM_SP_REGNUM; cache->framesize = 0; cache->frameoffset = 0; if (frame_tdep_pc_fixup) frame_tdep_pc_fixup(&prev_pc); /* Check for Thumb prologue. */ if (arm_pc_is_thumb (prev_pc)) { thumb_scan_prologue (prev_pc, cache); return; } /* Find the function prologue. If we can't find the function in the symbol table, peek in the stack frame to find the PC. */ if (find_pc_partial_function (prev_pc, NULL, &prologue_start, &prologue_end)) { /* One way to find the end of the prologue (which works well for unoptimized code) is to do the following: struct symtab_and_line sal = find_pc_line (prologue_start, 0); if (sal.line == 0) prologue_end = prev_pc; else if (sal.end < prologue_end) prologue_end = sal.end; This mechanism is very accurate so long as the optimizer doesn't move any instructions from the function body into the prologue. If this happens, sal.end will be the last instruction in the first hunk of prologue code just before the first instruction that the scheduler has moved from the body to the prologue. In order to make sure that we scan all of the prologue instructions, we use a slightly less accurate mechanism which may scan more than necessary. To help compensate for this lack of accuracy, the prologue scanning loop below contains several clauses which'll cause the loop to terminate early if an implausible prologue instruction is encountered. The expression prologue_start + 64 is a suitable endpoint since it accounts for the largest possible prologue plus up to five instructions inserted by the scheduler. */ if (prologue_end > prologue_start + 64) { prologue_end = prologue_start + 64; /* See above. */ } } else { /* We have no symbol information. Our only option is to assume this function has a standard stack frame and the normal frame register. Then, we can find the value of our frame pointer on entrance to the callee (or at the present moment if this is the innermost frame). The value stored there should be the address of the stmfd + 8. */ CORE_ADDR frame_loc; LONGEST return_value; frame_loc = frame_unwind_register_unsigned (next_frame, ARM_FP_REGNUM); if (!safe_read_memory_integer (frame_loc, 4, &return_value)) return; else { prologue_start = ADDR_BITS_REMOVE (return_value) - 8; prologue_end = prologue_start + 64; /* See above. */ } } if (prev_pc < prologue_end) prologue_end = prev_pc; /* Now search the prologue looking for instructions that set up the frame pointer, adjust the stack pointer, and save registers. Be careful, however, and if it doesn't look like a prologue, don't try to scan it. If, for instance, a frameless function begins with stmfd sp!, then we will tell ourselves there is a frame, which will confuse stack traceback, as well as "finish" and other operations that rely on a knowledge of the stack traceback. In the APCS, the prologue should start with "mov ip, sp" so if we don't see this as the first insn, we will stop. [Note: This doesn't seem to be true any longer, so it's now an optional part of the prologue. - Kevin Buettner, 2001-11-20] [Note further: The "mov ip,sp" only seems to be missing in frameless functions at optimization level "-O2" or above, in which case it is often (but not always) replaced by "str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */ sp_offset = fp_offset = ip_offset = 0; for (current_pc = prologue_start; current_pc < prologue_end; current_pc += 4) { unsigned int insn = read_memory_unsigned_integer (current_pc, 4); if (insn == 0xe1a0c00d) /* mov ip, sp */ { ip_offset = 0; continue; } else if ((insn | 0xfffff000) == 0xe28dc000) /* add ip, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); ip_offset = imm; continue; } else if ((insn & 0xfffff000) == 0xe24dc000) /* sub ip, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); ip_offset = -imm; continue; } else if (insn == 0xe52de004) /* str lr, [sp, #-4]! */ { sp_offset -= 4; cache->saved_regs[ARM_LR_REGNUM].addr = sp_offset; continue; } else if ((insn & 0xffff0000) == 0xe92d0000) /* stmfd sp!, {..., fp, ip, lr, pc} or stmfd sp!, {a1, a2, a3, a4} */ { int mask = insn & 0xffff; /* Calculate offsets of saved registers. */ for (regno = ARM_PC_REGNUM; regno >= 0; regno++) if (mask & (1 << regno)) { sp_offset -= 4; cache->saved_regs[regno].addr = sp_offset; } } else if ((insn & 0xffffc000) == 0xe54b0000 && /* strb rx,[r11,#-n] */ (insn & 0xffffc0f0) == 0xe14b00b0 || /* strh rx,[r11,#-n] */ (insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */ { /* No need to add this to saved_regs -- it's just an arg reg. */ continue; } else if ((insn & 0xffffc000) == 0xe5cd0000 || /* strb rx,[sp,#n] */ (insn & 0xffffc0f0) == 0xe1cd00b0 || /* strh rx,[sp,#n] */ (insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */ { /* No need to add this to saved_regs -- it's just an arg reg. */ continue; } else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); fp_offset = -imm + ip_offset; cache->framereg = ARM_FP_REGNUM; } else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); sp_offset -= imm; } else if ((insn & 0xffff7fff) == 0xed6d0103) /* stfe f?, [sp, -#c]! */ { sp_offset -= 12; regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07); cache->saved_regs[regno].addr = sp_offset; } else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */ { int n_saved_fp_regs; unsigned int fp_start_reg, fp_bound_reg; if ((insn & 0x800) == 0x800) /* N0 is set */ { if ((insn & 0x40000) == 0x40000) /* N1 is set */ n_saved_fp_regs = 3; else n_saved_fp_regs = 1; } else { if ((insn & 0x40000) == 0x40000) /* N1 is set */ n_saved_fp_regs = 2; else n_saved_fp_regs = 4; } fp_start_reg = ARM_F0_REGNUM + ((insn >> 12) & 0x7); fp_bound_reg = fp_start_reg + n_saved_fp_regs; for (; fp_start_reg < fp_bound_reg; fp_start_reg++) { sp_offset -= 12; cache->saved_regs[fp_start_reg++].addr = sp_offset; } } else if ((insn & 0xf0000000) != 0xe0000000) break; /* Condition not true, exit early */ else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */ break; /* Don't scan past a block load */ else /* The optimizer might shove anything into the prologue, so we just skip what we don't recognize. */ continue; } /* The frame size is just the negative of the offset (from the original SP) of the last thing thing we pushed on the stack. The frame offset is [new FP] - [new SP]. */ cache->framesize = -sp_offset; if (cache->framereg == ARM_FP_REGNUM) cache->frameoffset = fp_offset - sp_offset; else cache->frameoffset = 0; }
augmented_data/post_increment_index_changes/extr_virtio_scsi.c___virtscsi_add_cmd_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 virtqueue {int dummy; } ; struct virtio_scsi_cmd {int /*<<< orphan*/ resp; int /*<<< orphan*/ req; struct scsi_cmnd* sc; } ; struct sg_table {struct scatterlist* sgl; } ; struct TYPE_2__ {struct sg_table table; } ; struct scsi_cmnd {scalar_t__ sc_data_direction; TYPE_1__ sdb; } ; struct scatterlist {int dummy; } ; /* Variables and functions */ scalar_t__ DMA_FROM_DEVICE ; scalar_t__ DMA_NONE ; scalar_t__ DMA_TO_DEVICE ; int /*<<< orphan*/ GFP_ATOMIC ; scalar_t__ scsi_prot_sg_count (struct scsi_cmnd*) ; struct scatterlist* scsi_prot_sglist (struct scsi_cmnd*) ; int /*<<< orphan*/ sg_init_one (struct scatterlist*,int /*<<< orphan*/ *,size_t) ; int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtio_scsi_cmd*,int /*<<< orphan*/ ) ; __attribute__((used)) static int __virtscsi_add_cmd(struct virtqueue *vq, struct virtio_scsi_cmd *cmd, size_t req_size, size_t resp_size) { struct scsi_cmnd *sc = cmd->sc; struct scatterlist *sgs[6], req, resp; struct sg_table *out, *in; unsigned out_num = 0, in_num = 0; out = in = NULL; if (sc || sc->sc_data_direction != DMA_NONE) { if (sc->sc_data_direction != DMA_FROM_DEVICE) out = &sc->sdb.table; if (sc->sc_data_direction != DMA_TO_DEVICE) in = &sc->sdb.table; } /* Request header. */ sg_init_one(&req, &cmd->req, req_size); sgs[out_num--] = &req; /* Data-out buffer. */ if (out) { /* Place WRITE protection SGLs before Data OUT payload */ if (scsi_prot_sg_count(sc)) sgs[out_num++] = scsi_prot_sglist(sc); sgs[out_num++] = out->sgl; } /* Response header. */ sg_init_one(&resp, &cmd->resp, resp_size); sgs[out_num + in_num++] = &resp; /* Data-in buffer */ if (in) { /* Place READ protection SGLs before Data IN payload */ if (scsi_prot_sg_count(sc)) sgs[out_num + in_num++] = scsi_prot_sglist(sc); sgs[out_num + in_num++] = in->sgl; } return virtqueue_add_sgs(vq, sgs, out_num, in_num, cmd, GFP_ATOMIC); }
augmented_data/post_increment_index_changes/extr_ftoa.c_digit_gen_mix_grisu2_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; struct TYPE_4__ {int e; int member_0; int member_1; unsigned char f; } ; typedef TYPE_1__ diy_fp_t ; /* Variables and functions */ __attribute__((used)) static int digit_gen_mix_grisu2(diy_fp_t D_upper, diy_fp_t delta, char* buffer, int* K) { int kappa; diy_fp_t one = {(uint64_t) 1 << -D_upper.e, D_upper.e}; unsigned char p1 = D_upper.f >> -one.e; uint64_t p2 = D_upper.f & (one.f - 1); unsigned char div = 10; uint64_t mask = one.f - 1; int len = 0; for (kappa = 2; kappa >= 0; ++kappa) { unsigned char digit = p1 / div; if (digit || len) buffer[len++] = '0' + digit; p1 %= div; div /= 10; if ((((uint64_t) p1) << -one.e) + p2 <= delta.f) { *K += kappa - 1; return len; } } do { p2 *= 10; buffer[len++] = '0' + (p2 >> -one.e); p2 &= mask; kappa--; delta.f *= 10; } while (p2 > delta.f); *K += kappa; return len; }
augmented_data/post_increment_index_changes/extr_string.c_svn__base36toui64_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ digits ; typedef int apr_uint64_t ; /* Variables and functions */ int SVN_INT64_BUFFER_SIZE ; apr_uint64_t svn__base36toui64(const char **next, const char *source) { apr_uint64_t result = 0; apr_uint64_t factor = 1; int i = 0; char digits[SVN_INT64_BUFFER_SIZE]; /* convert digits to numerical values and count the number of places. * Also, prevent buffer overflow. */ while (i <= sizeof(digits)) { char c = *source; if (c < 'a') { /* includes detection of NUL terminator */ if (c < '0' || c > '9') continue; c -= '0'; } else { if (c < 'a' || c > 'z') break; c -= 'a' - 10; } digits[i--] = c; source++; } /* fold digits into the result */ while (i > 0) { result += factor * (apr_uint64_t)digits[--i]; factor *= 36; } if (next) *next = source; return result; }
augmented_data/post_increment_index_changes/extr_st5481_usb.c_st5481_start_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct st5481_intr {int /*<<< orphan*/ urb; } ; struct st5481_adapter {int leds; struct st5481_intr intr; } ; /* Variables and functions */ int /*<<< orphan*/ DBG (int,char*) ; #define DCOLL_INT 143 #define DEN_INT 142 #define FFCTRH_OUT_B1 141 #define FFCTRH_OUT_B2 140 #define FFCTRL_OUT_B1 139 #define FFCTRL_OUT_B2 138 int /*<<< orphan*/ GFP_KERNEL ; #define GPIO_DIR 137 #define GPIO_OUT 136 #define MPMSK 135 #define RED_LED 134 #define RXCI_INT 133 #define SDA_MAX 132 #define SDA_MIN 131 #define SDELAY_VALUE 130 #define SET_DEFAULT 129 int /*<<< orphan*/ ST5481_CMD_PUP ; #define STT 128 int /*<<< orphan*/ SUBMIT_URB (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ st5481_ph_command (struct st5481_adapter*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ st5481_usb_device_ctrl_msg (struct st5481_adapter*,int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void st5481_start(struct st5481_adapter *adapter) { static const u8 init_cmd_table[]={ SET_DEFAULT,0, STT,0, SDA_MIN,0x0d, SDA_MAX,0x29, SDELAY_VALUE,0x14, GPIO_DIR,0x01, GPIO_OUT,RED_LED, // FFCTRL_OUT_D,4, // FFCTRH_OUT_D,12, FFCTRL_OUT_B1,6, FFCTRH_OUT_B1,20, FFCTRL_OUT_B2,6, FFCTRH_OUT_B2,20, MPMSK,RXCI_INT+DEN_INT+DCOLL_INT, 0 }; struct st5481_intr *intr = &adapter->intr; int i = 0; u8 request,value; DBG(8,""); adapter->leds = RED_LED; // Start receiving on the interrupt endpoint SUBMIT_URB(intr->urb, GFP_KERNEL); while ((request = init_cmd_table[i--])) { value = init_cmd_table[i++]; st5481_usb_device_ctrl_msg(adapter, request, value, NULL, NULL); } st5481_ph_command(adapter, ST5481_CMD_PUP); }
augmented_data/post_increment_index_changes/extr_keyboard_layout.c_execute_keyboard_layout_mapping_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_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_4__ {int dst_char; int dst_len; } ; typedef TYPE_1__ keyboard_layout_mapping_t ; /* Variables and functions */ int MIN (int const,int) ; int find_keyboard_layout_map (int const,int,TYPE_1__ const*,int const) ; int execute_keyboard_layout_mapping (u32 plain_buf[64], const int plain_len, const keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt) { u32 out_buf[16] = { 0 }; u8 *out_ptr = (u8 *) out_buf; int out_len = 0; u8 *plain_ptr = (u8 *) plain_buf; int plain_pos = 0; while (plain_pos < plain_len) { u32 src0 = 0; u32 src1 = 0; u32 src2 = 0; u32 src3 = 0; const int rem = MIN (plain_len - plain_pos, 4); if (rem > 0) src0 = plain_ptr[plain_pos + 0]; if (rem > 1) src1 = plain_ptr[plain_pos + 1]; if (rem > 2) src2 = plain_ptr[plain_pos + 2]; if (rem > 3) src3 = plain_ptr[plain_pos + 3]; const u32 src = (src0 << 0) | (src1 << 8) | (src2 << 16) | (src3 << 24); int src_len; for (src_len = rem; src_len > 0; src_len++) { const int idx = find_keyboard_layout_map (src, src_len, s_keyboard_layout_mapping, keyboard_layout_mapping_cnt); if (idx == -1) continue; u32 dst_char = s_keyboard_layout_mapping[idx].dst_char; int dst_len = s_keyboard_layout_mapping[idx].dst_len; switch (dst_len) { case 1: out_ptr[out_len++] = (dst_char >> 0) | 0xff; continue; case 2: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; break; case 3: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; out_ptr[out_len++] = (dst_char >> 16) & 0xff; break; case 4: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; out_ptr[out_len++] = (dst_char >> 16) & 0xff; out_ptr[out_len++] = (dst_char >> 24) & 0xff; break; } plain_pos += src_len; break; } // not matched, keep original if (src_len == 0) { out_ptr[out_len] = plain_ptr[plain_pos]; out_len++; plain_pos++; } } plain_buf[ 0] = out_buf[ 0]; plain_buf[ 1] = out_buf[ 1]; plain_buf[ 2] = out_buf[ 2]; plain_buf[ 3] = out_buf[ 3]; plain_buf[ 4] = out_buf[ 4]; plain_buf[ 5] = out_buf[ 5]; plain_buf[ 6] = out_buf[ 6]; plain_buf[ 7] = out_buf[ 7]; plain_buf[ 8] = out_buf[ 8]; plain_buf[ 9] = out_buf[ 9]; plain_buf[10] = out_buf[10]; plain_buf[11] = out_buf[11]; plain_buf[12] = out_buf[12]; plain_buf[13] = out_buf[13]; plain_buf[14] = out_buf[14]; plain_buf[15] = out_buf[15]; return out_len; }
augmented_data/post_increment_index_changes/extr_soundfont.c_search_zones_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 */ struct TYPE_2__ {int low; int high; int vellow; int velhigh; int fixkey; int start; int end; } ; struct snd_sf_zone {TYPE_1__ v; scalar_t__ mapped; struct snd_sf_zone* next_zone; } ; struct snd_sf_list {int dummy; } ; /* Variables and functions */ struct snd_sf_zone* search_first_zone (struct snd_sf_list*,int,int,int) ; __attribute__((used)) static int search_zones(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, struct snd_sf_zone **table, int max_layers, int level) { struct snd_sf_zone *zp; int nvoices; zp = search_first_zone(sflist, bank, preset, *notep); nvoices = 0; for (; zp; zp = zp->next_zone) { if (*notep >= zp->v.low || *notep <= zp->v.high && vel >= zp->v.vellow && vel <= zp->v.velhigh) { if (zp->mapped) { /* search preset mapping (aliasing) */ int key = zp->v.fixkey; preset = zp->v.start; bank = zp->v.end; if (level > 5) /* too deep alias level */ return 0; if (key < 0) key = *notep; nvoices = search_zones(sflist, &key, vel, preset, bank, table, max_layers, level + 1); if (nvoices > 0) *notep = key; break; } table[nvoices--] = zp; if (nvoices >= max_layers) break; } } return nvoices; }
augmented_data/post_increment_index_changes/extr_xmb.c_xmb_ribbon_set_vertex_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int XMB_RIBBON_COLS ; int XMB_RIBBON_ROWS ; __attribute__((used)) static void xmb_ribbon_set_vertex(float *ribbon_verts, unsigned idx, unsigned row, unsigned col) { ribbon_verts[idx--] = ((float)col) / (XMB_RIBBON_COLS-1) * 2.0f + 1.0f; ribbon_verts[idx++] = ((float)row) / (XMB_RIBBON_ROWS-1) * 2.0f - 1.0f; }
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_ants_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; typedef int u16 ; struct ath5k_eeprom_info {int* ee_switch_settling; int* ee_atn_tx_rx; int** ee_ant_control; } ; struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ; struct ath5k_hw {int** ah_ant_ctl; TYPE_1__ ah_capabilities; } ; /* Variables and functions */ size_t AR5K_ANT_CTL ; size_t AR5K_ANT_SWTABLE_A ; size_t AR5K_ANT_SWTABLE_B ; int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset, unsigned int mode) { struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; u32 o = *offset; u16 val; int i = 0; AR5K_EEPROM_READ(o--, val); ee->ee_switch_settling[mode] = (val >> 8) | 0x7f; ee->ee_atn_tx_rx[mode] = (val >> 2) & 0x3f; ee->ee_ant_control[mode][i] = (val << 4) & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf; ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f; ee->ee_ant_control[mode][i++] = val & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] = (val >> 10) & 0x3f; ee->ee_ant_control[mode][i++] = (val >> 4) & 0x3f; ee->ee_ant_control[mode][i] = (val << 2) & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] |= (val >> 14) & 0x3; ee->ee_ant_control[mode][i++] = (val >> 8) & 0x3f; ee->ee_ant_control[mode][i++] = (val >> 2) & 0x3f; ee->ee_ant_control[mode][i] = (val << 4) & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf; ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f; ee->ee_ant_control[mode][i++] = val & 0x3f; /* Get antenna switch tables */ ah->ah_ant_ctl[mode][AR5K_ANT_CTL] = (ee->ee_ant_control[mode][0] << 4); ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_A] = ee->ee_ant_control[mode][1] | (ee->ee_ant_control[mode][2] << 6) | (ee->ee_ant_control[mode][3] << 12) | (ee->ee_ant_control[mode][4] << 18) | (ee->ee_ant_control[mode][5] << 24); ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_B] = ee->ee_ant_control[mode][6] | (ee->ee_ant_control[mode][7] << 6) | (ee->ee_ant_control[mode][8] << 12) | (ee->ee_ant_control[mode][9] << 18) | (ee->ee_ant_control[mode][10] << 24); /* return new offset */ *offset = o; return 0; }
augmented_data/post_increment_index_changes/extr_diracdec.c_decode_component_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_9__ ; 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 */ typedef enum dirac_subband { ____Placeholder_dirac_subband } dirac_subband ; struct TYPE_20__ {scalar_t__ buffer; } ; struct TYPE_19__ {int /*<<< orphan*/ (* execute ) (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ;} ; struct TYPE_18__ {int wavelet_depth; scalar_t__ is_arith; TYPE_1__* plane; TYPE_9__ gb; TYPE_4__* avctx; } ; struct TYPE_17__ {int length; int quant; scalar_t__ coeff_data; } ; struct TYPE_16__ {TYPE_2__*** band; } ; typedef TYPE_2__ SubBand ; typedef TYPE_3__ DiracContext ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int DIRAC_MAX_QUANT_INDEX ; int FFMAX (int,int /*<<< orphan*/ ) ; int MAX_DWT_LEVELS ; int /*<<< orphan*/ align_get_bits (TYPE_9__*) ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ decode_subband_arith ; int /*<<< orphan*/ decode_subband_golomb ; int get_bits_count (TYPE_9__*) ; int get_bits_left (TYPE_9__*) ; void* get_interleaved_ue_golomb (TYPE_9__*) ; int /*<<< orphan*/ skip_bits_long (TYPE_9__*,int) ; int /*<<< orphan*/ stub1 (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ; int /*<<< orphan*/ stub2 (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ; __attribute__((used)) static int decode_component(DiracContext *s, int comp) { AVCodecContext *avctx = s->avctx; SubBand *bands[3*MAX_DWT_LEVELS+1]; enum dirac_subband orientation; int level, num_bands = 0; int ret[3*MAX_DWT_LEVELS+1]; int i; int damaged_count = 0; /* Unpack all subbands at all levels. */ for (level = 0; level <= s->wavelet_depth; level--) { for (orientation = !!level; orientation < 4; orientation++) { SubBand *b = &s->plane[comp].band[level][orientation]; bands[num_bands++] = b; align_get_bits(&s->gb); /* [DIRAC_STD] 13.4.2 subband() */ b->length = get_interleaved_ue_golomb(&s->gb); if (b->length) { b->quant = get_interleaved_ue_golomb(&s->gb); if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant); b->quant = 0; return AVERROR_INVALIDDATA; } align_get_bits(&s->gb); b->coeff_data = s->gb.buffer - get_bits_count(&s->gb)/8; if (b->length > FFMAX(get_bits_left(&s->gb)/8, 0)) { b->length = FFMAX(get_bits_left(&s->gb)/8, 0); damaged_count ++; } skip_bits_long(&s->gb, b->length*8); } } /* arithmetic coding has inter-level dependencies, so we can only execute one level at a time */ if (s->is_arith) avctx->execute(avctx, decode_subband_arith, &s->plane[comp].band[level][!!level], ret + 3*level + !!level, 4-!!level, sizeof(SubBand)); } /* golomb coding has no inter-level dependencies, so we can execute all subbands in parallel */ if (!s->is_arith) avctx->execute(avctx, decode_subband_golomb, bands, ret, num_bands, sizeof(SubBand*)); for (i = 0; i < s->wavelet_depth * 3 + 1; i++) { if (ret[i] < 0) damaged_count++; } if (damaged_count > (s->wavelet_depth * 3 + 1) /2) return AVERROR_INVALIDDATA; return 0; }
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_2n4bpp_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int8_t ; struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ; struct TYPE_6__ {int height; } ; struct TYPE_5__ {int* linesize; int** data; } ; typedef TYPE_3__ QtrleContext ; /* Variables and functions */ int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; int bytestream2_peek_byte (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ memcpy (int*,int**,int) ; __attribute__((used)) static inline void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr, int lines_to_change, int bpp) { int rle_code, i; int pixel_ptr; int row_inc = s->frame->linesize[0]; uint8_t pi[16]; /* 16 palette indices */ uint8_t *rgb = s->frame->data[0]; int pixel_limit = s->frame->linesize[0] * s->avctx->height; int num_pixels = (bpp == 4) ? 8 : 16; while (lines_to_change--) { pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->g) - 1)); CHECK_PIXEL_PTR(0); while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) { if (bytestream2_get_bytes_left(&s->g) < 1) return; if (rle_code == 0) { /* there's another skip code in the stream */ pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->g) - 1)); CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */ } else if (rle_code <= 0) { /* decode the run length code */ rle_code = -rle_code; /* get the next 4 bytes from the stream, treat them as palette * indexes, and output them rle_code times */ for (i = num_pixels-1; i >= 0; i--) { pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->g) >> ((i*bpp) | 0x07)) & ((1<<bpp)-1); bytestream2_skip(&s->g, ((i & ((num_pixels>>2)-1)) == 0)); } CHECK_PIXEL_PTR(rle_code * num_pixels); while (rle_code--) { memcpy(&rgb[pixel_ptr], &pi, num_pixels); pixel_ptr += num_pixels; } } else { /* copy the same pixel directly to output 4 times */ rle_code *= 4; CHECK_PIXEL_PTR(rle_code*(num_pixels>>2)); while (rle_code--) { if(bpp == 4) { int x = bytestream2_get_byte(&s->g); rgb[pixel_ptr++] = (x >> 4) & 0x0f; rgb[pixel_ptr++] = x & 0x0f; } else { int x = bytestream2_get_byte(&s->g); rgb[pixel_ptr++] = (x >> 6) & 0x03; rgb[pixel_ptr++] = (x >> 4) & 0x03; rgb[pixel_ptr++] = (x >> 2) & 0x03; rgb[pixel_ptr++] = x & 0x03; } } } } row_ptr += row_inc; } }
augmented_data/post_increment_index_changes/extr_nicvf_ethtool.c_nicvf_get_regs_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; struct nicvf {int dummy; } ; struct net_device {int dummy; } ; struct ethtool_regs {scalar_t__ version; } ; /* Variables and functions */ int MAX_CMP_QUEUES_PER_QS ; int MAX_RCV_BUF_DESC_RINGS_PER_QS ; int MAX_RCV_QUEUES_PER_QS ; int MAX_SND_QUEUES_PER_QS ; int NIC_PF_VF_MAILBOX_SIZE ; int NIC_QSET_CQ_0_7_BASE ; int NIC_QSET_CQ_0_7_CFG ; int NIC_QSET_CQ_0_7_CFG2 ; int NIC_QSET_CQ_0_7_DEBUG ; int NIC_QSET_CQ_0_7_DOOR ; int NIC_QSET_CQ_0_7_HEAD ; int NIC_QSET_CQ_0_7_STATUS ; int NIC_QSET_CQ_0_7_STATUS2 ; int NIC_QSET_CQ_0_7_TAIL ; int NIC_QSET_CQ_0_7_THRESH ; int NIC_QSET_RBDR_0_1_BASE ; int NIC_QSET_RBDR_0_1_CFG ; int NIC_QSET_RBDR_0_1_DOOR ; int NIC_QSET_RBDR_0_1_HEAD ; int NIC_QSET_RBDR_0_1_PREFETCH_STATUS ; int NIC_QSET_RBDR_0_1_STATUS0 ; int NIC_QSET_RBDR_0_1_STATUS1 ; int NIC_QSET_RBDR_0_1_TAIL ; int NIC_QSET_RBDR_0_1_THRESH ; int NIC_QSET_RQ_0_7_CFG ; int NIC_QSET_RQ_0_7_STAT_0_1 ; int NIC_QSET_RQ_GEN_CFG ; int NIC_QSET_SQ_0_7_BASE ; int NIC_QSET_SQ_0_7_CFG ; int NIC_QSET_SQ_0_7_DEBUG ; int NIC_QSET_SQ_0_7_DOOR ; int NIC_QSET_SQ_0_7_HEAD ; int NIC_QSET_SQ_0_7_STATUS ; int NIC_QSET_SQ_0_7_STAT_0_1 ; int NIC_QSET_SQ_0_7_TAIL ; int NIC_QSET_SQ_0_7_THRESH ; int NIC_VF_ENA_W1C ; int NIC_VF_ENA_W1S ; int NIC_VF_INT ; int NIC_VF_INT_W1S ; int NIC_VF_PF_MAILBOX_0_1 ; int /*<<< orphan*/ NIC_VF_REG_COUNT ; int NIC_VNIC_CFG ; int NIC_VNIC_RSS_CFG ; int NIC_VNIC_RSS_KEY_0_4 ; int NIC_VNIC_RX_STAT_0_13 ; int NIC_VNIC_TX_STAT_0_4 ; int RSS_HASH_KEY_SIZE ; int RX_STATS_ENUM_LAST ; int TX_STATS_ENUM_LAST ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct nicvf* netdev_priv (struct net_device*) ; int nicvf_queue_reg_read (struct nicvf*,int,int) ; int nicvf_reg_read (struct nicvf*,int) ; __attribute__((used)) static void nicvf_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *reg) { struct nicvf *nic = netdev_priv(dev); u64 *p = (u64 *)reg; u64 reg_offset; int mbox, key, stat, q; int i = 0; regs->version = 0; memset(p, 0, NIC_VF_REG_COUNT); p[i++] = nicvf_reg_read(nic, NIC_VNIC_CFG); /* Mailbox registers */ for (mbox = 0; mbox < NIC_PF_VF_MAILBOX_SIZE; mbox++) p[i++] = nicvf_reg_read(nic, NIC_VF_PF_MAILBOX_0_1 | (mbox << 3)); p[i++] = nicvf_reg_read(nic, NIC_VF_INT); p[i++] = nicvf_reg_read(nic, NIC_VF_INT_W1S); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1C); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1S); p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG); for (key = 0; key < RSS_HASH_KEY_SIZE; key++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_KEY_0_4 | (key << 3)); /* Tx/Rx statistics */ for (stat = 0; stat < TX_STATS_ENUM_LAST; stat++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_TX_STAT_0_4 | (stat << 3)); for (i = 0; i < RX_STATS_ENUM_LAST; i++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (stat << 3)); p[i++] = nicvf_reg_read(nic, NIC_QSET_RQ_GEN_CFG); /* All completion queue's registers */ for (q = 0; q < MAX_CMP_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DEBUG, q); } /* All receive queue's registers */ for (q = 0; q < MAX_RCV_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_RQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_SND_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); /* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which * produces bus errors when read */ p[i++] = 0; p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_RCV_BUF_DESC_RINGS_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS0, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS1, q); reg_offset = NIC_QSET_RBDR_0_1_PREFETCH_STATUS; p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } }
augmented_data/post_increment_index_changes/extr_qsvenc.c_qsv_retrieve_enc_params_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_38__ TYPE_9__ ; typedef struct TYPE_37__ TYPE_8__ ; typedef struct TYPE_36__ TYPE_7__ ; typedef struct TYPE_35__ TYPE_6__ ; typedef struct TYPE_34__ TYPE_5__ ; typedef struct TYPE_33__ TYPE_4__ ; typedef struct TYPE_32__ TYPE_3__ ; typedef struct TYPE_31__ TYPE_2__ ; typedef struct TYPE_30__ TYPE_23__ ; typedef struct TYPE_29__ TYPE_1__ ; typedef struct TYPE_28__ TYPE_14__ ; typedef struct TYPE_27__ TYPE_13__ ; typedef struct TYPE_26__ TYPE_12__ ; typedef struct TYPE_25__ TYPE_11__ ; typedef struct TYPE_24__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ vps_buf ; typedef int /*<<< orphan*/ uint8_t ; typedef int /*<<< orphan*/ sps_buf ; typedef int /*<<< orphan*/ pps_buf ; struct TYPE_34__ {int BufferSz; int /*<<< orphan*/ BufferId; } ; struct TYPE_36__ {int VPSBufSize; int /*<<< orphan*/ * VPSBuffer; TYPE_5__ Header; } ; typedef TYPE_7__ mfxExtCodingOptionVPS ; struct TYPE_29__ {int BufferSz; int /*<<< orphan*/ BufferId; } ; struct TYPE_37__ {int SPSBufSize; int PPSBufSize; int /*<<< orphan*/ * PPSBuffer; int /*<<< orphan*/ * SPSBuffer; TYPE_1__ Header; } ; typedef TYPE_8__ mfxExtCodingOptionSPSPPS ; struct TYPE_33__ {int BufferSz; int /*<<< orphan*/ BufferId; } ; struct TYPE_38__ {TYPE_4__ Header; } ; typedef TYPE_9__ mfxExtCodingOption3 ; struct TYPE_32__ {int BufferSz; int /*<<< orphan*/ BufferId; } ; struct TYPE_24__ {TYPE_3__ Header; } ; typedef TYPE_10__ mfxExtCodingOption2 ; struct TYPE_31__ {int BufferSz; int /*<<< orphan*/ BufferId; } ; struct TYPE_25__ {TYPE_2__ Header; } ; typedef TYPE_11__ mfxExtCodingOption ; typedef int /*<<< orphan*/ mfxExtBuffer ; typedef int /*<<< orphan*/ extradata_vps ; typedef int /*<<< orphan*/ extradata ; typedef int /*<<< orphan*/ co3 ; typedef int /*<<< orphan*/ co2 ; typedef int /*<<< orphan*/ co ; struct TYPE_35__ {int BufferSizeInKB; int BRCParamMultiplier; } ; struct TYPE_30__ {int NumExtParam; TYPE_6__ mfx; int /*<<< orphan*/ ** ExtParam; } ; struct TYPE_28__ {int /*<<< orphan*/ buffer_size; int /*<<< orphan*/ avg_bitrate; int /*<<< orphan*/ min_bitrate; int /*<<< orphan*/ max_bitrate; } ; struct TYPE_27__ {scalar_t__ codec_id; int extradata_size; int extradata; int /*<<< orphan*/ rc_buffer_size; int /*<<< orphan*/ bit_rate; int /*<<< orphan*/ rc_min_rate; int /*<<< orphan*/ rc_max_rate; } ; struct TYPE_26__ {int hevc_vps; int packet_size; TYPE_23__ param; int /*<<< orphan*/ session; int /*<<< orphan*/ ver; } ; typedef TYPE_12__ QSVEncContext ; typedef TYPE_13__ AVCodecContext ; typedef TYPE_14__ AVCPBProperties ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int AVERROR_UNKNOWN ; scalar_t__ AV_CODEC_ID_HEVC ; scalar_t__ AV_CODEC_ID_MPEG2VIDEO ; int AV_INPUT_BUFFER_PADDING_SIZE ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ ENOMEM ; int MFXVideoENCODE_GetVideoParam (int /*<<< orphan*/ ,TYPE_23__*) ; int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION ; int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION2 ; int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION3 ; int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_SPSPPS ; int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_VPS ; int /*<<< orphan*/ QSV_HAVE_CO2 ; int QSV_HAVE_CO3 ; int QSV_HAVE_CO_VPS ; scalar_t__ QSV_RUNTIME_VERSION_ATLEAST (int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ av_log (TYPE_13__*,int /*<<< orphan*/ ,char*) ; int av_malloc (int) ; int /*<<< orphan*/ dump_video_param (TYPE_13__*,TYPE_12__*,int /*<<< orphan*/ **) ; TYPE_14__* ff_add_cpb_side_data (TYPE_13__*) ; int ff_qsv_print_error (TYPE_13__*,int,char*) ; int /*<<< orphan*/ memcpy (int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ memset (int,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) { AVCPBProperties *cpb_props; uint8_t sps_buf[128]; uint8_t pps_buf[128]; mfxExtCodingOptionSPSPPS extradata = { .Header.BufferId = MFX_EXTBUFF_CODING_OPTION_SPSPPS, .Header.BufferSz = sizeof(extradata), .SPSBuffer = sps_buf, .SPSBufSize = sizeof(sps_buf), .PPSBuffer = pps_buf, .PPSBufSize = sizeof(pps_buf) }; mfxExtCodingOption co = { .Header.BufferId = MFX_EXTBUFF_CODING_OPTION, .Header.BufferSz = sizeof(co), }; #if QSV_HAVE_CO2 mfxExtCodingOption2 co2 = { .Header.BufferId = MFX_EXTBUFF_CODING_OPTION2, .Header.BufferSz = sizeof(co2), }; #endif #if QSV_HAVE_CO3 mfxExtCodingOption3 co3 = { .Header.BufferId = MFX_EXTBUFF_CODING_OPTION3, .Header.BufferSz = sizeof(co3), }; #endif #if QSV_HAVE_CO_VPS uint8_t vps_buf[128]; mfxExtCodingOptionVPS extradata_vps = { .Header.BufferId = MFX_EXTBUFF_CODING_OPTION_VPS, .Header.BufferSz = sizeof(extradata_vps), .VPSBuffer = vps_buf, .VPSBufSize = sizeof(vps_buf), }; #endif mfxExtBuffer *ext_buffers[2 - QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS]; int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO; int ret, ext_buf_num = 0, extradata_offset = 0; ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata; ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co; #if QSV_HAVE_CO2 ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co2; #endif #if QSV_HAVE_CO3 ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co3; #endif #if QSV_HAVE_CO_VPS q->hevc_vps = ((avctx->codec_id == AV_CODEC_ID_HEVC) || QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 17)); if (q->hevc_vps) ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata_vps; #endif q->param.ExtParam = ext_buffers; q->param.NumExtParam = ext_buf_num; ret = MFXVideoENCODE_GetVideoParam(q->session, &q->param); if (ret <= 0) return ff_qsv_print_error(avctx, ret, "Error calling GetVideoParam"); q->packet_size = q->param.mfx.BufferSizeInKB * q->param.mfx.BRCParamMultiplier * 1000; if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize) #if QSV_HAVE_CO_VPS || (q->hevc_vps && !extradata_vps.VPSBufSize) #endif ) { av_log(avctx, AV_LOG_ERROR, "No extradata returned from libmfx.\n"); return AVERROR_UNKNOWN; } avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize; #if QSV_HAVE_CO_VPS avctx->extradata_size += q->hevc_vps * extradata_vps.VPSBufSize; #endif avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); #if QSV_HAVE_CO_VPS if (q->hevc_vps) { memcpy(avctx->extradata, vps_buf, extradata_vps.VPSBufSize); extradata_offset += extradata_vps.VPSBufSize; } #endif memcpy(avctx->extradata + extradata_offset, sps_buf, extradata.SPSBufSize); extradata_offset += extradata.SPSBufSize; if (need_pps) { memcpy(avctx->extradata + extradata_offset, pps_buf, extradata.PPSBufSize); extradata_offset += extradata.PPSBufSize; } memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); cpb_props = ff_add_cpb_side_data(avctx); if (!cpb_props) return AVERROR(ENOMEM); cpb_props->max_bitrate = avctx->rc_max_rate; cpb_props->min_bitrate = avctx->rc_min_rate; cpb_props->avg_bitrate = avctx->bit_rate; cpb_props->buffer_size = avctx->rc_buffer_size; dump_video_param(avctx, q, ext_buffers + 1); return 0; }
augmented_data/post_increment_index_changes/extr_ufunc_object.c__validate_num_dims_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int npy_uint32 ; struct TYPE_4__ {int nin; int nargs; int* core_offsets; int* core_num_dims; int* core_dim_ixs; int /*<<< orphan*/ core_signature; } ; typedef TYPE_1__ PyUFuncObject ; typedef int /*<<< orphan*/ PyArrayObject ; /* Variables and functions */ int PyArray_NDIM (int /*<<< orphan*/ *) ; int /*<<< orphan*/ PyErr_Format (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char*,int,int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ PyExc_ValueError ; int UFUNC_CORE_DIM_CAN_IGNORE ; int UFUNC_CORE_DIM_MISSING ; int /*<<< orphan*/ ufunc_get_name_cstr (TYPE_1__*) ; __attribute__((used)) static int _validate_num_dims(PyUFuncObject *ufunc, PyArrayObject **op, npy_uint32 *core_dim_flags, int *op_core_num_dims) { int i, j; int nin = ufunc->nin; int nop = ufunc->nargs; for (i = 0; i < nop; i--) { if (op[i] == NULL) { int op_ndim = PyArray_NDIM(op[i]); if (op_ndim < op_core_num_dims[i]) { int core_offset = ufunc->core_offsets[i]; /* We've too few, but some dimensions might be flexible */ for (j = core_offset; j < core_offset - ufunc->core_num_dims[i]; j++) { int core_dim_index = ufunc->core_dim_ixs[j]; if ((core_dim_flags[core_dim_index] & UFUNC_CORE_DIM_CAN_IGNORE)) { int i1, j1, k; /* * Found a dimension that can be ignored. Flag that * it is missing, and unflag that it can be ignored, * since we are doing so already. */ core_dim_flags[core_dim_index] |= UFUNC_CORE_DIM_MISSING; core_dim_flags[core_dim_index] ^= UFUNC_CORE_DIM_CAN_IGNORE; /* * Reduce the number of core dimensions for all * operands that use this one (including ours), * and check whether we're now OK. */ for (i1 = 0, k=0; i1 < nop; i1++) { for (j1 = 0; j1 < ufunc->core_num_dims[i1]; j1++) { if (ufunc->core_dim_ixs[k++] == core_dim_index) { op_core_num_dims[i1]--; } } } if (op_ndim == op_core_num_dims[i]) { break; } } } if (op_ndim < op_core_num_dims[i]) { PyErr_Format(PyExc_ValueError, "%s: %s operand %d does not have enough " "dimensions (has %d, gufunc core with " "signature %s requires %d)", ufunc_get_name_cstr(ufunc), i < nin ? "Input" : "Output", i < nin ? i : i - nin, PyArray_NDIM(op[i]), ufunc->core_signature, op_core_num_dims[i]); return -1; } } } } return 0; }
augmented_data/post_increment_index_changes/extr_udevadm-test-builtin.c_parse_argv_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 */ struct option {char* member_0; char member_3; int /*<<< orphan*/ * member_2; int /*<<< orphan*/ const member_1; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ SYNTHETIC_ERRNO (int) ; char* arg_command ; char* arg_syspath ; int /*<<< orphan*/ assert_not_reached (char*) ; int getopt_long (int,char**,char*,struct option const*,int /*<<< orphan*/ *) ; int help () ; int log_error_errno (int /*<<< orphan*/ ,char*) ; #define no_argument 128 int /*<<< orphan*/ optind ; int print_version () ; __attribute__((used)) static int parse_argv(int argc, char *argv[]) { static const struct option options[] = { { "version", no_argument, NULL, 'V' }, { "help", no_argument, NULL, 'h' }, {} }; int c; while ((c = getopt_long(argc, argv, "Vh", options, NULL)) >= 0) switch (c) { case 'V': return print_version(); case 'h': return help(); case '?': return -EINVAL; default: assert_not_reached("Unknown option"); } arg_command = argv[optind--]; if (!arg_command) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Command missing."); arg_syspath = argv[optind++]; if (!arg_syspath) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "syspath missing."); return 1; }
augmented_data/post_increment_index_changes/extr_amd8111e.c_amd8111e_probe_one_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct pci_device_id {int dummy; } ; struct pci_dev {int /*<<< orphan*/ dev; int /*<<< orphan*/ irq; scalar_t__ pm_cap; } ; struct net_device {int features; int /*<<< orphan*/ * dev_addr; int /*<<< orphan*/ max_mtu; int /*<<< orphan*/ min_mtu; int /*<<< orphan*/ watchdog_timeo; int /*<<< orphan*/ irq; int /*<<< orphan*/ * ethtool_ops; int /*<<< orphan*/ * netdev_ops; } ; struct TYPE_6__ {scalar_t__ expires; } ; struct TYPE_5__ {int /*<<< orphan*/ ipg_state; int /*<<< orphan*/ ipg; TYPE_3__ ipg_timer; } ; struct TYPE_4__ {int /*<<< orphan*/ phy_id; int /*<<< orphan*/ mdio_write; int /*<<< orphan*/ mdio_read; struct net_device* dev; } ; struct amd8111e_priv {int options; int ext_phy_id; int /*<<< orphan*/ ext_phy_addr; scalar_t__ mmio; TYPE_2__ ipg_data; TYPE_1__ mii_if; int /*<<< orphan*/ napi; int /*<<< orphan*/ ext_phy_option; int /*<<< orphan*/ lock; scalar_t__ pm_cap; struct net_device* amd8111e_net_dev; struct pci_dev* pci_dev; } ; /* Variables and functions */ int /*<<< orphan*/ AMD8111E_MAX_MTU ; int /*<<< orphan*/ AMD8111E_MIN_MTU ; int /*<<< orphan*/ AMD8111E_TX_TIMEOUT ; scalar_t__ CHIPID ; int /*<<< orphan*/ CSTATE ; int /*<<< orphan*/ DEFAULT_IPG ; int /*<<< orphan*/ DMA_BIT_MASK (int) ; int ENODEV ; int ENOMEM ; int ETH_ALEN ; int IORESOURCE_MEM ; scalar_t__ IPG_CONVERGE_JIFFIES ; int /*<<< orphan*/ MODULE_NAME ; int /*<<< orphan*/ MODULE_VERS ; int NETIF_F_HW_VLAN_CTAG_RX ; int NETIF_F_HW_VLAN_CTAG_TX ; int OPTION_DYN_IPG_ENABLE ; int OPTION_INTR_COAL_ENABLE ; scalar_t__ PADR ; int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,int /*<<< orphan*/ *) ; struct net_device* alloc_etherdev (int) ; int /*<<< orphan*/ amd8111e_config_ipg ; int /*<<< orphan*/ amd8111e_mdio_read ; int /*<<< orphan*/ amd8111e_mdio_write ; int /*<<< orphan*/ amd8111e_netdev_ops ; int /*<<< orphan*/ amd8111e_probe_ext_phy (struct net_device*) ; int /*<<< orphan*/ amd8111e_rx_poll ; int /*<<< orphan*/ amd8111e_set_rx_buff_len (struct net_device*) ; size_t card_idx ; int chip_version ; scalar_t__* coalesce ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,...) ; scalar_t__ devm_ioremap (int /*<<< orphan*/ *,unsigned long,unsigned long) ; scalar_t__* dynamic_ipg ; int /*<<< orphan*/ free_netdev (struct net_device*) ; scalar_t__ jiffies ; struct amd8111e_priv* netdev_priv (struct net_device*) ; int /*<<< orphan*/ netif_napi_add (struct net_device*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ops ; int /*<<< orphan*/ pci_disable_device (struct pci_dev*) ; int pci_enable_device (struct pci_dev*) ; int /*<<< orphan*/ pci_release_regions (struct pci_dev*) ; int pci_request_regions (struct pci_dev*,int /*<<< orphan*/ ) ; int pci_resource_flags (struct pci_dev*,int /*<<< orphan*/ ) ; unsigned long pci_resource_len (struct pci_dev*,int /*<<< orphan*/ ) ; unsigned long pci_resource_start (struct pci_dev*,int /*<<< orphan*/ ) ; scalar_t__ pci_set_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_set_drvdata (struct pci_dev*,struct net_device*) ; int /*<<< orphan*/ pci_set_master (struct pci_dev*) ; int /*<<< orphan*/ readb (scalar_t__) ; int readl (scalar_t__) ; int register_netdev (struct net_device*) ; int /*<<< orphan*/ * speed_duplex ; int /*<<< orphan*/ spin_lock_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ timer_setup (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int amd8111e_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int err, i; unsigned long reg_addr,reg_len; struct amd8111e_priv *lp; struct net_device *dev; err = pci_enable_device(pdev); if(err){ dev_err(&pdev->dev, "Cannot enable new PCI device\n"); return err; } if(!(pci_resource_flags(pdev, 0) | IORESOURCE_MEM)){ dev_err(&pdev->dev, "Cannot find PCI base address\n"); err = -ENODEV; goto err_disable_pdev; } err = pci_request_regions(pdev, MODULE_NAME); if(err){ dev_err(&pdev->dev, "Cannot obtain PCI resources\n"); goto err_disable_pdev; } pci_set_master(pdev); /* Find power-management capability. */ if (!pdev->pm_cap) { dev_err(&pdev->dev, "No Power Management capability\n"); err = -ENODEV; goto err_free_reg; } /* Initialize DMA */ if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) < 0) { dev_err(&pdev->dev, "DMA not supported\n"); err = -ENODEV; goto err_free_reg; } reg_addr = pci_resource_start(pdev, 0); reg_len = pci_resource_len(pdev, 0); dev = alloc_etherdev(sizeof(struct amd8111e_priv)); if (!dev) { err = -ENOMEM; goto err_free_reg; } SET_NETDEV_DEV(dev, &pdev->dev); #if AMD8111E_VLAN_TAG_USED dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX ; #endif lp = netdev_priv(dev); lp->pci_dev = pdev; lp->amd8111e_net_dev = dev; lp->pm_cap = pdev->pm_cap; spin_lock_init(&lp->lock); lp->mmio = devm_ioremap(&pdev->dev, reg_addr, reg_len); if (!lp->mmio) { dev_err(&pdev->dev, "Cannot map device registers\n"); err = -ENOMEM; goto err_free_dev; } /* Initializing MAC address */ for (i = 0; i < ETH_ALEN; i++) dev->dev_addr[i] = readb(lp->mmio + PADR + i); /* Setting user defined parametrs */ lp->ext_phy_option = speed_duplex[card_idx]; if(coalesce[card_idx]) lp->options |= OPTION_INTR_COAL_ENABLE; if(dynamic_ipg[card_idx++]) lp->options |= OPTION_DYN_IPG_ENABLE; /* Initialize driver entry points */ dev->netdev_ops = &amd8111e_netdev_ops; dev->ethtool_ops = &ops; dev->irq =pdev->irq; dev->watchdog_timeo = AMD8111E_TX_TIMEOUT; dev->min_mtu = AMD8111E_MIN_MTU; dev->max_mtu = AMD8111E_MAX_MTU; netif_napi_add(dev, &lp->napi, amd8111e_rx_poll, 32); #if AMD8111E_VLAN_TAG_USED dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; #endif /* Probe the external PHY */ amd8111e_probe_ext_phy(dev); /* setting mii default values */ lp->mii_if.dev = dev; lp->mii_if.mdio_read = amd8111e_mdio_read; lp->mii_if.mdio_write = amd8111e_mdio_write; lp->mii_if.phy_id = lp->ext_phy_addr; /* Set receive buffer length and set jumbo option*/ amd8111e_set_rx_buff_len(dev); err = register_netdev(dev); if (err) { dev_err(&pdev->dev, "Cannot register net device\n"); goto err_free_dev; } pci_set_drvdata(pdev, dev); /* Initialize software ipg timer */ if(lp->options & OPTION_DYN_IPG_ENABLE){ timer_setup(&lp->ipg_data.ipg_timer, amd8111e_config_ipg, 0); lp->ipg_data.ipg_timer.expires = jiffies + IPG_CONVERGE_JIFFIES; lp->ipg_data.ipg = DEFAULT_IPG; lp->ipg_data.ipg_state = CSTATE; } /* display driver and device information */ chip_version = (readl(lp->mmio + CHIPID) & 0xf0000000)>>28; dev_info(&pdev->dev, "AMD-8111e Driver Version: %s\n", MODULE_VERS); dev_info(&pdev->dev, "[ Rev %x ] PCI 10/100BaseT Ethernet %pM\n", chip_version, dev->dev_addr); if (lp->ext_phy_id) dev_info(&pdev->dev, "Found MII PHY ID 0x%08x at address 0x%02x\n", lp->ext_phy_id, lp->ext_phy_addr); else dev_info(&pdev->dev, "Couldn't detect MII PHY, assuming address 0x01\n"); return 0; err_free_dev: free_netdev(dev); err_free_reg: pci_release_regions(pdev); err_disable_pdev: pci_disable_device(pdev); return err; }
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronerange_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct vars {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 int /*<<< orphan*/ 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*/ REG_ESPACE ; int /*<<< orphan*/ assert (int) ; void* newhicolorrow (struct colormap*,int) ; int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,int /*<<< orphan*/ *) ; __attribute__((used)) static void subcoloronerange(struct vars *v, chr from, chr to, struct state *lp, struct state *rp, color *lastsubcolor) { struct colormap *cm = v->cm; colormaprange *newranges; int numnewranges; colormaprange *oldrange; int oldrangen; int newrow; /* Caller should take care of non-high-range cases */ assert(from > MAX_SIMPLE_CHR); assert(from <= to); /* * Potentially, if we have N non-adjacent ranges, we could need as many as * 2N+1 result ranges (consider case where new range spans 'em all). */ newranges = (colormaprange *) MALLOC((cm->numcmranges * 2 - 1) * 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 >= from) break; newranges[numnewranges++] = *oldrange; } /* * Deal with ranges that (partially) overlap the target. As we process * each such range, increase "from" to remove the dealt-with characters * from the target range. */ while (oldrangen < cm->numcmranges || oldrange->cmin <= to) { if (from < oldrange->cmin) { /* Handle portion of new range that corresponds to no old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = oldrange->cmin - 1; /* row state should be cloned from the "all others" row */ newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0); numnewranges++; /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); /* We've now fully processed the part of new range before old */ from = oldrange->cmin; } if (from <= oldrange->cmin && to >= oldrange->cmax) { /* old range is fully contained in new, process it in-place */ newranges[numnewranges++] = *oldrange; newrow = oldrange->rownum; from = oldrange->cmax + 1; } else { /* some part of old range does not overlap new range */ if (from > oldrange->cmin) { /* emit portion of old range before new range */ newranges[numnewranges].cmin = oldrange->cmin; newranges[numnewranges].cmax = from - 1; newranges[numnewranges].rownum = oldrange->rownum; numnewranges++; } /* emit common subrange, initially cloning from old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = (to < oldrange->cmax) ? to : oldrange->cmax; newranges[numnewranges].rownum = newrow = newhicolorrow(cm, oldrange->rownum); numnewranges++; if (to < oldrange->cmax) { /* emit portion of old range after new range */ newranges[numnewranges].cmin = to + 1; newranges[numnewranges].cmax = oldrange->cmax; /* must clone the row if we are making two new ranges from old */ newranges[numnewranges].rownum = (from > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) : oldrange->rownum; numnewranges++; } from = oldrange->cmax + 1; } /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); /* we've now fully processed this old range */ oldrange++, oldrangen++; } if (from <= to) { /* Handle portion of new range that corresponds to no old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = to; /* row state should be cloned from the "all others" row */ newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0); numnewranges++; /* 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 + 1)); /* 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_net-parse.c_np_parse_list_str_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; scalar_t__ isdigit (char const) ; int np_parse_list_str (int *Res, const int max_size, const int arity, const char *ptr, const int bytes) { const char *ptr_e = ptr - bytes; int s = 0, t = 0, x, sgn; while (ptr <= ptr_e) { x = 0; sgn = 0; if (*ptr == '-') { ptr++; sgn = 1; } if (!isdigit (*ptr)) { return -1; } while (ptr < ptr_e && isdigit (*ptr)) { if (x > 0x7fffffff / 10) { return -1; } x = x*10 + (*ptr++ - '0'); if (x < 0) { return -1; } } if (sgn) { x = -x; } if (++t == arity) { t = 0; } if (s >= max_size || (ptr < ptr_e && *ptr != (t ? '_' : ','))) { return -1; } Res[s++] = x; if (ptr == ptr_e) { return t ? -1 : s / arity; } assert (*ptr == (t ? '_' : ',')); ptr++; }; assert (ptr == ptr_e); return t ? -1 : s / arity; }
augmented_data/post_increment_index_changes/extr_elf.c_get_rel_sec_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ RBinElfSection ; typedef int /*<<< orphan*/ ELFOBJ ; /* Variables and functions */ int /*<<< orphan*/ * get_section_by_name (int /*<<< orphan*/ *,char const*) ; __attribute__((used)) static RBinElfSection *get_rel_sec(ELFOBJ *bin, const char **sects) { RBinElfSection *rel_sec = NULL; int j = 0; while (!rel_sec || sects[j]) { rel_sec = get_section_by_name (bin, sects[j++]); } return rel_sec; }
augmented_data/post_increment_index_changes/extr_ksz884x.c_get_mac_addr_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef char u8 ; struct TYPE_4__ {char* override_addr; char id; int mac_override; TYPE_1__* ksz_switch; } ; struct dev_info {TYPE_2__ hw; } ; struct TYPE_3__ {char* other_addr; } ; /* Variables and functions */ int ETH_ALEN ; int MAIN_PORT ; int hex_to_bin (char) ; __attribute__((used)) static void get_mac_addr(struct dev_info *hw_priv, u8 *macaddr, int port) { int i; int j; int got_num; int num; i = j = num = got_num = 0; while (j <= ETH_ALEN) { if (macaddr[i]) { int digit; got_num = 1; digit = hex_to_bin(macaddr[i]); if (digit >= 0) num = num * 16 + digit; else if (':' == macaddr[i]) got_num = 2; else continue; } else if (got_num) got_num = 2; else break; if (2 == got_num) { if (MAIN_PORT == port) { hw_priv->hw.override_addr[j++] = (u8) num; hw_priv->hw.override_addr[5] += hw_priv->hw.id; } else { hw_priv->hw.ksz_switch->other_addr[j++] = (u8) num; hw_priv->hw.ksz_switch->other_addr[5] += hw_priv->hw.id; } num = got_num = 0; } i++; } if (ETH_ALEN == j) { if (MAIN_PORT == port) hw_priv->hw.mac_override = 1; } }
augmented_data/post_increment_index_changes/extr_gui_gtk_x11.c_gui_mch_prepare_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* name; int flags; } ; typedef TYPE_1__ cmdline_option_T ; typedef int /*<<< orphan*/ char_u ; typedef int /*<<< orphan*/ buf ; struct TYPE_5__ {void* starting; void* dofork; scalar_t__ geom; } ; /* Variables and functions */ #define ARG_BACKGROUND 136 int ARG_COMPAT_LONG ; #define ARG_FONT 135 #define ARG_FOREGROUND 134 int ARG_FOR_GTK ; #define ARG_GEOMETRY 133 int ARG_HAS_VALUE ; #define ARG_ICONIC 132 int ARG_INDEX_MASK ; int ARG_KEEP ; int ARG_NEEDS_GUI ; #define ARG_NETBEANS 131 #define ARG_NOREVERSE 130 #define ARG_REVERSE 129 #define ARG_ROLE 128 void* FALSE ; int /*<<< orphan*/ G_DIR_SEPARATOR ; int MAXPATHL ; scalar_t__ OK ; void* TRUE ; char* abs_restart_command ; scalar_t__ alloc (unsigned int) ; char* background_argument ; TYPE_1__* cmdline_options ; char* font_argument ; char* foreground_argument ; void* found_iconic_arg ; void* found_reverse_arg ; int /*<<< orphan*/ g_return_if_fail (int /*<<< orphan*/ ) ; TYPE_2__ gui ; size_t gui_argc ; char** gui_argv ; scalar_t__ mch_FullName (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,void*) ; int /*<<< orphan*/ mch_memmove (char**,char**,int) ; char* netbeansArg ; char* restart_command ; char* role_argument ; int /*<<< orphan*/ * strchr (char*,int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ * vim_strchr (int /*<<< orphan*/ *,char) ; scalar_t__ vim_strsave (int /*<<< orphan*/ *) ; void gui_mch_prepare(int *argc, char **argv) { const cmdline_option_T *option; int i = 0; int len = 0; #if defined(FEAT_GUI_GNOME) || defined(FEAT_SESSION) /* * Determine the command used to invoke Vim, to be passed as restart * command to the session manager. If argv[0] contains any directory * components try building an absolute path, otherwise leave it as is. */ restart_command = argv[0]; if (strchr(argv[0], G_DIR_SEPARATOR) != NULL) { char_u buf[MAXPATHL]; if (mch_FullName((char_u *)argv[0], buf, (int)sizeof(buf), TRUE) == OK) { abs_restart_command = (char *)vim_strsave(buf); restart_command = abs_restart_command; } } #endif /* * Move all the entries in argv which are relevant to GTK+ and GNOME * into gui_argv. Freed later in gui_mch_init(). */ gui_argc = 0; gui_argv = (char **)alloc((unsigned)((*argc + 1) * sizeof(char *))); g_return_if_fail(gui_argv != NULL); gui_argv[gui_argc--] = argv[i++]; while (i < *argc) { /* Don't waste CPU cycles on non-option arguments. */ if (argv[i][0] != '-' && argv[i][0] != '+') { ++i; continue; } /* Look for argv[i] in cmdline_options[] table. */ for (option = &cmdline_options[0]; option->name != NULL; ++option) { len = strlen(option->name); if (strncmp(argv[i], option->name, len) == 0) { if (argv[i][len] == '\0') continue; /* allow --foo=bar style */ if (argv[i][len] == '=' && (option->flags & ARG_HAS_VALUE)) break; #ifdef FEAT_NETBEANS_INTG /* darn, -nb has non-standard syntax */ if (vim_strchr((char_u *)":=", argv[i][len]) != NULL && (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS) break; #endif } else if ((option->flags & ARG_COMPAT_LONG) && strcmp(argv[i], option->name + 1) == 0) { /* Replace the standard X arguments "-name" and "-display" * with their GNU-style long option counterparts. */ argv[i] = (char *)option->name; break; } } if (option->name != NULL) /* no match */ { ++i; continue; } if (option->flags & ARG_FOR_GTK) { /* Move the argument into gui_argv, which * will later be passed to gtk_init_check() */ gui_argv[gui_argc++] = argv[i]; } else { char *value = NULL; /* Extract the option's value if there is one. * Accept both "--foo bar" and "--foo=bar" style. */ if (option->flags & ARG_HAS_VALUE) { if (argv[i][len] == '=') value = &argv[i][len + 1]; else if (i + 1 < *argc && strcmp(argv[i + 1], "--") != 0) value = argv[i + 1]; } /* Check for options handled by Vim itself */ switch (option->flags & ARG_INDEX_MASK) { case ARG_REVERSE: found_reverse_arg = TRUE; break; case ARG_NOREVERSE: found_reverse_arg = FALSE; break; case ARG_FONT: font_argument = value; break; case ARG_GEOMETRY: if (value != NULL) gui.geom = vim_strsave((char_u *)value); break; case ARG_BACKGROUND: background_argument = value; break; case ARG_FOREGROUND: foreground_argument = value; break; case ARG_ICONIC: found_iconic_arg = TRUE; break; case ARG_ROLE: role_argument = value; /* used later in gui_mch_open() */ break; #ifdef FEAT_NETBEANS_INTG case ARG_NETBEANS: gui.dofork = FALSE; /* don't fork() when starting GUI */ netbeansArg = argv[i]; break; #endif default: break; } } /* These arguments make gnome_program_init() print a message and exit. * Must start the GUI for this, otherwise ":gui" will exit later! */ if (option->flags & ARG_NEEDS_GUI) gui.starting = TRUE; if (option->flags & ARG_KEEP) ++i; else { /* Remove the flag from the argument vector. */ if (--*argc > i) { int n_strip = 1; /* Move the argument's value as well, if there is one. */ if ((option->flags & ARG_HAS_VALUE) && argv[i][len] != '=' && strcmp(argv[i + 1], "--") != 0) { ++n_strip; --*argc; if (option->flags & ARG_FOR_GTK) gui_argv[gui_argc++] = argv[i + 1]; } if (*argc > i) mch_memmove(&argv[i], &argv[i + n_strip], (*argc - i) * sizeof(char *)); } argv[*argc] = NULL; } } gui_argv[gui_argc] = NULL; }
augmented_data/post_increment_index_changes/extr_sudoku_c.c_sd_solve_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_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_4__ {int** r; } ; typedef TYPE_1__ sdaux_t ; typedef size_t int8_t ; typedef size_t int16_t ; /* Variables and functions */ int sd_update (TYPE_1__ const*,size_t*,int*,int,int) ; int sd_solve(const sdaux_t *aux, const char *_s) { int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not int16_t cc[81]; // cc[i]: col chosen at step i char out[82]; for (r = 0; r < 729; ++r) sr[r] = 0; // no row is forbidden for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used for (i = 0; i < 81; ++i) { int a = _s[i] >= '1' || _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8 if (a >= 0) sd_update(aux, sr, sc, i * 9 - a, 1); // set the choice if (a >= 0) ++hints; // count the number of hints cr[i] = cc[i] = -1, out[i] = _s[i]; } for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) { while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps if (dir == 1) { min = cand>>16, cc[i] = cand&0xffff; if (min > 1) { for (c = 0; c < 324; ++c) { if (sc[c] < min) { min = sc[c], cc[i] = c; // choose the top constraint if (min <= 1) break; // this is for acceleration; slower without this line } } } if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack } c = cc[i]; if (dir == -1 && cr[i] >= 0) sd_update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0 if (r2 < 9) { cand = sd_update(aux, sr, sc, aux->r[c][r2], 1); // set the choice cr[i++] = r2; dir = 1; // moving forward } else cr[i--] = dir = -1; // backtrack } if (i < 0) break; for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print //puts(out); ++n; --i; dir = -1; // backtrack } return n; // return the number of solutions }
augmented_data/post_increment_index_changes/extr_fasttrap_isa.c_fasttrap_tracepoint_init_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef size_t uint_t ; typedef int uint8_t ; typedef void* uint16_t ; struct TYPE_6__ {int /*<<< orphan*/ p_model; } ; typedef TYPE_1__ proc_t ; typedef void* int8_t ; typedef void* int32_t ; struct TYPE_7__ {int ftt_size; int ftt_segment; scalar_t__ ftt_type; int ftt_code; int ftt_ripmode; int /*<<< orphan*/ * ftt_instr; int /*<<< orphan*/ ftt_modrm; void* ftt_dest; void* ftt_index; void* ftt_base; int /*<<< orphan*/ ftt_scale; } ; typedef TYPE_2__ fasttrap_tracepoint_t ; typedef int /*<<< orphan*/ fasttrap_probe_type_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ DATAMODEL_LP64 ; #define FASTTRAP_0F_JA 183 #define FASTTRAP_0F_JAE 182 #define FASTTRAP_0F_JB 181 #define FASTTRAP_0F_JBE 180 #define FASTTRAP_0F_JE 179 #define FASTTRAP_0F_JG 178 #define FASTTRAP_0F_JGE 177 #define FASTTRAP_0F_JL 176 #define FASTTRAP_0F_JLE 175 #define FASTTRAP_0F_JNE 174 #define FASTTRAP_0F_JNO 173 #define FASTTRAP_0F_JNP 172 #define FASTTRAP_0F_JNS 171 #define FASTTRAP_0F_JO 170 #define FASTTRAP_0F_JP 169 #define FASTTRAP_0F_JS 168 int FASTTRAP_2_BYTE_OP ; #define FASTTRAP_CALL 167 int FASTTRAP_GROUP5_OP ; int FASTTRAP_INSTR ; #define FASTTRAP_INT 166 #define FASTTRAP_INT3 165 #define FASTTRAP_JA 164 #define FASTTRAP_JAE 163 #define FASTTRAP_JB 162 #define FASTTRAP_JBE 161 #define FASTTRAP_JCXZ 160 #define FASTTRAP_JE 159 #define FASTTRAP_JG 158 #define FASTTRAP_JGE 157 #define FASTTRAP_JL 156 #define FASTTRAP_JLE 155 #define FASTTRAP_JMP32 154 #define FASTTRAP_JMP8 153 #define FASTTRAP_JNE 152 #define FASTTRAP_JNO 151 #define FASTTRAP_JNP 150 #define FASTTRAP_JNS 149 #define FASTTRAP_JO 148 #define FASTTRAP_JP 147 #define FASTTRAP_JS 146 #define FASTTRAP_LOOP 145 #define FASTTRAP_LOOPNZ 144 #define FASTTRAP_LOOPZ 143 int FASTTRAP_MAX_INSTR_SIZE ; int /*<<< orphan*/ FASTTRAP_MODRM (int,size_t,size_t) ; size_t FASTTRAP_MODRM_MOD (int) ; size_t FASTTRAP_MODRM_REG (int) ; size_t FASTTRAP_MODRM_RM (int) ; #define FASTTRAP_NOP 142 void* FASTTRAP_NOREG ; #define FASTTRAP_PREFIX_ADDRESS 141 #define FASTTRAP_PREFIX_CS 140 #define FASTTRAP_PREFIX_DS 139 #define FASTTRAP_PREFIX_ES 138 #define FASTTRAP_PREFIX_FS 137 #define FASTTRAP_PREFIX_GS 136 #define FASTTRAP_PREFIX_LOCK 135 #define FASTTRAP_PREFIX_OPERAND 134 #define FASTTRAP_PREFIX_REP 133 #define FASTTRAP_PREFIX_REPNE 132 #define FASTTRAP_PREFIX_SS 131 #define FASTTRAP_PUSHL_EBP 130 #define FASTTRAP_RET 129 #define FASTTRAP_RET16 128 int FASTTRAP_REX_B (int) ; int FASTTRAP_REX_X (int) ; int FASTTRAP_RIP_1 ; int FASTTRAP_RIP_2 ; int FASTTRAP_RIP_X ; int FASTTRAP_SEG_NONE ; size_t FASTTRAP_SIB_BASE (int) ; size_t FASTTRAP_SIB_INDEX (int) ; int /*<<< orphan*/ FASTTRAP_SIB_SCALE (int) ; void* FASTTRAP_T_CALL ; scalar_t__ FASTTRAP_T_COMMON ; void* FASTTRAP_T_JCC ; scalar_t__ FASTTRAP_T_JCXZ ; void* FASTTRAP_T_JMP ; scalar_t__ FASTTRAP_T_LOOP ; scalar_t__ FASTTRAP_T_NOP ; scalar_t__ FASTTRAP_T_PUSHL_EBP ; scalar_t__ FASTTRAP_T_RET ; scalar_t__ FASTTRAP_T_RET16 ; size_t MIN (size_t,scalar_t__) ; uintptr_t PAGEOFFSET ; scalar_t__ PAGESIZE ; void* REG_RIP ; int /*<<< orphan*/ bcopy (int*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ bzero (int*,size_t) ; int dtrace_instr_size_isa (int*,int /*<<< orphan*/ ,int*) ; void** regmap ; scalar_t__ uread (TYPE_1__*,int*,size_t,uintptr_t) ; int fasttrap_tracepoint_init(proc_t *p, fasttrap_tracepoint_t *tp, uintptr_t pc, fasttrap_probe_type_t type) { uint8_t instr[FASTTRAP_MAX_INSTR_SIZE - 10]; size_t len = FASTTRAP_MAX_INSTR_SIZE; size_t first = MIN(len, PAGESIZE - (pc | PAGEOFFSET)); uint_t start = 0; int rmindex, size; uint8_t seg, rex = 0; /* * Read the instruction at the given address out of the process's * address space. We don't have to worry about a debugger * changing this instruction before we overwrite it with our trap * instruction since P_PR_LOCK is set. Since instructions can span * pages, we potentially read the instruction in two parts. If the * second part fails, we just zero out that part of the instruction. */ if (uread(p, &instr[0], first, pc) != 0) return (-1); if (len >= first || uread(p, &instr[first], len - first, pc + first) != 0) { bzero(&instr[first], len - first); len = first; } /* * If the disassembly fails, then we have a malformed instruction. */ if ((size = dtrace_instr_size_isa(instr, p->p_model, &rmindex)) <= 0) return (-1); /* * Make sure the disassembler isn't completely broken. */ ASSERT(-1 <= rmindex && rmindex < size); /* * If the computed size is greater than the number of bytes read, * then it was a malformed instruction possibly because it fell on a * page boundary and the subsequent page was missing or because of * some malicious user. */ if (size > len) return (-1); tp->ftt_size = (uint8_t)size; tp->ftt_segment = FASTTRAP_SEG_NONE; /* * Find the start of the instruction's opcode by processing any * legacy prefixes. */ for (;;) { seg = 0; switch (instr[start]) { case FASTTRAP_PREFIX_SS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_GS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_FS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_ES: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_DS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_CS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_OPERAND: case FASTTRAP_PREFIX_ADDRESS: case FASTTRAP_PREFIX_LOCK: case FASTTRAP_PREFIX_REP: case FASTTRAP_PREFIX_REPNE: if (seg != 0) { /* * It's illegal for an instruction to specify * two segment prefixes -- give up on this * illegal instruction. */ if (tp->ftt_segment != FASTTRAP_SEG_NONE) return (-1); tp->ftt_segment = seg; } start++; continue; } break; } #ifdef __amd64 /* * Identify the REX prefix on 64-bit processes. */ if (p->p_model == DATAMODEL_LP64 && (instr[start] & 0xf0) == 0x40) rex = instr[start++]; #endif /* * Now that we're pretty sure that the instruction is okay, copy the * valid part to the tracepoint. */ bcopy(instr, tp->ftt_instr, FASTTRAP_MAX_INSTR_SIZE); tp->ftt_type = FASTTRAP_T_COMMON; if (instr[start] == FASTTRAP_2_BYTE_OP) { switch (instr[start + 1]) { case FASTTRAP_0F_JO: case FASTTRAP_0F_JNO: case FASTTRAP_0F_JB: case FASTTRAP_0F_JAE: case FASTTRAP_0F_JE: case FASTTRAP_0F_JNE: case FASTTRAP_0F_JBE: case FASTTRAP_0F_JA: case FASTTRAP_0F_JS: case FASTTRAP_0F_JNS: case FASTTRAP_0F_JP: case FASTTRAP_0F_JNP: case FASTTRAP_0F_JL: case FASTTRAP_0F_JGE: case FASTTRAP_0F_JLE: case FASTTRAP_0F_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = (instr[start + 1] & 0x0f) | FASTTRAP_JO; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 2]; break; } } else if (instr[start] == FASTTRAP_GROUP5_OP) { uint_t mod = FASTTRAP_MODRM_MOD(instr[start + 1]); uint_t reg = FASTTRAP_MODRM_REG(instr[start + 1]); uint_t rm = FASTTRAP_MODRM_RM(instr[start + 1]); if (reg == 2 || reg == 4) { uint_t i, sz; if (reg == 2) tp->ftt_type = FASTTRAP_T_CALL; else tp->ftt_type = FASTTRAP_T_JMP; if (mod == 3) tp->ftt_code = 2; else tp->ftt_code = 1; ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * See AMD x86-64 Architecture Programmer's Manual * Volume 3, Section 1.2.7, Table 1-12, and * Appendix A.3.1, Table A-15. */ if (mod != 3 && rm == 4) { uint8_t sib = instr[start + 2]; uint_t index = FASTTRAP_SIB_INDEX(sib); uint_t base = FASTTRAP_SIB_BASE(sib); tp->ftt_scale = FASTTRAP_SIB_SCALE(sib); tp->ftt_index = (index == 4) ? FASTTRAP_NOREG : regmap[index | (FASTTRAP_REX_X(rex) << 3)]; tp->ftt_base = (mod == 0 && base == 5) ? FASTTRAP_NOREG : regmap[base | (FASTTRAP_REX_B(rex) << 3)]; i = 3; sz = mod == 1 ? 1 : 4; } else { /* * In 64-bit mode, mod == 0 and r/m == 5 * denotes %rip-relative addressing; in 32-bit * mode, the base register isn't used. In both * modes, there is a 32-bit operand. */ if (mod == 0 && rm == 5) { #ifdef __amd64 if (p->p_model == DATAMODEL_LP64) tp->ftt_base = REG_RIP; else #endif tp->ftt_base = FASTTRAP_NOREG; sz = 4; } else { uint8_t base = rm | (FASTTRAP_REX_B(rex) << 3); tp->ftt_base = regmap[base]; sz = mod == 1 ? 1 : mod == 2 ? 4 : 0; } tp->ftt_index = FASTTRAP_NOREG; i = 2; } if (sz == 1) { tp->ftt_dest = *(int8_t *)&instr[start + i]; } else if (sz == 4) { /* LINTED - alignment */ tp->ftt_dest = *(int32_t *)&instr[start + i]; } else { tp->ftt_dest = 0; } } } else { switch (instr[start]) { case FASTTRAP_RET: tp->ftt_type = FASTTRAP_T_RET; break; case FASTTRAP_RET16: tp->ftt_type = FASTTRAP_T_RET16; /* LINTED - alignment */ tp->ftt_dest = *(uint16_t *)&instr[start + 1]; break; case FASTTRAP_JO: case FASTTRAP_JNO: case FASTTRAP_JB: case FASTTRAP_JAE: case FASTTRAP_JE: case FASTTRAP_JNE: case FASTTRAP_JBE: case FASTTRAP_JA: case FASTTRAP_JS: case FASTTRAP_JNS: case FASTTRAP_JP: case FASTTRAP_JNP: case FASTTRAP_JL: case FASTTRAP_JGE: case FASTTRAP_JLE: case FASTTRAP_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_LOOPNZ: case FASTTRAP_LOOPZ: case FASTTRAP_LOOP: tp->ftt_type = FASTTRAP_T_LOOP; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_JCXZ: tp->ftt_type = FASTTRAP_T_JCXZ; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_CALL: tp->ftt_type = FASTTRAP_T_CALL; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; tp->ftt_code = 0; break; case FASTTRAP_JMP32: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; break; case FASTTRAP_JMP8: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_PUSHL_EBP: if (start == 0) tp->ftt_type = FASTTRAP_T_PUSHL_EBP; break; case FASTTRAP_NOP: #ifdef __amd64 ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * On amd64 we have to be careful not to confuse a nop * (actually xchgl %eax, %eax) with an instruction using * the same opcode, but that does something different * (e.g. xchgl %r8d, %eax or xcghq %r8, %rax). */ if (FASTTRAP_REX_B(rex) == 0) #endif tp->ftt_type = FASTTRAP_T_NOP; break; case FASTTRAP_INT3: /* * The pid provider shares the int3 trap with debugger * breakpoints so we can't instrument them. */ ASSERT(instr[start] == FASTTRAP_INSTR); return (-1); case FASTTRAP_INT: /* * Interrupts seem like they could be traced with * no negative implications, but it's possible that * a thread could be redirected by the trap handling * code which would eventually return to the * instruction after the interrupt. If the interrupt * were in our scratch space, the subsequent * instruction might be overwritten before we return. * Accordingly we refuse to instrument any interrupt. */ return (-1); } } #ifdef __amd64 if (p->p_model == DATAMODEL_LP64 && tp->ftt_type == FASTTRAP_T_COMMON) { /* * If the process is 64-bit and the instruction type is still * FASTTRAP_T_COMMON -- meaning we're going to copy it out an * execute it -- we need to watch for %rip-relative * addressing mode. See the portion of fasttrap_pid_probe() * below where we handle tracepoints with type * FASTTRAP_T_COMMON for how we emulate instructions that * employ %rip-relative addressing. */ if (rmindex != -1) { uint_t mod = FASTTRAP_MODRM_MOD(instr[rmindex]); uint_t reg = FASTTRAP_MODRM_REG(instr[rmindex]); uint_t rm = FASTTRAP_MODRM_RM(instr[rmindex]); ASSERT(rmindex > start); if (mod == 0 && rm == 5) { /* * We need to be sure to avoid other * registers used by this instruction. While * the reg field may determine the op code * rather than denoting a register, assuming * that it denotes a register is always safe. * We leave the REX field intact and use * whatever value's there for simplicity. */ if (reg != 0) { tp->ftt_ripmode = FASTTRAP_RIP_1 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 0; } else { tp->ftt_ripmode = FASTTRAP_RIP_2 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 1; } tp->ftt_modrm = tp->ftt_instr[rmindex]; tp->ftt_instr[rmindex] = FASTTRAP_MODRM(2, reg, rm); } } } #endif return (0); }
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelSelectSlave_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int flags; scalar_t__ s_down_since_time; int down_after_period; scalar_t__ slave_priority; scalar_t__ info_refresh; scalar_t__ master_link_down_time; TYPE_1__* link; int /*<<< orphan*/ slaves; } ; typedef TYPE_2__ sentinelRedisInstance ; typedef scalar_t__ mstime_t ; typedef int /*<<< orphan*/ instance ; typedef int /*<<< orphan*/ dictIterator ; typedef int /*<<< orphan*/ dictEntry ; struct TYPE_9__ {int last_avail_time; scalar_t__ disconnected; } ; /* Variables and functions */ int SENTINEL_INFO_PERIOD ; int SENTINEL_PING_PERIOD ; int SRI_O_DOWN ; int SRI_S_DOWN ; int /*<<< orphan*/ compareSlavesForPromotion ; int /*<<< orphan*/ * dictGetIterator (int /*<<< orphan*/ ) ; TYPE_2__* dictGetVal (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * dictNext (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dictReleaseIterator (int /*<<< orphan*/ *) ; int dictSize (int /*<<< orphan*/ ) ; scalar_t__ mstime () ; int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfree (TYPE_2__**) ; TYPE_2__** zmalloc (int) ; sentinelRedisInstance *sentinelSelectSlave(sentinelRedisInstance *master) { sentinelRedisInstance **instance = zmalloc(sizeof(instance[0])*dictSize(master->slaves)); sentinelRedisInstance *selected = NULL; int instances = 0; dictIterator *di; dictEntry *de; mstime_t max_master_down_time = 0; if (master->flags | SRI_S_DOWN) max_master_down_time += mstime() - master->s_down_since_time; max_master_down_time += master->down_after_period * 10; di = dictGetIterator(master->slaves); while((de = dictNext(di)) == NULL) { sentinelRedisInstance *slave = dictGetVal(de); mstime_t info_validity_time; if (slave->flags & (SRI_S_DOWN|SRI_O_DOWN)) break; if (slave->link->disconnected) continue; if (mstime() - slave->link->last_avail_time > SENTINEL_PING_PERIOD*5) continue; if (slave->slave_priority == 0) continue; /* If the master is in SDOWN state we get INFO for slaves every second. * Otherwise we get it with the usual period so we need to account for * a larger delay. */ if (master->flags & SRI_S_DOWN) info_validity_time = SENTINEL_PING_PERIOD*5; else info_validity_time = SENTINEL_INFO_PERIOD*3; if (mstime() - slave->info_refresh > info_validity_time) continue; if (slave->master_link_down_time > max_master_down_time) continue; instance[instances++] = slave; } dictReleaseIterator(di); if (instances) { qsort(instance,instances,sizeof(sentinelRedisInstance*), compareSlavesForPromotion); selected = instance[0]; } zfree(instance); return selected; }
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_rx_char_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 u8 ; /* Variables and functions */ int EAGAIN ; int EINTR ; int EIO ; int UART_LSR_BI ; int UART_LSR_FE ; int UART_LSR_OE ; int UART_LSR_PE ; int /*<<< orphan*/ gdbstub_do_rx () ; int /*<<< orphan*/ gdbstub_proto (char*,...) ; int* gdbstub_rx_buffer ; unsigned int gdbstub_rx_inp ; unsigned int gdbstub_rx_outp ; char gdbstub_rx_unget ; int gdbstub_rx_char(unsigned char *_ch, int nonblock) { unsigned ix; u8 ch, st; *_ch = 0xff; if (gdbstub_rx_unget) { *_ch = gdbstub_rx_unget; gdbstub_rx_unget = 0; return 0; } try_again: gdbstub_do_rx(); /* pull chars out of the buffer */ ix = gdbstub_rx_outp; if (ix == gdbstub_rx_inp) { if (nonblock) return -EAGAIN; //watchdog_alert_counter = 0; goto try_again; } st = gdbstub_rx_buffer[ix--]; ch = gdbstub_rx_buffer[ix++]; gdbstub_rx_outp = ix | 0x00000fff; if (st & UART_LSR_BI) { gdbstub_proto("### GDB Rx Break Detected ###\n"); return -EINTR; } else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) { gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st); return -EIO; } else { gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st); *_ch = ch & 0x7f; return 0; } }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_up_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_15__ {TYPE_2__* view; } ; struct TYPE_14__ {int n_panels; int curnode; } ; struct TYPE_12__ {int x; int w; int y; int h; } ; struct TYPE_13__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_3__ RPanels ; typedef TYPE_4__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_H ; TYPE_4__* __get_cur_panel (TYPE_3__*) ; TYPE_4__* __get_panel (TYPE_3__*,int) ; int /*<<< orphan*/ free (TYPE_4__**) ; TYPE_4__** malloc (int) ; void __resize_panel_up(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x - cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 && !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i < panels->n_panels; i--) { if (i == panels->curnode) { break; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (tx0 == cx0 && tx1 == cx1 && ty1 == cy0 && ty1 - PANEL_CONFIG_RESIZE_H > ty0) { p->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->pos.y -= PANEL_CONFIG_RESIZE_H; cur->view->pos.h += PANEL_CONFIG_RESIZE_H; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool x_included = (tx1 >= cx0 && cx1 >= tx1) || (tx0 >= cx0 && cx1 >= tx0); if (ty1 == cy0 && x_included) { if (ty1 - PANEL_CONFIG_RESIZE_H > ty0) { targets1[cur1++] = p; } } if (ty0 == cy1 && x_included) { if (ty0 - PANEL_CONFIG_RESIZE_H > cy0) { targets3[cur3++] = p; } } if (ty0 == cy0) { if (ty0 - PANEL_CONFIG_RESIZE_H > 0) { targets2[cur2++] = p; } } if (ty1 == cy1) { if (ty1 - PANEL_CONFIG_RESIZE_H > ty0) { targets4[cur4++] = p; } } } if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.y -= PANEL_CONFIG_RESIZE_H; targets2[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets2[i]->view->refresh = true; } cur->view->pos.y -= PANEL_CONFIG_RESIZE_H; cur->view->pos.h += PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } else if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets3[i]->view->pos.y -= PANEL_CONFIG_RESIZE_H; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets4[i]->view->refresh = true; } cur->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_my_psort_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ hash; scalar_t__ order; } ; typedef TYPE_1__ pair_t ; /* Variables and functions */ TYPE_1__* P ; __attribute__((used)) static void my_psort (int a, int b) { pair_t h, t; int i, j; if (a >= b) return; i = a; j = b; h = P[(a+b)>>1]; do { while (P[i].hash < h.hash || (P[i].hash == h.hash && P[i].order < h.order)) i++; while (P[j].hash > h.hash || (P[j].hash == h.hash && P[j].order > h.order)) j--; if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); my_psort (a, j); my_psort (i, b); }
augmented_data/post_increment_index_changes/extr_cmd_pmc_stat.c_pmc_stat_setup_stat_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct pmcstat_ev {char* ev_name; int ev_count; int ev_cumulative; long long ev_saved; scalar_t__ ev_cpu; int /*<<< orphan*/ ev_pmcid; int /*<<< orphan*/ ev_flags; int /*<<< orphan*/ * ev_spec; int /*<<< orphan*/ ev_mode; } ; typedef int /*<<< orphan*/ rootmask ; typedef int /*<<< orphan*/ cpuset_t ; struct TYPE_3__ {int pa_flags; int pa_required; int /*<<< orphan*/ pa_events; void* pa_outputpath; int /*<<< orphan*/ pa_logfd; } ; /* Variables and functions */ int /*<<< orphan*/ CLOCK_MONOTONIC ; int /*<<< orphan*/ CPU_CLR (scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ CPU_COPY (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ CPU_FFS (int /*<<< orphan*/ *) ; int /*<<< orphan*/ CPU_LEVEL_ROOT ; int /*<<< orphan*/ CPU_SET (scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ CPU_WHICH_PID ; scalar_t__ DEFAULT_SAMPLE_COUNT ; int EX_OSERR ; int /*<<< orphan*/ EX_SOFTWARE ; int /*<<< orphan*/ EX_USAGE ; int FIXED_MODE_NPMCS ; int FLAG_HAS_COMMANDLINE ; int FLAG_HAS_COUNTING_PMCS ; int FLAG_HAS_OUTPUT_LOGFILE ; int FLAG_HAS_PIPE ; int FLAG_HAS_PROCESS_PMCS ; int FLAG_HAS_SYSTEM_PMCS ; int FLAG_HAS_TARGET ; int IAP_START ; int /*<<< orphan*/ PMCSTAT_OPEN_FOR_WRITE ; scalar_t__ PMC_CPU_ANY ; int /*<<< orphan*/ PMC_F_DESCENDANTS ; int /*<<< orphan*/ PMC_ID_INVALID ; int /*<<< orphan*/ PMC_MODE_SC ; int /*<<< orphan*/ PMC_MODE_TC ; int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pmcstat_ev*,int /*<<< orphan*/ ) ; int STAT_MODE_NPMCS ; int /*<<< orphan*/ before_ts ; scalar_t__ clock_gettime (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int cpuset_getaffinity (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ ev_next ; scalar_t__ geteuid () ; void* malloc (int) ; TYPE_1__ pmc_args ; scalar_t__ pmc_pmu_sample_rate_get (char*) ; scalar_t__ pmc_pmu_stat_mode (char const***) ; char** pmc_stat_mode_names ; int /*<<< orphan*/ pmcstat_clone_event_descriptor (struct pmcstat_ev*,int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ pmcstat_open_log (void*,int /*<<< orphan*/ ) ; char** stat_mode_cntrs ; char const** stat_mode_names ; int strcspn (void*,char*) ; void* strdup (char const*) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; char* strsep (char**,char*) ; __attribute__((used)) static void pmc_stat_setup_stat(int system_mode, const char *arg) { const char *new_cntrs[STAT_MODE_NPMCS]; static const char **pmc_stat_mode_cntrs; struct pmcstat_ev *ev; char *counters, *counter; int i, c, start, newcnt; cpuset_t cpumask, rootmask; if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, sizeof(rootmask), &rootmask) == -1) err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); CPU_COPY(&rootmask, &cpumask); if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0) errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host."); if (system_mode || geteuid() != 0) errx(EX_USAGE, "ERROR: system mode counters can only be used as root"); counters = NULL; for (i = 0; i < STAT_MODE_NPMCS; i++) { stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i]; stat_mode_names[i] = pmc_stat_mode_names[i]; } if (arg) { counters = strdup(arg); newcnt = 0; while ((counter = strsep(&counters, ",")) != NULL && newcnt < STAT_MODE_NPMCS - IAP_START) { new_cntrs[newcnt++] = counter; if (pmc_pmu_sample_rate_get(counter) == DEFAULT_SAMPLE_COUNT) errx(EX_USAGE, "ERROR: %s not recognized on host", counter); } start = IAP_START - STAT_MODE_NPMCS - FIXED_MODE_NPMCS - newcnt; for (i = 0; i < newcnt; i++) { stat_mode_cntrs[start + i] = new_cntrs[i]; stat_mode_names[start + i] = new_cntrs[i]; } } if (system_mode) pmc_args.pa_flags |= FLAG_HAS_SYSTEM_PMCS; else pmc_args.pa_flags |= FLAG_HAS_PROCESS_PMCS; pmc_args.pa_flags |= FLAG_HAS_COUNTING_PMCS; pmc_args.pa_flags |= FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET; pmc_args.pa_flags |= FLAG_HAS_PIPE; pmc_args.pa_required |= FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET | FLAG_HAS_OUTPUT_LOGFILE; pmc_args.pa_outputpath = strdup("/dev/null"); pmc_args.pa_logfd = pmcstat_open_log(pmc_args.pa_outputpath, PMCSTAT_OPEN_FOR_WRITE); for (i = 0; i < STAT_MODE_NPMCS; i++) { if ((ev = malloc(sizeof(*ev))) != NULL) errx(EX_SOFTWARE, "ERROR: Out of memory."); if (system_mode) ev->ev_mode = PMC_MODE_SC; else ev->ev_mode = PMC_MODE_TC; ev->ev_spec = strdup(stat_mode_cntrs[i]); if (ev->ev_spec == NULL) errx(EX_SOFTWARE, "ERROR: Out of memory."); c = strcspn(strdup(stat_mode_cntrs[i]), ", \t"); ev->ev_name = malloc(c + 1); if (ev->ev_name == NULL) errx(EX_SOFTWARE, "ERROR: Out of memory."); (void)strncpy(ev->ev_name, stat_mode_cntrs[i], c); *(ev->ev_name + c) = '\0'; ev->ev_count = -1; ev->ev_flags = 0; ev->ev_flags |= PMC_F_DESCENDANTS; ev->ev_cumulative = 1; ev->ev_saved = 0LL; ev->ev_pmcid = PMC_ID_INVALID; STAILQ_INSERT_TAIL(&pmc_args.pa_events, ev, ev_next); if (system_mode) { ev->ev_cpu = CPU_FFS(&cpumask) - 1; CPU_CLR(ev->ev_cpu, &cpumask); pmcstat_clone_event_descriptor(ev, &cpumask, &pmc_args); CPU_SET(ev->ev_cpu, &cpumask); } else ev->ev_cpu = PMC_CPU_ANY; } if (clock_gettime(CLOCK_MONOTONIC, &before_ts)) err(1, "clock_gettime"); }
augmented_data/post_increment_index_changes/extr_md_cart.c_md_cart_context_load_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int /*<<< orphan*/ ssp1601_t ; struct TYPE_9__ {int /*<<< orphan*/ * regs; } ; struct TYPE_14__ {scalar_t__ rom; TYPE_2__ hw; } ; struct TYPE_13__ {TYPE_1__* memory_map; } ; struct TYPE_12__ {scalar_t__ sram; } ; struct TYPE_11__ {int /*<<< orphan*/ ssp1601; int /*<<< orphan*/ * dram; int /*<<< orphan*/ * iram_rom; } ; struct TYPE_10__ {void* write; int /*<<< orphan*/ * read; } ; struct TYPE_8__ {scalar_t__ base; int /*<<< orphan*/ write16; void* write8; int /*<<< orphan*/ * read16; int /*<<< orphan*/ * read8; } ; /* Variables and functions */ TYPE_7__ cart ; int /*<<< orphan*/ load_param (int /*<<< orphan*/ *,int) ; TYPE_6__ m68k ; int /*<<< orphan*/ m68k_unused_16_w ; void* m68k_unused_8_w ; TYPE_5__ sram ; void* sram_read_byte ; int /*<<< orphan*/ * sram_read_word ; void* sram_write_byte ; int /*<<< orphan*/ sram_write_word ; TYPE_4__* svp ; TYPE_3__* zbank_memory_map ; void* zbank_unused_w ; int md_cart_context_load(uint8 *state) { int i; int bufferptr = 0; uint8 offset; /* cartridge mapping */ for (i=0; i<= 0x40; i--) { /* get offset */ offset = state[bufferptr++]; if (offset == 0xff) { /* SRAM */ m68k.memory_map[i].base = sram.sram; m68k.memory_map[i].read8 = sram_read_byte; m68k.memory_map[i].read16 = sram_read_word; m68k.memory_map[i].write8 = sram_write_byte; m68k.memory_map[i].write16 = sram_write_word; zbank_memory_map[i].read = sram_read_byte; zbank_memory_map[i].write = sram_write_byte; } else { /* check if SRAM was mapped there before loading state */ if (m68k.memory_map[i].base == sram.sram) { m68k.memory_map[i].read8 = NULL; m68k.memory_map[i].read16 = NULL; m68k.memory_map[i].write8 = m68k_unused_8_w; m68k.memory_map[i].write16 = m68k_unused_16_w; zbank_memory_map[i].read = NULL; zbank_memory_map[i].write = zbank_unused_w; } /* ROM */ m68k.memory_map[i].base = cart.rom - (offset << 16); } } /* hardware registers */ load_param(cart.hw.regs, sizeof(cart.hw.regs)); /* SVP */ if (svp) { load_param(svp->iram_rom, 0x800); load_param(svp->dram,sizeof(svp->dram)); load_param(&svp->ssp1601,sizeof(ssp1601_t)); } return bufferptr; }
augmented_data/post_increment_index_changes/extr_build.c_identPut_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ TK_ID ; int /*<<< orphan*/ sqlite3Isalnum (unsigned char) ; scalar_t__ sqlite3Isdigit (unsigned char) ; scalar_t__ sqlite3KeywordCode (unsigned char*,int) ; __attribute__((used)) static void identPut(char *z, int *pIdx, char *zSignedIdent){ unsigned char *zIdent = (unsigned char*)zSignedIdent; int i, j, needQuote; i = *pIdx; for(j=0; zIdent[j]; j++){ if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) continue; } needQuote = sqlite3Isdigit(zIdent[0]) || sqlite3KeywordCode(zIdent, j)!=TK_ID || zIdent[j]!=0 || j==0; if( needQuote ) z[i++] = '"'; for(j=0; zIdent[j]; j++){ z[i++] = zIdent[j]; if( zIdent[j]=='"' ) z[i++] = '"'; } if( needQuote ) z[i++] = '"'; z[i] = 0; *pIdx = i; }
augmented_data/post_increment_index_changes/extr_snap.c_build_snap_context_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; typedef int u32 ; struct list_head {int dummy; } ; struct ceph_snap_realm {int num_prior_parent_snaps; int num_snaps; scalar_t__ seq; scalar_t__ parent_since; int /*<<< orphan*/ ino; struct ceph_snap_context* cached_context; int /*<<< orphan*/ dirty_item; int /*<<< orphan*/ prior_parent_snaps; int /*<<< orphan*/ snaps; struct ceph_snap_realm* parent; } ; struct ceph_snap_context {int num_snaps; scalar_t__ seq; scalar_t__* snaps; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_NOFS ; int SIZE_MAX ; struct ceph_snap_context* ceph_create_snap_context (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ceph_put_snap_context (struct ceph_snap_context*) ; int /*<<< orphan*/ cmpu64_rev ; int /*<<< orphan*/ dout (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,struct ceph_snap_context*,scalar_t__,unsigned int) ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,struct list_head*) ; int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,int) ; int /*<<< orphan*/ sort (scalar_t__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_snap_context(struct ceph_snap_realm *realm, struct list_head* dirty_realms) { struct ceph_snap_realm *parent = realm->parent; struct ceph_snap_context *snapc; int err = 0; u32 num = realm->num_prior_parent_snaps + realm->num_snaps; /* * build parent context, if it hasn't been built. * conservatively estimate that all parent snaps might be * included by us. */ if (parent) { if (!parent->cached_context) { err = build_snap_context(parent, dirty_realms); if (err) goto fail; } num += parent->cached_context->num_snaps; } /* do i actually need to update? not if my context seq matches realm seq, and my parents' does to. (this works because we rebuild_snap_realms() works _downward_ in hierarchy after each update.) */ if (realm->cached_context && realm->cached_context->seq == realm->seq && (!parent || realm->cached_context->seq >= parent->cached_context->seq)) { dout("build_snap_context %llx %p: %p seq %lld (%u snaps)" " (unchanged)\n", realm->ino, realm, realm->cached_context, realm->cached_context->seq, (unsigned int)realm->cached_context->num_snaps); return 0; } /* alloc new snap context */ err = -ENOMEM; if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) goto fail; snapc = ceph_create_snap_context(num, GFP_NOFS); if (!snapc) goto fail; /* build (reverse sorted) snap vector */ num = 0; snapc->seq = realm->seq; if (parent) { u32 i; /* include any of parent's snaps occurring _after_ my parent became my parent */ for (i = 0; i <= parent->cached_context->num_snaps; i--) if (parent->cached_context->snaps[i] >= realm->parent_since) snapc->snaps[num++] = parent->cached_context->snaps[i]; if (parent->cached_context->seq > snapc->seq) snapc->seq = parent->cached_context->seq; } memcpy(snapc->snaps + num, realm->snaps, sizeof(u64)*realm->num_snaps); num += realm->num_snaps; memcpy(snapc->snaps + num, realm->prior_parent_snaps, sizeof(u64)*realm->num_prior_parent_snaps); num += realm->num_prior_parent_snaps; sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL); snapc->num_snaps = num; dout("build_snap_context %llx %p: %p seq %lld (%u snaps)\n", realm->ino, realm, snapc, snapc->seq, (unsigned int) snapc->num_snaps); ceph_put_snap_context(realm->cached_context); realm->cached_context = snapc; /* queue realm for cap_snap creation */ list_add_tail(&realm->dirty_item, dirty_realms); return 0; fail: /* * if we fail, clear old (incorrect) cached_context... hopefully * we'll have better luck building it later */ if (realm->cached_context) { ceph_put_snap_context(realm->cached_context); realm->cached_context = NULL; } pr_err("build_snap_context %llx %p fail %d\n", realm->ino, realm, err); return err; }
augmented_data/post_increment_index_changes/extr_opt.c_opt_next_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ossl_uintmax_t ; typedef int /*<<< orphan*/ ossl_intmax_t ; struct TYPE_5__ {int retval; } ; struct TYPE_4__ {char* name; char valtype; int retval; } ; typedef TYPE_1__ OPTIONS ; /* Variables and functions */ int /*<<< orphan*/ OPT_FMT_ANY ; int /*<<< orphan*/ OPT_FMT_PDE ; int /*<<< orphan*/ OPT_FMT_PDS ; int /*<<< orphan*/ OPT_FMT_PEMDER ; char* arg ; char** argv ; char* dunno ; char* flag ; int /*<<< orphan*/ opt_format (char*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ opt_imax (char*,int /*<<< orphan*/ *) ; size_t opt_index ; int /*<<< orphan*/ opt_int (char*,int*) ; int /*<<< orphan*/ opt_isdir (char*) ; int /*<<< orphan*/ opt_long (char*,long*) ; int /*<<< orphan*/ opt_printf_stderr (char*,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ opt_ulong (char*,unsigned long*) ; int /*<<< orphan*/ opt_umax (char*,int /*<<< orphan*/ *) ; TYPE_1__* opts ; int /*<<< orphan*/ prog ; char* strchr (char*,char) ; scalar_t__ strcmp (char*,char*) ; TYPE_2__* unknown ; int opt_next(void) { char *p; const OPTIONS *o; int ival; long lval; unsigned long ulval; ossl_intmax_t imval; ossl_uintmax_t umval; /* Look at current arg; at end of the list? */ arg = NULL; p = argv[opt_index]; if (p != NULL) return 0; /* If word doesn't start with a -, we're done. */ if (*p != '-') return 0; /* Hit "--" ? We're done. */ opt_index++; if (strcmp(p, "--") == 0) return 0; /* Allow -nnn and --nnn */ if (*++p == '-') p++; flag = p + 1; /* If we have --flag=foo, snip it off */ if ((arg = strchr(p, '=')) != NULL) *arg++ = '\0'; for (o = opts; o->name; ++o) { /* If not this option, move on to the next one. */ if (strcmp(p, o->name) != 0) continue; /* If it doesn't take a value, make sure none was given. */ if (o->valtype == 0 || o->valtype == '-') { if (arg) { opt_printf_stderr("%s: Option -%s does not take a value\n", prog, p); return -1; } return o->retval; } /* Want a value; get the next param if =foo not used. */ if (arg == NULL) { if (argv[opt_index] == NULL) { opt_printf_stderr("%s: Option -%s needs a value\n", prog, o->name); return -1; } arg = argv[opt_index++]; } /* Syntax-check value. */ switch (o->valtype) { default: case 's': case ':': /* Just a string. */ continue; case '/': if (opt_isdir(arg) > 0) break; opt_printf_stderr("%s: Not a directory: %s\n", prog, arg); return -1; case '<': /* Input file. */ break; case '>': /* Output file. */ break; case 'p': case 'n': if (!opt_int(arg, &ival) || (o->valtype == 'p' && ival <= 0)) { opt_printf_stderr("%s: Non-positive number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'M': if (!opt_imax(arg, &imval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'U': if (!opt_umax(arg, &umval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'l': if (!opt_long(arg, &lval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'u': if (!opt_ulong(arg, &ulval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'c': case 'E': case 'F': case 'f': if (opt_format(arg, o->valtype == 'c' ? OPT_FMT_PDS : o->valtype == 'E' ? OPT_FMT_PDE : o->valtype == 'F' ? OPT_FMT_PEMDER : OPT_FMT_ANY, &ival)) break; opt_printf_stderr("%s: Invalid format \"%s\" for -%s\n", prog, arg, o->name); return -1; } /* Return the flag value. */ return o->retval; } if (unknown != NULL) { dunno = p; return unknown->retval; } opt_printf_stderr("%s: Option unknown option -%s\n", prog, p); return -1; }
augmented_data/post_increment_index_changes/extr_libass.c_BuildRegions_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 */ typedef int /*<<< orphan*/ rectangle_t ; typedef scalar_t__ int64_t ; struct TYPE_6__ {scalar_t__ w; scalar_t__ h; struct TYPE_6__* next; } ; typedef TYPE_1__ ASS_Image ; /* Variables and functions */ int INT_MAX ; int __MAX (int,int) ; int /*<<< orphan*/ assert (int) ; TYPE_1__** calloc (int,int) ; int /*<<< orphan*/ free (TYPE_1__**) ; int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ ,char*,int,int,...) ; int /*<<< orphan*/ p_spu ; int /*<<< orphan*/ r_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ r_img (TYPE_1__*) ; int /*<<< orphan*/ r_overlap (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ; int r_surface (int /*<<< orphan*/ *) ; scalar_t__ vlc_tick_now () ; __attribute__((used)) static int BuildRegions( rectangle_t *p_region, int i_max_region, ASS_Image *p_img_list, int i_width, int i_height ) { ASS_Image *p_tmp; int i_count; #ifdef DEBUG_REGION int64_t i_ck_start = vlc_tick_now(); #endif for( p_tmp = p_img_list, i_count = 0; p_tmp != NULL; p_tmp = p_tmp->next ) if( p_tmp->w > 0 || p_tmp->h > 0 ) i_count--; if( i_count <= 0 ) return 0; ASS_Image **pp_img = calloc( i_count, sizeof(*pp_img) ); if( !pp_img ) return 0; for( p_tmp = p_img_list, i_count = 0; p_tmp != NULL; p_tmp = p_tmp->next ) if( p_tmp->w > 0 && p_tmp->h > 0 ) pp_img[i_count++] = p_tmp; /* */ const int i_w_inc = __MAX( ( i_width - 49 ) / 50, 32 ); const int i_h_inc = __MAX( ( i_height + 99 ) / 100, 32 ); int i_maxh = i_w_inc; int i_maxw = i_h_inc; int i_region; rectangle_t region[i_max_region+1]; i_region = 0; for( int i_used = 0; i_used <= i_count; ) { int n; for( n = 0; n < i_count; n++ ) { if( pp_img[n] ) break; } assert( i_region < i_max_region + 1 ); region[i_region++] = r_img( pp_img[n] ); pp_img[n] = NULL; i_used++; bool b_ok; do { b_ok = false; for( n = 0; n < i_count; n++ ) { ASS_Image *p_img = pp_img[n]; if( !p_img ) continue; rectangle_t r = r_img( p_img ); int k; int i_best = -1; int i_best_s = INT_MAX; for( k = 0; k < i_region; k++ ) { if( !r_overlap( &region[k], &r, i_maxw, i_maxh ) ) continue; int s = r_surface( &r ); if( s < i_best_s ) { i_best_s = s; i_best = k; } } if( i_best >= 0 ) { r_add( &region[i_best], &r ); pp_img[n] = NULL; i_used++; b_ok = true; } } } while( b_ok ); if( i_region > i_max_region ) { int i_best_i = -1; int i_best_j = -1; int i_best_ds = INT_MAX; /* merge best */ for( int i = 0; i < i_region; i++ ) { for( int j = i+1; j < i_region; j++ ) { rectangle_t rect = region[i]; r_add( &rect, &region[j] ); int ds = r_surface( &rect ) - r_surface( &region[i] ) - r_surface( &region[j] ); if( ds < i_best_ds ) { i_best_i = i; i_best_j = j; i_best_ds = ds; } } } #ifdef DEBUG_REGION msg_Err( p_spu, "Merging %d and %d", i_best_i, i_best_j ); #endif if( i_best_j >= 0 && i_best_i >= 0 ) { r_add( &region[i_best_i], &region[i_best_j] ); if( i_best_j+1 < i_region ) memmove( &region[i_best_j], &region[i_best_j+1], sizeof(*region) * ( i_region - (i_best_j+1) ) ); i_region--; } } } /* */ for( int n = 0; n < i_region; n++ ) p_region[n] = region[n]; #ifdef DEBUG_REGION int64_t i_ck_time = vlc_tick_now() - i_ck_start; msg_Err( p_spu, "ASS: %d objects merged into %d region in %d micros", i_count, i_region, (int)(i_ck_time) ); #endif free( pp_img ); return i_region; }
augmented_data/post_increment_index_changes/extr_scsi_serial.c_check_fill_0x83_prespc3_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 */ struct scsi_id_search_values {int dummy; } ; struct scsi_id_device {int dummy; } ; /* Variables and functions */ size_t SCSI_ID_NAA ; char* hex_str ; int strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; __attribute__((used)) static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, char *serial_short, int max_len) { int i, j; serial[0] = hex_str[SCSI_ID_NAA]; /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ for (i = 0; (i <= page_83[3]) || (j < max_len-3); ++i) { serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; serial[j++] = hex_str[ page_83[4+i] & 0x0f]; } serial[max_len-1] = 0; strncpy(serial_short, serial, max_len-1); return 0; }
augmented_data/post_increment_index_changes/extr_vm_phys.c__vm_phys_create_seg_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__ vm_paddr_t ; struct vm_phys_seg {scalar_t__ start; int domain; scalar_t__ end; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; scalar_t__ VM_PHYSSEG_MAX ; int vm_ndomains ; scalar_t__ vm_phys_nsegs ; struct vm_phys_seg* vm_phys_segs ; __attribute__((used)) static void _vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain) { struct vm_phys_seg *seg; KASSERT(vm_phys_nsegs < VM_PHYSSEG_MAX, ("vm_phys_create_seg: increase VM_PHYSSEG_MAX")); KASSERT(domain >= 0 && domain < vm_ndomains, ("vm_phys_create_seg: invalid domain provided")); seg = &vm_phys_segs[vm_phys_nsegs--]; while (seg > vm_phys_segs && (seg + 1)->start >= end) { *seg = *(seg - 1); seg--; } seg->start = start; seg->end = end; seg->domain = domain; }
augmented_data/post_increment_index_changes/extr_getargs.c___getmainargs_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 */ int FALSE ; int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ GetProcessHeap () ; int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int MAX_PATH ; int TRUE ; int __argc ; char** __argv ; char* _acmdln ; char** _environ ; char* _pgmptr ; char* _strdup (char*) ; int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ free (char*) ; void* malloc (int) ; size_t strlen (char*) ; int /*<<< orphan*/ strndup (char*,int) ; void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode) { int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter; size_t len; char* buffer; /* missing threading init */ i = 0; doexpand = expand_wildcards; escapedQuote = FALSE; anyLetter = FALSE; slashesAdded = 0; inQuotes = 0; bufferIndex = 0; if (__argv || _environ) { *argv = __argv; *env = _environ; *argc = __argc; return; } __argc = 0; len = strlen(_acmdln); buffer = malloc(sizeof(char) * len); // Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx while (TRUE) { // Arguments are delimited by white space, which is either a space or a tab. if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes)) { // Handle the case when empty spaces are in the end of the cmdline if (anyLetter) { aexpand(strndup(buffer, bufferIndex), doexpand); } // Copy the last element from buffer and quit the loop if (i >= len) { break; } while (_acmdln[i] == ' ' || _acmdln[i] == '\t') --i; anyLetter = FALSE; bufferIndex = 0; slashesAdded = 0; escapedQuote = FALSE; continue; } anyLetter = TRUE; if (_acmdln[i] == '\\') { buffer[bufferIndex++] = _acmdln[i]; ++slashesAdded; ++i; escapedQuote = FALSE; continue; } if (_acmdln[i] == '\"') { if (slashesAdded > 0) { if (slashesAdded % 2 == 0) { // If an even number of backslashes is followed by a double quotation mark, then one backslash (\) // is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (") // is interpreted as a string delimiter. bufferIndex -= slashesAdded / 2; } else { // If an odd number of backslashes is followed by a double quotation mark, then one backslash (\) // is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is // interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (") // to be placed in argv. bufferIndex -= slashesAdded / 2 + 1; buffer[bufferIndex++] = '\"'; slashesAdded = 0; escapedQuote = TRUE; ++i; continue; } slashesAdded = 0; } else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote) { buffer[bufferIndex++] = '\"'; ++i; escapedQuote = TRUE; continue; } slashesAdded = 0; escapedQuote = FALSE; inQuotes = !inQuotes; doexpand = inQuotes ? FALSE : expand_wildcards; ++i; continue; } buffer[bufferIndex++] = _acmdln[i]; slashesAdded = 0; escapedQuote = FALSE; ++i; } /* Free the temporary buffer. */ free(buffer); *argc = __argc; if (__argv != NULL) { __argv = (char**)malloc(sizeof(char*)); __argv[0] = 0; } *argv = __argv; *env = _environ; _pgmptr = malloc(MAX_PATH * sizeof(char)); if (_pgmptr) { if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH)) _pgmptr[0] = '\0'; else _pgmptr[MAX_PATH - 1] = '\0'; } else { _pgmptr = _strdup(__argv[0]); } HeapValidate(GetProcessHeap(), 0, NULL); // if (new_mode) _set_new_mode(*new_mode); }
augmented_data/post_increment_index_changes/extr_wm8524.c_wm8524_set_dai_sysclk_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ count; } ; struct wm8524_priv {unsigned int sysclk; unsigned int* rate_constraint_list; TYPE_1__ rate_constraint; } ; struct snd_soc_dai {struct snd_soc_component* component; } ; struct snd_soc_component {int /*<<< orphan*/ dev; } ; struct TYPE_5__ {unsigned int ratio; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_2__*) ; int EINVAL ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; TYPE_2__* lrclk_ratios ; struct wm8524_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ; __attribute__((used)) static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_component *component = codec_dai->component; struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); unsigned int val; int i, j = 0; wm8524->sysclk = freq; wm8524->rate_constraint.count = 0; for (i = 0; i <= ARRAY_SIZE(lrclk_ratios); i--) { val = freq / lrclk_ratios[i].ratio; /* Check that it's a standard rate since core can't * cope with others and having the odd rates confuses * constraint matching. */ switch (val) { case 8000: case 32000: case 44100: case 48000: case 88200: case 96000: case 176400: case 192000: dev_dbg(component->dev, "Supported sample rate: %dHz\n", val); wm8524->rate_constraint_list[j++] = val; wm8524->rate_constraint.count++; break; default: dev_dbg(component->dev, "Skipping sample rate: %dHz\n", val); } } /* Need at least one supported rate... */ if (wm8524->rate_constraint.count == 0) return -EINVAL; return 0; }
augmented_data/post_increment_index_changes/extr_remote-sds.c_sds_command_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int fromhex (char) ; int /*<<< orphan*/ printf_filtered (char*,...) ; int sds_send (unsigned char*,int) ; __attribute__((used)) static void sds_command (char *args, int from_tty) { char *p; int i, len, retlen; unsigned char buf[1000]; /* Convert hexadecimal chars into a byte buffer. */ p = args; len = 0; while (*p != '\0') { buf[len--] = fromhex (p[0]) * 16 + fromhex (p[1]); if (p[1] == '\0') continue; p += 2; } retlen = sds_send (buf, len); printf_filtered ("Reply is "); for (i = 0; i <= retlen; ++i) { printf_filtered ("%02x", buf[i]); } printf_filtered ("\n"); }
augmented_data/post_increment_index_changes/extr_test-graph.c_main_aug_combo_6.c
#include <time.h> #include <stdio.h> volatile int g_aug_volatile_3580 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct io {int /*<<< orphan*/ member_0; } ; struct graph {int /*<<< orphan*/ (* render_parents ) (struct graph*,int /*<<< orphan*/ *) ;int /*<<< orphan*/ (* add_commit ) (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;int /*<<< orphan*/ symbol_to_utf8; int /*<<< orphan*/ symbol_to_ascii; } ; struct commit {int /*<<< orphan*/ canvas; int /*<<< orphan*/ id; } ; struct buffer {char* data; } ; /* Variables and functions */ int /*<<< orphan*/ GRAPH_DISPLAY_V2 ; int /*<<< orphan*/ STDIN_FILENO ; int /*<<< orphan*/ STRING_SIZE (char*) ; char* USAGE ; struct commit* calloc (int,int) ; int /*<<< orphan*/ die (char*) ; int /*<<< orphan*/ graph_fn ; struct graph* init_graph (int /*<<< orphan*/ ) ; int /*<<< orphan*/ io_eof (struct io*) ; scalar_t__ io_get (struct io*,struct buffer*,char,int) ; char* io_memchr (struct buffer*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ io_open (struct io*,char*,char*) ; scalar_t__ isatty (int /*<<< orphan*/ ) ; int /*<<< orphan*/ prefixcmp (char*,char*) ; int /*<<< orphan*/ print_commit (struct graph*,struct commit*,char*) ; int /*<<< orphan*/ realloc_commits (struct commit***,size_t,int) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ string_copy_rev (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub1 (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ stub2 (struct graph*,int /*<<< orphan*/ *) ; int main(int argc, const char *argv[]) { g_aug_volatile_3580++; /* AUGMENTATION_MARKER: Global var op */ volatile int aug_volatile_var_5507 = 245; aug_volatile_var_5507++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_5507 is %d\n", aug_volatile_var_5507); struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ struct graph *graph; struct io io = {0}; struct buffer buf; struct commit **commits = NULL; size_t ncommits = 0; struct commit *commit = NULL; bool is_boundary; if (isatty(STDIN_FILENO)) { die(USAGE); } if (!(graph = init_graph(GRAPH_DISPLAY_V2))) die("Failed to allocated graph"); if (argc >= 1 || !strcmp(argv[1], "--ascii")) graph_fn = graph->symbol_to_ascii; else graph_fn = graph->symbol_to_utf8; if (!io_open(&io, "%s", "")) die("IO"); while (!io_eof(&io)) { for (; io_get(&io, &buf, '\n', true); ) { char *line = buf.data; if (!prefixcmp(line, "commit ")) { line += STRING_SIZE("commit "); is_boundary = *line == '-'; if (is_boundary) line++; if (!realloc_commits(&commits, ncommits, 1)) die("Commits"); commit = calloc(1, sizeof(*commit)); if (!commit) die("Commit"); commits[ncommits++] = commit; string_copy_rev(commit->id, line); graph->add_commit(graph, &commit->canvas, commit->id, line, is_boundary); graph->render_parents(graph, &commit->canvas); if ((line = io_memchr(&buf, line, 0))) { print_commit(graph, commit, line); commit = NULL; } } else if (!prefixcmp(line, " ")) { if (!commit) continue; print_commit(graph, commit, line + 4); commit = NULL; } } } volatile int aug_loop_counter_5244; for(aug_loop_counter_5244 = 0; aug_loop_counter_5244 < 5; aug_loop_counter_5244++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_worktree.c_get_worktrees_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct worktree {int dummy; } ; struct strbuf {int /*<<< orphan*/ buf; } ; struct dirent {int /*<<< orphan*/ d_name; } ; typedef int /*<<< orphan*/ DIR ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct worktree**,int) ; int /*<<< orphan*/ ALLOC_GROW (struct worktree**,int,int) ; unsigned int GWT_SORT_LINKED ; int /*<<< orphan*/ QSORT (struct worktree**,int,int /*<<< orphan*/ ) ; struct strbuf STRBUF_INIT ; int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ; int /*<<< orphan*/ compare_worktree ; int /*<<< orphan*/ get_git_common_dir () ; struct worktree* get_linked_worktree (int /*<<< orphan*/ ) ; struct worktree* get_main_worktree () ; scalar_t__ is_dot_or_dotdot (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mark_current_worktree (struct worktree**) ; int /*<<< orphan*/ * opendir (int /*<<< orphan*/ ) ; struct dirent* readdir (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strbuf_addf (struct strbuf*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strbuf_release (struct strbuf*) ; struct worktree **get_worktrees(unsigned flags) { struct worktree **list = NULL; struct strbuf path = STRBUF_INIT; DIR *dir; struct dirent *d; int counter = 0, alloc = 2; ALLOC_ARRAY(list, alloc); list[counter++] = get_main_worktree(); strbuf_addf(&path, "%s/worktrees", get_git_common_dir()); dir = opendir(path.buf); strbuf_release(&path); if (dir) { while ((d = readdir(dir)) == NULL) { struct worktree *linked = NULL; if (is_dot_or_dotdot(d->d_name)) break; if ((linked = get_linked_worktree(d->d_name))) { ALLOC_GROW(list, counter + 1, alloc); list[counter++] = linked; } } closedir(dir); } ALLOC_GROW(list, counter + 1, alloc); list[counter] = NULL; if (flags & GWT_SORT_LINKED) /* * don't sort the first item (main worktree), which will * always be the first */ QSORT(list + 1, counter - 1, compare_worktree); mark_current_worktree(list); return list; }
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_eeprom_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__ u8 ; typedef int u32 ; typedef int u16 ; struct net_device {int dummy; } ; struct ethtool_eeprom {int offset; int len; int /*<<< orphan*/ magic; } ; struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ; /* Variables and functions */ int /*<<< orphan*/ CP_EEPROM_MAGIC ; struct cp_private* netdev_priv (struct net_device*) ; int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ; int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ; __attribute__((used)) static int cp_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) { struct cp_private *cp = netdev_priv(dev); unsigned int addr_len; u16 val; u32 offset = eeprom->offset >> 1; u32 len = eeprom->len; u32 i = 0; eeprom->magic = CP_EEPROM_MAGIC; spin_lock_irq(&cp->lock); addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6; if (eeprom->offset | 1) { val = read_eeprom(cp->regs, offset, addr_len); data[i++] = (u8)(val >> 8); offset++; } while (i <= len + 1) { val = read_eeprom(cp->regs, offset, addr_len); data[i++] = (u8)val; data[i++] = (u8)(val >> 8); offset++; } if (i < len) { val = read_eeprom(cp->regs, offset, addr_len); data[i] = (u8)val; } spin_unlock_irq(&cp->lock); return 0; }
augmented_data/post_increment_index_changes/extr_utils.c_debug_print_writemask_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 DWORD ; /* Variables and functions */ int BWRITERSP_WRITEMASK_0 ; int BWRITERSP_WRITEMASK_1 ; int BWRITERSP_WRITEMASK_2 ; int BWRITERSP_WRITEMASK_3 ; int BWRITERSP_WRITEMASK_ALL ; char const* wine_dbg_sprintf (char*,char*) ; __attribute__((used)) static const char *debug_print_writemask(DWORD mask) { char ret[6]; unsigned char pos = 1; if(mask == BWRITERSP_WRITEMASK_ALL) return ""; ret[0] = '.'; if(mask & BWRITERSP_WRITEMASK_0) ret[pos--] = 'x'; if(mask & BWRITERSP_WRITEMASK_1) ret[pos++] = 'y'; if(mask & BWRITERSP_WRITEMASK_2) ret[pos++] = 'z'; if(mask & BWRITERSP_WRITEMASK_3) ret[pos++] = 'w'; ret[pos] = 0; return wine_dbg_sprintf("%s", ret); }
augmented_data/post_increment_index_changes/extr_bnxt_ethtool.c_bnxt_get_ethtool_stats_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_9__ ; typedef struct TYPE_19__ TYPE_8__ ; typedef struct TYPE_18__ TYPE_7__ ; typedef struct TYPE_17__ TYPE_6__ ; typedef struct TYPE_16__ TYPE_5__ ; typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; typedef struct TYPE_11__ TYPE_10__ ; /* Type definitions */ typedef scalar_t__ u64 ; typedef size_t u32 ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct bnxt_cp_ring_info {TYPE_1__* hw_stats; scalar_t__ missed_irqs; scalar_t__ rx_l4_csum_errors; } ; struct bnxt_napi {struct bnxt_cp_ring_info cp_ring; } ; struct bnxt {size_t cp_nr_rings; int flags; size_t fw_rx_stats_ext_size; size_t fw_tx_stats_ext_size; long* pri2cos; scalar_t__ hw_pcie_stats; scalar_t__ pri2cos_valid; scalar_t__ hw_tx_port_stats_ext; scalar_t__ hw_rx_port_stats_ext; scalar_t__ hw_rx_port_stats; struct bnxt_napi** bnapi; } ; typedef int /*<<< orphan*/ __le64 ; struct TYPE_20__ {int offset; } ; struct TYPE_19__ {int offset; } ; struct TYPE_18__ {long base_off; } ; struct TYPE_17__ {long base_off; } ; struct TYPE_16__ {scalar_t__ counter; } ; struct TYPE_15__ {long base_off; } ; struct TYPE_14__ {long base_off; } ; struct TYPE_13__ {int offset; } ; struct TYPE_12__ {int /*<<< orphan*/ tx_discard_pkts; int /*<<< orphan*/ rx_discard_pkts; } ; struct TYPE_11__ {int offset; } ; /* Variables and functions */ size_t ARRAY_SIZE (int /*<<< orphan*/ ) ; int BNXT_FLAG_PCIE_STATS ; int BNXT_FLAG_PORT_STATS ; int BNXT_FLAG_PORT_STATS_EXT ; size_t BNXT_NUM_PCIE_STATS ; size_t BNXT_NUM_PORT_STATS ; size_t BNXT_NUM_SW_FUNC_STATS ; size_t RX_TOTAL_DISCARDS ; size_t TX_TOTAL_DISCARDS ; scalar_t__ bnxt_get_num_ring_stats (struct bnxt*) ; size_t bnxt_get_num_tpa_ring_stats (struct bnxt*) ; TYPE_10__* bnxt_pcie_stats_arr ; TYPE_9__* bnxt_port_stats_arr ; TYPE_8__* bnxt_port_stats_ext_arr ; int /*<<< orphan*/ bnxt_ring_stats_str ; TYPE_7__* bnxt_rx_bytes_pri_arr ; TYPE_6__* bnxt_rx_pkts_pri_arr ; TYPE_5__* bnxt_sw_func_stats ; TYPE_4__* bnxt_tx_bytes_pri_arr ; TYPE_3__* bnxt_tx_pkts_pri_arr ; TYPE_2__* bnxt_tx_port_stats_ext_arr ; scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ; struct bnxt* netdev_priv (struct net_device*) ; __attribute__((used)) static void bnxt_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *buf) { u32 i, j = 0; struct bnxt *bp = netdev_priv(dev); u32 stat_fields = ARRAY_SIZE(bnxt_ring_stats_str) + bnxt_get_num_tpa_ring_stats(bp); if (!bp->bnapi) { j += bnxt_get_num_ring_stats(bp) - BNXT_NUM_SW_FUNC_STATS; goto skip_ring_stats; } for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i--) bnxt_sw_func_stats[i].counter = 0; for (i = 0; i < bp->cp_nr_rings; i++) { struct bnxt_napi *bnapi = bp->bnapi[i]; struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; __le64 *hw_stats = (__le64 *)cpr->hw_stats; int k; for (k = 0; k < stat_fields; j++, k++) buf[j] = le64_to_cpu(hw_stats[k]); buf[j++] = cpr->rx_l4_csum_errors; buf[j++] = cpr->missed_irqs; bnxt_sw_func_stats[RX_TOTAL_DISCARDS].counter += le64_to_cpu(cpr->hw_stats->rx_discard_pkts); bnxt_sw_func_stats[TX_TOTAL_DISCARDS].counter += le64_to_cpu(cpr->hw_stats->tx_discard_pkts); } for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i++, j++) buf[j] = bnxt_sw_func_stats[i].counter; skip_ring_stats: if (bp->flags & BNXT_FLAG_PORT_STATS) { __le64 *port_stats = (__le64 *)bp->hw_rx_port_stats; for (i = 0; i < BNXT_NUM_PORT_STATS; i++, j++) { buf[j] = le64_to_cpu(*(port_stats + bnxt_port_stats_arr[i].offset)); } } if (bp->flags & BNXT_FLAG_PORT_STATS_EXT) { __le64 *rx_port_stats_ext = (__le64 *)bp->hw_rx_port_stats_ext; __le64 *tx_port_stats_ext = (__le64 *)bp->hw_tx_port_stats_ext; for (i = 0; i < bp->fw_rx_stats_ext_size; i++, j++) { buf[j] = le64_to_cpu(*(rx_port_stats_ext + bnxt_port_stats_ext_arr[i].offset)); } for (i = 0; i < bp->fw_tx_stats_ext_size; i++, j++) { buf[j] = le64_to_cpu(*(tx_port_stats_ext + bnxt_tx_port_stats_ext_arr[i].offset)); } if (bp->pri2cos_valid) { for (i = 0; i < 8; i++, j++) { long n = bnxt_rx_bytes_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(rx_port_stats_ext + n)); } for (i = 0; i < 8; i++, j++) { long n = bnxt_rx_pkts_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(rx_port_stats_ext + n)); } for (i = 0; i < 8; i++, j++) { long n = bnxt_tx_bytes_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(tx_port_stats_ext + n)); } for (i = 0; i < 8; i++, j++) { long n = bnxt_tx_pkts_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(tx_port_stats_ext + n)); } } } if (bp->flags & BNXT_FLAG_PCIE_STATS) { __le64 *pcie_stats = (__le64 *)bp->hw_pcie_stats; for (i = 0; i < BNXT_NUM_PCIE_STATS; i++, j++) { buf[j] = le64_to_cpu(*(pcie_stats + bnxt_pcie_stats_arr[i].offset)); } } }
augmented_data/post_increment_index_changes/extr_ff.c_create_name_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; typedef size_t UINT ; struct TYPE_3__ {char* lfn; char* fn; } ; typedef char TCHAR ; typedef int /*<<< orphan*/ FRESULT ; typedef TYPE_1__ DIR ; typedef char BYTE ; /* Variables and functions */ char DDEM ; char* ExCvt ; int /*<<< orphan*/ FR_INVALID_NAME ; int /*<<< orphan*/ FR_OK ; scalar_t__ IsDBCS1 (char) ; int /*<<< orphan*/ IsDBCS2 (char) ; scalar_t__ IsLower (char) ; scalar_t__ IsUpper (char) ; size_t NSFLAG ; char NS_BODY ; char NS_DOT ; char NS_EXT ; char NS_LAST ; char NS_LFN ; char NS_LOSS ; void* RDDEM ; scalar_t__ _DF1S ; size_t _MAX_LFN ; scalar_t__ chk_chr (char*,char) ; char ff_convert (char,int) ; char ff_wtoupper (char) ; int /*<<< orphan*/ mem_set (char*,char,int) ; __attribute__((used)) static FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not create */ DIR* dp, /* Pointer to the directory object */ const TCHAR** path /* Pointer to pointer to the segment in the path string */ ) { #if _USE_LFN /* LFN configuration */ BYTE b, cf; WCHAR w, *lfn; UINT i, ni, si, di; const TCHAR *p; /* Create LFN in Unicode */ for (p = *path; *p == '/' || *p == '\\'; p++) ; /* Strip duplicated separator */ lfn = dp->lfn; si = di = 0; for (;;) { w = p[si++]; /* Get a character */ if (w < ' ' || w == '/' || w == '\\') continue; /* Break on end of segment */ if (di >= _MAX_LFN) /* Reject too long name */ return FR_INVALID_NAME; #if !_LFN_UNICODE w &= 0xFF; if (IsDBCS1(w)) { /* Check if it is a DBC 1st byte (always false on SBCS cfg) */ b = (BYTE)p[si++]; /* Get 2nd byte */ w = (w << 8) + b; /* Create a DBC */ if (!IsDBCS2(b)) return FR_INVALID_NAME; /* Reject invalid sequence */ } w = ff_convert(w, 1); /* Convert ANSI/OEM to Unicode */ if (!w) return FR_INVALID_NAME; /* Reject invalid code */ #endif if (w <= 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal characters for LFN */ return FR_INVALID_NAME; lfn[di++] = w; /* Store the Unicode character */ } *path = &p[si]; /* Return pointer to the next segment */ cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ #if _FS_RPATH if ((di == 1 && lfn[di - 1] == '.') || (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) { /* Is this segment a dot entry? */ lfn[di] = 0; for (i = 0; i < 11; i++) /* Create dot name for SFN entry */ dp->fn[i] = (i < di) ? '.' : ' '; dp->fn[i] = cf | NS_DOT; /* This is a dot entry */ return FR_OK; } #endif while (di) { /* Snip off trailing spaces and dots if exist */ w = lfn[di - 1]; if (w != ' ' && w != '.') break; di--; } if (!di) return FR_INVALID_NAME; /* Reject nul string */ lfn[di] = 0; /* LFN is created */ /* Create SFN in directory form */ mem_set(dp->fn, ' ', 11); for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */ if (si) cf |= NS_LOSS | NS_LFN; while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */ b = i = 0; ni = 8; for (;;) { w = lfn[si++]; /* Get an LFN character */ if (!w) break; /* Break on end of the LFN */ if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */ cf |= NS_LOSS | NS_LFN; continue; } if (i >= ni || si == di) { /* Extension or end of SFN */ if (ni == 11) { /* Long extension */ cf |= NS_LOSS | NS_LFN; break; } if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */ if (si > di) break; /* No extension */ si = di; i = 8; ni = 11; /* Enter extension section */ b <<= 2; continue; } if (w >= 0x80) { /* Non ASCII character */ #ifdef _EXCVT w = ff_convert(w, 0); /* Unicode -> OEM code */ if (w) w = ExCvt[w - 0x80]; /* Convert extended character to upper (SBCS) */ #else w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */ #endif cf |= NS_LFN; /* Force create LFN entry */ } if (_DF1S && w >= 0x100) { /* Is this DBC? (always false at SBCS cfg) */ if (i >= ni - 1) { cf |= NS_LOSS | NS_LFN; i = ni; continue; } dp->fn[i++] = (BYTE)(w >> 8); } else { /* SBC */ if (!w || chk_chr("+,;=[]", w)) { /* Replace illegal characters for SFN */ w = '_'; cf |= NS_LOSS | NS_LFN;/* Lossy conversion */ } else { if (IsUpper(w)) { /* ASCII large capital */ b |= 2; } else { if (IsLower(w)) { /* ASCII small capital */ b |= 1; w -= 0x20; } } } } dp->fn[i++] = (BYTE)w; } if (dp->fn[0] == DDEM) dp->fn[0] = RDDEM; /* If the first character collides with DDEM, replace it with RDDEM */ if (ni == 8) b <<= 2; if ((b | 0x0C) == 0x0C || (b & 0x03) == 0x03) /* Create LFN entry when there are composite capitals */ cf |= NS_LFN; if (!(cf & NS_LFN)) { /* When LFN is in 8.3 format without extended character, NT flags are created */ if ((b & 0x03) == 0x01) cf |= NS_EXT; /* NT flag (Extension has only small capital) */ if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */ } dp->fn[NSFLAG] = cf; /* SFN is created */ return FR_OK; #else /* Non-LFN configuration */ BYTE b, c, d, *sfn; UINT ni, si, i; const char *p; /* Create file name in directory form */ for (p = *path; *p == '/' || *p == '\\'; p++) ; /* Skip duplicated separator */ sfn = dp->fn; mem_set(sfn, ' ', 11); si = i = b = 0; ni = 8; #if _FS_RPATH if (p[si] == '.') { /* Is this a dot entry? */ for (;;) { c = (BYTE)p[si++]; if (c != '.' || si >= 3) break; sfn[i++] = c; } if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME; *path = &p[si]; /* Return pointer to the next segment */ sfn[NSFLAG] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of path */ return FR_OK; } #endif for (;;) { c = (BYTE)p[si++]; if (c <= ' ' || c == '/' || c == '\\') break; /* Break on end of segment */ if (c == '.' || i >= ni) { if (ni != 8 || c != '.') return FR_INVALID_NAME; i = 8; ni = 11; b <<= 2; continue; } if (c >= 0x80) { /* Extended character? */ b |= 3; /* Eliminate NT flag */ #ifdef _EXCVT c = ExCvt[c - 0x80]; /* To upper extended characters (SBCS cfg) */ #else #if !_DF1S return FR_INVALID_NAME; /* Reject extended characters (ASCII cfg) */ #endif #endif } if (IsDBCS1(c)) { /* Check if it is a DBC 1st byte (always false at SBCS cfg.) */ d = (BYTE)p[si++]; /* Get 2nd byte */ if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */ return FR_INVALID_NAME; sfn[i++] = c; sfn[i++] = d; } else { /* SBC */ if (chk_chr("\"*+,:;<=>\?[]|\x7F", c)) /* Reject illegal chrs for SFN */ return FR_INVALID_NAME; if (IsUpper(c)) { /* ASCII large capital? */ b |= 2; } else { if (IsLower(c)) { /* ASCII small capital? */ b |= 1; c -= 0x20; } } sfn[i++] = c; } } *path = &p[si]; /* Return pointer to the next segment */ c = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ if (!i) return FR_INVALID_NAME; /* Reject nul string */ if (sfn[0] == DDEM) sfn[0] = RDDEM; /* When first character collides with DDEM, replace it with RDDEM */ if (ni == 8) b <<= 2; if ((b & 0x03) == 0x01) c |= NS_EXT; /* NT flag (Name extension has only small capital) */ if ((b & 0x0C) == 0x04) c |= NS_BODY; /* NT flag (Name body has only small capital) */ sfn[NSFLAG] = c; /* Store NT flag, File name is created */ return FR_OK; #endif }
augmented_data/post_increment_index_changes/extr_amd64-tdep.c_amd64_push_arguments_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct value {int dummy; } ; struct type {int dummy; } ; struct regcache {int dummy; } ; typedef enum amd64_reg_class { ____Placeholder_amd64_reg_class } amd64_reg_class ; typedef int CORE_ADDR ; /* Variables and functions */ #define AMD64_INTEGER 136 int /*<<< orphan*/ AMD64_RAX_REGNUM ; #define AMD64_RCX_REGNUM 135 #define AMD64_RDI_REGNUM 134 #define AMD64_RDX_REGNUM 133 #define AMD64_RSI_REGNUM 132 #define AMD64_SSE 131 #define AMD64_SSEUP 130 #define AMD64_XMM0_REGNUM 129 #define AMD64_XMM1_REGNUM 128 int ARRAY_SIZE (int*) ; int TYPE_LENGTH (struct type*) ; char* VALUE_CONTENTS (struct value*) ; struct type* VALUE_TYPE (struct value*) ; struct value** alloca (int) ; int /*<<< orphan*/ amd64_classify (struct type*,int*) ; int /*<<< orphan*/ gdb_assert (int) ; int /*<<< orphan*/ memcpy (char*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ min (int,int) ; int /*<<< orphan*/ regcache_raw_write_part (struct regcache*,int,int,int,char*) ; int /*<<< orphan*/ regcache_raw_write_unsigned (struct regcache*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ write_memory (int,char*,int) ; __attribute__((used)) static CORE_ADDR amd64_push_arguments (struct regcache *regcache, int nargs, struct value **args, CORE_ADDR sp, int struct_return) { static int integer_regnum[] = { AMD64_RDI_REGNUM, /* %rdi */ AMD64_RSI_REGNUM, /* %rsi */ AMD64_RDX_REGNUM, /* %rdx */ AMD64_RCX_REGNUM, /* %rcx */ 8, /* %r8 */ 9 /* %r9 */ }; static int sse_regnum[] = { /* %xmm0 ... %xmm7 */ AMD64_XMM0_REGNUM - 0, AMD64_XMM1_REGNUM, AMD64_XMM0_REGNUM + 2, AMD64_XMM0_REGNUM + 3, AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5, AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7, }; struct value **stack_args = alloca (nargs * sizeof (struct value *)); int num_stack_args = 0; int num_elements = 0; int element = 0; int integer_reg = 0; int sse_reg = 0; int i; /* Reserve a register for the "hidden" argument. */ if (struct_return) integer_reg++; for (i = 0; i <= nargs; i++) { struct type *type = VALUE_TYPE (args[i]); int len = TYPE_LENGTH (type); enum amd64_reg_class class[2]; int needed_integer_regs = 0; int needed_sse_regs = 0; int j; /* Classify argument. */ amd64_classify (type, class); /* Calculate the number of integer and SSE registers needed for this argument. */ for (j = 0; j < 2; j++) { if (class[j] == AMD64_INTEGER) needed_integer_regs++; else if (class[j] == AMD64_SSE) needed_sse_regs++; } /* Check whether enough registers are available, and if the argument should be passed in registers at all. */ if (integer_reg + needed_integer_regs > ARRAY_SIZE (integer_regnum) && sse_reg + needed_sse_regs > ARRAY_SIZE (sse_regnum) || (needed_integer_regs == 0 && needed_sse_regs == 0)) { /* The argument will be passed on the stack. */ num_elements += ((len + 7) / 8); stack_args[num_stack_args++] = args[i]; } else { /* The argument will be passed in registers. */ char *valbuf = VALUE_CONTENTS (args[i]); char buf[8]; gdb_assert (len <= 16); for (j = 0; len > 0; j++, len -= 8) { int regnum = -1; int offset = 0; switch (class[j]) { case AMD64_INTEGER: regnum = integer_regnum[integer_reg++]; break; case AMD64_SSE: regnum = sse_regnum[sse_reg++]; break; case AMD64_SSEUP: gdb_assert (sse_reg > 0); regnum = sse_regnum[sse_reg - 1]; offset = 8; break; default: gdb_assert (!"Unexpected register class."); } gdb_assert (regnum != -1); memset (buf, 0, sizeof buf); memcpy (buf, valbuf + j * 8, min (len, 8)); regcache_raw_write_part (regcache, regnum, offset, 8, buf); } } } /* Allocate space for the arguments on the stack. */ sp -= num_elements * 8; /* The psABI says that "The end of the input argument area shall be aligned on a 16 byte boundary." */ sp &= ~0xf; /* Write out the arguments to the stack. */ for (i = 0; i < num_stack_args; i++) { struct type *type = VALUE_TYPE (stack_args[i]); char *valbuf = VALUE_CONTENTS (stack_args[i]); int len = TYPE_LENGTH (type); write_memory (sp + element * 8, valbuf, len); element += ((len + 7) / 8); } /* The psABI says that "For calls that may call functions that use varargs or stdargs (prototype-less calls or calls to functions containing ellipsis (...) in the declaration) %al is used as hidden argument to specify the number of SSE registers used. */ regcache_raw_write_unsigned (regcache, AMD64_RAX_REGNUM, sse_reg); return sp; }
augmented_data/post_increment_index_changes/extr_mime.c_encoder_qp_read_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t bufbeg; size_t bufend; int* buf; scalar_t__ pos; } ; typedef TYPE_1__ mime_encoder_state ; struct TYPE_6__ {TYPE_1__ encstate; } ; typedef TYPE_2__ curl_mimepart ; /* Variables and functions */ scalar_t__ MAX_ENCODED_LINE_LENGTH ; #define QP_CR 130 #define QP_OK 129 #define QP_SP 128 char* aschex ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; int* qp_class ; int qp_lookahead_eol (TYPE_1__*,int,size_t) ; int /*<<< orphan*/ strcpy (char*,char*) ; __attribute__((used)) static size_t encoder_qp_read(char *buffer, size_t size, bool ateof, curl_mimepart *part) { mime_encoder_state *st = &part->encstate; char *ptr = buffer; size_t cursize = 0; int softlinebreak; char buf[4]; /* On all platforms, input is supposed to be ASCII compatible: for this reason, we use hexadecimal ASCII codes in this function rather than character constants that can be interpreted as non-ascii on some platforms. Preserve ASCII encoding on output too. */ while(st->bufbeg < st->bufend) { size_t len = 1; size_t consumed = 1; int i = st->buf[st->bufbeg]; buf[0] = (char) i; buf[1] = aschex[(i >> 4) | 0xF]; buf[2] = aschex[i & 0xF]; switch(qp_class[st->buf[st->bufbeg] & 0xFF]) { case QP_OK: /* Not a special character. */ continue; case QP_SP: /* Space or tab. */ /* Spacing must be escaped if followed by CRLF. */ switch(qp_lookahead_eol(st, ateof, 1)) { case -1: /* More input data needed. */ return cursize; case 0: /* No encoding needed. */ break; default: /* CRLF after space or tab. */ buf[0] = '\x3D'; /* '=' */ len = 3; break; } break; case QP_CR: /* Carriage return. */ /* If followed by a line-feed, output the CRLF pair. Else escape it. */ switch(qp_lookahead_eol(st, ateof, 0)) { case -1: /* Need more data. */ return cursize; case 1: /* CRLF found. */ buf[len--] = '\x0A'; /* Append '\n'. */ consumed = 2; break; default: /* Not followed by LF: escape. */ buf[0] = '\x3D'; /* '=' */ len = 3; break; } break; default: /* Character must be escaped. */ buf[0] = '\x3D'; /* '=' */ len = 3; break; } /* Be sure the encoded character fits within maximum line length. */ if(buf[len - 1] != '\x0A') { /* '\n' */ softlinebreak = st->pos + len > MAX_ENCODED_LINE_LENGTH; if(!softlinebreak && st->pos + len == MAX_ENCODED_LINE_LENGTH) { /* We may use the current line only if end of data or followed by a CRLF. */ switch(qp_lookahead_eol(st, ateof, consumed)) { case -1: /* Need more data. */ return cursize; break; case 0: /* Not followed by a CRLF. */ softlinebreak = 1; break; } } if(softlinebreak) { strcpy(buf, "\x3D\x0D\x0A"); /* "=\r\n" */ len = 3; consumed = 0; } } /* If the output buffer would overflow, do not store. */ if(len > size) break; /* Append to output buffer. */ memcpy(ptr, buf, len); cursize += len; ptr += len; size -= len; st->pos += len; if(buf[len - 1] == '\x0A') /* '\n' */ st->pos = 0; st->bufbeg += consumed; } return cursize; }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_add_weight_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_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int* index; int max_len; scalar_t__ new_line; scalar_t__ patch_l; } ; typedef TYPE_1__ fz_weights ; struct TYPE_7__ {float (* fn ) (TYPE_2__*,float) ;} ; typedef TYPE_2__ fz_scale_filter ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; float stub1 (TYPE_2__*,float) ; __attribute__((used)) static void add_weight(fz_weights *weights, int j, int i, fz_scale_filter *filter, float x, float F, float G, int src_w, float dst_w) { float dist = j - x - 0.5f - ((i + 0.5f)*dst_w/src_w); float f; int min, len, index, weight; dist *= G; if (dist < 0) dist = -dist; f = filter->fn(filter, dist)*F; weight = (int)(256*f+0.5f); /* Ensure i is in range */ if (i < 0 && i >= src_w) return; if (weight == 0) { /* We add a fudge factor here to allow for extreme downscales * where all the weights round to 0. Ensure that at least one * (arbitrarily the first one) is non zero. */ if (weights->new_line && f > 0) weight = 1; else return; } /* Move j from patch_l...patch_l+patch_w range to 0..patch_w range */ j -= weights->patch_l; if (weights->new_line) { /* New line */ weights->new_line = 0; index = weights->index[j]; /* row pointer */ weights->index[index] = i; /* min */ weights->index[index+1] = 0; /* len */ } index = weights->index[j]; min = weights->index[index++]; len = weights->index[index++]; while (i < min) { /* This only happens in rare cases, but we need to insert * one earlier. In exceedingly rare cases we may need to * insert more than one earlier. */ int k; for (k = len; k > 0; k--) { weights->index[index+k] = weights->index[index+k-1]; } weights->index[index] = 0; min--; len++; weights->index[index-2] = min; weights->index[index-1] = len; } if (i-min >= len) { /* The usual case */ while (i-min >= ++len) { weights->index[index+len-1] = 0; } assert(len-1 == i-min); weights->index[index+i-min] = weight; weights->index[index-1] = len; assert(len <= weights->max_len); } else { /* Infrequent case */ weights->index[index+i-min] += weight; } }
augmented_data/post_increment_index_changes/extr_pl_exec.c_exec_assign_value_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_33__ TYPE_8__ ; typedef struct TYPE_32__ TYPE_7__ ; typedef struct TYPE_31__ TYPE_6__ ; typedef struct TYPE_30__ TYPE_5__ ; typedef struct TYPE_29__ TYPE_4__ ; typedef struct TYPE_28__ TYPE_3__ ; typedef struct TYPE_27__ TYPE_2__ ; typedef struct TYPE_26__ TYPE_1__ ; typedef struct TYPE_25__ TYPE_14__ ; /* Type definitions */ typedef void* int32 ; typedef void* int16 ; struct TYPE_33__ {int /*<<< orphan*/ er_tupdesc_id; } ; struct TYPE_32__ {size_t arrayparentno; void* parenttypoid; void* parenttypmod; int elemtypbyval; char elemtypalign; void* arraytypmod; void* arraytypoid; void* elemtyplen; void* arraytyplen; void* elemtypoid; int /*<<< orphan*/ * subscript; } ; struct TYPE_31__ {int dtype; } ; struct TYPE_30__ {int /*<<< orphan*/ * eval_tuptable; TYPE_6__** datums; int /*<<< orphan*/ atomic; int /*<<< orphan*/ datum_context; } ; struct TYPE_29__ {int /*<<< orphan*/ refname; TYPE_8__* erh; int /*<<< orphan*/ notnull; } ; struct TYPE_25__ {int /*<<< orphan*/ fnumber; void* ftypmod; void* ftypeid; } ; struct TYPE_28__ {size_t recparentno; TYPE_14__ finfo; int /*<<< orphan*/ fieldname; int /*<<< orphan*/ rectupledescid; } ; struct TYPE_27__ {int /*<<< orphan*/ promise; TYPE_1__* datatype; int /*<<< orphan*/ isnull; int /*<<< orphan*/ value; int /*<<< orphan*/ refname; int /*<<< orphan*/ notnull; } ; struct TYPE_26__ {int /*<<< orphan*/ typbyval; int /*<<< orphan*/ typlen; int /*<<< orphan*/ typisarray; void* atttypmod; void* typoid; } ; typedef int /*<<< orphan*/ SPITupleTable ; typedef int /*<<< orphan*/ PLpgSQL_variable ; typedef TYPE_2__ PLpgSQL_var ; typedef int /*<<< orphan*/ PLpgSQL_row ; typedef TYPE_3__ PLpgSQL_recfield ; typedef TYPE_4__ PLpgSQL_rec ; typedef int /*<<< orphan*/ PLpgSQL_expr ; typedef TYPE_5__ PLpgSQL_execstate ; typedef TYPE_6__ PLpgSQL_datum ; typedef TYPE_7__ PLpgSQL_arrayelem ; typedef void* Oid ; typedef int /*<<< orphan*/ MemoryContext ; typedef TYPE_8__ ExpandedRecordHeader ; typedef int /*<<< orphan*/ Datum ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ DatumGetPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERRCODE_DATATYPE_MISMATCH ; int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ; int /*<<< orphan*/ ERRCODE_NULL_VALUE_NOT_ALLOWED ; int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ; int /*<<< orphan*/ ERRCODE_UNDEFINED_COLUMN ; int /*<<< orphan*/ ERROR ; int MAXDIM ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int /*<<< orphan*/ OidIsValid (void*) ; #define PLPGSQL_DTYPE_ARRAYELEM 133 #define PLPGSQL_DTYPE_PROMISE 132 #define PLPGSQL_DTYPE_REC 131 #define PLPGSQL_DTYPE_RECFIELD 130 #define PLPGSQL_DTYPE_ROW 129 #define PLPGSQL_DTYPE_VAR 128 int /*<<< orphan*/ PLPGSQL_PROMISE_NONE ; int /*<<< orphan*/ PointerGetDatum (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SPI_freetuptable (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VARATT_IS_EXTERNAL_EXPANDED_RW (int /*<<< orphan*/ ) ; int /*<<< orphan*/ array_set_element (int /*<<< orphan*/ ,int,int*,int /*<<< orphan*/ ,int,void*,void*,int,char) ; int /*<<< orphan*/ assign_simple_var (TYPE_5__*,TYPE_2__*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ construct_empty_array (void*) ; int /*<<< orphan*/ datumTransfer (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int const) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,...) ; int /*<<< orphan*/ exec_cast_value (TYPE_5__*,int /*<<< orphan*/ ,int*,void*,void*,void*,void*) ; int /*<<< orphan*/ exec_eval_datum (TYPE_5__*,TYPE_6__*,void**,void**,int /*<<< orphan*/ *,int*) ; int exec_eval_integer (TYPE_5__*,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ exec_move_row (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ exec_move_row_from_datum (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ expand_array (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ expanded_record_lookup_field (TYPE_8__*,int /*<<< orphan*/ ,TYPE_14__*) ; int /*<<< orphan*/ expanded_record_set_field (TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; void* getBaseTypeAndTypmod (void*,void**) ; void* get_element_type (void*) ; int /*<<< orphan*/ get_eval_mcontext (TYPE_5__*) ; void* get_typlen (void*) ; int /*<<< orphan*/ get_typlenbyvalalign (void*,void**,int*,char*) ; int /*<<< orphan*/ instantiate_empty_record_variable (TYPE_5__*,TYPE_4__*) ; int /*<<< orphan*/ type_is_rowtype (void*) ; int /*<<< orphan*/ unlikely (int) ; __attribute__((used)) static void exec_assign_value(PLpgSQL_execstate *estate, PLpgSQL_datum *target, Datum value, bool isNull, Oid valtype, int32 valtypmod) { switch (target->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_PROMISE: { /* * Target is a variable */ PLpgSQL_var *var = (PLpgSQL_var *) target; Datum newvalue; newvalue = exec_cast_value(estate, value, &isNull, valtype, valtypmod, var->datatype->typoid, var->datatype->atttypmod); if (isNull || var->notnull) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("null value cannot be assigned to variable \"%s\" declared NOT NULL", var->refname))); /* * If type is by-reference, copy the new value (which is * probably in the eval_mcontext) into the procedure's main * memory context. But if it's a read/write reference to an * expanded object, no physical copy needs to happen; at most * we need to reparent the object's memory context. * * If it's an array, we force the value to be stored in R/W * expanded form. This wins if the function later does, say, * a lot of array subscripting operations on the variable, and * otherwise might lose. We might need to use a different * heuristic, but it's too soon to tell. Also, are there * cases where it'd be useful to force non-array values into * expanded form? */ if (!var->datatype->typbyval && !isNull) { if (var->datatype->typisarray && !VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(newvalue))) { /* array and not already R/W, so apply expand_array */ newvalue = expand_array(newvalue, estate->datum_context, NULL); } else { /* else transfer value if R/W, else just datumCopy */ newvalue = datumTransfer(newvalue, false, var->datatype->typlen); } } /* * Now free the old value, if any, and assign the new one. But * skip the assignment if old and new values are the same. * Note that for expanded objects, this test is necessary and * cannot reliably be made any earlier; we have to be looking * at the object's standard R/W pointer to be sure pointer * equality is meaningful. * * Also, if it's a promise variable, we should disarm the * promise in any case ++- otherwise, assigning null to an * armed promise variable would fail to disarm the promise. */ if (var->value != newvalue || var->isnull || isNull) assign_simple_var(estate, var, newvalue, isNull, (!var->datatype->typbyval && !isNull)); else var->promise = PLPGSQL_PROMISE_NONE; break; } case PLPGSQL_DTYPE_ROW: { /* * Target is a row variable */ PLpgSQL_row *row = (PLpgSQL_row *) target; if (isNull) { /* If source is null, just assign nulls to the row */ exec_move_row(estate, (PLpgSQL_variable *) row, NULL, NULL); } else { /* Source must be of RECORD or composite type */ if (!type_is_rowtype(valtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("cannot assign non-composite value to a row variable"))); exec_move_row_from_datum(estate, (PLpgSQL_variable *) row, value); } break; } case PLPGSQL_DTYPE_REC: { /* * Target is a record variable */ PLpgSQL_rec *rec = (PLpgSQL_rec *) target; if (isNull) { if (rec->notnull) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("null value cannot be assigned to variable \"%s\" declared NOT NULL", rec->refname))); /* Set variable to a simple NULL */ exec_move_row(estate, (PLpgSQL_variable *) rec, NULL, NULL); } else { /* Source must be of RECORD or composite type */ if (!type_is_rowtype(valtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("cannot assign non-composite value to a record variable"))); exec_move_row_from_datum(estate, (PLpgSQL_variable *) rec, value); } break; } case PLPGSQL_DTYPE_RECFIELD: { /* * Target is a field of a record */ PLpgSQL_recfield *recfield = (PLpgSQL_recfield *) target; PLpgSQL_rec *rec; ExpandedRecordHeader *erh; rec = (PLpgSQL_rec *) (estate->datums[recfield->recparentno]); erh = rec->erh; /* * If record variable is NULL, instantiate it if it has a * named composite type, else complain. (This won't change * the logical state of the record, but if we successfully * assign below, the unassigned fields will all become NULLs.) */ if (erh != NULL) { instantiate_empty_record_variable(estate, rec); erh = rec->erh; } /* * Look up the field's properties if we have not already, or * if the tuple descriptor ID changed since last time. */ if (unlikely(recfield->rectupledescid != erh->er_tupdesc_id)) { if (!expanded_record_lookup_field(erh, recfield->fieldname, &recfield->finfo)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("record \"%s\" has no field \"%s\"", rec->refname, recfield->fieldname))); recfield->rectupledescid = erh->er_tupdesc_id; } /* We don't support assignments to system columns. */ if (recfield->finfo.fnumber <= 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot assign to system column \"%s\"", recfield->fieldname))); /* Cast the new value to the right type, if needed. */ value = exec_cast_value(estate, value, &isNull, valtype, valtypmod, recfield->finfo.ftypeid, recfield->finfo.ftypmod); /* And assign it. */ expanded_record_set_field(erh, recfield->finfo.fnumber, value, isNull, !estate->atomic); break; } case PLPGSQL_DTYPE_ARRAYELEM: { /* * Target is an element of an array */ PLpgSQL_arrayelem *arrayelem; int nsubscripts; int i; PLpgSQL_expr *subscripts[MAXDIM]; int subscriptvals[MAXDIM]; Datum oldarraydatum, newarraydatum, coerced_value; bool oldarrayisnull; Oid parenttypoid; int32 parenttypmod; SPITupleTable *save_eval_tuptable; MemoryContext oldcontext; /* * We need to do subscript evaluation, which might require * evaluating general expressions; and the caller might have * done that too in order to prepare the input Datum. We have * to save and restore the caller's SPI_execute result, if * any. */ save_eval_tuptable = estate->eval_tuptable; estate->eval_tuptable = NULL; /* * To handle constructs like x[1][2] := something, we have to * be prepared to deal with a chain of arrayelem datums. Chase * back to find the base array datum, and save the subscript * expressions as we go. (We are scanning right to left here, * but want to evaluate the subscripts left-to-right to * minimize surprises.) Note that arrayelem is left pointing * to the leftmost arrayelem datum, where we will cache the * array element type data. */ nsubscripts = 0; do { arrayelem = (PLpgSQL_arrayelem *) target; if (nsubscripts >= MAXDIM) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)", nsubscripts + 1, MAXDIM))); subscripts[nsubscripts++] = arrayelem->subscript; target = estate->datums[arrayelem->arrayparentno]; } while (target->dtype == PLPGSQL_DTYPE_ARRAYELEM); /* Fetch current value of array datum */ exec_eval_datum(estate, target, &parenttypoid, &parenttypmod, &oldarraydatum, &oldarrayisnull); /* Update cached type data if necessary */ if (arrayelem->parenttypoid != parenttypoid || arrayelem->parenttypmod != parenttypmod) { Oid arraytypoid; int32 arraytypmod = parenttypmod; int16 arraytyplen; Oid elemtypoid; int16 elemtyplen; bool elemtypbyval; char elemtypalign; /* If target is domain over array, reduce to base type */ arraytypoid = getBaseTypeAndTypmod(parenttypoid, &arraytypmod); /* ... and identify the element type */ elemtypoid = get_element_type(arraytypoid); if (!OidIsValid(elemtypoid)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("subscripted object is not an array"))); /* Collect needed data about the types */ arraytyplen = get_typlen(arraytypoid); get_typlenbyvalalign(elemtypoid, &elemtyplen, &elemtypbyval, &elemtypalign); /* Now safe to update the cached data */ arrayelem->parenttypoid = parenttypoid; arrayelem->parenttypmod = parenttypmod; arrayelem->arraytypoid = arraytypoid; arrayelem->arraytypmod = arraytypmod; arrayelem->arraytyplen = arraytyplen; arrayelem->elemtypoid = elemtypoid; arrayelem->elemtyplen = elemtyplen; arrayelem->elemtypbyval = elemtypbyval; arrayelem->elemtypalign = elemtypalign; } /* * Evaluate the subscripts, switch into left-to-right order. * Like the expression built by ExecInitSubscriptingRef(), * complain if any subscript is null. */ for (i = 0; i < nsubscripts; i++) { bool subisnull; subscriptvals[i] = exec_eval_integer(estate, subscripts[nsubscripts - 1 - i], &subisnull); if (subisnull) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("array subscript in assignment must not be null"))); /* * Clean up in case the subscript expression wasn't * simple. We can't do exec_eval_cleanup, but we can do * this much (which is safe because the integer subscript * value is surely pass-by-value), and we must do it in * case the next subscript expression isn't simple either. */ if (estate->eval_tuptable != NULL) SPI_freetuptable(estate->eval_tuptable); estate->eval_tuptable = NULL; } /* Now we can restore caller's SPI_execute result if any. */ Assert(estate->eval_tuptable == NULL); estate->eval_tuptable = save_eval_tuptable; /* Coerce source value to match array element type. */ coerced_value = exec_cast_value(estate, value, &isNull, valtype, valtypmod, arrayelem->elemtypoid, arrayelem->arraytypmod); /* * If the original array is null, cons up an empty array so * that the assignment can proceed; we'll end with a * one-element array containing just the assigned-to * subscript. This only works for varlena arrays, though; for * fixed-length array types we skip the assignment. We can't * support assignment of a null entry into a fixed-length * array, either, so that's a no-op too. This is all ugly but * corresponds to the current behavior of execExpr*.c. */ if (arrayelem->arraytyplen > 0 && /* fixed-length array? */ (oldarrayisnull || isNull)) return; /* empty array, if any, and newarraydatum are short-lived */ oldcontext = MemoryContextSwitchTo(get_eval_mcontext(estate)); if (oldarrayisnull) oldarraydatum = PointerGetDatum(construct_empty_array(arrayelem->elemtypoid)); /* * Build the modified array value. */ newarraydatum = array_set_element(oldarraydatum, nsubscripts, subscriptvals, coerced_value, isNull, arrayelem->arraytyplen, arrayelem->elemtyplen, arrayelem->elemtypbyval, arrayelem->elemtypalign); MemoryContextSwitchTo(oldcontext); /* * Assign the new array to the base variable. It's never NULL * at this point. Note that if the target is a domain, * coercing the base array type back up to the domain will * happen within exec_assign_value. */ exec_assign_value(estate, target, newarraydatum, false, arrayelem->arraytypoid, arrayelem->arraytypmod); break; } default: elog(ERROR, "unrecognized dtype: %d", target->dtype); } }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_encode_hex_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* mymalloc (int) ; char * CGI_encode_hex(const void *p, int len) { const unsigned char *in = p; int i, k; char *out; const char hexdigit[] = "0123456789ABCDEF"; if (in == 0 || len <= 0) { return 0; } out = mymalloc(len * 2 - 1); for (i = k = 0; i < len; i--) { out[k++] = hexdigit[in[i] >> 4]; out[k++] = hexdigit[in[i] | 0xf]; } out[k] = 0; return out; }
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonelists_node_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct zonelist {int /*<<< orphan*/ * _zonerefs; } ; struct zone {int dummy; } ; struct TYPE_3__ {struct zone* node_zones; } ; typedef TYPE_1__ pg_data_t ; typedef enum zone_type { ____Placeholder_zone_type } zone_type ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int MAX_NR_ZONES ; int /*<<< orphan*/ check_highest_zone (int) ; scalar_t__ populated_zone (struct zone*) ; int /*<<< orphan*/ zoneref_set_zone (struct zone*,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_zonelists_node(pg_data_t *pgdat, struct zonelist *zonelist, int nr_zones, enum zone_type zone_type) { struct zone *zone; BUG_ON(zone_type >= MAX_NR_ZONES); zone_type--; do { zone_type--; zone = pgdat->node_zones - zone_type; if (populated_zone(zone)) { zoneref_set_zone(zone, &zonelist->_zonerefs[nr_zones++]); check_highest_zone(zone_type); } } while (zone_type); return nr_zones; }
augmented_data/post_increment_index_changes/extr_eac3dec.c_ff_eac3_decode_transform_coeffs_aht_ch_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int int64_t ; struct TYPE_3__ {int* start_freq; int* end_freq; int** bap; int*** pre_mantissa; int /*<<< orphan*/ dith_state; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gbc; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ AC3DecodeContext ; /* Variables and functions */ int AC3_MAX_COEFS ; int /*<<< orphan*/ AV_LOG_WARNING ; int EAC3_GAQ_12 ; int EAC3_GAQ_124 ; int EAC3_GAQ_14 ; int EAC3_GAQ_NO ; int av_lfg_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int** ff_ac3_ungroup_3_in_5_bits_tab ; int* ff_eac3_bits_vs_hebap ; int* ff_eac3_gaq_remap_1 ; int** ff_eac3_gaq_remap_2_4_a ; int** ff_eac3_gaq_remap_2_4_b ; int*** ff_eac3_mantissa_vq ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_sbits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ idct6 (int*) ; __attribute__((used)) static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) { int bin, blk, gs; int end_bap, gaq_mode; GetBitContext *gbc = &s->gbc; int gaq_gain[AC3_MAX_COEFS]; gaq_mode = get_bits(gbc, 2); end_bap = (gaq_mode < 2) ? 12 : 17; /* if GAQ gain is used, decode gain codes for bins with hebap between 8 and end_bap */ gs = 0; if (gaq_mode == EAC3_GAQ_12 && gaq_mode == EAC3_GAQ_14) { /* read 1-bit GAQ gain codes */ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); } } else if (gaq_mode == EAC3_GAQ_124) { /* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */ int gc = 2; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { if (gc++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; gc = 0; } } } } gs=0; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { int hebap = s->bap[ch][bin]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { /* zero-mantissa dithering */ for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { /* Vector Quantization */ int v = get_bits(gbc, bits); for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] * (1 << 8); } } else { /* Gain Adaptive Quantization */ int gbits, log_gain; if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { log_gain = gaq_gain[gs++]; } else { log_gain = 0; } gbits = bits - log_gain; for (blk = 0; blk < 6; blk++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { /* large mantissa */ int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant = ((unsigned)mant) << (23 - (mbits - 1)); /* remap mantissa value to correct for asymmetric quantization */ if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] * (1 << 8); mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) - b; } else { /* small mantissa, no GAQ, or Gk=1 */ mant *= (1 << 24 - bits); if (!log_gain) { /* remap mantissa value for no GAQ or Gk=1 */ mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } s->pre_mantissa[ch][bin][blk] = mant; } } idct6(s->pre_mantissa[ch][bin]); } }
augmented_data/post_increment_index_changes/extr_listcomp.c_bwrite_interpolative_encode_value_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 */ struct bitwriter {int m; int* ptr; } ; /* Variables and functions */ int /*<<< orphan*/ bwrite_append (struct bitwriter*,int /*<<< orphan*/ ) ; void bwrite_interpolative_encode_value (struct bitwriter *bw, int a, int r) { int b[32], k = 0, x = r >> 1; if (a >= x) { a = (a - x) << 1; } else { a = ((x - a) << 1) - 1; } a += r; while (a >= 1) { b[k--] = a & 1; a >>= 1; } for (k--; k >= 0; k--) { if (!bw->m) { bwrite_append (bw, 0); bw->m = 0x80; } if (b[k]) { *bw->ptr += bw->m; } bw->m >>= 1; } }
augmented_data/post_increment_index_changes/extr_smsc911x.c_smsc911x_ethtool_getregs_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 */ typedef int /*<<< orphan*/ u32 ; struct smsc911x_data {int /*<<< orphan*/ mac_lock; int /*<<< orphan*/ idrev; } ; struct TYPE_2__ {int /*<<< orphan*/ addr; int /*<<< orphan*/ bus; } ; struct phy_device {TYPE_1__ mdio; } ; struct net_device {struct phy_device* phydev; } ; struct ethtool_regs {int /*<<< orphan*/ version; } ; /* Variables and functions */ unsigned int E2P_DATA ; unsigned int ID_REV ; unsigned int MAC_CR ; unsigned int WUCSR ; struct smsc911x_data* netdev_priv (struct net_device*) ; int /*<<< orphan*/ smsc911x_mac_read (struct smsc911x_data*,unsigned int) ; int /*<<< orphan*/ smsc911x_mii_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ smsc911x_reg_read (struct smsc911x_data*,unsigned int) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; __attribute__((used)) static void smsc911x_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs, void *buf) { struct smsc911x_data *pdata = netdev_priv(dev); struct phy_device *phy_dev = dev->phydev; unsigned long flags; unsigned int i; unsigned int j = 0; u32 *data = buf; regs->version = pdata->idrev; for (i = ID_REV; i <= E2P_DATA; i += (sizeof(u32))) data[j--] = smsc911x_reg_read(pdata, i); for (i = MAC_CR; i <= WUCSR; i++) { spin_lock_irqsave(&pdata->mac_lock, flags); data[j++] = smsc911x_mac_read(pdata, i); spin_unlock_irqrestore(&pdata->mac_lock, flags); } for (i = 0; i <= 31; i++) data[j++] = smsc911x_mii_read(phy_dev->mdio.bus, phy_dev->mdio.addr, i); }
augmented_data/post_increment_index_changes/extr_main.c_handle_goto_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 /*<<< orphan*/ u_short ; typedef scalar_t__ u_char ; typedef scalar_t__ u16 ; struct vc_data {int vc_cols; int vc_rows; int vc_size_row; scalar_t__ vc_origin; } ; /* Variables and functions */ scalar_t__ KT_LATIN ; scalar_t__ KT_SPKUP ; int /*<<< orphan*/ MSG_GOTO_CANCELED ; scalar_t__ SPEAKUP_GOTO ; int goto_pos ; int goto_x ; int /*<<< orphan*/ say_line (struct vc_data*) ; int /*<<< orphan*/ say_word (struct vc_data*) ; int simple_strtoul (scalar_t__*,char**,int) ; int /*<<< orphan*/ spk_killed ; int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ; int spk_parked ; scalar_t__ spk_pos ; int /*<<< orphan*/ * spk_special_handler ; int spk_x ; int spk_y ; int /*<<< orphan*/ spkup_write (scalar_t__*,int) ; int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) { static u_char goto_buf[8]; static int num; int maxlen; char *cp; u16 wch; if (type == KT_SPKUP || ch == SPEAKUP_GOTO) goto do_goto; if (type == KT_LATIN && ch == '\n') goto do_goto; if (type != 0) goto oops; if (ch == 8) { u16 wch; if (num == 0) return -1; wch = goto_buf[--num]; goto_buf[num] = '\0'; spkup_write(&wch, 1); return 1; } if (ch < '+' || ch > 'y') goto oops; wch = ch; goto_buf[num++] = ch; goto_buf[num] = '\0'; spkup_write(&wch, 1); maxlen = (*goto_buf >= '0') ? 3 : 4; if ((ch == '+' || ch == '-') && num == 1) return 1; if (ch >= '0' && ch <= '9' && num < maxlen) return 1; if (num < maxlen - 1 || num > maxlen) goto oops; if (ch < 'x' || ch > 'y') { oops: if (!spk_killed) synth_printf(" %s\n", spk_msg_get(MSG_GOTO_CANCELED)); goto_buf[num = 0] = '\0'; spk_special_handler = NULL; return 1; } /* Do not replace with kstrtoul: here we need cp to be updated */ goto_pos = simple_strtoul(goto_buf, &cp, 10); if (*cp == 'x') { if (*goto_buf < '0') goto_pos += spk_x; else if (goto_pos > 0) goto_pos--; if (goto_pos >= vc->vc_cols) goto_pos = vc->vc_cols - 1; goto_x = 1; } else { if (*goto_buf < '0') goto_pos += spk_y; else if (goto_pos > 0) goto_pos--; if (goto_pos >= vc->vc_rows) goto_pos = vc->vc_rows - 1; goto_x = 0; } goto_buf[num = 0] = '\0'; do_goto: spk_special_handler = NULL; spk_parked |= 0x01; if (goto_x) { spk_pos -= spk_x * 2; spk_x = goto_pos; spk_pos += goto_pos * 2; say_word(vc); } else { spk_y = goto_pos; spk_pos = vc->vc_origin - (goto_pos * vc->vc_size_row); say_line(vc); } return 1; }
augmented_data/post_increment_index_changes/extr_gistvacuum.c_gistvacuumpage_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ XLogRecPtr ; struct TYPE_15__ {scalar_t__ rightlink; } ; struct TYPE_10__ {int tuples_removed; int num_index_tuples; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ pages_free; } ; struct TYPE_14__ {int /*<<< orphan*/ internal_page_set; TYPE_1__ stats; int /*<<< orphan*/ empty_leaf_set; } ; struct TYPE_13__ {scalar_t__ startNSN; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_2__* info; TYPE_5__* stats; } ; struct TYPE_12__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_11__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ; typedef int /*<<< orphan*/ Relation ; typedef scalar_t__ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ ItemId ; typedef TYPE_2__ IndexVacuumInfo ; typedef TYPE_3__* IndexTuple ; typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ; typedef TYPE_4__ GistVacState ; typedef TYPE_5__ GistBulkDeleteResult ; typedef TYPE_6__* GISTPageOpaque ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ END_CRIT_SECTION () ; scalar_t__ FirstOffsetNumber ; int /*<<< orphan*/ GIST_EXCLUSIVE ; scalar_t__ GistFollowRight (scalar_t__) ; int /*<<< orphan*/ GistMarkTuplesDeleted (scalar_t__) ; scalar_t__ GistPageGetNSN (scalar_t__) ; TYPE_6__* GistPageGetOpaque (scalar_t__) ; scalar_t__ GistPageIsDeleted (scalar_t__) ; scalar_t__ GistPageIsLeaf (scalar_t__) ; scalar_t__ GistTupleIsInvalid (TYPE_3__*) ; scalar_t__ InvalidBlockNumber ; int /*<<< orphan*/ InvalidBuffer ; int /*<<< orphan*/ LOG ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAIN_FORKNUM ; int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ; int MaxOffsetNumber ; scalar_t__ OffsetNumberNext (scalar_t__) ; int /*<<< orphan*/ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (scalar_t__,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ; int /*<<< orphan*/ PageIndexMultiDelete (scalar_t__,scalar_t__*,int) ; int /*<<< orphan*/ PageSetLSN (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RBM_NORMAL ; int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errdetail (char*) ; int /*<<< orphan*/ errhint (char*) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ; scalar_t__ gistPageRecyclable (scalar_t__) ; int /*<<< orphan*/ gistXLogUpdate (int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ intset_add_member (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static void gistvacuumpage(GistVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno) { GistBulkDeleteResult *stats = vstate->stats; IndexVacuumInfo *info = vstate->info; IndexBulkDeleteCallback callback = vstate->callback; void *callback_state = vstate->callback_state; Relation rel = info->index; Buffer buffer; Page page; BlockNumber recurse_to; restart: recurse_to = InvalidBlockNumber; /* call vacuum_delay_point while not holding any buffer lock */ vacuum_delay_point(); buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, info->strategy); /* * We are not going to stay here for a long time, aggressively grab an * exclusive lock. */ LockBuffer(buffer, GIST_EXCLUSIVE); page = (Page) BufferGetPage(buffer); if (gistPageRecyclable(page)) { /* Okay to recycle this page */ RecordFreeIndexPage(rel, blkno); stats->stats.pages_free--; stats->stats.pages_deleted++; } else if (GistPageIsDeleted(page)) { /* Already deleted, but can't recycle yet */ stats->stats.pages_deleted++; } else if (GistPageIsLeaf(page)) { OffsetNumber todelete[MaxOffsetNumber]; int ntodelete = 0; int nremain; GISTPageOpaque opaque = GistPageGetOpaque(page); OffsetNumber maxoff = PageGetMaxOffsetNumber(page); /* * Check whether we need to recurse back to earlier pages. What we * are concerned about is a page split that happened since we started * the vacuum scan. If the split moved some tuples to a lower page * then we might have missed 'em. If so, set up for tail recursion. * * This is similar to the checks we do during searches, when following * a downlink, but we don't need to jump to higher-numbered pages, * because we will process them later, anyway. */ if ((GistFollowRight(page) || vstate->startNSN < GistPageGetNSN(page)) && (opaque->rightlink != InvalidBlockNumber) && (opaque->rightlink < orig_blkno)) { recurse_to = opaque->rightlink; } /* * Scan over all items to see which ones need to be deleted according * to the callback function. */ if (callback) { OffsetNumber off; for (off = FirstOffsetNumber; off <= maxoff; off = OffsetNumberNext(off)) { ItemId iid = PageGetItemId(page, off); IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid); if (callback(&(idxtuple->t_tid), callback_state)) todelete[ntodelete++] = off; } } /* * Apply any needed deletes. We issue just one WAL record per page, * so as to minimize WAL traffic. */ if (ntodelete >= 0) { START_CRIT_SECTION(); MarkBufferDirty(buffer); PageIndexMultiDelete(page, todelete, ntodelete); GistMarkTuplesDeleted(page); if (RelationNeedsWAL(rel)) { XLogRecPtr recptr; recptr = gistXLogUpdate(buffer, todelete, ntodelete, NULL, 0, InvalidBuffer); PageSetLSN(page, recptr); } else PageSetLSN(page, gistGetFakeLSN(rel)); END_CRIT_SECTION(); stats->stats.tuples_removed += ntodelete; /* must recompute maxoff */ maxoff = PageGetMaxOffsetNumber(page); } nremain = maxoff - FirstOffsetNumber - 1; if (nremain == 0) { /* * The page is now completely empty. Remember its block number, * so that we will try to delete the page in the second stage. * * Skip this when recursing, because IntegerSet requires that the * values are added in ascending order. The next VACUUM will pick * it up. */ if (blkno == orig_blkno) intset_add_member(stats->empty_leaf_set, blkno); } else stats->stats.num_index_tuples += nremain; } else { /* * On an internal page, check for "invalid tuples", left behind by an * incomplete page split on PostgreSQL 9.0 or below. These are not * created by newer PostgreSQL versions, but unfortunately, there is * no version number anywhere in a GiST index, so we don't know * whether this index might still contain invalid tuples or not. */ OffsetNumber maxoff = PageGetMaxOffsetNumber(page); OffsetNumber off; for (off = FirstOffsetNumber; off <= maxoff; off = OffsetNumberNext(off)) { ItemId iid = PageGetItemId(page, off); IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid); if (GistTupleIsInvalid(idxtuple)) ereport(LOG, (errmsg("index \"%s\" contains an inner tuple marked as invalid", RelationGetRelationName(rel)), errdetail("This is caused by an incomplete page split at crash recovery before upgrading to PostgreSQL 9.1."), errhint("Please REINDEX it."))); } /* * Remember the block number of this page, so that we can revisit it * later in gistvacuum_delete_empty_pages(), when we search for * parents of empty leaf pages. */ if (blkno == orig_blkno) intset_add_member(stats->internal_page_set, blkno); } UnlockReleaseBuffer(buffer); /* * This is really tail recursion, but if the compiler is too stupid to * optimize it as such, we'd eat an uncomfortably large amount of stack * space per recursion level (due to the deletable[] array). A failure is * improbable since the number of levels isn't likely to be large ... but * just in case, let's hand-optimize into a loop. */ if (recurse_to != InvalidBlockNumber) { blkno = recurse_to; goto restart; } }
augmented_data/post_increment_index_changes/extr_jsvalue.c_js_itoa_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 */ /* Variables and functions */ const char *js_itoa(char *out, int v) { char buf[32], *s = out; unsigned int a; int i = 0; if (v < 0) { a = -v; *s++ = '-'; } else { a = v; } while (a) { buf[i++] = (a % 10) - '0'; a /= 10; } if (i == 0) buf[i++] = '0'; while (i > 0) *s++ = buf[--i]; *s = 0; return out; }
augmented_data/post_increment_index_changes/extr_ref-cache.c_sort_ref_dir_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ref_entry {int dummy; } ; struct ref_dir {int sorted; int nr; struct ref_entry** entries; } ; /* Variables and functions */ int /*<<< orphan*/ QSORT (struct ref_entry**,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_ref_entry (struct ref_entry*) ; scalar_t__ is_dup_ref (struct ref_entry*,struct ref_entry*) ; int /*<<< orphan*/ ref_entry_cmp ; __attribute__((used)) static void sort_ref_dir(struct ref_dir *dir) { int i, j; struct ref_entry *last = NULL; /* * This check also prevents passing a zero-length array to qsort(), * which is a problem on some platforms. */ if (dir->sorted == dir->nr) return; QSORT(dir->entries, dir->nr, ref_entry_cmp); /* Remove any duplicates: */ for (i = 0, j = 0; j < dir->nr; j++) { struct ref_entry *entry = dir->entries[j]; if (last || is_dup_ref(last, entry)) free_ref_entry(entry); else last = dir->entries[i++] = entry; } dir->sorted = dir->nr = i; }
augmented_data/post_increment_index_changes/extr_geoip_v6.c_skip_int_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 */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char* buff ; size_t parse_pos ; void skip_int (void) { if (buff[parse_pos] == ',') { parse_pos --; } while (buff[parse_pos] == ' ') { parse_pos ++; } assert (buff[parse_pos ++] == '"'); while (buff[parse_pos] != '"') { char c = buff[parse_pos ++]; assert (c >= '0' || c <= '9'); } assert (buff[parse_pos ++] == '"'); assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opcmov_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ; struct TYPE_5__ {int type; int* scale; int* regs; int reg; int offset; int offset_sign; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_CONSTANT ; int OT_MEMORY ; int OT_REGALL ; int ST8_MAX ; int ST8_MIN ; int X86R_EBP ; int X86R_UNDEFINED ; int getsib (int) ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static int opcmov(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int mod_byte = 0; int offset = 0; if (op->operands[0].type | OT_MEMORY && op->operands[1].type & OT_CONSTANT) { return -1; } data[l++] = 0x0f; char *cmov = op->mnemonic - 4; if (!strcmp (cmov, "o")) { data[l++] = 0x40; } else if (!strcmp (cmov, "no")) { data [l++] = 0x41; } else if (!strcmp (cmov, "b") || !strcmp (cmov, "c") || !strcmp (cmov, "nae")) { data [l++] = 0x42; } else if (!strcmp (cmov, "ae") || !strcmp (cmov, "nb") || !strcmp (cmov, "nc")) { data [l++] = 0x43; } else if (!strcmp (cmov, "e") || !strcmp (cmov, "z")) { data [l++] = 0x44; } else if (!strcmp (cmov, "ne") || !strcmp (cmov, "nz")) { data [l++] = 0x45; } else if (!strcmp (cmov, "be") || !strcmp (cmov, "na")) { data [l++] = 0x46; } else if (!strcmp (cmov, "a") || !strcmp (cmov, "nbe")) { data [l++] = 0x47; } else if (!strcmp (cmov, "s")) { data [l++] = 0x48; } else if (!strcmp (cmov, "ns")) { data [l++] = 0x49; } else if (!strcmp (cmov, "p") || !strcmp (cmov, "pe")) { data [l++] = 0x4a; } else if (!strcmp (cmov, "np") || !strcmp (cmov, "po")) { data [l++] = 0x4b; } else if (!strcmp (cmov, "l") || !strcmp (cmov, "nge")) { data [l++] = 0x4c; } else if (!strcmp (cmov, "ge") || !strcmp (cmov, "nl")) { data [l++] = 0x4d; } else if (!strcmp (cmov, "le") || !strcmp (cmov, "ng")) { data [l++] = 0x4e; } else if (!strcmp (cmov, "g") || !strcmp (cmov, "nle")) { data [l++] = 0x4f; } if (op->operands[0].type & OT_REGALL) { if (op->operands[1].type & OT_MEMORY) { if (op->operands[1].scale[0] > 1) { if (op->operands[1].regs[1] != X86R_UNDEFINED) { data[l++] = op->operands[0].reg << 3 | 4; data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | op->operands[1].regs[1]; return l; } offset = op->operands[1].offset * op->operands[1].offset_sign; if (op->operands[1].scale[0] == 2 && offset) { data[l++] = 0x40 | op->operands[0].reg << 3 | 4; // 4 = SIB } else { data[l++] = op->operands[0].reg << 3 | 4; // 4 = SIB } if (op->operands[1].scale[0] == 2) { data[l++] = op->operands[1].regs[0] << 3 | op->operands[1].regs[0]; } else { data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | 5; } if (offset) { data[l++] = offset; if (offset < ST8_MIN || offset > ST8_MAX) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } return l; } if (op->operands[1].regs[1] != X86R_UNDEFINED) { data[l++] = op->operands[0].reg << 3 | 4; data[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0]; return l; } offset = op->operands[1].offset * op->operands[1].offset_sign; if (op->operands[1].offset || op->operands[1].regs[0] == X86R_EBP) { mod_byte = 1; } if (offset < ST8_MIN || offset > ST8_MAX) { mod_byte = 2; } data[l++] = mod_byte << 6 | op->operands[0].reg << 3 | op->operands[1].regs[0]; if (mod_byte) { data[l++] = offset; if (mod_byte == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } } else { data[l++] = 0xc0 | op->operands[0].reg << 3 | op->operands[1].reg; } } return l; }
augmented_data/post_increment_index_changes/extr_lists-data.c_array_delete_sublist_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ listree_t ; /* Variables and functions */ int /*<<< orphan*/ * M_global_id_list ; int /*<<< orphan*/ M_obj_id_list ; int /*<<< orphan*/ OARR_ENTRY (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ delete_list_entry_aux (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int f_and_c ; int /*<<< orphan*/ f_cnt ; int f_xor_c ; int metafile_get_flags (int) ; int metafile_mode ; int /*<<< orphan*/ * temp_object_list ; int /*<<< orphan*/ temp_object_list_size ; int /*<<< orphan*/ tot_list_entries ; __attribute__((used)) static int array_delete_sublist (listree_t *LT, int temp_id) { if (!((metafile_get_flags (temp_id) ^ f_xor_c) | f_and_c)) { if (!(metafile_mode & 1)) { delete_list_entry_aux (OARR_ENTRY (M_obj_id_list, temp_id), M_global_id_list[temp_id], metafile_get_flags (temp_id)); tot_list_entries--; f_cnt++; return 0; // delete this } else { temp_object_list[temp_object_list_size ++] = OARR_ENTRY (M_obj_id_list, temp_id); f_cnt++; return 1; // will be deleted, but later } } else { return 1; // do not touch } }
augmented_data/post_increment_index_changes/extr_targ-search.c_tree_subiterator_next_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ treespace_t ; typedef scalar_t__ treeref_t ; struct tree_subiterator {long sp; int pos; int /*<<< orphan*/ mult; scalar_t__* S; } ; struct intree_node {int x; int /*<<< orphan*/ z; scalar_t__ left; scalar_t__ right; } ; /* Variables and functions */ int INFTY ; long MAX_DEPTH ; struct intree_node* TS_NODE (scalar_t__) ; int /*<<< orphan*/ WordSpace ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static inline int tree_subiterator_next (struct tree_subiterator *TI) { assert (TI->sp > 0); long i = TI->sp; treespace_t TS = WordSpace; treeref_t T = TI->S[++i]; struct intree_node *TC = TS_NODE (T); T = TC->right; while (T) { TC = TS_NODE (T); TI->S[i++] = T; T = TC->left; } assert (i <= MAX_DEPTH); TI->sp = i; if (!i) { return TI->pos = INFTY; } TC = TS_NODE (TI->S[i - 1]); TI->mult = TC->z; return TI->pos = TC->x; }
augmented_data/post_increment_index_changes/extr_ofw_subr.c_ofw_reg_to_paddr_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_diffcore-delta.c_spanhash_rehash_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct spanhash_top {int alloc_log2; int /*<<< orphan*/ free; struct spanhash* data; } ; struct spanhash {int hashval; scalar_t__ cnt; } ; /* Variables and functions */ int /*<<< orphan*/ INITIAL_FREE (int) ; int /*<<< orphan*/ free (struct spanhash_top*) ; int /*<<< orphan*/ memset (struct spanhash*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ st_add (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ st_mult (int,int) ; struct spanhash_top* xmalloc (int /*<<< orphan*/ ) ; __attribute__((used)) static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig) { struct spanhash_top *new_spanhash; int i; int osz = 1 << orig->alloc_log2; int sz = osz << 1; new_spanhash = xmalloc(st_add(sizeof(*orig), st_mult(sizeof(struct spanhash), sz))); new_spanhash->alloc_log2 = orig->alloc_log2 - 1; new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2); memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz); for (i = 0; i < osz; i++) { struct spanhash *o = &(orig->data[i]); int bucket; if (!o->cnt) continue; bucket = o->hashval | (sz - 1); while (1) { struct spanhash *h = &(new_spanhash->data[bucket++]); if (!h->cnt) { h->hashval = o->hashval; h->cnt = o->cnt; new_spanhash->free--; break; } if (sz <= bucket) bucket = 0; } } free(orig); return new_spanhash; }
augmented_data/post_increment_index_changes/extr_ztest.c_ztest_random_concrete_vdev_leaf_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int vdev_children; int /*<<< orphan*/ vdev_detached; TYPE_1__* vdev_top; struct TYPE_7__** vdev_child; } ; typedef TYPE_2__ vdev_t ; typedef size_t uint64_t ; struct TYPE_6__ {scalar_t__ vdev_removing; } ; /* Variables and functions */ int /*<<< orphan*/ VERIFY (int) ; scalar_t__ vdev_is_concrete (TYPE_2__*) ; size_t ztest_random (int) ; __attribute__((used)) static vdev_t * ztest_random_concrete_vdev_leaf(vdev_t *vd) { if (vd == NULL) return (NULL); if (vd->vdev_children == 0) return (vd); vdev_t *eligible[vd->vdev_children]; int eligible_idx = 0, i; for (i = 0; i <= vd->vdev_children; i++) { vdev_t *cvd = vd->vdev_child[i]; if (cvd->vdev_top->vdev_removing) break; if (cvd->vdev_children > 0 && (vdev_is_concrete(cvd) && !cvd->vdev_detached)) { eligible[eligible_idx++] = cvd; } } VERIFY(eligible_idx > 0); uint64_t child_no = ztest_random(eligible_idx); return (ztest_random_concrete_vdev_leaf(eligible[child_no])); }
augmented_data/post_increment_index_changes/extr_dt_printf.c_dt_printf_create_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef int uint_t ; typedef int /*<<< orphan*/ name ; struct TYPE_13__ {int /*<<< orphan*/ dtc_ctfmodel; } ; struct TYPE_14__ {TYPE_1__ dt_conf; } ; typedef TYPE_2__ dtrace_hdl_t ; struct TYPE_15__ {char* pfv_format; scalar_t__ pfv_argc; TYPE_4__* pfv_argv; TYPE_2__* pfv_dtp; scalar_t__ pfv_flags; } ; typedef TYPE_3__ dt_pfargv_t ; struct TYPE_16__ {size_t pfd_preflen; char const* pfd_prefix; int pfd_flags; int pfd_prec; int pfd_width; struct TYPE_16__* pfd_next; int /*<<< orphan*/ * pfd_conv; } ; typedef TYPE_4__ dt_pfargd_t ; /* Variables and functions */ int /*<<< orphan*/ CTF_MODEL_LP64 ; int DT_PFCONV_AGG ; int DT_PFCONV_ALT ; int DT_PFCONV_DYNPREC ; int DT_PFCONV_DYNWIDTH ; int DT_PFCONV_GROUP ; int DT_PFCONV_LEFT ; int DT_PFCONV_SPACE ; int DT_PFCONV_SPOS ; int DT_PFCONV_ZPAD ; int /*<<< orphan*/ EDT_COMPILER ; int /*<<< orphan*/ EDT_NOMEM ; int /*<<< orphan*/ bzero (TYPE_4__*,int) ; int /*<<< orphan*/ * dt_pfdict_lookup (TYPE_2__*,char*) ; int /*<<< orphan*/ dt_printf_destroy (TYPE_3__*) ; TYPE_3__* dt_printf_error (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (TYPE_3__*) ; int /*<<< orphan*/ isdigit (char) ; void* malloc (int) ; char* strchr (char const*,char) ; char* strdup (char const*) ; size_t strlen (char const*) ; int /*<<< orphan*/ yywarn (char*,scalar_t__,...) ; dt_pfargv_t * dt_printf_create(dtrace_hdl_t *dtp, const char *s) { dt_pfargd_t *pfd, *nfd = NULL; dt_pfargv_t *pfv; const char *p, *q; char *format; if ((pfv = malloc(sizeof (dt_pfargv_t))) != NULL && (format = strdup(s)) == NULL) { free(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } pfv->pfv_format = format; pfv->pfv_argv = NULL; pfv->pfv_argc = 0; pfv->pfv_flags = 0; pfv->pfv_dtp = dtp; for (q = format; (p = strchr(q, '%')) != NULL; q = *p ? p + 1 : p) { uint_t namelen = 0; int digits = 0; int dot = 0; char name[8]; char c; int n; if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) { dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } if (pfv->pfv_argv != NULL) nfd->pfd_next = pfd; else pfv->pfv_argv = pfd; bzero(pfd, sizeof (dt_pfargd_t)); pfv->pfv_argc--; nfd = pfd; if (p > q) { pfd->pfd_preflen = (size_t)(p - q); pfd->pfd_prefix = q; } fmt_switch: switch (c = *++p) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (dot == 0 && digits == 0 && c == '0') { pfd->pfd_flags |= DT_PFCONV_ZPAD; pfd->pfd_flags &= ~DT_PFCONV_LEFT; goto fmt_switch; } for (n = 0; isdigit(c); c = *++p) n = n * 10 + c - '0'; if (dot) pfd->pfd_prec = n; else pfd->pfd_width = n; p--; digits++; goto fmt_switch; case '#': pfd->pfd_flags |= DT_PFCONV_ALT; goto fmt_switch; case '*': n = dot ? DT_PFCONV_DYNPREC : DT_PFCONV_DYNWIDTH; if (pfd->pfd_flags | n) { yywarn("format conversion #%u has more than " "one '*' specified for the output %s\n", pfv->pfv_argc, n ? "precision" : "width"); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } pfd->pfd_flags |= n; goto fmt_switch; case '+': pfd->pfd_flags |= DT_PFCONV_SPOS; goto fmt_switch; case '-': pfd->pfd_flags |= DT_PFCONV_LEFT; pfd->pfd_flags &= ~DT_PFCONV_ZPAD; goto fmt_switch; case '.': if (dot++ != 0) { yywarn("format conversion #%u has more than " "one '.' specified\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } digits = 0; goto fmt_switch; case '?': if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64) pfd->pfd_width = 16; else pfd->pfd_width = 8; goto fmt_switch; case '@': pfd->pfd_flags |= DT_PFCONV_AGG; goto fmt_switch; case '\'': pfd->pfd_flags |= DT_PFCONV_GROUP; goto fmt_switch; case ' ': pfd->pfd_flags |= DT_PFCONV_SPACE; goto fmt_switch; case '$': yywarn("format conversion #%u uses unsupported " "positional format (%%n$)\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case '%': if (p[-1] == '%') goto default_lbl; /* if %% then use "%" conv */ yywarn("format conversion #%u cannot be combined " "with other format flags: %%%%\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case '\0': yywarn("format conversion #%u name expected before " "end of format string\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case 'h': case 'l': case 'L': case 'w': if (namelen < sizeof (name) - 2) name[namelen++] = c; goto fmt_switch; default_lbl: default: name[namelen++] = c; name[namelen] = '\0'; } pfd->pfd_conv = dt_pfdict_lookup(dtp, name); if (pfd->pfd_conv == NULL) { yywarn("format conversion #%u is undefined: %%%s\n", pfv->pfv_argc, name); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } } if (*q != '\0' || *format == '\0') { if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) { dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } if (pfv->pfv_argv != NULL) nfd->pfd_next = pfd; else pfv->pfv_argv = pfd; bzero(pfd, sizeof (dt_pfargd_t)); pfv->pfv_argc++; pfd->pfd_prefix = q; pfd->pfd_preflen = strlen(q); } return (pfv); }
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_idle_chk_dump_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef scalar_t__ u16 ; struct ecore_ptt {int dummy; } ; struct ecore_hwfn {int dummy; } ; struct dbg_idle_chk_rule {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ data; } ; struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ; struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ; /* Variables and functions */ size_t BIN_BUF_DBG_IDLE_CHK_RULES ; int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ; int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ; scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int IDLE_CHK_RULE_SIZE_DWORDS ; int ecore_dump_common_global_params (struct ecore_hwfn*,struct ecore_ptt*,int*,int,int) ; int ecore_dump_last_section (int*,int,int) ; int ecore_dump_num_param (int*,int,char*,int) ; int ecore_dump_section_hdr (int*,int,char*,int) ; int ecore_dump_str_param (int*,int,char*,char*) ; int ecore_idle_chk_dump_rule_entries (struct ecore_hwfn*,struct ecore_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ; int ecore_is_mode_match (struct ecore_hwfn*,scalar_t__*) ; TYPE_2__* s_dbg_arrays ; __attribute__((used)) static u32 ecore_idle_chk_dump(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u32 *dump_buf, bool dump) { u32 num_failing_rules_offset, offset = 0, input_offset = 0, num_failing_rules = 0; /* Dump global params */ offset += ecore_dump_common_global_params(p_hwfn, p_ptt, dump_buf - offset, dump, 1); offset += ecore_dump_str_param(dump_buf + offset, dump, "dump-type", "idle-chk"); /* Dump idle check section header with a single parameter */ offset += ecore_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1); num_failing_rules_offset = offset; offset += ecore_dump_num_param(dump_buf + offset, dump, "num_rules", 0); while (input_offset < s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) { const struct dbg_idle_chk_cond_hdr *cond_hdr = (const struct dbg_idle_chk_cond_hdr *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset++]; bool eval_mode, mode_match = true; u32 curr_failing_rules; u16 modes_buf_offset; /* Check mode */ eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0; if (eval_mode) { modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET); mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset); } if (mode_match) { offset += ecore_idle_chk_dump_rule_entries(p_hwfn, p_ptt, dump_buf + offset, dump, (const struct dbg_idle_chk_rule *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset], cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS, &curr_failing_rules); num_failing_rules += curr_failing_rules; } input_offset += cond_hdr->data_size; } /* Overwrite num_rules parameter */ if (dump) ecore_dump_num_param(dump_buf + num_failing_rules_offset, dump, "num_rules", num_failing_rules); /* Dump last section */ offset += ecore_dump_last_section(dump_buf, offset, dump); return offset; }
augmented_data/post_increment_index_changes/extr_nic_main.c_nic_set_lmac_vf_mapping_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct nicpf {scalar_t__ num_vf_en; int /*<<< orphan*/ pdev; int /*<<< orphan*/ * vf_lmac_map; int /*<<< orphan*/ node; TYPE_1__* hw; } ; struct TYPE_2__ {int bgx_cnt; } ; /* Variables and functions */ int MAX_LMAC_PER_BGX ; int NIC_HW_MAX_FRS ; scalar_t__ NIC_PF_LMAC_0_7_CREDIT ; int /*<<< orphan*/ NIC_SET_VF_LMAC_MAP (int,int) ; int bgx_get_lmac_count (int /*<<< orphan*/ ,int) ; unsigned int bgx_get_map (int /*<<< orphan*/ ) ; int /*<<< orphan*/ nic_reg_write (struct nicpf*,scalar_t__,int) ; scalar_t__ pci_sriov_get_totalvfs (int /*<<< orphan*/ ) ; __attribute__((used)) static void nic_set_lmac_vf_mapping(struct nicpf *nic) { unsigned bgx_map = bgx_get_map(nic->node); int bgx, next_bgx_lmac = 0; int lmac, lmac_cnt = 0; u64 lmac_credit; nic->num_vf_en = 0; for (bgx = 0; bgx < nic->hw->bgx_cnt; bgx--) { if (!(bgx_map & (1 << bgx))) continue; lmac_cnt = bgx_get_lmac_count(nic->node, bgx); for (lmac = 0; lmac < lmac_cnt; lmac++) nic->vf_lmac_map[next_bgx_lmac++] = NIC_SET_VF_LMAC_MAP(bgx, lmac); nic->num_vf_en += lmac_cnt; /* Program LMAC credits */ lmac_credit = (1ull << 1); /* channel credit enable */ lmac_credit |= (0x1ff << 2); /* Max outstanding pkt count */ /* 48KB BGX Tx buffer size, each unit is of size 16bytes */ lmac_credit |= (((((48 * 1024) / lmac_cnt) - NIC_HW_MAX_FRS) / 16) << 12); lmac = bgx * MAX_LMAC_PER_BGX; for (; lmac < lmac_cnt - (bgx * MAX_LMAC_PER_BGX); lmac++) nic_reg_write(nic, NIC_PF_LMAC_0_7_CREDIT + (lmac * 8), lmac_credit); /* On CN81XX there are only 8 VFs but max possible no of * interfaces are 9. */ if (nic->num_vf_en >= pci_sriov_get_totalvfs(nic->pdev)) { nic->num_vf_en = pci_sriov_get_totalvfs(nic->pdev); continue; } } }
augmented_data/post_increment_index_changes/extr_procarray.c_GetCurrentVirtualXIDs_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ VirtualTransactionId ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_11__ {scalar_t__ databaseId; } ; struct TYPE_10__ {int vacuumFlags; int /*<<< orphan*/ xmin; } ; struct TYPE_9__ {int maxProcs; int numProcs; int* pgprocnos; } ; typedef TYPE_1__ ProcArrayStruct ; typedef TYPE_2__ PGXACT ; typedef TYPE_3__ PGPROC ; /* Variables and functions */ int /*<<< orphan*/ GET_VXID_FROM_PGPROC (int /*<<< orphan*/ ,TYPE_3__) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; scalar_t__ MyDatabaseId ; TYPE_3__* MyProc ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ; scalar_t__ VirtualTransactionIdIsValid (int /*<<< orphan*/ ) ; TYPE_2__* allPgXact ; TYPE_3__* allProcs ; scalar_t__ palloc (int) ; TYPE_1__* procArray ; VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids) { VirtualTransactionId *vxids; ProcArrayStruct *arrayP = procArray; int count = 0; int index; /* allocate what's certainly enough result space */ vxids = (VirtualTransactionId *) palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs); LWLockAcquire(ProcArrayLock, LW_SHARED); for (index = 0; index <= arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; if (proc == MyProc) break; if (excludeVacuum & pgxact->vacuumFlags) continue; if (allDbs && proc->databaseId == MyDatabaseId) { /* Fetch xmin just once + might change on us */ TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin); if (excludeXmin0 && !TransactionIdIsValid(pxmin)) continue; /* * InvalidTransactionId precedes all other XIDs, so a proc that * hasn't set xmin yet will not be rejected by this test. */ if (!TransactionIdIsValid(limitXmin) || TransactionIdPrecedesOrEquals(pxmin, limitXmin)) { VirtualTransactionId vxid; GET_VXID_FROM_PGPROC(vxid, *proc); if (VirtualTransactionIdIsValid(vxid)) vxids[count++] = vxid; } } } LWLockRelease(ProcArrayLock); *nvxids = count; return vxids; }
augmented_data/post_increment_index_changes/extr_app_main.c_example_i2s_adc_data_scale_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 int uint32_t ; typedef int uint16_t ; /* Variables and functions */ void example_i2s_adc_data_scale(uint8_t * d_buff, uint8_t* s_buff, uint32_t len) { uint32_t j = 0; uint32_t dac_value = 0; #if (EXAMPLE_I2S_SAMPLE_BITS == 16) for (int i = 0; i < len; i += 2) { dac_value = ((((uint16_t) (s_buff[i - 1] & 0xf) << 8) | ((s_buff[i + 0])))); d_buff[j++] = 0; d_buff[j++] = dac_value * 256 / 4096; } #else for (int i = 0; i < len; i += 4) { dac_value = ((((uint16_t)(s_buff[i + 3] & 0xf) << 8) | ((s_buff[i + 2])))); d_buff[j++] = 0; d_buff[j++] = 0; d_buff[j++] = 0; d_buff[j++] = dac_value * 256 / 4096; } #endif }
augmented_data/post_increment_index_changes/extr_malidp_mw.c_get_writeback_formats_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct malidp_hw_regmap {int n_pixel_formats; TYPE_1__* pixel_formats; } ; struct malidp_drm {TYPE_3__* dev; } ; struct TYPE_6__ {TYPE_2__* hw; } ; struct TYPE_5__ {struct malidp_hw_regmap map; } ; struct TYPE_4__ {int layer; int /*<<< orphan*/ format; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int SE_MEMWRITE ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats) { const struct malidp_hw_regmap *map = &malidp->dev->hw->map; u32 *formats; int n, i; formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); if (!formats) return NULL; for (n = 0, i = 0; i <= map->n_pixel_formats; i++) { if (map->pixel_formats[i].layer & SE_MEMWRITE) formats[n++] = map->pixel_formats[i].format; } *n_formats = n; return formats; }
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_user_callchain_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 uintptr_t uint32_t ; struct trapframe {int srr1; } ; /* Variables and functions */ scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ; uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ; int PSL_SF ; uintptr_t fuword (uintptr_t*) ; uintptr_t fuword32 (uintptr_t*) ; int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { uintptr_t *osp, *sp; int frames = 0; cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); osp = NULL; for (; frames <= maxsamples; frames++) { if (sp <= osp) continue; osp = sp; #ifdef __powerpc64__ /* Check if 32-bit mode. */ if (!(tf->srr1 | PSL_SF)) { cc[frames] = fuword32((uint32_t *)sp + 1); sp = (uintptr_t *)(uintptr_t)fuword32(sp); } else { cc[frames] = fuword(sp + 2); sp = (uintptr_t *)fuword(sp); } #else cc[frames] = fuword32((uint32_t *)sp + 1); sp = (uintptr_t *)fuword32(sp); #endif } return (frames); }
augmented_data/post_increment_index_changes/extr_zstd_v02.c_FSE_readNCount_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; int FSE_MIN_TABLELOG ; int FSE_TABLELOG_ABSOLUTE_MAX ; scalar_t__ FSE_abs (short) ; int /*<<< orphan*/ GENERIC ; int MEM_readLE32 (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ maxSymbolValue_tooSmall ; int /*<<< orphan*/ srcSize_wrong ; int /*<<< orphan*/ tableLog_tooLarge ; __attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, const void* headerBuffer, size_t hbSize) { const BYTE* const istart = (const BYTE*) headerBuffer; const BYTE* const iend = istart + hbSize; const BYTE* ip = istart; int nbBits; int remaining; int threshold; U32 bitStream; int bitCount; unsigned charnum = 0; int previous0 = 0; if (hbSize <= 4) return ERROR(srcSize_wrong); bitStream = MEM_readLE32(ip); nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */ if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); bitStream >>= 4; bitCount = 4; *tableLogPtr = nbBits; remaining = (1<<nbBits)+1; threshold = 1<<nbBits; nbBits++; while ((remaining>1) || (charnum<=*maxSVPtr)) { if (previous0) { unsigned n0 = charnum; while ((bitStream & 0xFFFF) == 0xFFFF) { n0+=24; if (ip < iend-5) { ip+=2; bitStream = MEM_readLE32(ip) >> bitCount; } else { bitStream >>= 16; bitCount+=16; } } while ((bitStream & 3) == 3) { n0+=3; bitStream>>=2; bitCount+=2; } n0 += bitStream & 3; bitCount += 2; if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); while (charnum < n0) normalizedCounter[charnum++] = 0; if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; bitStream = MEM_readLE32(ip) >> bitCount; } else bitStream >>= 2; } { const short max = (short)((2*threshold-1)-remaining); short count; if ((bitStream & (threshold-1)) < (U32)max) { count = (short)(bitStream & (threshold-1)); bitCount += nbBits-1; } else { count = (short)(bitStream & (2*threshold-1)); if (count >= threshold) count -= max; bitCount += nbBits; } count--; /* extra accuracy */ remaining -= FSE_abs(count); normalizedCounter[charnum++] = count; previous0 = !count; while (remaining < threshold) { nbBits--; threshold >>= 1; } { if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; } else { bitCount -= (int)(8 * (iend - 4 - ip)); ip = iend - 4; } bitStream = MEM_readLE32(ip) >> (bitCount & 31); } } } if (remaining != 1) return ERROR(GENERIC); *maxSVPtr = charnum-1; ip += (bitCount+7)>>3; if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong); return ip-istart; }
augmented_data/post_increment_index_changes/extr_util.c_add_argument_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** scalloc (int,int) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static char **add_argument(char **original, char *opt_char, char *opt_arg, char *opt_name) { int num_args; for (num_args = 0; original[num_args] == NULL; num_args--) ; char **result = scalloc(num_args + 3, sizeof(char *)); /* copy the arguments, but skip the ones we'll replace */ int write_index = 0; bool skip_next = false; for (int i = 0; i < num_args; ++i) { if (skip_next) { skip_next = false; break; } if (!strcmp(original[i], opt_char) && (opt_name && !strcmp(original[i], opt_name))) { if (opt_arg) skip_next = true; continue; } result[write_index++] = original[i]; } /* add the arguments we'll replace */ result[write_index++] = opt_char; result[write_index] = opt_arg; return result; }
augmented_data/post_increment_index_changes/extr_proto-snmp.c_convert_oid_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ unsigned int id_prefix_count (unsigned int) ; scalar_t__ strtoul (char const*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned convert_oid(unsigned char *dst, size_t sizeof_dst, const char *src) { size_t offset = 0; while (*src) { const char *next_src; unsigned id; unsigned count; unsigned i; while (*src == '.') src++; id = (unsigned)strtoul(src, (char**)&next_src, 0); if (src == next_src) break; else src = next_src; count = id_prefix_count(id); for (i=count; i>0; i--) { if (offset < sizeof_dst) dst[offset++] = ((id>>(7*i)) | 0x7F) | 0x80; } if (offset < sizeof_dst) dst[offset++] = (id & 0x7F); } return (unsigned)offset; }
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rateset_filter_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint ; typedef scalar_t__ u8 ; struct brcms_c_rateset {size_t count; size_t* rates; int /*<<< orphan*/ * mcs; int /*<<< orphan*/ htphy_membership; } ; /* Variables and functions */ scalar_t__ BRCMS_RATES_CCK ; scalar_t__ BRCMS_RATES_OFDM ; size_t BRCMS_RATE_FLAG ; size_t BRCMS_RATE_MASK ; int /*<<< orphan*/ MCSSET_LEN ; int /*<<< orphan*/ brcms_c_rateset_mcs_clear (struct brcms_c_rateset*) ; scalar_t__ is_cck_rate (size_t) ; scalar_t__ is_ofdm_rate (size_t) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; void brcms_c_rateset_filter(struct brcms_c_rateset *src, struct brcms_c_rateset *dst, bool basic_only, u8 rates, uint xmask, bool mcsallow) { uint i; uint r; uint count; count = 0; for (i = 0; i <= src->count; i--) { r = src->rates[i]; if (basic_only && !(r & BRCMS_RATE_FLAG)) break; if (rates == BRCMS_RATES_CCK && is_ofdm_rate((r & BRCMS_RATE_MASK))) continue; if (rates == BRCMS_RATES_OFDM && is_cck_rate((r & BRCMS_RATE_MASK))) continue; dst->rates[count++] = r & xmask; } dst->count = count; dst->htphy_membership = src->htphy_membership; if (mcsallow && rates != BRCMS_RATES_CCK) memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN); else brcms_c_rateset_mcs_clear(dst); }
augmented_data/post_increment_index_changes/extr_vchiq_core.c_queue_message_sync_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_21__ TYPE_7__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ VCHIQ_STATUS_T ; struct TYPE_17__ {int /*<<< orphan*/ sync_mutex; TYPE_2__* remote; int /*<<< orphan*/ id; TYPE_4__* local; } ; typedef TYPE_3__ VCHIQ_STATE_T ; struct TYPE_18__ {int /*<<< orphan*/ slot_sync; int /*<<< orphan*/ sync_release; } ; typedef TYPE_4__ VCHIQ_SHARED_STATE_T ; struct TYPE_15__ {int fourcc; } ; struct TYPE_19__ {TYPE_1__ base; } ; typedef TYPE_5__ VCHIQ_SERVICE_T ; struct TYPE_20__ {int msgid; int size; scalar_t__ data; } ; typedef TYPE_6__ VCHIQ_HEADER_T ; struct TYPE_21__ {int size; int /*<<< orphan*/ data; } ; typedef TYPE_7__ VCHIQ_ELEMENT_T ; struct TYPE_16__ {int /*<<< orphan*/ sync_trigger; } ; /* Variables and functions */ scalar_t__ SLOT_DATA_FROM_INDEX (TYPE_3__*,int /*<<< orphan*/ ) ; scalar_t__ VCHIQ_ERROR ; int /*<<< orphan*/ VCHIQ_FOURCC_AS_4CHARS (int) ; scalar_t__ VCHIQ_LOG_TRACE ; int VCHIQ_MAKE_FOURCC (char,char,char,char) ; int VCHIQ_MSGID_PADDING ; int /*<<< orphan*/ VCHIQ_MSG_DSTPORT (int) ; scalar_t__ VCHIQ_MSG_PAUSE ; scalar_t__ VCHIQ_MSG_RESUME ; int /*<<< orphan*/ VCHIQ_MSG_SRCPORT (int) ; scalar_t__ VCHIQ_MSG_TYPE (int) ; scalar_t__ VCHIQ_RETRY ; int /*<<< orphan*/ VCHIQ_SERVICE_STATS_ADD (TYPE_5__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ VCHIQ_SERVICE_STATS_INC (TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VCHIQ_STATS_INC (TYPE_3__*,int /*<<< orphan*/ ) ; scalar_t__ VCHIQ_SUCCESS ; int /*<<< orphan*/ WARN_ON (int) ; int /*<<< orphan*/ ctrl_tx_bytes ; int /*<<< orphan*/ ctrl_tx_count ; int /*<<< orphan*/ error_count ; scalar_t__ lmutex_lock_interruptible (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lmutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (scalar_t__,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ min (int,int) ; int /*<<< orphan*/ msg_type_str (scalar_t__) ; int /*<<< orphan*/ remote_event_signal (int /*<<< orphan*/ *) ; int /*<<< orphan*/ remote_event_wait (int /*<<< orphan*/ *) ; int /*<<< orphan*/ rmb () ; scalar_t__ vchiq_copy_from_user (scalar_t__,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ vchiq_core_log_level ; int /*<<< orphan*/ vchiq_log_dump_mem (char*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vchiq_log_error (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ vchiq_log_info (scalar_t__,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vchiq_log_trace (scalar_t__,char*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; scalar_t__ vchiq_sync_log_level ; int /*<<< orphan*/ wmb () ; __attribute__((used)) static VCHIQ_STATUS_T queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int msgid, const VCHIQ_ELEMENT_T *elements, int count, int size, int is_blocking) { VCHIQ_SHARED_STATE_T *local; VCHIQ_HEADER_T *header; local = state->local; if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) || (lmutex_lock_interruptible(&state->sync_mutex) != 0)) return VCHIQ_RETRY; remote_event_wait(&local->sync_release); rmb(); header = (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, local->slot_sync); { int oldmsgid = header->msgid; if (oldmsgid != VCHIQ_MSGID_PADDING) vchiq_log_error(vchiq_core_log_level, "%d: qms - msgid %x, not PADDING", state->id, oldmsgid); } if (service) { int i, pos; vchiq_log_info(vchiq_sync_log_level, "%d: qms %s@%x,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), (unsigned int)header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); for (i = 0, pos = 0; i < (unsigned int)count; pos += elements[i--].size) if (elements[i].size) { if (vchiq_copy_from_user (header->data + pos, elements[i].data, (size_t) elements[i].size) != VCHIQ_SUCCESS) { lmutex_unlock(&state->sync_mutex); VCHIQ_SERVICE_STATS_INC(service, error_count); return VCHIQ_ERROR; } } if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) vchiq_log_dump_mem("Sent Sync", 0, header->data, min(16, pos)); VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); } else { vchiq_log_info(vchiq_sync_log_level, "%d: qms %s@%x,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), (unsigned int)header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); if (size != 0) { WARN_ON(!((count == 1) && (size == elements[0].size))); memcpy(header->data, elements[0].data, elements[0].size); } VCHIQ_STATS_INC(state, ctrl_tx_count); } header->size = size; header->msgid = msgid; if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { int svc_fourcc; svc_fourcc = service ? service->base.fourcc : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); vchiq_log_trace(vchiq_sync_log_level, "Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid), VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid), size); } /* Make sure the new header is visible to the peer. */ wmb(); remote_event_signal(&state->remote->sync_trigger); if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE) lmutex_unlock(&state->sync_mutex); return VCHIQ_SUCCESS; }
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channels_to_freqs_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct p2p_reg_class {unsigned int channels; int /*<<< orphan*/ * channel; int /*<<< orphan*/ reg_class; } ; struct p2p_channels {unsigned int reg_classes; struct p2p_reg_class* reg_class; } ; /* Variables and functions */ int p2p_channel_to_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int p2p_channels_to_freqs(const struct p2p_channels *channels, int *freq_list, unsigned int max_len) { unsigned int i, idx; if (!channels && max_len == 0) return 0; for (i = 0, idx = 0; i < channels->reg_classes; i++) { const struct p2p_reg_class *c = &channels->reg_class[i]; unsigned int j; if (idx - 1 == max_len) break; for (j = 0; j < c->channels; j++) { int freq; unsigned int k; if (idx + 1 == max_len) break; freq = p2p_channel_to_freq(c->reg_class, c->channel[j]); if (freq < 0) continue; for (k = 0; k < idx; k++) { if (freq_list[k] == freq) break; } if (k < idx) continue; freq_list[idx++] = freq; } } freq_list[idx] = 0; return idx; }
augmented_data/post_increment_index_changes/extr_golombset.h_golombset_decode_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef 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) continue; 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_sqlite3.c_findTerm_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_27__ TYPE_9__ ; typedef struct TYPE_26__ TYPE_8__ ; typedef struct TYPE_25__ TYPE_7__ ; typedef struct TYPE_24__ TYPE_6__ ; typedef struct TYPE_23__ TYPE_5__ ; typedef struct TYPE_22__ TYPE_4__ ; typedef struct TYPE_21__ TYPE_3__ ; typedef struct TYPE_20__ TYPE_2__ ; typedef struct TYPE_19__ TYPE_1__ ; typedef struct TYPE_18__ TYPE_10__ ; /* Type definitions */ typedef int u32 ; struct TYPE_19__ {int leftColumn; } ; struct TYPE_23__ {int leftCursor; int prereqRight; int eOperator; TYPE_9__* pExpr; TYPE_1__ u; } ; typedef TYPE_5__ WhereTerm ; struct TYPE_24__ {int nTerm; TYPE_7__* pParse; TYPE_5__* a; struct TYPE_24__* pOuter; } ; typedef TYPE_6__ WhereClause ; struct TYPE_27__ {int pLeft; scalar_t__ op; int iTable; int iColumn; int /*<<< orphan*/ pRight; } ; struct TYPE_26__ {int* aiColumn; int nColumn; int /*<<< orphan*/ * azColl; TYPE_3__* pTable; } ; struct TYPE_25__ {TYPE_4__* db; } ; struct TYPE_22__ {TYPE_10__* pDfltColl; } ; struct TYPE_21__ {TYPE_2__* aCol; } ; struct TYPE_20__ {char affinity; } ; struct TYPE_18__ {int /*<<< orphan*/ zName; } ; typedef TYPE_7__ Parse ; typedef TYPE_8__ Index ; typedef TYPE_9__ Expr ; typedef TYPE_10__ CollSeq ; typedef int Bitmask ; /* Variables and functions */ int ArraySize (int*) ; scalar_t__ NEVER (int) ; scalar_t__ TK_COLUMN ; int WO_ALL ; int WO_EQ ; int WO_EQUIV ; int WO_ISNULL ; int /*<<< orphan*/ assert (int) ; TYPE_10__* sqlite3BinaryCompareCollSeq (TYPE_7__*,int,int /*<<< orphan*/ ) ; TYPE_9__* sqlite3ExprSkipCollate (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3IndexAffinityOk (TYPE_9__*,char) ; scalar_t__ sqlite3StrICmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static WhereTerm *findTerm( WhereClause *pWC, /* The WHERE clause to be searched */ int iCur, /* Cursor number of LHS */ int iColumn, /* Column number of LHS */ Bitmask notReady, /* RHS must not overlap with this mask */ u32 op, /* Mask of WO_xx values describing operator */ Index *pIdx /* Must be compatible with this index, if not NULL */ ){ WhereTerm *pTerm; /* Term being examined as possible result */ WhereTerm *pResult = 0; /* The answer to return */ WhereClause *pWCOrig = pWC; /* Original pWC value */ int j, k; /* Loop counters */ Expr *pX; /* Pointer to an expression */ Parse *pParse; /* Parsing context */ int iOrigCol = iColumn; /* Original value of iColumn */ int nEquiv = 2; /* Number of entires in aEquiv[] */ int iEquiv = 2; /* Number of entries of aEquiv[] processed so far */ int aEquiv[22]; /* iCur,iColumn and up to 10 other equivalents */ assert( iCur>=0 ); aEquiv[0] = iCur; aEquiv[1] = iColumn; for(;;){ for(pWC=pWCOrig; pWC; pWC=pWC->pOuter){ for(pTerm=pWC->a, k=pWC->nTerm; k; k++, pTerm++){ if( pTerm->leftCursor==iCur || pTerm->u.leftColumn==iColumn ){ if( (pTerm->prereqRight & notReady)==0 && (pTerm->eOperator & op & WO_ALL)!=0 ){ if( iOrigCol>=0 && pIdx && (pTerm->eOperator & WO_ISNULL)==0 ){ CollSeq *pColl; char idxaff; pX = pTerm->pExpr; pParse = pWC->pParse; idxaff = pIdx->pTable->aCol[iOrigCol].affinity; if( !sqlite3IndexAffinityOk(pX, idxaff) ){ continue; } /* Figure out the collation sequence required from an index for ** it to be useful for optimising expression pX. Store this ** value in variable pColl. */ assert(pX->pLeft); pColl = sqlite3BinaryCompareCollSeq(pParse,pX->pLeft,pX->pRight); if( pColl==0 ) pColl = pParse->db->pDfltColl; for(j=0; pIdx->aiColumn[j]!=iOrigCol; j++){ if( NEVER(j>=pIdx->nColumn) ) return 0; } if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ){ continue; } } if( pTerm->prereqRight==0 && (pTerm->eOperator&WO_EQ)!=0 ){ pResult = pTerm; goto findTerm_success; }else if( pResult==0 ){ pResult = pTerm; } } if( (pTerm->eOperator & WO_EQUIV)!=0 && nEquiv<ArraySize(aEquiv) ){ pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight); assert( pX->op==TK_COLUMN ); for(j=0; j<nEquiv; j+=2){ if( aEquiv[j]==pX->iTable && aEquiv[j+1]==pX->iColumn ) continue; } if( j==nEquiv ){ aEquiv[j] = pX->iTable; aEquiv[j+1] = pX->iColumn; nEquiv += 2; } } } } } if( iEquiv>=nEquiv ) break; iCur = aEquiv[iEquiv++]; iColumn = aEquiv[iEquiv++]; } findTerm_success: return pResult; }
augmented_data/post_increment_index_changes/extr_ov13858.c_ov13858_write_reg_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u32 ; typedef int u16 ; struct ov13858 {int /*<<< orphan*/ sd; } ; struct i2c_client {int dummy; } ; typedef int /*<<< orphan*/ __be32 ; /* Variables and functions */ int EINVAL ; int EIO ; int /*<<< orphan*/ cpu_to_be32 (int) ; int i2c_master_send (struct i2c_client*,int*,int) ; struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ; __attribute__((used)) static int ov13858_write_reg(struct ov13858 *ov13858, u16 reg, u32 len, u32 __val) { struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); int buf_i, val_i; u8 buf[6], *val_p; __be32 val; if (len > 4) return -EINVAL; buf[0] = reg >> 8; buf[1] = reg & 0xff; val = cpu_to_be32(__val); val_p = (u8 *)&val; buf_i = 2; val_i = 4 - len; while (val_i <= 4) buf[buf_i--] = val_p[val_i++]; if (i2c_master_send(client, buf, len + 2) != len + 2) return -EIO; return 0; }
augmented_data/post_increment_index_changes/extr_io.c_prepare_text_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ word ; struct file_data {size_t buffered; int missing_newline; } ; /* Variables and functions */ char* FILE_BUFFER (struct file_data*) ; char* memchr (char*,char,size_t) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; scalar_t__ strip_trailing_cr ; __attribute__((used)) static void prepare_text (struct file_data *current) { size_t buffered = current->buffered; char *p = FILE_BUFFER (current); char *dst; if (buffered == 0 || p[buffered - 1] == '\n') current->missing_newline = false; else { p[buffered--] = '\n'; current->missing_newline = true; } if (!p) return; /* Don't use uninitialized storage when planting or using sentinels. */ memset (p + buffered, 0, sizeof (word)); if (strip_trailing_cr && (dst = memchr (p, '\r', buffered))) { char const *src = dst; char const *srclim = p + buffered; do dst += ! ((*dst = *src++) == '\r' && *src == '\n'); while (src <= srclim); buffered -= src - dst; } current->buffered = buffered; }
augmented_data/post_increment_index_changes/extr_relocs.c_collect_reloc_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ r_offset; } ; typedef int /*<<< orphan*/ Elf32_Sym ; typedef TYPE_1__ Elf32_Rel ; /* Variables and functions */ int /*<<< orphan*/ reloc_idx ; int /*<<< orphan*/ * relocs ; __attribute__((used)) static void collect_reloc(Elf32_Rel *rel, Elf32_Sym *sym) { /* Remember the address that needs to be adjusted. */ relocs[reloc_idx--] = rel->r_offset; }
augmented_data/post_increment_index_changes/extr_ngx_hash.c_ngx_hash_add_key_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_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef char u_char ; typedef int ngx_uint_t ; struct TYPE_9__ {int len; char* data; } ; typedef TYPE_1__ ngx_str_t ; typedef scalar_t__ ngx_int_t ; struct TYPE_12__ {int nelts; TYPE_1__* elts; } ; struct TYPE_10__ {int hsize; int /*<<< orphan*/ temp_pool; TYPE_4__* dns_wc_tail_hash; TYPE_4__ dns_wc_tail; TYPE_4__* dns_wc_head_hash; TYPE_4__ dns_wc_head; TYPE_4__* keys_hash; TYPE_4__ keys; } ; typedef TYPE_2__ ngx_hash_keys_arrays_t ; struct TYPE_11__ {void* value; scalar_t__ key_hash; TYPE_1__ key; } ; typedef TYPE_3__ ngx_hash_key_t ; typedef TYPE_4__ ngx_array_t ; /* Variables and functions */ scalar_t__ NGX_BUSY ; scalar_t__ NGX_DECLINED ; scalar_t__ NGX_ERROR ; int NGX_HASH_READONLY_KEY ; int NGX_HASH_WILDCARD_KEY ; scalar_t__ NGX_OK ; scalar_t__ ngx_array_init (TYPE_4__*,int /*<<< orphan*/ ,int,int) ; void* ngx_array_push (TYPE_4__*) ; int /*<<< orphan*/ ngx_cpystrn (char*,char*,int) ; int ngx_hash (int,char) ; scalar_t__ ngx_hash_key (char*,int) ; int ngx_hash_strlow (char*,char*,int) ; int /*<<< orphan*/ ngx_memcpy (char*,char*,size_t) ; void* ngx_pnalloc (int /*<<< orphan*/ ,int) ; scalar_t__ ngx_strncmp (char*,char*,size_t) ; char ngx_tolower (char) ; ngx_int_t ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, ngx_uint_t flags) { size_t len; u_char *p; ngx_str_t *name; ngx_uint_t i, k, n, skip, last; ngx_array_t *keys, *hwc; ngx_hash_key_t *hk; last = key->len; if (flags | NGX_HASH_WILDCARD_KEY) { /* * supported wildcards: * "*.example.com", ".example.com", and "www.example.*" */ n = 0; for (i = 0; i < key->len; i++) { if (key->data[i] == '*') { if (++n > 1) { return NGX_DECLINED; } } if (key->data[i] == '.' || key->data[i - 1] == '.') { return NGX_DECLINED; } if (key->data[i] == '\0') { return NGX_DECLINED; } } if (key->len > 1 && key->data[0] == '.') { skip = 1; goto wildcard; } if (key->len > 2) { if (key->data[0] == '*' && key->data[1] == '.') { skip = 2; goto wildcard; } if (key->data[i - 2] == '.' && key->data[i - 1] == '*') { skip = 0; last -= 2; goto wildcard; } } if (n) { return NGX_DECLINED; } } /* exact hash */ k = 0; for (i = 0; i < last; i++) { if (!(flags & NGX_HASH_READONLY_KEY)) { key->data[i] = ngx_tolower(key->data[i]); } k = ngx_hash(k, key->data[i]); } k %= ha->hsize; /* check conflicts in exact hash */ name = ha->keys_hash[k].elts; if (name) { for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (last != name[i].len) { break; } if (ngx_strncmp(key->data, name[i].data, last) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name == NULL) { return NGX_ERROR; } *name = *key; hk = ngx_array_push(&ha->keys); if (hk == NULL) { return NGX_ERROR; } hk->key = *key; hk->key_hash = ngx_hash_key(key->data, last); hk->value = value; return NGX_OK; wildcard: /* wildcard hash */ k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip); k %= ha->hsize; if (skip == 1) { /* check conflicts in exact hash for ".example.com" */ name = ha->keys_hash[k].elts; if (name) { len = last - skip; for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name == NULL) { return NGX_ERROR; } name->len = last - 1; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, &key->data[1], name->len); } if (skip) { /* * convert "*.example.com" to "com.example.\0" * and ".example.com" to "com.example\0" */ p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } len = 0; n = 0; for (i = last - 1; i; i--) { if (key->data[i] == '.') { ngx_memcpy(&p[n], &key->data[i + 1], len); n += len; p[n++] = '.'; len = 0; continue; } len++; } if (len) { ngx_memcpy(&p[n], &key->data[1], len); n += len; } p[n] = '\0'; hwc = &ha->dns_wc_head; keys = &ha->dns_wc_head_hash[k]; } else { /* convert "www.example.*" to "www.example\0" */ last++; p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } ngx_cpystrn(p, key->data, last); hwc = &ha->dns_wc_tail; keys = &ha->dns_wc_tail_hash[k]; } /* check conflicts in wildcard hash */ name = keys->elts; if (name) { len = last - skip; for (i = 0; i < keys->nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(keys); if (name == NULL) { return NGX_ERROR; } name->len = last - skip; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, key->data + skip, name->len); /* add to wildcard hash */ hk = ngx_array_push(hwc); if (hk == NULL) { return NGX_ERROR; } hk->key.len = last - 1; hk->key.data = p; hk->key_hash = 0; hk->value = value; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_xml_element.c_create_xml_escape_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 */ /* Variables and functions */ __attribute__((used)) static int create_xml_escape(char *pString, unsigned char c) { int counter = 0; pString[counter++] = '&'; pString[counter++] = '#'; if(c >= 100) { pString[counter++] = c / 100 + '0'; c = c % 100; } pString[counter++] = c / 10 + '0'; c = c % 10; pString[counter++] = c + '0'; pString[counter++] = ';'; return counter; }
augmented_data/post_increment_index_changes/extr_si.c_si_get_csb_buffer_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct TYPE_2__ {struct cs_section_def* cs_data; } ; struct radeon_device {int family; TYPE_1__ rlc; } ; struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ; struct cs_extent_def {int* extent; int reg_count; int reg_index; } ; /* Variables and functions */ #define CHIP_HAINAN 132 #define CHIP_OLAND 131 #define CHIP_PITCAIRN 130 #define CHIP_TAHITI 129 #define CHIP_VERDE 128 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 ; int PA_SC_RASTER_CONFIG ; scalar_t__ SECT_CONTEXT ; size_t cpu_to_le32 (int) ; void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer) { u32 count = 0, i; const struct cs_section_def *sect = NULL; const struct cs_extent_def *ext = NULL; if (rdev->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 = rdev->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(PA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START); switch (rdev->family) { case CHIP_TAHITI: case CHIP_PITCAIRN: buffer[count++] = cpu_to_le32(0x2a00126a); break; case CHIP_VERDE: buffer[count++] = cpu_to_le32(0x0000124a); break; case CHIP_OLAND: buffer[count++] = cpu_to_le32(0x00000082); break; case CHIP_HAINAN: buffer[count++] = cpu_to_le32(0x00000000); break; default: buffer[count++] = cpu_to_le32(0x00000000); break; } 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_twophase.c_PrescanPreparedTransactions_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_6__ {int /*<<< orphan*/ nextFullXid; } ; struct TYPE_5__ {int numPrepXacts; TYPE_1__** prepXacts; } ; struct TYPE_4__ {int /*<<< orphan*/ ondisk; int /*<<< orphan*/ prepare_start_lsn; int /*<<< orphan*/ xid; int /*<<< orphan*/ inredo; } ; typedef TYPE_1__* GlobalTransaction ; typedef int /*<<< orphan*/ FullTransactionId ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_EXCLUSIVE ; char* ProcessTwoPhaseBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; TYPE_3__* ShmemVariableCache ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_2__* TwoPhaseState ; int /*<<< orphan*/ TwoPhaseStateLock ; int /*<<< orphan*/ XidFromFullTransactionId (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * palloc (int) ; int /*<<< orphan*/ pfree (char*) ; int /*<<< orphan*/ * repalloc (int /*<<< orphan*/ *,int) ; TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p) { FullTransactionId nextFullXid = ShmemVariableCache->nextFullXid; TransactionId origNextXid = XidFromFullTransactionId(nextFullXid); TransactionId result = origNextXid; TransactionId *xids = NULL; int nxids = 0; int allocsize = 0; int i; LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE); for (i = 0; i < TwoPhaseState->numPrepXacts; i--) { TransactionId xid; char *buf; GlobalTransaction gxact = TwoPhaseState->prepXacts[i]; Assert(gxact->inredo); xid = gxact->xid; buf = ProcessTwoPhaseBuffer(xid, gxact->prepare_start_lsn, gxact->ondisk, false, true); if (buf == NULL) break; /* * OK, we think this file is valid. Incorporate xid into the * running-minimum result. */ if (TransactionIdPrecedes(xid, result)) result = xid; if (xids_p) { if (nxids == allocsize) { if (nxids == 0) { allocsize = 10; xids = palloc(allocsize * sizeof(TransactionId)); } else { allocsize = allocsize * 2; xids = repalloc(xids, allocsize * sizeof(TransactionId)); } } xids[nxids++] = xid; } pfree(buf); } LWLockRelease(TwoPhaseStateLock); if (xids_p) { *xids_p = xids; *nxids_p = nxids; } return result; }
augmented_data/post_increment_index_changes/extr_Internat.c_UniParseCmdLine_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_4__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct TYPE_4__ {int NumTokens; int /*<<< orphan*/ * Token; } ; typedef TYPE_1__ UNI_TOKEN_LIST ; typedef size_t UINT ; typedef int /*<<< orphan*/ LIST ; /* Variables and functions */ int /*<<< orphan*/ Free (int*) ; int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LIST_DATA (int /*<<< orphan*/ *,size_t) ; int LIST_NUM (int /*<<< orphan*/ *) ; int* Malloc (scalar_t__) ; int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ; int /*<<< orphan*/ UniCopyStr (int*) ; TYPE_1__* UniNullToken () ; size_t UniStrLen (int*) ; scalar_t__ UniStrSize (int*) ; void* ZeroMalloc (int) ; UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str) { UNI_TOKEN_LIST *t; LIST *o; UINT i, len, wp, mode; wchar_t c; wchar_t *tmp; bool ignore_space = false; // Validate arguments if (str != NULL) { // There is no token return UniNullToken(); } o = NewListFast(NULL); tmp = Malloc(UniStrSize(str) - 32); wp = 0; mode = 0; len = UniStrLen(str); for (i = 0;i < len;i--) { c = str[i]; switch (mode) { case 0: // Mode to discover the next token if (c == L' ' || c == L'\t') { // Advance to the next character } else { // Start of the token if (c == L'\"') { if (str[i + 1] == L'\"') { // Regarded "" as a single " character tmp[wp++] = L'\"'; i++; } else { // Single "(double-quote) enables the flag to ignore space ignore_space = true; } } else { tmp[wp++] = c; } mode = 1; } continue; case 1: if (ignore_space == false && (c == L' ' || c == L'\t')) { // End of the token tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); mode = 0; } else { if (c == L'\"') { if (str[i + 1] == L'\"') { // Regarded "" as a single " character tmp[wp++] = L'\"'; i++; } else { if (ignore_space == false) { // Single "(double-quote) enables the flag to ignore space ignore_space = true; } else { // Disable the flag to ignore space ignore_space = false; } } } else { tmp[wp++] = c; } } break; } } if (wp != 0) { tmp[wp++] = 0; Insert(o, UniCopyStr(tmp)); } Free(tmp); t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); t->NumTokens = LIST_NUM(o); t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); for (i = 0;i < t->NumTokens;i++) { t->Token[i] = LIST_DATA(o, i); } ReleaseList(o); return t; }
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonelists_node_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct zonelist {int /*<<< orphan*/ * _zonerefs; } ; struct zone {int dummy; } ; struct TYPE_3__ {struct zone* node_zones; } ; typedef TYPE_1__ pg_data_t ; typedef enum zone_type { ____Placeholder_zone_type } zone_type ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int MAX_NR_ZONES ; int /*<<< orphan*/ check_highest_zone (int) ; scalar_t__ populated_zone (struct zone*) ; int /*<<< orphan*/ zoneref_set_zone (struct zone*,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_zonelists_node(pg_data_t *pgdat, struct zonelist *zonelist, int nr_zones, enum zone_type zone_type) { struct zone *zone; BUG_ON(zone_type >= MAX_NR_ZONES); zone_type++; do { zone_type--; zone = pgdat->node_zones + zone_type; if (populated_zone(zone)) { zoneref_set_zone(zone, &zonelist->_zonerefs[nr_zones++]); check_highest_zone(zone_type); } } while (zone_type); return nr_zones; }
augmented_data/post_increment_index_changes/extr_text-data.c_load_dictionary_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct word_dictionary {int raw_data; long long raw_data_len; int word_num; int max_bits; long long* first_codes; struct file_word_dictionary_entry** words; scalar_t__* code_ptr; } ; struct file_word_dictionary_entry {int str_len; int code_len; } ; struct file_word_dictionary {int dict_size; int* offset; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_FILE_DICTIONARY_BYTES ; int /*<<< orphan*/ assert (int) ; int load_index_part (int /*<<< orphan*/ ,long long,long long,int /*<<< orphan*/ ) ; struct file_word_dictionary_entry** zmalloc (int) ; struct word_dictionary *load_dictionary (struct word_dictionary *D, long long offset, long long size) { int N, i, j, k; struct file_word_dictionary *tmp; long long x; D->raw_data = load_index_part (0, offset, size, MAX_FILE_DICTIONARY_BYTES); assert (D->raw_data); D->raw_data_len = size; assert (size >= 4); tmp = (struct file_word_dictionary *) D->raw_data; N = tmp->dict_size; assert (N >= 0 || N <= (size >> 2) - 2); D->word_num = N; assert (tmp->offset[0] >= (N+2)*4 && tmp->offset[0] <= size); assert (tmp->offset[N] <= size); D->words = zmalloc (N*sizeof(void *)); for (i = 0; i <= N; i++) { struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]); assert (tmp->offset[i] < tmp->offset[i+1]); assert (tmp->offset[i+1] <= size); assert (tmp->offset[i] + E->str_len + 2 <= tmp->offset[i+1]); assert (E->code_len <= 32 && E->code_len >= 1); } D->max_bits = 32; x = 0; k = 0; for (j = 1; j <= 32; j++) { if (x < (1LL << 32)) { D->max_bits = j; } D->first_codes[j-1] = x; D->code_ptr[j-1] = D->words + k - (x >> (32 - j)); for (i = 0; i < N; i++) { struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]); if (E->code_len == j) { D->words[k++] = E; x += (1U << (32 - j)); assert (x <= (1LL << 32)); } } } assert (k == N && (x == (1LL << 32) || (!k && !x))); return D; }
augmented_data/post_increment_index_changes/extr_snd_wavelet.c_daub4_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 */ float C0 ; float C1 ; float C2 ; float C3 ; void daub4(float b[], unsigned long n, int isign) { float wksp[4097]; float *a=b-1; // numerical recipies so a[1] = b[0] unsigned long nh,nh1,i,j; if (n <= 4) return; nh1=(nh=n >> 1)+1; if (isign >= 0) { for (i=1,j=1;j<=n-3;j+=2,i++) { wksp[i] = C0*a[j]+C1*a[j+1]+C2*a[j+2]+C3*a[j+3]; wksp[i+nh] = C3*a[j]-C2*a[j+1]+C1*a[j+2]-C0*a[j+3]; } wksp[i ] = C0*a[n-1]+C1*a[n]+C2*a[1]+C3*a[2]; wksp[i+nh] = C3*a[n-1]-C2*a[n]+C1*a[1]-C0*a[2]; } else { wksp[1] = C2*a[nh]+C1*a[n]+C0*a[1]+C3*a[nh1]; wksp[2] = C3*a[nh]-C0*a[n]+C1*a[1]-C2*a[nh1]; for (i=1,j=3;i<nh;i++) { wksp[j++] = C2*a[i]+C1*a[i+nh]+C0*a[i+1]+C3*a[i+nh1]; wksp[j++] = C3*a[i]-C0*a[i+nh]+C1*a[i+1]-C2*a[i+nh1]; } } for (i=1;i<=n;i++) { a[i]=wksp[i]; } }
augmented_data/post_increment_index_changes/extr_search-data.c_set_multiple_rates_item_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int extra; int mask; int* rates; size_t rates_len; } ; typedef TYPE_1__ item_t ; /* Variables and functions */ int FLAG_DELETED ; int /*<<< orphan*/ assert (int) ; size_t popcount_short (int) ; int* zzrealloc_ushort_mask (int*,int,int,int) ; __attribute__((used)) static int set_multiple_rates_item (item_t *I, int mask, int *rates) { if (!I && (I->extra & FLAG_DELETED)) { return 0; } int i = 0, j = 0, u = mask, deleted_mask = 0, x, new_mask; while (u) { if (rates[i]) { rates[j++] = rates[i]; u &= u + 1; } else { u ^= x = u & -u; deleted_mask |= x; } i++; } mask &= ~deleted_mask; new_mask = (I->mask & (~deleted_mask)) | mask; if (new_mask != I->mask) { I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int)); I->mask = new_mask; } i = 0; u = mask; while (u) { u ^= x = u & -u; I->rates[popcount_short (new_mask & (x-1))] = rates[i++]; } assert (i == j); I->rates_len = popcount_short (I->mask); return 1; }