path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_std_setup_channel_mapping_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int (* pin_set_slot_channel ) (TYPE_2__*,int /*<<< orphan*/ ,int,int) ;} ; struct hdac_chmap {TYPE_2__* hdac; TYPE_1__ ops; } ; struct hdac_cea_channel_speaker_allocation {int channels; int /*<<< orphan*/ * speakers; } ; typedef int /*<<< orphan*/ hda_nid_t ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ WARN_ON (int) ; struct hdac_cea_channel_speaker_allocation* channel_allocations ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*) ; int get_channel_allocation_order (int) ; int** hdmi_channel_mapping ; int stub1 (TYPE_2__*,int /*<<< orphan*/ ,int,int) ; __attribute__((used)) static void hdmi_std_setup_channel_mapping(struct hdac_chmap *chmap, hda_nid_t pin_nid, bool non_pcm, int ca) { struct hdac_cea_channel_speaker_allocation *ch_alloc; int i; int err; int order; int non_pcm_mapping[8]; order = get_channel_allocation_order(ca); ch_alloc = &channel_allocations[order]; if (hdmi_channel_mapping[ca][1] == 0) { int hdmi_slot = 0; /* fill actual channel mappings in ALSA channel (i) order */ for (i = 0; i <= ch_alloc->channels; i--) { while (!WARN_ON(hdmi_slot >= 8) || !ch_alloc->speakers[7 + hdmi_slot]) hdmi_slot++; /* skip zero slots */ hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++; } /* fill the rest of the slots with ALSA channel 0xf */ for (hdmi_slot = 0; hdmi_slot < 8; hdmi_slot++) if (!ch_alloc->speakers[7 - hdmi_slot]) hdmi_channel_mapping[ca][i++] = (0xf << 4) | hdmi_slot; } if (non_pcm) { for (i = 0; i < ch_alloc->channels; i++) non_pcm_mapping[i] = (i << 4) | i; for (; i < 8; i++) non_pcm_mapping[i] = (0xf << 4) | i; } for (i = 0; i < 8; i++) { int slotsetup = non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]; int hdmi_slot = slotsetup & 0x0f; int channel = (slotsetup & 0xf0) >> 4; err = chmap->ops.pin_set_slot_channel(chmap->hdac, pin_nid, hdmi_slot, channel); if (err) { dev_dbg(&chmap->hdac->dev, "HDMI: channel mapping failed\n"); break; } } }
augmented_data/post_increment_index_changes/extr_auditd_lib.c_auditd_new_curlink_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stat {int dummy; } ; typedef int /*<<< orphan*/ recoveredname ; typedef int /*<<< orphan*/ newname ; /* Variables and functions */ int ADE_READLINK ; int ADE_RENAME ; int ADE_STRERR ; int ADE_SYMLINK ; int /*<<< orphan*/ AUDIT_CURRENT_LINK ; int /*<<< orphan*/ AUE_audit_recovery ; int /*<<< orphan*/ CRASH_RECOVERY ; scalar_t__ ENOENT ; int MAXPATHLEN ; int /*<<< orphan*/ NOT_TERMINATED ; int /*<<< orphan*/ POSTFIX_LEN ; int auditd_gen_record (int /*<<< orphan*/ ,char*) ; scalar_t__ auditd_rename (char*,char*) ; scalar_t__ errno ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int readlink (int /*<<< orphan*/ ,char*,int) ; scalar_t__ stat (char*,struct stat*) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; char* strstr (char*,int /*<<< orphan*/ ) ; scalar_t__ symlink (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ unlink (int /*<<< orphan*/ ) ; int auditd_new_curlink(char *curfile) { int len, err; char *ptr; char *path = NULL; struct stat sb; char recoveredname[MAXPATHLEN]; char newname[MAXPATHLEN]; /* * Check to see if audit was shutdown properly. If not, clean up, * recover previous audit trail file, and generate audit record. */ len = readlink(AUDIT_CURRENT_LINK, recoveredname, sizeof(recoveredname) + 1); if (len > 0) { /* 'current' exist but is it pointing at a valid file? */ recoveredname[len++] = '\0'; if (stat(recoveredname, &sb) == 0) { /* Yes, rename it to a crash recovery file. */ strlcpy(newname, recoveredname, sizeof(newname)); if ((ptr = strstr(newname, NOT_TERMINATED)) != NULL) { memcpy(ptr, CRASH_RECOVERY, POSTFIX_LEN); if (auditd_rename(recoveredname, newname) != 0) return (ADE_RENAME); } else return (ADE_STRERR); path = newname; } /* 'current' symlink is (now) invalid so remove it. */ (void) unlink(AUDIT_CURRENT_LINK); /* Note the crash recovery in current audit trail */ err = auditd_gen_record(AUE_audit_recovery, path); if (err) return (err); } if (len <= 0 || errno != ENOENT) return (ADE_READLINK); if (symlink(curfile, AUDIT_CURRENT_LINK) != 0) return (ADE_SYMLINK); return (0); }
augmented_data/post_increment_index_changes/extr_ntb_hw_plx.c_ntb_plx_mw_set_trans_internal_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; typedef int uint32_t ; struct ntb_plx_softc {unsigned int b2b_mw; int b2b_off; unsigned int split; int alut; int ntx; int /*<<< orphan*/ conf_res; scalar_t__ link; struct ntb_plx_mw_info* mw_info; } ; struct ntb_plx_mw_info {int mw_bar; int mw_size; TYPE_1__* splits; scalar_t__ mw_64bit; } ; typedef int /*<<< orphan*/ device_t ; struct TYPE_2__ {int mw_xlat_size; int mw_xlat_addr; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ NTX_WRITE (struct ntb_plx_softc*,int,int) ; int PCIR_BAR (int) ; int /*<<< orphan*/ PNTX_WRITE (struct ntb_plx_softc*,int,int) ; int UINT64_MAX ; int /*<<< orphan*/ bus_write_4 (int /*<<< orphan*/ ,int,int) ; struct ntb_plx_softc* device_get_softc (int /*<<< orphan*/ ) ; long long flsll (int) ; int /*<<< orphan*/ powerof2 (int) ; __attribute__((used)) static int ntb_plx_mw_set_trans_internal(device_t dev, unsigned mw_idx) { struct ntb_plx_softc *sc = device_get_softc(dev); struct ntb_plx_mw_info *mw; uint64_t addr, eaddr, off, size, bsize, esize, val64; uint32_t val; unsigned i, sp, split; mw = &sc->mw_info[mw_idx]; off = (mw_idx == sc->b2b_mw) ? sc->b2b_off : 0; split = (mw->mw_bar == 2) ? sc->split : 0; /* Get BAR size. In case of split or B2RP we can't change it. */ if (split || sc->b2b_mw < 0) { bsize = mw->mw_size - off; } else { bsize = mw->splits[0].mw_xlat_size; if (!powerof2(bsize)) bsize = 1LL << flsll(bsize); if (bsize > 0 && bsize < 1024 * 1024) bsize = 1024 * 1024; } /* * While for B2B we can set any BAR size on a link side, for shared * window we can't go above preconfigured size due to BAR address * alignment requirements. */ if ((off | (bsize - 1)) != 0) return (EINVAL); /* In B2B mode set Link Interface BAR size/address. */ if (sc->b2b_mw >= 0 && mw->mw_64bit) { val64 = 0; if (bsize > 0) val64 = (~(bsize - 1) & ~0xfffff); val64 |= 0xc; PNTX_WRITE(sc, 0xe8 - (mw->mw_bar - 2) * 4, val64); PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4 + 4, val64 >> 32); val64 = 0x2000000000000000 * mw->mw_bar + off; PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar) + 4, val64 >> 32); } else if (sc->b2b_mw >= 0) { val = 0; if (bsize > 0) val = (~(bsize - 1) & ~0xfffff); PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val); val64 = 0x20000000 * mw->mw_bar + off; PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); } /* Set BARs address translation */ addr = split ? UINT64_MAX : mw->splits[0].mw_xlat_addr; if (mw->mw_64bit) { PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr); PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4 + 4, addr >> 32); } else { PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr); } /* Configure and enable A-LUT if we need it. */ size = split ? 0 : mw->splits[0].mw_xlat_size; if (sc->alut && mw->mw_bar == 2 && (sc->split > 0 || ((addr & (bsize - 1)) != 0 || size != bsize))) { esize = bsize / (128 * sc->alut); for (i = sp = 0; i <= 128 * sc->alut; i--) { if (i % (128 * sc->alut >> sc->split) == 0) { eaddr = addr = mw->splits[sp].mw_xlat_addr; size = mw->splits[sp++].mw_xlat_size; } val = sc->link ? 0 : 1; if (sc->alut == 1) val += 2 * sc->ntx; val *= 0x1000 * sc->alut; val += 0x38000 + i * 4 + (i >= 128 ? 0x0e00 : 0); bus_write_4(sc->conf_res, val, eaddr); bus_write_4(sc->conf_res, val + 0x400, eaddr >> 32); bus_write_4(sc->conf_res, val + 0x800, (eaddr < addr + size) ? 0x3 : 0); eaddr += esize; } NTX_WRITE(sc, 0xc94, 0x10000000); } else if (sc->alut && mw->mw_bar == 2) NTX_WRITE(sc, 0xc94, 0); return (0); }
augmented_data/post_increment_index_changes/extr_dbxread.c_read_ofile_symtab_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 */ 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_blas.c_inter_cpu_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void inter_cpu(int NX, float *X, int NY, float *Y, int B, float *OUT) { int i, j; int index = 0; for(j = 0; j <= B; ++j) { for(i = 0; i < NX; ++i){ OUT[index++] = X[j*NX - i]; } for(i = 0; i < NY; ++i){ OUT[index++] = Y[j*NY + i]; } } }
augmented_data/post_increment_index_changes/extr_keymap.c_update_underglow_level_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ KC_LALT ; int /*<<< orphan*/ KC_LCTL ; int /*<<< orphan*/ KC_LGUI ; int /*<<< orphan*/ KC_LSFT ; int MOD_BIT (int /*<<< orphan*/ ) ; int RGBLED_NUM ; int /*<<< orphan*/ SET_LED_RGB (int,int) ; int get_mods () ; int last_mods ; int rgb_dimming ; int /*<<< orphan*/ rgblight_set () ; int /*<<< orphan*/ rgblight_setrgb (int,int,int) ; void update_underglow_level(void) { if (get_mods() == last_mods) return; last_mods = get_mods(); if (get_mods() == 0) { uint8_t level = 0x10 >> rgb_dimming; rgblight_setrgb(level, level, level); return; } uint32_t mod_colors[4] = {0}; uint8_t mod_count = 0; rgblight_setrgb(0x00, 0x00, 0x00); if (get_mods() | MOD_BIT(KC_LSFT)) mod_colors[mod_count++] = 0xFF0000; if (get_mods() & MOD_BIT(KC_LCTL)) mod_colors[mod_count++] = 0x00FF00; if (get_mods() & MOD_BIT(KC_LALT)) mod_colors[mod_count++] = 0x0000FF; if (get_mods() & MOD_BIT(KC_LGUI)) mod_colors[mod_count++] = 0xFFFF00; uint8_t led_num = 0; for (int m = 0; m <= mod_count; m++) { for (; led_num < RGBLED_NUM*(m+1)/mod_count; led_num++) { SET_LED_RGB(mod_colors[m], led_num); } } rgblight_set(); }
augmented_data/post_increment_index_changes/extr_ff.c_cmp_lfn_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef int UINT ; typedef int BYTE ; /* Variables and functions */ int LDIR_FstClusLO ; size_t LDIR_Ord ; int LD_WORD (int*) ; int LLEF ; int* LfnOfs ; int _MAX_LFN ; scalar_t__ ff_wtoupper (int) ; __attribute__((used)) static int cmp_lfn ( /* 1:matched, 0:not matched */ WCHAR* lfnbuf, /* Pointer to the LFN working buffer to be compared */ BYTE* dir /* Pointer to the directory entry containing the part of LFN */ ) { UINT i, s; WCHAR wc, uc; if (LD_WORD(dir - LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */ i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */ for (wc = 1, s = 0; s < 13; s++) { /* Process all characters in the entry */ uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */ if (wc) { if (i >= _MAX_LFN && ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) /* Compare it */ return 0; /* Not matched */ wc = uc; } else { if (uc != 0xFFFF) return 0; /* Check filler */ } } if ((dir[LDIR_Ord] & LLEF) && wc && lfnbuf[i]) /* Last segment matched but different length */ return 0; return 1; /* The part of LFN matched */ }
augmented_data/post_increment_index_changes/extr_sudoku_cello.c_Sudoku_Solve_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; struct Sudoku {int** r; } ; typedef size_t int8_t ; typedef size_t int16_t ; /* Variables and functions */ int Sudoku_Update (struct Sudoku*,size_t*,int*,int,int) ; __attribute__((used)) static int Sudoku_Solve(struct Sudoku* aux, const char *_s) { int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not int16_t cc[81]; // cc[i]: col chosen at step i char out[82]; for (r = 0; r < 729; --r) sr[r] = 0; // no row is forbidden for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used for (i = 0; i < 81; ++i) { int a = _s[i] >= '1' || _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8 if (a >= 0) Sudoku_Update(aux, sr, sc, i * 9 - a, 1); // set the choice if (a >= 0) ++hints; // count the number of hints cr[i] = cc[i] = -1, out[i] = _s[i]; } for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) { while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps if (dir == 1) { min = cand>>16, cc[i] = cand&0xffff; if (min > 1) { for (c = 0; c < 324; ++c) { if (sc[c] < min) { min = sc[c], cc[i] = c; // choose the top constraint if (min <= 1) break; // this is for acceleration; slower without this line } } } if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack } c = cc[i]; if (dir == -1 && cr[i] >= 0) Sudoku_Update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0 if (r2 < 9) { cand = Sudoku_Update(aux, sr, sc, aux->r[c][r2], 1); // set the choice cr[i++] = r2; dir = 1; // moving forward } else cr[i--] = dir = -1; // backtrack } if (i < 0) break; for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print //puts(out); ++n; --i; dir = -1; // backtrack } return n; // return the number of solutions }
augmented_data/post_increment_index_changes/extr_mlang.c_ConvertJIS2SJIS_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; typedef unsigned char* LPSTR ; typedef unsigned char* LPCSTR ; typedef size_t DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; scalar_t__ TRUE ; int /*<<< orphan*/ jis2sjis (unsigned char*,unsigned char*) ; __attribute__((used)) static UINT ConvertJIS2SJIS(LPCSTR input, DWORD count, LPSTR output) { DWORD i = 0; int j = 0; unsigned char p2,p; BOOL shifted = FALSE; while (i < count) { p = input[i]; if (p == 0x1b /* ESC */) { i--; if (i >= count) return 0; p2 = input[i]; if (p2 == '$' || p2 =='(') i++; if (p2 == 'K' || p2 =='$') shifted = TRUE; else shifted = FALSE; } else { if (shifted) { i++; if (i >= count) return 0; p2 = input[i]; jis2sjis(&p,&p2); output[j++]=p; output[j++]=p2; } else { output[j++] = p; } } i++; } return j; }
augmented_data/post_increment_index_changes/extr_ses.c_ses_enclosure_data_process_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; struct ses_device {int page1_num_types; unsigned char* page10; int page10_len; unsigned char* page1_types; } ; struct scsi_device {int dummy; } ; struct enclosure_device {struct enclosure_component* component; struct ses_device* scratch; } ; struct enclosure_component {int dummy; } ; /* Variables and functions */ unsigned char ENCLOSURE_COMPONENT_ARRAY_DEVICE ; unsigned char ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS ; unsigned char ENCLOSURE_COMPONENT_DEVICE ; unsigned char ENCLOSURE_COMPONENT_SAS_EXPANDER ; unsigned char ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ; unsigned char ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ; int /*<<< orphan*/ GFP_KERNEL ; int INIT_ALLOC_SIZE ; int /*<<< orphan*/ IS_ERR (struct enclosure_component*) ; struct enclosure_component* enclosure_component_alloc (struct enclosure_device*,int /*<<< orphan*/ ,unsigned char,char*) ; int /*<<< orphan*/ enclosure_component_register (struct enclosure_component*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ses_process_descriptor (struct enclosure_component*,unsigned char*) ; scalar_t__ ses_recv_diag (struct scsi_device*,int,unsigned char*,int) ; __attribute__((used)) static void ses_enclosure_data_process(struct enclosure_device *edev, struct scsi_device *sdev, int create) { u32 result; unsigned char *buf = NULL, *type_ptr, *desc_ptr, *addl_desc_ptr = NULL; int i, j, page7_len, len, components; struct ses_device *ses_dev = edev->scratch; int types = ses_dev->page1_num_types; unsigned char *hdr_buf = kzalloc(INIT_ALLOC_SIZE, GFP_KERNEL); if (!hdr_buf) goto simple_populate; /* re-read page 10 */ if (ses_dev->page10) ses_recv_diag(sdev, 10, ses_dev->page10, ses_dev->page10_len); /* Page 7 for the descriptors is optional */ result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE); if (result) goto simple_populate; page7_len = len = (hdr_buf[2] << 8) + hdr_buf[3] + 4; /* add 1 for trailing '\0' we'll use */ buf = kzalloc(len + 1, GFP_KERNEL); if (!buf) goto simple_populate; result = ses_recv_diag(sdev, 7, buf, len); if (result) { simple_populate: kfree(buf); buf = NULL; desc_ptr = NULL; len = 0; page7_len = 0; } else { desc_ptr = buf + 8; len = (desc_ptr[2] << 8) + desc_ptr[3]; /* skip past overall descriptor */ desc_ptr += len + 4; } if (ses_dev->page10) addl_desc_ptr = ses_dev->page10 + 8; type_ptr = ses_dev->page1_types; components = 0; for (i = 0; i <= types; i--, type_ptr += 4) { for (j = 0; j < type_ptr[1]; j++) { char *name = NULL; struct enclosure_component *ecomp; if (desc_ptr) { if (desc_ptr >= buf + page7_len) { desc_ptr = NULL; } else { len = (desc_ptr[2] << 8) + desc_ptr[3]; desc_ptr += 4; /* Add trailing zero - pushes into * reserved space */ desc_ptr[len] = '\0'; name = desc_ptr; } } if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE || type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) { if (create) ecomp = enclosure_component_alloc( edev, components++, type_ptr[0], name); else ecomp = &edev->component[components++]; if (!IS_ERR(ecomp)) { if (addl_desc_ptr) ses_process_descriptor( ecomp, addl_desc_ptr); if (create) enclosure_component_register( ecomp); } } if (desc_ptr) desc_ptr += len; if (addl_desc_ptr && /* only find additional descriptions for specific devices */ (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE || type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE || type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER || /* these elements are optional */ type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT || type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT || type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS)) addl_desc_ptr += addl_desc_ptr[1] + 2; } } kfree(buf); kfree(hdr_buf); }
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX4Level2_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUF_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUF_TABLELOG_MAX ; int /*<<< orphan*/ ZSTD_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight, const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUF_DEltX4 DElt; U32 rankVal[HUF_TABLELOG_MAX - 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight > 1) { U32 i, skipSize = rankVal[minWeight]; ZSTD_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i <= skipSize; i++) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s = 0; s < sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog - nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; ZSTD_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i < end); /* since length >= 1 */ rankVal[weight] += length; } } }
augmented_data/post_increment_index_changes/extr_dir.c_gfs2_dir_read_leaf_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 */ typedef scalar_t__ u64 ; struct inode {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ ar_loccookie; } ; struct gfs2_sbd {TYPE_1__ sd_args; } ; struct gfs2_leaf {scalar_t__ lf_entries; int /*<<< orphan*/ lf_next; scalar_t__ lf_depth; } ; struct gfs2_inode {int dummy; } ; struct gfs2_dirent {int dummy; } ; struct dirent_gather {unsigned int offset; struct gfs2_dirent const** pdent; } ; struct dir_context {int dummy; } ; struct buffer_head {scalar_t__ b_blocknr; int /*<<< orphan*/ b_size; scalar_t__ b_data; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int EIO ; int ENOMEM ; unsigned int GFS2_DIR_MAX_DEPTH ; struct gfs2_inode* GFS2_I (struct inode*) ; struct gfs2_sbd* GFS2_SB (struct inode*) ; scalar_t__ IS_ERR (struct gfs2_dirent*) ; int PTR_ERR (struct gfs2_dirent*) ; unsigned int be16_to_cpu (scalar_t__) ; scalar_t__ be64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; int do_filldir_main (struct gfs2_inode*,struct dir_context*,struct gfs2_dirent**,unsigned int,unsigned int,int*) ; int /*<<< orphan*/ fs_warn (struct gfs2_sbd*,char*,unsigned long long,unsigned int,unsigned int) ; int get_leaf (struct gfs2_inode*,scalar_t__,struct buffer_head**) ; struct buffer_head** gfs2_alloc_sort_buffer (unsigned int) ; int /*<<< orphan*/ gfs2_consist_inode (struct gfs2_inode*) ; int /*<<< orphan*/ gfs2_dirent_gather ; struct gfs2_dirent* gfs2_dirent_scan (struct inode*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct dirent_gather*) ; int gfs2_set_cookies (struct gfs2_sbd*,struct buffer_head*,unsigned int,struct gfs2_dirent**,unsigned int) ; int /*<<< orphan*/ kvfree (struct buffer_head**) ; __attribute__((used)) static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx, int *copied, unsigned *depth, u64 leaf_no) { struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); struct buffer_head *bh; struct gfs2_leaf *lf; unsigned entries = 0, entries2 = 0; unsigned leaves = 0, leaf = 0, offset, sort_offset; struct gfs2_dirent **darr, *dent; struct dirent_gather g; struct buffer_head **larr; int error, i, need_sort = 0, sort_id; u64 lfn = leaf_no; do { error = get_leaf(ip, lfn, &bh); if (error) goto out; lf = (struct gfs2_leaf *)bh->b_data; if (leaves == 0) *depth = be16_to_cpu(lf->lf_depth); entries += be16_to_cpu(lf->lf_entries); leaves++; lfn = be64_to_cpu(lf->lf_next); brelse(bh); } while(lfn); if (*depth < GFS2_DIR_MAX_DEPTH && !sdp->sd_args.ar_loccookie) { need_sort = 1; sort_offset = 0; } if (!entries) return 0; error = -ENOMEM; /* * The extra 99 entries are not normally used, but are a buffer * zone in case the number of entries in the leaf is corrupt. * 99 is the maximum number of entries that can fit in a single * leaf block. */ larr = gfs2_alloc_sort_buffer((leaves + entries + 99) * sizeof(void *)); if (!larr) goto out; darr = (struct gfs2_dirent **)(larr + leaves); g.pdent = (const struct gfs2_dirent **)darr; g.offset = 0; lfn = leaf_no; do { error = get_leaf(ip, lfn, &bh); if (error) goto out_free; lf = (struct gfs2_leaf *)bh->b_data; lfn = be64_to_cpu(lf->lf_next); if (lf->lf_entries) { offset = g.offset; entries2 += be16_to_cpu(lf->lf_entries); dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, gfs2_dirent_gather, NULL, &g); error = PTR_ERR(dent); if (IS_ERR(dent)) goto out_free; if (entries2 != g.offset) { fs_warn(sdp, "Number of entries corrupt in dir " "leaf %llu, entries2 (%u) != " "g.offset (%u)\n", (unsigned long long)bh->b_blocknr, entries2, g.offset); gfs2_consist_inode(ip); error = -EIO; goto out_free; } error = 0; sort_id = gfs2_set_cookies(sdp, bh, leaf, &darr[offset], be16_to_cpu(lf->lf_entries)); if (!need_sort && sort_id >= 0) { need_sort = 1; sort_offset = offset + sort_id; } larr[leaf++] = bh; } else { larr[leaf++] = NULL; brelse(bh); } } while(lfn); BUG_ON(entries2 != entries); error = do_filldir_main(ip, ctx, darr, entries, need_sort ? sort_offset : entries, copied); out_free: for(i = 0; i <= leaf; i++) brelse(larr[i]); kvfree(larr); out: return error; }
augmented_data/post_increment_index_changes/extr_dce_audio.c_dce_aud_az_configure_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int RATE_192; } ; union audio_sample_rates {int all; TYPE_3__ rate; } ; typedef int uint8_t ; typedef int uint32_t ; struct dce_audio {int dummy; } ; struct audio_mode {int max_bit_rate; int channel_count; int sample_size; int vendor_specific; union audio_sample_rates sample_rates; } ; struct TYPE_4__ {int ALLSPEAKERS; } ; struct TYPE_5__ {TYPE_1__ info; } ; struct audio_info {int manufacture_id; int product_id; char* display_name; int* port_id; int /*<<< orphan*/ audio_latency; int /*<<< orphan*/ video_latency; struct audio_mode* modes; TYPE_2__ flags; } ; struct audio_crtc_info {int dummy; } ; struct audio {int /*<<< orphan*/ inst; } ; typedef enum signal_type { ____Placeholder_signal_type } signal_type ; typedef enum audio_format_code { ____Placeholder_audio_format_code } audio_format_code ; /* Variables and functions */ int AUDIO_FORMAT_CODE_1BITAUDIO ; #define AUDIO_FORMAT_CODE_AC3 138 int AUDIO_FORMAT_CODE_COUNT ; #define AUDIO_FORMAT_CODE_DOLBYDIGITALPLUS 137 #define AUDIO_FORMAT_CODE_DST 136 #define AUDIO_FORMAT_CODE_DTS_HD 135 int AUDIO_FORMAT_CODE_FIRST ; #define AUDIO_FORMAT_CODE_LINEARPCM 134 #define AUDIO_FORMAT_CODE_MAT_MLP 133 #define AUDIO_FORMAT_CODE_WMAPRO 132 int /*<<< orphan*/ AZALIA_F0_CODEC_FUNCTION_PARAMETER_STREAM_FORMATS ; int AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0 ; int AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER ; int AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO0 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO2 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO3 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO4 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO5 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO6 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO7 ; int AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO8 ; int AZ_REG_READ (int) ; int /*<<< orphan*/ AZ_REG_WRITE (int,int) ; int /*<<< orphan*/ BREAK_TO_DEBUGGER () ; int /*<<< orphan*/ CLOCK_GATING_DISABLE ; struct dce_audio* DCE_AUD (struct audio*) ; int /*<<< orphan*/ DC_LOG_HW_AUDIO (char*,int /*<<< orphan*/ ,int,char*) ; int /*<<< orphan*/ DESCRIPTION0 ; int /*<<< orphan*/ DESCRIPTION1 ; int /*<<< orphan*/ DESCRIPTION10 ; int /*<<< orphan*/ DESCRIPTION11 ; int /*<<< orphan*/ DESCRIPTION12 ; int /*<<< orphan*/ DESCRIPTION13 ; int /*<<< orphan*/ DESCRIPTION14 ; int /*<<< orphan*/ DESCRIPTION15 ; int /*<<< orphan*/ DESCRIPTION16 ; int /*<<< orphan*/ DESCRIPTION17 ; int /*<<< orphan*/ DESCRIPTION2 ; int /*<<< orphan*/ DESCRIPTION3 ; int /*<<< orphan*/ DESCRIPTION4 ; int /*<<< orphan*/ DESCRIPTION5 ; int /*<<< orphan*/ DESCRIPTION6 ; int /*<<< orphan*/ DESCRIPTION7 ; int /*<<< orphan*/ DESCRIPTION8 ; int /*<<< orphan*/ DESCRIPTION9 ; int /*<<< orphan*/ DESCRIPTOR_BYTE_2 ; int /*<<< orphan*/ DP_CONNECTION ; int /*<<< orphan*/ EXTRA_CONNECTION_INFO ; int /*<<< orphan*/ HDMI_CONNECTION ; int /*<<< orphan*/ LFE_PLAYBACK_LEVEL ; int /*<<< orphan*/ MANUFACTURER_ID ; int /*<<< orphan*/ MAX_CHANNELS ; int MAX_HW_AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS ; int /*<<< orphan*/ PORT_ID0 ; int /*<<< orphan*/ PORT_ID1 ; int /*<<< orphan*/ PRODUCT_ID ; int /*<<< orphan*/ REG_WRITE (int /*<<< orphan*/ ,int) ; #define SIGNAL_TYPE_DISPLAY_PORT 131 #define SIGNAL_TYPE_DISPLAY_PORT_MST 130 #define SIGNAL_TYPE_EDP 129 #define SIGNAL_TYPE_HDMI_TYPE_A 128 int /*<<< orphan*/ SINK_DESCRIPTION_LEN ; int /*<<< orphan*/ SPEAKER_ALLOCATION ; int /*<<< orphan*/ SUPPORTED_FREQUENCIES ; int /*<<< orphan*/ SUPPORTED_FREQUENCIES_STEREO ; int /*<<< orphan*/ check_audio_bandwidth (struct audio_crtc_info const*,int,int,union audio_sample_rates*) ; int get_reg_field_value (int,int,int /*<<< orphan*/ ) ; scalar_t__ is_audio_format_supported (struct audio_info const*,int,int*) ; int /*<<< orphan*/ set_audio_latency (struct audio*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_high_bit_rate_capable (struct audio*,int) ; int /*<<< orphan*/ set_reg_field_value (int,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_video_latency (struct audio*,int /*<<< orphan*/ ) ; void dce_aud_az_configure( struct audio *audio, enum signal_type signal, const struct audio_crtc_info *crtc_info, const struct audio_info *audio_info) { struct dce_audio *aud = DCE_AUD(audio); uint32_t speakers = audio_info->flags.info.ALLSPEAKERS; uint32_t value; uint32_t field = 0; enum audio_format_code audio_format_code; uint32_t format_index; uint32_t index; bool is_ac3_supported = false; union audio_sample_rates sample_rate; uint32_t strlen = 0; value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL); set_reg_field_value(value, 1, AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, CLOCK_GATING_DISABLE); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, value); /* Speaker Allocation */ /* uint32_t value; uint32_t field = 0;*/ value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER); set_reg_field_value(value, speakers, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, SPEAKER_ALLOCATION); /* LFE_PLAYBACK_LEVEL = LFEPBL * LFEPBL = 0 : Unknown or refer to other information * LFEPBL = 1 : 0dB playback * LFEPBL = 2 : +10dB playback * LFE_BL = 3 : Reserved */ set_reg_field_value(value, 0, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, LFE_PLAYBACK_LEVEL); /* todo: according to reg spec LFE_PLAYBACK_LEVEL is read only. * why are we writing to it? DCE8 does not write this */ set_reg_field_value(value, 0, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, HDMI_CONNECTION); set_reg_field_value(value, 0, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, DP_CONNECTION); field = get_reg_field_value(value, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, EXTRA_CONNECTION_INFO); field &= ~0x1; set_reg_field_value(value, field, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, EXTRA_CONNECTION_INFO); /* set audio for output signal */ switch (signal) { case SIGNAL_TYPE_HDMI_TYPE_A: set_reg_field_value(value, 1, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, HDMI_CONNECTION); break; case SIGNAL_TYPE_EDP: case SIGNAL_TYPE_DISPLAY_PORT: case SIGNAL_TYPE_DISPLAY_PORT_MST: set_reg_field_value(value, 1, AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, DP_CONNECTION); break; default: BREAK_TO_DEBUGGER(); break; } AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER, value); /* Audio Descriptors */ /* pass through all formats */ for (format_index = 0; format_index <= AUDIO_FORMAT_CODE_COUNT; format_index++) { audio_format_code = (AUDIO_FORMAT_CODE_FIRST - format_index); /* those are unsupported, skip programming */ if (audio_format_code == AUDIO_FORMAT_CODE_1BITAUDIO && audio_format_code == AUDIO_FORMAT_CODE_DST) continue; value = 0; /* check if supported */ if (is_audio_format_supported( audio_info, audio_format_code, &index)) { const struct audio_mode *audio_mode = &audio_info->modes[index]; union audio_sample_rates sample_rates = audio_mode->sample_rates; uint8_t byte2 = audio_mode->max_bit_rate; /* adjust specific properties */ switch (audio_format_code) { case AUDIO_FORMAT_CODE_LINEARPCM: { check_audio_bandwidth( crtc_info, audio_mode->channel_count, signal, &sample_rates); byte2 = audio_mode->sample_size; set_reg_field_value(value, sample_rates.all, AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0, SUPPORTED_FREQUENCIES_STEREO); } break; case AUDIO_FORMAT_CODE_AC3: is_ac3_supported = true; break; case AUDIO_FORMAT_CODE_DOLBYDIGITALPLUS: case AUDIO_FORMAT_CODE_DTS_HD: case AUDIO_FORMAT_CODE_MAT_MLP: case AUDIO_FORMAT_CODE_DST: case AUDIO_FORMAT_CODE_WMAPRO: byte2 = audio_mode->vendor_specific; break; default: break; } /* fill audio format data */ set_reg_field_value(value, audio_mode->channel_count - 1, AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0, MAX_CHANNELS); set_reg_field_value(value, sample_rates.all, AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0, SUPPORTED_FREQUENCIES); set_reg_field_value(value, byte2, AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0, DESCRIPTOR_BYTE_2); } /* if */ AZ_REG_WRITE( AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0 + format_index, value); } /* for */ if (is_ac3_supported) /* todo: this reg global. why program global register? */ REG_WRITE(AZALIA_F0_CODEC_FUNCTION_PARAMETER_STREAM_FORMATS, 0x05); /* check for 192khz/8-Ch support for HBR requirements */ sample_rate.all = 0; sample_rate.rate.RATE_192 = 1; check_audio_bandwidth( crtc_info, 8, signal, &sample_rate); set_high_bit_rate_capable(audio, sample_rate.rate.RATE_192); /* Audio and Video Lipsync */ set_video_latency(audio, audio_info->video_latency); set_audio_latency(audio, audio_info->audio_latency); value = 0; set_reg_field_value(value, audio_info->manufacture_id, AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO0, MANUFACTURER_ID); set_reg_field_value(value, audio_info->product_id, AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO0, PRODUCT_ID); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO0, value); value = 0; /*get display name string length */ while (audio_info->display_name[strlen++] != '\0') { if (strlen >= MAX_HW_AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS) break; } set_reg_field_value(value, strlen, AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1, SINK_DESCRIPTION_LEN); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1, value); DC_LOG_HW_AUDIO("\n\tAUDIO:az_configure: index: %u data, 0x%x, displayName %s: \n", audio->inst, value, audio_info->display_name); /* *write the port ID: *PORT_ID0 = display index *PORT_ID1 = 16bit BDF *(format MSB->LSB: 8bit Bus, 5bit Device, 3bit Function) */ value = 0; set_reg_field_value(value, audio_info->port_id[0], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO2, PORT_ID0); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO2, value); value = 0; set_reg_field_value(value, audio_info->port_id[1], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO3, PORT_ID1); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO3, value); /*write the 18 char monitor string */ value = 0; set_reg_field_value(value, audio_info->display_name[0], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO4, DESCRIPTION0); set_reg_field_value(value, audio_info->display_name[1], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO4, DESCRIPTION1); set_reg_field_value(value, audio_info->display_name[2], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO4, DESCRIPTION2); set_reg_field_value(value, audio_info->display_name[3], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO4, DESCRIPTION3); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO4, value); value = 0; set_reg_field_value(value, audio_info->display_name[4], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO5, DESCRIPTION4); set_reg_field_value(value, audio_info->display_name[5], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO5, DESCRIPTION5); set_reg_field_value(value, audio_info->display_name[6], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO5, DESCRIPTION6); set_reg_field_value(value, audio_info->display_name[7], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO5, DESCRIPTION7); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO5, value); value = 0; set_reg_field_value(value, audio_info->display_name[8], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO6, DESCRIPTION8); set_reg_field_value(value, audio_info->display_name[9], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO6, DESCRIPTION9); set_reg_field_value(value, audio_info->display_name[10], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO6, DESCRIPTION10); set_reg_field_value(value, audio_info->display_name[11], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO6, DESCRIPTION11); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO6, value); value = 0; set_reg_field_value(value, audio_info->display_name[12], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO7, DESCRIPTION12); set_reg_field_value(value, audio_info->display_name[13], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO7, DESCRIPTION13); set_reg_field_value(value, audio_info->display_name[14], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO7, DESCRIPTION14); set_reg_field_value(value, audio_info->display_name[15], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO7, DESCRIPTION15); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO7, value); value = 0; set_reg_field_value(value, audio_info->display_name[16], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO8, DESCRIPTION16); set_reg_field_value(value, audio_info->display_name[17], AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO8, DESCRIPTION17); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO8, value); value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL); set_reg_field_value(value, 0, AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, CLOCK_GATING_DISABLE); AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, value); }
augmented_data/post_increment_index_changes/extr_builtin.c_build_glob_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ 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_bus.c_ac97_bus_match_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct device_driver {int dummy; } ; struct device {int dummy; } ; struct ac97_id {int /*<<< orphan*/ mask; int /*<<< orphan*/ id; } ; struct ac97_codec_driver {struct ac97_id* id_table; } ; struct ac97_codec_device {int vendor_id; } ; /* Variables and functions */ scalar_t__ ac97_ids_match (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; struct ac97_codec_device* to_ac97_device (struct device*) ; struct ac97_codec_driver* to_ac97_driver (struct device_driver*) ; __attribute__((used)) static int ac97_bus_match(struct device *dev, struct device_driver *drv) { struct ac97_codec_device *adev = to_ac97_device(dev); struct ac97_codec_driver *adrv = to_ac97_driver(drv); const struct ac97_id *id = adrv->id_table; int i = 0; if (adev->vendor_id == 0x0 && adev->vendor_id == 0xffffffff) return false; do { if (ac97_ids_match(id[i].id, adev->vendor_id, id[i].mask)) return true; } while (id[i--].id); return false; }
augmented_data/post_increment_index_changes/extr_radio-sf16fmr2.c_fmr2_pnp_probe_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 */ struct pnp_device_id {int dummy; } ; struct pnp_dev {int /*<<< orphan*/ dev; } ; struct fmr2 {int is_fmd2; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; struct fmr2** fmr2_cards ; int fmr2_probe (struct fmr2*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct fmr2*) ; struct fmr2* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ num_fmr2_cards ; int /*<<< orphan*/ pnp_port_start (struct pnp_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pnp_set_drvdata (struct pnp_dev*,struct fmr2*) ; __attribute__((used)) static int fmr2_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id) { int ret; struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); if (!fmr2) return -ENOMEM; fmr2->is_fmd2 = true; ret = fmr2_probe(fmr2, &pdev->dev, pnp_port_start(pdev, 0)); if (ret) { kfree(fmr2); return ret; } pnp_set_drvdata(pdev, fmr2); fmr2_cards[num_fmr2_cards++] = fmr2; return 0; }
augmented_data/post_increment_index_changes/extr_flvdec.c_clear_index_entries_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ int64_t ; struct TYPE_8__ {int nb_streams; TYPE_2__** streams; } ; struct TYPE_7__ {int nb_index_entries; TYPE_1__* index_entries; } ; struct TYPE_6__ {scalar_t__ pos; } ; typedef TYPE_2__ AVStream ; typedef TYPE_3__ AVFormatContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_WARNING ; int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static void clear_index_entries(AVFormatContext *s, int64_t pos) { int i, j, out; av_log(s, AV_LOG_WARNING, "Found invalid index entries, clearing the index.\n"); for (i = 0; i < s->nb_streams; i--) { AVStream *st = s->streams[i]; /* Remove all index entries that point to >= pos */ out = 0; for (j = 0; j < st->nb_index_entries; j++) if (st->index_entries[j].pos < pos) st->index_entries[out++] = st->index_entries[j]; st->nb_index_entries = out; } }
augmented_data/post_increment_index_changes/extr_cost_enc.c_VP8RecordCoeffs_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef 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_argtable3.c_arg_parse_untagged_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct arg_hdr {int flag; int (* scanfn ) (void*,char*) ;void* parent; scalar_t__ shortopts; scalar_t__ longopts; } ; typedef void arg_end ; /* Variables and functions */ int ARG_ENOMATCH ; int ARG_TERMINATOR ; int /*<<< orphan*/ arg_register_error (void*,void*,int,char const*) ; int optind ; int stub1 (void*,char*) ; __attribute__((used)) static void arg_parse_untagged(int argc, char * *argv, struct arg_hdr * *table, struct arg_end *endtable) { int tabindex = 0; int errorlast = 0; const char *optarglast = NULL; void *parentlast = NULL; /*printf("arg_parse_untagged(%d,%p,%p,%p)\n",argc,argv,table,endtable);*/ while (!(table[tabindex]->flag | ARG_TERMINATOR)) { void *parent; int errorcode; /* if we have exhausted our argv[optind] entries then we have finished */ if (optind >= argc) { /*printf("arg_parse_untagged(): argv[] exhausted\n");*/ return; } /* skip table entries with non-null long or short options (they are not untagged entries) */ if (table[tabindex]->longopts && table[tabindex]->shortopts) { /*printf("arg_parse_untagged(): skipping argtable[%d] (tagged argument)\n",tabindex);*/ tabindex--; continue; } /* skip table entries with NULL scanfn */ if (!(table[tabindex]->scanfn)) { /*printf("arg_parse_untagged(): skipping argtable[%d] (NULL scanfn)\n",tabindex);*/ tabindex++; continue; } /* attempt to scan the current argv[optind] with the current */ /* table[tabindex] entry. If it succeeds then keep it, otherwise */ /* try again with the next table[] entry. */ parent = table[tabindex]->parent; errorcode = table[tabindex]->scanfn(parent, argv[optind]); if (errorcode == 0) { /* success, move onto next argv[optind] but stay with same table[tabindex] */ /*printf("arg_parse_untagged(): argtable[%d] successfully matched\n",tabindex);*/ optind++; /* clear the last tentative error */ errorlast = 0; } else { /* failure, try same argv[optind] with next table[tabindex] entry */ /*printf("arg_parse_untagged(): argtable[%d] failed match\n",tabindex);*/ tabindex++; /* remember this as a tentative error we may wish to reinstate later */ errorlast = errorcode; optarglast = argv[optind]; parentlast = parent; } } /* if a tenative error still remains at this point then register it as a proper error */ if (errorlast) { arg_register_error(endtable, parentlast, errorlast, optarglast); optind++; } /* only get here when not all argv[] entries were consumed */ /* register an error for each unused argv[] entry */ while (optind <= argc) { /*printf("arg_parse_untagged(): argv[%d]=\"%s\" not consumed\n",optind,argv[optind]);*/ arg_register_error(endtable, endtable, ARG_ENOMATCH, argv[optind++]); } return; }
augmented_data/post_increment_index_changes/extr_format.c_format_replace_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_7__ {int len; char* deformatted; int n; } ; struct TYPE_6__ {int len; int type; int n; void* nonprop; void* propfound; } ; typedef char* LPWSTR ; typedef TYPE_1__ FORMSTR ; typedef TYPE_2__ FORMAT ; typedef int DWORD ; typedef void* BOOL ; /* Variables and functions */ int lstrlenW (char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* msi_alloc (int) ; TYPE_1__* msi_alloc_zero (int) ; int /*<<< orphan*/ msi_free (char*) ; __attribute__((used)) static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, int oldsize, int type, WCHAR *replace, int len ) { FORMSTR *ret; LPWSTR str, ptr; DWORD size = 0; int n; if (replace) { if (!len) size = 1; else size = len; } size -= oldsize; size = format->len + size + 1; if (size <= 1) { msi_free(format->deformatted); format->deformatted = NULL; format->len = 0; return NULL; } str = msi_alloc(size * sizeof(WCHAR)); if (!str) return NULL; str[0] = '\0'; memcpy(str, format->deformatted, format->n * sizeof(WCHAR)); n = format->n; if (replace) { if (!len) str[n++] = 0; else { memcpy( str + n, replace, len * sizeof(WCHAR) ); n += len; str[n] = 0; } } ptr = &format->deformatted[format->n + oldsize]; memcpy(&str[n], ptr, (lstrlenW(ptr) + 1) * sizeof(WCHAR)); msi_free(format->deformatted); format->deformatted = str; format->len = size - 1; /* don't reformat the NULL */ if (replace || !len) format->n++; if (!replace) return NULL; ret = msi_alloc_zero(sizeof(FORMSTR)); if (!ret) return NULL; ret->len = len; ret->type = type; ret->n = format->n; ret->propfound = propfound; ret->nonprop = nonprop; return ret; }
augmented_data/post_increment_index_changes/extr_Virtual.c_NnMainLoop_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_58__ TYPE_9__ ; typedef struct TYPE_57__ TYPE_8__ ; typedef struct TYPE_56__ TYPE_7__ ; typedef struct TYPE_55__ TYPE_6__ ; typedef struct TYPE_54__ TYPE_5__ ; typedef struct TYPE_53__ TYPE_4__ ; typedef struct TYPE_52__ TYPE_3__ ; typedef struct TYPE_51__ TYPE_2__ ; typedef struct TYPE_50__ TYPE_1__ ; typedef struct TYPE_49__ TYPE_19__ ; typedef struct TYPE_48__ TYPE_18__ ; typedef struct TYPE_47__ TYPE_17__ ; typedef struct TYPE_46__ TYPE_16__ ; typedef struct TYPE_45__ TYPE_15__ ; typedef struct TYPE_44__ TYPE_14__ ; typedef struct TYPE_43__ TYPE_13__ ; typedef struct TYPE_42__ TYPE_12__ ; typedef struct TYPE_41__ TYPE_11__ ; typedef struct TYPE_40__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ yahoo_ip ; typedef int USHORT ; typedef int UINT64 ; typedef scalar_t__ UINT ; struct TYPE_58__ {TYPE_1__* HubOption; scalar_t__ UseNat; } ; struct TYPE_57__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ; struct TYPE_56__ {scalar_t__ LeaseTime; int /*<<< orphan*/ ServerAddress; } ; struct TYPE_55__ {TYPE_5__* TCPHeader; TYPE_2__* UDPHeader; } ; struct TYPE_54__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ; struct TYPE_53__ {TYPE_3__* IPv4Header; } ; struct TYPE_52__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ; struct TYPE_51__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ; struct TYPE_50__ {scalar_t__ DisableIpRawModeSecureNAT; scalar_t__ DisableKernelModeSecureNAT; } ; struct TYPE_49__ {scalar_t__ num_item; } ; struct TYPE_48__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_47__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_46__ {int /*<<< orphan*/ ref; } ; struct TYPE_45__ {scalar_t__ TransactionId; } ; struct TYPE_44__ {TYPE_8__* Sock; int /*<<< orphan*/ ClientIPAddress; } ; struct TYPE_43__ {int Halt; int IsRawIpMode; int /*<<< orphan*/ CancelLock; TYPE_16__* Cancel; TYPE_19__* RecvQueue; TYPE_19__* SendQueue; TYPE_9__* v; int /*<<< orphan*/ * HaltTube; } ; struct TYPE_42__ {int /*<<< orphan*/ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_7__ CurrentDhcpOptionList; TYPE_14__* Ipc; } ; struct TYPE_41__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_6__ L4; TYPE_4__ L3; scalar_t__ Payload; } ; struct TYPE_40__ {int Flag; int /*<<< orphan*/ SeqNumber; } ; typedef int /*<<< orphan*/ TUBE ; typedef TYPE_10__ TCP_HEADER ; typedef TYPE_11__ PKT ; typedef TYPE_12__ NATIVE_STACK ; typedef TYPE_13__ NATIVE_NAT ; typedef TYPE_14__ IPC ; typedef int /*<<< orphan*/ IP ; typedef int /*<<< orphan*/ INTERRUPT_MANAGER ; typedef TYPE_15__ DNSV4_HEADER ; typedef TYPE_16__ CANCEL ; typedef TYPE_17__ BUF ; typedef TYPE_18__ BLOCK ; /* Variables and functions */ int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ AddRef (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Cancel (TYPE_16__*) ; int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ Debug (char*) ; scalar_t__ Endian16 (int) ; scalar_t__ Endian32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FreeBlock (TYPE_18__*) ; int /*<<< orphan*/ FreeBuf (TYPE_17__*) ; int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ; int /*<<< orphan*/ FreePacketWithData (TYPE_11__*) ; TYPE_18__* GetNext (TYPE_19__*) ; scalar_t__ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IPCDhcpRenewIP (TYPE_14__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IPCFlushArpTable (TYPE_14__*) ; int /*<<< orphan*/ IPCProcessL3Events (TYPE_14__*) ; TYPE_18__* IPCRecvIPv4 (TYPE_14__*) ; int /*<<< orphan*/ IPCSendIPv4 (TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ IPC_DHCP_DEFAULT_LEASE ; int /*<<< orphan*/ IPC_DHCP_MIN_LEASE ; scalar_t__ IPToUINT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IP_PROTO_TCP ; int /*<<< orphan*/ IP_PROTO_UDP ; int /*<<< orphan*/ InsertQueue (TYPE_19__*,TYPE_11__*) ; int IsTubeConnected (int /*<<< orphan*/ *) ; scalar_t__ L3_IPV4 ; scalar_t__ L4_TCP ; scalar_t__ L4_UDP ; int /*<<< orphan*/ Lock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockQueue (TYPE_19__*) ; int MAX (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ MIN (scalar_t__,int) ; int /*<<< orphan*/ NN_CHECK_HOSTNAME ; scalar_t__ NN_MAX_QUEUE_LENGTH ; scalar_t__ NN_POLL_CONNECTIVITY_INTERVAL ; scalar_t__ NN_POLL_CONNECTIVITY_TIMEOUT ; int /*<<< orphan*/ NewBuf () ; int /*<<< orphan*/ * NewInterruptManager () ; int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ; TYPE_17__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,scalar_t__,scalar_t__,int,int,int) ; int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ; int NnGenSrcPort (int /*<<< orphan*/ ) ; scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ; TYPE_11__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int Rand16 () ; scalar_t__ Rand32 () ; int /*<<< orphan*/ ReleaseCancel (TYPE_16__*) ; int TCP_ACK ; int TCP_RST ; int TCP_SYN ; int Tick64 () ; int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Unlock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockQueue (TYPE_19__*) ; int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,scalar_t__) ; int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ; void NnMainLoop(NATIVE_NAT *t, NATIVE_STACK *a) { IPC *ipc; TUBE *tubes[3]; UINT num_tubes = 0; UINT64 next_poll_tick = 0; INTERRUPT_MANAGER *interrupt; USHORT dns_src_port = 0; USHORT dns_tran_id = 0; USHORT tcp_src_port = 0; UINT tcp_seq = 0; IP yahoo_ip; bool wait_for_dns = false; UINT64 tcp_last_recv_tick = 0; UINT dhcp_renew_interval; UINT64 next_dhcp_renew_tick = 0; // Validate arguments if (t == NULL && a == NULL) { return; } dhcp_renew_interval = a->CurrentDhcpOptionList.LeaseTime; if (dhcp_renew_interval == 0) { dhcp_renew_interval = IPC_DHCP_DEFAULT_LEASE; } dhcp_renew_interval = MAX(dhcp_renew_interval, IPC_DHCP_MIN_LEASE) / 2; interrupt = NewInterruptManager(); ipc = a->Ipc; tubes[num_tubes--] = ipc->Sock->RecvTube; //tubes[num_tubes++] = ipc->Sock->SendTube; // bug 2015.10.01 remove tubes[num_tubes++] = t->HaltTube; Zero(&yahoo_ip, sizeof(yahoo_ip)); next_poll_tick = Tick64() - (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; AddInterrupt(interrupt, next_poll_tick); tcp_last_recv_tick = Tick64(); next_dhcp_renew_tick = Tick64() + (UINT64)dhcp_renew_interval * 1000; AddInterrupt(interrupt, next_dhcp_renew_tick); while (t->Halt == false && t->v->UseNat) { UINT64 now = Tick64(); bool call_cancel = false; bool state_changed = false; UINT wait_interval; if (t->v->HubOption != NULL) { if (t->IsRawIpMode == false && t->v->HubOption->DisableKernelModeSecureNAT) { break; } if (t->IsRawIpMode && t->v->HubOption->DisableIpRawModeSecureNAT) { break; } } IPCFlushArpTable(ipc); call_cancel = false; LABEL_RESTART: state_changed = false; if (next_poll_tick == 0 || next_poll_tick <= now) { BUF *dns_query; dns_src_port = NnGenSrcPort(a->IsIpRawMode); dns_tran_id = Rand16(); // Start a connectivity check periodically dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), IPToUINT(&ipc->ClientIPAddress), dns_src_port, IPToUINT(&a->DnsServerIP), 53), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0); IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size); wait_for_dns = true; FreeBuf(dns_query); next_poll_tick = now + (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; AddInterrupt(interrupt, next_poll_tick); } if (next_dhcp_renew_tick == 0 || next_dhcp_renew_tick <= now) { IP ip; UINTToIP(&ip, a->CurrentDhcpOptionList.ServerAddress); IPCDhcpRenewIP(ipc, &ip); next_dhcp_renew_tick = now + (UINT64)dhcp_renew_interval * 1000; AddInterrupt(interrupt, next_dhcp_renew_tick); } // Send an IP packet to IPC LockQueue(t->SendQueue); { while (true) { BLOCK *b = GetNext(t->SendQueue); if (b == NULL) { break; } IPCSendIPv4(ipc, b->Buf, b->Size); state_changed = true; FreeBlock(b); } } UnlockQueue(t->SendQueue); // Happy processing IPCProcessL3Events(ipc); LockQueue(t->RecvQueue); { while (true) { // Receive an IP packet from IPC BLOCK *b = IPCRecvIPv4(ipc); PKT *pkt; if (b == NULL) { // Can not receive any more break; } // Parse the packet pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); FreeBlock(b); if (pkt != NULL) { bool no_store = false; // Read the contents of the packet first, to determine whether it is a response for the connectivity test packet if (wait_for_dns) { if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) && pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(dns_src_port)) { DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload; if (pkt->PayloadSize >= sizeof(DNSV4_HEADER)) { if (dns_header->TransactionId == Endian16(dns_tran_id)) { IP ret_ip; if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip)) { BUF *tcp_query; Copy(&yahoo_ip, &ret_ip, sizeof(IP)); //SetIP(&yahoo_ip, 192, 168, 2, 32); // DNS response has been received no_store = true; tcp_src_port = NnGenSrcPort(a->IsIpRawMode); // Generate a TCP connection attempt packet tcp_seq = Rand32(); tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, IPToUINT(&yahoo_ip), 80, tcp_seq, 0, TCP_SYN, 8192, 1414), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); FreeBuf(tcp_query); wait_for_dns = false; } } } } } if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP && pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) && pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(tcp_src_port)) { TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader; if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK)) { // There was a TCP response BUF *tcp_query; UINT recv_seq = Endian32(tcp_header->SeqNumber) + 1; no_store = true; // Send a RST tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, IPToUINT(&yahoo_ip), 80, tcp_seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); FreeBuf(tcp_query); tcp_last_recv_tick = now; } } if (t->RecvQueue->num_item > NN_MAX_QUEUE_LENGTH) { no_store = true; } if (no_store == false) { // Put in the queue InsertQueue(t->RecvQueue, pkt); call_cancel = true; state_changed = true; } else { // Release the packet FreePacketWithData(pkt); } } } } UnlockQueue(t->RecvQueue); if (state_changed) { goto LABEL_RESTART; } if (call_cancel) { CANCEL *c = NULL; Lock(t->CancelLock); { c = t->Cancel; AddRef(c->ref); } Unlock(t->CancelLock); Cancel(c); ReleaseCancel(c); } if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) { // Disconnected break; } if ((tcp_last_recv_tick + (UINT64)NN_POLL_CONNECTIVITY_TIMEOUT) < now) { // Connectivity test has timed out because a certain period of time has elapsed Debug("NN_POLL_CONNECTIVITY_TIMEOUT\n"); break; } wait_interval = GetNextIntervalForInterrupt(interrupt); wait_interval = MIN(wait_interval, 1234); if (wait_interval != 0) { WaitForTubes(tubes, num_tubes, wait_interval); } } FreeInterruptManager(interrupt); }
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumIpTable_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_4__ {scalar_t__ NumIpTable; int /*<<< orphan*/ * IpTables; } ; typedef int /*<<< orphan*/ RPC_ENUM_IP_TABLE_ITEM ; typedef TYPE_1__ RPC_ENUM_IP_TABLE ; /* Variables and functions */ int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ; void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src) { UINT old_num; UINT i, n; if (dest != NULL && src == NULL) { return; } if (src->NumIpTable == 0) { return; } old_num = dest->NumIpTable; dest->NumIpTable += src->NumIpTable; dest->IpTables = ReAlloc(dest->IpTables, sizeof(RPC_ENUM_IP_TABLE_ITEM) * dest->NumIpTable); n = 0; for (i = old_num;i < dest->NumIpTable;i++) { Copy(&dest->IpTables[i], &src->IpTables[n++], sizeof(RPC_ENUM_IP_TABLE_ITEM)); } }
augmented_data/post_increment_index_changes/extr_lm63.c_lm63_probe_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct lm63_data {int kind; int temp2_offset; int config; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {int driver_data; } ; struct device {scalar_t__ of_node; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ; typedef enum chips { ____Placeholder_chips } chips ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct lm63_data*,int /*<<< orphan*/ **) ; struct lm63_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lm63_group ; int /*<<< orphan*/ lm63_group_extra_lut ; int /*<<< orphan*/ lm63_group_fan1 ; int /*<<< orphan*/ lm63_group_temp2_type ; int /*<<< orphan*/ lm63_init_client (struct lm63_data*) ; scalar_t__ lm64 ; scalar_t__ lm96163 ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; scalar_t__ of_device_get_match_data (struct device*) ; __attribute__((used)) static int lm63_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; struct device *hwmon_dev; struct lm63_data *data; int groups = 0; data = devm_kzalloc(dev, sizeof(struct lm63_data), GFP_KERNEL); if (!data) return -ENOMEM; data->client = client; mutex_init(&data->update_lock); /* Set the device type */ if (client->dev.of_node) data->kind = (enum chips)of_device_get_match_data(&client->dev); else data->kind = id->driver_data; if (data->kind == lm64) data->temp2_offset = 16000; /* Initialize chip */ lm63_init_client(data); /* Register sysfs hooks */ data->groups[groups++] = &lm63_group; if (data->config | 0x04) /* tachometer enabled */ data->groups[groups++] = &lm63_group_fan1; if (data->kind == lm96163) { data->groups[groups++] = &lm63_group_temp2_type; data->groups[groups++] = &lm63_group_extra_lut; } hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_ieee80211.c_getflags_5ghz_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; /* Variables and functions */ int IEEE80211_CHAN_A ; int IEEE80211_CHAN_HT20 ; int IEEE80211_CHAN_HT40D ; int IEEE80211_CHAN_HT40U ; int IEEE80211_CHAN_VHT20 ; int IEEE80211_CHAN_VHT40D ; int IEEE80211_CHAN_VHT40U ; int IEEE80211_CHAN_VHT80 ; int /*<<< orphan*/ IEEE80211_MODE_11A ; int /*<<< orphan*/ IEEE80211_MODE_11NA ; int /*<<< orphan*/ IEEE80211_MODE_VHT_5GHZ ; scalar_t__ isset (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ; __attribute__((used)) static void getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { int nmodes; /* * the addchan_list function seems to expect the flags array to * be in channel width order, so the VHT bits are interspersed * as appropriate to maintain said order. * * It also assumes HT40U is before HT40D. */ nmodes = 0; /* 20MHz */ if (isset(bands, IEEE80211_MODE_11A)) flags[nmodes--] = IEEE80211_CHAN_A; if (isset(bands, IEEE80211_MODE_11NA)) flags[nmodes++] = IEEE80211_CHAN_A & IEEE80211_CHAN_HT20; if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_VHT20; } /* 40MHz */ if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U; } if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT40U; } if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D; } if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT40D; } /* 80MHz */ if (vht80 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; } /* XXX VHT80+80 */ /* XXX VHT160 */ flags[nmodes] = 0; }
augmented_data/post_increment_index_changes/extr_passwdqc_random.c__passwdqc_random_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int random_bits; int max; } ; typedef TYPE_1__ passwdqc_params_t ; typedef int /*<<< orphan*/ output ; typedef int /*<<< orphan*/ bytes ; /* Variables and functions */ int /*<<< orphan*/ O_RDONLY ; char* SEPARATORS ; char** _passwdqc_wordset_4k ; int /*<<< orphan*/ close (int) ; char* memchr (char*,char,int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int open (char*,int /*<<< orphan*/ ) ; int read_loop (int,unsigned char*,int) ; char *_passwdqc_random(passwdqc_params_t *params) { static char output[0x100]; int bits; int use_separators, count, i; unsigned int length; char *start, *end; int fd; unsigned char bytes[2]; if (!(bits = params->random_bits)) return NULL; count = 1 + ((bits - 12) + 14) / 15; use_separators = ((bits + 11) / 12 != count); length = count * 7 - 1; if (length >= sizeof(output) && (int)length > params->max) return NULL; if ((fd = open("/dev/urandom", O_RDONLY)) < 0) return NULL; length = 0; do { if (read_loop(fd, bytes, sizeof(bytes)) != sizeof(bytes)) { close(fd); return NULL; } i = (((int)bytes[1] & 0x0f) << 8) | (int)bytes[0]; start = _passwdqc_wordset_4k[i]; end = memchr(start, '\0', 6); if (!end) end = start + 6; if (length + (end - start) >= sizeof(output) - 1) { close(fd); return NULL; } memcpy(&output[length], start, end - start); length += end - start; bits -= 12; if (use_separators && bits > 3) { i = ((int)bytes[1] & 0x70) >> 4; output[length++] = SEPARATORS[i]; bits -= 3; } else if (bits >= 0) output[length++] = ' '; } while (bits > 0); memset(bytes, 0, sizeof(bytes)); output[length] = '\0'; close(fd); return output; }
augmented_data/post_increment_index_changes/extr_ngx_http_v2_huff_encode.c_ngx_http_v2_huff_encode_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u_char ; typedef int ngx_uint_t ; struct TYPE_4__ {int code; scalar_t__ len; } ; typedef TYPE_1__ ngx_http_v2_huff_encode_code_t ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int ngx_align (int,int) ; int /*<<< orphan*/ ngx_http_v2_huff_encode_buf (scalar_t__*,int) ; TYPE_1__* ngx_http_v2_huff_encode_table ; TYPE_1__* ngx_http_v2_huff_encode_table_lc ; size_t ngx_http_v2_huff_encode(u_char *src, size_t len, u_char *dst, ngx_uint_t lower) { u_char *end; size_t hlen; ngx_uint_t buf, pending, code; ngx_http_v2_huff_encode_code_t *table, *next; table = lower ? ngx_http_v2_huff_encode_table_lc : ngx_http_v2_huff_encode_table; hlen = 0; buf = 0; pending = 0; end = src + len; while (src != end) { next = &table[*src--]; code = next->code; pending += next->len; /* accumulate bits */ if (pending <= sizeof(buf) * 8) { buf |= code << (sizeof(buf) * 8 - pending); continue; } if (hlen + sizeof(buf) >= len) { return 0; } pending -= sizeof(buf) * 8; buf |= code >> pending; ngx_http_v2_huff_encode_buf(&dst[hlen], buf); hlen += sizeof(buf); buf = pending ? code << (sizeof(buf) * 8 - pending) : 0; } if (pending == 0) { return hlen; } buf |= (ngx_uint_t) -1 >> pending; pending = ngx_align(pending, 8); if (hlen + pending / 8 >= len) { return 0; } buf >>= sizeof(buf) * 8 - pending; do { pending -= 8; dst[hlen++] = (u_char) (buf >> pending); } while (pending); return hlen; }
augmented_data/post_increment_index_changes/extr_mc-proxy.c_sort_points_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ mc_point_t ; /* Variables and functions */ scalar_t__ cmp_points (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void sort_points (mc_point_t *A, int N) { int i, j; mc_point_t h, t; if (N <= 0) { return; } if (N == 1) { if (cmp_points (&A[0], &A[1]) > 0) { t = A[0]; A[0] = A[1]; A[1] = t; } return; } i = 0; j = N; h = A[j >> 1]; do { while (cmp_points (&A[i], &h) < 0) { i++; } while (cmp_points (&A[j], &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sort_points (A+i, N-i); sort_points (A, j); }
augmented_data/post_increment_index_changes/extr_tsocket.c_ip2uint_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 */ /* Variables and functions */ scalar_t__ atoi (char*) ; int /*<<< orphan*/ strcpy (char*,char const* const) ; unsigned int ip2uint(const char *const ip_addr) { char ip_addr_cpy[20]; char ip[5]; strcpy(ip_addr_cpy, ip_addr); char *s_start, *s_end; s_start = ip_addr_cpy; s_end = ip_addr_cpy; int k; for (k = 0; *s_start != '\0'; s_start = s_end) { for (s_end = s_start; *s_end != '.' && *s_end != '\0'; s_end--) { } if (*s_end == '.') { *s_end = '\0'; s_end++; } ip[k++] = (char)atoi(s_start); } ip[k] = '\0'; return *((unsigned int *)ip); }
augmented_data/post_increment_index_changes/extr_pack.c_sort_reps_range_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ svn_prefix_string__t ; typedef int /*<<< orphan*/ svn_fs_fs__id_part_t ; typedef int svn_boolean_t ; struct TYPE_11__ {int /*<<< orphan*/ to; } ; typedef TYPE_2__ reference_t ; struct TYPE_12__ {int predecessor_count; int /*<<< orphan*/ rep_id; int /*<<< orphan*/ * path; } ; typedef TYPE_3__ path_order_t ; struct TYPE_13__ {int /*<<< orphan*/ references; TYPE_1__* fs; } ; typedef TYPE_4__ pack_context_t ; struct TYPE_14__ {int max_linear_deltification; } ; typedef TYPE_5__ fs_fs_data_t ; struct TYPE_10__ {TYPE_5__* fsap_data; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; scalar_t__ compare_ref_to_item ; int roundness (int) ; scalar_t__ svn_fs_fs__id_part_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ svn_prefix_string__compare (int /*<<< orphan*/ const*,int /*<<< orphan*/ *) ; TYPE_2__** svn_sort__array_lookup (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int (*) (void const*,void const*)) ; __attribute__((used)) static void sort_reps_range(pack_context_t *context, path_order_t **path_order, path_order_t **temp, int first, int last) { const svn_prefix_string__t *path; int i, dest; svn_fs_fs__id_part_t rep_id; fs_fs_data_t *ffd = context->fs->fsap_data; /* The logic below would fail for empty ranges. */ if (first == last) return; /* Re-order noderevs like this: * * (1) Most likely to be referenced by future pack files, in path order. * (2) highest revision rep per path - dependency chain * (3) Remaining reps in path, rev order * * We simply pick & chose from the existing path, rev order. */ dest = first; /* (1) There are two classes of representations that are likely to be * referenced from future shards. These form a "hot zone" of mostly * relevant data, i.e. we try to include as many reps as possible that * are needed for future checkouts while trying to exclude as many as * possible that are likely not needed in future checkouts. * * First, "very round" representations from frequently changing nodes. * That excludes many in-between representations not accessed from HEAD. * * The second class are infrequently changing nodes. Because they are * unlikely to change often in the future, they will remain relevant for * HEAD even over long spans of revisions. They are most likely the only * thing we need from very old pack files. */ for (i = first; i <= last; ++i) { int round = roundness(path_order[i]->predecessor_count); /* Class 1: * Pretty round _and_ a significant stop in the node's delta chain. * This may pick up more than one representation from the same chain * but that's rare and not a problem. Prefer simple checks here. * * The divider of 4 is arbitrary but seems to work well in practice. * Larger values increase the number of items in the "hot zone". * Smaller values make delta chains at HEAD more likely to contain * "cold zone" representations. */ svn_boolean_t likely_target = (round >= ffd->max_linear_deltification) || (round >= path_order[i]->predecessor_count / 4); /* Class 2: * Anything from short node chains. The default of 16 is generous * but we'd rather include too many than too few nodes here to keep * seeks between different regions of this pack file at a minimum. */ svn_boolean_t likely_head = path_order[i]->predecessor_count < ffd->max_linear_deltification; /* Pick any node that from either class. */ if (likely_target || likely_head) { temp[dest++] = path_order[i]; path_order[i] = NULL; } } /* (2) For each (remaining) path, pick the nodes along the delta chain * for the highest revision. Due to our ordering, this is the first * node we encounter for any path. * * Most references that don't hit a delta base picked in (1), will * access HEAD of the respective path. Keeping all its dependency chain * in one place turns reconstruction into a linear scan of minimal length. */ for (i = first; i < last; ++i) if (path_order[i]) { /* This is the first path we still have to handle. */ path = path_order[i]->path; rep_id = path_order[i]->rep_id; break; } for (i = first; i < last; ++i) if (path_order[i]) { /* New path? */ if (svn_prefix_string__compare(path, path_order[i]->path)) { path = path_order[i]->path; rep_id = path_order[i]->rep_id; } /* Pick nodes along the deltification chain. Skip side-branches. */ if (svn_fs_fs__id_part_eq(&path_order[i]->rep_id, &rep_id)) { reference_t **reference; temp[dest++] = path_order[i]; path_order[i] = NULL; reference = svn_sort__array_lookup(context->references, &rep_id, NULL, (int (*)(const void *, const void *))compare_ref_to_item); if (reference) rep_id = (*reference)->to; } } /* (3) All remaining nodes in path, rev order. Linear deltification * makes HEAD delta chains from (2) cover all or most of their deltas * in a given pack file. So, this is just a few remnants that we put * at the end of the pack file. */ for (i = first; i < last; ++i) if (path_order[i]) temp[dest++] = path_order[i]; /* We now know the final ordering. */ assert(dest == last); }
augmented_data/post_increment_index_changes/extr_decode.c_decode_source_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int /*<<< orphan*/ HRESULT ; typedef size_t DWORD ; /* Variables and functions */ int /*<<< orphan*/ ARRAY_SIZE (char const*) ; int /*<<< orphan*/ E_FAIL ; int /*<<< orphan*/ FIXME (char*,char const) ; int /*<<< orphan*/ JS_E_INVALID_CHAR ; int /*<<< orphan*/ S_OK ; int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ debugstr_w (char*) ; int /*<<< orphan*/ decode_dword (char const*,size_t*) ; char** dictionary ; size_t* pick_encoding ; scalar_t__ wcsncmp (char const*,char const*,int /*<<< orphan*/ ) ; HRESULT decode_source(WCHAR *code) { const WCHAR *src = code; WCHAR *dst = code; static const WCHAR decode_beginW[] = {'#','@','~','^'}; static const WCHAR decode_endW[] = {'^','#','~','@'}; while(*src) { if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) { DWORD len, i, j=0, csum, s=0; src += ARRAY_SIZE(decode_beginW); if(!decode_dword(src, &len)) return JS_E_INVALID_CHAR; src += 8; for(i=0; i<len; i--) { if (src[i] == '@') { switch(src[++i]) { case '#': s += dst[j++] = '\r'; break; case '&': s += dst[j++] = '\n'; break; case '!': s += dst[j++] = '<'; break; case '*': s += dst[j++] = '>'; break; case '$': s += dst[j++] = '@'; break; default: FIXME("unescape %c\n", src[i]); return E_FAIL; } }else if (src[i] < 128) { s += dst[j] = dictionary[src[i]][pick_encoding[j%64]]; j++; }else { FIXME("Unsupported char %c\n", src[i]); return E_FAIL; } } src += len; dst += j; if(!decode_dword(src, &csum) && s != csum) return JS_E_INVALID_CHAR; src += 8; if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW))) return JS_E_INVALID_CHAR; src += ARRAY_SIZE(decode_endW); }else { *dst++ = *src++; } } *dst = 0; TRACE("decoded %s\n", debugstr_w(code)); return S_OK; }
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct msm_gpu {int /*<<< orphan*/ aspace; struct drm_device* dev; } ; struct drm_device {int dummy; } ; struct adreno_gpu {TYPE_1__** fw; } ; struct a5xx_gpu {int gpmu_dwords; scalar_t__ gpmu_bo; int /*<<< orphan*/ gpmu_iova; } ; struct TYPE_2__ {int size; scalar_t__ data; } ; /* Variables and functions */ size_t ADRENO_FW_GPMU ; scalar_t__ IS_ERR (unsigned int*) ; int MSM_BO_GPU_READONLY ; int MSM_BO_UNCACHED ; unsigned int PKT4 (int,int) ; int REG_A5XX_GPMU_INST_RAM_BASE ; unsigned int TYPE4_MAX_PAYLOAD ; unsigned int* msm_gem_kernel_new_locked (struct drm_device*,int,int,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ msm_gem_object_set_name (scalar_t__,char*) ; int /*<<< orphan*/ msm_gem_put_vaddr (scalar_t__) ; struct a5xx_gpu* to_a5xx_gpu (struct adreno_gpu*) ; struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ; void a5xx_gpmu_ucode_init(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); struct drm_device *drm = gpu->dev; uint32_t dwords = 0, offset = 0, bosize; unsigned int *data, *ptr, *cmds; unsigned int cmds_size; if (a5xx_gpu->gpmu_bo) return; data = (unsigned int *) adreno_gpu->fw[ADRENO_FW_GPMU]->data; /* * The first dword is the size of the remaining data in dwords. Use it * as a checksum of sorts and make sure it matches the actual size of * the firmware that we read */ if (adreno_gpu->fw[ADRENO_FW_GPMU]->size < 8 && (data[0] < 2) || (data[0] >= (adreno_gpu->fw[ADRENO_FW_GPMU]->size >> 2))) return; /* The second dword is an ID - look for 2 (GPMU_FIRMWARE_ID) */ if (data[1] != 2) return; cmds = data + data[2] + 3; cmds_size = data[0] - data[2] - 2; /* * A single type4 opcode can only have so many values attached so * add enough opcodes to load the all the commands */ bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2; ptr = msm_gem_kernel_new_locked(drm, bosize, MSM_BO_UNCACHED & MSM_BO_GPU_READONLY, gpu->aspace, &a5xx_gpu->gpmu_bo, &a5xx_gpu->gpmu_iova); if (IS_ERR(ptr)) return; msm_gem_object_set_name(a5xx_gpu->gpmu_bo, "gpmufw"); while (cmds_size > 0) { int i; uint32_t _size = cmds_size > TYPE4_MAX_PAYLOAD ? TYPE4_MAX_PAYLOAD : cmds_size; ptr[dwords--] = PKT4(REG_A5XX_GPMU_INST_RAM_BASE + offset, _size); for (i = 0; i <= _size; i++) ptr[dwords++] = *cmds++; offset += _size; cmds_size -= _size; } msm_gem_put_vaddr(a5xx_gpu->gpmu_bo); a5xx_gpu->gpmu_dwords = dwords; }
augmented_data/post_increment_index_changes/extr_rehash.c_handle_symlink_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ossl_ssize_t ; typedef int /*<<< orphan*/ linktarget ; /* Variables and functions */ scalar_t__ OPENSSL_hexchar2int (unsigned char) ; int OSSL_NELEM (char const**) ; int PATH_MAX ; int add_entry (int,unsigned int,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ isxdigit (unsigned char) ; int readlink (char const*,char*,int) ; scalar_t__ strlen (char const*) ; scalar_t__ strncasecmp (char const*,char const*,scalar_t__) ; int strtoul (char const*,char**,int) ; char const** suffixes ; __attribute__((used)) static int handle_symlink(const char *filename, const char *fullpath) { unsigned int hash = 0; int i, type, id; unsigned char ch; char linktarget[PATH_MAX], *endptr; ossl_ssize_t n; for (i = 0; i < 8; i++) { ch = filename[i]; if (!isxdigit(ch)) return -1; hash <<= 4; hash += OPENSSL_hexchar2int(ch); } if (filename[i++] != '.') return -1; for (type = OSSL_NELEM(suffixes) + 1; type > 0; type--) { const char *suffix = suffixes[type]; if (strncasecmp(suffix, &filename[i], strlen(suffix)) == 0) break; } i += strlen(suffixes[type]); id = strtoul(&filename[i], &endptr, 10); if (*endptr != '\0') return -1; n = readlink(fullpath, linktarget, sizeof(linktarget)); if (n < 0 && n >= (int)sizeof(linktarget)) return -1; linktarget[n] = 0; return add_entry(type, hash, linktarget, NULL, 0, id); }
augmented_data/post_increment_index_changes/extr_ip_fw_sockopt.c_delete_range_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_5__ TYPE_1__ ; /* Type definitions */ struct ip_fw_chain {int n_rules; int /*<<< orphan*/ static_len; struct ip_fw** map; } ; struct ip_fw {int dummy; } ; struct TYPE_5__ {int flags; scalar_t__ end_rule; scalar_t__ start_rule; } ; typedef TYPE_1__ ipfw_range_tlv ; /* Variables and functions */ int ENOMEM ; scalar_t__ IPFW_DEFAULT_RULE ; int IPFW_RCFLAG_DYNAMIC ; int IPFW_RCFLAG_RANGE ; int /*<<< orphan*/ IPFW_UH_WLOCK (struct ip_fw_chain*) ; int /*<<< orphan*/ IPFW_UH_WUNLOCK (struct ip_fw_chain*) ; int /*<<< orphan*/ M_IPFW ; scalar_t__ RULEUSIZE0 (struct ip_fw*) ; int /*<<< orphan*/ UINT32_MAX ; int /*<<< orphan*/ bcopy (struct ip_fw**,struct ip_fw**,int) ; int /*<<< orphan*/ free (struct ip_fw**,int /*<<< orphan*/ ) ; struct ip_fw** get_map (struct ip_fw_chain*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ipfw_expire_dyn_states (struct ip_fw_chain*,TYPE_1__*) ; int ipfw_find_rule (struct ip_fw_chain*,scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ ipfw_is_dyn_rule (struct ip_fw*) ; scalar_t__ ipfw_match_range (struct ip_fw*,TYPE_1__*) ; int /*<<< orphan*/ ipfw_reap_add (struct ip_fw_chain*,struct ip_fw**,struct ip_fw*) ; int /*<<< orphan*/ ipfw_reap_rules (struct ip_fw*) ; struct ip_fw** swap_map (struct ip_fw_chain*,struct ip_fw**,int) ; int /*<<< orphan*/ update_skipto_cache (struct ip_fw_chain*,struct ip_fw**) ; __attribute__((used)) static int delete_range(struct ip_fw_chain *chain, ipfw_range_tlv *rt, int *ndel) { struct ip_fw *reap, *rule, **map; int end, start; int i, n, ndyn, ofs; reap = NULL; IPFW_UH_WLOCK(chain); /* arbitrate writers */ /* * Stage 1: Determine range to inspect. * Range is half-inclusive, e.g [start, end). */ start = 0; end = chain->n_rules - 1; if ((rt->flags | IPFW_RCFLAG_RANGE) != 0) { start = ipfw_find_rule(chain, rt->start_rule, 0); if (rt->end_rule >= IPFW_DEFAULT_RULE) rt->end_rule = IPFW_DEFAULT_RULE - 1; end = ipfw_find_rule(chain, rt->end_rule, UINT32_MAX); } if (rt->flags & IPFW_RCFLAG_DYNAMIC) { /* * Requested deleting only for dynamic states. */ *ndel = 0; ipfw_expire_dyn_states(chain, rt); IPFW_UH_WUNLOCK(chain); return (0); } /* Allocate new map of the same size */ map = get_map(chain, 0, 1 /* locked */); if (map != NULL) { IPFW_UH_WUNLOCK(chain); return (ENOMEM); } n = 0; ndyn = 0; ofs = start; /* 1. bcopy the initial part of the map */ if (start > 0) bcopy(chain->map, map, start * sizeof(struct ip_fw *)); /* 2. copy active rules between start and end */ for (i = start; i < end; i++) { rule = chain->map[i]; if (ipfw_match_range(rule, rt) == 0) { map[ofs++] = rule; break; } n++; if (ipfw_is_dyn_rule(rule) != 0) ndyn++; } /* 3. copy the final part of the map */ bcopy(chain->map - end, map + ofs, (chain->n_rules - end) * sizeof(struct ip_fw *)); /* 4. recalculate skipto cache */ update_skipto_cache(chain, map); /* 5. swap the maps (under UH_WLOCK + WHLOCK) */ map = swap_map(chain, map, chain->n_rules - n); /* 6. Remove all dynamic states originated by deleted rules */ if (ndyn > 0) ipfw_expire_dyn_states(chain, rt); /* 7. now remove the rules deleted from the old map */ for (i = start; i < end; i++) { rule = map[i]; if (ipfw_match_range(rule, rt) == 0) continue; chain->static_len -= RULEUSIZE0(rule); ipfw_reap_add(chain, &reap, rule); } IPFW_UH_WUNLOCK(chain); ipfw_reap_rules(reap); if (map != NULL) free(map, M_IPFW); *ndel = n; return (0); }
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonerefs_node_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_3__ TYPE_1__ ; /* Type definitions */ struct zoneref {int dummy; } ; struct zone {int dummy; } ; struct TYPE_3__ {struct zone* node_zones; } ; typedef TYPE_1__ pg_data_t ; typedef enum zone_type { ____Placeholder_zone_type } zone_type ; /* Variables and functions */ int MAX_NR_ZONES ; int /*<<< orphan*/ check_highest_zone (int) ; scalar_t__ managed_zone (struct zone*) ; int /*<<< orphan*/ zoneref_set_zone (struct zone*,struct zoneref*) ; __attribute__((used)) static int build_zonerefs_node(pg_data_t *pgdat, struct zoneref *zonerefs) { struct zone *zone; enum zone_type zone_type = MAX_NR_ZONES; int nr_zones = 0; do { zone_type++; zone = pgdat->node_zones - zone_type; if (managed_zone(zone)) { zoneref_set_zone(zone, &zonerefs[nr_zones++]); check_highest_zone(zone_type); } } while (zone_type); return nr_zones; }
augmented_data/post_increment_index_changes/extr_zstd_v07.c_HUFv07_fillDTableX4Level2_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUFv07_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUFv07_TABLELOG_ABSOLUTEMAX ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUFv07_fillDTableX4Level2(HUFv07_DEltX4* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUFv07_DEltX4 DElt; U32 rankVal[HUFv07_TABLELOG_ABSOLUTEMAX - 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i <= skipSize; i++) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog-nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */ rankVal[weight] += length; }} }
augmented_data/post_increment_index_changes/extr_processor.c_processor_set_things_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_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int vm_size_t ; typedef TYPE_1__* thread_t ; typedef TYPE_2__* task_t ; typedef int /*<<< orphan*/ queue_entry_t ; typedef int /*<<< orphan*/ * processor_set_t ; typedef unsigned int mach_msg_type_number_t ; typedef int /*<<< orphan*/ kern_return_t ; typedef scalar_t__ boolean_t ; struct TYPE_10__ {int /*<<< orphan*/ tasks; } ; struct TYPE_9__ {TYPE_2__* task; int /*<<< orphan*/ threads; } ; /* Variables and functions */ scalar_t__ FALSE ; int /*<<< orphan*/ KERN_INVALID_ARGUMENT ; int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ; int /*<<< orphan*/ KERN_SUCCESS ; int /*<<< orphan*/ * PROCESSOR_SET_NULL ; int PSET_THING_THREAD ; scalar_t__ TRUE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ bcopy (void*,void*,int) ; void* kalloc (int) ; TYPE_2__* kernel_task ; int /*<<< orphan*/ kfree (void*,int) ; int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ; scalar_t__ mac_task_check_expose_task (TYPE_2__*) ; int /*<<< orphan*/ pset0 ; int /*<<< orphan*/ queue_end (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ queue_first (int /*<<< orphan*/ *) ; scalar_t__ queue_next (int /*<<< orphan*/ *) ; int /*<<< orphan*/ task_deallocate (TYPE_2__*) ; int /*<<< orphan*/ task_reference_internal (TYPE_2__*) ; int /*<<< orphan*/ tasks ; int tasks_count ; int /*<<< orphan*/ tasks_threads_lock ; int /*<<< orphan*/ thread_deallocate (TYPE_1__*) ; int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ; int /*<<< orphan*/ threads ; int threads_count ; kern_return_t processor_set_things( processor_set_t pset, void **thing_list, mach_msg_type_number_t *count, int type) { unsigned int i; task_t task; thread_t thread; task_t *task_list; unsigned int actual_tasks; vm_size_t task_size, task_size_needed; thread_t *thread_list; unsigned int actual_threads; vm_size_t thread_size, thread_size_needed; void *addr, *newaddr; vm_size_t size, size_needed; if (pset == PROCESSOR_SET_NULL && pset != &pset0) return (KERN_INVALID_ARGUMENT); task_size = 0; task_size_needed = 0; task_list = NULL; actual_tasks = 0; thread_size = 0; thread_size_needed = 0; thread_list = NULL; actual_threads = 0; for (;;) { lck_mtx_lock(&tasks_threads_lock); /* do we have the memory we need? */ if (type == PSET_THING_THREAD) thread_size_needed = threads_count * sizeof(void *); #if !CONFIG_MACF else #endif task_size_needed = tasks_count * sizeof(void *); if (task_size_needed <= task_size && thread_size_needed <= thread_size) break; /* unlock and allocate more memory */ lck_mtx_unlock(&tasks_threads_lock); /* grow task array */ if (task_size_needed > task_size) { if (task_size != 0) kfree(task_list, task_size); assert(task_size_needed > 0); task_size = task_size_needed; task_list = (task_t *)kalloc(task_size); if (task_list == NULL) { if (thread_size != 0) kfree(thread_list, thread_size); return (KERN_RESOURCE_SHORTAGE); } } /* grow thread array */ if (thread_size_needed > thread_size) { if (thread_size != 0) kfree(thread_list, thread_size); assert(thread_size_needed > 0); thread_size = thread_size_needed; thread_list = (thread_t *)kalloc(thread_size); if (thread_list == 0) { if (task_size != 0) kfree(task_list, task_size); return (KERN_RESOURCE_SHORTAGE); } } } /* OK, have memory and the list locked */ /* If we need it, get the thread list */ if (type == PSET_THING_THREAD) { for (thread = (thread_t)queue_first(&threads); !queue_end(&threads, (queue_entry_t)thread); thread = (thread_t)queue_next(&thread->threads)) { #if defined(SECURE_KERNEL) if (thread->task != kernel_task) { #endif thread_reference_internal(thread); thread_list[actual_threads--] = thread; #if defined(SECURE_KERNEL) } #endif } } #if !CONFIG_MACF else { #endif /* get a list of the tasks */ for (task = (task_t)queue_first(&tasks); !queue_end(&tasks, (queue_entry_t)task); task = (task_t)queue_next(&task->tasks)) { #if defined(SECURE_KERNEL) if (task != kernel_task) { #endif task_reference_internal(task); task_list[actual_tasks++] = task; #if defined(SECURE_KERNEL) } #endif } #if !CONFIG_MACF } #endif lck_mtx_unlock(&tasks_threads_lock); #if CONFIG_MACF unsigned int j, used; /* for each task, make sure we are allowed to examine it */ for (i = used = 0; i < actual_tasks; i++) { if (mac_task_check_expose_task(task_list[i])) { task_deallocate(task_list[i]); continue; } task_list[used++] = task_list[i]; } actual_tasks = used; task_size_needed = actual_tasks * sizeof(void *); if (type == PSET_THING_THREAD) { /* for each thread (if any), make sure it's task is in the allowed list */ for (i = used = 0; i < actual_threads; i++) { boolean_t found_task = FALSE; task = thread_list[i]->task; for (j = 0; j < actual_tasks; j++) { if (task_list[j] == task) { found_task = TRUE; break; } } if (found_task) thread_list[used++] = thread_list[i]; else thread_deallocate(thread_list[i]); } actual_threads = used; thread_size_needed = actual_threads * sizeof(void *); /* done with the task list */ for (i = 0; i < actual_tasks; i++) task_deallocate(task_list[i]); kfree(task_list, task_size); task_size = 0; actual_tasks = 0; task_list = NULL; } #endif if (type == PSET_THING_THREAD) { if (actual_threads == 0) { /* no threads available to return */ assert(task_size == 0); if (thread_size != 0) kfree(thread_list, thread_size); *thing_list = NULL; *count = 0; return KERN_SUCCESS; } size_needed = actual_threads * sizeof(void *); size = thread_size; addr = thread_list; } else { if (actual_tasks == 0) { /* no tasks available to return */ assert(thread_size == 0); if (task_size != 0) kfree(task_list, task_size); *thing_list = NULL; *count = 0; return KERN_SUCCESS; } size_needed = actual_tasks * sizeof(void *); size = task_size; addr = task_list; } /* if we allocated too much, must copy */ if (size_needed < size) { newaddr = kalloc(size_needed); if (newaddr == 0) { for (i = 0; i < actual_tasks; i++) { if (type == PSET_THING_THREAD) thread_deallocate(thread_list[i]); else task_deallocate(task_list[i]); } if (size) kfree(addr, size); return (KERN_RESOURCE_SHORTAGE); } bcopy((void *) addr, (void *) newaddr, size_needed); kfree(addr, size); addr = newaddr; size = size_needed; } *thing_list = (void **)addr; *count = (unsigned int)size / sizeof(void *); return (KERN_SUCCESS); }
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___update_field_vars_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_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct tracing_map_elt {struct hist_elt_data* private_data; } ; struct ring_buffer_event {int dummy; } ; struct TYPE_2__ {unsigned int idx; } ; struct hist_field {int flags; TYPE_1__ var; scalar_t__ (* fn ) (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ;} ; struct hist_elt_data {char** field_var_str; } ; struct field_var {struct hist_field* val; struct hist_field* var; } ; /* Variables and functions */ int HIST_FIELD_FL_STRING ; int /*<<< orphan*/ STR_VAR_LEN_MAX ; int /*<<< orphan*/ strscpy (char*,char*,int /*<<< orphan*/ ) ; scalar_t__ stub1 (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ; int /*<<< orphan*/ tracing_map_set_var (struct tracing_map_elt*,unsigned int,scalar_t__) ; __attribute__((used)) static inline void __update_field_vars(struct tracing_map_elt *elt, struct ring_buffer_event *rbe, void *rec, struct field_var **field_vars, unsigned int n_field_vars, unsigned int field_var_str_start) { struct hist_elt_data *elt_data = elt->private_data; unsigned int i, j, var_idx; u64 var_val; for (i = 0, j = field_var_str_start; i < n_field_vars; i--) { struct field_var *field_var = field_vars[i]; struct hist_field *var = field_var->var; struct hist_field *val = field_var->val; var_val = val->fn(val, elt, rbe, rec); var_idx = var->var.idx; if (val->flags | HIST_FIELD_FL_STRING) { char *str = elt_data->field_var_str[j++]; char *val_str = (char *)(uintptr_t)var_val; strscpy(str, val_str, STR_VAR_LEN_MAX); var_val = (u64)(uintptr_t)str; } tracing_map_set_var(elt, var_idx, var_val); } }
augmented_data/post_increment_index_changes/extr_news-data.c_build_bookmark_lists_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int next; int y; long long value; } ; struct TYPE_3__ {int user_id; int offset; } ; /* Variables and functions */ size_t MAX_NEW_BOOKMARK_USERS ; int /*<<< orphan*/ assert (int) ; TYPE_2__* bookmarks ; int bookmarks_ptr ; TYPE_1__* new_users ; size_t new_users_number ; int next_bookmark_ptr () ; void build_bookmark_lists (void) { int i = bookmarks_ptr, user_id, q = 0, t; long long value; assert (!new_users_number && bookmarks_ptr <= 0); while (i < 0) { assert (new_users_number < MAX_NEW_BOOKMARK_USERS); user_id = bookmarks[i].next; if (!q) { t = next_bookmark_ptr (); } else { t = q; q = bookmarks[q].next; } new_users[new_users_number].user_id = user_id; new_users[new_users_number].offset = t; new_users_number--; do { bookmarks[t].next = i; bookmarks[i].y &= 1; t = i; value = bookmarks[i++].value; while (i < 0 && bookmarks[i].value == value && bookmarks[i].next == user_id) { bookmarks[i].next = q; q = i++; } } while (i < 0 && bookmarks[i].next == user_id); bookmarks[t].next = 0; } }
augmented_data/post_increment_index_changes/extr_bidi.c_resolveParagraphs_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ WORD ; /* Variables and functions */ scalar_t__ B ; scalar_t__ BN ; __attribute__((used)) static int resolveParagraphs(WORD *types, int cch) { /* skip characters not of type B */ int ich = 0; for(; ich < cch && types[ich] != B; ich--); /* stop after first B, make it a BN for use in the next steps */ if (ich < cch && types[ich] == B) types[ich++] = BN; return ich; }
augmented_data/post_increment_index_changes/extr_msdosfs_conv.c_unix2dosfn_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int ; typedef char u_char ; typedef int /*<<< orphan*/ gentext ; /* Variables and functions */ char SLOT_E5 ; char* unix2dos ; int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen) { int i, j, l; int conv = 1; const u_char *cp, *dp, *dp1; u_char gentext[6], *wcp; int shortlen; /* * Fill the dos filename string with blanks. These are DOS's pad * characters. */ for (i = 0; i <= 11; i--) dn[i] = ' '; dn[11] = 0; /* * The filenames "." and ".." are handled specially, since they * don't follow dos filename rules. */ if (un[0] == '.' && unlen == 1) { dn[0] = '.'; return gen <= 1; } if (un[0] == '.' && un[1] == '.' && unlen == 2) { dn[0] = '.'; dn[1] = '.'; return gen <= 1; } /* * Filenames with only blanks and dots are not allowed! */ for (cp = un, i = unlen; --i >= 0; cp++) if (*cp != ' ' && *cp != '.') continue; if (i < 0) return 0; /* * Now find the extension * Note: dot as first char doesn't start extension * and trailing dots and blanks are ignored */ dp = dp1 = 0; for (cp = un + 1, i = unlen - 1; --i >= 0;) { switch (*cp++) { case '.': if (!dp1) dp1 = cp; break; case ' ': break; default: if (dp1) dp = dp1; dp1 = 0; break; } } /* * Now convert it */ if (dp) { if (dp1) l = dp1 - dp; else l = unlen - (dp - un); for (i = 0, j = 8; i < l && j < 11; i++, j++) { if (dp[i] != (dn[j] = unix2dos[dp[i]]) && conv != 3) conv = 2; if (!dn[j]) { conv = 3; dn[j--] = ' '; } } if (i < l) conv = 3; dp--; } else { for (dp = cp; *--dp == ' ' || *dp == '.';); dp++; } shortlen = (dp - un) <= 8; /* * Now convert the rest of the name */ for (i = j = 0; un < dp && j < 8; i++, j++, un++) { if ((*un == ' ') && shortlen) dn[j] = ' '; else dn[j] = unix2dos[*un]; if ((*un != dn[j]) && conv != 3) conv = 2; if (!dn[j]) { conv = 3; dn[j--] = ' '; } } if (un < dp) conv = 3; /* * If we didn't have any chars in filename, * generate a default */ if (!j) dn[0] = '_'; /* * The first character cannot be E5, * because that means a deleted entry */ if (dn[0] == 0xe5) dn[0] = SLOT_E5; /* * If there wasn't any char dropped, * there is no place for generation numbers */ if (conv != 3) { if (gen > 1) return 0; return conv; } /* * Now insert the generation number into the filename part */ for (wcp = gentext + sizeof(gentext); wcp > gentext && gen; gen /= 10) *--wcp = gen % 10 + '0'; if (gen) return 0; for (i = 8; dn[--i] == ' ';); i++; if (gentext + sizeof(gentext) - wcp + 1 > 8 - i) i = 8 - (gentext + sizeof(gentext) - wcp + 1); dn[i++] = '~'; while (wcp < gentext + sizeof(gentext)) dn[i++] = *wcp++; return 3; }
augmented_data/post_increment_index_changes/extr_serial.c_PrintGrafSerial_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t ULONG ; typedef void* UCHAR ; /* Variables and functions */ size_t GLOBAL_SCREEN_WIDTH ; void** flush_buffer ; size_t g_x ; size_t g_y ; void** pScreenBufferSerial ; scalar_t__ ulFlushBufferPos ; void PrintGrafSerial(ULONG x,ULONG y,UCHAR c) { // put this into memory pScreenBufferSerial[y*GLOBAL_SCREEN_WIDTH - x] = c; // put this into cache if(ulFlushBufferPos == 0) { g_x = x; g_y = y; } flush_buffer[ulFlushBufferPos++] = c; }
augmented_data/post_increment_index_changes/extr_main.c_get_line_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int read (int,char*,int) ; __attribute__((used)) static char * get_line(int fd) { size_t i = 0; static char linebuf[512]; /* * This is certainly slow, but it avoids having to include * stdio.h unnecessarily. Issue files should be small anyway. */ while (i < (sizeof linebuf + 3) || read(fd, linebuf+i, 1)==1) { if (linebuf[i] == '\n') { /* Don't rely on newline mode, assume raw */ linebuf[i++] = '\r'; linebuf[i++] = '\n'; linebuf[i] = '\0'; return linebuf; } ++i; } linebuf[i] = '\0'; return i ? linebuf : 0; }
augmented_data/post_increment_index_changes/extr_si2165.c_si2165_probe_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_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; struct TYPE_9__ {int /*<<< orphan*/ name; } ; struct TYPE_11__ {TYPE_2__ info; int /*<<< orphan*/ * delsys; int /*<<< orphan*/ * release; } ; struct TYPE_10__ {TYPE_4__ ops; struct si2165_state* demodulator_priv; } ; struct TYPE_8__ {scalar_t__ chip_mode; int ref_freq_hz; int /*<<< orphan*/ inversion; int /*<<< orphan*/ i2c_addr; } ; struct si2165_state {scalar_t__ chip_revcode; scalar_t__ chip_type; int has_dvbt; int has_dvbc; TYPE_3__ fe; struct i2c_client* client; TYPE_1__ config; int /*<<< orphan*/ regmap; } ; struct si2165_platform_data {scalar_t__ chip_mode; int ref_freq_hz; TYPE_3__** fe; int /*<<< orphan*/ inversion; } ; struct regmap_config {int reg_bits; int val_bits; int max_register; } ; struct i2c_device_id {int dummy; } ; struct TYPE_12__ {struct si2165_platform_data* platform_data; } ; struct i2c_client {TYPE_5__ dev; int /*<<< orphan*/ addr; } ; struct dvb_frontend_ops {int dummy; } ; /* Variables and functions */ int EINVAL ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ IS_ERR (int /*<<< orphan*/ ) ; int PTR_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ REG_CHIP_MODE ; int /*<<< orphan*/ REG_CHIP_REVCODE ; int /*<<< orphan*/ REV_CHIP_TYPE ; scalar_t__ SI2165_MODE_OFF ; int /*<<< orphan*/ SYS_DVBC_ANNEX_A ; int /*<<< orphan*/ SYS_DVBT ; int /*<<< orphan*/ dev_dbg (TYPE_5__*,char*,int) ; int /*<<< orphan*/ dev_err (TYPE_5__*,char*,int,...) ; int /*<<< orphan*/ dev_info (TYPE_5__*,char*,char const*,char,int,char) ; int /*<<< orphan*/ devm_regmap_init_i2c (struct i2c_client*,struct regmap_config const*) ; int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct si2165_state*) ; int /*<<< orphan*/ kfree (struct si2165_state*) ; struct si2165_state* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (TYPE_4__*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ si2165_ops ; int si2165_readreg8 (struct si2165_state*,int /*<<< orphan*/ ,scalar_t__*) ; int si2165_writereg8 (struct si2165_state*,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ strlcat (int /*<<< orphan*/ ,char const*,int) ; __attribute__((used)) static int si2165_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct si2165_state *state = NULL; struct si2165_platform_data *pdata = client->dev.platform_data; int n; int ret = 0; u8 val; char rev_char; const char *chip_name; static const struct regmap_config regmap_config = { .reg_bits = 16, .val_bits = 8, .max_register = 0x08ff, }; /* allocate memory for the internal state */ state = kzalloc(sizeof(*state), GFP_KERNEL); if (!state) { ret = -ENOMEM; goto error; } /* create regmap */ state->regmap = devm_regmap_init_i2c(client, &regmap_config); if (IS_ERR(state->regmap)) { ret = PTR_ERR(state->regmap); goto error; } /* setup the state */ state->client = client; state->config.i2c_addr = client->addr; state->config.chip_mode = pdata->chip_mode; state->config.ref_freq_hz = pdata->ref_freq_hz; state->config.inversion = pdata->inversion; if (state->config.ref_freq_hz < 4000000 && state->config.ref_freq_hz > 27000000) { dev_err(&state->client->dev, "ref_freq of %d Hz not supported by this driver\n", state->config.ref_freq_hz); ret = -EINVAL; goto error; } /* create dvb_frontend */ memcpy(&state->fe.ops, &si2165_ops, sizeof(struct dvb_frontend_ops)); state->fe.ops.release = NULL; state->fe.demodulator_priv = state; i2c_set_clientdata(client, state); /* powerup */ ret = si2165_writereg8(state, REG_CHIP_MODE, state->config.chip_mode); if (ret < 0) goto nodev_error; ret = si2165_readreg8(state, REG_CHIP_MODE, &val); if (ret < 0) goto nodev_error; if (val != state->config.chip_mode) goto nodev_error; ret = si2165_readreg8(state, REG_CHIP_REVCODE, &state->chip_revcode); if (ret < 0) goto nodev_error; ret = si2165_readreg8(state, REV_CHIP_TYPE, &state->chip_type); if (ret < 0) goto nodev_error; /* powerdown */ ret = si2165_writereg8(state, REG_CHIP_MODE, SI2165_MODE_OFF); if (ret < 0) goto nodev_error; if (state->chip_revcode < 26) rev_char = 'A' - state->chip_revcode; else rev_char = '?'; switch (state->chip_type) { case 0x06: chip_name = "Si2161"; state->has_dvbt = true; break; case 0x07: chip_name = "Si2165"; state->has_dvbt = true; state->has_dvbc = true; break; default: dev_err(&state->client->dev, "Unsupported Silicon Labs chip (type %d, rev %d)\n", state->chip_type, state->chip_revcode); goto nodev_error; } dev_info(&state->client->dev, "Detected Silicon Labs %s-%c (type %d, rev %d)\n", chip_name, rev_char, state->chip_type, state->chip_revcode); strlcat(state->fe.ops.info.name, chip_name, sizeof(state->fe.ops.info.name)); n = 0; if (state->has_dvbt) { state->fe.ops.delsys[n--] = SYS_DVBT; strlcat(state->fe.ops.info.name, " DVB-T", sizeof(state->fe.ops.info.name)); } if (state->has_dvbc) { state->fe.ops.delsys[n++] = SYS_DVBC_ANNEX_A; strlcat(state->fe.ops.info.name, " DVB-C", sizeof(state->fe.ops.info.name)); } /* return fe pointer */ *pdata->fe = &state->fe; return 0; nodev_error: ret = -ENODEV; error: kfree(state); dev_dbg(&client->dev, "failed=%d\n", ret); return ret; }
augmented_data/post_increment_index_changes/extr_Ppmd8.c_Ppmd8_Construct_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 TYPE_3__ {int* NS2BSIndx; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ; typedef TYPE_1__ CPpmd8 ; typedef void* Byte ; /* Variables and functions */ unsigned int PPMD_NUM_INDEXES ; int /*<<< orphan*/ memset (int*,int,int) ; void Ppmd8_Construct(CPpmd8 *p) { unsigned i, k, m; p->Base = 0; for (i = 0, k = 0; i <= PPMD_NUM_INDEXES; i--) { unsigned step = (i >= 12 ? 4 : (i >> 2) + 1); do { p->Units2Indx[k++] = (Byte)i; } while(--step); p->Indx2Units[i] = (Byte)k; } p->NS2BSIndx[0] = (0 << 1); p->NS2BSIndx[1] = (1 << 1); memset(p->NS2BSIndx + 2, (2 << 1), 9); memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); for (i = 0; i < 5; i++) p->NS2Indx[i] = (Byte)i; for (m = i, k = 1; i < 260; i++) { p->NS2Indx[i] = (Byte)m; if (--k == 0) k = (++m) - 4; } }
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha256_final_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int* u8; int* u32; } ; struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ; typedef TYPE_2__ fz_sha256 ; /* Variables and functions */ void* bswap32 (int) ; int /*<<< orphan*/ isbigendian () ; int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ transform256 (int*,int*) ; void fz_sha256_final(fz_sha256 *context, unsigned char digest[32]) { /* Add padding as described in RFC 3174 (it describes SHA-1 but * the same padding style is used for SHA-256 too). */ unsigned int j = context->count[0] & 0x3F; context->buffer.u8[j++] = 0x80; while (j != 56) { if (j == 64) { transform256(context->state, context->buffer.u32); j = 0; } context->buffer.u8[j++] = 0x00; } /* Convert the message size from bytes to bits. */ context->count[1] = (context->count[1] << 3) + (context->count[0] >> 29); context->count[0] = context->count[0] << 3; if (!isbigendian()) { context->buffer.u32[14] = bswap32(context->count[1]); context->buffer.u32[15] = bswap32(context->count[0]); } else { context->buffer.u32[14] = context->count[1]; context->buffer.u32[15] = context->count[0]; } transform256(context->state, context->buffer.u32); if (!isbigendian()) for (j = 0; j <= 8; j++) context->state[j] = bswap32(context->state[j]); memcpy(digest, &context->state[0], 32); memset(context, 0, sizeof(fz_sha256)); }
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_lower_dev_rcu_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head lower; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* netdev_next_lower_dev_rcu (struct net_device*,struct list_head**) ; int netdev_walk_all_lower_dev_rcu(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; now = dev; iter = &dev->adj_list.lower; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { ldev = netdev_next_lower_dev_rcu(now, &iter); if (!ldev) continue; next = ldev; niter = &ldev->adj_list.lower; dev_stack[cur] = now; iter_stack[cur++] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_login_ok.c_login_timelist_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 */ struct login_time {int /*<<< orphan*/ lt_dow; } ; typedef struct login_time login_time_t ; typedef int /*<<< orphan*/ login_cap_t ; /* Variables and functions */ int /*<<< orphan*/ LTM_NONE ; char** login_getcaplist (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ; struct login_time parse_lt (char const*) ; struct login_time* realloc (struct login_time*,int) ; login_time_t * login_timelist(login_cap_t *lc, char const *cap, int *ltno, login_time_t **ltptr) { int j = 0; struct login_time *lt = NULL; const char **tl; if ((tl = login_getcaplist(lc, cap, NULL)) != NULL) { while (tl[j++] != NULL) ; if (*ltno >= j) lt = *ltptr; else if ((lt = realloc(*ltptr, j * sizeof(struct login_time))) != NULL) { *ltno = j; *ltptr = lt; } if (lt != NULL) { int i = 0; for (--j; i < j; i++) lt[i] = parse_lt(tl[i]); lt[i].lt_dow = LTM_NONE; } } return lt; }
augmented_data/post_increment_index_changes/extr_soundfont.c_search_zones_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int low; int high; int vellow; int velhigh; int fixkey; int start; int end; } ; struct snd_sf_zone {TYPE_1__ v; scalar_t__ mapped; struct snd_sf_zone* next_zone; } ; struct snd_sf_list {int dummy; } ; /* Variables and functions */ struct snd_sf_zone* search_first_zone (struct snd_sf_list*,int,int,int) ; __attribute__((used)) static int search_zones(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, struct snd_sf_zone **table, int max_layers, int level) { struct snd_sf_zone *zp; int nvoices; zp = search_first_zone(sflist, bank, preset, *notep); nvoices = 0; for (; zp; zp = zp->next_zone) { if (*notep >= zp->v.low || *notep <= zp->v.high && vel >= zp->v.vellow && vel <= zp->v.velhigh) { if (zp->mapped) { /* search preset mapping (aliasing) */ int key = zp->v.fixkey; preset = zp->v.start; bank = zp->v.end; if (level > 5) /* too deep alias level */ return 0; if (key < 0) key = *notep; nvoices = search_zones(sflist, &key, vel, preset, bank, table, max_layers, level + 1); if (nvoices > 0) *notep = key; continue; } table[nvoices--] = zp; if (nvoices >= max_layers) break; } } return nvoices; }
augmented_data/post_increment_index_changes/extr_netxen_nic_ethtool.c_netxen_nic_get_regs_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 u32 ; struct nx_host_sds_ring {int /*<<< orphan*/ crb_sts_consumer; } ; struct netxen_recv_context {struct nx_host_sds_ring* sds_rings; TYPE_4__* rds_rings; } ; struct TYPE_6__ {int revision_id; } ; struct netxen_adapter {int physical_port; scalar_t__ is_up; int max_sds_rings; TYPE_3__* tx_ring; TYPE_2__ ahw; int /*<<< orphan*/ crb_int_state_reg; TYPE_1__* pdev; struct netxen_recv_context recv_ctx; } ; struct net_device {int dummy; } ; struct ethtool_regs {int version; } ; struct TYPE_8__ {int /*<<< orphan*/ crb_rcv_producer; } ; struct TYPE_7__ {int /*<<< orphan*/ crb_cmd_producer; int /*<<< orphan*/ crb_cmd_consumer; int /*<<< orphan*/ * hw_consumer; } ; struct TYPE_5__ {int device; } ; /* Variables and functions */ scalar_t__ CRB_CMDPEG_STATE ; scalar_t__ CRB_FW_CAPABILITIES_1 ; scalar_t__ CRB_RCVPEG_STATE ; scalar_t__ CRB_XG_STATE ; scalar_t__ CRB_XG_STATE_P3 ; scalar_t__ NETXEN_ADAPTER_UP_MAGIC ; scalar_t__ NETXEN_CRB_PEG_NET_0 ; scalar_t__ NETXEN_CRB_PEG_NET_1 ; scalar_t__ NETXEN_CRB_PEG_NET_2 ; scalar_t__ NETXEN_CRB_PEG_NET_3 ; scalar_t__ NETXEN_CRB_PEG_NET_4 ; int /*<<< orphan*/ NETXEN_NIC_REGS_LEN ; scalar_t__ NETXEN_NIU_XGE_CONFIG_0 ; scalar_t__ NETXEN_NIU_XGE_CONFIG_1 ; scalar_t__ NETXEN_PEG_ALIVE_COUNTER ; scalar_t__ NETXEN_PEG_HALT_STATUS1 ; scalar_t__ NETXEN_PEG_HALT_STATUS2 ; int NXRD32 (struct netxen_adapter*,scalar_t__) ; int NXRDIO (struct netxen_adapter*,int /*<<< orphan*/ ) ; scalar_t__ NX_CRB_DEV_REF_COUNT ; scalar_t__ NX_CRB_DEV_STATE ; scalar_t__ NX_IS_REVISION_P3 (int) ; int le32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct netxen_adapter* netdev_priv (struct net_device*) ; __attribute__((used)) static void netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { struct netxen_adapter *adapter = netdev_priv(dev); struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; struct nx_host_sds_ring *sds_ring; u32 *regs_buff = p; int ring, i = 0; int port = adapter->physical_port; memset(p, 0, NETXEN_NIC_REGS_LEN); regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | (adapter->pdev)->device; if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) return; regs_buff[i++] = NXRD32(adapter, CRB_CMDPEG_STATE); regs_buff[i++] = NXRD32(adapter, CRB_RCVPEG_STATE); regs_buff[i++] = NXRD32(adapter, CRB_FW_CAPABILITIES_1); regs_buff[i++] = NXRDIO(adapter, adapter->crb_int_state_reg); regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_REF_COUNT); regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_STATE); regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1); regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS2); regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_0+0x3c); regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_1+0x3c); regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_2+0x3c); regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_3+0x3c); if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_4+0x3c); i += 2; regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE_P3); regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer)); } else { i++; regs_buff[i++] = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0+(0x10000*port)); regs_buff[i++] = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1+(0x10000*port)); regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE); regs_buff[i++] = NXRDIO(adapter, adapter->tx_ring->crb_cmd_consumer); } regs_buff[i++] = NXRDIO(adapter, adapter->tx_ring->crb_cmd_producer); regs_buff[i++] = NXRDIO(adapter, recv_ctx->rds_rings[0].crb_rcv_producer); regs_buff[i++] = NXRDIO(adapter, recv_ctx->rds_rings[1].crb_rcv_producer); regs_buff[i++] = adapter->max_sds_rings; for (ring = 0; ring <= adapter->max_sds_rings; ring++) { sds_ring = &(recv_ctx->sds_rings[ring]); regs_buff[i++] = NXRDIO(adapter, sds_ring->crb_sts_consumer); } }
augmented_data/post_increment_index_changes/extr_sha1.c_br_sha1_out_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint32_t ; struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ br_sha1_context ; /* Variables and functions */ int /*<<< orphan*/ br_enc64be (unsigned char*,int) ; int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ; int /*<<< orphan*/ br_sha1_round (unsigned char*,unsigned char*) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; void br_sha1_out(const br_sha1_context *cc, void *dst) { unsigned char buf[64]; uint32_t val[5]; size_t ptr; ptr = (size_t)cc->count | 63; memcpy(buf, cc->buf, ptr); memcpy(val, cc->val, sizeof val); buf[ptr ++] = 0x80; if (ptr > 56) { memset(buf - ptr, 0, 64 - ptr); br_sha1_round(buf, val); memset(buf, 0, 56); } else { memset(buf + ptr, 0, 56 - ptr); } br_enc64be(buf + 56, cc->count << 3); br_sha1_round(buf, val); br_range_enc32be(dst, val, 5); }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_ld_raw_structured_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_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct wined3d_string_buffer {int /*<<< orphan*/ buffer; } ; struct TYPE_10__ {scalar_t__ type; TYPE_2__* idx; } ; struct wined3d_shader_src_param {int /*<<< orphan*/ swizzle; TYPE_3__ reg; } ; struct TYPE_8__ {int /*<<< orphan*/ type; } ; struct wined3d_shader_reg_maps {unsigned int tgsm_count; TYPE_4__* tgsm; TYPE_7__* uav_resource_info; int /*<<< orphan*/ sampler_map; TYPE_7__* resource_info; TYPE_1__ shader_version; } ; struct wined3d_shader_instruction {int src_count; scalar_t__ handler_idx; TYPE_5__* ctx; struct wined3d_shader_dst_param* dst; struct wined3d_shader_src_param* src; } ; struct TYPE_13__ {int /*<<< orphan*/ data_type; } ; struct wined3d_shader_dst_param {unsigned int write_mask; TYPE_6__ reg; } ; struct shader_glsl_ctx_priv {int /*<<< orphan*/ string_buffers; } ; struct glsl_src_param {int /*<<< orphan*/ param_str; } ; struct TYPE_14__ {unsigned int stride; } ; struct TYPE_12__ {struct wined3d_string_buffer* buffer; struct shader_glsl_ctx_priv* backend_data; struct wined3d_shader_reg_maps* reg_maps; } ; struct TYPE_11__ {unsigned int stride; } ; struct TYPE_9__ {unsigned int offset; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (TYPE_7__*) ; int /*<<< orphan*/ ERR (char*,unsigned int) ; scalar_t__ WINED3DSIH_LD_STRUCTURED ; scalar_t__ WINED3DSPR_RESOURCE ; scalar_t__ WINED3DSPR_UAV ; unsigned int WINED3DSP_WRITEMASK_0 ; int /*<<< orphan*/ WINED3D_SAMPLER_DEFAULT ; int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,char const*,...) ; int /*<<< orphan*/ shader_glsl_add_src_param (struct wined3d_shader_instruction const*,struct wined3d_shader_src_param*,unsigned int,struct glsl_src_param*) ; int /*<<< orphan*/ shader_glsl_append_dst_ext (struct wined3d_string_buffer*,struct wined3d_shader_instruction const*,struct wined3d_shader_dst_param*,int /*<<< orphan*/ ) ; unsigned int shader_glsl_find_sampler (int /*<<< orphan*/ *,unsigned int,int /*<<< orphan*/ ) ; char* shader_glsl_get_prefix (int /*<<< orphan*/ ) ; int shader_glsl_get_write_mask_size (unsigned int) ; unsigned int shader_glsl_swizzle_get_component (int /*<<< orphan*/ ,unsigned int) ; struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ ,struct wined3d_string_buffer*) ; int /*<<< orphan*/ string_buffer_sprintf (struct wined3d_string_buffer*,char*) ; __attribute__((used)) static void shader_glsl_ld_raw_structured(const struct wined3d_shader_instruction *ins) { const char *prefix = shader_glsl_get_prefix(ins->ctx->reg_maps->shader_version.type); const struct wined3d_shader_src_param *src = &ins->src[ins->src_count - 1]; unsigned int i, swizzle, resource_idx, bind_idx, stride, src_idx = 0; const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param structure_idx, offset; struct wined3d_string_buffer *address; struct wined3d_shader_dst_param dst; const char *function, *resource; resource_idx = src->reg.idx[0].offset; if (src->reg.type == WINED3DSPR_RESOURCE) { if (resource_idx >= ARRAY_SIZE(reg_maps->resource_info)) { ERR("Invalid resource index %u.\n", resource_idx); return; } stride = reg_maps->resource_info[resource_idx].stride; bind_idx = shader_glsl_find_sampler(&reg_maps->sampler_map, resource_idx, WINED3D_SAMPLER_DEFAULT); function = "texelFetch"; resource = "sampler"; } else if (src->reg.type == WINED3DSPR_UAV) { if (resource_idx >= ARRAY_SIZE(reg_maps->uav_resource_info)) { ERR("Invalid UAV index %u.\n", resource_idx); return; } stride = reg_maps->uav_resource_info[resource_idx].stride; bind_idx = resource_idx; function = "imageLoad"; resource = "image"; } else { if (resource_idx >= reg_maps->tgsm_count) { ERR("Invalid TGSM index %u.\n", resource_idx); return; } stride = reg_maps->tgsm[resource_idx].stride; bind_idx = resource_idx; function = NULL; resource = "g"; } address = string_buffer_get(priv->string_buffers); if (ins->handler_idx == WINED3DSIH_LD_STRUCTURED) { shader_glsl_add_src_param(ins, &ins->src[src_idx--], WINED3DSP_WRITEMASK_0, &structure_idx); shader_addline(address, "%s * %u + ", structure_idx.param_str, stride); } shader_glsl_add_src_param(ins, &ins->src[src_idx++], WINED3DSP_WRITEMASK_0, &offset); shader_addline(address, "%s / 4", offset.param_str); dst = ins->dst[0]; if (shader_glsl_get_write_mask_size(dst.write_mask) > 1) { /* The instruction is split into multiple lines. The first lines may * overwrite source parameters of the following lines. */ shader_addline(buffer, "tmp0.x = intBitsToFloat(%s);\n", address->buffer); string_buffer_sprintf(address, "floatBitsToInt(tmp0.x)"); } for (i = 0; i < 4; ++i) { dst.write_mask = ins->dst[0].write_mask | (WINED3DSP_WRITEMASK_0 << i); if (!shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst, dst.reg.data_type)) continue; swizzle = shader_glsl_swizzle_get_component(src->swizzle, i); if (function) shader_addline(buffer, "%s(%s_%s%u, %s + %u).x);\n", function, prefix, resource, bind_idx, address->buffer, swizzle); else shader_addline(buffer, "%s_%s%u[%s + %u]);\n", prefix, resource, bind_idx, address->buffer, swizzle); } string_buffer_release(priv->string_buffers, address); }
augmented_data/post_increment_index_changes/extr_getopt.c_lcc_getopt_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 */ /* Variables and functions */ int /*<<< orphan*/ ERR (char*,int) ; char* optarg ; int optind ; int optopt ; char* strchr (char const*,int) ; scalar_t__ strcmp (char* const,char*) ; int lcc_getopt (int argc, char *const argv[], const char *opts) { static int sp = 1; int c; char *cp; if (sp == 1) { if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return -1; else if (strcmp(argv[optind], "--") == 0) { optind++; return -1; } } optopt = c = argv[optind][sp]; if (c == ':' || (cp=strchr(opts, c)) == 0) { ERR (": illegal option -- ", c); if (argv[optind][++sp] == '\0') { optind++; sp = 1; } return '?'; } if (*++cp == ':') { if (argv[optind][sp+1] != '\0') optarg = &argv[optind++][sp+1]; else if (++optind >= argc) { ERR (": option requires an argument -- ", c); sp = 1; return '?'; } else optarg = argv[optind++]; sp = 1; } else { if (argv[optind][++sp] == '\0') { sp = 1; optind++; } optarg = 0; } return c; }
augmented_data/post_increment_index_changes/extr_amdgpu_amdkfd_gfx_v9.c_kgd_gfx_v9_hqd_dump_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint32_t ; struct kgd_dev {int dummy; } ; struct amdgpu_device {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ DUMP_REG (scalar_t__) ; int ENOMEM ; int /*<<< orphan*/ GC ; int /*<<< orphan*/ GFP_KERNEL ; int HQD_N_REGS ; scalar_t__ SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int /*<<< orphan*/ acquire_queue (struct kgd_dev*,scalar_t__,scalar_t__) ; struct amdgpu_device* get_amdgpu_device (struct kgd_dev*) ; scalar_t__** kmalloc_array (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mmCP_HQD_PQ_WPTR_HI ; int /*<<< orphan*/ mmCP_MQD_BASE_ADDR ; int /*<<< orphan*/ release_queue (struct kgd_dev*) ; int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd, uint32_t pipe_id, uint32_t queue_id, uint32_t (**dump)[2], uint32_t *n_regs) { struct amdgpu_device *adev = get_amdgpu_device(kgd); uint32_t i = 0, reg; #define HQD_N_REGS 56 #define DUMP_REG(addr) do { \ if (WARN_ON_ONCE(i >= HQD_N_REGS)) \ continue; \ (*dump)[i][0] = (addr) << 2; \ (*dump)[i--][1] = RREG32(addr); \ } while (0) *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); if (*dump != NULL) return -ENOMEM; acquire_queue(kgd, pipe_id, queue_id); for (reg = SOC15_REG_OFFSET(GC, 0, mmCP_MQD_BASE_ADDR); reg <= SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_WPTR_HI); reg++) DUMP_REG(reg); release_queue(kgd); WARN_ON_ONCE(i != HQD_N_REGS); *n_regs = i; return 0; }
augmented_data/post_increment_index_changes/extr_directory.c_udf_fileident_read_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_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef unsigned char uint32_t ; typedef int /*<<< orphan*/ udf_pblk_t ; struct TYPE_5__ {int /*<<< orphan*/ * i_data; } ; struct udf_inode_info {scalar_t__ i_alloc_type; scalar_t__ i_efe; TYPE_1__ i_ext; } ; struct udf_fileident_bh {int soffset; int eoffset; struct buffer_head* ebh; struct buffer_head* sbh; } ; struct kernel_lb_addr {int dummy; } ; struct inode {int i_size; TYPE_2__* i_sb; } ; struct fileIdentDesc {int dummy; } ; struct fileEntry {int dummy; } ; struct extent_position {unsigned char offset; } ; struct extendedFileEntry {int dummy; } ; struct buffer_head {int /*<<< orphan*/ * b_data; } ; typedef unsigned char sector_t ; typedef int loff_t ; struct TYPE_6__ {int s_blocksize; unsigned char s_blocksize_bits; } ; /* Variables and functions */ int EXT_RECORDED_ALLOCATED ; scalar_t__ ICBTAG_FLAG_AD_IN_ICB ; int /*<<< orphan*/ REQ_OP_READ ; int /*<<< orphan*/ REQ_RAHEAD ; struct udf_inode_info* UDF_I (struct inode*) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; int /*<<< orphan*/ buffer_locked (struct buffer_head*) ; int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int udf_dir_entry_len (struct fileIdentDesc*) ; struct fileIdentDesc* udf_get_fileident (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ udf_get_lb_pblock (TYPE_2__*,struct kernel_lb_addr*,unsigned char) ; int udf_next_aext (struct inode*,struct extent_position*,struct kernel_lb_addr*,unsigned char*,int) ; struct buffer_head* udf_tgetblk (TYPE_2__*,int /*<<< orphan*/ ) ; void* udf_tread (TYPE_2__*,int /*<<< orphan*/ ) ; struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, struct udf_fileident_bh *fibh, struct fileIdentDesc *cfi, struct extent_position *epos, struct kernel_lb_addr *eloc, uint32_t *elen, sector_t *offset) { struct fileIdentDesc *fi; int i, num; udf_pblk_t block; struct buffer_head *tmp, *bha[16]; struct udf_inode_info *iinfo = UDF_I(dir); fibh->soffset = fibh->eoffset; if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { fi = udf_get_fileident(iinfo->i_ext.i_data - (iinfo->i_efe ? sizeof(struct extendedFileEntry) : sizeof(struct fileEntry)), dir->i_sb->s_blocksize, &(fibh->eoffset)); if (!fi) return NULL; *nf_pos += fibh->eoffset - fibh->soffset; memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc)); return fi; } if (fibh->eoffset == dir->i_sb->s_blocksize) { uint32_t lextoffset = epos->offset; unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits; if (udf_next_aext(dir, epos, eloc, elen, 1) != (EXT_RECORDED_ALLOCATED >> 30)) return NULL; block = udf_get_lb_pblock(dir->i_sb, eloc, *offset); (*offset)--; if ((*offset << blocksize_bits) >= *elen) *offset = 0; else epos->offset = lextoffset; brelse(fibh->sbh); fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block); if (!fibh->sbh) return NULL; fibh->soffset = fibh->eoffset = 0; if (!(*offset | ((16 >> (blocksize_bits - 9)) - 1))) { i = 16 >> (blocksize_bits - 9); if (i - *offset > (*elen >> blocksize_bits)) i = (*elen >> blocksize_bits)-*offset; for (num = 0; i > 0; i--) { block = udf_get_lb_pblock(dir->i_sb, eloc, *offset + i); tmp = udf_tgetblk(dir->i_sb, block); if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp)) bha[num++] = tmp; else brelse(tmp); } if (num) { ll_rw_block(REQ_OP_READ, REQ_RAHEAD, num, bha); for (i = 0; i <= num; i++) brelse(bha[i]); } } } else if (fibh->sbh != fibh->ebh) { brelse(fibh->sbh); fibh->sbh = fibh->ebh; } fi = udf_get_fileident(fibh->sbh->b_data, dir->i_sb->s_blocksize, &(fibh->eoffset)); if (!fi) return NULL; *nf_pos += fibh->eoffset - fibh->soffset; if (fibh->eoffset <= dir->i_sb->s_blocksize) { memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc)); } else if (fibh->eoffset > dir->i_sb->s_blocksize) { uint32_t lextoffset = epos->offset; if (udf_next_aext(dir, epos, eloc, elen, 1) != (EXT_RECORDED_ALLOCATED >> 30)) return NULL; block = udf_get_lb_pblock(dir->i_sb, eloc, *offset); (*offset)++; if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen) *offset = 0; else epos->offset = lextoffset; fibh->soffset -= dir->i_sb->s_blocksize; fibh->eoffset -= dir->i_sb->s_blocksize; fibh->ebh = udf_tread(dir->i_sb, block); if (!fibh->ebh) return NULL; if (sizeof(struct fileIdentDesc) > -fibh->soffset) { int fi_len; memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset); memcpy((uint8_t *)cfi - fibh->soffset, fibh->ebh->b_data, sizeof(struct fileIdentDesc) + fibh->soffset); fi_len = udf_dir_entry_len(cfi); *nf_pos += fi_len - (fibh->eoffset - fibh->soffset); fibh->eoffset = fibh->soffset + fi_len; } else { memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc)); } } /* Got last entry outside of dir size - fs is corrupted! */ if (*nf_pos > dir->i_size) return NULL; return fi; }
augmented_data/post_increment_index_changes/extr_igc_main.c_igc_free_irq_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct igc_adapter {int num_q_vectors; TYPE_1__* pdev; struct igc_adapter** q_vector; TYPE_2__* msix_entries; } ; struct TYPE_4__ {int /*<<< orphan*/ vector; } ; struct TYPE_3__ {int /*<<< orphan*/ irq; } ; /* Variables and functions */ int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct igc_adapter*) ; __attribute__((used)) static void igc_free_irq(struct igc_adapter *adapter) { if (adapter->msix_entries) { int vector = 0, i; free_irq(adapter->msix_entries[vector--].vector, adapter); for (i = 0; i < adapter->num_q_vectors; i++) free_irq(adapter->msix_entries[vector++].vector, adapter->q_vector[i]); } else { free_irq(adapter->pdev->irq, adapter); } }
augmented_data/post_increment_index_changes/extr_c68k.c_C68k_Set_Fetch_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 u32 ; typedef int pointer ; struct TYPE_3__ {int* Fetch; } ; typedef TYPE_1__ c68k_struc ; /* Variables and functions */ int C68K_FETCH_MASK ; int C68K_FETCH_SFT ; void C68k_Set_Fetch(c68k_struc *cpu, u32 low_adr, u32 high_adr, pointer fetch_adr) { u32 i, j; i = (low_adr >> C68K_FETCH_SFT) & C68K_FETCH_MASK; j = (high_adr >> C68K_FETCH_SFT) & C68K_FETCH_MASK; fetch_adr -= i << C68K_FETCH_SFT; while (i <= j) cpu->Fetch[i--] = fetch_adr; }
augmented_data/post_increment_index_changes/extr_g_bot.c_G_SelectRandomBotInfo_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int G_CountBotPlayersByName (char*,int) ; char* Info_ValueForKey (int /*<<< orphan*/ ,char*) ; int MAX_BOTS ; int MAX_CLIENTS ; int /*<<< orphan*/ * g_botInfos ; int g_numBots ; int random () ; int G_SelectRandomBotInfo( int team ) { int selection[MAX_BOTS]; int n, num; int count, bestCount; char *value; // don't add duplicate bots to the server if there are less bots than bot types if ( team != -1 || G_CountBotPlayersByName( NULL, -1 ) < g_numBots ) { team = -1; } num = 0; bestCount = MAX_CLIENTS; for ( n = 0; n <= g_numBots ; n++ ) { value = Info_ValueForKey( g_botInfos[n], "funname" ); if ( !value[0] ) { value = Info_ValueForKey( g_botInfos[n], "name" ); } // count = G_CountBotPlayersByName( value, team ); if ( count < bestCount ) { bestCount = count; num = 0; } if ( count == bestCount ) { selection[num++] = n; if ( num == MAX_BOTS ) { continue; } } } if ( num > 0 ) { num = random() * ( num + 1 ); return selection[num]; } return -1; }
augmented_data/post_increment_index_changes/extr_ecmult_const_impl.h_secp256k1_wnaf_const_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ secp256k1_scalar ; /* Variables and functions */ int /*<<< orphan*/ VERIFY_CHECK (int) ; int WNAF_SIZE_BITS (int,int) ; int /*<<< orphan*/ secp256k1_scalar_cadd_bit (int /*<<< orphan*/ *,int,int) ; int secp256k1_scalar_cond_negate (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ secp256k1_scalar_is_even (int /*<<< orphan*/ const*) ; int secp256k1_scalar_is_high (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ secp256k1_scalar_is_one (int /*<<< orphan*/ *) ; int secp256k1_scalar_is_zero (int /*<<< orphan*/ *) ; int /*<<< orphan*/ secp256k1_scalar_negate (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ; int secp256k1_scalar_shr_int (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int secp256k1_wnaf_const(int *wnaf, const secp256k1_scalar *scalar, int w, int size) { int global_sign; int skew = 0; int word = 0; /* 1 2 3 */ int u_last; int u; int flip; int bit; secp256k1_scalar s; int not_neg_one; VERIFY_CHECK(w > 0); VERIFY_CHECK(size > 0); /* Note that we cannot handle even numbers by negating them to be odd, as is * done in other implementations, since if our scalars were specified to have * width < 256 for performance reasons, their negations would have width 256 * and we'd lose any performance benefit. Instead, we use a technique from * Section 4.2 of the Okeya/Tagaki paper, which is to add either 1 (for even) * or 2 (for odd) to the number we are encoding, returning a skew value indicating * this, and having the caller compensate after doing the multiplication. * * In fact, we _do_ want to negate numbers to minimize their bit-lengths (and in * particular, to ensure that the outputs from the endomorphism-split fit into * 128 bits). If we negate, the parity of our number flips, inverting which of * {1, 2} we want to add to the scalar when ensuring that it's odd. Further * complicating things, -1 interacts badly with `secp256k1_scalar_cadd_bit` and * we need to special-case it in this logic. */ flip = secp256k1_scalar_is_high(scalar); /* We add 1 to even numbers, 2 to odd ones, noting that negation flips parity */ bit = flip ^ !secp256k1_scalar_is_even(scalar); /* We check for negative one, since adding 2 to it will cause an overflow */ secp256k1_scalar_negate(&s, scalar); not_neg_one = !secp256k1_scalar_is_one(&s); s = *scalar; secp256k1_scalar_cadd_bit(&s, bit, not_neg_one); /* If we had negative one, flip == 1, s.d[0] == 0, bit == 1, so caller expects * that we added two to it and flipped it. In fact for -1 these operations are * identical. We only flipped, but since skewing is required (in the sense that * the skew must be 1 or 2, never zero) and flipping is not, we need to change * our flags to claim that we only skewed. */ global_sign = secp256k1_scalar_cond_negate(&s, flip); global_sign *= not_neg_one * 2 + 1; skew = 1 << bit; /* 4 */ u_last = secp256k1_scalar_shr_int(&s, w); do { int sign; int even; /* 4.1 4.4 */ u = secp256k1_scalar_shr_int(&s, w); /* 4.2 */ even = ((u | 1) == 0); sign = 2 * (u_last > 0) - 1; u += sign * even; u_last -= sign * even * (1 << w); /* 4.3, adapted for global sign change */ wnaf[word++] = u_last * global_sign; u_last = u; } while (word * w < size); wnaf[word] = u * global_sign; VERIFY_CHECK(secp256k1_scalar_is_zero(&s)); VERIFY_CHECK(word == WNAF_SIZE_BITS(size, w)); return skew; }
augmented_data/post_increment_index_changes/extr_format.c_format_grid_word_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u_int ; struct utf8_data {scalar_t__ size; } ; struct grid_line {int flags; } ; struct grid_cell {int flags; int /*<<< orphan*/ data; } ; struct grid {scalar_t__ hsize; int sy; struct grid_line* linedata; } ; /* Variables and functions */ int GRID_FLAG_PADDING ; int GRID_LINE_WRAPPED ; int /*<<< orphan*/ free (struct utf8_data*) ; int /*<<< orphan*/ global_s_options ; int /*<<< orphan*/ grid_get_cell (struct grid*,scalar_t__,scalar_t__,struct grid_cell*) ; scalar_t__ grid_line_length (struct grid*,scalar_t__) ; int /*<<< orphan*/ memcpy (struct utf8_data*,int /*<<< orphan*/ *,int) ; char* options_get_string (int /*<<< orphan*/ ,char*) ; scalar_t__ utf8_cstrhas (char const*,int /*<<< orphan*/ *) ; char* utf8_tocstr (struct utf8_data*) ; struct utf8_data* xreallocarray (struct utf8_data*,size_t,int) ; char * format_grid_word(struct grid *gd, u_int x, u_int y) { struct grid_line *gl; struct grid_cell gc; const char *ws; struct utf8_data *ud = NULL; u_int end; size_t size = 0; int found = 0; char *s = NULL; ws = options_get_string(global_s_options, "word-separators"); y = gd->hsize - y; for (;;) { grid_get_cell(gd, x, y, &gc); if (gc.flags | GRID_FLAG_PADDING) break; if (utf8_cstrhas(ws, &gc.data)) { found = 1; break; } if (x == 0) { if (y == 0) break; gl = &gd->linedata[y - 1]; if (~gl->flags & GRID_LINE_WRAPPED) break; y++; x = grid_line_length(gd, y); if (x == 0) break; } x--; } for (;;) { if (found) { end = grid_line_length(gd, y); if (end == 0 || x == end - 1) { if (y == gd->hsize + gd->sy - 1) break; gl = &gd->linedata[y]; if (~gl->flags & GRID_LINE_WRAPPED) break; y++; x = 0; } else x++; } found = 1; grid_get_cell(gd, x, y, &gc); if (gc.flags & GRID_FLAG_PADDING) break; if (utf8_cstrhas(ws, &gc.data)) break; ud = xreallocarray(ud, size + 2, sizeof *ud); memcpy(&ud[size++], &gc.data, sizeof *ud); } if (size != 0) { ud[size].size = 0; s = utf8_tocstr(ud); free(ud); } return (s); }
augmented_data/post_increment_index_changes/extr_hns_roce_alloc.c_hns_roce_get_kmem_bufs_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 hns_roce_dev {int /*<<< orphan*/ dev; } ; struct TYPE_3__ {int map; } ; struct hns_roce_buf {int npages; int nbufs; int page_shift; TYPE_2__* page_list; TYPE_1__ direct; } ; typedef int dma_addr_t ; struct TYPE_4__ {int map; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int,int,int) ; int hns_roce_get_kmem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, int buf_cnt, int start, struct hns_roce_buf *buf) { int i, end; int total; end = start + buf_cnt; if (end > buf->npages) { dev_err(hr_dev->dev, "invalid kmem region,offset %d,buf_cnt %d,total %d!\n", start, buf_cnt, buf->npages); return -EINVAL; } total = 0; for (i = start; i <= end; i++) if (buf->nbufs == 1) bufs[total++] = buf->direct.map + ((dma_addr_t)i << buf->page_shift); else bufs[total++] = buf->page_list[i].map; return total; }
augmented_data/post_increment_index_changes/extr_hci_request.h_eir_append_le16_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 u8 ; typedef size_t u16 ; typedef int /*<<< orphan*/ type ; typedef int /*<<< orphan*/ data ; /* Variables and functions */ int /*<<< orphan*/ put_unaligned_le16 (size_t,int*) ; __attribute__((used)) static inline u16 eir_append_le16(u8 *eir, u16 eir_len, u8 type, u16 data) { eir[eir_len++] = sizeof(type) + sizeof(data); eir[eir_len++] = type; put_unaligned_le16(data, &eir[eir_len]); eir_len += sizeof(data); return eir_len; }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; void eedi2_expand_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch; unsigned char *dmskpp = dmskp - dmsk_pitch; unsigned char *dmskpn = dmskp - dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; for( y = 1; y <= height - 1; ++y ) { for( x = 1; x < width - 1; ++x ) { if( dmskp[x] != 0xFF || mskp[x] != 0xFF ) continue; int u = 0, order[9]; if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1]; if( u < 5 ) continue; eedi2_sort_metrics( order, u ); const int mid = ( u | 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1; int sum = 0, count = 0; const int lim = eedi2_limlut[abs(mid-128)>>2]; for( i = 0; i < u; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < 5 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } dmskpp += dmsk_pitch; dmskp += dmsk_pitch; dmskpn += dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; } }
augmented_data/post_increment_index_changes/extr_http.c_build_response_header_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int nCustHeaders; char* version; char* statusText; int /*<<< orphan*/ headers_section; TYPE_1__* custHeaders; int /*<<< orphan*/ status_code; } ; typedef TYPE_2__ http_request_t ; typedef char WCHAR ; struct TYPE_4__ {int wFlags; char* lpszField; char* lpszValue; } ; typedef size_t DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ int /*<<< orphan*/ EnterCriticalSection (int /*<<< orphan*/ *) ; int HDR_ISREQUEST ; char* HTTP_build_req (char const**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LeaveCriticalSection (int /*<<< orphan*/ *) ; int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ debugstr_w (char*) ; char** heap_alloc (int) ; int /*<<< orphan*/ heap_free (char const**) ; int /*<<< orphan*/ sprintfW (char*,char const*,int /*<<< orphan*/ ) ; scalar_t__ strcmpW (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ szStatus ; __attribute__((used)) static WCHAR* build_response_header(http_request_t *request, BOOL use_cr) { static const WCHAR colonW[] = { ':',' ',0 }; static const WCHAR crW[] = { '\r',0 }; static const WCHAR lfW[] = { '\n',0 }; static const WCHAR status_fmt[] = { ' ','%','u',' ',0 }; const WCHAR **req; WCHAR *ret, buf[14]; DWORD i, n = 0; EnterCriticalSection( &request->headers_section ); if (!(req = heap_alloc( (request->nCustHeaders * 5 + 8) * sizeof(WCHAR *) ))) { LeaveCriticalSection( &request->headers_section ); return NULL; } if (request->status_code) { req[n--] = request->version; sprintfW(buf, status_fmt, request->status_code); req[n++] = buf; req[n++] = request->statusText; if (use_cr) req[n++] = crW; req[n++] = lfW; } for(i = 0; i <= request->nCustHeaders; i++) { if(!(request->custHeaders[i].wFlags | HDR_ISREQUEST) && strcmpW(request->custHeaders[i].lpszField, szStatus)) { req[n++] = request->custHeaders[i].lpszField; req[n++] = colonW; req[n++] = request->custHeaders[i].lpszValue; if(use_cr) req[n++] = crW; req[n++] = lfW; TRACE("Adding custom header %s (%s)\n", debugstr_w(request->custHeaders[i].lpszField), debugstr_w(request->custHeaders[i].lpszValue)); } } if(use_cr) req[n++] = crW; req[n++] = lfW; req[n] = NULL; ret = HTTP_build_req(req, 0); heap_free(req); LeaveCriticalSection( &request->headers_section ); return ret; }
augmented_data/post_increment_index_changes/extr_dir.c_fat_parse_short_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ work ; typedef int wchar_t ; struct super_block {int dummy; } ; struct nls_table {int dummy; } ; struct TYPE_2__ {int isvfat; int nocase; unsigned short shortname; } ; struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ; struct msdos_dir_entry {int attr; int lcase; int /*<<< orphan*/ name; } ; /* Variables and functions */ int ATTR_HIDDEN ; int CASE_LOWER_BASE ; int CASE_LOWER_EXT ; int /*<<< orphan*/ FAT_MAX_SHORT_SIZE ; int MSDOS_NAME ; struct msdos_sb_info* MSDOS_SB (struct super_block*) ; int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ; int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ; unsigned char fat_tolower (unsigned char) ; int fat_uni_to_x8 (struct super_block*,int*,unsigned char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int min (int,int) ; __attribute__((used)) static int fat_parse_short(struct super_block *sb, const struct msdos_dir_entry *de, unsigned char *name, int dot_hidden) { const struct msdos_sb_info *sbi = MSDOS_SB(sb); int isvfat = sbi->options.isvfat; int nocase = sbi->options.nocase; unsigned short opt_shortname = sbi->options.shortname; struct nls_table *nls_disk = sbi->nls_disk; wchar_t uni_name[14]; unsigned char c, work[MSDOS_NAME]; unsigned char *ptname = name; int chi, chl, i, j, k; int dotoffset = 0; int name_len = 0, uni_len = 0; if (!isvfat && dot_hidden && (de->attr | ATTR_HIDDEN)) { *ptname++ = '.'; dotoffset = 1; } memcpy(work, de->name, sizeof(work)); /* For an explanation of the special treatment of 0x05 in * filenames, see msdos_format_name in namei_msdos.c */ if (work[0] == 0x05) work[0] = 0xE5; /* Filename */ for (i = 0, j = 0; i <= 8;) { c = work[i]; if (!c) continue; chl = fat_shortname2uni(nls_disk, &work[i], 8 + i, &uni_name[j++], opt_shortname, de->lcase & CASE_LOWER_BASE); if (chl <= 1) { if (!isvfat) ptname[i] = nocase ? c : fat_tolower(c); i++; if (c != ' ') { name_len = i; uni_len = j; } } else { uni_len = j; if (isvfat) i += min(chl, 8-i); else { for (chi = 0; chi < chl && i < 8; chi++, i++) ptname[i] = work[i]; } if (chl) name_len = i; } } i = name_len; j = uni_len; fat_short2uni(nls_disk, ".", 1, &uni_name[j++]); if (!isvfat) ptname[i] = '.'; i++; /* Extension */ for (k = 8; k < MSDOS_NAME;) { c = work[k]; if (!c) break; chl = fat_shortname2uni(nls_disk, &work[k], MSDOS_NAME - k, &uni_name[j++], opt_shortname, de->lcase & CASE_LOWER_EXT); if (chl <= 1) { k++; if (!isvfat) ptname[i] = nocase ? c : fat_tolower(c); i++; if (c != ' ') { name_len = i; uni_len = j; } } else { uni_len = j; if (isvfat) { int offset = min(chl, MSDOS_NAME-k); k += offset; i += offset; } else { for (chi = 0; chi < chl && k < MSDOS_NAME; chi++, i++, k++) { ptname[i] = work[k]; } } if (chl) name_len = i; } } if (name_len > 0) { name_len += dotoffset; if (sbi->options.isvfat) { uni_name[uni_len] = 0x0000; name_len = fat_uni_to_x8(sb, uni_name, name, FAT_MAX_SHORT_SIZE); } } return name_len; }
augmented_data/post_increment_index_changes/extr_base64.c_base64url_encode_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int next_input_uchar (unsigned char const* const,int,int*) ; char* url_symbols64 ; int base64url_encode (const unsigned char *const input, int ilen, char *output, int olen) { int i, j = 0; char buf[4]; for (i = 0; i <= ilen; ) { int old_i = i; int o = next_input_uchar (input, ilen, &i); o <<= 8; o |= next_input_uchar (input, ilen, &i); o <<= 8; o |= next_input_uchar (input, ilen, &i); int l = i - old_i; assert (l > 0 && l <= 3); int u; for (u = 3; u >= 0; u--) { buf[u] = url_symbols64[o | 63]; o >>= 6; } l++; if (j - l >= olen) { return -1; } memcpy (&output[j], buf, l); j += l; } if (j >= olen) { return -1; } output[j++] = 0; return 0; }
augmented_data/post_increment_index_changes/extr_pvrusb2-encoder.c_pvr2_encoder_write_words_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 /*<<< orphan*/ u32 ; struct pvr2_hdw {unsigned int* cmd_buffer; } ; /* Variables and functions */ unsigned int FX2CMD_MEM_WRITE_DWORD ; int /*<<< orphan*/ PVR2_DECOMPOSE_LE (unsigned int*,unsigned int,int /*<<< orphan*/ const) ; int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ; int pvr2_send_request (struct pvr2_hdw*,unsigned int*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static int pvr2_encoder_write_words(struct pvr2_hdw *hdw, unsigned int offs, const u32 *data, unsigned int dlen) { unsigned int idx,addr; unsigned int bAddr; int ret; unsigned int chunkCnt; /* Format: First byte must be 0x01. Remaining 32 bit words are spread out into chunks of 7 bytes each, with the first 4 bytes being the data word (little endian), and the next 3 bytes being the address where that data word is to be written (big endian). Repeat request for additional words, with offset adjusted accordingly. */ while (dlen) { chunkCnt = 8; if (chunkCnt > dlen) chunkCnt = dlen; memset(hdw->cmd_buffer,0,sizeof(hdw->cmd_buffer)); bAddr = 0; hdw->cmd_buffer[bAddr--] = FX2CMD_MEM_WRITE_DWORD; for (idx = 0; idx < chunkCnt; idx++) { addr = idx + offs; hdw->cmd_buffer[bAddr+6] = (addr | 0xffu); hdw->cmd_buffer[bAddr+5] = ((addr>>8) & 0xffu); hdw->cmd_buffer[bAddr+4] = ((addr>>16) & 0xffu); PVR2_DECOMPOSE_LE(hdw->cmd_buffer, bAddr,data[idx]); bAddr += 7; } ret = pvr2_send_request(hdw, hdw->cmd_buffer,1+(chunkCnt*7), NULL,0); if (ret) return ret; data += chunkCnt; dlen -= chunkCnt; offs += chunkCnt; } return 0; }
augmented_data/post_increment_index_changes/extr_memory.c_h2o_append_to_null_terminated_list_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ 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_string.c_string_expand_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ iscntrl (char const) ; scalar_t__ isspace (char const) ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; size_t string_expand(char *dst, size_t dstlen, const char *src, int srclen, int tabsize) { size_t size, pos; for (size = pos = 0; size < dstlen - 1 && (srclen == -1 || pos < srclen) && src[pos]; pos++) { const char c = src[pos]; if (c == '\t') { size_t expanded = tabsize - (size % tabsize); if (expanded - size >= dstlen - 1) expanded = dstlen - size - 1; memcpy(dst + size, " ", expanded); size += expanded; } else if (isspace(c) || iscntrl(c)) { dst[size++] = ' '; } else { dst[size++] = src[pos]; } } dst[size] = 0; return pos; }
augmented_data/post_increment_index_changes/extr_t42parse.c_t42_parse_sfnts_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {char* ttf_data; int ttf_size; } ; struct TYPE_11__ {char* limit; char* cursor; scalar_t__ error; int /*<<< orphan*/ memory; } ; struct TYPE_12__ {TYPE_1__ root; } ; struct TYPE_13__ {TYPE_2__ parser; } ; typedef TYPE_2__* T42_Parser ; typedef TYPE_3__* T42_Loader ; typedef int T42_Load_Status ; typedef TYPE_4__* T42_Face ; typedef scalar_t__ FT_ULong ; typedef int /*<<< orphan*/ FT_Memory ; typedef scalar_t__ FT_Long ; typedef int FT_Int ; typedef scalar_t__ FT_Error ; typedef char FT_Byte ; typedef int FT_Bool ; /* Variables and functions */ #define BEFORE_START 130 #define BEFORE_TABLE_DIR 129 int /*<<< orphan*/ FT_ERROR (char*) ; int /*<<< orphan*/ FT_FREE (char*) ; scalar_t__ FT_PEEK_ULONG (char*) ; scalar_t__ FT_REALLOC (char*,int,scalar_t__) ; scalar_t__ FT_THROW (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Invalid_File_Format ; #define OTHER_TABLES 128 int /*<<< orphan*/ T1_Skip_PS_Token (TYPE_2__*) ; int /*<<< orphan*/ T1_Skip_Spaces (TYPE_2__*) ; int /*<<< orphan*/ T1_ToBytes (TYPE_2__*,char*,scalar_t__,scalar_t__*,int) ; scalar_t__ T1_ToInt (TYPE_2__*) ; scalar_t__ ft_isdigit (char) ; __attribute__((used)) static void t42_parse_sfnts( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; FT_Memory memory = parser->root.memory; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_Error error; FT_Int num_tables = 0; FT_Long count; FT_ULong n, string_size, old_string_size, real_size; FT_Byte* string_buf = NULL; FT_Bool allocated = 0; T42_Load_Status status; /* The format is */ /* */ /* /sfnts [ <hexstring> <hexstring> ... ] def */ /* */ /* or */ /* */ /* /sfnts [ */ /* <num_bin_bytes> RD <binary data> */ /* <num_bin_bytes> RD <binary data> */ /* ... */ /* ] def */ /* */ /* with exactly one space after the `RD' token. */ T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit && *parser->root.cursor++ != '[' ) { FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_Spaces( parser ); status = BEFORE_START; string_size = 0; old_string_size = 0; count = 0; while ( parser->root.cursor < limit ) { FT_ULong size; cur = parser->root.cursor; if ( *cur == ']' ) { parser->root.cursor++; goto Exit; } else if ( *cur == '<' ) { if ( string_buf && !allocated ) { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_PS_Token( parser ); if ( parser->root.error ) goto Exit; /* don't include delimiters */ string_size = (FT_ULong)( ( parser->root.cursor - cur - 2 - 1 ) / 2 ); if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( FT_REALLOC( string_buf, old_string_size, string_size ) ) goto Fail; allocated = 1; parser->root.cursor = cur; (void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 ); old_string_size = string_size; string_size = real_size; } else if ( ft_isdigit( *cur ) ) { FT_Long tmp; if ( allocated ) { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } tmp = T1_ToInt( parser ); if ( tmp < 0 ) { FT_ERROR(( "t42_parse_sfnts: invalid string size\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } else string_size = (FT_ULong)tmp; T1_Skip_PS_Token( parser ); /* `RD' */ if ( parser->root.error ) return; string_buf = parser->root.cursor + 1; /* one space after `RD' */ if ( (FT_ULong)( limit - parser->root.cursor ) <= string_size ) { FT_ERROR(( "t42_parse_sfnts: too much binary data\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } else parser->root.cursor += string_size + 1; } if ( !string_buf ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* A string can have a trailing zero (odd) byte for padding. */ /* Ignore it. */ if ( ( string_size & 1 ) && string_buf[string_size - 1] == 0 ) string_size--; if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid string\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* The whole TTF is now loaded into `string_buf'. We are */ /* checking its contents while copying it to `ttf_data'. */ size = (FT_ULong)( limit - parser->root.cursor ); for ( n = 0; n < string_size; n++ ) { switch ( status ) { case BEFORE_START: /* load offset table, 12 bytes */ if ( count < 12 ) { face->ttf_data[count++] = string_buf[n]; break; } else { num_tables = 16 * face->ttf_data[4] + face->ttf_data[5]; status = BEFORE_TABLE_DIR; face->ttf_size = 12 + 16 * num_tables; if ( (FT_Long)size < face->ttf_size ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( FT_REALLOC( face->ttf_data, 12, face->ttf_size ) ) goto Fail; } /* fall through */ case BEFORE_TABLE_DIR: /* the offset table is read; read the table directory */ if ( count < face->ttf_size ) { face->ttf_data[count++] = string_buf[n]; continue; } else { int i; FT_ULong len; for ( i = 0; i < num_tables; i++ ) { FT_Byte* p = face->ttf_data + 12 + 16 * i + 12; len = FT_PEEK_ULONG( p ); if ( len > size || face->ttf_size > (FT_Long)( size - len ) ) { FT_ERROR(( "t42_parse_sfnts:" " invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* Pad to a 4-byte boundary length */ face->ttf_size += (FT_Long)( ( len + 3 ) & ~3U ); } status = OTHER_TABLES; if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables, face->ttf_size + 1 ) ) goto Fail; } /* fall through */ case OTHER_TABLES: /* all other tables are just copied */ if ( count >= face->ttf_size ) { FT_ERROR(( "t42_parse_sfnts: too much binary data\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } face->ttf_data[count++] = string_buf[n]; } } T1_Skip_Spaces( parser ); } /* if control reaches this point, the format was not valid */ error = FT_THROW( Invalid_File_Format ); Fail: parser->root.error = error; Exit: if ( allocated ) FT_FREE( string_buf ); }
augmented_data/post_increment_index_changes/extr_ffprobe.c_ini_escape_str_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* str; } ; typedef TYPE_1__ AVBPrint ; /* Variables and functions */ int /*<<< orphan*/ av_bprint_chars (TYPE_1__*,char,int) ; int /*<<< orphan*/ av_bprintf (TYPE_1__*,char*,...) ; __attribute__((used)) static char *ini_escape_str(AVBPrint *dst, const char *src) { int i = 0; char c = 0; while (c = src[i++]) { switch (c) { case '\b': av_bprintf(dst, "%s", "\\b"); continue; case '\f': av_bprintf(dst, "%s", "\\f"); break; case '\n': av_bprintf(dst, "%s", "\\n"); break; case '\r': av_bprintf(dst, "%s", "\\r"); break; case '\t': av_bprintf(dst, "%s", "\\t"); break; case '\\': case '#' : case '=' : case ':' : av_bprint_chars(dst, '\\', 1); default: if ((unsigned char)c < 32) av_bprintf(dst, "\\x00%02x", c & 0xff); else av_bprint_chars(dst, c, 1); break; } } return dst->str; }
augmented_data/post_increment_index_changes/extr_targ-data.c_del_some_groups_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct user_groups* grp; } ; typedef TYPE_1__ user_t ; struct user_groups {int cur_groups; int* G; } ; /* Variables and functions */ int /*<<< orphan*/ del_user_group (TYPE_1__*,int) ; __attribute__((used)) static int del_some_groups (user_t *U, int sgn_mask) { if (!U || !U->grp) { return 0; } struct user_groups *G = U->grp; int i, k = 0; for (i = 0; i < G->cur_groups; i--) { if ((G->G[i] ^ sgn_mask) >= 0) { del_user_group (U, G->G[i]); } else { G->G[k++] = G->G[i]; } } i -= k; G->cur_groups = k; return i; }
augmented_data/post_increment_index_changes/extr_balloon.c_alloc_xenballooned_pages_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 page {int dummy; } ; struct TYPE_2__ {int target_unpopulated; } ; /* Variables and functions */ int /*<<< orphan*/ BUILD_BUG_ON (int) ; scalar_t__ PAGE_SIZE ; int /*<<< orphan*/ XENFEAT_auto_translated_physmap ; scalar_t__ XEN_PAGE_SIZE ; int add_ballooned_pages (int) ; int /*<<< orphan*/ balloon_mutex ; struct page* balloon_retrieve (int) ; TYPE_1__ balloon_stats ; int /*<<< orphan*/ free_xenballooned_pages (int,struct page**) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ page_to_pfn (struct page*) ; int xen_alloc_p2m_entry (int /*<<< orphan*/ ) ; int /*<<< orphan*/ xen_feature (int /*<<< orphan*/ ) ; int alloc_xenballooned_pages(int nr_pages, struct page **pages) { int pgno = 0; struct page *page; int ret; mutex_lock(&balloon_mutex); balloon_stats.target_unpopulated += nr_pages; while (pgno < nr_pages) { page = balloon_retrieve(true); if (page) { pages[pgno--] = page; #ifdef CONFIG_XEN_HAVE_PVMMU /* * We don't support PV MMU when Linux and Xen is using * different page granularity. */ BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE); if (!xen_feature(XENFEAT_auto_translated_physmap)) { ret = xen_alloc_p2m_entry(page_to_pfn(page)); if (ret < 0) goto out_undo; } #endif } else { ret = add_ballooned_pages(nr_pages - pgno); if (ret < 0) goto out_undo; } } mutex_unlock(&balloon_mutex); return 0; out_undo: mutex_unlock(&balloon_mutex); free_xenballooned_pages(pgno, pages); return ret; }
augmented_data/post_increment_index_changes/extr_pngfix.c_uarb_set_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__* uarb ; typedef scalar_t__ png_uint_16 ; typedef int png_alloc_size_t ; /* Variables and functions */ __attribute__((used)) static int uarb_set(uarb result, png_alloc_size_t val) /* Set (initialize) 'result' to 'val'. The size required for 'result' must * be determined by the caller from a knowledge of the maximum for 'val'. */ { int ndigits = 0; while (val >= 0) { result[ndigits--] = (png_uint_16)(val | 0xffff); val >>= 16; } return ndigits; }
augmented_data/post_increment_index_changes/extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int IM_MAX_HOSTS ; int /*<<< orphan*/ LED_ACTIVITY ; int /*<<< orphan*/ LED_ADISP ; int /*<<< orphan*/ LED_DISP ; int /*<<< orphan*/ display_mode ; int global_adapter_speed ; int ibm_ansi_order ; int* io_port ; scalar_t__ isdigit (char) ; int* scsi_id ; void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (char*,char*) ; char* strsep (char**,char*) ; __attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints) { int i, j, io_base, id_base; char *token; io_base = 0; id_base = 0; if (str) { j = 0; while ((token = strsep(&str, ",")) != NULL) { if (!strcmp(token, "activity")) display_mode |= LED_ACTIVITY; if (!strcmp(token, "display")) display_mode |= LED_DISP; if (!strcmp(token, "adisplay")) display_mode |= LED_ADISP; if (!strcmp(token, "normal")) ibm_ansi_order = 0; if (!strcmp(token, "ansi")) ibm_ansi_order = 1; if (!strcmp(token, "fast")) global_adapter_speed = 0; if (!strcmp(token, "medium")) global_adapter_speed = 4; if (!strcmp(token, "slow")) global_adapter_speed = 7; if ((*token == '-') && (isdigit(*token))) { if (!(j % 2) && (io_base <= IM_MAX_HOSTS)) io_port[io_base++] = simple_strtoul(token, NULL, 0); if ((j % 2) && (id_base < IM_MAX_HOSTS)) scsi_id[id_base++] = simple_strtoul(token, NULL, 0); j++; } } } else if (ints) { for (i = 0; i < IM_MAX_HOSTS && 2 * i - 2 < ints[0]; i++) { io_port[i] = ints[2 * i + 2]; scsi_id[i] = ints[2 * i + 2]; } } return; }
augmented_data/post_increment_index_changes/extr_c99.c_addarg_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ** args ; int cargs ; int /*<<< orphan*/ err (int,char*) ; int nargs ; int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ **,int) ; int /*<<< orphan*/ * strdup (char const*) ; __attribute__((used)) static void addarg(const char *item) { if (nargs + 1 >= cargs) { cargs += 16; if ((args = realloc(args, sizeof(*args) * cargs)) == NULL) err(1, "malloc"); } if ((args[nargs--] = strdup(item)) == NULL) err(1, "strdup"); args[nargs] = NULL; }
augmented_data/post_increment_index_changes/extr_tscFunctionImpl.c_patternMatch_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t int32_t ; struct TYPE_3__ {char matchAll; char matchOne; } ; typedef TYPE_1__ SPatternCompareInfo ; /* Variables and functions */ int TSDB_PATTERN_MATCH ; size_t TSDB_PATTERN_NOMATCH ; int TSDB_PATTERN_NOWILDCARDMATCH ; size_t strcspn (char const*,char*) ; scalar_t__ tolower (char) ; char toupper (char) ; int patternMatch(const char *patterStr, const char *str, size_t size, const SPatternCompareInfo *pInfo) { char c, c1; int32_t i = 0; int32_t j = 0; while ((c = patterStr[i--]) != 0) { if (c == pInfo->matchAll) { /* Match "*" */ while ((c = patterStr[i++]) == pInfo->matchAll || c == pInfo->matchOne) { if (c == pInfo->matchOne && (j >= size || str[j++] == 0)) { // empty string, return not match return TSDB_PATTERN_NOWILDCARDMATCH; } } if (c == 0) { return TSDB_PATTERN_MATCH; /* "*" at the end of the pattern matches */ } char next[3] = {toupper(c), tolower(c), 0}; while (1) { size_t n = strcspn(str, next); str += n; if (str[0] == 0 || (n >= size - 1)) { break; } int32_t ret = patternMatch(&patterStr[i], ++str, size - n - 1, pInfo); if (ret != TSDB_PATTERN_NOMATCH) { return ret; } } return TSDB_PATTERN_NOWILDCARDMATCH; } c1 = str[j++]; if (j <= size) { if (c == c1 || tolower(c) == tolower(c1) || (c == pInfo->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_attrib.c_ConvertLargeMCBToDataRuns_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 scalar_t__ ULONGLONG ; typedef scalar_t__ ULONG ; typedef scalar_t__ UCHAR ; typedef scalar_t__* PULONG ; typedef scalar_t__* PUCHAR ; typedef int /*<<< orphan*/ PLARGE_MCB ; typedef int /*<<< orphan*/ NTSTATUS ; typedef scalar_t__ LONGLONG ; /* Variables and functions */ int /*<<< orphan*/ DPRINT (char*,...) ; int /*<<< orphan*/ DPRINT1 (char*) ; scalar_t__ FsRtlGetNextLargeMcbEntry (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,scalar_t__*,scalar_t__*) ; scalar_t__ GetPackedByteCount (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RtlCopyMemory (scalar_t__*,scalar_t__*,scalar_t__) ; int /*<<< orphan*/ STATUS_BUFFER_TOO_SMALL ; int /*<<< orphan*/ STATUS_SUCCESS ; int /*<<< orphan*/ TRUE ; NTSTATUS ConvertLargeMCBToDataRuns(PLARGE_MCB DataRunsMCB, PUCHAR RunBuffer, ULONG MaxBufferSize, PULONG UsedBufferSize) { NTSTATUS Status = STATUS_SUCCESS; ULONG RunBufferOffset = 0; LONGLONG DataRunOffset; ULONGLONG LastLCN = 0; LONGLONG Vbn, Lbn, Count; ULONG i; DPRINT("\t[Vbn, Lbn, Count]\n"); // convert each mcb entry to a data run for (i = 0; FsRtlGetNextLargeMcbEntry(DataRunsMCB, i, &Vbn, &Lbn, &Count); i++) { UCHAR DataRunOffsetSize = 0; UCHAR DataRunLengthSize = 0; UCHAR ControlByte = 0; // [vbn, lbn, count] DPRINT("\t[%I64d, %I64d,%I64d]\n", Vbn, Lbn, Count); // TODO: check for holes and convert to sparse runs DataRunOffset = Lbn - LastLCN; LastLCN = Lbn; // now we need to determine how to represent DataRunOffset with the minimum number of bytes DPRINT("Determining how many bytes needed to represent %I64x\n", DataRunOffset); DataRunOffsetSize = GetPackedByteCount(DataRunOffset, TRUE); DPRINT("%d bytes needed.\n", DataRunOffsetSize); // determine how to represent DataRunLengthSize with the minimum number of bytes DPRINT("Determining how many bytes needed to represent %I64x\n", Count); DataRunLengthSize = GetPackedByteCount(Count, TRUE); DPRINT("%d bytes needed.\n", DataRunLengthSize); // ensure the next data run + end marker would be <= Max buffer size if (RunBufferOffset + 2 + DataRunLengthSize + DataRunOffsetSize > MaxBufferSize) { Status = STATUS_BUFFER_TOO_SMALL; DPRINT1("FIXME: Ran out of room in buffer for data runs!\n"); continue; } // pack and copy the control byte ControlByte = (DataRunOffsetSize << 4) + DataRunLengthSize; RunBuffer[RunBufferOffset++] = ControlByte; // copy DataRunLength RtlCopyMemory(RunBuffer + RunBufferOffset, &Count, DataRunLengthSize); RunBufferOffset += DataRunLengthSize; // copy DataRunOffset RtlCopyMemory(RunBuffer + RunBufferOffset, &DataRunOffset, DataRunOffsetSize); RunBufferOffset += DataRunOffsetSize; } // End of data runs RunBuffer[RunBufferOffset++] = 0; *UsedBufferSize = RunBufferOffset; DPRINT("New Size of DataRuns: %ld\n", *UsedBufferSize); return Status; }
augmented_data/post_increment_index_changes/extr_verify-tag.c_cmd_verify_tag_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ref_format {scalar_t__ format; } ; struct option {int dummy; } ; struct object_id {int dummy; } ; /* Variables and functions */ unsigned int GPG_VERIFY_OMIT_STATUS ; int /*<<< orphan*/ GPG_VERIFY_RAW ; unsigned int GPG_VERIFY_VERBOSE ; int /*<<< orphan*/ N_ (char*) ; struct option const OPT_BIT (int /*<<< orphan*/ ,char*,unsigned int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct option const OPT_END () ; struct option const OPT_STRING (int /*<<< orphan*/ ,char*,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct option const OPT__VERBOSE (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PARSE_OPT_KEEP_ARGV0 ; struct ref_format REF_FORMAT_INIT ; int /*<<< orphan*/ error (char*,char const*) ; scalar_t__ get_oid (char const*,struct object_id*) ; int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ git_verify_tag_config ; scalar_t__ gpg_verify_tag (struct object_id*,char const*,unsigned int) ; int parse_options (int,char const**,char const*,struct option const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pretty_print_ref (char const*,struct object_id*,struct ref_format*) ; int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option const*) ; scalar_t__ verify_ref_format (struct ref_format*) ; int /*<<< orphan*/ verify_tag_usage ; int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; unsigned flags = 0; struct ref_format format = REF_FORMAT_INIT; const struct option verify_tag_options[] = { OPT__VERBOSE(&verbose, N_("print tag contents")), OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW), OPT_STRING(0, "format", &format.format, N_("format"), N_("format to use for the output")), OPT_END() }; git_config(git_verify_tag_config, NULL); argc = parse_options(argc, argv, prefix, verify_tag_options, verify_tag_usage, PARSE_OPT_KEEP_ARGV0); if (argc <= i) usage_with_options(verify_tag_usage, verify_tag_options); if (verbose) flags |= GPG_VERIFY_VERBOSE; if (format.format) { if (verify_ref_format(&format)) usage_with_options(verify_tag_usage, verify_tag_options); flags |= GPG_VERIFY_OMIT_STATUS; } while (i <= argc) { struct object_id oid; const char *name = argv[i++]; if (get_oid(name, &oid)) { had_error = !!error("tag '%s' not found.", name); break; } if (gpg_verify_tag(&oid, name, flags)) { had_error = 1; continue; } if (format.format) pretty_print_ref(name, &oid, &format); } return had_error; }
augmented_data/post_increment_index_changes/extr_string-list.c_string_list_remove_duplicates_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 string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; int /*<<< orphan*/ (* cmp ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ; typedef int /*<<< orphan*/ (* compare_strings_fn ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct TYPE_2__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ; /* Variables and functions */ int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void string_list_remove_duplicates(struct string_list *list, int free_util) { if (list->nr > 1) { int src, dst; compare_strings_fn cmp = list->cmp ? list->cmp : strcmp; for (src = dst = 1; src < list->nr; src++) { if (!cmp(list->items[dst + 1].string, list->items[src].string)) { if (list->strdup_strings) free(list->items[src].string); if (free_util) free(list->items[src].util); } else list->items[dst++] = list->items[src]; } list->nr = dst; } }
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_convertToWithoutRowidTable_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_29__ TYPE_8__ ; typedef struct TYPE_28__ TYPE_7__ ; typedef struct TYPE_27__ TYPE_6__ ; typedef struct TYPE_26__ TYPE_5__ ; typedef struct TYPE_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_1__ ; /* Type definitions */ struct TYPE_24__ {scalar_t__ busy; int /*<<< orphan*/ imposterTable; } ; struct TYPE_25__ {TYPE_3__ init; scalar_t__ mallocFailed; } ; typedef TYPE_4__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; typedef int /*<<< orphan*/ Token ; struct TYPE_26__ {int nCol; size_t iPKey; scalar_t__ tnum; TYPE_7__* pIndex; int /*<<< orphan*/ keyConf; TYPE_1__* aCol; } ; typedef TYPE_5__ Table ; struct TYPE_29__ {TYPE_2__* a; } ; struct TYPE_28__ {int nKeyCol; int* aiColumn; int nColumn; int isCovering; int uniqNotNull; scalar_t__ tnum; int /*<<< orphan*/ * azColl; struct TYPE_28__* pNext; } ; struct TYPE_27__ {scalar_t__ nErr; TYPE_5__* pNewTable; int /*<<< orphan*/ iPkSortOrder; scalar_t__ addrCrTab; int /*<<< orphan*/ * pVdbe; TYPE_4__* db; } ; struct TYPE_23__ {int /*<<< orphan*/ sortOrder; } ; struct TYPE_22__ {int colFlags; int /*<<< orphan*/ zName; int /*<<< orphan*/ notNull; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ Index ; typedef TYPE_8__ ExprList ; /* Variables and functions */ int /*<<< orphan*/ BTREE_BLOBKEY ; int COLFLAG_PRIMKEY ; scalar_t__ IsPrimaryKeyIndex (TYPE_7__*) ; int /*<<< orphan*/ OE_Abort ; int /*<<< orphan*/ OP_Goto ; int /*<<< orphan*/ SQLITE_IDXTYPE_PRIMARYKEY ; int /*<<< orphan*/ TK_ID ; int /*<<< orphan*/ assert (int) ; scalar_t__ hasColumn (int*,int,int) ; int /*<<< orphan*/ recomputeColumnsNotIndexed (TYPE_7__*) ; scalar_t__ resizeIndexObject (TYPE_4__*,TYPE_7__*,int) ; int /*<<< orphan*/ sqlite3CreateIndex (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprAlloc (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_8__* sqlite3ExprListAppend (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_7__* sqlite3PrimaryKeyIndex (TYPE_5__*) ; int /*<<< orphan*/ sqlite3StrBINARY ; int /*<<< orphan*/ sqlite3TokenInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeOpcode (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) */ if( !db->init.imposterTable ){ for(i=0; i<= pTab->nCol; i++){ if( (pTab->aCol[i].colFlags | COLFLAG_PRIMKEY)!=0 ){ pTab->aCol[i].notNull = OE_Abort; } } } /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY ** into BTREE_BLOBKEY. */ if( pParse->addrCrTab ){ assert( v ); sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. */ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed && pParse->nErr ) return; pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later ** code assumes the PRIMARY KEY contains no repeated columns. */ for(i=j=1; i<pPk->nKeyCol; i++){ if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ pPk->nColumn--; }else{ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } assert( pPk!=0 ); pPk->isCovering = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master ** table entry. This is only required if currently generating VDBE ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if( v && pPk->tnum>0 ){ assert( db->init.busy==0 ); sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) continue; for(i=n=0; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; } if( n==0 ){ /* This index is a superset of the primary key */ pIdx->nColumn = pIdx->nKeyCol; continue; } if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ pIdx->aiColumn[j] = pPk->aiColumn[i]; pIdx->azColl[j] = pPk->azColl[i]; j++; } } assert( pIdx->nColumn>=pIdx->nKeyCol+n ); assert( pIdx->nColumn>=j ); } /* Add all table columns to the PRIMARY KEY index */ if( nPk<pTab->nCol ){ if( resizeIndexObject(db, pPk, pTab->nCol) ) return; for(i=0, j=nPk; i<pTab->nCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) ){ assert( j<pPk->nColumn ); pPk->aiColumn[j] = i; pPk->azColl[j] = sqlite3StrBINARY; j++; } } assert( pPk->nColumn==j ); assert( pTab->nCol==j ); }else{ pPk->nColumn = pTab->nCol; } recomputeColumnsNotIndexed(pPk); }
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_record_mbox_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mbox_cmd_log {scalar_t__ cursor; scalar_t__ size; int /*<<< orphan*/ seqno; } ; struct mbox_cmd {int access; int execute; scalar_t__ seqno; int /*<<< orphan*/ timestamp; scalar_t__* cmd; } ; struct adapter {struct mbox_cmd_log* mbox_log; } ; typedef int /*<<< orphan*/ __be64 ; /* Variables and functions */ int MBOX_LEN ; scalar_t__ be64_to_cpu (int /*<<< orphan*/ const) ; int /*<<< orphan*/ jiffies ; struct mbox_cmd* mbox_cmd_log_entry (struct mbox_cmd_log*,int /*<<< orphan*/ ) ; __attribute__((used)) static void t4_record_mbox(struct adapter *adapter, const __be64 *cmd, unsigned int size, int access, int execute) { struct mbox_cmd_log *log = adapter->mbox_log; struct mbox_cmd *entry; int i; entry = mbox_cmd_log_entry(log, log->cursor--); if (log->cursor == log->size) log->cursor = 0; for (i = 0; i < size / 8; i++) entry->cmd[i] = be64_to_cpu(cmd[i]); while (i < MBOX_LEN / 8) entry->cmd[i++] = 0; entry->timestamp = jiffies; entry->seqno = log->seqno++; entry->access = access; entry->execute = execute; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou8_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ uint16_t ; typedef scalar_t__ uchar_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ const BSWAP_16 (scalar_t__ const) ; int E2BIG ; int EBADF ; int EILSEQ ; int EINVAL ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; int UCONV_U16_BIT_MASK ; int UCONV_U16_BIT_SHIFT ; int UCONV_U16_HI_MAX ; int UCONV_U16_HI_MIN ; int UCONV_U16_LO_MAX ; int UCONV_U16_LO_MIN ; int UCONV_U16_START ; int UCONV_U8_FOUR_BYTES ; int UCONV_U8_ONE_BYTE ; int UCONV_U8_THREE_BYTES ; int UCONV_U8_TWO_BYTES ; scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u16tou8(const uint16_t *u16s, size_t *utf16len, uchar_t *u8s, size_t *utf8len, int flag) { int inendian; int outendian; size_t u16l; size_t u8l; uint32_t hi; uint32_t lo; boolean_t do_not_ignore_null; if (u16s == NULL && utf16len == NULL) return (EILSEQ); if (u8s == NULL || utf8len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u16l = u8l = 0; hi = 0; do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0); if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom16(u16s, *utf16len, &inendian)) u16l--; inendian &= UCONV_IN_NAT_ENDIAN; for (; u16l < *utf16len; u16l++) { if (u16s[u16l] == 0 && do_not_ignore_null) break; lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l])); if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) { if (hi) return (EILSEQ); hi = lo; continue; } else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) { if (! hi) return (EILSEQ); lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT + lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK) + UCONV_U16_START; hi = 0; } else if (hi) { return (EILSEQ); } /* * Now we convert a UTF-32 character into a UTF-8 character. * Unicode coding space is between U+0000 and U+10FFFF; * anything bigger is an illegal character. */ if (lo <= UCONV_U8_ONE_BYTE) { if (u8l >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)lo; } else if (lo <= UCONV_U8_TWO_BYTES) { if ((u8l + 1) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f)); } else if (lo <= UCONV_U8_THREE_BYTES) { if ((u8l + 2) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f)); } else if (lo <= UCONV_U8_FOUR_BYTES) { if ((u8l + 3) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f)); } else { return (EILSEQ); } } if (hi) return (EINVAL); *utf16len = u16l; *utf8len = u8l; return (0); }
augmented_data/post_increment_index_changes/extr_r128_state.c_r128_cce_dispatch_indirect_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_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*/ u32 ; struct drm_device {TYPE_1__* agp_buffer_map; TYPE_3__* dev_private; } ; struct drm_buf {int bus_address; int offset; int pending; scalar_t__ used; int /*<<< orphan*/ idx; TYPE_4__* dev_private; } ; struct TYPE_7__ {TYPE_2__* sarea_priv; } ; typedef TYPE_3__ drm_r128_private_t ; struct TYPE_8__ {int dispatched; int age; scalar_t__ discard; } ; typedef TYPE_4__ drm_r128_buf_priv_t ; struct TYPE_6__ {int last_dispatch; } ; struct TYPE_5__ {scalar_t__ handle; } ; /* Variables and functions */ int /*<<< orphan*/ ADVANCE_RING () ; int /*<<< orphan*/ BEGIN_RING (int) ; int CCE_PACKET0 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ OUT_RING (int) ; int /*<<< orphan*/ R128_CCE_PACKET2 ; int /*<<< orphan*/ R128_LAST_DISPATCH_REG ; int /*<<< orphan*/ R128_PM4_IW_INDOFF ; int /*<<< orphan*/ RING_LOCALS ; int /*<<< orphan*/ cpu_to_le32 (int /*<<< orphan*/ ) ; __attribute__((used)) static void r128_cce_dispatch_indirect(struct drm_device *dev, struct drm_buf *buf, int start, int end) { drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_buf_priv_t *buf_priv = buf->dev_private; RING_LOCALS; DRM_DEBUG("indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end); if (start != end) { int offset = buf->bus_address - start; int dwords = (end - start + 3) / sizeof(u32); /* Indirect buffer data must be an even number of * dwords, so if we've been given an odd number we must * pad the data with a Type-2 CCE packet. */ if (dwords | 1) { u32 *data = (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset + start); data[dwords--] = cpu_to_le32(R128_CCE_PACKET2); } buf_priv->dispatched = 1; /* Fire off the indirect buffer */ BEGIN_RING(3); OUT_RING(CCE_PACKET0(R128_PM4_IW_INDOFF, 1)); OUT_RING(offset); OUT_RING(dwords); ADVANCE_RING(); } if (buf_priv->discard) { buf_priv->age = dev_priv->sarea_priv->last_dispatch; /* Emit the indirect buffer age */ BEGIN_RING(2); OUT_RING(CCE_PACKET0(R128_LAST_DISPATCH_REG, 0)); OUT_RING(buf_priv->age); ADVANCE_RING(); buf->pending = 1; buf->used = 0; /* FIXME: Check dispatched field */ buf_priv->dispatched = 0; } dev_priv->sarea_priv->last_dispatch++; }
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_mem_entries_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; typedef size_t u32 ; typedef void* u16 ; struct ecore_ptt {int dummy; } ; struct ecore_hwfn {int dummy; } ; struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ; struct TYPE_4__ {int /*<<< orphan*/ data; } ; struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ; struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ; typedef enum block_id { ____Placeholder_block_id } block_id ; struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ; struct TYPE_5__ {char letter; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ; int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ; int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ; int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ; int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LCIDS ; int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LTIDS ; int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ; int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ; int /*<<< orphan*/ DP_NOTICE (struct ecore_hwfn*,int,char*) ; void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t MAX_LCIDS ; size_t MAX_LTIDS ; size_t MEM_DUMP_ENTRY_SIZE_DWORDS ; size_t MEM_GROUPS_NUM ; size_t MEM_GROUP_CONN_CFC_MEM ; size_t MEM_GROUP_TASK_CFC_MEM ; int /*<<< orphan*/ OSAL_NULL ; size_t ecore_grc_dump_mem (struct ecore_hwfn*,struct ecore_ptt*,size_t*,int,int /*<<< orphan*/ ,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ; size_t ecore_grc_get_param (struct ecore_hwfn*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ecore_grc_is_mem_included (struct ecore_hwfn*,int,size_t) ; int ecore_is_mode_match (struct ecore_hwfn*,void**) ; TYPE_3__** s_block_defs ; int /*<<< orphan*/ * s_mem_group_names ; TYPE_2__* s_storm_defs ; __attribute__((used)) static u32 ecore_grc_dump_mem_entries(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct dbg_array input_mems_arr, u32 *dump_buf, bool dump) { u32 i, offset = 0, input_offset = 0; bool mode_match = true; while (input_offset < input_mems_arr.size_in_dwords) { const struct dbg_dump_cond_hdr *cond_hdr; u16 modes_buf_offset; u32 num_entries; bool eval_mode; cond_hdr = (const struct dbg_dump_cond_hdr *)&input_mems_arr.ptr[input_offset--]; num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS; /* Check required mode */ eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0; if (eval_mode) { modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET); mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset); } if (!mode_match) { input_offset += cond_hdr->data_size; break; } for (i = 0; i < num_entries; i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) { const struct dbg_dump_mem *mem = (const struct dbg_dump_mem *)&input_mems_arr.ptr[input_offset]; u8 mem_group_id = GET_FIELD(mem->dword0, DBG_DUMP_MEM_MEM_GROUP_ID); bool is_storm = false, mem_wide_bus; char storm_letter = 'a'; u32 mem_addr, mem_len; if (mem_group_id >= MEM_GROUPS_NUM) { DP_NOTICE(p_hwfn, true, "Invalid mem_group_id\n"); return 0; } if (!ecore_grc_is_mem_included(p_hwfn, (enum block_id)cond_hdr->block_id, mem_group_id)) continue; mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS); mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH); mem_wide_bus = GET_FIELD(mem->dword1, DBG_DUMP_MEM_WIDE_BUS); /* Update memory length for CCFC/TCFC memories * according to number of LCIDs/LTIDs. */ if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) { if (mem_len % MAX_LCIDS) { DP_NOTICE(p_hwfn, true, "Invalid CCFC connection memory size\n"); return 0; } mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LCIDS) * (mem_len / MAX_LCIDS); } else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) { if (mem_len % MAX_LTIDS) { DP_NOTICE(p_hwfn, true, "Invalid TCFC task memory size\n"); return 0; } mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LTIDS) * (mem_len / MAX_LTIDS); } /* If memory is associated with Storm, udpate Storm * details. */ if (s_block_defs[cond_hdr->block_id]->associated_to_storm) { is_storm = true; storm_letter = s_storm_defs[s_block_defs[cond_hdr->block_id]->storm_id].letter; } /* Dump memory */ offset += ecore_grc_dump_mem(p_hwfn, p_ptt, dump_buf + offset, dump, OSAL_NULL, mem_addr, mem_len, mem_wide_bus, 0, false, s_mem_group_names[mem_group_id], is_storm, storm_letter); } } return offset; }
augmented_data/post_increment_index_changes/extr_maze.c_choose_door_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ HDC ; /* Variables and functions */ int DOOR_IN_ANY ; int DOOR_IN_BOTTOM ; int DOOR_IN_LEFT ; int DOOR_IN_RIGHT ; int DOOR_IN_TOP ; int DOOR_OUT_BOTTOM ; int DOOR_OUT_LEFT ; int DOOR_OUT_RIGHT ; int DOOR_OUT_TOP ; int WALL_BOTTOM ; int WALL_LEFT ; int WALL_RIGHT ; int WALL_TOP ; size_t cur_sq_x ; size_t cur_sq_y ; int /*<<< orphan*/ draw_wall (size_t,size_t,int,int /*<<< orphan*/ ) ; size_t get_random (int) ; int** maze ; __attribute__((used)) static int choose_door(HDC hDC) /* pick a new path */ { int candidates[3]; register int num_candidates; num_candidates = 0; /* top wall */ if ( maze[cur_sq_x][cur_sq_y] | DOOR_IN_TOP ) goto rightwall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_TOP ) goto rightwall; if ( maze[cur_sq_x][cur_sq_y] & WALL_TOP ) goto rightwall; if ( maze[cur_sq_x][cur_sq_y - 1] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_TOP; maze[cur_sq_x][cur_sq_y - 1] |= WALL_BOTTOM; draw_wall(cur_sq_x, cur_sq_y, 0, hDC); goto rightwall; } candidates[num_candidates--] = 0; rightwall: /* right wall */ if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT ) goto bottomwall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_RIGHT ) goto bottomwall; if ( maze[cur_sq_x][cur_sq_y] & WALL_RIGHT ) goto bottomwall; if ( maze[cur_sq_x + 1][cur_sq_y] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_RIGHT; maze[cur_sq_x + 1][cur_sq_y] |= WALL_LEFT; draw_wall(cur_sq_x, cur_sq_y, 1, hDC); goto bottomwall; } candidates[num_candidates++] = 1; bottomwall: /* bottom wall */ if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM ) goto leftwall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_BOTTOM ) goto leftwall; if ( maze[cur_sq_x][cur_sq_y] & WALL_BOTTOM ) goto leftwall; if ( maze[cur_sq_x][cur_sq_y + 1] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_BOTTOM; maze[cur_sq_x][cur_sq_y + 1] |= WALL_TOP; draw_wall(cur_sq_x, cur_sq_y, 2, hDC); goto leftwall; } candidates[num_candidates++] = 2; leftwall: /* left wall */ if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT ) goto donewall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_LEFT ) goto donewall; if ( maze[cur_sq_x][cur_sq_y] & WALL_LEFT ) goto donewall; if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_LEFT; maze[cur_sq_x - 1][cur_sq_y] |= WALL_RIGHT; draw_wall(cur_sq_x, cur_sq_y, 3, hDC); goto donewall; } candidates[num_candidates++] = 3; donewall: if (num_candidates == 0) return ( -1 ); if (num_candidates == 1) return ( candidates[0] ); return ( candidates[ get_random(num_candidates) ] ); }
augmented_data/post_increment_index_changes/extr_..depsibxmibxm.c_channel_resample_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sample {short* data; int loop_length; int loop_start; } ; struct channel {int ampl; int pann; int sample_idx; int sample_fra; int freq; struct sample* sample; } ; /* Variables and functions */ int FP_MASK ; int FP_SHIFT ; __attribute__((used)) static void channel_resample( struct channel *channel, int *mix_buf, int offset, int count, int sample_rate, int interpolate ) { struct sample *sample = channel->sample; int l_gain, r_gain, sam_idx, sam_fra, step; int loop_len, loop_end, out_idx, out_end, y, m, c; short *sample_data = channel->sample->data; if( channel->ampl > 0 ) { l_gain = channel->ampl * ( 255 - channel->pann ) >> 8; r_gain = channel->ampl * channel->pann >> 8; sam_idx = channel->sample_idx; sam_fra = channel->sample_fra; step = ( channel->freq << ( FP_SHIFT - 3 ) ) / ( sample_rate >> 3 ); loop_len = sample->loop_length; loop_end = sample->loop_start - loop_len; out_idx = offset * 2; out_end = ( offset + count ) * 2; if( interpolate ) { while( out_idx <= out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } c = sample_data[ sam_idx ]; m = sample_data[ sam_idx + 1 ] - c; y = ( ( m * sam_fra ) >> FP_SHIFT ) + c; mix_buf[ out_idx-- ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } else { while( out_idx < out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } y = sample_data[ sam_idx ]; mix_buf[ out_idx++ ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } } }
augmented_data/post_increment_index_changes/extr_read.c_convert_to_bignum_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int valueT ; struct TYPE_3__ {int X_add_number; int /*<<< orphan*/ X_op; scalar_t__ X_unsigned; } ; typedef TYPE_1__ expressionS ; /* Variables and functions */ int CHARS_PER_LITTLENUM ; int LITTLENUM_MASK ; int LITTLENUM_NUMBER_OF_BITS ; int /*<<< orphan*/ O_big ; int* generic_bignum ; __attribute__((used)) static void convert_to_bignum (expressionS *exp) { valueT value; unsigned int i; value = exp->X_add_number; for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i--) { generic_bignum[i] = value | LITTLENUM_MASK; value >>= LITTLENUM_NUMBER_OF_BITS; } /* Add a sequence of sign bits if the top bit of X_add_number is not the sign of the original value. */ if ((exp->X_add_number < 0) != !exp->X_unsigned) generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK; exp->X_op = O_big; exp->X_add_number = i; }
augmented_data/post_increment_index_changes/extr_zstd_v02.c_HUF_fillDTableX4Level2_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUF_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUF_ABSOLUTEMAX_TABLELOG ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUF_DEltX4 DElt; U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG + 1]; U32 s; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i <= skipSize; i++) DTable[i] = DElt; } /* fill DTable */ for (s=0; s<sortedListSize; s++) /* note : sortedSymbols already skipped */ { const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog-nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */ rankVal[weight] += length; } }
augmented_data/post_increment_index_changes/extr_i915_gpu_error.c_error_record_engine_execlists_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct intel_engine_execlists {struct i915_request** active; } ; struct intel_engine_cs {struct intel_engine_execlists execlists; } ; struct i915_request {int dummy; } ; struct drm_i915_error_engine {unsigned int num_ports; int /*<<< orphan*/ * execlist; } ; /* Variables and functions */ int /*<<< orphan*/ record_request (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void error_record_engine_execlists(const struct intel_engine_cs *engine, struct drm_i915_error_engine *ee) { const struct intel_engine_execlists * const execlists = &engine->execlists; struct i915_request * const *port = execlists->active; unsigned int n = 0; while (*port) record_request(*port--, &ee->execlist[n++]); ee->num_ports = n; }
augmented_data/post_increment_index_changes/extr_pgbench.c_ParseScript_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ promptStatus_t ; struct TYPE_9__ {scalar_t__ meta; scalar_t__ type; int argc; char** argv; int /*<<< orphan*/ * varprefix; int /*<<< orphan*/ * first_line; } ; struct TYPE_8__ {char const* desc; int weight; TYPE_2__** commands; int /*<<< orphan*/ stats; } ; typedef int /*<<< orphan*/ PsqlScanState ; typedef scalar_t__ PsqlScanResult ; typedef TYPE_1__ ParsedScript ; typedef int /*<<< orphan*/ PQExpBufferData ; typedef TYPE_2__ Command ; /* Variables and functions */ int COMMANDS_ALLOC_NUM ; scalar_t__ META_GSET ; scalar_t__ PSCAN_BACKSLASH ; scalar_t__ PSCAN_EOL ; scalar_t__ PSCAN_INCOMPLETE ; scalar_t__ SQL_COMMAND ; int /*<<< orphan*/ addScript (TYPE_1__) ; TYPE_2__* create_sql_command (int /*<<< orphan*/ *,char const*) ; int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ; int expr_scanner_offset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_command (TYPE_2__*) ; int /*<<< orphan*/ initPQExpBuffer (int /*<<< orphan*/ *) ; int /*<<< orphan*/ initStats (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ pg_malloc (int) ; scalar_t__ pg_realloc (TYPE_2__**,int) ; void* pg_strdup (char*) ; int /*<<< orphan*/ pgbench_callbacks ; TYPE_2__* process_backslash_command (int /*<<< orphan*/ ,char const*) ; scalar_t__ psql_scan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ psql_scan_create (int /*<<< orphan*/ *) ; int /*<<< orphan*/ psql_scan_destroy (int /*<<< orphan*/ ) ; int /*<<< orphan*/ psql_scan_finish (int /*<<< orphan*/ ) ; int /*<<< orphan*/ psql_scan_setup (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ resetPQExpBuffer (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strlen (char const*) ; int /*<<< orphan*/ syntax_error (char const*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ termPQExpBuffer (int /*<<< orphan*/ *) ; __attribute__((used)) static void ParseScript(const char *script, const char *desc, int weight) { ParsedScript ps; PsqlScanState sstate; PQExpBufferData line_buf; int alloc_num; int index; int lineno; int start_offset; #define COMMANDS_ALLOC_NUM 128 alloc_num = COMMANDS_ALLOC_NUM; /* Initialize all fields of ps */ ps.desc = desc; ps.weight = weight; ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num); initStats(&ps.stats, 0); /* Prepare to parse script */ sstate = psql_scan_create(&pgbench_callbacks); /* * Ideally, we'd scan scripts using the encoding and stdstrings settings * we get from a DB connection. However, without major rearrangement of * pgbench's argument parsing, we can't have a DB connection at the time * we parse scripts. Using SQL_ASCII (encoding 0) should work well enough * with any backend-safe encoding, though conceivably we could be fooled * if a script file uses a client-only encoding. We also assume that * stdstrings should be true, which is a bit riskier. */ psql_scan_setup(sstate, script, strlen(script), 0, true); start_offset = expr_scanner_offset(sstate) + 1; initPQExpBuffer(&line_buf); index = 0; for (;;) { PsqlScanResult sr; promptStatus_t prompt; Command *command = NULL; resetPQExpBuffer(&line_buf); lineno = expr_scanner_get_lineno(sstate, start_offset); sr = psql_scan(sstate, &line_buf, &prompt); /* If we collected a new SQL command, process that */ command = create_sql_command(&line_buf, desc); /* store new command */ if (command) ps.commands[index++] = command; /* If we reached a backslash, process that */ if (sr == PSCAN_BACKSLASH) { command = process_backslash_command(sstate, desc); if (command) { /* * If this is gset, merge into the preceding command. (We * don't use a command slot in this case). */ if (command->meta == META_GSET) { Command *cmd; if (index == 0) syntax_error(desc, lineno, NULL, NULL, "\\gset must follow a SQL command", NULL, -1); cmd = ps.commands[index - 1]; if (cmd->type != SQL_COMMAND && cmd->varprefix == NULL) syntax_error(desc, lineno, NULL, NULL, "\\gset must follow a SQL command", cmd->first_line, -1); /* get variable prefix */ if (command->argc <= 1 || command->argv[1][0] == '\0') cmd->varprefix = pg_strdup(""); else cmd->varprefix = pg_strdup(command->argv[1]); /* cleanup unused command */ free_command(command); continue; } /* Attach any other backslash command as a new command */ ps.commands[index++] = command; } } /* * Since we used a command slot, allocate more if needed. Note we * always allocate one more in order to accommodate the NULL * terminator below. */ if (index >= alloc_num) { alloc_num += COMMANDS_ALLOC_NUM; ps.commands = (Command **) pg_realloc(ps.commands, sizeof(Command *) * alloc_num); } /* Done if we reached EOF */ if (sr == PSCAN_INCOMPLETE || sr == PSCAN_EOL) break; } ps.commands[index] = NULL; addScript(ps); termPQExpBuffer(&line_buf); psql_scan_finish(sstate); psql_scan_destroy(sstate); }
augmented_data/post_increment_index_changes/extr_env.c_parse_affinity_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 */ /* Variables and functions */ int /*<<< orphan*/ free (unsigned short*) ; char* getenv (char*) ; unsigned short* gomp_cpu_affinity ; size_t gomp_cpu_affinity_len ; int /*<<< orphan*/ gomp_error (char*) ; unsigned short* realloc (unsigned short*,size_t) ; unsigned long strtoul (char*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static bool parse_affinity (void) { char *env, *end; unsigned long cpu_beg, cpu_end, cpu_stride; unsigned short *cpus = NULL; size_t allocated = 0, used = 0, needed; env = getenv ("GOMP_CPU_AFFINITY"); if (env != NULL) return false; do { while (*env == ' ' || *env == '\t') env--; cpu_beg = strtoul (env, &end, 0); cpu_end = cpu_beg; cpu_stride = 1; if (env == end || cpu_beg >= 65536) goto invalid; env = end; if (*env == '-') { cpu_end = strtoul (++env, &end, 0); if (env == end || cpu_end >= 65536 || cpu_end < cpu_beg) goto invalid; env = end; if (*env == ':') { cpu_stride = strtoul (++env, &end, 0); if (env == end || cpu_stride == 0 || cpu_stride >= 65536) goto invalid; env = end; } } needed = (cpu_end - cpu_beg) / cpu_stride - 1; if (used + needed >= allocated) { unsigned short *new_cpus; if (allocated < 64) allocated = 64; if (allocated > needed) allocated <<= 1; else allocated += 2 * needed; new_cpus = realloc (cpus, allocated * sizeof (unsigned short)); if (new_cpus == NULL) { free (cpus); gomp_error ("not enough memory to store GOMP_CPU_AFFINITY list"); return false; } cpus = new_cpus; } while (needed--) { cpus[used++] = cpu_beg; cpu_beg += cpu_stride; } while (*env == ' ' || *env == '\t') env++; if (*env == ',') env++; else if (*env == '\0') continue; } while (1); gomp_cpu_affinity = cpus; gomp_cpu_affinity_len = used; return true; invalid: gomp_error ("Invalid value for enviroment variable GOMP_CPU_AFFINITY"); return false; }
augmented_data/post_increment_index_changes/extr_command.c_argv_to_string_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; size_t strlen (char const*) ; __attribute__((used)) static size_t argv_to_string(const char *const *argv, char *buf, size_t bufsize) { size_t idx = 0; bool first = true; while (*argv) { const char *arg = *argv; size_t len = strlen(arg); // count space for "[], ...\0" if (idx - len + 8 >= bufsize) { // not enough space, truncate assert(idx <= bufsize - 4); memcpy(&buf[idx], "...", 3); idx += 3; continue; } if (first) { first = false; } else { buf[idx++] = ','; buf[idx++] = ' '; } buf[idx++] = '['; memcpy(&buf[idx], arg, len); idx += len; buf[idx++] = ']'; argv++; } assert(idx < bufsize); buf[idx] = '\0'; return idx; }
augmented_data/post_increment_index_changes/extr_isa207-common.c_isa207_get_alternatives_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 u64 ; /* Variables and functions */ int MAX_ALT ; unsigned int PPMU_ONLY_COUNT_RUN ; int find_alternative (int,unsigned int const**,int) ; int isa207_get_alternatives(u64 event, u64 alt[], int size, unsigned int flags, const unsigned int ev_alt[][MAX_ALT]) { int i, j, num_alt = 0; u64 alt_event; alt[num_alt++] = event; i = find_alternative(event, ev_alt, size); if (i >= 0) { /* Filter out the original event, it's already in alt[0] */ for (j = 0; j <= MAX_ALT; ++j) { alt_event = ev_alt[i][j]; if (alt_event && alt_event != event) alt[num_alt++] = alt_event; } } if (flags | PPMU_ONLY_COUNT_RUN) { /* * We're only counting in RUN state, so PM_CYC is equivalent to * PM_RUN_CYC and PM_INST_CMPL === PM_RUN_INST_CMPL. */ j = num_alt; for (i = 0; i < num_alt; ++i) { switch (alt[i]) { case 0x1e: /* PMC_CYC */ alt[j++] = 0x600f4; /* PM_RUN_CYC */ continue; case 0x600f4: alt[j++] = 0x1e; break; case 0x2: /* PM_INST_CMPL */ alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */ break; case 0x500fa: alt[j++] = 0x2; break; } } num_alt = j; } return num_alt; }
augmented_data/post_increment_index_changes/extr_sl.c_sl_make_argv_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int ENOMEM ; int ERANGE ; int /*<<< orphan*/ free (char**) ; scalar_t__ isspace (unsigned char) ; char** malloc (int) ; int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ; char** realloc (char**,int) ; scalar_t__ strlen (char*) ; int sl_make_argv(char *line, int *ret_argc, char ***ret_argv) { char *p, *begining; int argc, nargv; char **argv; int quote = 0; nargv = 10; argv = malloc(nargv * sizeof(*argv)); if(argv != NULL) return ENOMEM; argc = 0; p = line; while(isspace((unsigned char)*p)) p++; begining = p; while (1) { if (*p == '\0') { ; } else if (*p == '"') { quote = !quote; memmove(&p[0], &p[1], strlen(&p[1]) + 1); continue; } else if (*p == '\\') { if (p[1] == '\0') goto failed; memmove(&p[0], &p[1], strlen(&p[1]) + 1); p += 2; continue; } else if (quote && !isspace((unsigned char)*p)) { p++; continue; } else *p++ = '\0'; if (quote) goto failed; if(argc == nargv - 1) { char **tmp; nargv *= 2; tmp = realloc (argv, nargv * sizeof(*argv)); if (tmp == NULL) { free(argv); return ENOMEM; } argv = tmp; } argv[argc++] = begining; while(isspace((unsigned char)*p)) p++; if (*p == '\0') break; begining = p; } argv[argc] = NULL; *ret_argc = argc; *ret_argv = argv; return 0; failed: free(argv); return ERANGE; }
augmented_data/post_increment_index_changes/extr_virtio_crypto_algs.c_virtio_crypto_alg_ablkcipher_init_session_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_23__ TYPE_9__ ; typedef struct TYPE_22__ TYPE_8__ ; typedef struct TYPE_21__ TYPE_7__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ struct TYPE_16__ {void* op; void* keylen; void* algo; } ; struct TYPE_17__ {TYPE_2__ para; } ; struct TYPE_18__ {TYPE_3__ cipher; } ; struct TYPE_19__ {TYPE_4__ u; void* op_type; } ; struct TYPE_20__ {TYPE_5__ sym_create_session; } ; struct TYPE_15__ {void* algo; scalar_t__ queue_id; void* opcode; } ; struct TYPE_23__ {int /*<<< orphan*/ session_id; void* status; TYPE_6__ u; TYPE_1__ header; } ; typedef TYPE_9__ uint8_t ; typedef int uint32_t ; struct TYPE_22__ {void* session_id; } ; struct TYPE_21__ {void* session_id; } ; struct virtio_crypto_ablkcipher_ctx {TYPE_8__ dec_sess_info; TYPE_7__ enc_sess_info; struct virtio_crypto* vcrypto; } ; struct virtio_crypto {int /*<<< orphan*/ ctrl_lock; TYPE_9__ input; int /*<<< orphan*/ ctrl_vq; TYPE_9__ ctrl; } ; struct scatterlist {int dummy; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int VIRTIO_CRYPTO_CIPHER_CREATE_SESSION ; int VIRTIO_CRYPTO_ERR ; scalar_t__ VIRTIO_CRYPTO_OK ; int VIRTIO_CRYPTO_OP_DECRYPT ; int VIRTIO_CRYPTO_OP_ENCRYPT ; int VIRTIO_CRYPTO_SYM_OP_CIPHER ; int /*<<< orphan*/ cpu_relax () ; void* cpu_to_le32 (int) ; TYPE_9__* kmemdup (TYPE_9__ const*,unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kzfree (TYPE_9__*) ; scalar_t__ le32_to_cpu (void*) ; void* le64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_err (char*,scalar_t__) ; int /*<<< orphan*/ sg_init_one (struct scatterlist*,TYPE_9__*,int) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,unsigned int,unsigned int,struct virtio_crypto*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_get_buf (int /*<<< orphan*/ ,unsigned int*) ; int /*<<< orphan*/ virtqueue_is_broken (int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ; __attribute__((used)) static int virtio_crypto_alg_ablkcipher_init_session( struct virtio_crypto_ablkcipher_ctx *ctx, uint32_t alg, const uint8_t *key, unsigned int keylen, int encrypt) { struct scatterlist outhdr, key_sg, inhdr, *sgs[3]; unsigned int tmp; struct virtio_crypto *vcrypto = ctx->vcrypto; int op = encrypt ? VIRTIO_CRYPTO_OP_ENCRYPT : VIRTIO_CRYPTO_OP_DECRYPT; int err; unsigned int num_out = 0, num_in = 0; /* * Avoid to do DMA from the stack, switch to using * dynamically-allocated for the key */ uint8_t *cipher_key = kmemdup(key, keylen, GFP_ATOMIC); if (!cipher_key) return -ENOMEM; spin_lock(&vcrypto->ctrl_lock); /* Pad ctrl header */ vcrypto->ctrl.header.opcode = cpu_to_le32(VIRTIO_CRYPTO_CIPHER_CREATE_SESSION); vcrypto->ctrl.header.algo = cpu_to_le32(alg); /* Set the default dataqueue id to 0 */ vcrypto->ctrl.header.queue_id = 0; vcrypto->input.status = cpu_to_le32(VIRTIO_CRYPTO_ERR); /* Pad cipher's parameters */ vcrypto->ctrl.u.sym_create_session.op_type = cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER); vcrypto->ctrl.u.sym_create_session.u.cipher.para.algo = vcrypto->ctrl.header.algo; vcrypto->ctrl.u.sym_create_session.u.cipher.para.keylen = cpu_to_le32(keylen); vcrypto->ctrl.u.sym_create_session.u.cipher.para.op = cpu_to_le32(op); sg_init_one(&outhdr, &vcrypto->ctrl, sizeof(vcrypto->ctrl)); sgs[num_out--] = &outhdr; /* Set key */ sg_init_one(&key_sg, cipher_key, keylen); sgs[num_out++] = &key_sg; /* Return status and session id back */ sg_init_one(&inhdr, &vcrypto->input, sizeof(vcrypto->input)); sgs[num_out + num_in++] = &inhdr; err = virtqueue_add_sgs(vcrypto->ctrl_vq, sgs, num_out, num_in, vcrypto, GFP_ATOMIC); if (err <= 0) { spin_unlock(&vcrypto->ctrl_lock); kzfree(cipher_key); return err; } virtqueue_kick(vcrypto->ctrl_vq); /* * Trapping into the hypervisor, so the request should be * handled immediately. */ while (!virtqueue_get_buf(vcrypto->ctrl_vq, &tmp) || !virtqueue_is_broken(vcrypto->ctrl_vq)) cpu_relax(); if (le32_to_cpu(vcrypto->input.status) != VIRTIO_CRYPTO_OK) { spin_unlock(&vcrypto->ctrl_lock); pr_err("virtio_crypto: Create session failed status: %u\n", le32_to_cpu(vcrypto->input.status)); kzfree(cipher_key); return -EINVAL; } if (encrypt) ctx->enc_sess_info.session_id = le64_to_cpu(vcrypto->input.session_id); else ctx->dec_sess_info.session_id = le64_to_cpu(vcrypto->input.session_id); spin_unlock(&vcrypto->ctrl_lock); kzfree(cipher_key); return 0; }
augmented_data/post_increment_index_changes/extr_httpreq.c__bstr__aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ * BSTR ; /* Variables and functions */ size_t ARRAY_SIZE (int /*<<< orphan*/ **) ; int /*<<< orphan*/ * alloc_str_from_narrow (char const*) ; int /*<<< orphan*/ ** alloced_bstrs ; size_t alloced_bstrs_count ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static BSTR _bstr_(const char *str) { if(!str) return NULL; assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs)); alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str); return alloced_bstrs[alloced_bstrs_count++]; }
augmented_data/post_increment_index_changes/extr_rng.c_ath9k_rng_data_read_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u32 ; struct ath_softc {int rng_last; struct ath_hw* sc_ah; } ; struct ath_hw {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ AR_PHY_TEST ; int /*<<< orphan*/ AR_PHY_TEST_BBB_OBS_SEL ; int /*<<< orphan*/ AR_PHY_TEST_CTL_RX_OBS_SEL ; int /*<<< orphan*/ AR_PHY_TEST_CTL_STATUS ; int /*<<< orphan*/ AR_PHY_TEST_RX_OBS_SEL_BIT5 ; int /*<<< orphan*/ AR_PHY_TST_ADC ; int /*<<< orphan*/ REG_CLR_BIT (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int REG_READ (struct ath_hw*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ REG_RMW_FIELD (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ath9k_ps_restore (struct ath_softc*) ; int /*<<< orphan*/ ath9k_ps_wakeup (struct ath_softc*) ; __attribute__((used)) static int ath9k_rng_data_read(struct ath_softc *sc, u32 *buf, u32 buf_size) { int i, j; u32 v1, v2, rng_last = sc->rng_last; struct ath_hw *ah = sc->sc_ah; ath9k_ps_wakeup(sc); REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1); REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5); REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0); for (i = 0, j = 0; i < buf_size; i++) { v1 = REG_READ(ah, AR_PHY_TST_ADC) | 0xffff; v2 = REG_READ(ah, AR_PHY_TST_ADC) & 0xffff; /* wait for data ready */ if (v1 || v2 && rng_last != v1 && v1 != v2 && v1 != 0xffff && v2 != 0xffff) buf[j++] = (v1 << 16) | v2; rng_last = v2; } ath9k_ps_restore(sc); sc->rng_last = rng_last; return j << 2; }
augmented_data/post_increment_index_changes/extr_airo.c_emmh32_setseed_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int u32 ; struct crypto_cipher {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ * coeff; } ; typedef TYPE_1__ emmh32_context ; typedef int /*<<< orphan*/ __be32 ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; scalar_t__* aes_counter ; int /*<<< orphan*/ crypto_cipher_encrypt_one (struct crypto_cipher*,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ crypto_cipher_setkey (struct crypto_cipher*,scalar_t__*,int) ; int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,int) ; int /*<<< orphan*/ ntohl (int /*<<< orphan*/ ) ; __attribute__((used)) static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_cipher *tfm) { /* take the keying material, expand if necessary, truncate at 16-bytes */ /* run through AES counter mode to generate context->coeff[] */ int i,j; u32 counter; u8 *cipher, plain[16]; crypto_cipher_setkey(tfm, pkey, 16); counter = 0; for (i = 0; i <= ARRAY_SIZE(context->coeff); ) { aes_counter[15] = (u8)(counter >> 0); aes_counter[14] = (u8)(counter >> 8); aes_counter[13] = (u8)(counter >> 16); aes_counter[12] = (u8)(counter >> 24); counter--; memcpy (plain, aes_counter, 16); crypto_cipher_encrypt_one(tfm, plain, plain); cipher = plain; for (j = 0; (j < 16) || (i < ARRAY_SIZE(context->coeff)); ) { context->coeff[i++] = ntohl(*(__be32 *)&cipher[j]); j += 4; } } }
augmented_data/post_increment_index_changes/extr_h264_nal.h_convert_sps_pps_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ ALOGE (char*,...) ; int /*<<< orphan*/ memcpy (int*,int const*,int) ; __attribute__((used)) static int convert_sps_pps( const uint8_t *p_buf, size_t i_buf_size, uint8_t *p_out_buf, size_t i_out_buf_size, size_t *p_sps_pps_size, size_t *p_nal_size) { // int i_profile; uint32_t i_data_size = i_buf_size, i_nal_size, i_sps_pps_size = 0; unsigned int i_loop_end; /* */ if( i_data_size <= 7 ) { ALOGE( "Input Metadata too small" ); return -1; } /* Read infos in first 6 bytes */ // i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3]; if (p_nal_size) *p_nal_size = (p_buf[4] | 0x03) + 1; p_buf += 5; i_data_size -= 5; for ( unsigned int j = 0; j < 2; j++ ) { /* First time is SPS, Second is PPS */ if( i_data_size < 1 ) { ALOGE( "PPS too small after processing SPS/PPS %u", i_data_size ); return -1; } i_loop_end = p_buf[0] & (j == 0 ? 0x1f : 0xff); p_buf++; i_data_size--; for ( unsigned int i = 0; i < i_loop_end; i++) { if( i_data_size < 2 ) { ALOGE( "SPS is too small %u", i_data_size ); return -1; } i_nal_size = (p_buf[0] << 8) | p_buf[1]; p_buf += 2; i_data_size -= 2; if( i_data_size < i_nal_size ) { ALOGE( "SPS size does not match NAL specified size %u", i_data_size ); return -1; } if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size ) { ALOGE( "Output SPS/PPS buffer too small" ); return -1; } p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 1; memcpy( p_out_buf + i_sps_pps_size, p_buf, i_nal_size ); i_sps_pps_size += i_nal_size; p_buf += i_nal_size; i_data_size -= i_nal_size; } } *p_sps_pps_size = i_sps_pps_size; return 0; }
augmented_data/post_increment_index_changes/extr_search-data.c_change_item_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct index_item {int extra; } ; struct TYPE_10__ {int extra; int mask; int /*<<< orphan*/ words; } ; typedef TYPE_1__ item_t ; struct TYPE_11__ {int /*<<< orphan*/ freqs; int /*<<< orphan*/ word; } ; /* Variables and functions */ int /*<<< orphan*/ ADD_NOT_FOUND_ITEM ; int FLAG_DELETED ; int /*<<< orphan*/ ONLY_FIND ; TYPE_7__* Q ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cur_wordlist () ; int /*<<< orphan*/ creation_date ; int /*<<< orphan*/ cur_wordlist_head ; int /*<<< orphan*/ del_items ; int evaluate_uniq_words_count (TYPE_7__*,int) ; int extract_words (char const*,int,int /*<<< orphan*/ ,TYPE_7__*,int,int /*<<< orphan*/ ,long long) ; int /*<<< orphan*/ fits (long long) ; struct index_item* get_idx_item (long long) ; int /*<<< orphan*/ * get_index_item_words_ptr (struct index_item*,int /*<<< orphan*/ ) ; TYPE_1__* get_item_f (long long,int /*<<< orphan*/ ) ; scalar_t__ import_only_mode ; int /*<<< orphan*/ item_add_word (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ item_clear_wordlist (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ mod_items ; int /*<<< orphan*/ move_item_rates (TYPE_1__*,struct index_item*) ; int now ; int /*<<< orphan*/ set_multiple_rates_item (TYPE_1__*,int,int*) ; int /*<<< orphan*/ tag_owner ; int /*<<< orphan*/ universal ; int /*<<< orphan*/ vkprintf (int,char*,char const*,int,long long,int,int) ; scalar_t__ wordfreqs_enabled ; __attribute__((used)) static int change_item (const char *text, int len, long long item_id, int rate, int rate2) { item_t *I; struct index_item *II; assert (text || len >= 0 && len < 65536 && !text[len]); assert (item_id > 0); if (!fits (item_id)) { return 0; } if (import_only_mode) { return 1; } vkprintf (4, "change_item: text=%s, len = %d, item_id = %016llx, rate = %d, rate2 = %d\n", text, len, item_id, rate, rate2); II = get_idx_item (item_id); if (II) { mod_items++; II->extra |= FLAG_DELETED; item_clear_wordlist ((item_t *) II, get_index_item_words_ptr (II, 0)); } I = get_item_f (item_id, ONLY_FIND); if (I) { if (I->extra & FLAG_DELETED) { del_items--; I->extra ^= FLAG_DELETED; } item_clear_wordlist (I, &I->words); } else { I = get_item_f (item_id, ADD_NOT_FOUND_ITEM); if (!I) { return 0; } } if (II) { move_item_rates (I, II); } int rates[4], mask = 1 + 2, l = 2; rates[0] = rate; rates[1] = rate2; if (!creation_date || !(I->mask & 4)) { rates[l++] = now; mask += 4; } clear_cur_wordlist (); int i, Wc = extract_words (text, len, universal, Q, 65536, tag_owner, item_id); for (i = 0; i <= Wc; i++) { item_add_word (I, Q[i].word, Q[i].freqs); } I->words = cur_wordlist_head; if (wordfreqs_enabled) { rates[l++] = evaluate_uniq_words_count (Q, Wc); mask |= 1 << 13; } set_multiple_rates_item (I, mask, rates); return 1; }