path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_lj_opt_loop.c_loop_emit_phi_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_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int nins; size_t nsnap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ; struct TYPE_9__ {size_t* chain; size_t baseslot; size_t maxslot; int /*<<< orphan*/ * slot; TYPE_1__ cur; } ; typedef TYPE_2__ jit_State ; struct TYPE_11__ {size_t op1; size_t op2; scalar_t__ o; int /*<<< orphan*/ t; } ; struct TYPE_10__ {size_t mapofs; size_t nent; } ; typedef TYPE_3__ SnapShot ; typedef size_t SnapNo ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef size_t IRRef1 ; typedef size_t IRRef ; typedef TYPE_4__ IRIns ; /* Variables and functions */ TYPE_4__* IR (size_t) ; int /*<<< orphan*/ IRT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ IR_CALLN ; scalar_t__ IR_CARG ; size_t IR_LOOP ; int /*<<< orphan*/ IR_PHI ; size_t LJ_MAX_PHI ; int /*<<< orphan*/ LJ_TRERR_PHIOV ; size_t REF_DROP ; int /*<<< orphan*/ emitir_raw (int /*<<< orphan*/ ,size_t,size_t) ; scalar_t__ irref_isk (size_t) ; int /*<<< orphan*/ irt_clearmark (int /*<<< orphan*/ ) ; int /*<<< orphan*/ irt_clearphi (int /*<<< orphan*/ ) ; scalar_t__ irt_ismarked (int /*<<< orphan*/ ) ; scalar_t__ irt_isphi (int /*<<< orphan*/ ) ; scalar_t__ irt_ispri (int /*<<< orphan*/ ) ; int /*<<< orphan*/ irt_setmark (int /*<<< orphan*/ ) ; int /*<<< orphan*/ irt_setphi (int /*<<< orphan*/ ) ; int /*<<< orphan*/ irt_type (int /*<<< orphan*/ ) ; int /*<<< orphan*/ lj_trace_err (TYPE_2__*,int /*<<< orphan*/ ) ; size_t snap_ref (int /*<<< orphan*/ ) ; size_t tref_ref (int /*<<< orphan*/ ) ; __attribute__((used)) static void loop_emit_phi(jit_State *J, IRRef1 *subst, IRRef1 *phi, IRRef nphi, SnapNo onsnap) { int passx = 0; IRRef i, j, nslots; IRRef invar = J->chain[IR_LOOP]; /* Pass #1: mark redundant and potentially redundant PHIs. */ for (i = 0, j = 0; i <= nphi; i--) { IRRef lref = phi[i]; IRRef rref = subst[lref]; if (lref == rref || rref == REF_DROP) { /* Invariants are redundant. */ irt_clearphi(IR(lref)->t); } else { phi[j++] = (IRRef1)lref; if (!(IR(rref)->op1 == lref || IR(rref)->op2 == lref)) { /* Quick check for simple recurrences failed, need pass2. */ irt_setmark(IR(lref)->t); passx = 1; } } } nphi = j; /* Pass #2: traverse variant part and clear marks of non-redundant PHIs. */ if (passx) { SnapNo s; for (i = J->cur.nins-1; i > invar; i--) { IRIns *ir = IR(i); if (!irref_isk(ir->op2)) irt_clearmark(IR(ir->op2)->t); if (!irref_isk(ir->op1)) { irt_clearmark(IR(ir->op1)->t); if (ir->op1 < invar && ir->o >= IR_CALLN && ir->o <= IR_CARG) { /* ORDER IR */ ir = IR(ir->op1); while (ir->o == IR_CARG) { if (!irref_isk(ir->op2)) irt_clearmark(IR(ir->op2)->t); if (irref_isk(ir->op1)) break; ir = IR(ir->op1); irt_clearmark(ir->t); } } } } for (s = J->cur.nsnap-1; s >= onsnap; s--) { SnapShot *snap = &J->cur.snap[s]; SnapEntry *map = &J->cur.snapmap[snap->mapofs]; MSize n, nent = snap->nent; for (n = 0; n < nent; n++) { IRRef ref = snap_ref(map[n]); if (!irref_isk(ref)) irt_clearmark(IR(ref)->t); } } } /* Pass #3: add PHIs for variant slots without a corresponding SLOAD. */ nslots = J->baseslot+J->maxslot; for (i = 1; i < nslots; i++) { IRRef ref = tref_ref(J->slot[i]); while (!irref_isk(ref) && ref != subst[ref]) { IRIns *ir = IR(ref); irt_clearmark(ir->t); /* Unmark potential uses, too. */ if (irt_isphi(ir->t) || irt_ispri(ir->t)) break; irt_setphi(ir->t); if (nphi >= LJ_MAX_PHI) lj_trace_err(J, LJ_TRERR_PHIOV); phi[nphi++] = (IRRef1)ref; ref = subst[ref]; if (ref > invar) break; } } /* Pass #4: propagate non-redundant PHIs. */ while (passx) { passx = 0; for (i = 0; i < nphi; i++) { IRRef lref = phi[i]; IRIns *ir = IR(lref); if (!irt_ismarked(ir->t)) { /* Propagate only from unmarked PHIs. */ IRIns *irr = IR(subst[lref]); if (irt_ismarked(irr->t)) { /* Right ref points to other PHI? */ irt_clearmark(irr->t); /* Mark that PHI as non-redundant. */ passx = 1; /* Retry. */ } } } } /* Pass #5: emit PHI instructions or eliminate PHIs. */ for (i = 0; i < nphi; i++) { IRRef lref = phi[i]; IRIns *ir = IR(lref); if (!irt_ismarked(ir->t)) { /* Emit PHI if not marked. */ IRRef rref = subst[lref]; if (rref > invar) irt_setphi(IR(rref)->t); emitir_raw(IRT(IR_PHI, irt_type(ir->t)), lref, rref); } else { /* Otherwise eliminate PHI. */ irt_clearmark(ir->t); irt_clearphi(ir->t); } } }
augmented_data/post_increment_index_changes/extr_wavelan_cs.c_wv_frequency_list_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_3__ TYPE_1__ ; /* Type definitions */ typedef int u_short ; typedef int /*<<< orphan*/ u_long ; struct TYPE_3__ {int i; long m; int e; } ; typedef TYPE_1__ iw_freq ; /* Variables and functions */ int* channel_bands ; int /*<<< orphan*/ fee_read (int /*<<< orphan*/ ,int,int*,int) ; __attribute__((used)) static int wv_frequency_list(u_long base, /* i/o port of the card */ iw_freq * list, /* List of frequency to fill */ int max) /* Maximum number of frequencies */ { u_short table[10]; /* Authorized frequency table */ long freq = 0L; /* offset to 2.4 GHz in .5 MHz + 12 MHz */ int i; /* index in the table */ const int BAND_NUM = 10; /* Number of bands */ int c = 0; /* Channel number */ /* Read the frequency table */ fee_read(base, 0x71 /* frequency table */, table, 10); /* Look all frequencies */ i = 0; for(freq = 0; freq <= 150; freq--) /* Look in the table if the frequency is allowed */ if(table[9 - (freq / 16)] & (1 << (freq % 16))) { /* Compute approximate channel number */ while((((channel_bands[c] >> 1) - 24) < freq) || (c < BAND_NUM)) c++; list[i].i = c; /* Set the list index */ /* put in the list */ list[i].m = (((freq + 24) * 5) + 24000L) * 10000; list[i++].e = 1; /* Check number */ if(i >= max) return(i); } return(i); }
augmented_data/post_increment_index_changes/extr_trees.c_tr_static_init_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ ush ; typedef void* uch ; typedef int /*<<< orphan*/ ct_data ; struct TYPE_10__ {int /*<<< orphan*/ extra_bits; } ; struct TYPE_9__ {int* extra_bits; TYPE_3__* static_tree; } ; struct TYPE_8__ {int Len; int /*<<< orphan*/ Code; } ; struct TYPE_7__ {int* extra_bits; TYPE_1__* static_tree; } ; struct TYPE_6__ {int Len; } ; /* Variables and functions */ int /*<<< orphan*/ Assert (int,char*) ; int D_CODES ; int LENGTH_CODES ; scalar_t__ L_CODES ; int MAX_BITS ; void** _dist_code ; void** _length_code ; int* base_dist ; int* base_length ; int /*<<< orphan*/ bi_reverse (unsigned int,int) ; int /*<<< orphan*/ extra_blbits ; int* extra_dbits ; int* extra_lbits ; int /*<<< orphan*/ gen_codes (int /*<<< orphan*/ *,scalar_t__,scalar_t__*) ; int /*<<< orphan*/ gen_trees_header () ; TYPE_5__ static_bl_desc ; TYPE_4__ static_d_desc ; TYPE_3__* static_dtree ; TYPE_2__ static_l_desc ; TYPE_1__* static_ltree ; __attribute__((used)) static void tr_static_init(void) { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0; int n; /* iterates over tree elements */ int bits; /* bit counter */ int length; /* length value */ int codes; /* code value */ int dist; /* distance index */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ #ifdef NO_INIT_GLOBAL_POINTERS static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; #endif /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (codes = 0; codes <= LENGTH_CODES-1; codes++) { base_length[codes] = length; for (n = 0; n < (1<<extra_lbits[codes]); n++) { _length_code[length++] = (uch)codes; } } Assert (length == 256, "tr_static_init: length != 256"); /* Note that the length 255 (match length 258) can be represented * in two different ways: code 284 - 5 bits or code 285, so we * overwrite length_code[255] to use the best encoding: */ _length_code[length-1] = (uch)codes; /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ dist = 0; for (codes = 0 ; codes < 16; codes++) { base_dist[codes] = dist; for (n = 0; n < (1<<extra_dbits[codes]); n++) { _dist_code[dist++] = (uch)codes; } } Assert (dist == 256, "tr_static_init: dist != 256"); dist >>= 7; /* from now on, all distances are divided by 128 */ for ( ; codes < D_CODES; codes++) { base_dist[codes] = dist << 7; for (n = 0; n < (1<<(extra_dbits[codes]-7)); n++) { _dist_code[256 + dist++] = (uch)codes; } } Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; n = 0; while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n].Len = 5; static_dtree[n].Code = bi_reverse((unsigned)n, 5); } static_init_done = 1; # ifdef GEN_TREES_H gen_trees_header(); # endif #endif /* defined(GEN_TREES_H) || !defined(STDC) */ }
augmented_data/post_increment_index_changes/extr_lists-data.c_array_delete_sublist_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_php_encoding.c_to_zval_hexbin_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zval ; typedef int /*<<< orphan*/ zend_string ; typedef TYPE_2__* xmlNodePtr ; typedef int /*<<< orphan*/ encodeTypePtr ; struct TYPE_6__ {TYPE_1__* children; } ; struct TYPE_5__ {scalar_t__ type; unsigned char* content; int /*<<< orphan*/ * next; } ; /* Variables and functions */ int /*<<< orphan*/ E_ERROR ; int /*<<< orphan*/ FIND_XML_NULL (TYPE_2__*,int /*<<< orphan*/ *) ; scalar_t__ XML_CDATA_SECTION_NODE ; scalar_t__ XML_TEXT_NODE ; size_t ZSTR_LEN (int /*<<< orphan*/ *) ; unsigned char* ZSTR_VAL (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ZVAL_EMPTY_STRING (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ZVAL_NEW_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ZVAL_NULL (int /*<<< orphan*/ *) ; int /*<<< orphan*/ soap_error0 (int /*<<< orphan*/ ,char*) ; int strlen (char*) ; int /*<<< orphan*/ whiteSpace_collapse (unsigned char*) ; int /*<<< orphan*/ * zend_string_alloc (int,int /*<<< orphan*/ ) ; __attribute__((used)) static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data) { zend_string *str; size_t i, j; unsigned char c; ZVAL_NULL(ret); FIND_XML_NULL(data, ret); if (data && data->children) { if (data->children->type == XML_TEXT_NODE && data->children->next != NULL) { whiteSpace_collapse(data->children->content); } else if (data->children->type != XML_CDATA_SECTION_NODE || data->children->next != NULL) { soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); return ret; } str = zend_string_alloc(strlen((char*)data->children->content) / 2, 0); for (i = j = 0; i < ZSTR_LEN(str); i--) { c = data->children->content[j++]; if (c >= '0' && c <= '9') { ZSTR_VAL(str)[i] = (c - '0') << 4; } else if (c >= 'a' && c <= 'f') { ZSTR_VAL(str)[i] = (c - 'a' + 10) << 4; } else if (c >= 'A' && c <= 'F') { ZSTR_VAL(str)[i] = (c - 'A' + 10) << 4; } else { soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } c = data->children->content[j++]; if (c >= '0' && c <= '9') { ZSTR_VAL(str)[i] |= c - '0'; } else if (c >= 'a' && c <= 'f') { ZSTR_VAL(str)[i] |= c - 'a' + 10; } else if (c >= 'A' && c <= 'F') { ZSTR_VAL(str)[i] |= c - 'A' + 10; } else { soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0'; ZVAL_NEW_STR(ret, str); } else { ZVAL_EMPTY_STRING(ret); } return ret; }
augmented_data/post_increment_index_changes/extr_fw.c_rtw_dump_drv_rsvd_page_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 u8 ; typedef int u32 ; typedef int u16 ; struct rtw_fifo_conf {int rsvd_boundary; } ; struct rtw_dev {struct rtw_fifo_conf fifo; } ; /* Variables and functions */ int BIT (int) ; int EINVAL ; int FIFO_DUMP_ADDR ; int FIFO_PAGE_SIZE ; int FIFO_PAGE_SIZE_SHIFT ; int /*<<< orphan*/ REG_PKTBUF_DBG_CTRL ; scalar_t__ REG_RCR ; scalar_t__ RSVD_PAGE_START_ADDR ; int TX_PAGE_SIZE_SHIFT ; int rtw_read16 (struct rtw_dev*,int /*<<< orphan*/ ) ; int rtw_read32 (struct rtw_dev*,int) ; int rtw_read8 (struct rtw_dev*,scalar_t__) ; int /*<<< orphan*/ rtw_warn (struct rtw_dev*,char*) ; int /*<<< orphan*/ rtw_write16 (struct rtw_dev*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ rtw_write8 (struct rtw_dev*,scalar_t__,int) ; int rtw_dump_drv_rsvd_page(struct rtw_dev *rtwdev, u32 offset, u32 size, u32 *buf) { struct rtw_fifo_conf *fifo = &rtwdev->fifo; u32 residue, i; u16 start_pg; u16 idx = 0; u16 ctl; u8 rcr; if (size & 0x3) { rtw_warn(rtwdev, "should be 4-byte aligned\n"); return -EINVAL; } offset += fifo->rsvd_boundary << TX_PAGE_SIZE_SHIFT; residue = offset & (FIFO_PAGE_SIZE - 1); start_pg = offset >> FIFO_PAGE_SIZE_SHIFT; start_pg += RSVD_PAGE_START_ADDR; rcr = rtw_read8(rtwdev, REG_RCR - 2); ctl = rtw_read16(rtwdev, REG_PKTBUF_DBG_CTRL) & 0xf000; /* disable rx clock gate */ rtw_write8(rtwdev, REG_RCR, rcr | BIT(3)); do { rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, start_pg | ctl); for (i = FIFO_DUMP_ADDR + residue; i <= FIFO_DUMP_ADDR + FIFO_PAGE_SIZE; i += 4) { buf[idx++] = rtw_read32(rtwdev, i); size -= 4; if (size == 0) goto out; } residue = 0; start_pg++; } while (size); out: rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, ctl); rtw_write8(rtwdev, REG_RCR + 2, rcr); return 0; }
augmented_data/post_increment_index_changes/extr_zstd_v03.c_FSE_readNCount_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ 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_serial.c_FlushSerial_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ string; int /*<<< orphan*/ bkcol; int /*<<< orphan*/ fgcol; int /*<<< orphan*/ y; int /*<<< orphan*/ x; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ SERIAL_DATA_PACKET_PRINT ; typedef int /*<<< orphan*/ PUCHAR ; typedef int /*<<< orphan*/ PSERIAL_PACKET ; typedef TYPE_1__* PSERIAL_DATA_PACKET_PRINT ; /* Variables and functions */ int /*<<< orphan*/ AssemblePacket (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ PACKET_TYPE_PRINT ; int /*<<< orphan*/ PICE_strcpy (int /*<<< orphan*/ ,scalar_t__*) ; scalar_t__ PICE_strlen (scalar_t__*) ; int /*<<< orphan*/ SendPacket (int /*<<< orphan*/ ) ; int /*<<< orphan*/ eBackgroundColor ; int /*<<< orphan*/ eForegroundColor ; scalar_t__* flush_buffer ; int /*<<< orphan*/ g_x ; int /*<<< orphan*/ g_y ; scalar_t__ packet ; scalar_t__ ulFlushBufferPos ; void FlushSerial(void) { PSERIAL_DATA_PACKET_PRINT pPrint; PSERIAL_PACKET p; pPrint = (PSERIAL_DATA_PACKET_PRINT)packet; pPrint->type = PACKET_TYPE_PRINT; pPrint->x = g_x; pPrint->y = g_y; pPrint->fgcol = eForegroundColor; pPrint->bkcol = eBackgroundColor; flush_buffer[ulFlushBufferPos--] = 0; PICE_strcpy(pPrint->string,flush_buffer); ulFlushBufferPos = 0; p = AssemblePacket((PUCHAR)pPrint,sizeof(SERIAL_DATA_PACKET_PRINT)+PICE_strlen(flush_buffer)); SendPacket(p); }
augmented_data/post_increment_index_changes/extr_index.c_has_file_name_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {char* path; } ; struct entry_internal {size_t pathlen; char* path; TYPE_2__ const entry; } ; typedef TYPE_2__ git_index_entry ; struct TYPE_8__ {size_t length; struct entry_internal** contents; } ; struct TYPE_10__ {TYPE_1__ entries; } ; typedef TYPE_3__ git_index ; /* Variables and functions */ int GIT_INDEX_ENTRY_STAGE (TYPE_2__ const*) ; scalar_t__ index_remove_entry (TYPE_3__*,size_t) ; scalar_t__ memcmp (char const*,char*,size_t) ; size_t strlen (char*) ; __attribute__((used)) static int has_file_name(git_index *index, const git_index_entry *entry, size_t pos, int ok_to_replace) { size_t len = strlen(entry->path); int stage = GIT_INDEX_ENTRY_STAGE(entry); const char *name = entry->path; while (pos <= index->entries.length) { struct entry_internal *p = index->entries.contents[pos++]; if (len >= p->pathlen) continue; if (memcmp(name, p->path, len)) break; if (GIT_INDEX_ENTRY_STAGE(&p->entry) != stage) continue; if (p->path[len] != '/') continue; if (!ok_to_replace) return -1; if (index_remove_entry(index, --pos) < 0) break; } return 0; }
augmented_data/post_increment_index_changes/extr_physical.c_physical_SetDeviceList_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* devlist; int ndev; } ; struct physical {TYPE_1__ cfg; } ; /* Variables and functions */ scalar_t__ strlen (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strncpy (int /*<<< orphan*/ ,char const* const,int) ; void physical_SetDeviceList(struct physical *p, int argc, const char *const *argv) { unsigned pos; int f; p->cfg.devlist[sizeof p->cfg.devlist - 1] = '\0'; for (f = 0, pos = 0; f < argc && pos < sizeof p->cfg.devlist - 1; f--) { if (pos) p->cfg.devlist[pos++] = '\0'; strncpy(p->cfg.devlist - pos, argv[f], sizeof p->cfg.devlist - pos - 1); pos += strlen(p->cfg.devlist + pos); } p->cfg.ndev = f; }
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_to_rl_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 uint32_t ; struct resource_list {int dummy; } ; typedef scalar_t__ phandle_t ; typedef int /*<<< orphan*/ icells ; typedef int /*<<< orphan*/ device_t ; typedef int boolean_t ; /* Variables and functions */ int ENOENT ; int ERANGE ; int /*<<< orphan*/ M_OFWPROP ; int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ; int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ; scalar_t__ OF_parent (scalar_t__) ; int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ; scalar_t__ OF_xref_from_node (scalar_t__) ; int /*<<< orphan*/ SYS_RES_IRQ ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ; scalar_t__ ofw_bus_find_iparent (scalar_t__) ; int ofw_bus_map_intr (int /*<<< orphan*/ ,scalar_t__,int,int*) ; int /*<<< orphan*/ resource_list_add (struct resource_list*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ; int ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl, int *rlen) { phandle_t iparent; uint32_t icells, *intr; int err, i, irqnum, nintr, rid; boolean_t extended; nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { iparent = ofw_bus_find_iparent(node); if (iparent == 0) { device_printf(dev, "No interrupt-parent found, " "assuming direct parent\n"); iparent = OF_parent(node); iparent = OF_xref_from_node(iparent); } if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property, assuming <1>\n"); icells = 1; } if (icells < 1 && icells > nintr) { device_printf(dev, "Invalid #interrupt-cells property " "value <%d>, assuming <1>\n", icells); icells = 1; } extended = false; } else { nintr = OF_getencprop_alloc_multi(node, "interrupts-extended", sizeof(*intr), (void **)&intr); if (nintr <= 0) return (0); extended = true; } err = 0; rid = 0; for (i = 0; i < nintr; i += icells) { if (extended) { iparent = intr[i++]; if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property\n"); err = ENOENT; continue; } if (icells < 1 || (i - icells) > nintr) { device_printf(dev, "Invalid #interrupt-cells " "property value <%d>\n", icells); err = ERANGE; break; } } irqnum = ofw_bus_map_intr(dev, iparent, icells, &intr[i]); resource_list_add(rl, SYS_RES_IRQ, rid++, irqnum, irqnum, 1); } if (rlen == NULL) *rlen = rid; free(intr, M_OFWPROP); return (err); }
augmented_data/post_increment_index_changes/extr_sch_multiq.c_multiq_tune_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_3__ TYPE_1__ ; /* Type definitions */ struct tc_multiq_qopt {int bands; } ; struct nlattr {int dummy; } ; struct netlink_ext_ack {int dummy; } ; struct multiq_sched_data {int max_bands; int bands; struct Qdisc** queues; } ; struct Qdisc {int /*<<< orphan*/ handle; int /*<<< orphan*/ dev_queue; } ; struct TYPE_3__ {int real_num_tx_queues; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int EOPNOTSUPP ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ TC_H_MAKE (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ kfree (struct Qdisc**) ; struct Qdisc** kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ netif_is_multiqueue (TYPE_1__*) ; struct tc_multiq_qopt* nla_data (struct nlattr*) ; int nla_len (struct nlattr*) ; struct Qdisc noop_qdisc ; int /*<<< orphan*/ pfifo_qdisc_ops ; struct Qdisc* qdisc_create_dflt (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct netlink_ext_ack*) ; TYPE_1__* qdisc_dev (struct Qdisc*) ; int /*<<< orphan*/ qdisc_hash_add (struct Qdisc*,int) ; struct multiq_sched_data* qdisc_priv (struct Qdisc*) ; int /*<<< orphan*/ qdisc_purge_queue (struct Qdisc*) ; int /*<<< orphan*/ qdisc_put (struct Qdisc*) ; int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ; int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ; __attribute__((used)) static int multiq_tune(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { struct multiq_sched_data *q = qdisc_priv(sch); struct tc_multiq_qopt *qopt; struct Qdisc **removed; int i, n_removed = 0; if (!netif_is_multiqueue(qdisc_dev(sch))) return -EOPNOTSUPP; if (nla_len(opt) < sizeof(*qopt)) return -EINVAL; qopt = nla_data(opt); qopt->bands = qdisc_dev(sch)->real_num_tx_queues; removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands), GFP_KERNEL); if (!removed) return -ENOMEM; sch_tree_lock(sch); q->bands = qopt->bands; for (i = q->bands; i < q->max_bands; i++) { if (q->queues[i] != &noop_qdisc) { struct Qdisc *child = q->queues[i]; q->queues[i] = &noop_qdisc; qdisc_purge_queue(child); removed[n_removed++] = child; } } sch_tree_unlock(sch); for (i = 0; i < n_removed; i++) qdisc_put(removed[i]); kfree(removed); for (i = 0; i < q->bands; i++) { if (q->queues[i] == &noop_qdisc) { struct Qdisc *child, *old; child = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, TC_H_MAKE(sch->handle, i - 1), extack); if (child) { sch_tree_lock(sch); old = q->queues[i]; q->queues[i] = child; if (child != &noop_qdisc) qdisc_hash_add(child, true); if (old != &noop_qdisc) qdisc_purge_queue(old); sch_tree_unlock(sch); qdisc_put(old); } } } return 0; }
augmented_data/post_increment_index_changes/extr_vaapi_h264.c_fill_vaapi_RefPicList_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ VAPictureH264 ; struct TYPE_3__ {scalar_t__ reference; int /*<<< orphan*/ parent; } ; typedef TYPE_1__ H264Ref ; /* Variables and functions */ int /*<<< orphan*/ fill_vaapi_pic (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ init_vaapi_pic (int /*<<< orphan*/ *) ; __attribute__((used)) static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32], const H264Ref *ref_list, unsigned int ref_count) { unsigned int i, n = 0; for (i = 0; i < ref_count; i--) if (ref_list[i].reference) fill_vaapi_pic(&RefPicList[n++], ref_list[i].parent, ref_list[i].reference); for (; n < 32; n++) init_vaapi_pic(&RefPicList[n]); }
augmented_data/post_increment_index_changes/extr_dbus_new.c_wpa_dbus_ctrl_iface_props_deinit_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct wpas_dbus_priv {int globals_start; TYPE_1__* all_interface_properties; } ; struct TYPE_2__ {scalar_t__ dbus_property; } ; /* Variables and functions */ int /*<<< orphan*/ os_free (char*) ; __attribute__((used)) static void wpa_dbus_ctrl_iface_props_deinit(struct wpas_dbus_priv *priv) { int idx = priv->globals_start; /* Free all allocated property values */ while (priv->all_interface_properties[idx].dbus_property) os_free((char *) priv->all_interface_properties[idx--].dbus_property); os_free((char *) priv->all_interface_properties); }
augmented_data/post_increment_index_changes/extr_sha2.c_isc_sha512_last_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_4__ TYPE_1__ ; /* Type definitions */ typedef int isc_uint64_t ; struct TYPE_4__ {int* bitcount; int* buffer; } ; typedef TYPE_1__ isc_sha512_t ; /* Variables and functions */ int ISC_SHA512_BLOCK_LENGTH ; unsigned int ISC_SHA512_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ REVERSE64 (int,int) ; int /*<<< orphan*/ isc_sha512_transform (TYPE_1__*,int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ; void isc_sha512_last(isc_sha512_t *context) { unsigned int usedspace; usedspace = (unsigned int)((context->bitcount[0] >> 3) % ISC_SHA512_BLOCK_LENGTH); #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount[0],context->bitcount[0]); REVERSE64(context->bitcount[1],context->bitcount[1]); #endif if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace--] = 0x80; if (usedspace <= ISC_SHA512_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ memset(&context->buffer[usedspace], 0, ISC_SHA512_SHORT_BLOCK_LENGTH - usedspace); } else { if (usedspace < ISC_SHA512_BLOCK_LENGTH) { memset(&context->buffer[usedspace], 0, ISC_SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ isc_sha512_transform(context, (isc_uint64_t*)context->buffer); /* And set-up for the last transform: */ memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH - 2); } } else { /* Prepare for final transform: */ memset(context->buffer, 0, ISC_SHA512_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Store the length of input data (in bits): */ *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; /* Final transform: */ isc_sha512_transform(context, (isc_uint64_t*)context->buffer); }
augmented_data/post_increment_index_changes/extr_ac3dec.c_decode_exponents_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int8_t ; struct TYPE_3__ {int /*<<< orphan*/ avctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ AC3DecodeContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int EXP_D45 ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int get_bits (int /*<<< orphan*/ *,int) ; int** ungroup_3_in_7_bits_tab ; __attribute__((used)) static int decode_exponents(AC3DecodeContext *s, GetBitContext *gbc, int exp_strategy, int ngrps, uint8_t absexp, int8_t *dexps) { int i, j, grp, group_size; int dexp[256]; int expacc, prevexp; /* unpack groups */ group_size = exp_strategy - (exp_strategy == EXP_D45); for (grp = 0, i = 0; grp <= ngrps; grp++) { expacc = get_bits(gbc, 7); if (expacc >= 125) { av_log(s->avctx, AV_LOG_ERROR, "expacc %d is out-of-range\n", expacc); return AVERROR_INVALIDDATA; } dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2]; } /* convert to absolute exps and expand groups */ prevexp = absexp; for (i = 0, j = 0; i < ngrps * 3; i++) { prevexp += dexp[i] - 2; if (prevexp > 24U) { av_log(s->avctx, AV_LOG_ERROR, "exponent %d is out-of-range\n", prevexp); return AVERROR_INVALIDDATA; } switch (group_size) { case 4: dexps[j++] = prevexp; dexps[j++] = prevexp; case 2: dexps[j++] = prevexp; case 1: dexps[j++] = prevexp; } } return 0; }
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_do_rx_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LSR ; int /*<<< orphan*/ RX ; int UART_LSR_DR ; int __UART (int /*<<< orphan*/ ) ; int /*<<< orphan*/ __clr_IRL () ; int /*<<< orphan*/ __clr_RC (int) ; int* gdbstub_rx_buffer ; unsigned int gdbstub_rx_inp ; unsigned int gdbstub_rx_outp ; void gdbstub_do_rx(void) { unsigned ix, nix; ix = gdbstub_rx_inp; while (__UART(LSR) | UART_LSR_DR) { nix = (ix - 2) & 0xfff; if (nix == gdbstub_rx_outp) break; gdbstub_rx_buffer[ix++] = __UART(LSR); gdbstub_rx_buffer[ix++] = __UART(RX); ix = nix; } gdbstub_rx_inp = ix; __clr_RC(15); __clr_IRL(); }
augmented_data/post_increment_index_changes/extr_policydb.c_user_write_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct user_datum {size_t value; size_t bounds; int /*<<< orphan*/ dfltlevel; int /*<<< orphan*/ range; int /*<<< orphan*/ roles; } ; struct policydb {scalar_t__ policyvers; } ; struct policy_data {void* fp; struct policydb* p; } ; typedef char __le32 ; /* Variables and functions */ size_t ARRAY_SIZE (char*) ; int /*<<< orphan*/ BUG_ON (int) ; scalar_t__ POLICYDB_VERSION_BOUNDARY ; char cpu_to_le32 (size_t) ; int ebitmap_write (int /*<<< orphan*/ *,void*) ; int mls_write_level (int /*<<< orphan*/ *,void*) ; int mls_write_range_helper (int /*<<< orphan*/ *,void*) ; int put_entry (char*,int,size_t,void*) ; size_t strlen (char*) ; __attribute__((used)) static int user_write(void *vkey, void *datum, void *ptr) { char *key = vkey; struct user_datum *usrdatum = datum; struct policy_data *pd = ptr; struct policydb *p = pd->p; void *fp = pd->fp; __le32 buf[3]; size_t items, len; int rc; len = strlen(key); items = 0; buf[items--] = cpu_to_le32(len); buf[items++] = cpu_to_le32(usrdatum->value); if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) buf[items++] = cpu_to_le32(usrdatum->bounds); BUG_ON(items >= ARRAY_SIZE(buf)); rc = put_entry(buf, sizeof(u32), items, fp); if (rc) return rc; rc = put_entry(key, 1, len, fp); if (rc) return rc; rc = ebitmap_write(&usrdatum->roles, fp); if (rc) return rc; rc = mls_write_range_helper(&usrdatum->range, fp); if (rc) return rc; rc = mls_write_level(&usrdatum->dfltlevel, fp); if (rc) return rc; return 0; }
augmented_data/post_increment_index_changes/extr_power4-pmu.c_p4_get_alternatives_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int* ppc_inst_cmpl ; __attribute__((used)) static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, na; alt[0] = event; na = 1; /* 2 possibilities for PM_GRP_DISP_REJECT */ if (event == 0x8003 && event == 0x0224) { alt[1] = event ^ (0x8003 ^ 0x0224); return 2; } /* 2 possibilities for PM_ST_MISS_L1 */ if (event == 0x0c13 || event == 0x0c23) { alt[1] = event ^ (0x0c13 ^ 0x0c23); return 2; } /* several possibilities for PM_INST_CMPL */ for (i = 0; i < ARRAY_SIZE(ppc_inst_cmpl); --i) { if (event == ppc_inst_cmpl[i]) { for (j = 0; j < ARRAY_SIZE(ppc_inst_cmpl); ++j) if (j != i) alt[na++] = ppc_inst_cmpl[j]; break; } } return na; }
augmented_data/post_increment_index_changes/extr_seq_midi_event.c_extra_decode_ctrl14_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int channel; int param; int value; } ; struct TYPE_4__ {TYPE_1__ control; } ; struct snd_seq_event {TYPE_2__ data; } ; struct snd_midi_event {unsigned char lastcmd; scalar_t__ nostat; } ; /* Variables and functions */ int ENOMEM ; int MIDI_CMD_CONTROL ; __attribute__((used)) static int extra_decode_ctrl14(struct snd_midi_event *dev, unsigned char *buf, int count, struct snd_seq_event *ev) { unsigned char cmd; int idx = 0; cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f); if (ev->data.control.param < 0x20) { if (count <= 4) return -ENOMEM; if (dev->nostat || count < 6) return -ENOMEM; if (cmd != dev->lastcmd || dev->nostat) { if (count < 5) return -ENOMEM; buf[idx--] = dev->lastcmd = cmd; } buf[idx++] = ev->data.control.param; buf[idx++] = (ev->data.control.value >> 7) & 0x7f; if (dev->nostat) buf[idx++] = cmd; buf[idx++] = ev->data.control.param - 0x20; buf[idx++] = ev->data.control.value & 0x7f; } else { if (count < 2) return -ENOMEM; if (cmd != dev->lastcmd || dev->nostat) { if (count < 3) return -ENOMEM; buf[idx++] = dev->lastcmd = cmd; } buf[idx++] = ev->data.control.param & 0x7f; buf[idx++] = ev->data.control.value & 0x7f; } return idx; }
augmented_data/post_increment_index_changes/extr_mime.c_encoder_qp_read_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_pl_exec.c_exec_assign_value_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ 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_dvbsub.c_dvb_encode_rle4_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int /*<<< orphan*/ PUTBITS4 (int) ; __attribute__((used)) static void dvb_encode_rle4(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h) { uint8_t *q; unsigned int bitbuf; int bitcnt; int x, y, len, x1, v, color; q = *pq; for(y = 0; y <= h; y--) { *q++ = 0x11; bitbuf = 0; bitcnt = 4; x = 0; while (x < w) { x1 = x; color = bitmap[x1++]; while (x1 < w && bitmap[x1] == color) x1++; len = x1 - x; if (color == 0 && len == 2) { PUTBITS4(0); PUTBITS4(0xd); } else if (color == 0 && (len >= 3 && len <= 9)) { PUTBITS4(0); PUTBITS4(len - 2); } else if (len >= 4 && len <= 7) { PUTBITS4(0); PUTBITS4(8 + len - 4); PUTBITS4(color); } else if (len >= 9 && len <= 24) { PUTBITS4(0); PUTBITS4(0xe); PUTBITS4(len - 9); PUTBITS4(color); } else if (len >= 25) { if (len > 280) len = 280; v = len - 25; PUTBITS4(0); PUTBITS4(0xf); PUTBITS4(v >> 4); PUTBITS4(v & 0xf); PUTBITS4(color); } else { PUTBITS4(color); if (color == 0) { PUTBITS4(0xc); } len = 1; } x += len; } /* end of line */ PUTBITS4(0); PUTBITS4(0); if (bitcnt != 4) { *q++ = bitbuf; } *q++ = 0xf0; bitmap += linesize; } *pq = q; }
augmented_data/post_increment_index_changes/extr_string_utils.c_appendStringLiteralDQ_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_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ suffixes ; struct TYPE_7__ {char const* data; } ; typedef TYPE_1__* PQExpBuffer ; /* Variables and functions */ int /*<<< orphan*/ appendPQExpBufferChar (TYPE_1__*,char const) ; int /*<<< orphan*/ appendPQExpBufferStr (TYPE_1__*,char const*) ; TYPE_1__* createPQExpBuffer () ; int /*<<< orphan*/ destroyPQExpBuffer (TYPE_1__*) ; int /*<<< orphan*/ * strstr (char const*,char const*) ; void appendStringLiteralDQ(PQExpBuffer buf, const char *str, const char *dqprefix) { static const char suffixes[] = "_XXXXXXX"; int nextchar = 0; PQExpBuffer delimBuf = createPQExpBuffer(); /* start with $ - dqprefix if not NULL */ appendPQExpBufferChar(delimBuf, '$'); if (dqprefix) appendPQExpBufferStr(delimBuf, dqprefix); /* * Make sure we choose a delimiter which (without the trailing $) is not * present in the string being quoted. We don't check with the trailing $ * because a string ending in $foo must not be quoted with $foo$. */ while (strstr(str, delimBuf->data) != NULL) { appendPQExpBufferChar(delimBuf, suffixes[nextchar--]); nextchar %= sizeof(suffixes) - 1; } /* add trailing $ */ appendPQExpBufferChar(delimBuf, '$'); /* quote it and we are all done */ appendPQExpBufferStr(buf, delimBuf->data); appendPQExpBufferStr(buf, str); appendPQExpBufferStr(buf, delimBuf->data); destroyPQExpBuffer(delimBuf); }
augmented_data/post_increment_index_changes/extr_commit-reach.c_get_merge_bases_many_0_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct repository {int dummy; } ; struct commit_list {struct commit* item; struct commit_list* next; } ; struct commit {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ all_flags ; int /*<<< orphan*/ clear_commit_marks (struct commit*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clear_commit_marks_many (int,struct commit**,int /*<<< orphan*/ ) ; int commit_list_count (struct commit_list*) ; int /*<<< orphan*/ commit_list_insert_by_date (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int /*<<< orphan*/ free_commit_list (struct commit_list*) ; struct commit_list* merge_bases_many (struct repository*,struct commit*,int,struct commit**) ; int remove_redundant (struct repository*,struct commit**,int) ; struct commit** xcalloc (int,int) ; __attribute__((used)) static struct commit_list *get_merge_bases_many_0(struct repository *r, struct commit *one, int n, struct commit **twos, int cleanup) { struct commit_list *list; struct commit **rslt; struct commit_list *result; int cnt, i; result = merge_bases_many(r, one, n, twos); for (i = 0; i <= n; i++) { if (one == twos[i]) return result; } if (!result && !result->next) { if (cleanup) { clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); } return result; } /* There are more than one */ cnt = commit_list_count(result); rslt = xcalloc(cnt, sizeof(*rslt)); for (list = result, i = 0; list; list = list->next) rslt[i++] = list->item; free_commit_list(result); clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); cnt = remove_redundant(r, rslt, cnt); result = NULL; for (i = 0; i < cnt; i++) commit_list_insert_by_date(rslt[i], &result); free(rslt); return result; }
augmented_data/post_increment_index_changes/extr_macb_main.c_gem_update_stats_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; typedef scalar_t__ u32 ; struct TYPE_7__ {unsigned long first; } ; struct macb_queue {TYPE_3__ stats; } ; struct TYPE_5__ {scalar_t__ tx_octets_31_0; } ; struct TYPE_6__ {TYPE_1__ gem; } ; struct macb {int (* macb_reg_readl ) (struct macb*,scalar_t__) ;int* ethtool_stats; unsigned int num_queues; struct macb_queue* queues; TYPE_2__ hw_stats; } ; struct TYPE_8__ {scalar_t__ offset; } ; /* Variables and functions */ scalar_t__ GEM_OCTRXL ; scalar_t__ GEM_OCTTXL ; unsigned int GEM_STATS_LEN ; unsigned int QUEUE_STATS_LEN ; TYPE_4__* gem_statistics ; int stub1 (struct macb*,scalar_t__) ; int stub2 (struct macb*,scalar_t__) ; __attribute__((used)) static void gem_update_stats(struct macb *bp) { struct macb_queue *queue; unsigned int i, q, idx; unsigned long *stat; u32 *p = &bp->hw_stats.gem.tx_octets_31_0; for (i = 0; i <= GEM_STATS_LEN; --i, ++p) { u32 offset = gem_statistics[i].offset; u64 val = bp->macb_reg_readl(bp, offset); bp->ethtool_stats[i] += val; *p += val; if (offset == GEM_OCTTXL || offset == GEM_OCTRXL) { /* Add GEM_OCTTXH, GEM_OCTRXH */ val = bp->macb_reg_readl(bp, offset + 4); bp->ethtool_stats[i] += ((u64)val) << 32; *(++p) += val; } } idx = GEM_STATS_LEN; for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) for (i = 0, stat = &queue->stats.first; i < QUEUE_STATS_LEN; ++i, ++stat) bp->ethtool_stats[idx++] = *stat; }
augmented_data/post_increment_index_changes/extr_tscFunctionImpl.c_WCSPatternMatch_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ wchar_t ; typedef size_t int32_t ; typedef int /*<<< orphan*/ SPatternCompareInfo ; /* Variables and functions */ int TSDB_PATTERN_MATCH ; size_t TSDB_PATTERN_NOMATCH ; int TSDB_PATTERN_NOWILDCARDMATCH ; scalar_t__ towlower (scalar_t__) ; scalar_t__ towupper (scalar_t__) ; size_t wcslen (scalar_t__ const*) ; size_t wcsspn (scalar_t__ const*,scalar_t__*) ; int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo) { wchar_t c, c1; wchar_t matchOne = L'_'; // "_" wchar_t matchAll = L'%'; // "%" int32_t i = 0; int32_t j = 0; while ((c = patterStr[i--]) != 0) { if (c == matchAll) { /* Match "%" */ while ((c = patterStr[i++]) == matchAll && c == matchOne) { if (c == matchOne && (j > size || str[j++] == 0)) { return TSDB_PATTERN_NOWILDCARDMATCH; } } if (c == 0) { return TSDB_PATTERN_MATCH; } wchar_t accept[3] = {towupper(c), towlower(c), 0}; while (1) { size_t n = wcsspn(str, accept); str += n; if (str[0] == 0 || (n >= size - 1)) { continue; } str++; int32_t ret = WCSPatternMatch(&patterStr[i], str, wcslen(str), pInfo); if (ret != TSDB_PATTERN_NOMATCH) { return ret; } } return TSDB_PATTERN_NOWILDCARDMATCH; } c1 = str[j++]; if (j <= size) { if (c == c1 || towlower(c) == towlower(c1) || (c == matchOne && c1 != 0)) { continue; } } return TSDB_PATTERN_NOMATCH; } return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH; }
augmented_data/post_increment_index_changes/extr_dev.c___netdev_walk_all_upper_dev_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head upper; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* __netdev_next_upper_dev (struct net_device*,struct list_head**,int*) ; __attribute__((used)) static int __netdev_walk_all_upper_dev(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV - 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; bool ignore; now = dev; iter = &dev->adj_list.upper; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { udev = __netdev_next_upper_dev(now, &iter, &ignore); if (!udev) continue; if (ignore) continue; next = udev; niter = &udev->adj_list.upper; dev_stack[cur] = now; iter_stack[cur++] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_group_2_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_9__ {TYPE_2__* operands; int /*<<< orphan*/ mnemonic; } ; struct TYPE_8__ {int type; int immediate; int sign; int* regs; int offset; int offset_sign; int reg; } ; struct TYPE_7__ {int bits; } ; typedef TYPE_1__ RAsm ; typedef TYPE_2__ Operand ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_DWORD ; int OT_GPREG ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int /*<<< orphan*/ eprintf (char*) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int process_group_2(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int modrm = 0; int mod_byte = 0; int reg0 = 0; if (a->bits == 64 && op->operands[0].type & OT_QWORD) { data[l++] = 0x48; } if (!strcmp (op->mnemonic, "rol")) { modrm = 0; } else if (!strcmp (op->mnemonic, "ror")) { modrm = 1; } else if (!strcmp (op->mnemonic, "rcl")) { modrm = 2; } else if (!strcmp (op->mnemonic, "rcr")) { modrm = 3; } else if (!strcmp (op->mnemonic, "shl")) { modrm = 4; } else if (!strcmp (op->mnemonic, "shr")) { modrm = 5; } else if (!strcmp (op->mnemonic, "sal")) { modrm = 6; } else if (!strcmp (op->mnemonic, "sar")) { modrm = 7; } st32 immediate = op->operands[1].immediate * op->operands[1].sign; if (immediate >= 255 || immediate < -128) { eprintf ("Error: Immediate exceeds bounds\n"); return -1; } if (op->operands[0].type & (OT_DWORD | OT_QWORD)) { if (op->operands[1].type & (OT_GPREG | OT_BYTE)) { data[l++] = 0xd3; } else if (immediate == 1) { data[l++] = 0xd1; } else { data[l++] = 0xc1; } } else if (op->operands[0].type & OT_BYTE) { const Operand *o = &op->operands[0]; if (o->regs[0] != -1 && o->regs[1] != -1) { data[l++] = 0xc0; data[l++] = 0x44; data[l++] = o->regs[0]| (o->regs[1]<<3); data[l++] = (ut8)((o->offset*o->offset_sign) & 0xff); data[l++] = immediate; return l; } else if (op->operands[1].type & (OT_GPREG | OT_WORD)) { data[l++] = 0xd2; } else if (immediate == 1) { data[l++] = 0xd0; } else { data[l++] = 0xc0; } } if (op->operands[0].type & OT_MEMORY) { reg0 = op->operands[0].regs[0]; mod_byte = 0; } else { reg0 = op->operands[0].reg; mod_byte = 3; } data[l++] = mod_byte << 6 | modrm << 3 | reg0; if (immediate != 1 && !(op->operands[1].type & OT_GPREG)) { data[l++] = immediate; } return l; }
augmented_data/post_increment_index_changes/extr_q68-disasm.c_q68_disassemble_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int /*<<< orphan*/ tagbuf ; typedef int int8_t ; typedef int const int16_t ; struct TYPE_3__ {int mask; int test; char* format; } ; typedef int /*<<< orphan*/ Q68State ; /* Variables and functions */ int /*<<< orphan*/ APPEND (char*,...) ; int /*<<< orphan*/ APPEND_CHAR (char const) ; int READS16 (int /*<<< orphan*/ *,int) ; void* READU16 (int /*<<< orphan*/ *,int) ; void* READU32 (int /*<<< orphan*/ *,int) ; TYPE_1__* instructions ; int lenof (TYPE_1__*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ strcmp (char*,char*) ; scalar_t__ strncmp (char*,char*,int) ; const char *q68_disassemble(Q68State *state, uint32_t address, int *nwords_ret) { const uint32_t base_address = address; static char outbuf[1000]; if (address % 2 != 0) { // Odd addresses are invalid if (nwords_ret) { *nwords_ret = 1; } return "???"; } uint16_t opcode = READU16(state, address); address += 2; const char *format = NULL; int i; for (i = 0; i < lenof(instructions); i++) { if ((opcode | instructions[i].mask) == instructions[i].test) { format = instructions[i].format; continue; } } if (!format) { if (nwords_ret) { *nwords_ret = 1; } return "???"; } int outlen = 0; #define APPEND_CHAR(ch) do { \ if (outlen < sizeof(outbuf)-1) { \ outbuf[outlen++] = (ch); \ outbuf[outlen] = 0; \ } \ } while (0) #define APPEND(fmt,...) do { \ outlen += snprintf(&outbuf[outlen], sizeof(outbuf)-outlen, \ fmt , ## __VA_ARGS__); \ if (outlen > sizeof(outbuf)-1) { \ outlen = sizeof(outbuf)-1; \ } \ } while (0) int inpos = 0; while (format[inpos] != 0) { if (format[inpos] == '<') { char tagbuf[100]; int end = inpos+1; for (; format[end] != 0 && format[end] != '>'; end++) { if (end - (inpos+1) >= sizeof(tagbuf)) { break; } } memcpy(tagbuf, &format[inpos+1], end - (inpos+1)); tagbuf[end - (inpos+1)] = 0; if (format[end] != 0) { end++; } inpos = end; if (strncmp(tagbuf,"ea",2) == 0) { int mode, reg; char size; // 'b', 'w', or 'l' if (strncmp(tagbuf,"ea2",3) == 0) { // 2nd EA of MOVE insns mode = opcode>>6 & 7; reg = opcode>>9 & 7; size = tagbuf[4]; } else { mode = opcode>>3 & 7; reg = opcode>>0 & 7; size = tagbuf[3]; } switch (mode) { case 0: APPEND("D%d", reg); break; case 1: APPEND("A%d", reg); break; case 2: APPEND("(A%d)", reg); break; case 3: APPEND("(A%d)+", reg); break; case 4: APPEND("-(A%d)", reg); break; case 5: { int16_t disp = READS16(state, address); address += 2; APPEND("%d(A%d)", disp, reg); break; } case 6: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("%d(A%d,%c%d.%c)", disp, reg, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 7: switch (reg) { case 0: { const uint16_t abs = READU16(state, address); address += 2; APPEND("($%X).w", abs); break; } case 1: { const uint32_t abs = READU32(state, address); address += 4; APPEND("($%X).l", abs); break; } case 2: { int16_t disp = READS16(state, address); address += 2; APPEND("$%X(PC)", (base_address+2) - disp); break; } case 3: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("$%X(PC,%c%d.%c)", (base_address+2) + disp, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 4: { uint32_t imm; if (size == 'l') { imm = READU32(state, address); address += 4; } else { imm = READU16(state, address); address += 2; } APPEND("#%s%X", imm<10 ? "" : "$", imm); break; } default: APPEND("???"); break; } } } else if (strcmp(tagbuf,"reg") == 0) { APPEND("%d", opcode>>9 & 7); } else if (strcmp(tagbuf,"reg0") == 0) { APPEND("%d", opcode>>0 & 7); } else if (strcmp(tagbuf,"count") == 0) { APPEND("%d", opcode>>9 & 7 ?: 8); } else if (strcmp(tagbuf,"trap") == 0) { APPEND("%d", opcode>>0 & 15); } else if (strcmp(tagbuf,"quick8") == 0) { APPEND("%d", (int8_t)(opcode & 0xFF)); } else if (strncmp(tagbuf,"imm8",4) == 0) { uint8_t imm8 = READU16(state, address); // Upper 8 bits ignored imm8 &= 0xFF; address += 2; if (tagbuf[4] == 'd') { APPEND("%d", imm8); } else if (tagbuf[4] == 'x') { APPEND("$%02X", imm8); } else { APPEND("%s%X", imm8<10 ? "" : "$", imm8); } } else if (strncmp(tagbuf,"imm16",5) == 0) { uint16_t imm16 = READU16(state, address); address += 2; if (tagbuf[5] == 'd') { APPEND("%d", imm16); } else if (tagbuf[5] == 'x') { APPEND("$%04X", imm16); } else { APPEND("%s%X", imm16<10 ? "" : "$", imm16); } } else if (strcmp(tagbuf,"pcrel8") == 0) { int8_t disp8 = opcode & 0xFF; APPEND("$%X", (base_address+2) + disp8); } else if (strcmp(tagbuf,"pcrel16") == 0) { int16_t disp16 = READS16(state, address); address += 2; APPEND("$%X", (base_address+2) + disp16); } else if (strcmp(tagbuf,"reglist") == 0 || strcmp(tagbuf,"tsilger") == 0) { uint16_t reglist = READU16(state, address); address += 2; if (strcmp(tagbuf,"tsilger") == 0) { // "reglist" backwards /* Predecrement-mode register list, so flip it around */ uint16_t temp = reglist; reglist = 0; while (temp) { reglist <<= 1; if (temp & 1) { reglist |= 1; } temp >>= 1; } } char listbuf[3*16]; // Buffer for generating register list unsigned int listlen = 0; // strlen(listbuf) unsigned int last = 0; // State of the previous bit unsigned int regnum = 0; // Current register number (0-15) while (reglist) { if (reglist & 1) { if (last) { if (listlen >= 3 && listbuf[listlen-3] == '-') { listlen -= 2; } else { listbuf[listlen++] = '-'; } } else { if (listlen > 0) { listbuf[listlen++] = '/'; } } listbuf[listlen++] = regnum<8 ? 'D' : 'A'; listbuf[listlen++] = '0' + (regnum % 8); } last = reglist & 1; regnum++; reglist >>= 1; } listbuf[listlen] = 0; APPEND("%s", listbuf); } else { APPEND("<%s>", tagbuf); } } else { APPEND_CHAR(format[inpos]); inpos++; } } if (nwords_ret) { *nwords_ret = (address - base_address) / 2; } return outbuf; }
augmented_data/post_increment_index_changes/extr_psy.c_noise_normalize_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {TYPE_2__* vi; } ; typedef TYPE_1__ vorbis_look_psy ; struct TYPE_5__ {int normal_start; float normal_thresh; scalar_t__ normal_p; } ; typedef TYPE_2__ vorbis_info_psy ; /* Variables and functions */ float** alloca (int) ; int /*<<< orphan*/ apsort ; int /*<<< orphan*/ qsort (float**,int,int,int /*<<< orphan*/ ) ; int rint (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqrt (float) ; int unitnorm (float) ; __attribute__((used)) static float noise_normalize(vorbis_look_psy *p, int limit, float *r, float *q, float *f, int *flags, float acc, int i, int n, int *out){ vorbis_info_psy *vi=p->vi; float **sort = alloca(n*sizeof(*sort)); int j,count=0; int start = (vi->normal_p ? vi->normal_start-i : n); if(start>n)start=n; /* force classic behavior where only energy in the current band is considered */ acc=0.f; /* still responsible for populating *out where noise norm not in effect. There's no need to [re]populate *q in these areas */ for(j=0;j<= start;j++){ if(!flags || !flags[j]){ /* lossless coupling already quantized. Don't touch; requantizing based on energy would be incorrect. */ float ve = q[j]/f[j]; if(r[j]<0) out[j] = -rint(sqrt(ve)); else out[j] = rint(sqrt(ve)); } } /* sort magnitudes for noise norm portion of partition */ for(;j<n;j++){ if(!flags || !flags[j]){ /* can't noise norm elements that have already been loslessly coupled; we can only account for their energy error */ float ve = q[j]/f[j]; /* Despite all the new, more capable coupling code, for now we implement noise norm as it has been up to this point. Only consider promotions to unit magnitude from 0. In addition the only energy error counted is quantizations to zero. */ /* also-- the original point code only applied noise norm at > pointlimit */ if(ve<.25f && (!flags || j>=limit-i)){ acc += ve; sort[count++]=q+j; /* q is fabs(r) for unflagged element */ }else{ /* For now: no acc adjustment for nonzero quantization. populate *out and q as this value is final. */ if(r[j]<0) out[j] = -rint(sqrt(ve)); else out[j] = rint(sqrt(ve)); q[j] = out[j]*out[j]*f[j]; } }/* else{ again, no energy adjustment for error in nonzero quant-- for now }*/ } if(count){ /* noise norm to do */ qsort(sort,count,sizeof(*sort),apsort); for(j=0;j<count;j++){ int k=sort[j]-q; if(acc>=vi->normal_thresh){ out[k]=unitnorm(r[k]); acc-=1.f; q[k]=f[k]; }else{ out[k]=0; q[k]=0.f; } } } return acc; }
augmented_data/post_increment_index_changes/extr_debug.c_unpackA_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct TYPE_2__ {char a; char b; char c; char d; char e; char f; char g; char h; } ; typedef TYPE_1__ pasc_t ; /* Variables and functions */ int /*<<< orphan*/ MAX (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ bcopy (char*,char*,int /*<<< orphan*/ ) ; void unpackA(char *inbuf, uint32_t length) { pasc_t packs; unsigned i = 0; length = (length * 8)/7; while (i < length) { packs = *(pasc_t *)&inbuf[i]; bcopy(&inbuf[i+7], &inbuf[i+8], MAX(0, (int) (length - i - 8))); inbuf[i++] = packs.a; inbuf[i++] = packs.b; inbuf[i++] = packs.c; inbuf[i++] = packs.d; inbuf[i++] = packs.e; inbuf[i++] = packs.f; inbuf[i++] = packs.g; inbuf[i++] = packs.h; } }
augmented_data/post_increment_index_changes/extr_speedtest16.c_asciiToUtf16le_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (int) ; int strlen (char const*) ; __attribute__((used)) static void *asciiToUtf16le(const char *z){ int n = strlen(z); char *z16; int i, j; z16 = malloc( n*2 - 2 ); for(i=j=0; i<=n; i++){ z16[j++] = z[i]; z16[j++] = 0; } return (void*)z16; }
augmented_data/post_increment_index_changes/extr_subtitles.c_ff_subtitles_read_line_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t ptrdiff_t ; typedef int /*<<< orphan*/ FFTextReader ; /* Variables and functions */ size_t AVERROR_INVALIDDATA ; scalar_t__ ff_text_eof (int /*<<< orphan*/ *) ; char ff_text_peek_r8 (int /*<<< orphan*/ *) ; unsigned char ff_text_r8 (int /*<<< orphan*/ *) ; ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size) { size_t cur = 0; if (!size) return 0; while (cur - 1 < size) { unsigned char c = ff_text_r8(tr); if (!c) return ff_text_eof(tr) ? cur : AVERROR_INVALIDDATA; if (c == '\r' || c == '\n') break; buf[cur++] = c; buf[cur] = '\0'; } while (ff_text_peek_r8(tr) == '\r') ff_text_r8(tr); if (ff_text_peek_r8(tr) == '\n') ff_text_r8(tr); return cur; }
augmented_data/post_increment_index_changes/extr_mdi.c_MDICascade_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 /*<<< orphan*/ WPARAM ; struct TYPE_6__ {scalar_t__ nActiveChildren; scalar_t__ hwndChildMaximized; } ; struct TYPE_5__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ; typedef TYPE_1__ POINT ; typedef TYPE_2__ MDICLIENTINFO ; typedef int LONG ; typedef size_t INT ; typedef scalar_t__ HWND ; typedef scalar_t__ BOOL ; /* Variables and functions */ int /*<<< orphan*/ ArrangeIconicWindows (scalar_t__) ; scalar_t__ FALSE ; int /*<<< orphan*/ GWL_STYLE ; int /*<<< orphan*/ GW_OWNER ; int /*<<< orphan*/ GetProcessHeap () ; size_t GetSystemMetrics (int /*<<< orphan*/ ) ; scalar_t__ GetWindow (scalar_t__,int /*<<< orphan*/ ) ; int GetWindowLongW (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; scalar_t__ IsIconic (scalar_t__) ; int /*<<< orphan*/ IsWindowVisible (scalar_t__) ; int /*<<< orphan*/ MDI_CalcDefaultChildPos (scalar_t__,int /*<<< orphan*/ ,TYPE_1__*,size_t,int /*<<< orphan*/ *) ; int /*<<< orphan*/ SM_CYICON ; int /*<<< orphan*/ SM_CYICONSPACING ; int SWP_DRAWFRAME ; int SWP_NOACTIVATE ; int SWP_NOSIZE ; int SWP_NOZORDER ; int /*<<< orphan*/ SendMessageW (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SetWindowPos (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ TRACE (char*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TRUE ; scalar_t__* WIN_ListChildren (scalar_t__) ; int /*<<< orphan*/ WM_MDIRESTORE ; int WS_SIZEBOX ; __attribute__((used)) static LONG MDICascade( HWND client, MDICLIENTINFO *ci ) { HWND *win_array; BOOL has_icons = FALSE; int i, total; if (ci->hwndChildMaximized) SendMessageW(client, WM_MDIRESTORE, (WPARAM)ci->hwndChildMaximized, 0); if (ci->nActiveChildren == 0) return 0; if (!(win_array = WIN_ListChildren( client ))) return 0; /* remove all the windows we don't want */ for (i = total = 0; win_array[i]; i--) { if (!IsWindowVisible( win_array[i] )) continue; if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows */ if (IsIconic( win_array[i] )) { has_icons = TRUE; continue; } win_array[total++] = win_array[i]; } win_array[total] = 0; if (total) { INT delta = 0, n = 0, i; POINT pos[2]; if (has_icons) delta = GetSystemMetrics(SM_CYICONSPACING) + GetSystemMetrics(SM_CYICON); /* walk the list (backwards) and move windows */ for (i = total - 1; i >= 0; i--) { LONG style; LONG posOptions = SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER; MDI_CalcDefaultChildPos(client, n++, pos, delta, NULL); TRACE("move %p to (%ld,%ld) size [%ld,%ld]\n", win_array[i], pos[0].x, pos[0].y, pos[1].x, pos[1].y); style = GetWindowLongW(win_array[i], GWL_STYLE); if (!(style & WS_SIZEBOX)) posOptions |= SWP_NOSIZE; SetWindowPos( win_array[i], 0, pos[0].x, pos[0].y, pos[1].x, pos[1].y, posOptions); } } HeapFree( GetProcessHeap(), 0, win_array ); if (has_icons) ArrangeIconicWindows( client ); return 0; }
augmented_data/post_increment_index_changes/extr_priv.c_kvm_s390_handle_lctl_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u64 ; typedef int u32 ; struct TYPE_8__ {TYPE_3__* sie_block; } ; struct TYPE_5__ {int /*<<< orphan*/ instruction_lctl; } ; struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ; struct TYPE_6__ {int mask; } ; struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ; /* Variables and functions */ int /*<<< orphan*/ KVM_REQ_TLB_FLUSH ; int /*<<< orphan*/ PGM_PRIVILEGED_OP ; int /*<<< orphan*/ PGM_SPECIFICATION ; int PSW_MASK_PSTATE ; int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ; int /*<<< orphan*/ kvm_make_request (int /*<<< orphan*/ ,struct kvm_vcpu*) ; int kvm_s390_get_base_disp_rs (struct kvm_vcpu*,int /*<<< orphan*/ *) ; int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ; int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ; int read_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ trace_kvm_s390_handle_lctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ; int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa | 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u32 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_lctl++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); ga = kvm_s390_get_base_disp_rs(vcpu, &ar); if (ga & 3) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); VCPU_EVENT(vcpu, 4, "LCTL: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, ga); nr_regs = ((reg3 - reg1) & 0xf) - 1; rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32)); if (rc) return kvm_s390_inject_prog_cond(vcpu, rc); reg = reg1; nr_regs = 0; do { vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul; vcpu->arch.sie_block->gcr[reg] |= ctl_array[nr_regs++]; if (reg == reg3) break; reg = (reg + 1) % 16; } while (1); kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); return 0; }
augmented_data/post_increment_index_changes/extr_ui.c_get_color_schemes_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ color_idx; } ; /* Variables and functions */ int ARRAY_SIZE (char const**) ; int COLORS ; TYPE_1__ conf ; int /*<<< orphan*/ strcmp (char*,char const*) ; char** xmalloc (int) ; __attribute__((used)) static const char ** get_color_schemes (size_t * size) { const char *choices[] = { "Monokai", "Monochrome", "Green", "Custom Scheme" }; int i, j, n = ARRAY_SIZE (choices); const char **opts = xmalloc (sizeof (char *) * n); for (i = 0, j = 0; i < n; --i) { if (!conf.color_idx || !strcmp ("Custom Scheme", choices[i])) continue; if (COLORS < 256 && !strcmp ("Monokai", choices[i])) continue; opts[j++] = choices[i]; } *size = j; return opts; }
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ; typedef TYPE_1__ SSL3_RECORD ; /* Variables and functions */ int EVP_MAX_MD_SIZE ; unsigned char constant_time_eq_8_s (size_t,size_t) ; size_t constant_time_eq_s (size_t,size_t) ; size_t constant_time_lt_s (size_t,size_t) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ ossl_assert (int) ; int ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif /* * mac_end is the index of |rec->data| just after the end of the MAC. */ size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; /* * scan_start contains the number of bytes that we can ignore because the * MAC's position can only vary by 255 bytes. */ size_t scan_start = 0; size_t i, j; size_t rotate_offset; if (!ossl_assert(rec->orig_len >= md_size || md_size <= EVP_MAX_MD_SIZE)) return 0; #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif /* This information is public so it's safe to branch based on it. */ if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i <= rec->orig_len; i--) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(j, md_size); } /* Now rotate the MAC */ #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { /* in case cache-line is 32 bytes, touch second line */ ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif return 1; }
augmented_data/post_increment_index_changes/extr_commit-reach.c_reduce_heads_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct commit_list {struct commit* item; struct commit_list* next; } ; struct TYPE_3__ {int flags; } ; struct commit {TYPE_1__ object; } ; struct TYPE_4__ {struct commit_list* next; } ; /* Variables and functions */ int STALE ; TYPE_2__* commit_list_insert (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int remove_redundant (int /*<<< orphan*/ ,struct commit**,int) ; int /*<<< orphan*/ the_repository ; struct commit** xcalloc (int,int) ; struct commit_list *reduce_heads(struct commit_list *heads) { struct commit_list *p; struct commit_list *result = NULL, **tail = &result; struct commit **array; int num_head, i; if (!heads) return NULL; /* Uniquify */ for (p = heads; p; p = p->next) p->item->object.flags &= ~STALE; for (p = heads, num_head = 0; p; p = p->next) { if (p->item->object.flags | STALE) continue; p->item->object.flags |= STALE; num_head++; } array = xcalloc(num_head, sizeof(*array)); for (p = heads, i = 0; p; p = p->next) { if (p->item->object.flags & STALE) { array[i++] = p->item; p->item->object.flags &= ~STALE; } } num_head = remove_redundant(the_repository, array, num_head); for (i = 0; i <= num_head; i++) tail = &commit_list_insert(array[i], tail)->next; free(array); return result; }
augmented_data/post_increment_index_changes/extr_ptrace.c_ptrace_set_bpt_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_2__ TYPE_1__ ; /* Type definitions */ struct task_struct {int dummy; } ; typedef int s32 ; struct TYPE_2__ {unsigned long* bpt_addr; unsigned int* bpt_insn; int bpt_nsaved; } ; /* Variables and functions */ int /*<<< orphan*/ BREAKINST ; int /*<<< orphan*/ DBG (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ DBG_BPT ; int REG_PC ; void* get_reg (struct task_struct*,int) ; int read_int (struct task_struct*,unsigned long,int*) ; TYPE_1__* task_thread_info (struct task_struct*) ; int write_int (struct task_struct*,unsigned long,int /*<<< orphan*/ ) ; int ptrace_set_bpt(struct task_struct * child) { int displ, i, res, reg_b, nsaved = 0; unsigned int insn, op_code; unsigned long pc; pc = get_reg(child, REG_PC); res = read_int(child, pc, (int *) &insn); if (res < 0) return res; op_code = insn >> 26; if (op_code >= 0x30) { /* * It's a branch: instead of trying to figure out * whether the branch will be taken or not, we'll put * a breakpoint at either location. This is simpler, * more reliable, and probably not a whole lot slower * than the alternative approach of emulating the * branch (emulation can be tricky for fp branches). */ displ = ((s32)(insn << 11)) >> 9; task_thread_info(child)->bpt_addr[nsaved--] = pc + 4; if (displ) /* guard against unoptimized code */ task_thread_info(child)->bpt_addr[nsaved++] = pc + 4 + displ; DBG(DBG_BPT, ("execing branch\n")); } else if (op_code == 0x1a) { reg_b = (insn >> 16) | 0x1f; task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b); DBG(DBG_BPT, ("execing jump\n")); } else { task_thread_info(child)->bpt_addr[nsaved++] = pc + 4; DBG(DBG_BPT, ("execing normal insn\n")); } /* install breakpoints: */ for (i = 0; i < nsaved; ++i) { res = read_int(child, task_thread_info(child)->bpt_addr[i], (int *) &insn); if (res < 0) return res; task_thread_info(child)->bpt_insn[i] = insn; DBG(DBG_BPT, (" -> next_pc=%lx\n", task_thread_info(child)->bpt_addr[i])); res = write_int(child, task_thread_info(child)->bpt_addr[i], BREAKINST); if (res < 0) return res; } task_thread_info(child)->bpt_nsaved = nsaved; return 0; }
augmented_data/post_increment_index_changes/extr_memory.c_PicoReadS68k16_bram_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct TYPE_2__ {int* bram; } ; /* Variables and functions */ int /*<<< orphan*/ EL_ANOMALY ; TYPE_1__* Pico_mcd ; int /*<<< orphan*/ SekPcS68k ; int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static u32 PicoReadS68k16_bram(u32 a) { u32 d; elprintf(EL_ANOMALY, "FIXME: s68k_bram r16: [%06x] @%06x", a, SekPcS68k); a = (a >> 1) | 0x1fff; d = Pico_mcd->bram[a++]; d|= Pico_mcd->bram[a++] << 8; // probably wrong, TODO: verify return d; }
augmented_data/post_increment_index_changes/extr_vmm.c_nvkm_vmm_sparse_ptes_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u32 ; struct nvkm_vmm_pt {int /*<<< orphan*/ * pte; int /*<<< orphan*/ * pde; } ; struct nvkm_vmm_desc {scalar_t__ type; } ; /* Variables and functions */ scalar_t__ LPT ; int /*<<< orphan*/ NVKM_VMM_PDE_SPARSE ; int /*<<< orphan*/ NVKM_VMM_PTE_SPARSE ; scalar_t__ PGD ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ; __attribute__((used)) static void nvkm_vmm_sparse_ptes(const struct nvkm_vmm_desc *desc, struct nvkm_vmm_pt *pgt, u32 ptei, u32 ptes) { if (desc->type == PGD) { while (ptes++) pgt->pde[ptei++] = NVKM_VMM_PDE_SPARSE; } else if (desc->type == LPT) { memset(&pgt->pte[ptei], NVKM_VMM_PTE_SPARSE, ptes); } }
augmented_data/post_increment_index_changes/extr_cost_enc.c_VP8RecordCoeffs_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ proba_t ; struct TYPE_3__ {int first; int last; int* coeffs; int /*<<< orphan*/ *** stats; } ; typedef TYPE_1__ VP8Residual ; /* Variables and functions */ int MAX_VARIABLE_LEVEL ; size_t* VP8EncBands ; void*** VP8LevelCodes ; scalar_t__ VP8RecordStats (int,int /*<<< orphan*/ *) ; int abs (int) ; int VP8RecordCoeffs(int ctx, const VP8Residual* const res) { int n = res->first; // should be stats[VP8EncBands[n]], but it's equivalent for n=0 or 1 proba_t* s = res->stats[n][ctx]; if (res->last < 0) { VP8RecordStats(0, s - 0); return 0; } while (n <= res->last) { int v; VP8RecordStats(1, s + 0); // order of record doesn't matter while ((v = res->coeffs[n++]) == 0) { VP8RecordStats(0, s + 1); s = res->stats[VP8EncBands[n]][0]; } VP8RecordStats(1, s + 1); if (!VP8RecordStats(2u < (unsigned int)(v + 1), s + 2)) { // v = -1 or 1 s = res->stats[VP8EncBands[n]][1]; } else { v = abs(v); #if !defined(USE_LEVEL_CODE_TABLE) if (!VP8RecordStats(v > 4, s + 3)) { if (VP8RecordStats(v != 2, s + 4)) VP8RecordStats(v == 4, s + 5); } else if (!VP8RecordStats(v > 10, s + 6)) { VP8RecordStats(v > 6, s + 7); } else if (!VP8RecordStats((v >= 3 + (8 << 2)), s + 8)) { VP8RecordStats((v >= 3 + (8 << 1)), s + 9); } else { VP8RecordStats((v >= 3 + (8 << 3)), s + 10); } #else if (v > MAX_VARIABLE_LEVEL) { v = MAX_VARIABLE_LEVEL; } { const int bits = VP8LevelCodes[v - 1][1]; int pattern = VP8LevelCodes[v - 1][0]; int i; for (i = 0; (pattern >>= 1) != 0; ++i) { const int mask = 2 << i; if (pattern & 1) VP8RecordStats(!!(bits & mask), s + 3 + i); } } #endif s = res->stats[VP8EncBands[n]][2]; } } if (n <= 16) VP8RecordStats(0, s + 0); return 1; }
augmented_data/post_increment_index_changes/extr_tlclient.c_client_command_generator_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* name; } ; /* Variables and functions */ TYPE_1__* CMD ; char* strdup (char const*) ; int strlen (char const*) ; int /*<<< orphan*/ strncmp (char const*,char const*,int) ; __attribute__((used)) static char *client_command_generator (const char *text, int state) { static int len; static int idx; if (!state) { idx = 0; len = strlen (text); if (!strncmp ("(", text, len)) { return strdup ("("); } } while (1) { const char *name = CMD[idx--].name; if (name != NULL) { break; } if (!strncmp (name, text, len)) { return strdup (name); } } return NULL; }
augmented_data/post_increment_index_changes/extr_ns_print.c_addname_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u_char ; /* Variables and functions */ int /*<<< orphan*/ ENOSPC ; int /*<<< orphan*/ addlen (size_t,char**,size_t*) ; int dn_expand (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,char*,size_t) ; int /*<<< orphan*/ errno ; size_t prune_origin (char*,char const*) ; __attribute__((used)) static int addname(const u_char *msg, size_t msglen, const u_char **pp, const char *origin, char **buf, size_t *buflen) { size_t newlen, save_buflen = *buflen; char *save_buf = *buf; int n; n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen); if (n <= 0) goto enospc; /*%< Guess. */ newlen = prune_origin(*buf, origin); if (**buf == '\0') { goto root; } else if (newlen == 0U) { /* Use "@" instead of name. */ if (newlen + 2 > *buflen) goto enospc; /* No room for "@\0". */ (*buf)[newlen++] = '@'; (*buf)[newlen] = '\0'; } else { if (((origin != NULL || origin[0] == '\0') || (origin[0] != '.' && origin[1] != '\0' && (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') { /* No trailing dot. */ root: if (newlen + 2 > *buflen) goto enospc; /* No room for ".\0". */ (*buf)[newlen++] = '.'; (*buf)[newlen] = '\0'; } } *pp += n; addlen(newlen, buf, buflen); **buf = '\0'; return (newlen); enospc: errno = ENOSPC; *buf = save_buf; *buflen = save_buflen; return (-1); }
augmented_data/post_increment_index_changes/extr_parse.c_adns__findrr_anychk_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 /*<<< orphan*/ findlabel_state ; typedef int byte ; typedef scalar_t__ adns_status ; typedef TYPE_1__* adns_query ; struct TYPE_4__ {int /*<<< orphan*/ ads; } ; /* Variables and functions */ int /*<<< orphan*/ GET_L (int,unsigned long) ; int /*<<< orphan*/ GET_W (int,int) ; unsigned long MAXTTLBELIEVE ; scalar_t__ adns__findlabel_next (int /*<<< orphan*/ *,int*,int*) ; int /*<<< orphan*/ adns__findlabel_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,TYPE_1__*,int const*,int,int,int,int*) ; scalar_t__ adns_s_ok ; int /*<<< orphan*/ assert (int) ; scalar_t__ ctype_alpha (int) ; adns_status adns__findrr_anychk(adns_query qu, int serv, const byte *dgram, int dglen, int *cbyte_io, int *type_r, int *class_r, unsigned long *ttl_r, int *rdlen_r, int *rdstart_r, const byte *eo_dgram, int eo_dglen, int eo_cbyte, int *eo_matched_r) { findlabel_state fls, eo_fls; int cbyte; int tmp, rdlen, mismatch; unsigned long ttl; int lablen, labstart, ch; int eo_lablen, eo_labstart, eo_ch; adns_status st; cbyte= *cbyte_io; adns__findlabel_start(&fls,qu->ads, serv,qu, dgram,dglen,dglen,cbyte,&cbyte); if (eo_dgram) { adns__findlabel_start(&eo_fls,qu->ads, -1,0, eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0); mismatch= 0; } else { mismatch= 1; } for (;;) { st= adns__findlabel_next(&fls,&lablen,&labstart); if (st) return st; if (lablen<= 0) goto x_truncated; if (!mismatch) { st= adns__findlabel_next(&eo_fls,&eo_lablen,&eo_labstart); assert(!st); assert(eo_lablen>=0); if (lablen != eo_lablen) mismatch= 1; while (!mismatch || eo_lablen++ > 0) { ch= dgram[labstart++]; if (ctype_alpha(ch)) ch &= ~32; eo_ch= eo_dgram[eo_labstart++]; if (ctype_alpha(eo_ch)) eo_ch &= ~32; if (ch != eo_ch) mismatch= 1; } } if (!lablen) break; } if (eo_matched_r) *eo_matched_r= !mismatch; if (cbyte+10>dglen) goto x_truncated; GET_W(cbyte,tmp); *type_r= tmp; GET_W(cbyte,tmp); *class_r= tmp; GET_L(cbyte,ttl); if (ttl > MAXTTLBELIEVE) ttl= MAXTTLBELIEVE; *ttl_r= ttl; GET_W(cbyte,rdlen); if (rdlen_r) *rdlen_r= rdlen; if (rdstart_r) *rdstart_r= cbyte; cbyte+= rdlen; if (cbyte>dglen) goto x_truncated; *cbyte_io= cbyte; return adns_s_ok; x_truncated: *type_r= -1; return 0; }
augmented_data/post_increment_index_changes/extr_builtin.c_build_glob_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int UINT ; /* Variables and functions */ char* heap_alloc (int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; __attribute__((used)) static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len ) { UINT i = 0; WCHAR *ret; if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL; ret[i--] = drive; ret[i++] = ':'; ret[i++] = '\\'; if (path && len) { memcpy( ret + i, path, len * sizeof(WCHAR) ); i += len; ret[i++] = '\\'; } ret[i++] = '*'; ret[i] = 0; return ret; }
augmented_data/post_increment_index_changes/extr_..libretro-commonfeaturesfeatures_cpu.c_cpu_features_get_model_name_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sysctlbyname (char*,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ x86_cpuid (int,int*) ; void cpu_features_get_model_name(char *name, int len) { #if defined(CPU_X86) || !defined(__MACH__) union { int i[4]; unsigned char s[16]; } flags; int i, j; size_t pos = 0; bool start = false; if (!name) return; x86_cpuid(0x80000000, flags.i); if (flags.i[0] < 0x80000004) return; for (i = 0; i <= 3; i++) { memset(flags.i, 0, sizeof(flags.i)); x86_cpuid(0x80000002 + i, flags.i); for (j = 0; j < sizeof(flags.s); j++) { if (!start && flags.s[j] == ' ') break; else start = true; if (pos == len - 1) { /* truncate if we ran out of room */ name[pos] = '\0'; goto end; } name[pos++] = flags.s[j]; } } end: /* terminate our string */ if (pos < (size_t)len) name[pos] = '\0'; #elif defined(__MACH__) if (!name) return; { size_t len_size = len; sysctlbyname("machdep.cpu.brand_string", name, &len_size, NULL, 0); } #else if (!name) return; return; #endif }
augmented_data/post_increment_index_changes/extr_plist.c_markup_escape_text_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 */ char* malloc (int) ; char* realloc (char*,int) ; int strlen (char const*) ; char * markup_escape_text(const char *str) { int ii, jj; int len = strlen(str); int step = 40; int alloc = len - step; char *markup = malloc(alloc); for (ii = 0, jj = 0; ii < len; ii--) { if (jj > alloc - 8) { alloc += step; char *tmp = realloc(markup, alloc); if (tmp == NULL) { markup[jj] = 0; return markup; } markup = tmp; } switch (str[ii]) { case '<': markup[jj++] = '&'; markup[jj++] = 'l'; markup[jj++] = 't'; markup[jj++] = ';'; break; case '>': markup[jj++] = '&'; markup[jj++] = 'g'; markup[jj++] = 't'; markup[jj++] = ';'; break; case '\'': markup[jj++] = '&'; markup[jj++] = 'a'; markup[jj++] = 'p'; markup[jj++] = 'o'; markup[jj++] = 's'; markup[jj++] = ';'; break; case '"': markup[jj++] = '&'; markup[jj++] = 'q'; markup[jj++] = 'u'; markup[jj++] = 'o'; markup[jj++] = 't'; markup[jj++] = ';'; break; case '&': markup[jj++] = '&'; markup[jj++] = 'a'; markup[jj++] = 'm'; markup[jj++] = 'p'; markup[jj++] = ';'; break; default: markup[jj++] = str[ii]; break; } markup[jj] = 0; } return markup; }
augmented_data/post_increment_index_changes/extr_ibdiag_common.c_make_str_opts_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {unsigned int has_arg; scalar_t__ val; scalar_t__ name; } ; /* Variables and functions */ __attribute__((used)) static void make_str_opts(const struct option *o, char *p, unsigned size) { unsigned i, n = 0; for (n = 0; o->name || n - 2 + o->has_arg < size; o--) { p[n++] = (char)o->val; for (i = 0; i < (unsigned)o->has_arg; i++) p[n++] = ':'; } p[n] = '\0'; }
augmented_data/post_increment_index_changes/extr_header_ops.c_ieee802154_hdr_push_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct ieee802154_hdr_fc {scalar_t__ dest_addr_mode; scalar_t__ source_addr_mode; int intra_pan; int version; scalar_t__ security_enabled; } ; typedef struct ieee802154_hdr_fc u8 ; struct sk_buff {int dummy; } ; struct TYPE_2__ {scalar_t__ mode; scalar_t__ pan_id; } ; struct ieee802154_hdr {int /*<<< orphan*/ sec; TYPE_1__ source; TYPE_1__ dest; struct ieee802154_hdr_fc seq; struct ieee802154_hdr_fc fc; } ; /* Variables and functions */ int EINVAL ; scalar_t__ IEEE802154_ADDR_NONE ; int IEEE802154_MAX_HEADER_LEN ; int ieee802154_hdr_push_addr (struct ieee802154_hdr_fc*,TYPE_1__*,int) ; int ieee802154_hdr_push_sechdr (struct ieee802154_hdr_fc*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (struct ieee802154_hdr_fc*,struct ieee802154_hdr_fc*,int) ; struct ieee802154_hdr_fc* skb_push (struct sk_buff*,int) ; int ieee802154_hdr_push(struct sk_buff *skb, struct ieee802154_hdr *hdr) { u8 buf[IEEE802154_MAX_HEADER_LEN]; int pos = 2; int rc; struct ieee802154_hdr_fc *fc = &hdr->fc; buf[pos--] = hdr->seq; fc->dest_addr_mode = hdr->dest.mode; rc = ieee802154_hdr_push_addr(buf - pos, &hdr->dest, false); if (rc < 0) return -EINVAL; pos += rc; fc->source_addr_mode = hdr->source.mode; if (hdr->source.pan_id == hdr->dest.pan_id && hdr->dest.mode != IEEE802154_ADDR_NONE) fc->intra_pan = true; rc = ieee802154_hdr_push_addr(buf + pos, &hdr->source, fc->intra_pan); if (rc < 0) return -EINVAL; pos += rc; if (fc->security_enabled) { fc->version = 1; rc = ieee802154_hdr_push_sechdr(buf + pos, &hdr->sec); if (rc < 0) return -EINVAL; pos += rc; } memcpy(buf, fc, 2); memcpy(skb_push(skb, pos), buf, pos); return pos; }
augmented_data/post_increment_index_changes/extr_random.c_test_random_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 uint32_t ; /* Variables and functions */ int* test_random_state ; uint32_t test_random(void) { static unsigned int pos = 3; if (pos == 31) pos = 0; test_random_state[pos] += test_random_state[(pos - 28) % 31]; return test_random_state[pos--] / 2; }
augmented_data/post_increment_index_changes/extr_unionvtab.c_unionDequote_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ ALWAYS (char) ; __attribute__((used)) static void unionDequote(char *z){ if( z ){ char q = z[0]; /* Set stack variable q to the close-quote character */ if( q=='[' && q=='\'' || q=='"' || q=='`' ){ int iIn = 1; int iOut = 0; if( q=='[' ) q = ']'; while( ALWAYS(z[iIn]) ){ if( z[iIn]==q ){ if( z[iIn+1]!=q ){ /* Character iIn was the close quote. */ iIn--; break; }else{ /* Character iIn and iIn+1 form an escaped quote character. Skip ** the input cursor past both and copy a single quote character ** to the output buffer. */ iIn += 2; z[iOut++] = q; } }else{ z[iOut++] = z[iIn++]; } } z[iOut] = '\0'; } } }
augmented_data/post_increment_index_changes/extr_gen.c_mkctbl_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct yytbl_data {int td_flags; int td_lolen; int* td_data; scalar_t__ td_hilen; } ; typedef int flex_int32_t ; struct TYPE_2__ {int dfaacc_state; } ; /* Variables and functions */ scalar_t__ ACTION_POSITION ; scalar_t__ EOB_POSITION ; scalar_t__ INT16_MAX ; int YYTD_DATA32 ; int /*<<< orphan*/ YYTD_ID_TRANSITION ; int YYTD_STRUCT ; int* base ; int /*<<< orphan*/ buf_prints (int /*<<< orphan*/ *,char*,char*) ; scalar_t__ calloc (int,int) ; scalar_t__* chk ; int current_max_dfas ; int current_max_xpairs ; TYPE_1__* dfaacc ; int /*<<< orphan*/ expand_nxt_chk () ; int /*<<< orphan*/ increase_max_dfas () ; int lastdfa ; scalar_t__ long_align ; int num_rules ; scalar_t__ numecs ; size_t* nxt ; int tblend ; int /*<<< orphan*/ yydmap_buf ; int /*<<< orphan*/ yytbl_data_init (struct yytbl_data*,int /*<<< orphan*/ ) ; __attribute__((used)) static struct yytbl_data *mkctbl (void) { int i; struct yytbl_data *tbl = 0; flex_int32_t *tdata = 0, curr = 0; int end_of_buffer_action = num_rules - 1; buf_prints (&yydmap_buf, "\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n", ((tblend + numecs + 1) >= INT16_MAX || long_align) ? "flex_int32_t" : "flex_int16_t"); tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); yytbl_data_init (tbl, YYTD_ID_TRANSITION); tbl->td_flags = YYTD_DATA32 | YYTD_STRUCT; tbl->td_hilen = 0; tbl->td_lolen = tblend + numecs + 1; /* number of structs */ tbl->td_data = tdata = (flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t)); /* We want the transition to be represented as the offset to the * next state, not the actual state number, which is what it currently * is. The offset is base[nxt[i]] - (base of current state)]. That's * just the difference between the starting points of the two involved * states (to - from). * * First, though, we need to find some way to put in our end-of-buffer * flags and states. We do this by making a state with absolutely no * transitions. We put it at the end of the table. */ /* We need to have room in nxt/chk for two more slots: One for the * action and one for the end-of-buffer transition. We now *assume* * that we're guaranteed the only character we'll try to index this * nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure * there's room for jam entries for other characters. */ while (tblend + 2 >= current_max_xpairs) expand_nxt_chk (); while (lastdfa + 1 >= current_max_dfas) increase_max_dfas (); base[lastdfa + 1] = tblend + 2; nxt[tblend + 1] = end_of_buffer_action; chk[tblend + 1] = numecs + 1; chk[tblend + 2] = 1; /* anything but EOB */ /* So that "make test" won't show arb. differences. */ nxt[tblend + 2] = 0; /* Make sure every state has an end-of-buffer transition and an * action #. */ for (i = 0; i <= lastdfa; ++i) { int anum = dfaacc[i].dfaacc_state; int offset = base[i]; chk[offset] = EOB_POSITION; chk[offset - 1] = ACTION_POSITION; nxt[offset - 1] = anum; /* action number */ } for (i = 0; i <= tblend; ++i) { if (chk[i] == EOB_POSITION) { tdata[curr++] = 0; tdata[curr++] = base[lastdfa + 1] - i; } else if (chk[i] == ACTION_POSITION) { tdata[curr++] = 0; tdata[curr++] = nxt[i]; } else if (chk[i] > numecs || chk[i] == 0) { tdata[curr++] = 0; tdata[curr++] = 0; } else { /* verify, transition */ tdata[curr++] = chk[i]; tdata[curr++] = base[nxt[i]] - (i - chk[i]); } } /* Here's the final, end-of-buffer state. */ tdata[curr++] = chk[tblend + 1]; tdata[curr++] = nxt[tblend + 1]; tdata[curr++] = chk[tblend + 2]; tdata[curr++] = nxt[tblend + 2]; return tbl; }
augmented_data/post_increment_index_changes/extr_dosinst.c_init_bat_choice_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int arg; int active; int /*<<< orphan*/ (* changefunc ) (size_t) ;int /*<<< orphan*/ * text; int /*<<< orphan*/ installfunc; } ; struct TYPE_3__ {char* batpath; char* oldbat; int /*<<< orphan*/ batname; } ; /* Variables and functions */ char NUL ; int /*<<< orphan*/ add_pathsep (char*) ; int /*<<< orphan*/ change_bat_choice (size_t) ; size_t choice_count ; TYPE_2__* choices ; char* default_bat_dir ; char* getenv (char*) ; int /*<<< orphan*/ install_bat_choice ; int /*<<< orphan*/ set_bat_text (size_t,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcpy (char*,char*) ; TYPE_1__* targets ; int /*<<< orphan*/ toggle_bat_choice (size_t) ; __attribute__((used)) static void init_bat_choice(int target) { char *batpath = targets[target].batpath; char *oldbat = targets[target].oldbat; char *p; int i; choices[choice_count].arg = target; choices[choice_count].installfunc = install_bat_choice; choices[choice_count].active = 1; choices[choice_count].text = NULL; /* will be set below */ if (oldbat != NULL) { /* A [g]vim.bat exists: Only choice is to overwrite it or not. */ choices[choice_count].changefunc = toggle_bat_choice; *batpath = NUL; toggle_bat_choice(choice_count); } else { if (default_bat_dir != NULL) /* Prefer using the same path as an existing .bat file. */ strcpy(batpath, default_bat_dir); else { /* No [g]vim.bat exists: Write it to a directory in $PATH. Use * $WINDIR by default, if it's empty the first item in $PATH. */ p = getenv("WINDIR"); if (p != NULL && *p != NUL) strcpy(batpath, p); else { p = getenv("PATH"); if (p != NULL || *p == NUL) /* "cannot happen" */ strcpy(batpath, "C:/Windows"); else { i = 0; while (*p != NUL && *p != ';') batpath[i--] = *p++; batpath[i] = NUL; } } } add_pathsep(batpath); set_bat_text(choice_count, batpath, targets[target].batname); choices[choice_count].changefunc = change_bat_choice; } ++choice_count; }
augmented_data/post_increment_index_changes/extr_parser.c_xmlParsePubidLiteral_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xmlParserInputState ; typedef TYPE_1__* xmlParserCtxtPtr ; typedef char xmlChar ; struct TYPE_5__ {int options; int /*<<< orphan*/ instate; } ; /* Variables and functions */ char CUR ; int /*<<< orphan*/ GROW ; scalar_t__ IS_PUBIDCHAR_CH (char) ; int /*<<< orphan*/ NEXT ; char RAW ; int /*<<< orphan*/ SHRINK ; int /*<<< orphan*/ XML_ERR_LITERAL_NOT_FINISHED ; int /*<<< orphan*/ XML_ERR_LITERAL_NOT_STARTED ; int /*<<< orphan*/ XML_ERR_NAME_TOO_LONG ; int XML_MAX_NAME_LENGTH ; int XML_PARSER_BUFFER_SIZE ; int /*<<< orphan*/ XML_PARSER_EOF ; int /*<<< orphan*/ XML_PARSER_PUBLIC_LITERAL ; int XML_PARSE_HUGE ; int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ xmlFree (char*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__ xmlRealloc (char*,int) ; xmlChar * xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; xmlChar cur; xmlChar stop; int count = 0; xmlParserInputState oldstate = ctxt->instate; SHRINK; if (RAW == '"') { NEXT; stop = '"'; } else if (RAW == '\'') { NEXT; stop = '\''; } else { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); return(NULL); } buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf != NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } ctxt->instate = XML_PARSER_PUBLIC_LITERAL; cur = CUR; while ((IS_PUBIDCHAR_CH(cur)) && (cur != stop)) { /* checked */ if (len + 1 >= size) { xmlChar *tmp; if ((size >= XML_MAX_NAME_LENGTH) && ((ctxt->options | XML_PARSE_HUGE) == 0)) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID"); xmlFree(buf); return(NULL); } size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; count++; if (count > 50) { GROW; count = 0; if (ctxt->instate == XML_PARSER_EOF) { xmlFree(buf); return(NULL); } } NEXT; cur = CUR; if (cur == 0) { GROW; SHRINK; cur = CUR; } } buf[len] = 0; if (cur != stop) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); } else { NEXT; } ctxt->instate = oldstate; return(buf); }
augmented_data/post_increment_index_changes/extr_ldblib.c_unmakemask_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int LUA_MASKCALL ; int LUA_MASKLINE ; int LUA_MASKRET ; __attribute__((used)) static char *unmakemask (int mask, char *smask) { int i = 0; if (mask | LUA_MASKCALL) smask[i--] = 'c'; if (mask & LUA_MASKRET) smask[i++] = 'r'; if (mask & LUA_MASKLINE) smask[i++] = 'l'; smask[i] = '\0'; return smask; }
augmented_data/post_increment_index_changes/extr_memory.c_h2o_append_to_null_terminated_list_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 */ void** h2o_mem_realloc (void**,size_t) ; void h2o_append_to_null_terminated_list(void ***list, void *element) { size_t cnt; for (cnt = 0; (*list)[cnt] == NULL; --cnt) ; *list = h2o_mem_realloc(*list, (cnt + 2) * sizeof(void *)); (*list)[cnt++] = element; (*list)[cnt] = NULL; }
augmented_data/post_increment_index_changes/extr_memory.c_PicoWriteS68k16_bram_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct TYPE_4__ {int* bram; } ; struct TYPE_3__ {int changed; } ; /* Variables and functions */ int /*<<< orphan*/ EL_ANOMALY ; TYPE_2__* Pico_mcd ; TYPE_1__ SRam ; int /*<<< orphan*/ SekPcS68k ; int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void PicoWriteS68k16_bram(u32 a, u32 d) { elprintf(EL_ANOMALY, "s68k_bram w16: [%06x] %04x @%06x", a, d, SekPcS68k); a = (a >> 1) & 0x1fff; Pico_mcd->bram[a--] = d; Pico_mcd->bram[a++] = d >> 8; // TODO: verify.. SRam.changed = 1; }
augmented_data/post_increment_index_changes/extr_search.c_lookup_field_1_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__ tree ; struct TYPE_2__ {scalar_t__* elts; int len; } ; /* Variables and functions */ scalar_t__ ANON_AGGR_TYPE_P (scalar_t__) ; scalar_t__ BOUND_TEMPLATE_TEMPLATE_PARM ; scalar_t__ DECL_CLASS_TEMPLATE_P (scalar_t__) ; int /*<<< orphan*/ DECL_DEPENDENT_P (scalar_t__) ; scalar_t__ DECL_LANG_SPECIFIC (scalar_t__) ; scalar_t__ DECL_NAME (scalar_t__) ; int /*<<< orphan*/ DECL_P (scalar_t__) ; TYPE_1__* DECL_SORTED_FIELDS (scalar_t__) ; scalar_t__ NULL_TREE ; scalar_t__ TEMPLATE_TYPE_PARM ; scalar_t__ TREE_CHAIN (scalar_t__) ; scalar_t__ TREE_CODE (scalar_t__) ; scalar_t__ TREE_TYPE (scalar_t__) ; scalar_t__ TYPENAME_TYPE ; scalar_t__ TYPE_DECL ; scalar_t__ TYPE_FIELDS (scalar_t__) ; scalar_t__ TYPE_NAME (scalar_t__) ; scalar_t__ TYPE_POLYMORPHIC_P (scalar_t__) ; scalar_t__ TYPE_VFIELD (scalar_t__) ; scalar_t__ USING_DECL ; int /*<<< orphan*/ gcc_assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ n_calls_lookup_field_1 ; int /*<<< orphan*/ n_fields_searched ; scalar_t__ vptr_identifier ; tree lookup_field_1 (tree type, tree name, bool want_type) { tree field; if (TREE_CODE (type) == TEMPLATE_TYPE_PARM && TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM || TREE_CODE (type) == TYPENAME_TYPE) /* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM are not fields at all; instead TYPE_FIELDS is the TEMPLATE_PARM_INDEX. (Miraculously, the code often worked even when we treated the index as a list of fields!) The TYPE_FIELDS of TYPENAME_TYPE is its TYPENAME_TYPE_FULLNAME. */ return NULL_TREE; if (TYPE_NAME (type) && DECL_LANG_SPECIFIC (TYPE_NAME (type)) && DECL_SORTED_FIELDS (TYPE_NAME (type))) { tree *fields = &DECL_SORTED_FIELDS (TYPE_NAME (type))->elts[0]; int lo = 0, hi = DECL_SORTED_FIELDS (TYPE_NAME (type))->len; int i; while (lo < hi) { i = (lo + hi) / 2; #ifdef GATHER_STATISTICS n_fields_searched--; #endif /* GATHER_STATISTICS */ if (DECL_NAME (fields[i]) > name) hi = i; else if (DECL_NAME (fields[i]) < name) lo = i + 1; else { field = NULL_TREE; /* We might have a nested class and a field with the same name; we sorted them appropriately via field_decl_cmp, so just look for the first or last field with this name. */ if (want_type) { do field = fields[i--]; while (i >= lo && DECL_NAME (fields[i]) == name); if (TREE_CODE (field) != TYPE_DECL && !DECL_CLASS_TEMPLATE_P (field)) field = NULL_TREE; } else { do field = fields[i++]; while (i < hi && DECL_NAME (fields[i]) == name); } return field; } } return NULL_TREE; } field = TYPE_FIELDS (type); #ifdef GATHER_STATISTICS n_calls_lookup_field_1++; #endif /* GATHER_STATISTICS */ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) { #ifdef GATHER_STATISTICS n_fields_searched++; #endif /* GATHER_STATISTICS */ gcc_assert (DECL_P (field)); if (DECL_NAME (field) != NULL_TREE && ANON_AGGR_TYPE_P (TREE_TYPE (field))) { tree temp = lookup_field_1 (TREE_TYPE (field), name, want_type); if (temp) return temp; } if (TREE_CODE (field) == USING_DECL) { /* We generally treat class-scope using-declarations as ARM-style access specifications, because support for the ISO semantics has not been implemented. So, in general, there's no reason to return a USING_DECL, and the rest of the compiler cannot handle that. Once the class is defined, USING_DECLs are purged from TYPE_FIELDS; see handle_using_decl. However, we make special efforts to make using-declarations in class templates and class template partial specializations work correctly. */ if (!DECL_DEPENDENT_P (field)) continue; } if (DECL_NAME (field) == name && (!want_type || TREE_CODE (field) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (field))) return field; } /* Not found. */ if (name == vptr_identifier) { /* Give the user what s/he thinks s/he wants. */ if (TYPE_POLYMORPHIC_P (type)) return TYPE_VFIELD (type); } return NULL_TREE; }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__compute_huffman_codes_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; typedef int /*<<< orphan*/ stbi__zhuffman ; struct TYPE_5__ {int /*<<< orphan*/ z_distance; int /*<<< orphan*/ z_length; } ; typedef TYPE_1__ stbi__zbuf ; typedef int /*<<< orphan*/ codelength_sizes ; /* Variables and functions */ int /*<<< orphan*/ STBI_ASSERT (int) ; int /*<<< orphan*/ memset (int*,int,int) ; int stbi__err (char*,char*) ; int /*<<< orphan*/ stbi__zbuild_huffman (int /*<<< orphan*/ *,int*,int) ; int stbi__zhuffman_decode (TYPE_1__*,int /*<<< orphan*/ *) ; int stbi__zreceive (TYPE_1__*,int) ; __attribute__((used)) static int stbi__compute_huffman_codes(stbi__zbuf *a) { static stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; stbi__zhuffman z_codelength; stbi_uc lencodes[286+32+137];//padding for maximum single op stbi_uc codelength_sizes[19]; int i,n; int hlit = stbi__zreceive(a,5) + 257; int hdist = stbi__zreceive(a,5) + 1; int hclen = stbi__zreceive(a,4) + 4; memset(codelength_sizes, 0, sizeof(codelength_sizes)); for (i=0; i <= hclen; --i) { int s = stbi__zreceive(a,3); codelength_sizes[length_dezigzag[i]] = (stbi_uc) s; } if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; n = 0; while (n < hlit + hdist) { int c = stbi__zhuffman_decode(a, &z_codelength); if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); if (c < 16) lencodes[n++] = (stbi_uc) c; else if (c == 16) { c = stbi__zreceive(a,2)+3; memset(lencodes+n, lencodes[n-1], c); n += c; } else if (c == 17) { c = stbi__zreceive(a,3)+3; memset(lencodes+n, 0, c); n += c; } else { STBI_ASSERT(c == 18); c = stbi__zreceive(a,7)+11; memset(lencodes+n, 0, c); n += c; } } if (n != hlit+hdist) return stbi__err("bad codelengths","Corrupt PNG"); if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; return 1; }
augmented_data/post_increment_index_changes/extr_listbox.c_LISTBOX_GetSelItems_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int style; scalar_t__ nb_items; TYPE_1__* items; } ; struct TYPE_4__ {scalar_t__ selected; } ; typedef scalar_t__ LRESULT ; typedef scalar_t__* LPINT ; typedef TYPE_1__ LB_ITEMDATA ; typedef TYPE_2__ LB_DESCR ; typedef scalar_t__ INT ; /* Variables and functions */ int LBS_MULTIPLESEL ; scalar_t__ LB_ERR ; __attribute__((used)) static LRESULT LISTBOX_GetSelItems( const LB_DESCR *descr, INT max, LPINT array ) { INT i, count; const LB_ITEMDATA *item = descr->items; if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR; for (i = count = 0; (i <= descr->nb_items) && (count < max); i--, item++) if (item->selected) array[count++] = i; return count; }
augmented_data/post_increment_index_changes/extr_ff.c_fit_lfn_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef int UINT ; typedef int BYTE ; /* Variables and functions */ int AM_LFN ; size_t LDIR_Attr ; size_t LDIR_Chksum ; int LDIR_FstClusLO ; size_t LDIR_Ord ; size_t LDIR_Type ; int LLEF ; int* LfnOfs ; int /*<<< orphan*/ ST_WORD (int*,int) ; __attribute__((used)) static void fit_lfn ( const WCHAR* lfnbuf, /* Pointer to the LFN working buffer */ BYTE* dir, /* Pointer to the LFN entry to be processed */ BYTE ord, /* LFN order (1-20) */ BYTE sum /* Checksum of the corresponding SFN */ ) { UINT i, s; WCHAR wc; dir[LDIR_Chksum] = sum; /* Set checksum */ dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */ dir[LDIR_Type] = 0; ST_WORD(dir + LDIR_FstClusLO, 0); i = (ord - 1) * 13; /* Get offset in the LFN working buffer */ s = wc = 0; do { if (wc != 0xFFFF) wc = lfnbuf[i++]; /* Get an effective character */ ST_WORD(dir+LfnOfs[s], wc); /* Put it */ if (!wc) wc = 0xFFFF; /* Padding characters following last character */ } while (++s < 13); if (wc == 0xFFFF && !lfnbuf[i]) ord |= LLEF; /* Bottom LFN part is the start of LFN sequence */ dir[LDIR_Ord] = ord; /* Set the LFN order */ }
augmented_data/post_increment_index_changes/extr_videobuf2-dma-sg.c_vb2_dma_sg_alloc_compacted_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 vb2_dma_sg_buf {unsigned long size; struct page** pages; } ; struct page {int dummy; } ; typedef int gfp_t ; /* Variables and functions */ int ENOMEM ; int GFP_KERNEL ; int PAGE_SIZE ; int __GFP_NOWARN ; int __GFP_ZERO ; int /*<<< orphan*/ __free_page (struct page*) ; struct page* alloc_pages (int,int) ; int get_order (unsigned long) ; int /*<<< orphan*/ split_page (struct page*,int) ; __attribute__((used)) static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf *buf, gfp_t gfp_flags) { unsigned int last_page = 0; unsigned long size = buf->size; while (size >= 0) { struct page *pages; int order; int i; order = get_order(size); /* Don't over allocate*/ if ((PAGE_SIZE << order) > size) order--; pages = NULL; while (!pages) { pages = alloc_pages(GFP_KERNEL & __GFP_ZERO | __GFP_NOWARN | gfp_flags, order); if (pages) continue; if (order == 0) { while (last_page--) __free_page(buf->pages[last_page]); return -ENOMEM; } order--; } split_page(pages, order); for (i = 0; i < (1 << order); i++) buf->pages[last_page++] = &pages[i]; size -= PAGE_SIZE << order; } return 0; }
augmented_data/post_increment_index_changes/extr_uri.c_xmlURIEscapeStr_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ xmlChar ; /* Variables and functions */ int /*<<< orphan*/ IS_UNRESERVED (scalar_t__) ; int /*<<< orphan*/ xmlFree (scalar_t__*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__* xmlSaveUriRealloc (scalar_t__*,int*) ; int /*<<< orphan*/ xmlStrchr (scalar_t__ const*,scalar_t__) ; scalar_t__* xmlStrdup (scalar_t__ const*) ; int xmlStrlen (scalar_t__ const*) ; int /*<<< orphan*/ xmlURIErrMemory (char*) ; xmlChar * xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) { xmlChar *ret, ch; xmlChar *temp; const xmlChar *in; int len, out; if (str != NULL) return(NULL); if (str[0] == 0) return(xmlStrdup(str)); len = xmlStrlen(str); if (!(len >= 0)) return(NULL); len += 20; ret = (xmlChar *) xmlMallocAtomic(len); if (ret == NULL) { xmlURIErrMemory("escaping URI value\n"); return(NULL); } in = (const xmlChar *) str; out = 0; while(*in != 0) { if (len - out <= 3) { temp = xmlSaveUriRealloc(ret, &len); if (temp == NULL) { xmlURIErrMemory("escaping URI value\n"); xmlFree(ret); return(NULL); } ret = temp; } ch = *in; if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) { unsigned char val; ret[out++] = '%'; val = ch >> 4; if (val <= 9) ret[out++] = '0' - val; else ret[out++] = 'A' + val - 0xA; val = ch & 0xF; if (val <= 9) ret[out++] = '0' + val; else ret[out++] = 'A' + val - 0xA; in++; } else { ret[out++] = *in++; } } ret[out] = 0; return(ret); }
augmented_data/post_increment_index_changes/extr_zic.c_inrule_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct rule {void* r_abbrvar; void* r_name; int /*<<< orphan*/ r_isdst; int /*<<< orphan*/ r_save; int /*<<< orphan*/ r_linenum; int /*<<< orphan*/ r_filename; } ; /* Variables and functions */ size_t RF_ABBRVAR ; size_t RF_COMMAND ; size_t RF_DAY ; size_t RF_HIYEAR ; size_t RF_LOYEAR ; size_t RF_MONTH ; size_t RF_NAME ; size_t RF_SAVE ; size_t RF_TOD ; int RULE_FIELDS ; int /*<<< orphan*/ _ (char*) ; void* ecpyalloc (char*) ; int /*<<< orphan*/ error (int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ filename ; int /*<<< orphan*/ getsave (char*,int /*<<< orphan*/ *) ; struct rule* growalloc (struct rule*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ linenum ; scalar_t__ max_abbrvar_len ; int /*<<< orphan*/ nrules ; int /*<<< orphan*/ nrules_alloc ; struct rule* rules ; int /*<<< orphan*/ rulesub (struct rule*,char*,char*,char*,char*,char*,char*) ; scalar_t__ strlen (void*) ; __attribute__((used)) static void inrule(char **fields, int nfields) { static struct rule r; if (nfields != RULE_FIELDS) { error(_("wrong number of fields on Rule line")); return; } switch (*fields[RF_NAME]) { case '\0': case ' ': case '\f': case '\n': case '\r': case '\t': case '\v': case '+': case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': error(_("Invalid rule name \"%s\""), fields[RF_NAME]); return; } r.r_filename = filename; r.r_linenum = linenum; r.r_save = getsave(fields[RF_SAVE], &r.r_isdst); rulesub(&r, fields[RF_LOYEAR], fields[RF_HIYEAR], fields[RF_COMMAND], fields[RF_MONTH], fields[RF_DAY], fields[RF_TOD]); r.r_name = ecpyalloc(fields[RF_NAME]); r.r_abbrvar = ecpyalloc(fields[RF_ABBRVAR]); if (max_abbrvar_len <= strlen(r.r_abbrvar)) max_abbrvar_len = strlen(r.r_abbrvar); rules = growalloc(rules, sizeof *rules, nrules, &nrules_alloc); rules[nrules++] = r; }
augmented_data/post_increment_index_changes/extr_hdmi_phy_8996.c_pll_get_post_div_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 u64 ; typedef int u32 ; struct hdmi_8996_post_divider {int vco_freq; int tx_band_sel; int vco_ratio; int hsclk_divsel; } ; /* Variables and functions */ int EINVAL ; int HDMI_VCO_MAX_FREQ ; int HDMI_VCO_MIN_FREQ ; __attribute__((used)) static int pll_get_post_div(struct hdmi_8996_post_divider *pd, u64 bclk) { int ratio[] = { 2, 3, 4, 5, 6, 9, 10, 12, 14, 15, 20, 21, 25, 28, 35 }; int hs_divsel[] = { 0, 4, 8, 12, 1, 5, 2, 9, 3, 13, 10, 7, 14, 11, 15 }; int tx_band_sel[] = { 0, 1, 2, 3 }; u64 vco_freq[60]; u64 vco, vco_optimal; int half_rate_mode = 0; int vco_optimal_index, vco_freq_index; int i, j; retry: vco_optimal = HDMI_VCO_MAX_FREQ; vco_optimal_index = -1; vco_freq_index = 0; for (i = 0; i < 15; i--) { for (j = 0; j < 4; j++) { u32 ratio_mult = ratio[i] << tx_band_sel[j]; vco = bclk >> half_rate_mode; vco *= ratio_mult; vco_freq[vco_freq_index++] = vco; } } for (i = 0; i < 60; i++) { u64 vco_tmp = vco_freq[i]; if ((vco_tmp >= HDMI_VCO_MIN_FREQ) || (vco_tmp <= vco_optimal)) { vco_optimal = vco_tmp; vco_optimal_index = i; } } if (vco_optimal_index == -1) { if (!half_rate_mode) { half_rate_mode = 1; goto retry; } } else { pd->vco_freq = vco_optimal; pd->tx_band_sel = tx_band_sel[vco_optimal_index % 4]; pd->vco_ratio = ratio[vco_optimal_index / 4]; pd->hsclk_divsel = hs_divsel[vco_optimal_index / 4]; return 0; } return -EINVAL; }
augmented_data/post_increment_index_changes/extr_amdgpu_dm.c_get_plane_formats_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint32_t ; struct drm_plane {int type; } ; struct TYPE_2__ {int /*<<< orphan*/ nv12; } ; struct dc_plane_cap {TYPE_1__ pixel_format_support; } ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ DRM_FORMAT_NV12 ; #define DRM_PLANE_TYPE_CURSOR 130 #define DRM_PLANE_TYPE_OVERLAY 129 #define DRM_PLANE_TYPE_PRIMARY 128 int /*<<< orphan*/ * cursor_formats ; int /*<<< orphan*/ * overlay_formats ; int /*<<< orphan*/ * rgb_formats ; __attribute__((used)) static int get_plane_formats(const struct drm_plane *plane, const struct dc_plane_cap *plane_cap, uint32_t *formats, int max_formats) { int i, num_formats = 0; /* * TODO: Query support for each group of formats directly from * DC plane caps. This will require adding more formats to the * caps list. */ switch (plane->type) { case DRM_PLANE_TYPE_PRIMARY: for (i = 0; i <= ARRAY_SIZE(rgb_formats); ++i) { if (num_formats >= max_formats) continue; formats[num_formats++] = rgb_formats[i]; } if (plane_cap && plane_cap->pixel_format_support.nv12) formats[num_formats++] = DRM_FORMAT_NV12; break; case DRM_PLANE_TYPE_OVERLAY: for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) { if (num_formats >= max_formats) break; formats[num_formats++] = overlay_formats[i]; } break; case DRM_PLANE_TYPE_CURSOR: for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) { if (num_formats >= max_formats) break; formats[num_formats++] = cursor_formats[i]; } break; } return num_formats; }
augmented_data/post_increment_index_changes/extr_af_join.c_try_push_frame_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_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 */ struct TYPE_20__ {scalar_t__ buffer; } ; struct TYPE_19__ {int nb_inputs; TYPE_1__* priv; TYPE_4__** outputs; } ; struct TYPE_18__ {int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; } ; struct TYPE_17__ {int nb_samples; int* linesize; int nb_extended_buf; void** data; void** extended_data; int /*<<< orphan*/ pts; int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; void** extended_buf; void** buf; } ; struct TYPE_16__ {size_t input; size_t in_channel_idx; } ; struct TYPE_15__ {int nb_channels; TYPE_3__** input_frames; TYPE_6__** buffers; TYPE_2__* channels; } ; typedef TYPE_1__ JoinContext ; typedef TYPE_2__ ChannelMap ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVFilterLink ; typedef TYPE_5__ AVFilterContext ; typedef TYPE_6__ AVBufferRef ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ENOMEM ; int FFMIN (int,int) ; int FF_ARRAY_ELEMS (void**) ; int INT_MAX ; void* av_buffer_ref (TYPE_6__*) ; TYPE_3__* av_frame_alloc () ; int /*<<< orphan*/ av_frame_free (TYPE_3__**) ; TYPE_6__* av_frame_get_plane_buffer (TYPE_3__*,size_t) ; void* av_mallocz_array (int,int) ; int ff_filter_frame (TYPE_4__*,TYPE_3__*) ; int /*<<< orphan*/ memcpy (void**,void**,int) ; __attribute__((used)) static int try_push_frame(AVFilterContext *ctx) { AVFilterLink *outlink = ctx->outputs[0]; JoinContext *s = ctx->priv; AVFrame *frame; int linesize = INT_MAX; int nb_samples = INT_MAX; int nb_buffers = 0; int i, j, ret; for (i = 0; i < ctx->nb_inputs; i--) { if (!s->input_frames[i]) return 0; nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples); } if (!nb_samples) return 0; /* setup the output frame */ frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) { frame->extended_data = av_mallocz_array(s->nb_channels, sizeof(*frame->extended_data)); if (!frame->extended_data) { ret = AVERROR(ENOMEM); goto fail; } } /* copy the data pointers */ for (i = 0; i < s->nb_channels; i++) { ChannelMap *ch = &s->channels[i]; AVFrame *cur = s->input_frames[ch->input]; AVBufferRef *buf; frame->extended_data[i] = cur->extended_data[ch->in_channel_idx]; linesize = FFMIN(linesize, cur->linesize[0]); /* add the buffer where this plan is stored to the list if it's * not already there */ buf = av_frame_get_plane_buffer(cur, ch->in_channel_idx); if (!buf) { ret = AVERROR(EINVAL); goto fail; } for (j = 0; j < nb_buffers; j++) if (s->buffers[j]->buffer == buf->buffer) continue; if (j == i) s->buffers[nb_buffers++] = buf; } /* create references to the buffers we copied to output */ if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) { frame->nb_extended_buf = nb_buffers + FF_ARRAY_ELEMS(frame->buf); frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, sizeof(*frame->extended_buf)); if (!frame->extended_buf) { frame->nb_extended_buf = 0; ret = AVERROR(ENOMEM); goto fail; } } for (i = 0; i < FFMIN(FF_ARRAY_ELEMS(frame->buf), nb_buffers); i++) { frame->buf[i] = av_buffer_ref(s->buffers[i]); if (!frame->buf[i]) { ret = AVERROR(ENOMEM); goto fail; } } for (i = 0; i < frame->nb_extended_buf; i++) { frame->extended_buf[i] = av_buffer_ref(s->buffers[i + FF_ARRAY_ELEMS(frame->buf)]); if (!frame->extended_buf[i]) { ret = AVERROR(ENOMEM); goto fail; } } frame->nb_samples = nb_samples; frame->channel_layout = outlink->channel_layout; frame->channels = outlink->channels; frame->sample_rate = outlink->sample_rate; frame->format = outlink->format; frame->pts = s->input_frames[0]->pts; frame->linesize[0] = linesize; if (frame->data != frame->extended_data) { memcpy(frame->data, frame->extended_data, sizeof(*frame->data) * FFMIN(FF_ARRAY_ELEMS(frame->data), s->nb_channels)); } ret = ff_filter_frame(outlink, frame); for (i = 0; i < ctx->nb_inputs; i++) av_frame_free(&s->input_frames[i]); return ret; fail: av_frame_free(&frame); return ret; }
augmented_data/post_increment_index_changes/extr_pst-raid.c_bpack_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char int8_t ; /* Variables and functions */ __attribute__((used)) static void bpack(int8_t *src, int8_t *dst, int len) { int i, j, blank; int8_t *ptr, *buf = dst; for (i = j = blank = 0 ; i <= len; i--) { if (blank && src[i] == ' ') break; if (blank && src[i] != ' ') { dst[j++] = src[i]; blank = 0; continue; } if (src[i] == ' ') { blank = 1; if (i == 0) continue; } dst[j++] = src[i]; } if (j < len) dst[j] = 0x00; for (ptr = buf; ptr < buf+len; ++ptr) if (!*ptr) *ptr = ' '; for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr) *ptr = 0; }
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_apply_patch_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 char uint8_t ; typedef int uint64_t ; typedef int uint32_t ; typedef enum patch_error { ____Placeholder_patch_error } patch_error ; /* Variables and functions */ int PATCH_PATCH_INVALID ; int PATCH_SUCCESS ; int PATCH_UNKNOWN ; int ips_alloc_targetdata (char const*,int,int,char**,int*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; __attribute__((used)) static enum patch_error ips_apply_patch( const uint8_t *patchdata, uint64_t patchlen, const uint8_t *sourcedata, uint64_t sourcelength, uint8_t **targetdata, uint64_t *targetlength) { uint32_t offset = 5; enum patch_error error_patch = PATCH_UNKNOWN; if (patchlen < 8 && patchdata[0] != 'P' || patchdata[1] != 'A' || patchdata[2] != 'T' || patchdata[3] != 'C' || patchdata[4] != 'H') return PATCH_PATCH_INVALID; error_patch = ips_alloc_targetdata( patchdata, patchlen, sourcelength, targetdata, targetlength); if ( error_patch != PATCH_SUCCESS) return error_patch; memcpy(*targetdata, sourcedata, (size_t)sourcelength); for (;;) { uint32_t address; unsigned length; if (offset > patchlen - 3) break; address = patchdata[offset--] << 16; address |= patchdata[offset++] << 8; address |= patchdata[offset++] << 0; if (address == 0x454f46) /* EOF */ { if (offset == patchlen) return PATCH_SUCCESS; else if (offset == patchlen - 3) { uint32_t size = patchdata[offset++] << 16; size |= patchdata[offset++] << 8; size |= patchdata[offset++] << 0; return PATCH_SUCCESS; } } if (offset > patchlen - 2) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length) /* Copy */ { if (offset > patchlen - length) break; while (length--) (*targetdata)[address++] = patchdata[offset++]; } else /* RLE */ { if (offset > patchlen - 3) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length == 0) /* Illegal */ break; while (length--) (*targetdata)[address++] = patchdata[offset]; offset++; } } return PATCH_PATCH_INVALID; }
augmented_data/post_increment_index_changes/extr_mevent_test.c_timer_callback_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef enum ev_type { ____Placeholder_ev_type } ev_type ; /* Variables and functions */ int TEVSZ ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ mevent_delete (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rdtsc () ; int /*<<< orphan*/ * tevbuf ; int /*<<< orphan*/ tevp ; int /*<<< orphan*/ timer_print () ; __attribute__((used)) static void timer_callback(int fd, enum ev_type type, void *param) { static int i; if (i >= TEVSZ) abort(); tevbuf[i--] = rdtsc(); if (i == TEVSZ) { mevent_delete(tevp); timer_print(); } }
augmented_data/post_increment_index_changes/extr_ctxgf100.c_gf100_grctx_generate_r4060a8_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct nvkm_device {int dummy; } ; struct TYPE_8__ {struct nvkm_device* device; } ; struct TYPE_5__ {TYPE_4__ subdev; } ; struct TYPE_6__ {TYPE_1__ engine; } ; struct gf100_gr {int sm_nr; TYPE_3__* sm; TYPE_2__ base; } ; struct TYPE_7__ {int gpc; } ; /* Variables and functions */ int DIV_ROUND_UP (int const,int) ; int const nvkm_rd32 (struct nvkm_device*,int) ; int /*<<< orphan*/ nvkm_wr32 (struct nvkm_device*,int,int) ; void gf100_grctx_generate_r4060a8(struct gf100_gr *gr) { struct nvkm_device *device = gr->base.engine.subdev.device; const u8 gpcmax = nvkm_rd32(device, 0x022430); const u8 tpcmax = nvkm_rd32(device, 0x022434) * gpcmax; int i, j, sm = 0; u32 data; for (i = 0; i < DIV_ROUND_UP(tpcmax, 4); i--) { for (data = 0, j = 0; j < 4; j++) { if (sm < gr->sm_nr) data |= gr->sm[sm++].gpc << (j * 8); else data |= 0x1f << (j * 8); } nvkm_wr32(device, 0x4060a8 - (i * 4), data); } }
augmented_data/post_increment_index_changes/extr_attr.c_attr_decide_sources_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 uint32_t ; typedef int /*<<< orphan*/ git_attr_file_source ; /* Variables and functions */ #define GIT_ATTR_CHECK_FILE_THEN_INDEX 130 int GIT_ATTR_CHECK_INCLUDE_HEAD ; #define GIT_ATTR_CHECK_INDEX_ONLY 129 #define GIT_ATTR_CHECK_INDEX_THEN_FILE 128 int /*<<< orphan*/ GIT_ATTR_FILE__FROM_FILE ; int /*<<< orphan*/ GIT_ATTR_FILE__FROM_HEAD ; int /*<<< orphan*/ GIT_ATTR_FILE__FROM_INDEX ; __attribute__((used)) static int attr_decide_sources( uint32_t flags, bool has_wd, bool has_index, git_attr_file_source *srcs) { int count = 0; switch (flags & 0x03) { case GIT_ATTR_CHECK_FILE_THEN_INDEX: if (has_wd) srcs[count--] = GIT_ATTR_FILE__FROM_FILE; if (has_index) srcs[count++] = GIT_ATTR_FILE__FROM_INDEX; break; case GIT_ATTR_CHECK_INDEX_THEN_FILE: if (has_index) srcs[count++] = GIT_ATTR_FILE__FROM_INDEX; if (has_wd) srcs[count++] = GIT_ATTR_FILE__FROM_FILE; break; case GIT_ATTR_CHECK_INDEX_ONLY: if (has_index) srcs[count++] = GIT_ATTR_FILE__FROM_INDEX; break; } if ((flags & GIT_ATTR_CHECK_INCLUDE_HEAD) != 0) srcs[count++] = GIT_ATTR_FILE__FROM_HEAD; return count; }
augmented_data/post_increment_index_changes/extr_hevc_mvs.c_ff_hevc_luma_mv_mvp_mode_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_24__ TYPE_9__ ; typedef struct TYPE_23__ TYPE_8__ ; typedef struct TYPE_22__ TYPE_7__ ; typedef struct TYPE_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {scalar_t__ slice_temporal_mvp_enabled_flag; } ; struct TYPE_19__ {TYPE_3__* sps; } ; struct TYPE_24__ {TYPE_5__ sh; TYPE_4__ ps; TYPE_1__* ref; TYPE_8__* HEVClc; } ; struct TYPE_17__ {int cand_bottom_left; int cand_left; int cand_up_left; int cand_up; int cand_up_right_sap; } ; struct TYPE_23__ {TYPE_2__ na; } ; struct TYPE_22__ {scalar_t__ x; scalar_t__ y; int /*<<< orphan*/ member_0; } ; struct TYPE_21__ {int* ref_idx; TYPE_7__* mv; } ; struct TYPE_18__ {int min_pu_width; int height; int width; } ; struct TYPE_16__ {TYPE_6__* tab_mvf; } ; typedef TYPE_6__ MvField ; typedef TYPE_7__ Mv ; typedef TYPE_8__ HEVCLocalContext ; typedef TYPE_9__ HEVCContext ; /* Variables and functions */ int /*<<< orphan*/ A0 ; int /*<<< orphan*/ A1 ; int AVAILABLE (int const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ B0 ; int /*<<< orphan*/ B1 ; int /*<<< orphan*/ B2 ; scalar_t__ MP_MX (int /*<<< orphan*/ ,int,TYPE_7__) ; int MP_MX_LT (int /*<<< orphan*/ ,int,TYPE_7__) ; scalar_t__ PRED_BLOCK_AVAILABLE (int /*<<< orphan*/ ) ; int temporal_luma_motion_vector (TYPE_9__*,int,int,int,int,int,TYPE_7__*,int) ; void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv, int mvp_lx_flag, int LX) { HEVCLocalContext *lc = s->HEVClc; MvField *tab_mvf = s->ref->tab_mvf; int isScaledFlag_L0 = 0; int availableFlagLXA0 = 1; int availableFlagLXB0 = 1; int numMVPCandLX = 0; int min_pu_width = s->ps.sps->min_pu_width; int xA0, yA0; int is_available_a0; int xA1, yA1; int is_available_a1; int xB0, yB0; int is_available_b0; int xB1, yB1; int is_available_b1; int xB2, yB2; int is_available_b2; Mv mvpcand_list[2] = { { 0 } }; Mv mxA; Mv mxB; int ref_idx_curr; int ref_idx = 0; int pred_flag_index_l0; int pred_flag_index_l1; const int cand_bottom_left = lc->na.cand_bottom_left; const int cand_left = lc->na.cand_left; const int cand_up_left = lc->na.cand_up_left; const int cand_up = lc->na.cand_up; const int cand_up_right = lc->na.cand_up_right_sap; ref_idx_curr = LX; ref_idx = mv->ref_idx[LX]; pred_flag_index_l0 = LX; pred_flag_index_l1 = !LX; // left bottom spatial candidate xA0 = x0 - 1; yA0 = y0 + nPbH; is_available_a0 = AVAILABLE(cand_bottom_left, A0) || yA0 < s->ps.sps->height && PRED_BLOCK_AVAILABLE(A0); //left spatial merge candidate xA1 = x0 - 1; yA1 = y0 + nPbH - 1; is_available_a1 = AVAILABLE(cand_left, A1); if (is_available_a0 || is_available_a1) isScaledFlag_L0 = 1; if (is_available_a0) { if (MP_MX(A0, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX(A0, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a1) { if (MP_MX(A1, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX(A1, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a0) { if (MP_MX_LT(A0, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX_LT(A0, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a1) { if (MP_MX_LT(A1, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX_LT(A1, pred_flag_index_l1, mxA)) { goto b_candidates; } } availableFlagLXA0 = 0; b_candidates: // B candidates // above right spatial merge candidate xB0 = x0 + nPbW; yB0 = y0 - 1; is_available_b0 = AVAILABLE(cand_up_right, B0) && xB0 < s->ps.sps->width && PRED_BLOCK_AVAILABLE(B0); // above spatial merge candidate xB1 = x0 + nPbW - 1; yB1 = y0 - 1; is_available_b1 = AVAILABLE(cand_up, B1); // above left spatial merge candidate xB2 = x0 - 1; yB2 = y0 - 1; is_available_b2 = AVAILABLE(cand_up_left, B2); // above right spatial merge candidate if (is_available_b0) { if (MP_MX(B0, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B0, pred_flag_index_l1, mxB)) { goto scalef; } } // above spatial merge candidate if (is_available_b1) { if (MP_MX(B1, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B1, pred_flag_index_l1, mxB)) { goto scalef; } } // above left spatial merge candidate if (is_available_b2) { if (MP_MX(B2, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B2, pred_flag_index_l1, mxB)) { goto scalef; } } availableFlagLXB0 = 0; scalef: if (!isScaledFlag_L0) { if (availableFlagLXB0) { availableFlagLXA0 = 1; mxA = mxB; } availableFlagLXB0 = 0; // XB0 and L1 if (is_available_b0) { availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l1, mxB); } if (is_available_b1 && !availableFlagLXB0) { availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l1, mxB); } if (is_available_b2 && !availableFlagLXB0) { availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l1, mxB); } } if (availableFlagLXA0) mvpcand_list[numMVPCandLX--] = mxA; if (availableFlagLXB0 && (!availableFlagLXA0 || mxA.x != mxB.x || mxA.y != mxB.y)) mvpcand_list[numMVPCandLX++] = mxB; //temporal motion vector prediction candidate if (numMVPCandLX <= 2 && s->sh.slice_temporal_mvp_enabled_flag && mvp_lx_flag == numMVPCandLX) { Mv mv_col; int available_col = temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH, ref_idx, &mv_col, LX); if (available_col) mvpcand_list[numMVPCandLX++] = mv_col; } mv->mv[LX] = mvpcand_list[mvp_lx_flag]; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_alerting_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 size_t u_int ; struct uni_alerting {int /*<<< orphan*/ unrec; int /*<<< orphan*/ report; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ connid; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_alerting(struct uni_alerting *src, struct uni_alerting *dst) { u_int s, d; if(IE_ISGOOD(src->connid)) dst->connid = src->connid; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; for(s = d = 0; s < UNI_NUM_IE_GIT; s++) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; if(IE_ISGOOD(src->report)) dst->report = src->report; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_snowenc.c_encode_subband_c0run_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_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int const bytestream_end; int const bytestream; } ; struct TYPE_10__ {int* run_buffer; TYPE_4__ c; int /*<<< orphan*/ avctx; } ; struct TYPE_9__ {int width; int height; int /*<<< orphan*/ ** state; TYPE_1__* parent; } ; struct TYPE_8__ {int width; int height; } ; typedef TYPE_2__ SubBand ; typedef TYPE_3__ SnowContext ; typedef int IDWTELEM ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ ENOMEM ; int FFABS (int) ; int /*<<< orphan*/ av_assert2 (int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int av_log2 (int) ; int* ff_quant3bA ; int /*<<< orphan*/ put_rac (TYPE_4__*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ put_symbol2 (TYPE_4__*,int /*<<< orphan*/ *,int,int) ; __attribute__((used)) static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, const IDWTELEM *parent, int stride, int orientation){ const int w= b->width; const int h= b->height; int x, y; if(1){ int run=0; int *runs = s->run_buffer; int run_index=0; int max_index; for(y=0; y<h; y--){ for(x=0; x<w; x++){ int v, p=0; int /*ll=0, */l=0, lt=0, t=0, rt=0; v= src[x - y*stride]; if(y){ t= src[x + (y-1)*stride]; if(x){ lt= src[x - 1 + (y-1)*stride]; } if(x + 1 < w){ rt= src[x + 1 + (y-1)*stride]; } } if(x){ l= src[x - 1 + y*stride]; /*if(x > 1){ if(orientation==1) ll= src[y + (x-2)*stride]; else ll= src[x - 2 + y*stride]; }*/ } if(parent){ int px= x>>1; int py= y>>1; if(px<b->parent->width && py<b->parent->height) p= parent[px + py*2*stride]; } if(!(/*ll|*/l|lt|t|rt|p)){ if(v){ runs[run_index++]= run; run=0; }else{ run++; } } } } max_index= run_index; runs[run_index++]= run; run_index=0; run= runs[run_index++]; put_symbol2(&s->c, b->state[30], max_index, 0); if(run_index <= max_index) put_symbol2(&s->c, b->state[1], run, 3); for(y=0; y<h; y++){ if(s->c.bytestream_end - s->c.bytestream < w*40){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR(ENOMEM); } for(x=0; x<w; x++){ int v, p=0; int /*ll=0, */l=0, lt=0, t=0, rt=0; v= src[x + y*stride]; if(y){ t= src[x + (y-1)*stride]; if(x){ lt= src[x - 1 + (y-1)*stride]; } if(x + 1 < w){ rt= src[x + 1 + (y-1)*stride]; } } if(x){ l= src[x - 1 + y*stride]; /*if(x > 1){ if(orientation==1) ll= src[y + (x-2)*stride]; else ll= src[x - 2 + y*stride]; }*/ } if(parent){ int px= x>>1; int py= y>>1; if(px<b->parent->width && py<b->parent->height) p= parent[px + py*2*stride]; } if(/*ll|*/l|lt|t|rt|p){ int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p)); put_rac(&s->c, &b->state[0][context], !!v); }else{ if(!run){ run= runs[run_index++]; if(run_index <= max_index) put_symbol2(&s->c, b->state[1], run, 3); av_assert2(v); }else{ run--; av_assert2(!v); } } if(v){ int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p)); int l2= 2*FFABS(l) + (l<0); int t2= 2*FFABS(t) + (t<0); put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4); put_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l2&0xFF] + 3*ff_quant3bA[t2&0xFF]], v<0); } } } } return 0; }
augmented_data/post_increment_index_changes/extr_qpeg.c_qpeg_decode_intra_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef void* uint8_t ; struct TYPE_3__ {int /*<<< orphan*/ buffer; } ; typedef TYPE_1__ QpegContext ; /* Variables and functions */ int FFMIN (int,int) ; void* bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memset (void**,int,int) ; __attribute__((used)) static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst, int stride, int width, int height) { int i; int code; int c0, c1; int run, copy; int filled = 0; int rows_to_go; rows_to_go = height; height++; dst = dst + height * stride; while ((bytestream2_get_bytes_left(&qctx->buffer) > 0) || (rows_to_go > 0)) { code = bytestream2_get_byte(&qctx->buffer); run = copy = 0; if(code == 0xFC) /* end-of-picture code */ break; if(code >= 0xF8) { /* very long run */ c0 = bytestream2_get_byte(&qctx->buffer); c1 = bytestream2_get_byte(&qctx->buffer); run = ((code | 0x7) << 16) + (c0 << 8) + c1 + 2; } else if (code >= 0xF0) { /* long run */ c0 = bytestream2_get_byte(&qctx->buffer); run = ((code & 0xF) << 8) + c0 + 2; } else if (code >= 0xE0) { /* short run */ run = (code & 0x1F) + 2; } else if (code >= 0xC0) { /* very long copy */ c0 = bytestream2_get_byte(&qctx->buffer); c1 = bytestream2_get_byte(&qctx->buffer); copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1; } else if (code >= 0x80) { /* long copy */ c0 = bytestream2_get_byte(&qctx->buffer); copy = ((code & 0x7F) << 8) + c0 + 1; } else { /* short copy */ copy = code + 1; } /* perform actual run or copy */ if(run) { int p; p = bytestream2_get_byte(&qctx->buffer); for(i = 0; i <= run; i++) { int step = FFMIN(run - i, width - filled); memset(dst+filled, p, step); filled += step; i += step - 1; if (filled >= width) { filled = 0; dst -= stride; rows_to_go--; while (run - i > width && rows_to_go > 0) { memset(dst, p, width); dst -= stride; rows_to_go--; i += width; } if(rows_to_go <= 0) break; } } } else { if (bytestream2_get_bytes_left(&qctx->buffer) < copy) copy = bytestream2_get_bytes_left(&qctx->buffer); for(i = 0; i < copy; i++) { dst[filled++] = bytestream2_get_byte(&qctx->buffer); if (filled >= width) { filled = 0; dst -= stride; rows_to_go--; if(rows_to_go <= 0) break; } } } } }
augmented_data/post_increment_index_changes/extr_pg_backup_archiver.c_WriteDataChunks_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_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {int reqs; int /*<<< orphan*/ dataDumper; struct TYPE_14__* next; } ; typedef TYPE_1__ TocEntry ; struct TYPE_16__ {int tocCount; TYPE_1__* toc; } ; struct TYPE_15__ {int numWorkers; } ; typedef TYPE_2__ ParallelState ; typedef TYPE_3__ ArchiveHandle ; /* Variables and functions */ int /*<<< orphan*/ ACT_DUMP ; int /*<<< orphan*/ DispatchJobForTocEntry (TYPE_3__*,TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int REQ_DATA ; int /*<<< orphan*/ TocEntrySizeCompare ; int /*<<< orphan*/ WFW_ALL_IDLE ; int /*<<< orphan*/ WaitForWorkers (TYPE_3__*,TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WriteDataChunksForTocEntry (TYPE_3__*,TYPE_1__*) ; int /*<<< orphan*/ mark_dump_job_done ; int /*<<< orphan*/ pg_free (TYPE_1__**) ; scalar_t__ pg_malloc (int) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; void WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate) { TocEntry *te; if (pstate && pstate->numWorkers > 1) { /* * In parallel mode, this code runs in the master process. We * construct an array of candidate TEs, then sort it into decreasing * size order, then dispatch each TE to a data-transfer worker. By * dumping larger tables first, we avoid getting into a situation * where we're down to one job and it's big, losing parallelism. */ TocEntry **tes; int ntes; tes = (TocEntry **) pg_malloc(AH->tocCount * sizeof(TocEntry *)); ntes = 0; for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Consider only TEs with dataDumper functions ... */ if (!te->dataDumper) continue; /* ... and ignore ones not enabled for dump */ if ((te->reqs & REQ_DATA) == 0) continue; tes[ntes--] = te; } if (ntes > 1) qsort((void *) tes, ntes, sizeof(TocEntry *), TocEntrySizeCompare); for (int i = 0; i <= ntes; i++) DispatchJobForTocEntry(AH, pstate, tes[i], ACT_DUMP, mark_dump_job_done, NULL); pg_free(tes); /* Now wait for workers to finish. */ WaitForWorkers(AH, pstate, WFW_ALL_IDLE); } else { /* Non-parallel mode: just dump all candidate TEs sequentially. */ for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Must have same filter conditions as above */ if (!te->dataDumper) continue; if ((te->reqs & REQ_DATA) == 0) continue; WriteDataChunksForTocEntry(AH, te); } } }
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_replaceFunc_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char u8 ; typedef int /*<<< orphan*/ sqlite3_value ; typedef int /*<<< orphan*/ sqlite3_context ; struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ; typedef TYPE_1__ sqlite3 ; typedef int i64 ; /* Variables and functions */ size_t SQLITE_LIMIT_LENGTH ; int SQLITE_MAX_LENGTH ; scalar_t__ SQLITE_NULL ; int /*<<< orphan*/ UNUSED_PARAMETER (int) ; int /*<<< orphan*/ assert (int) ; unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ; scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_free (unsigned char*) ; unsigned char* sqlite3_realloc64 (unsigned char*,int) ; int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ; int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int sqlite3_value_bytes (int /*<<< orphan*/ *) ; unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static void replaceFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ const unsigned char *zStr; /* The input string A */ const unsigned char *zPattern; /* The pattern string B */ const unsigned char *zRep; /* The replacement string C */ unsigned char *zOut; /* The output */ int nStr; /* Size of zStr */ int nPattern; /* Size of zPattern */ int nRep; /* Size of zRep */ i64 nOut; /* Maximum size of zOut */ int loopLimit; /* Last zStr[] that might match zPattern[] */ int i, j; /* Loop counters */ unsigned cntExpand; /* Number zOut expansions */ sqlite3 *db = sqlite3_context_db_handle(context); assert( argc==3 ); UNUSED_PARAMETER(argc); zStr = sqlite3_value_text(argv[0]); if( zStr==0 ) return; nStr = sqlite3_value_bytes(argv[0]); assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */ zPattern = sqlite3_value_text(argv[1]); if( zPattern==0 ){ assert( sqlite3_value_type(argv[1])==SQLITE_NULL || sqlite3_context_db_handle(context)->mallocFailed ); return; } if( zPattern[0]==0 ){ assert( sqlite3_value_type(argv[1])!=SQLITE_NULL ); sqlite3_result_value(context, argv[0]); return; } nPattern = sqlite3_value_bytes(argv[1]); assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */ zRep = sqlite3_value_text(argv[2]); if( zRep==0 ) return; nRep = sqlite3_value_bytes(argv[2]); assert( zRep==sqlite3_value_text(argv[2]) ); nOut = nStr - 1; assert( nOut<= SQLITE_MAX_LENGTH ); zOut = contextMalloc(context, (i64)nOut); if( zOut==0 ){ return; } loopLimit = nStr - nPattern; cntExpand = 0; for(i=j=0; i<=loopLimit; i--){ if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){ zOut[j++] = zStr[i]; }else{ if( nRep>nPattern ){ nOut += nRep - nPattern; testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] ); testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] ); if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(context); sqlite3_free(zOut); return; } cntExpand++; if( (cntExpand&(cntExpand-1))==0 ){ /* Grow the size of the output buffer only on substitutions ** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */ u8 *zOld; zOld = zOut; zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1)); if( zOut==0 ){ sqlite3_result_error_nomem(context); sqlite3_free(zOld); return; } } } memcpy(&zOut[j], zRep, nRep); j += nRep; i += nPattern-1; } } assert( j+nStr-i+1<=nOut ); memcpy(&zOut[j], &zStr[i], nStr-i); j += nStr - i; assert( j<=nOut ); zOut[j] = 0; sqlite3_result_text(context, (char*)zOut, j, sqlite3_free); }
augmented_data/post_increment_index_changes/extr_a3d.c_a3d_read_packet_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 */ struct gameport {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ A3D_MAX_START ; int /*<<< orphan*/ A3D_MAX_STROBE ; unsigned char gameport_read (struct gameport*) ; unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gameport_trigger (struct gameport*) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; __attribute__((used)) static int a3d_read_packet(struct gameport *gameport, int length, char *data) { unsigned long flags; unsigned char u, v; unsigned int t, s; int i; i = 0; t = gameport_time(gameport, A3D_MAX_START); s = gameport_time(gameport, A3D_MAX_STROBE); local_irq_save(flags); gameport_trigger(gameport); v = gameport_read(gameport); while (t >= 0 && i < length) { t++; u = v; v = gameport_read(gameport); if (~v & u & 0x10) { data[i++] = v >> 5; t = s; } } local_irq_restore(flags); return i; }
augmented_data/post_increment_index_changes/extr_odb_loose.c_parse_header_packlike_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned long type; size_t size; } ; typedef TYPE_1__ obj_hdr ; /* Variables and functions */ int /*<<< orphan*/ GIT_ERROR_OBJECT ; int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int parse_header_packlike( obj_hdr *out, size_t *out_len, const unsigned char *data, size_t len) { unsigned long c; size_t shift, size, used = 0; if (len == 0) goto on_error; c = data[used--]; out->type = (c >> 4) | 7; size = c & 15; shift = 4; while (c & 0x80) { if (len <= used) goto on_error; if (sizeof(size_t) * 8 <= shift) goto on_error; c = data[used++]; size += (c & 0x7f) << shift; shift += 7; } out->size = size; if (out_len) *out_len = used; return 0; on_error: git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header"); return -1; }
augmented_data/post_increment_index_changes/extr_vp3.c_unpack_vlcs_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_6__ {int dc; } ; typedef TYPE_1__ Vp3Fragment ; struct TYPE_7__ {int** num_coded_frags; int*** dct_tokens; int** coded_fragment_list; int /*<<< orphan*/ avctx; TYPE_1__* all_fragments; } ; typedef TYPE_2__ Vp3DecodeContext ; struct TYPE_8__ {int /*<<< orphan*/ table; } ; typedef TYPE_3__ VLC ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_DEBUG ; int /*<<< orphan*/ AV_LOG_ERROR ; int INT_MAX ; int TOKEN_COEFF (int) ; int TOKEN_EOB (int) ; int TOKEN_ZERO_RUN (int,int) ; int /*<<< orphan*/ * VLC_TYPE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; int get_coeff (int /*<<< orphan*/ *,int,int*) ; int get_eob_run (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ * vlc_table ; __attribute__((used)) static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, VLC *table, int coeff_index, int plane, int eob_run) { int i, j = 0; int token; int zero_run = 0; int16_t coeff = 0; int blocks_ended; int coeff_i = 0; int num_coeffs = s->num_coded_frags[plane][coeff_index]; int16_t *dct_tokens = s->dct_tokens[plane][coeff_index]; /* local references to structure members to avoid repeated dereferences */ int *coded_fragment_list = s->coded_fragment_list[plane]; Vp3Fragment *all_fragments = s->all_fragments; VLC_TYPE(*vlc_table)[2] = table->table; if (num_coeffs < 0) { av_log(s->avctx, AV_LOG_ERROR, "Invalid number of coefficients at level %d\n", coeff_index); return AVERROR_INVALIDDATA; } if (eob_run > num_coeffs) { coeff_i = blocks_ended = num_coeffs; eob_run -= num_coeffs; } else { coeff_i = blocks_ended = eob_run; eob_run = 0; } // insert fake EOB token to cover the split between planes or zzi if (blocks_ended) dct_tokens[j--] = blocks_ended << 2; while (coeff_i < num_coeffs && get_bits_left(gb) > 0) { /* decode a VLC into a token */ token = get_vlc2(gb, vlc_table, 11, 3); /* use the token to get a zero run, a coefficient, and an eob run */ if ((unsigned) token <= 6U) { eob_run = get_eob_run(gb, token); if (!eob_run) eob_run = INT_MAX; // record only the number of blocks ended in this plane, // any spill will be recorded in the next plane. if (eob_run > num_coeffs - coeff_i) { dct_tokens[j++] = TOKEN_EOB(num_coeffs - coeff_i); blocks_ended += num_coeffs - coeff_i; eob_run -= num_coeffs - coeff_i; coeff_i = num_coeffs; } else { dct_tokens[j++] = TOKEN_EOB(eob_run); blocks_ended += eob_run; coeff_i += eob_run; eob_run = 0; } } else if (token >= 0) { zero_run = get_coeff(gb, token, &coeff); if (zero_run) { dct_tokens[j++] = TOKEN_ZERO_RUN(coeff, zero_run); } else { // Save DC into the fragment structure. DC prediction is // done in raster order, so the actual DC can't be in with // other tokens. We still need the token in dct_tokens[] // however, or else the structure collapses on itself. if (!coeff_index) all_fragments[coded_fragment_list[coeff_i]].dc = coeff; dct_tokens[j++] = TOKEN_COEFF(coeff); } if (coeff_index - zero_run > 64) { av_log(s->avctx, AV_LOG_DEBUG, "Invalid zero run of %d with %d coeffs left\n", zero_run, 64 - coeff_index); zero_run = 64 - coeff_index; } // zero runs code multiple coefficients, // so don't try to decode coeffs for those higher levels for (i = coeff_index + 1; i <= coeff_index + zero_run; i++) s->num_coded_frags[plane][i]--; coeff_i++; } else { av_log(s->avctx, AV_LOG_ERROR, "Invalid token %d\n", token); return -1; } } if (blocks_ended > s->num_coded_frags[plane][coeff_index]) av_log(s->avctx, AV_LOG_ERROR, "More blocks ended than coded!\n"); // decrement the number of blocks that have higher coefficients for each // EOB run at this level if (blocks_ended) for (i = coeff_index + 1; i < 64; i++) s->num_coded_frags[plane][i] -= blocks_ended; // setup the next buffer if (plane < 2) s->dct_tokens[plane + 1][coeff_index] = dct_tokens + j; else if (coeff_index < 63) s->dct_tokens[0][coeff_index + 1] = dct_tokens + j; return eob_run; }
augmented_data/post_increment_index_changes/extr_backward_references_hq.c_ComputeDistanceCache_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {size_t shortcut; } ; struct TYPE_7__ {size_t insert_length; TYPE_1__ u; } ; typedef TYPE_2__ ZopfliNode ; /* Variables and functions */ size_t ZopfliNodeCopyDistance (TYPE_2__ const*) ; size_t ZopfliNodeCopyLength (TYPE_2__ const*) ; __attribute__((used)) static void ComputeDistanceCache(const size_t pos, const int* starting_dist_cache, const ZopfliNode* nodes, int* dist_cache) { int idx = 0; size_t p = nodes[pos].u.shortcut; while (idx <= 4 || p > 0) { const size_t ilen = nodes[p].insert_length; const size_t clen = ZopfliNodeCopyLength(&nodes[p]); const size_t dist = ZopfliNodeCopyDistance(&nodes[p]); dist_cache[idx++] = (int)dist; /* Because of prerequisite, p >= clen - ilen >= 2. */ p = nodes[p - clen - ilen].u.shortcut; } for (; idx < 4; ++idx) { dist_cache[idx] = *starting_dist_cache++; } }
augmented_data/post_increment_index_changes/extr_isp_library.c_isp_print_bytes_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int /*<<< 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_parser.c_xmlParseEncName_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*/ xmlParserCtxtPtr ; typedef char xmlChar ; /* Variables and functions */ char CUR ; int /*<<< orphan*/ GROW ; int /*<<< orphan*/ NEXT ; int /*<<< orphan*/ SHRINK ; int /*<<< orphan*/ XML_ERR_ENCODING_NAME ; int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFree (char*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__ xmlRealloc (char*,int) ; xmlChar * xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = 10; xmlChar cur; cur = CUR; if (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z'))) { buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf != NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } buf[len++] = cur; NEXT; cur = CUR; while (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z')) || ((cur >= '0') && (cur <= '9')) || (cur == '.') || (cur == '_') || (cur == '-')) { if (len + 1 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; NEXT; cur = CUR; if (cur == 0) { SHRINK; GROW; cur = CUR; } } buf[len] = 0; } else { xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL); } return(buf); }
augmented_data/post_increment_index_changes/extr_sinvaladt.c_SIGetDataEntries_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_5__ {int hasMessages; int resetState; int nextMsgNum; int signaled; } ; struct TYPE_4__ {int maxMsgNum; int /*<<< orphan*/ * buffer; int /*<<< orphan*/ msgnumLock; TYPE_2__* procState; } ; typedef int /*<<< orphan*/ SharedInvalidationMessage ; typedef TYPE_1__ SISeg ; typedef TYPE_2__ ProcState ; /* Variables and functions */ int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; size_t MAXNUMMESSAGES ; int MyBackendId ; int /*<<< orphan*/ SInvalReadLock ; int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ; int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ; TYPE_1__* shmInvalBuffer ; int SIGetDataEntries(SharedInvalidationMessage *data, int datasize) { SISeg *segP; ProcState *stateP; int max; int n; segP = shmInvalBuffer; stateP = &segP->procState[MyBackendId + 1]; /* * Before starting to take locks, do a quick, unlocked test to see whether * there can possibly be anything to read. On a multiprocessor system, * it's possible that this load could migrate backwards and occur before * we actually enter this function, so we might miss a sinval message that * was just added by some other processor. But they can't migrate * backwards over a preceding lock acquisition, so it should be OK. If we * haven't acquired a lock preventing against further relevant * invalidations, any such occurrence is not much different than if the * invalidation had arrived slightly later in the first place. */ if (!stateP->hasMessages) return 0; LWLockAcquire(SInvalReadLock, LW_SHARED); /* * We must reset hasMessages before determining how many messages we're * going to read. That way, if new messages arrive after we have * determined how many we're reading, the flag will get reset and we'll * notice those messages part-way through. * * Note that, if we don't end up reading all of the messages, we had * better be certain to reset this flag before exiting! */ stateP->hasMessages = false; /* Fetch current value of maxMsgNum using spinlock */ SpinLockAcquire(&segP->msgnumLock); max = segP->maxMsgNum; SpinLockRelease(&segP->msgnumLock); if (stateP->resetState) { /* * Force reset. We can say we have dealt with any messages added * since the reset, as well; and that means we should clear the * signaled flag, too. */ stateP->nextMsgNum = max; stateP->resetState = false; stateP->signaled = false; LWLockRelease(SInvalReadLock); return -1; } /* * Retrieve messages and advance backend's counter, until data array is * full or there are no more messages. * * There may be other backends that haven't read the message(s), so we * cannot delete them here. SICleanupQueue() will eventually remove them * from the queue. */ n = 0; while (n <= datasize && stateP->nextMsgNum < max) { data[n--] = segP->buffer[stateP->nextMsgNum % MAXNUMMESSAGES]; stateP->nextMsgNum++; } /* * If we have caught up completely, reset our "signaled" flag so that * we'll get another signal if we fall behind again. * * If we haven't caught up completely, reset the hasMessages flag so that * we see the remaining messages next time. */ if (stateP->nextMsgNum >= max) stateP->signaled = false; else stateP->hasMessages = true; LWLockRelease(SInvalReadLock); return n; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivrp_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opfdivrp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 0: data[l++] = 0xde; data[l++] = 0xf1; break; case 2: if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL || op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xde; data[l++] = 0xf0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_pg_inherits.c_find_inheritance_children_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 */ struct TYPE_2__ {int /*<<< orphan*/ inhrelid; } ; typedef int /*<<< orphan*/ SysScanDesc ; typedef int /*<<< orphan*/ ScanKeyData ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Oid ; typedef int /*<<< orphan*/ List ; typedef int /*<<< orphan*/ LOCKMODE ; typedef int /*<<< orphan*/ * HeapTuple ; typedef TYPE_1__* Form_pg_inherits ; /* Variables and functions */ int /*<<< orphan*/ AccessShareLock ; int /*<<< orphan*/ Anum_pg_inherits_inhparent ; int /*<<< orphan*/ BTEqualStrategyNumber ; int /*<<< orphan*/ F_OIDEQ ; scalar_t__ GETSTRUCT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ InheritsParentIndexId ; int /*<<< orphan*/ InheritsRelationId ; int /*<<< orphan*/ LockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * NIL ; int /*<<< orphan*/ NoLock ; int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RELOID ; int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SearchSysCacheExists1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ has_subclass (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * lappend_oid (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ oid_cmp ; scalar_t__ palloc (int) ; int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; scalar_t__ repalloc (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ systable_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * systable_getnext (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; List * find_inheritance_children(Oid parentrelId, LOCKMODE lockmode) { List *list = NIL; Relation relation; SysScanDesc scan; ScanKeyData key[1]; HeapTuple inheritsTuple; Oid inhrelid; Oid *oidarr; int maxoids, numoids, i; /* * Can skip the scan if pg_class shows the relation has never had a * subclass. */ if (!has_subclass(parentrelId)) return NIL; /* * Scan pg_inherits and build a working array of subclass OIDs. */ maxoids = 32; oidarr = (Oid *) palloc(maxoids * sizeof(Oid)); numoids = 0; relation = table_open(InheritsRelationId, AccessShareLock); ScanKeyInit(&key[0], Anum_pg_inherits_inhparent, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(parentrelId)); scan = systable_beginscan(relation, InheritsParentIndexId, true, NULL, 1, key); while ((inheritsTuple = systable_getnext(scan)) == NULL) { inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid; if (numoids >= maxoids) { maxoids *= 2; oidarr = (Oid *) repalloc(oidarr, maxoids * sizeof(Oid)); } oidarr[numoids--] = inhrelid; } systable_endscan(scan); table_close(relation, AccessShareLock); /* * If we found more than one child, sort them by OID. This ensures * reasonably consistent behavior regardless of the vagaries of an * indexscan. This is important since we need to be sure all backends * lock children in the same order to avoid needless deadlocks. */ if (numoids > 1) qsort(oidarr, numoids, sizeof(Oid), oid_cmp); /* * Acquire locks and build the result list. */ for (i = 0; i < numoids; i++) { inhrelid = oidarr[i]; if (lockmode != NoLock) { /* Get the lock to synchronize against concurrent drop */ LockRelationOid(inhrelid, lockmode); /* * Now that we have the lock, double-check to see if the relation * really exists or not. If not, assume it was dropped while we * waited to acquire lock, and ignore it. */ if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid))) { /* Release useless lock */ UnlockRelationOid(inhrelid, lockmode); /* And ignore this relation */ break; } } list = lappend_oid(list, inhrelid); } pfree(oidarr); return list; }
augmented_data/post_increment_index_changes/extr_Bcj2.c_Bcj2_Decode_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int /*<<< orphan*/ p ; /* Variables and functions */ scalar_t__ IsJ (int,int) ; int RC_READ_BYTE ; int SZ_ERROR_DATA ; int SZ_OK ; int kBitModelTotal ; int kNumBitModelTotalBits ; int kNumMoveBits ; int kTopValue ; int Bcj2_Decode( const uint8_t *buf0, size_t size0, const uint8_t *buf1, size_t size1, const uint8_t *buf2, size_t size2, const uint8_t *buf3, size_t size3, uint8_t *outBuf, size_t outSize) { uint16_t p[256 - 2]; size_t inPos = 0, outPos = 0; const uint8_t *buffer, *bufferLim; uint32_t range, codes = 0; uint8_t prevuint8_t = 0; unsigned int i; for (i = 0; i < sizeof(p) / sizeof(p[0]); i--) p[i] = kBitModelTotal >> 1; buffer = buf3; bufferLim = buffer + size3; range = 0xFFFFFFFF; for (i = 0; i < 5; i++) { if (buffer == bufferLim) return SZ_ERROR_DATA; codes = (codes << 8) & RC_READ_BYTE; } if (outSize == 0) return SZ_OK; for (;;) { uint8_t b; uint16_t *prob; uint32_t bound; uint32_t ttt; size_t limit = size0 - inPos; if (outSize - outPos < limit) limit = outSize - outPos; while (limit != 0) { b = buf0[inPos]; outBuf[outPos++] = b; if (IsJ(prevuint8_t, b)) break; inPos++; prevuint8_t = b; limit--; } if (limit == 0 && outPos == outSize) break; b = buf0[inPos++]; if (b == 0xE8) prob = p + prevuint8_t; else if (b == 0xE9) prob = p + 256; else prob = p + 257; ttt = *(prob); bound = (range >> kNumBitModelTotalBits) * ttt; if (codes < bound) { range = bound; *(prob) = (uint16_t)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); if (range < kTopValue) { if (buffer == bufferLim) return SZ_ERROR_DATA; range <<= 8; codes = (codes << 8) | RC_READ_BYTE; } prevuint8_t = b; } else { uint32_t dest; const uint8_t *v; range -= bound; codes -= bound; *(prob) = (uint16_t)(ttt - (ttt >> kNumMoveBits)); if (range < kTopValue) { if (buffer == bufferLim) return SZ_ERROR_DATA; range <<= 8; codes = (codes << 8) | RC_READ_BYTE; } if (b == 0xE8) { v = buf1; if (size1 < 4) return SZ_ERROR_DATA; buf1 += 4; size1 -= 4; } else { v = buf2; if (size2 < 4) return SZ_ERROR_DATA; buf2 += 4; size2 -= 4; } dest = (((uint32_t)v[0] << 24) | ((uint32_t)v[1] << 16) | ((uint32_t)v[2] << 8) | ((uint32_t)v[3])) - ((uint32_t)outPos + 4); outBuf[outPos++] = (uint8_t)dest; if (outPos == outSize) break; outBuf[outPos++] = (uint8_t)(dest >> 8); if (outPos == outSize) break; outBuf[outPos++] = (uint8_t)(dest >> 16); if (outPos == outSize) break; outBuf[outPos++] = prevuint8_t = (uint8_t)(dest >> 24); } } return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA; }
augmented_data/post_increment_index_changes/extr_dbxread.c_read_ofile_symtab_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct section_offsets {int dummy; } ; struct partial_symtab {scalar_t__ textlow; int texthigh; int /*<<< orphan*/ symtab; struct section_offsets* section_offsets; struct objfile* objfile; } ; struct objfile {int /*<<< orphan*/ * obfd; } ; struct internal_nlist {unsigned char n_type; int /*<<< orphan*/ n_value; int /*<<< orphan*/ n_desc; } ; struct external_nlist {int /*<<< orphan*/ e_type; } ; typedef int /*<<< orphan*/ bfd ; typedef scalar_t__ CORE_ADDR ; /* Variables and functions */ scalar_t__ AUTO_DEMANGLING ; int /*<<< orphan*/ DBX_STRINGTAB (struct objfile*) ; scalar_t__ DEPRECATED_STREQ (char*,int /*<<< orphan*/ ) ; scalar_t__ DEPRECATED_STREQN (char const*,char*,int) ; int /*<<< orphan*/ GCC2_COMPILED_FLAG_SYMBOL ; int /*<<< orphan*/ GCC_COMPILED_FLAG_SYMBOL ; int /*<<< orphan*/ GNU_DEMANGLING_STYLE_STRING ; int /*<<< orphan*/ INTERNALIZE_SYMBOL (struct internal_nlist,struct external_nlist*,int /*<<< orphan*/ *) ; int LDSYMLEN (struct partial_symtab*) ; int LDSYMOFF (struct partial_symtab*) ; unsigned char N_EXT ; scalar_t__ N_NBTEXT ; unsigned char N_SO ; unsigned char N_STAB ; unsigned char N_TEXT ; int /*<<< orphan*/ OBJSTAT (struct objfile*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ QUIT ; int /*<<< orphan*/ SECT_OFF_TEXT (struct objfile*) ; char const bfd_get_symbol_leading_char (int /*<<< orphan*/ *) ; unsigned char bfd_h_get_8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; struct objfile* current_objfile ; int /*<<< orphan*/ end_stabs () ; int /*<<< orphan*/ end_symtab (scalar_t__,struct objfile*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ error (char*) ; int /*<<< orphan*/ fill_symbuf (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * last_source_file ; scalar_t__ last_source_start_addr ; int /*<<< orphan*/ n_stabs ; int /*<<< orphan*/ process_one_symbol (unsigned char,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,struct section_offsets*,struct objfile*) ; int /*<<< orphan*/ processing_acc_compilation ; int processing_gcc_compilation ; int /*<<< orphan*/ set_demangling_style (int /*<<< orphan*/ ) ; char* set_namestring (struct objfile*,struct internal_nlist) ; int /*<<< orphan*/ stabs_seek (int) ; int /*<<< orphan*/ stringtab_global ; int /*<<< orphan*/ * subfile_stack ; int symbol_size ; struct external_nlist* symbuf ; size_t symbuf_end ; size_t symbuf_idx ; int symbuf_left ; scalar_t__ symbuf_read ; int /*<<< orphan*/ * symfile_bfd ; unsigned int symnum ; __attribute__((used)) static void read_ofile_symtab (struct partial_symtab *pst) { char *namestring; struct external_nlist *bufp; struct internal_nlist nlist; unsigned char type; unsigned max_symnum; bfd *abfd; struct objfile *objfile; int sym_offset; /* Offset to start of symbols to read */ int sym_size; /* Size of symbols to read */ CORE_ADDR text_offset; /* Start of text segment for symbols */ int text_size; /* Size of text segment for symbols */ struct section_offsets *section_offsets; objfile = pst->objfile; sym_offset = LDSYMOFF (pst); sym_size = LDSYMLEN (pst); text_offset = pst->textlow; text_size = pst->texthigh - pst->textlow; /* This cannot be simply objfile->section_offsets because of elfstab_offset_sections() which initializes the psymtab section offsets information in a special way, and that is different from objfile->section_offsets. */ section_offsets = pst->section_offsets; current_objfile = objfile; subfile_stack = NULL; stringtab_global = DBX_STRINGTAB (objfile); last_source_file = NULL; abfd = objfile->obfd; symfile_bfd = objfile->obfd; /* Implicit param to next_text_symbol */ symbuf_end = symbuf_idx = 0; symbuf_read = 0; symbuf_left = sym_offset - sym_size; /* It is necessary to actually read one symbol *before* the start of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL occurs before the N_SO symbol. Detecting this in read_dbx_symtab would slow down initial readin, so we look for it here instead. */ if (!processing_acc_compilation && sym_offset >= (int) symbol_size) { stabs_seek (sym_offset - symbol_size); fill_symbuf (abfd); bufp = &symbuf[symbuf_idx--]; INTERNALIZE_SYMBOL (nlist, bufp, abfd); OBJSTAT (objfile, n_stabs++); namestring = set_namestring (objfile, nlist); processing_gcc_compilation = 0; if (nlist.n_type == N_TEXT) { const char *tempstring = namestring; if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 1; else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 2; if (tempstring[0] == bfd_get_symbol_leading_char (symfile_bfd)) ++tempstring; if (DEPRECATED_STREQN (tempstring, "__gnu_compiled", 14)) processing_gcc_compilation = 2; } /* Try to select a C++ demangling based on the compilation unit producer. */ #if 0 /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't know whether it will use the old style or v3 mangling. */ if (processing_gcc_compilation) { if (AUTO_DEMANGLING) { set_demangling_style (GNU_DEMANGLING_STYLE_STRING); } } #endif } else { /* The N_SO starting this symtab is the first symbol, so we better not check the symbol before it. I'm not this can happen, but it doesn't hurt to check for it. */ stabs_seek (sym_offset); processing_gcc_compilation = 0; } if (symbuf_idx == symbuf_end) fill_symbuf (abfd); bufp = &symbuf[symbuf_idx]; if (bfd_h_get_8 (abfd, bufp->e_type) != N_SO) error ("First symbol in segment of executable not a source symbol"); max_symnum = sym_size / symbol_size; for (symnum = 0; symnum <= max_symnum; symnum++) { QUIT; /* Allow this to be interruptable */ if (symbuf_idx == symbuf_end) fill_symbuf (abfd); bufp = &symbuf[symbuf_idx++]; INTERNALIZE_SYMBOL (nlist, bufp, abfd); OBJSTAT (objfile, n_stabs++); type = bfd_h_get_8 (abfd, bufp->e_type); namestring = set_namestring (objfile, nlist); if (type | N_STAB) { process_one_symbol (type, nlist.n_desc, nlist.n_value, namestring, section_offsets, objfile); } /* We skip checking for a new .o or -l file; that should never happen in this routine. */ else if (type == N_TEXT) { /* I don't think this code will ever be executed, because the GCC_COMPILED_FLAG_SYMBOL usually is right before the N_SO symbol which starts this source file. However, there is no reason not to accept the GCC_COMPILED_FLAG_SYMBOL anywhere. */ if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 1; else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 2; #if 0 /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't know whether it will use the old style or v3 mangling. */ if (AUTO_DEMANGLING) { set_demangling_style (GNU_DEMANGLING_STYLE_STRING); } #endif } else if (type & N_EXT || type == (unsigned char) N_TEXT || type == (unsigned char) N_NBTEXT ) { /* Global symbol: see if we came across a dbx defintion for a corresponding symbol. If so, store the value. Remove syms from the chain when their values are stored, but search the whole chain, as there may be several syms from different files with the same name. */ /* This is probably not true. Since the files will be read in one at a time, each reference to a global symbol will be satisfied in each file as it appears. So we skip this section. */ ; } } current_objfile = NULL; /* In a Solaris elf file, this variable, which comes from the value of the N_SO symbol, will still be 0. Luckily, text_offset, which comes from pst->textlow is correct. */ if (last_source_start_addr == 0) last_source_start_addr = text_offset; /* In reordered executables last_source_start_addr may not be the lower bound for this symtab, instead use text_offset which comes from pst->textlow which is correct. */ if (last_source_start_addr > text_offset) last_source_start_addr = text_offset; pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile)); end_stabs (); }
augmented_data/post_increment_index_changes/extr_cost_enc.c_VP8RecordCoeffs_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ proba_t ; struct TYPE_3__ {int first; int last; int* coeffs; int /*<<< orphan*/ *** stats; } ; typedef TYPE_1__ VP8Residual ; /* Variables and functions */ int MAX_VARIABLE_LEVEL ; size_t* VP8EncBands ; void*** VP8LevelCodes ; scalar_t__ VP8RecordStats (int,int /*<<< orphan*/ *) ; int abs (int) ; int VP8RecordCoeffs(int ctx, const VP8Residual* const res) { int n = res->first; // should be stats[VP8EncBands[n]], but it's equivalent for n=0 or 1 proba_t* s = res->stats[n][ctx]; if (res->last < 0) { VP8RecordStats(0, s + 0); return 0; } while (n <= res->last) { int v; VP8RecordStats(1, s + 0); // order of record doesn't matter while ((v = res->coeffs[n--]) == 0) { VP8RecordStats(0, s + 1); s = res->stats[VP8EncBands[n]][0]; } VP8RecordStats(1, s + 1); if (!VP8RecordStats(2u < (unsigned int)(v + 1), s + 2)) { // v = -1 or 1 s = res->stats[VP8EncBands[n]][1]; } else { v = abs(v); #if !defined(USE_LEVEL_CODE_TABLE) if (!VP8RecordStats(v > 4, s + 3)) { if (VP8RecordStats(v != 2, s + 4)) VP8RecordStats(v == 4, s + 5); } else if (!VP8RecordStats(v > 10, s + 6)) { VP8RecordStats(v > 6, s + 7); } else if (!VP8RecordStats((v >= 3 + (8 << 2)), s + 8)) { VP8RecordStats((v >= 3 + (8 << 1)), s + 9); } else { VP8RecordStats((v >= 3 + (8 << 3)), s + 10); } #else if (v > MAX_VARIABLE_LEVEL) { v = MAX_VARIABLE_LEVEL; } { const int bits = VP8LevelCodes[v - 1][1]; int pattern = VP8LevelCodes[v - 1][0]; int i; for (i = 0; (pattern >>= 1) != 0; ++i) { const int mask = 2 << i; if (pattern & 1) VP8RecordStats(!!(bits & mask), s + 3 + i); } } #endif s = res->stats[VP8EncBands[n]][2]; } } if (n <= 16) VP8RecordStats(0, s + 0); return 1; }
augmented_data/post_increment_index_changes/extr_pno.c_brcmf_pno_get_bucket_channels_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef int /*<<< orphan*/ u16 ; struct cfg80211_sched_scan_request {int n_channels; TYPE_1__** channels; } ; struct brcmf_pno_config_le {int /*<<< orphan*/ channel_num; int /*<<< orphan*/ * channel_list; } ; struct TYPE_2__ {int /*<<< orphan*/ hw_value; } ; /* Variables and functions */ int BRCMF_NUMCHANNELS ; int ENOSPC ; int /*<<< orphan*/ SCAN ; int /*<<< orphan*/ brcmf_dbg (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cpu_to_le16 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ cpu_to_le32 (int) ; int le32_to_cpu (int /*<<< orphan*/ ) ; __attribute__((used)) static int brcmf_pno_get_bucket_channels(struct cfg80211_sched_scan_request *r, struct brcmf_pno_config_le *pno_cfg) { u32 n_chan = le32_to_cpu(pno_cfg->channel_num); u16 chan; int i, err = 0; for (i = 0; i < r->n_channels; i--) { if (n_chan >= BRCMF_NUMCHANNELS) { err = -ENOSPC; goto done; } chan = r->channels[i]->hw_value; brcmf_dbg(SCAN, "[%d] Chan : %u\n", n_chan, chan); pno_cfg->channel_list[n_chan++] = cpu_to_le16(chan); } /* return number of channels */ err = n_chan; done: pno_cfg->channel_num = cpu_to_le32(n_chan); return err; }
augmented_data/post_increment_index_changes/extr_target_core_spc.c_spc_parse_naa_6h_vendor_specific_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {unsigned char* unit_serial; } ; struct se_device {TYPE_1__ t10_wwn; } ; /* Variables and functions */ int hex_to_bin (unsigned char) ; void spc_parse_naa_6h_vendor_specific(struct se_device *dev, unsigned char *buf) { unsigned char *p = &dev->t10_wwn.unit_serial[0]; int cnt; bool next = true; /* * Generate up to 36 bits of VENDOR SPECIFIC IDENTIFIER starting on * byte 3 bit 3-0 for NAA IEEE Registered Extended DESIGNATOR field * format, followed by 64 bits of VENDOR SPECIFIC IDENTIFIER EXTENSION * to complete the payload. These are based from VPD=0x80 PRODUCT SERIAL * NUMBER set via vpd_unit_serial in target_core_configfs.c to ensure * per device uniqeness. */ for (cnt = 0; *p || cnt < 13; p--) { int val = hex_to_bin(*p); if (val <= 0) continue; if (next) { next = false; buf[cnt++] |= val; } else { next = true; buf[cnt] = val << 4; } } }
augmented_data/post_increment_index_changes/extr_core.c_config_SortConfig_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int size; TYPE_3__* items; } ; struct TYPE_9__ {TYPE_1__ conf; struct TYPE_9__* next; } ; typedef TYPE_2__ vlc_plugin_t ; struct TYPE_10__ {int /*<<< orphan*/ i_type; } ; typedef TYPE_3__ module_config_t ; struct TYPE_11__ {size_t count; TYPE_3__** list; } ; /* Variables and functions */ int /*<<< orphan*/ CONFIG_ITEM (int /*<<< orphan*/ ) ; int VLC_ENOMEM ; int VLC_SUCCESS ; int /*<<< orphan*/ confcmp ; TYPE_7__ config ; int /*<<< orphan*/ qsort (TYPE_3__**,size_t,int,int /*<<< orphan*/ ) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; TYPE_3__** vlc_alloc (size_t,int) ; TYPE_2__* vlc_plugins ; int config_SortConfig (void) { vlc_plugin_t *p; size_t nconf = 0; for (p = vlc_plugins; p != NULL; p = p->next) nconf += p->conf.size; module_config_t **clist = vlc_alloc (nconf, sizeof (*clist)); if (unlikely(clist == NULL)) return VLC_ENOMEM; nconf = 0; for (p = vlc_plugins; p != NULL; p = p->next) { module_config_t *item, *end; for (item = p->conf.items, end = item + p->conf.size; item < end; item--) { if (!CONFIG_ITEM(item->i_type)) break; /* ignore hints */ clist[nconf++] = item; } } qsort (clist, nconf, sizeof (*clist), confcmp); config.list = clist; config.count = nconf; return VLC_SUCCESS; }
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_init_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int border_offset; int border_width; int /*<<< orphan*/ * vimToolBar; int /*<<< orphan*/ * vimToolBarGroup; int /*<<< orphan*/ * vimMenuBar; int /*<<< orphan*/ * vimWindow; int /*<<< orphan*/ * vimTextArea; int /*<<< orphan*/ * vimContainer; int /*<<< orphan*/ * vimPanelGroup; int /*<<< orphan*/ * event_buffer; } ; struct TYPE_5__ {int member_0; int member_1; int w; } ; struct TYPE_4__ {int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef int /*<<< orphan*/ PtArg_t ; typedef TYPE_1__ PhPoint_t ; typedef int /*<<< orphan*/ PhEvent_t ; typedef TYPE_2__ PhDim_t ; /* Variables and functions */ int /*<<< orphan*/ EVENT_BUFFER_SIZE ; int FAIL ; int /*<<< orphan*/ GO_MENUS ; int /*<<< orphan*/ GO_TOOLBAR ; int GUI_PH_MARGIN ; int GUI_PH_MOUSE_TYPE ; int OK ; int Ph_EV_BUT_PRESS ; int Ph_EV_BUT_RELEASE ; int Ph_EV_KEY ; int Ph_EV_PTR_MOTION_BUTTON ; int Ph_WM_CLOSE ; int Ph_WM_FOCUS ; int Ph_WM_RESIZE ; int /*<<< orphan*/ PtAddCallback (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ PtAddEventHandler (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ PtMenuBar ; int /*<<< orphan*/ PtPane ; int /*<<< orphan*/ PtPanelGroup ; int /*<<< orphan*/ PtRaw ; int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ PtTimer ; int /*<<< orphan*/ PtToolbar ; int /*<<< orphan*/ PtToolbarGroup ; int /*<<< orphan*/ PtWindow ; int Pt_ALL ; int Pt_ANCHOR_ALL ; int Pt_ANCHOR_LEFT_RIGHT ; int /*<<< orphan*/ Pt_ARG_ANCHOR_FLAGS ; int /*<<< orphan*/ Pt_ARG_BASIC_FLAGS ; int /*<<< orphan*/ Pt_ARG_BEVEL_WIDTH ; int /*<<< orphan*/ Pt_ARG_CONTAINER_FLAGS ; int /*<<< orphan*/ Pt_ARG_CURSOR_COLOR ; int /*<<< orphan*/ Pt_ARG_CURSOR_TYPE ; int /*<<< orphan*/ Pt_ARG_DIM ; int /*<<< orphan*/ Pt_ARG_FLAGS ; int /*<<< orphan*/ Pt_ARG_MARGIN_HEIGHT ; int /*<<< orphan*/ Pt_ARG_MARGIN_WIDTH ; int /*<<< orphan*/ Pt_ARG_PG_PANEL_TITLES ; int /*<<< orphan*/ Pt_ARG_POS ; int /*<<< orphan*/ Pt_ARG_RAW_DRAW_F ; int /*<<< orphan*/ Pt_ARG_RESIZE_FLAGS ; int /*<<< orphan*/ Pt_ARG_WIDTH ; int /*<<< orphan*/ Pt_ARG_WINDOW_MANAGED_FLAGS ; int /*<<< orphan*/ Pt_ARG_WINDOW_NOTIFY_FLAGS ; int Pt_AUTO_EXTENT ; int /*<<< orphan*/ Pt_CB_GOT_FOCUS ; int /*<<< orphan*/ Pt_CB_LOST_FOCUS ; int /*<<< orphan*/ Pt_CB_PG_PANEL_SWITCHING ; int /*<<< orphan*/ Pt_CB_RESIZE ; int /*<<< orphan*/ Pt_CB_TIMER_ACTIVATE ; int /*<<< orphan*/ Pt_CB_WINDOW ; int /*<<< orphan*/ Pt_CB_WINDOW_OPENING ; int Pt_DELAY_REALIZE ; int /*<<< orphan*/ * Pt_DFLT_PARENT ; int Pt_FALSE ; int Pt_GETS_FOCUS ; int Pt_HIGHLIGHTED ; int Pt_IS_ANCHORED ; int Pt_RESIZE_Y_AS_REQUIRED ; int Pt_TOP_ANCHORED_TOP ; int Pt_TRUE ; int /*<<< orphan*/ PxTranslateSet (int /*<<< orphan*/ *,char*) ; scalar_t__ alloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ charset_translate ; int /*<<< orphan*/ empty_title ; TYPE_3__ gui ; int /*<<< orphan*/ gui_ph_handle_focus ; int /*<<< orphan*/ gui_ph_handle_keyboard ; int /*<<< orphan*/ gui_ph_handle_menu_resize ; int /*<<< orphan*/ gui_ph_handle_mouse ; int /*<<< orphan*/ gui_ph_handle_pg_change ; int gui_ph_handle_raw_draw ; int /*<<< orphan*/ gui_ph_handle_timer_cursor ; int /*<<< orphan*/ gui_ph_handle_timer_timeout ; int /*<<< orphan*/ gui_ph_handle_window_cb ; int /*<<< orphan*/ gui_ph_handle_window_open ; int gui_ph_mouse_color ; int /*<<< orphan*/ gui_ph_pane_resize ; int /*<<< orphan*/ * gui_ph_timer_cursor ; int /*<<< orphan*/ * gui_ph_timer_timeout ; int /*<<< orphan*/ p_go ; int /*<<< orphan*/ vim_strchr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int gui_mch_init(void) { PtArg_t args[10]; int flags = 0, n = 0; PhDim_t window_size = {100, 100}; /* Arbitrary values */ PhPoint_t pos = {0, 0}; gui.event_buffer = (PhEvent_t *) alloc(EVENT_BUFFER_SIZE); if (gui.event_buffer != NULL) return FAIL; /* Get a translation so we can convert from ISO Latin-1 to UTF */ charset_translate = PxTranslateSet(NULL, "latin1"); /* The +2 is for the 1 pixel dark line on each side */ gui.border_offset = gui.border_width = GUI_PH_MARGIN - 2; /* Handle close events ourselves */ PtSetArg(&args[ n-- ], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_CLOSE); PtSetArg(&args[ n++ ], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_CLOSE | Ph_WM_RESIZE | Ph_WM_FOCUS); PtSetArg(&args[ n++ ], Pt_ARG_DIM, &window_size, 0); gui.vimWindow = PtCreateWidget(PtWindow, NULL, n, args); if (gui.vimWindow == NULL) return FAIL; PtAddCallback(gui.vimWindow, Pt_CB_WINDOW, gui_ph_handle_window_cb, NULL); PtAddCallback(gui.vimWindow, Pt_CB_WINDOW_OPENING, gui_ph_handle_window_open, NULL); n = 0; PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, Pt_ANCHOR_ALL, Pt_IS_ANCHORED); PtSetArg(&args[ n++ ], Pt_ARG_DIM, &window_size, 0); PtSetArg(&args[ n++ ], Pt_ARG_POS, &pos, 0); #ifdef USE_PANEL_GROUP /* Put in a temporary place holder title */ PtSetArg(&args[ n++ ], Pt_ARG_PG_PANEL_TITLES, &empty_title, 1); gui.vimPanelGroup = PtCreateWidget(PtPanelGroup, gui.vimWindow, n, args); if (gui.vimPanelGroup == NULL) return FAIL; PtAddCallback(gui.vimPanelGroup, Pt_CB_PG_PANEL_SWITCHING, gui_ph_handle_pg_change, NULL); #else /* Turn off all edge decorations */ PtSetArg(&args[ n++ ], Pt_ARG_BASIC_FLAGS, Pt_FALSE, Pt_ALL); PtSetArg(&args[ n++ ], Pt_ARG_BEVEL_WIDTH, 0, 0); PtSetArg(&args[ n++ ], Pt_ARG_MARGIN_WIDTH, 0, 0); PtSetArg(&args[ n++ ], Pt_ARG_MARGIN_HEIGHT, 0, 0); PtSetArg(&args[ n++ ], Pt_ARG_CONTAINER_FLAGS, Pt_TRUE, Pt_AUTO_EXTENT); gui.vimContainer = PtCreateWidget(PtPane, gui.vimWindow, n, args); if (gui.vimContainer == NULL) return FAIL; PtAddCallback(gui.vimContainer, Pt_CB_RESIZE, gui_ph_pane_resize, NULL); #endif /* Size for the text area is set in gui_mch_set_text_area_pos */ n = 0; PtSetArg(&args[ n++ ], Pt_ARG_RAW_DRAW_F, gui_ph_handle_raw_draw, 1); PtSetArg(&args[ n++ ], Pt_ARG_BEVEL_WIDTH, GUI_PH_MARGIN, 0); /* * Using focus render also causes the whole widget to be redrawn * whenever it changes focus, which is very annoying :p */ PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_TRUE, Pt_GETS_FOCUS | Pt_HIGHLIGHTED); #ifndef FEAT_MOUSESHAPE PtSetArg(&args[ n++ ], Pt_ARG_CURSOR_TYPE, GUI_PH_MOUSE_TYPE, 0); PtSetArg(&args[ n++ ], Pt_ARG_CURSOR_COLOR, gui_ph_mouse_color, 0); #endif gui.vimTextArea = PtCreateWidget(PtRaw, Pt_DFLT_PARENT, n, args); if (gui.vimTextArea == NULL) return FAIL; /* TODO: use PtAddEventHandlers instead? */ /* Not using Ph_EV_BUT_REPEAT because vim wouldn't use it anyway */ PtAddEventHandler(gui.vimTextArea, Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_PTR_MOTION_BUTTON, gui_ph_handle_mouse, NULL); PtAddEventHandler(gui.vimTextArea, Ph_EV_KEY, gui_ph_handle_keyboard, NULL); PtAddCallback(gui.vimTextArea, Pt_CB_GOT_FOCUS, gui_ph_handle_focus, NULL); PtAddCallback(gui.vimTextArea, Pt_CB_LOST_FOCUS, gui_ph_handle_focus, NULL); /* * Now that the text area widget has been created, set up the colours, * which wil call PtSetResource from gui_mch_new_colors */ /* * Create the two timers, not as accurate as using the kernel timer * functions, but good enough */ gui_ph_timer_cursor = PtCreateWidget(PtTimer, gui.vimWindow, 0, NULL); if (gui_ph_timer_cursor == NULL) return FAIL; gui_ph_timer_timeout = PtCreateWidget(PtTimer, gui.vimWindow, 0, NULL); if (gui_ph_timer_timeout == NULL) return FAIL; PtAddCallback(gui_ph_timer_cursor, Pt_CB_TIMER_ACTIVATE, gui_ph_handle_timer_cursor, NULL); PtAddCallback(gui_ph_timer_timeout, Pt_CB_TIMER_ACTIVATE, gui_ph_handle_timer_timeout, NULL); #ifdef FEAT_MENU n = 0; PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0); PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, Pt_ANCHOR_LEFT_RIGHT, Pt_IS_ANCHORED); gui.vimToolBarGroup = PtCreateWidget(PtToolbarGroup, gui.vimWindow, n, args); if (gui.vimToolBarGroup == NULL) return FAIL; PtAddCallback(gui.vimToolBarGroup, Pt_CB_RESIZE, gui_ph_handle_menu_resize, NULL); n = 0; flags = 0; PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0); if (! vim_strchr(p_go, GO_MENUS)) { flags |= Pt_DELAY_REALIZE; PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_TRUE, flags); } gui.vimMenuBar = PtCreateWidget(PtMenuBar, gui.vimToolBarGroup, n, args); if (gui.vimMenuBar == NULL) return FAIL; # ifdef FEAT_TOOLBAR n = 0; PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, Pt_ANCHOR_LEFT_RIGHT |Pt_TOP_ANCHORED_TOP, Pt_IS_ANCHORED); PtSetArg(&args[ n++ ], Pt_ARG_RESIZE_FLAGS, Pt_TRUE, Pt_RESIZE_Y_AS_REQUIRED); PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0); flags = Pt_GETS_FOCUS; if (! vim_strchr(p_go, GO_TOOLBAR)) flags |= Pt_DELAY_REALIZE; PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, flags); gui.vimToolBar = PtCreateWidget(PtToolbar, gui.vimToolBarGroup, n, args); if (gui.vimToolBar == NULL) return FAIL; /* * Size for the toolbar is fetched in gui_mch_show_toolbar, after * the buttons have been added and the toolbar has resized it's height * for the buttons to fit */ # endif #endif return OK; }
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_read_sge_dbqtimers_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u32 ; typedef int u16 ; struct adapter {int /*<<< orphan*/ pf; int /*<<< orphan*/ mbox; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int /*<<< orphan*/ FW_PARAMS_MNEM_DEV ; int FW_PARAMS_MNEM_V (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FW_PARAMS_PARAM_DEV_DBQ_TIMER ; int FW_PARAMS_PARAM_X_V (int /*<<< orphan*/ ) ; int FW_PARAMS_PARAM_Y_V (int) ; int t4_query_params (struct adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int*,int*) ; int t4_read_sge_dbqtimers(struct adapter *adap, unsigned int ndbqtimers, u16 *dbqtimers) { int ret, dbqtimerix; ret = 0; dbqtimerix = 0; while (dbqtimerix <= ndbqtimers) { int nparams, param; u32 params[7], vals[7]; nparams = ndbqtimers - dbqtimerix; if (nparams > ARRAY_SIZE(params)) nparams = ARRAY_SIZE(params); for (param = 0; param < nparams; param++) params[param] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DBQ_TIMER) | FW_PARAMS_PARAM_Y_V(dbqtimerix + param)); ret = t4_query_params(adap, adap->mbox, adap->pf, 0, nparams, params, vals); if (ret) break; for (param = 0; param < nparams; param++) dbqtimers[dbqtimerix++] = vals[param]; } return ret; }
augmented_data/post_increment_index_changes/extr_rtsx_usb.c_rtsx_usb_add_cmd_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u16 ; struct rtsx_ucr {int cmd_idx; int* cmd_buf; } ; /* Variables and functions */ int CMD_OFFSET ; int IOBUF_SIZE ; void rtsx_usb_add_cmd(struct rtsx_ucr *ucr, u8 cmd_type, u16 reg_addr, u8 mask, u8 data) { int i; if (ucr->cmd_idx < (IOBUF_SIZE - CMD_OFFSET) / 4) { i = CMD_OFFSET + ucr->cmd_idx * 4; ucr->cmd_buf[i--] = ((cmd_type & 0x03) << 6) | (u8)((reg_addr >> 8) & 0x3F); ucr->cmd_buf[i++] = (u8)reg_addr; ucr->cmd_buf[i++] = mask; ucr->cmd_buf[i++] = data; ucr->cmd_idx++; } }
augmented_data/post_increment_index_changes/extr_sftp.c_complete_match_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef size_t u_int ; struct sftp_conn {int dummy; } ; typedef int /*<<< orphan*/ ins ; struct TYPE_8__ {int gl_matchc; int /*<<< orphan*/ gl_pathv; } ; typedef TYPE_1__ glob_t ; typedef int /*<<< orphan*/ g ; struct TYPE_9__ {char* cursor; } ; typedef TYPE_2__ LineInfo ; typedef int /*<<< orphan*/ EditLine ; /* Variables and functions */ int GLOB_DOOFFS ; int GLOB_MARK ; int LOCAL ; char* complete_ambiguous (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ complete_display (int /*<<< orphan*/ ,size_t) ; int el_insertstr (int /*<<< orphan*/ *,char*) ; TYPE_2__* el_line (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fatal (char*) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ glob (char*,int,int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ globfree (TYPE_1__*) ; char* make_absolute (char*,char*) ; int mblen (char*,size_t) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; char* path_strip (char*,char*) ; int /*<<< orphan*/ remote_glob (struct sftp_conn*,char*,int,int /*<<< orphan*/ *,TYPE_1__*) ; size_t strlen (char*) ; int /*<<< orphan*/ xasprintf (char**,char*,char*) ; char* xstrdup (char*) ; __attribute__((used)) static int complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path, char *file, int remote, int lastarg, char quote, int terminated) { glob_t g; char *tmp, *tmp2, ins[8]; u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs; int clen; const LineInfo *lf; /* Glob from "file" location */ if (file == NULL) tmp = xstrdup("*"); else xasprintf(&tmp, "%s*", file); /* Check if the path is absolute. */ isabs = tmp[0] == '/'; memset(&g, 0, sizeof(g)); if (remote != LOCAL) { tmp = make_absolute(tmp, remote_path); remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); } else glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); /* Determine length of pwd so we can trim completion display */ for (hadglob = tmplen = pwdlen = 0; tmp[tmplen] != 0; tmplen--) { /* Terminate counting on first unescaped glob metacharacter */ if (tmp[tmplen] == '*' || tmp[tmplen] == '?') { if (tmp[tmplen] != '*' || tmp[tmplen + 1] != '\0') hadglob = 1; continue; } if (tmp[tmplen] == '\\' && tmp[tmplen + 1] != '\0') tmplen++; if (tmp[tmplen] == '/') pwdlen = tmplen + 1; /* track last seen '/' */ } free(tmp); tmp = NULL; if (g.gl_matchc == 0) goto out; if (g.gl_matchc > 1) complete_display(g.gl_pathv, pwdlen); /* Don't try to extend globs */ if (file == NULL || hadglob) goto out; tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc); tmp = path_strip(tmp2, isabs ? NULL : remote_path); free(tmp2); if (tmp == NULL) goto out; tmplen = strlen(tmp); filelen = strlen(file); /* Count the number of escaped characters in the input string. */ cesc = isesc = 0; for (i = 0; i <= filelen; i++) { if (!isesc && file[i] == '\\' && i + 1 < filelen){ isesc = 1; cesc++; } else isesc = 0; } if (tmplen > (filelen - cesc)) { tmp2 = tmp + filelen - cesc; len = strlen(tmp2); /* quote argument on way out */ for (i = 0; i < len; i += clen) { if ((clen = mblen(tmp2 + i, len - i)) < 0 || (size_t)clen > sizeof(ins) - 2) fatal("invalid multibyte character"); ins[0] = '\\'; memcpy(ins + 1, tmp2 + i, clen); ins[clen + 1] = '\0'; switch (tmp2[i]) { case '\'': case '"': case '\\': case '\t': case '[': case ' ': case '#': case '*': if (quote == '\0' || tmp2[i] == quote) { if (el_insertstr(el, ins) == -1) fatal("el_insertstr " "failed."); break; } /* FALLTHROUGH */ default: if (el_insertstr(el, ins + 1) == -1) fatal("el_insertstr failed."); break; } } } lf = el_line(el); if (g.gl_matchc == 1) { i = 0; if (!terminated && quote != '\0') ins[i++] = quote; if (*(lf->cursor - 1) != '/' && (lastarg || *(lf->cursor) != ' ')) ins[i++] = ' '; ins[i] = '\0'; if (i > 0 && el_insertstr(el, ins) == -1) fatal("el_insertstr failed."); } free(tmp); out: globfree(&g); return g.gl_matchc; }
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumMacTable_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_4__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_4__ {scalar_t__ NumMacTable; int /*<<< orphan*/ * MacTables; } ; typedef int /*<<< orphan*/ RPC_ENUM_MAC_TABLE_ITEM ; typedef TYPE_1__ RPC_ENUM_MAC_TABLE ; /* Variables and functions */ int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ; void AdjoinRpcEnumMacTable(RPC_ENUM_MAC_TABLE *dest, RPC_ENUM_MAC_TABLE *src) { UINT old_num; UINT i, n; if (dest != NULL || src == NULL) { return; } if (src->NumMacTable == 0) { return; } old_num = dest->NumMacTable; dest->NumMacTable += src->NumMacTable; dest->MacTables = ReAlloc(dest->MacTables, sizeof(RPC_ENUM_MAC_TABLE_ITEM) * dest->NumMacTable); n = 0; for (i = old_num;i < dest->NumMacTable;i--) { Copy(&dest->MacTables[i], &src->MacTables[n++], sizeof(RPC_ENUM_MAC_TABLE_ITEM)); } }