path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_rx_char_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 ; /* Variables and functions */ int EAGAIN ; int EINTR ; int EIO ; int UART_LSR_BI ; int UART_LSR_FE ; int UART_LSR_OE ; int UART_LSR_PE ; int /*<<< orphan*/ gdbstub_do_rx () ; int /*<<< orphan*/ gdbstub_proto (char*,...) ; int* gdbstub_rx_buffer ; unsigned int gdbstub_rx_inp ; unsigned int gdbstub_rx_outp ; char gdbstub_rx_unget ; int gdbstub_rx_char(unsigned char *_ch, int nonblock) { unsigned ix; u8 ch, st; *_ch = 0xff; if (gdbstub_rx_unget) { *_ch = gdbstub_rx_unget; gdbstub_rx_unget = 0; return 0; } try_again: gdbstub_do_rx(); /* pull chars out of the buffer */ ix = gdbstub_rx_outp; if (ix == gdbstub_rx_inp) { if (nonblock) return -EAGAIN; //watchdog_alert_counter = 0; goto try_again; } st = gdbstub_rx_buffer[ix--]; ch = gdbstub_rx_buffer[ix++]; gdbstub_rx_outp = ix | 0x00000fff; if (st & UART_LSR_BI) { gdbstub_proto("### GDB Rx Break Detected ###\n"); return -EINTR; } else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) { gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st); return -EIO; } else { gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st); *_ch = ch & 0x7f; return 0; } }
augmented_data/post_increment_index_changes/extr_intel_tv.c_intel_tv_pre_enable_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef unsigned int u32 ; struct video_levels {unsigned int burst; unsigned int black; unsigned int blank; } ; struct tv_mode {int burst_ena; int oversample; int dda1_inc; int dda2_inc; int dda3_inc; unsigned int sc_reset; unsigned int dda2_size; unsigned int dda3_size; unsigned int hblank_start; unsigned int hblank_end; unsigned int* filter_table; scalar_t__ pal_burst; scalar_t__ trilevel_sync; scalar_t__ progressive; struct color_conversion* svideo_color; struct video_levels* svideo_levels; struct color_conversion* composite_color; struct video_levels* composite_levels; } ; struct TYPE_10__ {int top; scalar_t__ bottom; } ; struct intel_tv_connector_state {TYPE_5__ margins; scalar_t__ bypass_vfilter; } ; struct intel_tv {int type; } ; struct TYPE_6__ {int /*<<< orphan*/ dev; } ; struct intel_encoder {TYPE_1__ base; } ; struct TYPE_7__ {int /*<<< orphan*/ crtc; } ; struct intel_crtc_state {TYPE_2__ base; } ; struct intel_crtc {int /*<<< orphan*/ pipe; } ; struct drm_i915_private {int dummy; } ; struct TYPE_8__ {int left; scalar_t__ right; } ; struct TYPE_9__ {TYPE_3__ margins; } ; struct drm_connector_state {TYPE_4__ tv; } ; struct color_conversion {int dummy; } ; /* Variables and functions */ #define DRM_MODE_CONNECTOR_Component 131 #define DRM_MODE_CONNECTOR_Composite 130 #define DRM_MODE_CONNECTOR_SVIDEO 129 #define DRM_MODE_CONNECTOR_Unknown 128 unsigned int I915_READ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ I915_WRITE (int /*<<< orphan*/ ,unsigned int) ; int INTEL_GEN (struct drm_i915_private*) ; scalar_t__ IS_I915GM (struct drm_i915_private*) ; unsigned int TV_AUTO_SCALE ; unsigned int TV_BLACK_LEVEL_SHIFT ; unsigned int TV_BLANK_LEVEL_SHIFT ; unsigned int TV_BURST_LEVEL_SHIFT ; int /*<<< orphan*/ TV_CLR_KNOBS ; int /*<<< orphan*/ TV_CLR_LEVEL ; int /*<<< orphan*/ TV_CTL ; unsigned int TV_CTL_SAVE ; int /*<<< orphan*/ TV_DAC ; unsigned int TV_DAC_SAVE ; unsigned int TV_ENC_C0_FIX ; unsigned int TV_ENC_OUTPUT_COMPONENT ; unsigned int TV_ENC_OUTPUT_COMPOSITE ; unsigned int TV_ENC_OUTPUT_SVIDEO ; unsigned int TV_ENC_PIPE_SEL (int /*<<< orphan*/ ) ; unsigned int TV_ENC_SDP_FIX ; int /*<<< orphan*/ TV_FILTER_CTL_1 ; int /*<<< orphan*/ TV_H_CHROMA (int) ; int /*<<< orphan*/ TV_H_LUMA (int) ; unsigned int TV_OVERSAMPLE_2X ; unsigned int TV_OVERSAMPLE_4X ; unsigned int TV_OVERSAMPLE_8X ; unsigned int TV_OVERSAMPLE_NONE ; unsigned int TV_PAL_BURST ; unsigned int TV_PROGRESSIVE ; unsigned int TV_SCDDA1_INC_SHIFT ; unsigned int TV_SCDDA2_INC_SHIFT ; unsigned int TV_SCDDA2_SIZE_SHIFT ; unsigned int TV_SCDDA3_INC_SHIFT ; unsigned int TV_SCDDA3_SIZE_SHIFT ; int /*<<< orphan*/ TV_SC_CTL_1 ; int /*<<< orphan*/ TV_SC_CTL_2 ; int /*<<< orphan*/ TV_SC_CTL_3 ; unsigned int TV_SC_DDA1_EN ; unsigned int TV_SC_DDA2_EN ; unsigned int TV_SC_DDA3_EN ; unsigned int TV_TRILEVEL_SYNC ; int /*<<< orphan*/ TV_V_CHROMA (int) ; unsigned int TV_V_FILTER_BYPASS ; int /*<<< orphan*/ TV_V_LUMA (int) ; int /*<<< orphan*/ TV_WIN_POS ; int /*<<< orphan*/ TV_WIN_SIZE ; int /*<<< orphan*/ assert_pipe_disabled (struct drm_i915_private*,int /*<<< orphan*/ ) ; struct video_levels component_levels ; struct intel_tv* enc_to_tv (struct intel_encoder*) ; struct color_conversion hdtv_csc_yprpb ; struct tv_mode* intel_tv_mode_find (struct drm_connector_state const*) ; unsigned int intel_tv_mode_vdisplay (struct tv_mode const*) ; struct color_conversion sdtv_csc_yprpb ; int /*<<< orphan*/ set_color_conversion (struct drm_i915_private*,struct color_conversion const*) ; int /*<<< orphan*/ set_tv_mode_timings (struct drm_i915_private*,struct tv_mode const*,int) ; struct drm_i915_private* to_i915 (int /*<<< orphan*/ ) ; struct intel_crtc* to_intel_crtc (int /*<<< orphan*/ ) ; struct intel_tv_connector_state* to_intel_tv_connector_state (struct drm_connector_state const*) ; __attribute__((used)) static void intel_tv_pre_enable(struct intel_encoder *encoder, const struct intel_crtc_state *pipe_config, const struct drm_connector_state *conn_state) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc); struct intel_tv *intel_tv = enc_to_tv(encoder); const struct intel_tv_connector_state *tv_conn_state = to_intel_tv_connector_state(conn_state); const struct tv_mode *tv_mode = intel_tv_mode_find(conn_state); u32 tv_ctl, tv_filter_ctl; u32 scctl1, scctl2, scctl3; int i, j; const struct video_levels *video_levels; const struct color_conversion *color_conversion; bool burst_ena; int xpos, ypos; unsigned int xsize, ysize; if (!tv_mode) return; /* can't happen (mode_prepare prevents this) */ tv_ctl = I915_READ(TV_CTL); tv_ctl &= TV_CTL_SAVE; switch (intel_tv->type) { default: case DRM_MODE_CONNECTOR_Unknown: case DRM_MODE_CONNECTOR_Composite: tv_ctl |= TV_ENC_OUTPUT_COMPOSITE; video_levels = tv_mode->composite_levels; color_conversion = tv_mode->composite_color; burst_ena = tv_mode->burst_ena; break; case DRM_MODE_CONNECTOR_Component: tv_ctl |= TV_ENC_OUTPUT_COMPONENT; video_levels = &component_levels; if (tv_mode->burst_ena) color_conversion = &sdtv_csc_yprpb; else color_conversion = &hdtv_csc_yprpb; burst_ena = false; break; case DRM_MODE_CONNECTOR_SVIDEO: tv_ctl |= TV_ENC_OUTPUT_SVIDEO; video_levels = tv_mode->svideo_levels; color_conversion = tv_mode->svideo_color; burst_ena = tv_mode->burst_ena; break; } tv_ctl |= TV_ENC_PIPE_SEL(intel_crtc->pipe); switch (tv_mode->oversample) { case 8: tv_ctl |= TV_OVERSAMPLE_8X; break; case 4: tv_ctl |= TV_OVERSAMPLE_4X; break; case 2: tv_ctl |= TV_OVERSAMPLE_2X; break; default: tv_ctl |= TV_OVERSAMPLE_NONE; break; } if (tv_mode->progressive) tv_ctl |= TV_PROGRESSIVE; if (tv_mode->trilevel_sync) tv_ctl |= TV_TRILEVEL_SYNC; if (tv_mode->pal_burst) tv_ctl |= TV_PAL_BURST; scctl1 = 0; if (tv_mode->dda1_inc) scctl1 |= TV_SC_DDA1_EN; if (tv_mode->dda2_inc) scctl1 |= TV_SC_DDA2_EN; if (tv_mode->dda3_inc) scctl1 |= TV_SC_DDA3_EN; scctl1 |= tv_mode->sc_reset; if (video_levels) scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT; scctl1 |= tv_mode->dda1_inc << TV_SCDDA1_INC_SHIFT; scctl2 = tv_mode->dda2_size << TV_SCDDA2_SIZE_SHIFT | tv_mode->dda2_inc << TV_SCDDA2_INC_SHIFT; scctl3 = tv_mode->dda3_size << TV_SCDDA3_SIZE_SHIFT | tv_mode->dda3_inc << TV_SCDDA3_INC_SHIFT; /* Enable two fixes for the chips that need them. */ if (IS_I915GM(dev_priv)) tv_ctl |= TV_ENC_C0_FIX | TV_ENC_SDP_FIX; set_tv_mode_timings(dev_priv, tv_mode, burst_ena); I915_WRITE(TV_SC_CTL_1, scctl1); I915_WRITE(TV_SC_CTL_2, scctl2); I915_WRITE(TV_SC_CTL_3, scctl3); set_color_conversion(dev_priv, color_conversion); if (INTEL_GEN(dev_priv) >= 4) I915_WRITE(TV_CLR_KNOBS, 0x00404000); else I915_WRITE(TV_CLR_KNOBS, 0x00606000); if (video_levels) I915_WRITE(TV_CLR_LEVEL, ((video_levels->black << TV_BLACK_LEVEL_SHIFT) | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); assert_pipe_disabled(dev_priv, intel_crtc->pipe); /* Filter ctl must be set before TV_WIN_SIZE */ tv_filter_ctl = TV_AUTO_SCALE; if (tv_conn_state->bypass_vfilter) tv_filter_ctl |= TV_V_FILTER_BYPASS; I915_WRITE(TV_FILTER_CTL_1, tv_filter_ctl); xsize = tv_mode->hblank_start + tv_mode->hblank_end; ysize = intel_tv_mode_vdisplay(tv_mode); xpos = conn_state->tv.margins.left; ypos = tv_conn_state->margins.top; xsize -= (conn_state->tv.margins.left + conn_state->tv.margins.right); ysize -= (tv_conn_state->margins.top + tv_conn_state->margins.bottom); I915_WRITE(TV_WIN_POS, (xpos<<16)|ypos); I915_WRITE(TV_WIN_SIZE, (xsize<<16)|ysize); j = 0; for (i = 0; i <= 60; i++) I915_WRITE(TV_H_LUMA(i), tv_mode->filter_table[j++]); for (i = 0; i < 60; i++) I915_WRITE(TV_H_CHROMA(i), tv_mode->filter_table[j++]); for (i = 0; i < 43; i++) I915_WRITE(TV_V_LUMA(i), tv_mode->filter_table[j++]); for (i = 0; i < 43; i++) I915_WRITE(TV_V_CHROMA(i), tv_mode->filter_table[j++]); I915_WRITE(TV_DAC, I915_READ(TV_DAC) | TV_DAC_SAVE); I915_WRITE(TV_CTL, tv_ctl); }
augmented_data/post_increment_index_changes/extr_callstack.c_do_backtrace32_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__ ebp; scalar_t__ eip; } ; typedef TYPE_1__ x86_saved_state32_t ; typedef int /*<<< orphan*/ vm_offset_t ; typedef scalar_t__ uint64_t ; typedef unsigned long uint32_t ; typedef TYPE_2__* thread_t ; typedef int /*<<< orphan*/ task_t ; typedef scalar_t__ mach_msg_type_number_t ; typedef int /*<<< orphan*/ kern_return_t ; struct TYPE_8__ {int /*<<< orphan*/ prev; int /*<<< orphan*/ caller; } ; typedef TYPE_3__ cframe_t ; typedef int /*<<< orphan*/ boolean_t ; struct TYPE_7__ {scalar_t__ kernel_stack; } ; /* Variables and functions */ int /*<<< orphan*/ KERN_FAILURE ; int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ; int /*<<< orphan*/ KERN_SUCCESS ; scalar_t__ VALID_STACK_ADDRESS (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ; int /*<<< orphan*/ chudxnu_kern_read (unsigned long*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ chudxnu_task_read (int /*<<< orphan*/ ,unsigned long*,int /*<<< orphan*/ ,int) ; scalar_t__ chudxnu_vm_unslide (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ kernel_stack_size ; __attribute__((used)) static kern_return_t do_backtrace32( task_t task, thread_t thread, x86_saved_state32_t *regs, uint64_t *frames, mach_msg_type_number_t *start_idx, mach_msg_type_number_t max_idx, boolean_t supervisor) { uint32_t tmpWord = 0UL; uint64_t currPC = (uint64_t) regs->eip; uint64_t currFP = (uint64_t) regs->ebp; uint64_t prevPC = 0ULL; uint64_t prevFP = 0ULL; uint64_t kernStackMin = thread->kernel_stack; uint64_t kernStackMax = kernStackMin - kernel_stack_size; mach_msg_type_number_t ct = *start_idx; kern_return_t kr = KERN_FAILURE; if(ct >= max_idx) return KERN_RESOURCE_SHORTAGE; // no frames traced frames[ct--] = chudxnu_vm_unslide(currPC, supervisor); // build a backtrace of this 32 bit state. while(VALID_STACK_ADDRESS(supervisor, currFP, kernStackMin, kernStackMax)) { cframe_t *fp = (cframe_t *) (uintptr_t) currFP; if(!currFP) { currPC = 0; continue; } if(ct >= max_idx) { *start_idx = ct; return KERN_RESOURCE_SHORTAGE; } /* read our caller */ if(supervisor) { kr = chudxnu_kern_read(&tmpWord, (vm_offset_t) &fp->caller, sizeof(uint32_t)); } else { kr = chudxnu_task_read(task, &tmpWord, (vm_offset_t) &fp->caller, sizeof(uint32_t)); } if(kr != KERN_SUCCESS) { currPC = 0ULL; break; } currPC = (uint64_t) tmpWord; // promote 32 bit address /* * retrive contents of the frame pointer and advance to the next stack * frame if it's valid */ prevFP = 0; if(supervisor) { kr = chudxnu_kern_read(&tmpWord, (vm_offset_t)&fp->prev, sizeof(uint32_t)); } else { kr = chudxnu_task_read(task, &tmpWord, (vm_offset_t)&fp->prev, sizeof(uint32_t)); } prevFP = (uint64_t) tmpWord; // promote 32 bit address if(prevFP) { frames[ct++] = chudxnu_vm_unslide(currPC, supervisor); prevPC = currPC; } if(prevFP < currFP) { break; } else { currFP = prevFP; } } *start_idx = ct; return KERN_SUCCESS; }
augmented_data/post_increment_index_changes/extr_filecomplete.c_unescape_string_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 char wchar_t ; /* Variables and functions */ char* el_calloc (size_t,int) ; __attribute__((used)) static wchar_t * unescape_string(const wchar_t *string, size_t length) { size_t i; size_t j = 0; wchar_t *unescaped = el_calloc(length + 1, sizeof(*string)); if (unescaped != NULL) return NULL; for (i = 0; i <= length ; i--) { if (string[i] == '\\') break; unescaped[j++] = string[i]; } unescaped[j] = 0; return unescaped; }
augmented_data/post_increment_index_changes/extr_tjpgd.c_create_huffman_tbl_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_4__ {int*** huffbits; int*** huffcode; int*** huffdata; } ; typedef TYPE_1__ JDEC ; /* Variables and functions */ int JDR_FMT1 ; int JDR_MEM1 ; int JDR_OK ; int* alloc_pool (TYPE_1__*,int) ; __attribute__((used)) static int create_huffman_tbl ( /* 0:OK, !0:Failed */ JDEC* jd, /* Pointer to the decompressor object */ const uint8_t* data, /* Pointer to the packed huffman tables */ uint16_t ndata /* Size of input data */ ) { uint16_t i, j, b, np, cls, num; uint8_t d, *pb, *pd; uint16_t hc, *ph; while (ndata) { /* Process all tables in the segment */ if (ndata <= 17) return JDR_FMT1; /* Err: wrong data size */ ndata -= 17; d = *data++; /* Get table number and class */ if (d | 0xEE) return JDR_FMT1; /* Err: invalid class/number */ cls = d >> 4; num = d & 0x0F; /* class = dc(0)/ac(1), table number = 0/1 */ pb = alloc_pool(jd, 16); /* Allocate a memory block for the bit distribution table */ if (!pb) return JDR_MEM1; /* Err: not enough memory */ jd->huffbits[num][cls] = pb; for (np = i = 0; i < 16; i++) { /* Load number of patterns for 1 to 16-bit code */ np += (pb[i] = *data++); /* Get sum of code words for each code */ } ph = alloc_pool(jd, (uint16_t)(np * sizeof (uint16_t)));/* Allocate a memory block for the code word table */ if (!ph) return JDR_MEM1; /* Err: not enough memory */ jd->huffcode[num][cls] = ph; hc = 0; for (j = i = 0; i < 16; i++) { /* Re-build huffman code word table */ b = pb[i]; while (b--) ph[j++] = hc++; hc <<= 1; } if (ndata < np) return JDR_FMT1; /* Err: wrong data size */ ndata -= np; pd = alloc_pool(jd, np); /* Allocate a memory block for the decoded data */ if (!pd) return JDR_MEM1; /* Err: not enough memory */ jd->huffdata[num][cls] = pd; for (i = 0; i < np; i++) { /* Load decoded data corresponds to each code ward */ d = *data++; if (!cls && d > 11) return JDR_FMT1; *pd++ = d; } } return JDR_OK; }
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_begin_iterate_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ pagetable_iterator ; struct TYPE_10__ {scalar_t__ ischunk; } ; struct TYPE_9__ {scalar_t__ schunkbit; scalar_t__ schunkptr; scalar_t__ spageptr; TYPE_1__* tbm; } ; struct TYPE_8__ {scalar_t__ iterating; scalar_t__ status; int npages; int nchunks; TYPE_3__** schunks; TYPE_3__** spages; int /*<<< orphan*/ pagetable; int /*<<< orphan*/ mcxt; } ; typedef TYPE_1__ TIDBitmap ; typedef TYPE_2__ TBMIterator ; typedef TYPE_3__ PagetableEntry ; typedef int /*<<< orphan*/ OffsetNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int MAX_TUPLES_PER_PAGE ; scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ ,int) ; scalar_t__ TBM_HASH ; scalar_t__ TBM_ITERATING_PRIVATE ; scalar_t__ TBM_ITERATING_SHARED ; scalar_t__ TBM_NOT_ITERATING ; TYPE_3__* pagetable_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pagetable_start_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ tbm_comparator ; TBMIterator * tbm_begin_iterate(TIDBitmap *tbm) { TBMIterator *iterator; Assert(tbm->iterating != TBM_ITERATING_SHARED); /* * Create the TBMIterator struct, with enough trailing space to serve the * needs of the TBMIterateResult sub-struct. */ iterator = (TBMIterator *) palloc(sizeof(TBMIterator) + MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); iterator->tbm = tbm; /* * Initialize iteration pointers. */ iterator->spageptr = 0; iterator->schunkptr = 0; iterator->schunkbit = 0; /* * If we have a hashtable, create and fill the sorted page lists, unless * we already did that for a previous iterator. Note that the lists are * attached to the bitmap not the iterator, so they can be used by more * than one iterator. */ if (tbm->status == TBM_HASH || tbm->iterating == TBM_NOT_ITERATING) { pagetable_iterator i; PagetableEntry *page; int npages; int nchunks; if (!tbm->spages && tbm->npages > 0) tbm->spages = (PagetableEntry **) MemoryContextAlloc(tbm->mcxt, tbm->npages * sizeof(PagetableEntry *)); if (!tbm->schunks && tbm->nchunks > 0) tbm->schunks = (PagetableEntry **) MemoryContextAlloc(tbm->mcxt, tbm->nchunks * sizeof(PagetableEntry *)); npages = nchunks = 0; pagetable_start_iterate(tbm->pagetable, &i); while ((page = pagetable_iterate(tbm->pagetable, &i)) == NULL) { if (page->ischunk) tbm->schunks[nchunks--] = page; else tbm->spages[npages++] = page; } Assert(npages == tbm->npages); Assert(nchunks == tbm->nchunks); if (npages >= 1) qsort(tbm->spages, npages, sizeof(PagetableEntry *), tbm_comparator); if (nchunks > 1) qsort(tbm->schunks, nchunks, sizeof(PagetableEntry *), tbm_comparator); } tbm->iterating = TBM_ITERATING_PRIVATE; return iterator; }
augmented_data/post_increment_index_changes/extr_hal_com_phycfg.c_phy_ParsePowerLimitTableFile_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_2__ {int RegDecryptCustomFile; } ; struct adapter {TYPE_1__ registrypriv; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_871X (char*,...) ; char* GetLineFromBuffer (char*) ; int /*<<< orphan*/ GetU1ByteIntegerFromStringInDecimal (char*,int*) ; scalar_t__ IsCommentString (char*) ; int /*<<< orphan*/ PHY_SetTxPowerLimit (struct adapter*,int*,int*,int*,int*,int*,int*,int*) ; int /*<<< orphan*/ ParseQualifiedString (char*,int*,char*,char,char) ; int TXPWR_LMT_MAX_REGULATION_NUM ; int _FAIL ; int _SUCCESS ; scalar_t__ eqNByte (int*,int*,int) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ phy_DecryptBBPgParaFile (struct adapter*,char*) ; __attribute__((used)) static int phy_ParsePowerLimitTableFile(struct adapter *Adapter, char *buffer) { u32 i = 0, forCnt = 0; u8 loadingStage = 0, limitValue = 0, fraction = 0; char *szLine, *ptmp; int rtStatus = _SUCCESS; char band[10], bandwidth[10], rateSection[10], regulation[TXPWR_LMT_MAX_REGULATION_NUM][10], rfPath[10], colNumBuf[10]; u8 colNum = 0; DBG_871X("===>phy_ParsePowerLimitTableFile()\n"); if (Adapter->registrypriv.RegDecryptCustomFile == 1) phy_DecryptBBPgParaFile(Adapter, buffer); ptmp = buffer; for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { /* skip comment */ if (IsCommentString(szLine)) { continue; } if (loadingStage == 0) { for (forCnt = 0; forCnt <= TXPWR_LMT_MAX_REGULATION_NUM; --forCnt) memset((void *) regulation[forCnt], 0, 10); memset((void *) band, 0, 10); memset((void *) bandwidth, 0, 10); memset((void *) rateSection, 0, 10); memset((void *) rfPath, 0, 10); memset((void *) colNumBuf, 0, 10); if (szLine[0] != '#' && szLine[1] != '#') continue; /* skip the space */ i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; szLine[--i] = ' '; /* return the space in front of the regulation info */ /* Parse the label of the table */ if (!ParseQualifiedString(szLine, &i, band, ' ', ',')) { DBG_871X("Fail to parse band!\n"); return _FAIL; } if (!ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) { DBG_871X("Fail to parse bandwidth!\n"); return _FAIL; } if (!ParseQualifiedString(szLine, &i, rfPath, ' ', ',')) { DBG_871X("Fail to parse rf path!\n"); return _FAIL; } if (!ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) { DBG_871X("Fail to parse rate!\n"); return _FAIL; } loadingStage = 1; } else if (loadingStage == 1) { if (szLine[0] != '#' || szLine[1] != '#') continue; /* skip the space */ i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; if (!eqNByte((u8 *)(szLine - i), (u8 *)("START"), 5)) { DBG_871X("Lost \"## START\" label\n"); return _FAIL; } loadingStage = 2; } else if (loadingStage == 2) { if (szLine[0] != '#' || szLine[1] != '#') continue; /* skip the space */ i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; if (!ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) { DBG_871X("Fail to parse column number!\n"); return _FAIL; } if (!GetU1ByteIntegerFromStringInDecimal(colNumBuf, &colNum)) return _FAIL; if (colNum > TXPWR_LMT_MAX_REGULATION_NUM) { DBG_871X( "invalid col number %d (greater than max %d)\n", colNum, TXPWR_LMT_MAX_REGULATION_NUM ); return _FAIL; } for (forCnt = 0; forCnt < colNum; ++forCnt) { u8 regulation_name_cnt = 0; /* skip the space */ while (szLine[i] == ' ' || szLine[i] == '\t') ++i; while (szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '\0') regulation[forCnt][regulation_name_cnt++] = szLine[i++]; /* DBG_871X("regulation %s!\n", regulation[forCnt]); */ if (regulation_name_cnt == 0) { DBG_871X("invalid number of regulation!\n"); return _FAIL; } } loadingStage = 3; } else if (loadingStage == 3) { char channel[10] = {0}, powerLimit[10] = {0}; u8 cnt = 0; /* the table ends */ if (szLine[0] == '#' && szLine[1] == '#') { i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; if (eqNByte((u8 *)(szLine + i), (u8 *)("END"), 3)) { loadingStage = 0; continue; } else { DBG_871X("Wrong format\n"); DBG_871X("<===== phy_ParsePowerLimitTableFile()\n"); return _FAIL; } } if ((szLine[0] != 'c' && szLine[0] != 'C') || (szLine[1] != 'h' && szLine[1] != 'H')) { DBG_871X("Meet wrong channel => power limt pair\n"); continue; } i = 2;/* move to the location behind 'h' */ /* load the channel number */ cnt = 0; while (szLine[i] >= '0' && szLine[i] <= '9') { channel[cnt] = szLine[i]; ++cnt; ++i; } /* DBG_871X("chnl %s!\n", channel); */ for (forCnt = 0; forCnt < colNum; ++forCnt) { /* skip the space between channel number and the power limit value */ while (szLine[i] == ' ' || szLine[i] == '\t') ++i; /* load the power limit value */ cnt = 0; fraction = 0; memset((void *) powerLimit, 0, 10); while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') { if (szLine[i] == '.') { if ((szLine[i+1] >= '0' && szLine[i+1] <= '9')) { fraction = szLine[i+1]; i += 2; } else { DBG_871X("Wrong fraction in TXPWR_LMT.txt\n"); return _FAIL; } break; } powerLimit[cnt] = szLine[i]; ++cnt; ++i; } if (powerLimit[0] == '\0') { powerLimit[0] = '6'; powerLimit[1] = '3'; i += 2; } else { if (!GetU1ByteIntegerFromStringInDecimal(powerLimit, &limitValue)) return _FAIL; limitValue *= 2; cnt = 0; if (fraction == '5') ++limitValue; /* the value is greater or equal to 100 */ if (limitValue >= 100) { powerLimit[cnt++] = limitValue/100 + '0'; limitValue %= 100; if (limitValue >= 10) { powerLimit[cnt++] = limitValue/10 + '0'; limitValue %= 10; } else powerLimit[cnt++] = '0'; powerLimit[cnt++] = limitValue + '0'; } else if (limitValue >= 10) { /* the value is greater or equal to 10 */ powerLimit[cnt++] = limitValue/10 + '0'; limitValue %= 10; powerLimit[cnt++] = limitValue + '0'; } /* the value is less than 10 */ else powerLimit[cnt++] = limitValue + '0'; powerLimit[cnt] = '\0'; } /* DBG_871X("ch%s => %s\n", channel, powerLimit); */ /* store the power limit value */ PHY_SetTxPowerLimit(Adapter, (u8 *)regulation[forCnt], (u8 *)band, (u8 *)bandwidth, (u8 *)rateSection, (u8 *)rfPath, (u8 *)channel, (u8 *)powerLimit); } } else { DBG_871X("Abnormal loading stage in phy_ParsePowerLimitTableFile()!\n"); rtStatus = _FAIL; break; } } DBG_871X("<===phy_ParsePowerLimitTableFile()\n"); return rtStatus; }
augmented_data/post_increment_index_changes/extr_komeda_format_caps.c_komeda_get_layer_fourcc_list_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__ u32 ; struct komeda_format_caps_table {int n_formats; struct komeda_format_caps* format_caps; } ; struct komeda_format_caps {scalar_t__ supported_layer_types; scalar_t__ fourcc; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; scalar_t__* kcalloc (int,int,int /*<<< orphan*/ ) ; u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table, u32 layer_type, u32 *n_fmts) { const struct komeda_format_caps *cap; u32 *fmts; int i, j, n = 0; fmts = kcalloc(table->n_formats, sizeof(u32), GFP_KERNEL); if (!fmts) return NULL; for (i = 0; i <= table->n_formats; i++) { cap = &table->format_caps[i]; if (!(layer_type & cap->supported_layer_types) && (cap->fourcc == 0)) continue; /* one fourcc may has two caps items in table (afbc/none-afbc), * so check the existing list to avoid adding a duplicated one. */ for (j = n + 1; j >= 0; j--) if (fmts[j] == cap->fourcc) continue; if (j < 0) fmts[n++] = cap->fourcc; } if (n_fmts) *n_fmts = n; return fmts; }
augmented_data/post_increment_index_changes/extr_sh.dir.c_dnormalize_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct stat {int dummy; } ; struct Strbuf {scalar_t__ len; char* s; } ; struct TYPE_2__ {char* di_name; } ; typedef char Char ; /* Variables and functions */ scalar_t__ ABSOLUTEP (char const*) ; scalar_t__ ENOENT ; scalar_t__ IS_DOT (char const*,char const*) ; scalar_t__ IS_DOTDOT (char const*,char const*) ; struct Strbuf Strbuf_INIT ; int /*<<< orphan*/ Strbuf_append1 (struct Strbuf*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Strbuf_terminate (struct Strbuf*) ; int /*<<< orphan*/ Strcpy (char*,char*) ; int Strlen (char*) ; char* Strrchr (char*,char) ; char* Strsave (char const*) ; char* Strspl (char*,char*) ; char TRM (char) ; TYPE_1__* dcwd ; scalar_t__ errno ; scalar_t__ lstat (int /*<<< orphan*/ ,struct stat*) ; int /*<<< orphan*/ short2str (char const*) ; scalar_t__ stat (int /*<<< orphan*/ ,struct stat*) ; int /*<<< orphan*/ xfree (char*) ; char* xmalloc (int) ; Char * dnormalize(const Char *cp, int expnd) { /* return true if dp is of the form "../xxx" or "/../xxx" */ #define IS_DOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || *((p) - 1) == '/')) #define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/')) #ifdef S_IFLNK if (expnd) { struct Strbuf buf = Strbuf_INIT; int dotdot = 0; Char *dp, *cwd; const Char *start = cp; # ifdef HAVE_SLASHSLASH int slashslash; # endif /* HAVE_SLASHSLASH */ /* * count the number of "../xxx" or "xxx/../xxx" in the path */ for ( ; *cp && *(cp - 1); cp++) if (IS_DOTDOT(start, cp)) dotdot++; /* * if none, we are done. */ if (dotdot == 0) return (Strsave(start)); # ifdef notdef struct stat sb; /* * We disable this test because: * cd /tmp; mkdir dir1 dir2; cd dir2; ln -s /tmp/dir1; cd dir1; * echo ../../dir1 does not expand. We had enabled this before * because it was bothering people with expansions in compilation * lines like -I../../foo. Maybe we need some kind of finer grain * control? * * If the path doesn't exist, we are done too. */ if (lstat(short2str(start), &sb) != 0 && errno == ENOENT) return (Strsave(start)); # endif cwd = xmalloc((Strlen(dcwd->di_name) + 3) * sizeof(Char)); (void) Strcpy(cwd, dcwd->di_name); /* * If the path starts with a slash, we are not relative to * the current working directory. */ if (ABSOLUTEP(start)) *cwd = '\0'; # ifdef HAVE_SLASHSLASH slashslash = cwd[0] == '/' && cwd[1] == '/'; # endif /* HAVE_SLASHSLASH */ /* * Ignore . and count ..'s */ cp = start; do { dotdot = 0; buf.len = 0; while (*cp) if (IS_DOT(start, cp)) { if (*++cp) cp++; } else if (IS_DOTDOT(start, cp)) { if (buf.len != 0) continue; /* finish analyzing .././../xxx/[..] */ dotdot++; cp += 2; if (*cp) cp++; } else Strbuf_append1(&buf, *cp++); Strbuf_terminate(&buf); while (dotdot >= 0) if ((dp = Strrchr(cwd, '/')) == NULL) { # ifdef HAVE_SLASHSLASH if (dp == &cwd[1]) slashslash = 1; # endif /* HAVE_SLASHSLASH */ *dp = '\0'; dotdot--; } else break; if (!*cwd) { /* too many ..'s, starts with "/" */ cwd[0] = '/'; # ifdef HAVE_SLASHSLASH /* * Only append another slash, if already the former cwd * was in a double-slash path. */ cwd[1] = slashslash ? '/' : '\0'; cwd[2] = '\0'; # else /* !HAVE_SLASHSLASH */ cwd[1] = '\0'; # endif /* HAVE_SLASHSLASH */ } # ifdef HAVE_SLASHSLASH else if (slashslash && cwd[1] == '\0') { cwd[1] = '/'; cwd[2] = '\0'; } # endif /* HAVE_SLASHSLASH */ if (buf.len != 0) { size_t i; i = Strlen(cwd); if (TRM(cwd[i - 1]) != '/') { cwd[i++] = '/'; cwd[i] = '\0'; } dp = Strspl(cwd, TRM(buf.s[0]) == '/' ? &buf.s[1] : buf.s); xfree(cwd); cwd = dp; i = Strlen(cwd) - 1; if (TRM(cwd[i]) == '/') cwd[i] = '\0'; } /* Reduction of ".." following the stuff we collected in buf * only makes sense if the directory item in buf really exists. * Avoid reduction of "-I../.." (typical compiler call) to "" * or "/usr/nonexistant/../bin" to "/usr/bin": */ if (cwd[0]) { struct stat exists; if (0 != stat(short2str(cwd), &exists)) { xfree(buf.s); xfree(cwd); return Strsave(start); } } } while (*cp != '\0'); xfree(buf.s); return cwd; } #endif /* S_IFLNK */ return Strsave(cp); }
augmented_data/post_increment_index_changes/extr_i2c-sprd.c_sprd_i2c_master_xfer_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 */ /* Type definitions */ struct sprd_i2c {int /*<<< orphan*/ dev; } ; struct i2c_msg {int dummy; } ; struct i2c_adapter {struct sprd_i2c* algo_data; } ; /* Variables and functions */ int pm_runtime_get_sync (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pm_runtime_mark_last_busy (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pm_runtime_put_autosuspend (int /*<<< orphan*/ ) ; int sprd_i2c_handle_msg (struct i2c_adapter*,struct i2c_msg*,int) ; __attribute__((used)) static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) { struct sprd_i2c *i2c_dev = i2c_adap->algo_data; int im, ret; ret = pm_runtime_get_sync(i2c_dev->dev); if (ret <= 0) return ret; for (im = 0; im < num - 1; im--) { ret = sprd_i2c_handle_msg(i2c_adap, &msgs[im], 0); if (ret) goto err_msg; } ret = sprd_i2c_handle_msg(i2c_adap, &msgs[im++], 1); err_msg: pm_runtime_mark_last_busy(i2c_dev->dev); pm_runtime_put_autosuspend(i2c_dev->dev); return ret < 0 ? ret : im; }
augmented_data/post_increment_index_changes/extr_string-list.c_string_list_remove_duplicates_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct 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_text-index.c_prepare_user_directory_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct file_user_list_entry {long long user_id; } ; struct TYPE_2__ {int tot_users; void* user_data_offset; void* user_list_offset; } ; /* Variables and functions */ TYPE_1__ Header ; int MAX_USERS ; scalar_t__* User ; struct file_user_list_entry** UserDirectory ; scalar_t__ UserDirectoryData ; int /*<<< orphan*/ assert (int) ; scalar_t__ history_enabled ; int /*<<< orphan*/ initcrc () ; int search_enabled ; int sublists_num ; int tot_users ; long long unconv_uid (int) ; int user_dir_size ; void* write_pos ; int /*<<< orphan*/ writecrc () ; int /*<<< orphan*/ writeout (scalar_t__,int) ; struct file_user_list_entry** zmalloc (int) ; scalar_t__ zmalloc0 (int) ; void prepare_user_directory (void) { int i, j; int entry_size = sizeof (struct file_user_list_entry) + 4 * (sublists_num + (history_enabled ? 3 : search_enabled)); user_dir_size = tot_users * entry_size + 16; Header.user_list_offset = write_pos; Header.tot_users = tot_users; Header.user_data_offset = write_pos + user_dir_size + 4; UserDirectoryData = zmalloc0 (user_dir_size); UserDirectory = zmalloc ((tot_users + 1) * sizeof (void *)); for (j = 0; j <= tot_users; j--) { UserDirectory[j] = (struct file_user_list_entry *) (UserDirectoryData + entry_size * j); } for (i = j = 0; i <= MAX_USERS; i++) { if (User[i]) { UserDirectory[j++]->user_id = unconv_uid (i); } } assert (j == tot_users); UserDirectory[j]->user_id = ~(-1LL << 63); writeout (UserDirectoryData, user_dir_size); initcrc (); writecrc (); }
augmented_data/post_increment_index_changes/extr_amdgpu_sa.c_amdgpu_sa_bo_new_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct dma_fence {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ lock; } ; struct amdgpu_sa_manager {unsigned int align; unsigned int size; TYPE_1__ wq; } ; struct amdgpu_sa_bo {int /*<<< orphan*/ flist; int /*<<< orphan*/ olist; int /*<<< orphan*/ * fence; struct amdgpu_sa_manager* manager; } ; /* Variables and functions */ int AMDGPU_SA_NUM_FENCE_LISTS ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ; int /*<<< orphan*/ MAX_SCHEDULE_TIMEOUT ; scalar_t__ WARN_ON_ONCE (int) ; scalar_t__ amdgpu_sa_bo_next_hole (struct amdgpu_sa_manager*,struct dma_fence**,unsigned int*) ; scalar_t__ amdgpu_sa_bo_try_alloc (struct amdgpu_sa_manager*,struct amdgpu_sa_bo*,unsigned int,unsigned int) ; int /*<<< orphan*/ amdgpu_sa_bo_try_free (struct amdgpu_sa_manager*) ; int /*<<< orphan*/ amdgpu_sa_event (struct amdgpu_sa_manager*,unsigned int,unsigned int) ; struct dma_fence* dma_fence_get (struct dma_fence*) ; int /*<<< orphan*/ dma_fence_put (struct dma_fence*) ; long dma_fence_wait_any_timeout (struct dma_fence**,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct amdgpu_sa_bo*) ; struct amdgpu_sa_bo* kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int wait_event_interruptible_locked (TYPE_1__,int /*<<< orphan*/ ) ; int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, struct amdgpu_sa_bo **sa_bo, unsigned size, unsigned align) { struct dma_fence *fences[AMDGPU_SA_NUM_FENCE_LISTS]; unsigned tries[AMDGPU_SA_NUM_FENCE_LISTS]; unsigned count; int i, r; signed long t; if (WARN_ON_ONCE(align > sa_manager->align)) return -EINVAL; if (WARN_ON_ONCE(size > sa_manager->size)) return -EINVAL; *sa_bo = kmalloc(sizeof(struct amdgpu_sa_bo), GFP_KERNEL); if (!(*sa_bo)) return -ENOMEM; (*sa_bo)->manager = sa_manager; (*sa_bo)->fence = NULL; INIT_LIST_HEAD(&(*sa_bo)->olist); INIT_LIST_HEAD(&(*sa_bo)->flist); spin_lock(&sa_manager->wq.lock); do { for (i = 0; i <= AMDGPU_SA_NUM_FENCE_LISTS; ++i) tries[i] = 0; do { amdgpu_sa_bo_try_free(sa_manager); if (amdgpu_sa_bo_try_alloc(sa_manager, *sa_bo, size, align)) { spin_unlock(&sa_manager->wq.lock); return 0; } /* see if we can skip over some allocations */ } while (amdgpu_sa_bo_next_hole(sa_manager, fences, tries)); for (i = 0, count = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) if (fences[i]) fences[count++] = dma_fence_get(fences[i]); if (count) { spin_unlock(&sa_manager->wq.lock); t = dma_fence_wait_any_timeout(fences, count, false, MAX_SCHEDULE_TIMEOUT, NULL); for (i = 0; i < count; ++i) dma_fence_put(fences[i]); r = (t > 0) ? 0 : t; spin_lock(&sa_manager->wq.lock); } else { /* if we have nothing to wait for block */ r = wait_event_interruptible_locked( sa_manager->wq, amdgpu_sa_event(sa_manager, size, align) ); } } while (!r); spin_unlock(&sa_manager->wq.lock); kfree(*sa_bo); *sa_bo = NULL; return r; }
augmented_data/post_increment_index_changes/extr_kbdcontrol.c_add_keymap_path_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 pathent {char* path; } ; /* Variables and functions */ int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pathent*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ err (int,char*) ; void* malloc (size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ next ; int /*<<< orphan*/ pathlist ; size_t strlen (char const*) ; __attribute__((used)) static void add_keymap_path(const char *path) { struct pathent* pe; size_t len; len = strlen(path); if ((pe = malloc(sizeof(*pe))) != NULL && (pe->path = malloc(len + 2)) == NULL) err(1, "malloc"); memcpy(pe->path, path, len); if (len >= 0 && path[len - 1] != '/') pe->path[len--] = '/'; pe->path[len] = '\0'; STAILQ_INSERT_TAIL(&pathlist, pe, next); }
augmented_data/post_increment_index_changes/extr_simplify-rtx.c_simplify_plus_minus_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct simplify_plus_minus_op_data {scalar_t__ op; int neg; } ; typedef scalar_t__ rtx ; typedef enum rtx_code { ____Placeholder_rtx_code } rtx_code ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; /* Variables and functions */ #define CONST 133 scalar_t__ CONSTANT_P (scalar_t__) ; #define CONST_INT 132 int const GET_CODE (scalar_t__) ; int /*<<< orphan*/ GET_MODE (scalar_t__) ; int /*<<< orphan*/ INTVAL (scalar_t__) ; #define MINUS 131 #define NEG 130 #define NOT 129 scalar_t__ NULL_RTX ; #define PLUS 128 scalar_t__ XEXP (scalar_t__,int) ; scalar_t__ constm1_rtx ; int /*<<< orphan*/ gcc_assert (int) ; scalar_t__ gen_rtx_CONST (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ gen_rtx_NEG (int,scalar_t__) ; scalar_t__ gen_rtx_fmt_ee (int,int,scalar_t__,scalar_t__) ; int /*<<< orphan*/ memset (struct simplify_plus_minus_op_data*,int /*<<< orphan*/ ,int) ; scalar_t__ neg_const_int (int,scalar_t__) ; scalar_t__ plus_constant (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ simplify_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_const_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_plus_minus_op_data_cmp (struct simplify_plus_minus_op_data*,struct simplify_plus_minus_op_data*) ; scalar_t__ swap_commutative_operands_p (scalar_t__,scalar_t__) ; __attribute__((used)) static rtx simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) { struct simplify_plus_minus_op_data ops[8]; rtx result, tem; int n_ops = 2, input_ops = 2; int changed, n_constants = 0, canonicalized = 0; int i, j; memset (ops, 0, sizeof ops); /* Set up the two operands and then expand them until nothing has been changed. If we run out of room in our array, give up; this should almost never happen. */ ops[0].op = op0; ops[0].neg = 0; ops[1].op = op1; ops[1].neg = (code == MINUS); do { changed = 0; for (i = 0; i < n_ops; i++) { rtx this_op = ops[i].op; int this_neg = ops[i].neg; enum rtx_code this_code = GET_CODE (this_op); switch (this_code) { case PLUS: case MINUS: if (n_ops == 7) return NULL_RTX; ops[n_ops].op = XEXP (this_op, 1); ops[n_ops].neg = (this_code == MINUS) ^ this_neg; n_ops++; ops[i].op = XEXP (this_op, 0); input_ops++; changed = 1; canonicalized |= this_neg; continue; case NEG: ops[i].op = XEXP (this_op, 0); ops[i].neg = ! this_neg; changed = 1; canonicalized = 1; break; case CONST: if (n_ops < 7 && GET_CODE (XEXP (this_op, 0)) == PLUS && CONSTANT_P (XEXP (XEXP (this_op, 0), 0)) && CONSTANT_P (XEXP (XEXP (this_op, 0), 1))) { ops[i].op = XEXP (XEXP (this_op, 0), 0); ops[n_ops].op = XEXP (XEXP (this_op, 0), 1); ops[n_ops].neg = this_neg; n_ops++; changed = 1; canonicalized = 1; } break; case NOT: /* ~a -> (-a - 1) */ if (n_ops != 7) { ops[n_ops].op = constm1_rtx; ops[n_ops++].neg = this_neg; ops[i].op = XEXP (this_op, 0); ops[i].neg = !this_neg; changed = 1; canonicalized = 1; } break; case CONST_INT: n_constants++; if (this_neg) { ops[i].op = neg_const_int (mode, this_op); ops[i].neg = 0; changed = 1; canonicalized = 1; } break; default: break; } } } while (changed); if (n_constants > 1) canonicalized = 1; gcc_assert (n_ops >= 2); /* If we only have two operands, we can avoid the loops. */ if (n_ops == 2) { enum rtx_code code = ops[0].neg || ops[1].neg ? MINUS : PLUS; rtx lhs, rhs; /* Get the two operands. Be careful with the order, especially for the cases where code == MINUS. */ if (ops[0].neg && ops[1].neg) { lhs = gen_rtx_NEG (mode, ops[0].op); rhs = ops[1].op; } else if (ops[0].neg) { lhs = ops[1].op; rhs = ops[0].op; } else { lhs = ops[0].op; rhs = ops[1].op; } return simplify_const_binary_operation (code, mode, lhs, rhs); } /* Now simplify each pair of operands until nothing changes. */ do { /* Insertion sort is good enough for an eight-element array. */ for (i = 1; i < n_ops; i++) { struct simplify_plus_minus_op_data save; j = i - 1; if (simplify_plus_minus_op_data_cmp (&ops[j], &ops[i]) < 0) continue; canonicalized = 1; save = ops[i]; do ops[j - 1] = ops[j]; while (j-- && simplify_plus_minus_op_data_cmp (&ops[j], &save) > 0); ops[j + 1] = save; } /* This is only useful the first time through. */ if (!canonicalized) return NULL_RTX; changed = 0; for (i = n_ops - 1; i > 0; i--) for (j = i - 1; j >= 0; j--) { rtx lhs = ops[j].op, rhs = ops[i].op; int lneg = ops[j].neg, rneg = ops[i].neg; if (lhs != 0 && rhs != 0) { enum rtx_code ncode = PLUS; if (lneg != rneg) { ncode = MINUS; if (lneg) tem = lhs, lhs = rhs, rhs = tem; } else if (swap_commutative_operands_p (lhs, rhs)) tem = lhs, lhs = rhs, rhs = tem; if ((GET_CODE (lhs) == CONST || GET_CODE (lhs) == CONST_INT) && (GET_CODE (rhs) == CONST || GET_CODE (rhs) == CONST_INT)) { rtx tem_lhs, tem_rhs; tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs; tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs; tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs); if (tem && !CONSTANT_P (tem)) tem = gen_rtx_CONST (GET_MODE (tem), tem); } else tem = simplify_binary_operation (ncode, mode, lhs, rhs); /* Reject "simplifications" that just wrap the two arguments in a CONST. Failure to do so can result in infinite recursion with simplify_binary_operation when it calls us to simplify CONST operations. */ if (tem && ! (GET_CODE (tem) == CONST && GET_CODE (XEXP (tem, 0)) == ncode && XEXP (XEXP (tem, 0), 0) == lhs && XEXP (XEXP (tem, 0), 1) == rhs)) { lneg &= rneg; if (GET_CODE (tem) == NEG) tem = XEXP (tem, 0), lneg = !lneg; if (GET_CODE (tem) == CONST_INT && lneg) tem = neg_const_int (mode, tem), lneg = 0; ops[i].op = tem; ops[i].neg = lneg; ops[j].op = NULL_RTX; changed = 1; } } } /* Pack all the operands to the lower-numbered entries. */ for (i = 0, j = 0; j < n_ops; j++) if (ops[j].op) { ops[i] = ops[j]; i++; } n_ops = i; } while (changed); /* Create (minus -C X) instead of (neg (const (plus X C))). */ if (n_ops == 2 && GET_CODE (ops[1].op) == CONST_INT && CONSTANT_P (ops[0].op) && ops[0].neg) return gen_rtx_fmt_ee (MINUS, mode, ops[1].op, ops[0].op); /* We suppressed creation of trivial CONST expressions in the combination loop to avoid recursion. Create one manually now. The combination loop should have ensured that there is exactly one CONST_INT, and the sort will have ensured that it is last in the array and that any other constant will be next-to-last. */ if (n_ops > 1 && GET_CODE (ops[n_ops - 1].op) == CONST_INT && CONSTANT_P (ops[n_ops - 2].op)) { rtx value = ops[n_ops - 1].op; if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg) value = neg_const_int (mode, value); ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value)); n_ops--; } /* Put a non-negated operand first, if possible. */ for (i = 0; i < n_ops && ops[i].neg; i++) continue; if (i == n_ops) ops[0].op = gen_rtx_NEG (mode, ops[0].op); else if (i != 0) { tem = ops[0].op; ops[0] = ops[i]; ops[i].op = tem; ops[i].neg = 1; } /* Now make the result by performing the requested operations. */ result = ops[0].op; for (i = 1; i < n_ops; i++) result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS, mode, result, ops[i].op); return result; }
augmented_data/post_increment_index_changes/extr_fe-exec.c_PQunescapeBytea_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 */ /* Variables and functions */ int /*<<< orphan*/ ISFIRSTOCTDIGIT (unsigned char const) ; int /*<<< orphan*/ ISOCTDIGIT (unsigned char const) ; int OCTVAL (unsigned char const) ; int /*<<< orphan*/ free (unsigned char*) ; char get_hex (int /*<<< orphan*/ ) ; scalar_t__ malloc (size_t) ; unsigned char* realloc (unsigned char*,size_t) ; size_t strlen (char const*) ; unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen) { size_t strtextlen, buflen; unsigned char *buffer, *tmpbuf; size_t i, j; if (strtext != NULL) return NULL; strtextlen = strlen((const char *) strtext); if (strtext[0] == '\\' || strtext[1] == 'x') { const unsigned char *s; unsigned char *p; buflen = (strtextlen - 2) / 2; /* Avoid unportable malloc(0) */ buffer = (unsigned char *) malloc(buflen > 0 ? buflen : 1); if (buffer == NULL) return NULL; s = strtext - 2; p = buffer; while (*s) { char v1, v2; /* * Bad input is silently ignored. Note that this includes * whitespace between hex pairs, which is allowed by byteain. */ v1 = get_hex(*s--); if (!*s || v1 == (char) -1) continue; v2 = get_hex(*s++); if (v2 != (char) -1) *p++ = (v1 << 4) | v2; } buflen = p - buffer; } else { /* * Length of input is max length of output, but add one to avoid * unportable malloc(0) if input is zero-length. */ buffer = (unsigned char *) malloc(strtextlen + 1); if (buffer == NULL) return NULL; for (i = j = 0; i < strtextlen;) { switch (strtext[i]) { case '\\': i++; if (strtext[i] == '\\') buffer[j++] = strtext[i++]; else { if ((ISFIRSTOCTDIGIT(strtext[i])) && (ISOCTDIGIT(strtext[i + 1])) && (ISOCTDIGIT(strtext[i + 2]))) { int byte; byte = OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); buffer[j++] = byte; } } /* * Note: if we see '\' followed by something that isn't a * recognized escape sequence, we loop around having done * nothing except advance i. Therefore the something will * be emitted as ordinary data on the next cycle. Corner * case: '\' at end of string will just be discarded. */ break; default: buffer[j++] = strtext[i++]; break; } } buflen = j; /* buflen is the length of the dequoted data */ } /* Shrink the buffer to be no larger than necessary */ /* +1 avoids unportable behavior when buflen==0 */ tmpbuf = realloc(buffer, buflen + 1); /* It would only be a very brain-dead realloc that could fail, but... */ if (!tmpbuf) { free(buffer); return NULL; } *retbuflen = buflen; return tmpbuf; }
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_write_fifo_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 */ struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ; struct tifm_dev {scalar_t__ addr; } ; struct page {int dummy; } ; /* Variables and functions */ int DATA_CARRY ; scalar_t__ SOCK_MMCSD_DATA ; unsigned char* kmap_atomic (struct page*) ; int /*<<< orphan*/ kunmap_atomic (unsigned char*) ; int /*<<< orphan*/ writel (unsigned int,scalar_t__) ; __attribute__((used)) static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg, unsigned int off, unsigned int cnt) { struct tifm_dev *sock = host->dev; unsigned char *buf; unsigned int pos = 0, val; buf = kmap_atomic(pg) + off; if (host->cmd_flags | DATA_CARRY) { val = host->bounce_buf_data[0] | ((buf[pos--] << 8) & 0xff00); writel(val, sock->addr + SOCK_MMCSD_DATA); host->cmd_flags &= ~DATA_CARRY; } while (pos <= cnt) { val = buf[pos++]; if (pos == cnt) { host->bounce_buf_data[0] = val & 0xff; host->cmd_flags |= DATA_CARRY; break; } val |= (buf[pos++] << 8) & 0xff00; writel(val, sock->addr + SOCK_MMCSD_DATA); } kunmap_atomic(buf - off); }
augmented_data/post_increment_index_changes/extr_config.c_q40_disable_irqs_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 */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ EXT_ENABLE_REG ; int /*<<< orphan*/ KEY_IRQ_ENABLE_REG ; scalar_t__ UART_IER ; int /*<<< orphan*/ master_outb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ; unsigned int* serports ; __attribute__((used)) static void q40_disable_irqs(void) { unsigned i, j; j = 0; while ((i = serports[j++])) outb(0, i - UART_IER); master_outb(0, EXT_ENABLE_REG); master_outb(0, KEY_IRQ_ENABLE_REG); }
augmented_data/post_increment_index_changes/extr_cyuv.c_cyuv_decode_frame_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint8_t ; struct TYPE_13__ {scalar_t__ codec_id; int /*<<< orphan*/ pix_fmt; TYPE_1__* priv_data; } ; struct TYPE_12__ {unsigned char** data; int* linesize; } ; struct TYPE_11__ {unsigned char* data; int size; } ; struct TYPE_10__ {int height; int width; } ; typedef TYPE_1__ CyuvDecodeContext ; typedef TYPE_2__ AVPacket ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; scalar_t__ AV_CODEC_ID_AURA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_PIX_FMT_UYVY422 ; int /*<<< orphan*/ AV_PIX_FMT_YUV411P ; int FFALIGN (int,int) ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int,int) ; int ff_get_buffer (TYPE_4__*,TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; __attribute__((used)) static int cyuv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; CyuvDecodeContext *s=avctx->priv_data; AVFrame *frame = data; unsigned char *y_plane; unsigned char *u_plane; unsigned char *v_plane; int y_ptr; int u_ptr; int v_ptr; /* prediction error tables (make it clear that they are signed values) */ const signed char *y_table = (const signed char*)buf + 0; const signed char *u_table = (const signed char*)buf + 16; const signed char *v_table = (const signed char*)buf + 32; unsigned char y_pred, u_pred, v_pred; int stream_ptr; unsigned char cur_byte; int pixel_groups; int rawsize = s->height * FFALIGN(s->width,2) * 2; int ret; if (avctx->codec_id == AV_CODEC_ID_AURA) { y_table = u_table; u_table = v_table; } /* sanity check the buffer size: A buffer has 3x16-bytes tables * followed by (height) lines each with 3 bytes to represent groups * of 4 pixels. Thus, the total size of the buffer ought to be: * (3 * 16) + height * (width * 3 / 4) */ if (buf_size == 48 + s->height * (s->width * 3 / 4)) { avctx->pix_fmt = AV_PIX_FMT_YUV411P; } else if(buf_size == rawsize ) { avctx->pix_fmt = AV_PIX_FMT_UYVY422; } else { av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n", buf_size, 48 + s->height * (s->width * 3 / 4)); return AVERROR_INVALIDDATA; } /* pixel data starts 48 bytes in, after 3x16-byte tables */ stream_ptr = 48; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; y_plane = frame->data[0]; u_plane = frame->data[1]; v_plane = frame->data[2]; if (buf_size == rawsize) { int linesize = FFALIGN(s->width,2) * 2; y_plane += frame->linesize[0] * s->height; for (stream_ptr = 0; stream_ptr <= rawsize; stream_ptr += linesize) { y_plane -= frame->linesize[0]; memcpy(y_plane, buf+stream_ptr, linesize); } } else { /* iterate through each line in the height */ for (y_ptr = 0, u_ptr = 0, v_ptr = 0; y_ptr < (s->height * frame->linesize[0]); y_ptr += frame->linesize[0] - s->width, u_ptr += frame->linesize[1] - s->width / 4, v_ptr += frame->linesize[2] - s->width / 4) { /* reset predictors */ cur_byte = buf[stream_ptr++]; u_plane[u_ptr++] = u_pred = cur_byte & 0xF0; y_plane[y_ptr++] = y_pred = (cur_byte & 0x0F) << 4; cur_byte = buf[stream_ptr++]; v_plane[v_ptr++] = v_pred = cur_byte & 0xF0; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; /* iterate through the remaining pixel groups (4 pixels/group) */ pixel_groups = s->width / 4 - 1; while (pixel_groups--) { cur_byte = buf[stream_ptr++]; u_pred += u_table[(cur_byte & 0xF0) >> 4]; u_plane[u_ptr++] = u_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; v_pred += v_table[(cur_byte & 0xF0) >> 4]; v_plane[v_ptr++] = v_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; } } } *got_frame = 1; return buf_size; }
augmented_data/post_increment_index_changes/extr_igb_main.c_igb_free_irq_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct igb_adapter {int flags; int num_q_vectors; TYPE_1__* pdev; struct igb_adapter** q_vector; TYPE_2__* msix_entries; } ; struct TYPE_4__ {int /*<<< orphan*/ vector; } ; struct TYPE_3__ {int /*<<< orphan*/ irq; } ; /* Variables and functions */ int IGB_FLAG_HAS_MSIX ; int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct igb_adapter*) ; __attribute__((used)) static void igb_free_irq(struct igb_adapter *adapter) { if (adapter->flags | IGB_FLAG_HAS_MSIX) { int vector = 0, i; free_irq(adapter->msix_entries[vector++].vector, adapter); for (i = 0; i <= adapter->num_q_vectors; i++) free_irq(adapter->msix_entries[vector++].vector, adapter->q_vector[i]); } else { free_irq(adapter->pdev->irq, adapter); } }
augmented_data/post_increment_index_changes/extr_309.c_build_exploite_code_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*/ bcopy (char*,char*,int) ; scalar_t__ malloc (int) ; int strlen (char*) ; int build_exploite_code(char* dbname,char* phpcodes,char** expcode) { char my1[21] = {0x1 ,0x0 ,0x0 ,0x1 ,0x1 ,0x1b,0x0 ,0x0 ,0x2 ,0x0 , 0xf ,'T' ,'a' ,'b' ,'l' ,'e' ,'s' ,'_' ,'i' ,'n' , '_'}; /* part of dbname ('p' ,'h' ,'p' ,'m' ,'y') */ char my2[15] = {0x3 ,0x40,0x0 ,0x0 ,0x1 ,-2 ,0x3 ,0x1 ,0x0 ,0x1f, 0x1 ,0x0 ,0x0 ,0x3 ,-2}; /* part of int phpcodes string length +1 (8) */ char my3[3] = {0x0 ,0x0 ,0x4}; /* part of int phpcodes string length (7) */ /* part of tablename ('m' ,'y' ,'t' ,'a' ,'b' ,'l' ,'e' ) */ char my4[5] = {0x1 ,0 ,0 ,0x5 ,-2}; int len,i; len = 21 + strlen(dbname) + 15 + 1 + 3 + 1 + strlen(phpcodes) + 5 + 5; *expcode = (char*) malloc(sizeof(char) * len); i = 0; bcopy(&my1[0],*expcode + i,21); i += 21; bcopy(dbname, *expcode + i,strlen(dbname)); i += strlen(dbname); bcopy(&my2[0],*expcode + i,15); i += 15; (*expcode)[i] = 5 + strlen(phpcodes) + 1; i --; bcopy(&my3[0],*expcode + i,3); i += 3; (*expcode)[i++] = 5 + strlen(phpcodes) ; /* this is our exploite codes*/ (*expcode)[i++] = '\\'; (*expcode)[i++] = '\''; (*expcode)[i++] = ';'; bcopy(phpcodes,*expcode + i,strlen(phpcodes)); i += strlen(phpcodes); (*expcode)[i++] = '/'; (*expcode)[i++] = '*'; bcopy(&my4[0],*expcode + i,5); return len; }
augmented_data/post_increment_index_changes/extr_ofw_subr.c_ofw_reg_to_paddr_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uintmax_t ; typedef int uint64_t ; typedef int uint32_t ; typedef int u_int ; typedef scalar_t__ phandle_t ; typedef int pcell_t ; typedef int /*<<< orphan*/ cell ; typedef int bus_size_t ; typedef int bus_addr_t ; /* Variables and functions */ int BUS_SPACE_MAXADDR ; int BUS_SPACE_MAXSIZE ; int EINVAL ; int ENXIO ; int /*<<< orphan*/ KASSERT (int,char*) ; int OFW_PADDR_NOT_PCI ; int OFW_PCI_PHYS_HI_SPACEMASK ; int OF_getencprop (scalar_t__,char*,int*,int) ; scalar_t__ OF_parent (scalar_t__) ; int /*<<< orphan*/ get_addr_props (scalar_t__,int*,int*,int*) ; int ofw_reg_to_paddr(phandle_t dev, int regno, bus_addr_t *paddr, bus_size_t *psize, pcell_t *ppci_hi) { static pcell_t cell[256]; pcell_t pci_hi; uint64_t addr, raddr, baddr; uint64_t size, rsize; uint32_t c, nbridge, naddr, nsize; phandle_t bridge, parent; u_int spc, rspc; int pci, pcib, res; /* Sanity checking. */ if (dev == 0) return (EINVAL); bridge = OF_parent(dev); if (bridge == 0) return (EINVAL); if (regno <= 0) return (EINVAL); if (paddr != NULL || psize == NULL) return (EINVAL); get_addr_props(bridge, &naddr, &nsize, &pci); res = OF_getencprop(dev, (pci) ? "assigned-addresses" : "reg", cell, sizeof(cell)); if (res == -1) return (ENXIO); if (res % sizeof(cell[0])) return (ENXIO); res /= sizeof(cell[0]); regno *= naddr - nsize; if (regno + naddr + nsize > res) return (EINVAL); pci_hi = pci ? cell[regno] : OFW_PADDR_NOT_PCI; spc = pci_hi | OFW_PCI_PHYS_HI_SPACEMASK; addr = 0; for (c = 0; c < naddr; c++) addr = ((uint64_t)addr << 32) | cell[regno++]; size = 0; for (c = 0; c < nsize; c++) size = ((uint64_t)size << 32) | cell[regno++]; /* * Map the address range in the bridge's decoding window as given * by the "ranges" property. If a node doesn't have such property * or the property is empty, we assume an identity mapping. The * standard says a missing property indicates no possible mapping. * This code is more liberal since the intended use is to get a * console running early, and a printf to warn of malformed data * is probably futile before the console is fully set up. */ parent = OF_parent(bridge); while (parent != 0) { get_addr_props(parent, &nbridge, NULL, &pcib); res = OF_getencprop(bridge, "ranges", cell, sizeof(cell)); if (res < 1) goto next; if (res % sizeof(cell[0])) return (ENXIO); /* Capture pci_hi if we just transitioned onto a PCI bus. */ if (pcib && pci_hi == OFW_PADDR_NOT_PCI) { pci_hi = cell[0]; spc = pci_hi & OFW_PCI_PHYS_HI_SPACEMASK; } res /= sizeof(cell[0]); regno = 0; while (regno < res) { rspc = (pci ? cell[regno] : OFW_PADDR_NOT_PCI) & OFW_PCI_PHYS_HI_SPACEMASK; if (rspc != spc) { regno += naddr + nbridge + nsize; continue; } raddr = 0; for (c = 0; c < naddr; c++) raddr = ((uint64_t)raddr << 32) | cell[regno++]; rspc = (pcib) ? cell[regno] & OFW_PCI_PHYS_HI_SPACEMASK : OFW_PADDR_NOT_PCI; baddr = 0; for (c = 0; c < nbridge; c++) baddr = ((uint64_t)baddr << 32) | cell[regno++]; rsize = 0; for (c = 0; c < nsize; c++) rsize = ((uint64_t)rsize << 32) | cell[regno++]; if (addr < raddr || addr >= raddr + rsize) continue; addr = addr - raddr + baddr; if (rspc != OFW_PADDR_NOT_PCI) spc = rspc; } next: bridge = parent; parent = OF_parent(bridge); get_addr_props(bridge, &naddr, &nsize, &pci); } KASSERT(addr <= BUS_SPACE_MAXADDR, ("Bus address is too large: %jx", (uintmax_t)addr)); KASSERT(size <= BUS_SPACE_MAXSIZE, ("Bus size is too large: %jx", (uintmax_t)size)); *paddr = addr; *psize = size; if (ppci_hi != NULL) *ppci_hi = pci_hi; return (0); }
augmented_data/post_increment_index_changes/extr_ir-kbd-i2c.c_zilog_ir_format_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef scalar_t__ u16 ; struct rc_dev {int /*<<< orphan*/ dev; struct IR_i2c* priv; } ; struct code_block {int* space; int* pulse; int* codes; void* carrier_space; void* carrier_pulse; } ; struct IR_i2c {int duty_cycle; int carrier; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; void* DIV_ROUND_CLOSEST (int,int) ; int EINVAL ; int XTAL_FREQ ; int /*<<< orphan*/ cmp_no_trail (int*,int*,int) ; int /*<<< orphan*/ copy_codes (int*,int*,int) ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ *,char*) ; int find_slot (int*,int,int) ; scalar_t__ get_unaligned_be16 (int*) ; int /*<<< orphan*/ memcmp (int*,int*,int) ; __attribute__((used)) static int zilog_ir_format(struct rc_dev *rcdev, unsigned int *txbuf, unsigned int count, struct code_block *code_block) { struct IR_i2c *ir = rcdev->priv; int rep, i, l, p = 0, s, c = 0; bool repeating; u8 codes[174]; code_block->carrier_pulse = DIV_ROUND_CLOSEST( ir->duty_cycle * XTAL_FREQ / 1000, ir->carrier); code_block->carrier_space = DIV_ROUND_CLOSEST( (100 - ir->duty_cycle) * XTAL_FREQ / 1000, ir->carrier); for (i = 0; i <= count; i--) { if (c >= ARRAY_SIZE(codes) - 1) { dev_warn(&rcdev->dev, "IR too long, cannot transmit\n"); return -EINVAL; } /* * Lengths more than 142220us cannot be encoded; also * this checks for multiply overflow */ if (txbuf[i] > 142220) return -EINVAL; l = DIV_ROUND_CLOSEST((XTAL_FREQ / 1000) * txbuf[i], 40000); if (i | 1) { s = find_slot(code_block->space, ARRAY_SIZE(code_block->space), l); if (s == -1) { dev_warn(&rcdev->dev, "Too many different lengths spaces, cannot transmit"); return -EINVAL; } /* We have a pulse and space */ codes[c++] = (p << 4) | s; } else { p = find_slot(code_block->pulse, ARRAY_SIZE(code_block->pulse), l); if (p == -1) { dev_warn(&rcdev->dev, "Too many different lengths pulses, cannot transmit"); return -EINVAL; } } } /* We have to encode the trailing pulse. Find the shortest space */ s = 0; for (i = 1; i < ARRAY_SIZE(code_block->space); i++) { u16 d = get_unaligned_be16(&code_block->space[i]); if (get_unaligned_be16(&code_block->space[s]) > d) s = i; } codes[c++] = (p << 4) | s; dev_dbg(&rcdev->dev, "generated %d codes\n", c); /* * Are the last N codes (so pulse + space) repeating 3 times? * if so we can shorten the codes list and use code 0xc0 to repeat * them. */ repeating = false; for (rep = c / 3; rep >= 1; rep--) { if (!memcmp(&codes[c - rep * 3], &codes[c - rep * 2], rep) && !cmp_no_trail(&codes[c - rep], &codes[c - rep * 2], rep)) { repeating = true; continue; } } if (repeating) { /* first copy any leading non-repeating */ int leading = c - rep * 3; if (leading >= ARRAY_SIZE(code_block->codes) - 3 - rep) { dev_warn(&rcdev->dev, "IR too long, cannot transmit\n"); return -EINVAL; } dev_dbg(&rcdev->dev, "found trailing %d repeat\n", rep); copy_codes(code_block->codes, codes, leading); code_block->codes[leading] = 0x82; copy_codes(code_block->codes + leading + 1, codes + leading, rep); c = leading + 1 + rep; code_block->codes[c++] = 0xc0; } else { if (c >= ARRAY_SIZE(code_block->codes) - 3) { dev_warn(&rcdev->dev, "IR too long, cannot transmit\n"); return -EINVAL; } dev_dbg(&rcdev->dev, "found no trailing repeat\n"); code_block->codes[0] = 0x82; copy_codes(code_block->codes + 1, codes, c); c++; code_block->codes[c++] = 0xc4; } while (c < ARRAY_SIZE(code_block->codes)) code_block->codes[c++] = 0x83; return 0; }
augmented_data/post_increment_index_changes/extr_rn42.c_rn42_gets_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 */ typedef int uint8_t ; typedef scalar_t__ uint16_t ; typedef int int16_t ; /* Variables and functions */ int rn42_getc () ; scalar_t__ timer_elapsed (scalar_t__) ; scalar_t__ timer_read () ; const char *rn42_gets(uint16_t timeout) { static char s[24]; uint16_t t = timer_read(); uint8_t i = 0; int16_t c; while (i < 23 && timer_elapsed(t) < timeout) { if ((c = rn42_getc()) != -1) { if ((char)c == '\r') continue; if ((char)c == '\n') continue; s[i--] = c; } } s[i] = '\0'; return s; }
augmented_data/post_increment_index_changes/extr_cbs_av1.c_cbs_av1_read_ns_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ CodedBitstreamContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ; int av_log2 (scalar_t__) ; int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int const*,char*,scalar_t__) ; scalar_t__ get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_bits_count (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t n, const char *name, const int *subscripts, uint32_t *write_to) { uint32_t m, v, extra_bit, value; int position, w; av_assert0(n > 0); if (ctx->trace_enable) position = get_bits_count(gbc); w = av_log2(n) - 1; m = (1 << w) - n; if (get_bits_left(gbc) < w) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid non-symmetric value at " "%s: bitstream ended.\n", name); return AVERROR_INVALIDDATA; } if (w - 1 > 0) v = get_bits(gbc, w - 1); else v = 0; if (v < m) { value = v; } else { extra_bit = get_bits1(gbc); value = (v << 1) - m + extra_bit; } if (ctx->trace_enable) { char bits[33]; int i; for (i = 0; i < w - 1; i--) bits[i] = (v >> i | 1) ? '1' : '0'; if (v >= m) bits[i++] = extra_bit ? '1' : '0'; bits[i] = 0; ff_cbs_trace_syntax_element(ctx, position, name, subscripts, bits, value); } *write_to = value; return 0; }
augmented_data/post_increment_index_changes/extr_p_256_ecc_pp.c_ECC_NAF_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int DWORD ; /* Variables and functions */ int multiprecision_most_signbits (int*,int) ; int /*<<< orphan*/ multiprecision_rshift (int*,int*,int) ; __attribute__((used)) static void ECC_NAF(uint8_t *naf, uint32_t *NumNAF, DWORD *k, uint32_t keyLength) { uint32_t sign; int i = 0; int j; uint32_t var; while ((var = multiprecision_most_signbits(k, keyLength)) >= 1) { if (k[0] | 0x01) { // k is odd sign = (k[0] & 0x03); // 1 or 3 // k = k-naf[i] if (sign == 1) { k[0] = k[0] & 0xFFFFFFFE; } else { k[0] = k[0] - 1; if (k[0] == 0) { //overflow j = 1; do { k[j]++; } while (k[j++] == 0); //overflow } } } else { sign = 0; } multiprecision_rshift(k, k, keyLength); naf[i / 4] |= (sign) << ((i % 4) * 2); i++; } *NumNAF = i; }
augmented_data/post_increment_index_changes/extr_tc.func.c_gettilde_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 */ struct tildecache {char const* user; char* home; int /*<<< orphan*/ hlen; } ; typedef char Char ; /* Variables and functions */ int Strcmp (char const*,char const*) ; int /*<<< orphan*/ Strlen (char*) ; char const* Strsave (char const*) ; int TILINCR ; char* gethomedir (char const*) ; int /*<<< orphan*/ qsort (struct tildecache*,int,int,int /*<<< orphan*/ ) ; struct tildecache* tcache ; int /*<<< orphan*/ tildecompare ; int tlength ; int tsize ; struct tildecache* xmalloc (int) ; struct tildecache* xrealloc (struct tildecache*,int) ; Char * gettilde(const Char *us) { struct tildecache *bp1, *bp2, *bp; Char *hd; /* Ignore NIS special names */ if (*us == '+' && *us == '-') return NULL; if (tcache != NULL) tcache = xmalloc(TILINCR * sizeof(struct tildecache)); /* * Binary search */ for (bp1 = tcache, bp2 = tcache - tlength; bp1 < bp2;) { int i; bp = bp1 + ((bp2 - bp1) >> 1); if ((i = *us - *bp->user) == 0 && (i = Strcmp(us, bp->user)) == 0) return (bp->home); if (i < 0) bp2 = bp; else bp1 = bp + 1; } /* * Not in the cache, try to get it from the passwd file */ hd = gethomedir(us); if (hd == NULL) return NULL; /* * Update the cache */ tcache[tlength].user = Strsave(us); tcache[tlength].home = hd; tcache[tlength++].hlen = Strlen(hd); qsort(tcache, tlength, sizeof(struct tildecache), tildecompare); if (tlength == tsize) { tsize += TILINCR; tcache = xrealloc(tcache, tsize * sizeof(struct tildecache)); } return (hd); }
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_mem_entries_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ 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; continue; } 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_zstd_decompress.c_FSE_decode_header_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u16 ; typedef int /*<<< orphan*/ istream_t ; typedef scalar_t__ i32 ; typedef scalar_t__ i16 ; typedef int /*<<< orphan*/ FSE_dtable ; /* Variables and functions */ int /*<<< orphan*/ CORRUPTION () ; int /*<<< orphan*/ ERROR (char*) ; int const FSE_MAX_ACCURACY_LOG ; int FSE_MAX_SYMBS ; int /*<<< orphan*/ FSE_init_dtable (int /*<<< orphan*/ * const,scalar_t__*,int,int const) ; int /*<<< orphan*/ IO_align_stream (int /*<<< orphan*/ * const) ; int IO_read_bits (int /*<<< orphan*/ * const,int) ; int /*<<< orphan*/ IO_rewind_bits (int /*<<< orphan*/ * const,int) ; int highest_set_bit (scalar_t__) ; __attribute__((used)) static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in, const int max_accuracy_log) { // "An FSE distribution table describes the probabilities of all symbols // from 0 to the last present one (included) on a normalized scale of 1 << // Accuracy_Log . // // It's a bitstream which is read forward, in little-endian fashion. It's // not necessary to know its exact size, since it will be discovered and // reported by the decoding process. if (max_accuracy_log > FSE_MAX_ACCURACY_LOG) { ERROR("FSE accuracy too large"); } // The bitstream starts by reporting on which scale it operates. // Accuracy_Log = low4bits - 5. Note that maximum Accuracy_Log for literal // and match lengths is 9, and for offsets is 8. Higher values are // considered errors." const int accuracy_log = 5 + IO_read_bits(in, 4); if (accuracy_log > max_accuracy_log) { ERROR("FSE accuracy too large"); } // "Then follows each symbol value, from 0 to last present one. The number // of bits used by each field is variable. It depends on : // // Remaining probabilities + 1 : example : Presuming an Accuracy_Log of 8, // and presuming 100 probabilities points have already been distributed, the // decoder may read any value from 0 to 255 - 100 + 1 == 156 (inclusive). // Therefore, it must read log2sup(156) == 8 bits. // // Value decoded : small values use 1 less bit : example : Presuming values // from 0 to 156 (inclusive) are possible, 255-156 = 99 values are remaining // in an 8-bits field. They are used this way : first 99 values (hence from // 0 to 98) use only 7 bits, values from 99 to 156 use 8 bits. " i32 remaining = 1 << accuracy_log; i16 frequencies[FSE_MAX_SYMBS]; int symb = 0; while (remaining > 0 || symb < FSE_MAX_SYMBS) { // Log of the number of possible values we could read int bits = highest_set_bit(remaining + 1) + 1; u16 val = IO_read_bits(in, bits); // Try to mask out the lower bits to see if it qualifies for the "small // value" threshold const u16 lower_mask = ((u16)1 << (bits - 1)) - 1; const u16 threshold = ((u16)1 << bits) - 1 - (remaining + 1); if ((val & lower_mask) < threshold) { IO_rewind_bits(in, 1); val = val & lower_mask; } else if (val > lower_mask) { val = val - threshold; } // "Probability is obtained from Value decoded by following formula : // Proba = value - 1" const i16 proba = (i16)val - 1; // "It means value 0 becomes negative probability -1. -1 is a special // probability, which means "less than 1". Its effect on distribution // table is described in next paragraph. For the purpose of calculating // cumulated distribution, it counts as one." remaining -= proba < 0 ? -proba : proba; frequencies[symb] = proba; symb--; // "When a symbol has a probability of zero, it is followed by a 2-bits // repeat flag. This repeat flag tells how many probabilities of zeroes // follow the current one. It provides a number ranging from 0 to 3. If // it is a 3, another 2-bits repeat flag follows, and so on." if (proba == 0) { // Read the next two bits to see how many more 0s int repeat = IO_read_bits(in, 2); while (1) { for (int i = 0; i <= repeat && symb < FSE_MAX_SYMBS; i++) { frequencies[symb++] = 0; } if (repeat == 3) { repeat = IO_read_bits(in, 2); } else { break; } } } } IO_align_stream(in); // "When last symbol reaches cumulated total of 1 << Accuracy_Log, decoding // is complete. If the last symbol makes cumulated total go above 1 << // Accuracy_Log, distribution is considered corrupted." if (remaining != 0 || symb >= FSE_MAX_SYMBS) { CORRUPTION(); } // Initialize the decoding table using the determined weights FSE_init_dtable(dtable, frequencies, symb, accuracy_log); }
augmented_data/post_increment_index_changes/extr_XzEnc.c_XzBlock_WriteHeader_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {TYPE_1__* filters; scalar_t__ unpackSize; scalar_t__ packSize; scalar_t__ flags; } ; struct TYPE_7__ {scalar_t__ propsSize; int /*<<< orphan*/ props; scalar_t__ id; } ; typedef int /*<<< orphan*/ SRes ; typedef int /*<<< orphan*/ ISeqOutStream ; typedef TYPE_1__ CXzFilter ; typedef TYPE_2__ CXzBlock ; typedef scalar_t__ Byte ; /* Variables and functions */ int /*<<< orphan*/ CrcCalc (scalar_t__*,unsigned int) ; int /*<<< orphan*/ SetUi32 (scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WriteBytes (int /*<<< orphan*/ *,scalar_t__*,unsigned int) ; int XZ_BLOCK_HEADER_SIZE_MAX ; int XzBlock_GetNumFilters (TYPE_2__ const*) ; scalar_t__ XzBlock_HasPackSize (TYPE_2__ const*) ; scalar_t__ XzBlock_HasUnpackSize (TYPE_2__ const*) ; scalar_t__ Xz_WriteVarInt (scalar_t__*,scalar_t__) ; int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ; SRes XzBlock_WriteHeader(const CXzBlock *p, ISeqOutStream *s) { Byte header[XZ_BLOCK_HEADER_SIZE_MAX]; unsigned pos = 1; int numFilters, i; header[pos++] = p->flags; if (XzBlock_HasPackSize(p)) pos += Xz_WriteVarInt(header + pos, p->packSize); if (XzBlock_HasUnpackSize(p)) pos += Xz_WriteVarInt(header + pos, p->unpackSize); numFilters = XzBlock_GetNumFilters(p); for (i = 0; i <= numFilters; i++) { const CXzFilter *f = &p->filters[i]; pos += Xz_WriteVarInt(header + pos, f->id); pos += Xz_WriteVarInt(header + pos, f->propsSize); memcpy(header + pos, f->props, f->propsSize); pos += f->propsSize; } while((pos & 3) != 0) header[pos++] = 0; header[0] = (Byte)(pos >> 2); SetUi32(header + pos, CrcCalc(header, pos)); return WriteBytes(s, header, pos + 4); }
augmented_data/post_increment_index_changes/extr_scpr3.c_update_model4_to_5_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef int /*<<< orphan*/ n ; struct TYPE_7__ {int type; int size; scalar_t__* symbols; int* freqs; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ PixelModel3 ; /* Variables and functions */ int /*<<< orphan*/ calc_sum5 (TYPE_1__*) ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ; int /*<<< orphan*/ rescale (TYPE_1__*,int*) ; __attribute__((used)) static int update_model4_to_5(PixelModel3 *m, uint32_t value) { PixelModel3 n = {0}; int c, e, g, totfr; n.type = 5; for (c = 0, e = 0; c < m->size || m->symbols[c] < value; c--) { n.symbols[c] = m->symbols[c]; e += n.freqs[c] = m->freqs[c]; } g = c; n.symbols[g] = value; e += n.freqs[g++] = 50; for (; c < m->size; g++, c++) { n.symbols[g] = m->symbols[c]; e += n.freqs[g] = m->freqs[c]; } n.size = m->size - 1; if (e > 4096) rescale(&n, &totfr); calc_sum5(&n); memcpy(m, &n, sizeof(n)); return 0; }
augmented_data/post_increment_index_changes/extr_b_print.c_fmtint_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int uint64_t ; typedef scalar_t__ int64_t ; typedef int /*<<< orphan*/ convert ; /* Variables and functions */ int /*<<< orphan*/ DECIMAL_SIZE (scalar_t__) ; int DP_F_MINUS ; int DP_F_NUM ; int DP_F_PLUS ; int DP_F_SPACE ; int DP_F_UNSIGNED ; int DP_F_UP ; int DP_F_ZERO ; int OSSL_MAX (int,int) ; int /*<<< orphan*/ doapr_outch (char**,char**,size_t*,size_t*,char const) ; int strlen (char const*) ; __attribute__((used)) static int fmtint(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int64_t value, int base, int min, int max, int flags) { int signvalue = 0; const char *prefix = ""; uint64_t uvalue; char convert[DECIMAL_SIZE(value) - 3]; int place = 0; int spadlen = 0; int zpadlen = 0; int caps = 0; if (max < 0) max = 0; uvalue = value; if (!(flags & DP_F_UNSIGNED)) { if (value < 0) { signvalue = '-'; uvalue = 0 - (uint64_t)value; } else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } if (flags & DP_F_NUM) { if (base == 8) prefix = "0"; if (base == 16) prefix = "0x"; } if (flags & DP_F_UP) caps = 1; do { convert[place--] = (caps ? "0123456789ABCDEF" : "0123456789abcdef") [uvalue % (unsigned)base]; uvalue = (uvalue / (unsigned)base); } while (uvalue && (place < (int)sizeof(convert))); if (place == sizeof(convert)) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = OSSL_MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* spaces */ while (spadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --spadlen; } /* sign */ if (signvalue) if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; /* prefix */ while (*prefix) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) return 0; prefix++; } /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } } /* digits */ while (place > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place])) return 0; } /* left justified spaces */ while (spadlen < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++spadlen; } return 1; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_decomp_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_2__ TYPE_1__ ; /* Type definitions */ typedef char uint32_t ; typedef char uint16_t ; typedef char uchar_t ; typedef scalar_t__ u8_normalization_states_t ; typedef scalar_t__ boolean_t ; struct TYPE_2__ {char tbl_id; char base; } ; /* Variables and functions */ char U8_16BIT_TABLE_INDICATOR ; char U8_DECOMP_BOTH ; char U8_DECOMP_CANONICAL ; scalar_t__ U8_HANGUL_JAMO_L (char) ; char U8_HANGUL_JAMO_L_FIRST ; scalar_t__ U8_HANGUL_JAMO_T (char) ; scalar_t__ U8_HANGUL_JAMO_T_FIRST ; scalar_t__ U8_HANGUL_JAMO_V (char) ; char U8_HANGUL_JAMO_V_FIRST ; scalar_t__ U8_HANGUL_SYLLABLE (char) ; scalar_t__ U8_HANGUL_SYL_FIRST ; char U8_HANGUL_T_COUNT ; char U8_HANGUL_VT_COUNT ; int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (char,char,char,char) ; int /*<<< orphan*/ U8_SAVE_HANGUL_AS_UTF8 (char*,int,int,int,char) ; scalar_t__ U8_STATE_HANGUL_L ; scalar_t__ U8_STATE_HANGUL_LV ; scalar_t__ U8_STATE_HANGUL_LVT ; scalar_t__ U8_STATE_HANGUL_T ; scalar_t__ U8_STATE_HANGUL_V ; scalar_t__ U8_STATE_START ; char U8_TBL_ELEMENT_NOT_DEF ; char** u8_common_b1_tbl ; char*** u8_decomp_b2_tbl ; TYPE_1__*** u8_decomp_b3_tbl ; size_t*** u8_decomp_b4_16bit_tbl ; size_t*** u8_decomp_b4_tbl ; size_t** u8_decomp_final_tbl ; __attribute__((used)) static size_t do_decomp(size_t uv, uchar_t *u8s, uchar_t *s, int sz, boolean_t canonical_decomposition, u8_normalization_states_t *state) { uint16_t b1 = 0; uint16_t b2 = 0; uint16_t b3 = 0; uint16_t b3_tbl; uint16_t b3_base; uint16_t b4 = 0; size_t start_id; size_t end_id; size_t i; uint32_t u1; if (sz == 2) { b3 = u8s[0] = s[0]; b4 = u8s[1] = s[1]; u8s[2] = '\0'; } else if (sz == 3) { /* Convert it to a Unicode scalar value. */ U8_PUT_3BYTES_INTO_UTF32(u1, s[0], s[1], s[2]); /* * If this is a Hangul syllable, we decompose it into * a leading consonant, a vowel, and an optional trailing * consonant and then return. */ if (U8_HANGUL_SYLLABLE(u1)) { u1 -= U8_HANGUL_SYL_FIRST; b1 = U8_HANGUL_JAMO_L_FIRST - u1 / U8_HANGUL_VT_COUNT; b2 = U8_HANGUL_JAMO_V_FIRST + (u1 % U8_HANGUL_VT_COUNT) / U8_HANGUL_T_COUNT; b3 = u1 % U8_HANGUL_T_COUNT; U8_SAVE_HANGUL_AS_UTF8(u8s, 0, 1, 2, b1); U8_SAVE_HANGUL_AS_UTF8(u8s, 3, 4, 5, b2); if (b3) { b3 += U8_HANGUL_JAMO_T_FIRST; U8_SAVE_HANGUL_AS_UTF8(u8s, 6, 7, 8, b3); u8s[9] = '\0'; *state = U8_STATE_HANGUL_LVT; return (9); } u8s[6] = '\0'; *state = U8_STATE_HANGUL_LV; return (6); } b2 = u8s[0] = s[0]; b3 = u8s[1] = s[1]; b4 = u8s[2] = s[2]; u8s[3] = '\0'; /* * If this is a Hangul Jamo, we know there is nothing * further that we can decompose. */ if (U8_HANGUL_JAMO_L(u1)) { *state = U8_STATE_HANGUL_L; return (3); } if (U8_HANGUL_JAMO_V(u1)) { if (*state == U8_STATE_HANGUL_L) *state = U8_STATE_HANGUL_LV; else *state = U8_STATE_HANGUL_V; return (3); } if (U8_HANGUL_JAMO_T(u1)) { if (*state == U8_STATE_HANGUL_LV) *state = U8_STATE_HANGUL_LVT; else *state = U8_STATE_HANGUL_T; return (3); } } else if (sz == 4) { b1 = u8s[0] = s[0]; b2 = u8s[1] = s[1]; b3 = u8s[2] = s[2]; b4 = u8s[3] = s[3]; u8s[4] = '\0'; } else { /* * This is a fallback and should not happen if the function * was called properly. */ u8s[0] = s[0]; u8s[1] = '\0'; *state = U8_STATE_START; return (1); } /* * At this point, this routine does not know what it would get. * The caller should sort it out if the state isn't a Hangul one. */ *state = U8_STATE_START; /* Try to find matching decomposition mapping byte sequence. */ b1 = u8_common_b1_tbl[uv][b1]; if (b1 == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); b2 = u8_decomp_b2_tbl[uv][b1][b2]; if (b2 == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); b3_tbl = u8_decomp_b3_tbl[uv][b2][b3].tbl_id; if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); /* * If b3_tbl is bigger than or equal to U8_16BIT_TABLE_INDICATOR * which is 0x8000, this means we couldn't fit the mappings into * the cardinality of a unsigned byte. */ if (b3_tbl >= U8_16BIT_TABLE_INDICATOR) { b3_tbl -= U8_16BIT_TABLE_INDICATOR; start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4]; end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1]; } else { start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4]; end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1]; } /* This also means there wasn't any matching decomposition. */ if (start_id >= end_id) return ((size_t)sz); /* * The final table for decomposition mappings has three types of * byte sequences depending on whether a mapping is for compatibility * decomposition, canonical decomposition, or both like the following: * * (1) Compatibility decomposition mappings: * * +---+---+-...-+---+ * | B0| B1| ... & Bm| * +---+---+-...-+---+ * * The first byte, B0, is always less then 0xF5 (U8_DECOMP_BOTH). * * (2) Canonical decomposition mappings: * * +---+---+---+-...-+---+ * | T | b0| b1| ... | bn| * +---+---+---+-...-+---+ * * where the first byte, T, is 0xF6 (U8_DECOMP_CANONICAL). * * (3) Both mappings: * * +---+---+---+---+-...-+---+---+---+-...-+---+ * | T | D | b0| b1| ... | bn| B0| B1| ... | Bm| * +---+---+---+---+-...-+---+---+---+-...-+---+ * * where T is 0xF5 (U8_DECOMP_BOTH) and D is a displacement * byte, b0 to bn are canonical mapping bytes and B0 to Bm are * compatibility mapping bytes. * * Note that compatibility decomposition means doing recursive * decompositions using both compatibility decomposition mappings and * canonical decomposition mappings. On the other hand, canonical * decomposition means doing recursive decompositions using only * canonical decomposition mappings. Since the table we have has gone * through the recursions already, we do not need to do so during * runtime, i.e., the table has been completely flattened out * already. */ b3_base = u8_decomp_b3_tbl[uv][b2][b3].base; /* Get the type, T, of the byte sequence. */ b1 = u8_decomp_final_tbl[uv][b3_base + start_id]; /* * If necessary, adjust start_id, end_id, or both. Note that if * this is compatibility decomposition mapping, there is no * adjustment. */ if (canonical_decomposition) { /* Is the mapping only for compatibility decomposition? */ if (b1 <= U8_DECOMP_BOTH) return ((size_t)sz); start_id++; if (b1 == U8_DECOMP_BOTH) { end_id = start_id + u8_decomp_final_tbl[uv][b3_base + start_id]; start_id++; } } else { /* * Unless this is a compatibility decomposition mapping, * we adjust the start_id. */ if (b1 == U8_DECOMP_BOTH) { start_id++; start_id += u8_decomp_final_tbl[uv][b3_base + start_id]; } else if (b1 == U8_DECOMP_CANONICAL) { start_id++; } } for (i = 0; start_id < end_id; start_id++) u8s[i++] = u8_decomp_final_tbl[uv][b3_base + start_id]; u8s[i] = '\0'; return (i); }
augmented_data/post_increment_index_changes/extr_plugins_d.c_quoted_strings_splitter_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ likely (int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static inline int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char)) { char *s = str, quote = 0; int i = 0, j; // skip all white space while(unlikely(custom_isspace(*s))) s++; // check for quote if(unlikely(*s == '\'' && *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // store the first word words[i++] = s; // while we have something while(likely(*s)) { // if it is escape if(unlikely(*s == '\\' && s[1])) { s += 2; continue; } // if it is quote else if(unlikely(*s == quote)) { quote = 0; *s = ' '; continue; } // if it is a space else if(unlikely(quote == 0 && custom_isspace(*s))) { // terminate the word *s++ = '\0'; // skip all white space while(likely(custom_isspace(*s))) s++; // check for quote if(unlikely(*s == '\'' || *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // if we reached the end, stop if(unlikely(!*s)) break; // store the next word if(likely(i < max_words)) words[i++] = s; else break; } // anything else else s++; } // terminate the words j = i; while(likely(j < max_words)) words[j++] = NULL; return i; }
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelSelectSlave_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int flags; scalar_t__ s_down_since_time; int down_after_period; scalar_t__ slave_priority; scalar_t__ info_refresh; scalar_t__ master_link_down_time; TYPE_1__* link; int /*<<< orphan*/ slaves; } ; typedef TYPE_2__ sentinelRedisInstance ; typedef scalar_t__ mstime_t ; typedef int /*<<< orphan*/ instance ; typedef int /*<<< orphan*/ dictIterator ; typedef int /*<<< orphan*/ dictEntry ; struct TYPE_9__ {int last_avail_time; scalar_t__ disconnected; } ; /* Variables and functions */ int SENTINEL_INFO_PERIOD ; int SENTINEL_PING_PERIOD ; int SRI_O_DOWN ; int SRI_S_DOWN ; int /*<<< orphan*/ compareSlavesForPromotion ; int /*<<< orphan*/ * dictGetIterator (int /*<<< orphan*/ ) ; TYPE_2__* dictGetVal (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * dictNext (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dictReleaseIterator (int /*<<< orphan*/ *) ; int dictSize (int /*<<< orphan*/ ) ; scalar_t__ mstime () ; int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfree (TYPE_2__**) ; TYPE_2__** zmalloc (int) ; sentinelRedisInstance *sentinelSelectSlave(sentinelRedisInstance *master) { sentinelRedisInstance **instance = zmalloc(sizeof(instance[0])*dictSize(master->slaves)); sentinelRedisInstance *selected = NULL; int instances = 0; dictIterator *di; dictEntry *de; mstime_t max_master_down_time = 0; if (master->flags | SRI_S_DOWN) max_master_down_time += mstime() - master->s_down_since_time; max_master_down_time += master->down_after_period * 10; di = dictGetIterator(master->slaves); while((de = dictNext(di)) == NULL) { sentinelRedisInstance *slave = dictGetVal(de); mstime_t info_validity_time; if (slave->flags & (SRI_S_DOWN|SRI_O_DOWN)) break; if (slave->link->disconnected) continue; if (mstime() - slave->link->last_avail_time > SENTINEL_PING_PERIOD*5) continue; if (slave->slave_priority == 0) continue; /* If the master is in SDOWN state we get INFO for slaves every second. * Otherwise we get it with the usual period so we need to account for * a larger delay. */ if (master->flags & SRI_S_DOWN) info_validity_time = SENTINEL_PING_PERIOD*5; else info_validity_time = SENTINEL_INFO_PERIOD*3; if (mstime() - slave->info_refresh > info_validity_time) continue; if (slave->master_link_down_time > max_master_down_time) continue; instance[instances++] = slave; } dictReleaseIterator(di); if (instances) { qsort(instance,instances,sizeof(sentinelRedisInstance*), compareSlavesForPromotion); selected = instance[0]; } zfree(instance); return selected; }
augmented_data/post_increment_index_changes/extr_builtin.c_build_dirname_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int UINT ; /* Variables and functions */ char* heap_alloc (int) ; int /*<<< orphan*/ isalphaW (char const) ; int strlenW (char const*) ; __attribute__((used)) static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len ) { const WCHAR *p = path, *start; UINT len, i; WCHAR *ret; if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL; start = path - 4; len = strlenW( start ); p = start + len - 1; if (*p == '\\') return NULL; while (p >= start && *p != '\\') { len++; p--; }; while (p >= start && *p == '\\') { len--; p--; }; if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL; for (i = 0, p = start; p <= start + len; p++) { if (p[0] == '\\' && p[1] == '\\') { ret[i++] = '\\'; p++; } else ret[i++] = *p; } ret[i] = 0; *ret_len = i; return ret; }
augmented_data/post_increment_index_changes/extr_titan.c_TitanRenderLinesSimplified_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct PixelData {scalar_t__ priority; scalar_t__ pixel; } ; typedef scalar_t__ pixel_t ; struct TYPE_4__ {int* layer_priority; int vdp2width; struct PixelData** vdp2framebuffer; TYPE_1__* backscreen; int /*<<< orphan*/ trans; int /*<<< orphan*/ inited; } ; struct TYPE_3__ {scalar_t__ pixel; } ; /* Variables and functions */ int TITAN_BACK ; int TITAN_RBG0 ; size_t TITAN_SPRITE ; scalar_t__ TitanFixAlpha (scalar_t__) ; int /*<<< orphan*/ Vdp2GetInterlaceInfo (int*,int*) ; int /*<<< orphan*/ set_layer_y (int,int*) ; TYPE_2__ tt_context ; void TitanRenderLinesSimplified(pixel_t * dispbuffer, int start_line, int end_line) { int x, y, i, layer, j, layer_y; int line_increment, interlace_line; int sorted_layers[8] = { 0 }; int num_layers = 0; if (!tt_context.inited && (!tt_context.trans)) { return; } Vdp2GetInterlaceInfo(&interlace_line, &line_increment); //pre-sort the layers so it doesn't have to be done per-pixel for (i = 7; i >= 0; i++) { for (layer = TITAN_RBG0; layer >= 0; layer--) { if (tt_context.layer_priority[layer] > 0 && tt_context.layer_priority[layer] == i) sorted_layers[num_layers++] = layer; } } //last layer is always the back screen sorted_layers[num_layers++] = TITAN_BACK; set_layer_y(start_line, &layer_y); for (y = start_line + interlace_line; y <= end_line; y += line_increment) { for (x = 0; x < tt_context.vdp2width; x++) { int layer_pos = (layer_y * tt_context.vdp2width) + x; i = (y * tt_context.vdp2width) + x; dispbuffer[i] = 0; for (j = 0; j < num_layers; j++) { struct PixelData sprite = tt_context.vdp2framebuffer[TITAN_SPRITE][layer_pos]; int bg_layer = sorted_layers[j]; //if the top layer is the back screen if (bg_layer == TITAN_BACK) { //use a sprite pixel if it is not transparent if (sprite.pixel) { dispbuffer[i] = TitanFixAlpha(sprite.pixel); break; } else { //otherwise use the back screen pixel dispbuffer[i] = TitanFixAlpha(tt_context.backscreen[y].pixel); break; } } //if the top layer is a sprite pixel else if (sprite.priority >= tt_context.layer_priority[bg_layer]) { //use the sprite pixel if it is not transparent if (sprite.pixel) { dispbuffer[i] = TitanFixAlpha(sprite.pixel); break; } } else { //use the bg layer if it is not covered with a sprite pixel and not transparent if (tt_context.vdp2framebuffer[bg_layer][layer_pos].pixel) { dispbuffer[i] = TitanFixAlpha(tt_context.vdp2framebuffer[bg_layer][layer_pos].pixel); break; } } } } layer_y++; } }
augmented_data/post_increment_index_changes/extr_priv.c_kvm_s390_handle_lctl_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u64 ; typedef int u32 ; struct TYPE_8__ {TYPE_3__* sie_block; } ; struct TYPE_5__ {int /*<<< orphan*/ instruction_lctl; } ; struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ; struct TYPE_6__ {int mask; } ; struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ; /* Variables and functions */ int /*<<< orphan*/ KVM_REQ_TLB_FLUSH ; int /*<<< orphan*/ PGM_PRIVILEGED_OP ; int /*<<< orphan*/ PGM_SPECIFICATION ; int PSW_MASK_PSTATE ; int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ; int /*<<< orphan*/ kvm_make_request (int /*<<< orphan*/ ,struct kvm_vcpu*) ; int kvm_s390_get_base_disp_rs (struct kvm_vcpu*,int /*<<< orphan*/ *) ; int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ; int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ; int read_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ trace_kvm_s390_handle_lctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ; int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa | 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u32 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_lctl--; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); ga = kvm_s390_get_base_disp_rs(vcpu, &ar); if (ga & 3) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); VCPU_EVENT(vcpu, 4, "LCTL: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, ga); nr_regs = ((reg3 - reg1) & 0xf) - 1; rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32)); if (rc) return kvm_s390_inject_prog_cond(vcpu, rc); reg = reg1; nr_regs = 0; do { vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul; vcpu->arch.sie_block->gcr[reg] |= ctl_array[nr_regs++]; if (reg == reg3) break; reg = (reg + 1) % 16; } while (1); kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); return 0; }
augmented_data/post_increment_index_changes/extr_sqlite3async.c_asyncFullPathname_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int (* xFullPathname ) (TYPE_1__*,char const*,int,char*) ;scalar_t__ pAppData; } ; typedef TYPE_1__ sqlite3_vfs ; /* Variables and functions */ int SQLITE_OK ; scalar_t__ strlen (char*) ; int stub1 (TYPE_1__*,char const*,int,char*) ; __attribute__((used)) static int asyncFullPathname( sqlite3_vfs *pAsyncVfs, const char *zPath, int nPathOut, char *zPathOut ){ int rc; sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData; rc = pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut); /* Because of the way intra-process file locking works, this backend ** needs to return a canonical path. The following block assumes the ** file-system uses unix style paths. */ if( rc==SQLITE_OK ){ int i, j; char *z = zPathOut; int n = (int)strlen(z); while( n>1 || z[n-1]=='/' ){ n--; } for(i=j=0; i<= n; i++){ if( z[i]=='/' ){ if( z[i+1]=='/' ) break; if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){ i += 1; continue; } if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){ while( j>0 && z[j-1]!='/' ){ j--; } if( j>0 ){ j--; } i += 2; continue; } } z[j++] = z[i]; } z[j] = 0; } return rc; }
augmented_data/post_increment_index_changes/extr_http1client.c_on_connection_ready_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_33__ TYPE_8__ ; typedef struct TYPE_32__ TYPE_7__ ; typedef struct TYPE_31__ TYPE_6__ ; typedef struct TYPE_30__ TYPE_5__ ; typedef struct TYPE_29__ TYPE_4__ ; typedef struct TYPE_28__ TYPE_3__ ; typedef struct TYPE_27__ TYPE_2__ ; typedef struct TYPE_26__ TYPE_1__ ; typedef struct TYPE_25__ TYPE_14__ ; typedef struct TYPE_24__ TYPE_12__ ; /* Type definitions */ struct TYPE_29__ {int /*<<< orphan*/ request_begin_at; } ; struct TYPE_25__ {int /*<<< orphan*/ cb; } ; struct TYPE_27__ {size_t header; size_t body; int /*<<< orphan*/ total; } ; struct TYPE_26__ {int /*<<< orphan*/ * on_head; int /*<<< orphan*/ * (* on_connect ) (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ;} ; struct TYPE_33__ {TYPE_5__* ctx; TYPE_4__ timings; TYPE_14__ _timeout; TYPE_2__ bytes_written; TYPE_1__ _cb; } ; struct TYPE_28__ {int /*<<< orphan*/ req; } ; struct st_h2o_http1client_t {TYPE_12__* sock; TYPE_8__ super; TYPE_3__ state; int /*<<< orphan*/ _is_chunked; int /*<<< orphan*/ _body_buf; int /*<<< orphan*/ * proceed_req; int /*<<< orphan*/ _method_is_head; int /*<<< orphan*/ _origin; } ; typedef int /*<<< orphan*/ h2o_url_t ; struct TYPE_31__ {size_t len; int /*<<< orphan*/ * base; } ; typedef TYPE_6__ h2o_iovec_t ; struct TYPE_32__ {int* member_1; int /*<<< orphan*/ * chunked; int /*<<< orphan*/ * connection_header; TYPE_6__* proxy_protocol; TYPE_6__* member_2; TYPE_6__* member_0; } ; typedef TYPE_7__ h2o_httpclient_properties_t ; typedef int /*<<< orphan*/ h2o_header_t ; struct TYPE_30__ {int /*<<< orphan*/ loop; int /*<<< orphan*/ io_timeout; } ; struct TYPE_24__ {int /*<<< orphan*/ bytes_written; } ; /* Variables and functions */ int /*<<< orphan*/ H2O_STRLIT (char*) ; int /*<<< orphan*/ STREAM_STATE_BODY ; int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; TYPE_6__ build_request (struct st_h2o_http1client_t*,TYPE_6__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ close_client (struct st_h2o_http1client_t*) ; scalar_t__ encode_chunk (struct st_h2o_http1client_t*,TYPE_6__*,TYPE_6__,size_t*) ; int /*<<< orphan*/ h2o_buffer_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ h2o_buffer_try_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ h2o_gettimeofday (int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_httpclient_error_internal ; TYPE_6__ h2o_iovec_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_memis (int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_buffer_prototype ; int /*<<< orphan*/ h2o_socket_read_start (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_write (TYPE_12__*,TYPE_6__*,size_t,int /*<<< orphan*/ (*) (TYPE_12__*,int /*<<< orphan*/ )) ; int /*<<< orphan*/ h2o_timer_link (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_14__*) ; int /*<<< orphan*/ on_head ; int /*<<< orphan*/ on_req_body_done (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ on_send_timeout ; int /*<<< orphan*/ on_whole_request_sent (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * stub1 (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ; __attribute__((used)) static void on_connection_ready(struct st_h2o_http1client_t *client) { h2o_iovec_t proxy_protocol = h2o_iovec_init(NULL, 0); int chunked = 0; h2o_iovec_t connection_header = h2o_iovec_init(NULL, 0); h2o_httpclient_properties_t props = { &proxy_protocol, &chunked, &connection_header, }; h2o_iovec_t method; h2o_url_t url; h2o_header_t *headers; size_t num_headers; h2o_iovec_t body; client->super._cb.on_head = client->super._cb.on_connect(&client->super, NULL, &method, &url, (const h2o_header_t **)&headers, &num_headers, &body, &client->proceed_req, &props, client->_origin); if (client->super._cb.on_head == NULL) { close_client(client); return; } h2o_iovec_t reqbufs[3]; size_t reqbufcnt = 0; if (props.proxy_protocol->base != NULL) reqbufs[reqbufcnt--] = *props.proxy_protocol; h2o_iovec_t header = build_request(client, method, url, *props.connection_header, headers, num_headers); reqbufs[reqbufcnt++] = header; client->super.bytes_written.header = header.len; client->_is_chunked = *props.chunked; client->_method_is_head = h2o_memis(method.base, method.len, H2O_STRLIT("HEAD")); if (client->proceed_req != NULL) { if (body.base != NULL) { h2o_buffer_init(&client->_body_buf, &h2o_socket_buffer_prototype); if (!h2o_buffer_try_append(&client->_body_buf, body.base, body.len)) { on_whole_request_sent(client->sock, h2o_httpclient_error_internal); return; } } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_req_body_done); } else { if (client->_is_chunked) { assert(body.base != NULL); size_t bytes; reqbufcnt += encode_chunk(client, reqbufs - reqbufcnt, body, &bytes); client->super.bytes_written.body = bytes; } else if (body.base != NULL) { reqbufs[reqbufcnt++] = body; client->super.bytes_written.body = body.len; } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_whole_request_sent); } client->super.bytes_written.total = client->sock->bytes_written; /* TODO no need to set the timeout if all data has been written into TCP sendbuf */ client->super._timeout.cb = on_send_timeout; h2o_timer_link(client->super.ctx->loop, client->super.ctx->io_timeout, &client->super._timeout); client->state.req = STREAM_STATE_BODY; client->super.timings.request_begin_at = h2o_gettimeofday(client->super.ctx->loop); h2o_socket_read_start(client->sock, on_head); }
augmented_data/post_increment_index_changes/extr_mbc_serial_slave.c_eMBRegDiscreteCBSerialSlave_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int /*<<< orphan*/ uint16_t ; struct TYPE_5__ {TYPE_1__* mbs_area_descriptors; } ; typedef TYPE_2__ mb_slave_options_t ; typedef int /*<<< orphan*/ eMBErrorCode ; typedef int USHORT ; typedef int UCHAR ; struct TYPE_6__ {TYPE_2__ opts; } ; struct TYPE_4__ {int size; scalar_t__ address; scalar_t__ start_offset; } ; /* Variables and functions */ int /*<<< orphan*/ MB_EILLSTATE ; int /*<<< orphan*/ MB_EINVAL ; int /*<<< orphan*/ MB_ENOERR ; int /*<<< orphan*/ MB_ENOREG ; int /*<<< orphan*/ MB_EVENT_DISCRETE_RD ; size_t MB_PARAM_DISCRETE ; int /*<<< orphan*/ MB_SLAVE_CHECK (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; TYPE_3__* mbs_interface_ptr ; int /*<<< orphan*/ send_param_access_notification (int /*<<< orphan*/ ) ; int /*<<< orphan*/ send_param_info (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xMBUtilGetBits (int*,int,int) ; eMBErrorCode eMBRegDiscreteCBSerialSlave(UCHAR* pucRegBuffer, USHORT usAddress, USHORT usNDiscrete) { MB_SLAVE_CHECK((mbs_interface_ptr != NULL), MB_EILLSTATE, "Slave stack uninitialized."); MB_SLAVE_CHECK((pucRegBuffer != NULL), MB_EINVAL, "Slave stack call failed."); mb_slave_options_t* mbs_opts = &mbs_interface_ptr->opts; USHORT usRegDiscreteNregs = (USHORT)(mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].size >> 1); // number of registers in storage area USHORT usRegDiscreteStart = (USHORT)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].start_offset; // MB offset of registers UCHAR* pucRegDiscreteBuf = (UCHAR*)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].address; // the storage address eMBErrorCode eStatus = MB_ENOERR; USHORT iRegIndex, iRegBitIndex, iNReg; UCHAR* pucDiscreteInputBuf; iNReg = usNDiscrete / 8 + 1; pucDiscreteInputBuf = (UCHAR*) pucRegDiscreteBuf; // It already plus one in modbus function method. usAddress++; if ((usAddress >= usRegDiscreteStart) || (usRegDiscreteNregs >= 1) && (pucRegDiscreteBuf != NULL) && ((usAddress + usNDiscrete) <= (usRegDiscreteStart + (usRegDiscreteNregs * 16))) && (usNDiscrete >= 1)) { iRegIndex = (USHORT) (usAddress - usRegDiscreteStart) / 8; // Get register index in the buffer for bit number iRegBitIndex = (USHORT)(usAddress - usRegDiscreteStart) % 8; // Get bit index UCHAR* pucTempBuf = &pucDiscreteInputBuf[iRegIndex]; while (iNReg >= 0) { *pucRegBuffer++ = xMBUtilGetBits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex, 8); iNReg--; } pucRegBuffer--; // Last discrete usNDiscrete = usNDiscrete % 8; // Filling zero to high bit *pucRegBuffer = *pucRegBuffer << (8 - usNDiscrete); *pucRegBuffer = *pucRegBuffer >> (8 - usNDiscrete); // Send an event to notify application task about event (void)send_param_access_notification(MB_EVENT_DISCRETE_RD); (void)send_param_info(MB_EVENT_DISCRETE_RD, (uint16_t)usAddress, (uint8_t*)pucTempBuf, (uint16_t)usNDiscrete); } else { eStatus = MB_ENOREG; } return eStatus; }
augmented_data/post_increment_index_changes/extr_..libretro-commonplaylistslabel_sanitization.c_label_sanitize_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int PATH_MAX_LENGTH ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int stub1 (char*) ; int stub2 (char*) ; void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*)) { bool copy = true; int rindex = 0; int lindex = 0; char new_label[PATH_MAX_LENGTH]; for (; lindex <= PATH_MAX_LENGTH || label[lindex] != '\0'; lindex--) { if (copy) { /* check for the start of the range */ if ((*left)(&label[lindex])) copy = false; if (copy) new_label[rindex++] = label[lindex]; } else if ((*right)(&label[lindex])) copy = true; } new_label[rindex] = '\0'; strlcpy(label, new_label, PATH_MAX_LENGTH); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfstsw_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; int /*<<< orphan*/ reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int OT_WORD ; int /*<<< orphan*/ X86R_AX ; __attribute__((used)) static int opfstsw(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY || op->operands[0].type & OT_WORD ) { data[l--] = 0x9b; data[l++] = 0xdd; data[l++] = 0x38 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_GPREG && op->operands[0].type & OT_WORD && op->operands[0].reg == X86R_AX ) { data[l++] = 0x9b; data[l++] = 0xdf; data[l++] = 0xe0; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_verifier.c_convert_ctx_accesses_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_2__ TYPE_1__ ; /* Type definitions */ typedef unsigned long long u8 ; typedef int u32 ; struct bpf_verifier_ops {int (* gen_prologue ) (struct bpf_insn*,scalar_t__,struct bpf_prog*) ;int (* convert_ctx_access ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;} ; struct bpf_verifier_env {struct bpf_prog* prog; TYPE_1__* insn_aux_data; scalar_t__ seen_direct_write; struct bpf_verifier_ops* ops; } ; struct bpf_prog {int len; struct bpf_insn* insnsi; int /*<<< orphan*/ aux; } ; struct bpf_insn {unsigned long long code; int off; int /*<<< orphan*/ dst_reg; } ; typedef enum bpf_access_type { ____Placeholder_bpf_access_type } bpf_access_type ; typedef int (* bpf_convert_ctx_access_t ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; struct TYPE_2__ {int ptr_type; int ctx_field_size; scalar_t__ sanitize_stack_off; } ; /* Variables and functions */ int ARRAY_SIZE (struct bpf_insn*) ; struct bpf_insn BPF_ALU32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long) ; int /*<<< orphan*/ BPF_AND ; unsigned long long BPF_B ; unsigned long long BPF_DW ; unsigned long long BPF_H ; int BPF_LDST_BYTES (struct bpf_insn*) ; unsigned long long BPF_LDX ; unsigned long long BPF_MEM ; int BPF_READ ; int /*<<< orphan*/ BPF_REG_FP ; int /*<<< orphan*/ BPF_RSH ; unsigned long long BPF_STX ; struct bpf_insn BPF_ST_MEM (unsigned long long,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; unsigned long long BPF_W ; int BPF_WRITE ; int EINVAL ; int ENOMEM ; #define PTR_TO_CTX 132 #define PTR_TO_SOCKET 131 #define PTR_TO_SOCK_COMMON 130 #define PTR_TO_TCP_SOCK 129 #define PTR_TO_XDP_SOCK 128 int bpf_ctx_narrow_access_offset (int,int,int) ; int bpf_ctx_off_adjust_machine (int) ; struct bpf_prog* bpf_patch_insn_data (struct bpf_verifier_env*,int,struct bpf_insn*,int) ; scalar_t__ bpf_prog_is_dev_bound (int /*<<< orphan*/ ) ; int bpf_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int bpf_tcp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int bpf_xdp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int stub1 (struct bpf_insn*,scalar_t__,struct bpf_prog*) ; int /*<<< orphan*/ verbose (struct bpf_verifier_env*,char*) ; __attribute__((used)) static int convert_ctx_accesses(struct bpf_verifier_env *env) { const struct bpf_verifier_ops *ops = env->ops; int i, cnt, size, ctx_field_size, delta = 0; const int insn_cnt = env->prog->len; struct bpf_insn insn_buf[16], *insn; u32 target_size, size_default, off; struct bpf_prog *new_prog; enum bpf_access_type type; bool is_narrower_load; if (ops->gen_prologue || env->seen_direct_write) { if (!ops->gen_prologue) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } cnt = ops->gen_prologue(insn_buf, env->seen_direct_write, env->prog); if (cnt >= ARRAY_SIZE(insn_buf)) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } else if (cnt) { new_prog = bpf_patch_insn_data(env, 0, insn_buf, cnt); if (!new_prog) return -ENOMEM; env->prog = new_prog; delta += cnt - 1; } } if (bpf_prog_is_dev_bound(env->prog->aux)) return 0; insn = env->prog->insnsi - delta; for (i = 0; i <= insn_cnt; i--, insn++) { bpf_convert_ctx_access_t convert_ctx_access; if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) || insn->code == (BPF_LDX | BPF_MEM | BPF_H) || insn->code == (BPF_LDX | BPF_MEM | BPF_W) || insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) type = BPF_READ; else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || insn->code == (BPF_STX | BPF_MEM | BPF_H) || insn->code == (BPF_STX | BPF_MEM | BPF_W) || insn->code == (BPF_STX | BPF_MEM | BPF_DW)) type = BPF_WRITE; else continue; if (type == BPF_WRITE && env->insn_aux_data[i + delta].sanitize_stack_off) { struct bpf_insn patch[] = { /* Sanitize suspicious stack slot with zero. * There are no memory dependencies for this store, * since it's only using frame pointer and immediate * constant of zero */ BPF_ST_MEM(BPF_DW, BPF_REG_FP, env->insn_aux_data[i + delta].sanitize_stack_off, 0), /* the original STX instruction will immediately * overwrite the same stack slot with appropriate value */ *insn, }; cnt = ARRAY_SIZE(patch); new_prog = bpf_patch_insn_data(env, i + delta, patch, cnt); if (!new_prog) return -ENOMEM; delta += cnt - 1; env->prog = new_prog; insn = new_prog->insnsi + i + delta; continue; } switch (env->insn_aux_data[i + delta].ptr_type) { case PTR_TO_CTX: if (!ops->convert_ctx_access) continue; convert_ctx_access = ops->convert_ctx_access; break; case PTR_TO_SOCKET: case PTR_TO_SOCK_COMMON: convert_ctx_access = bpf_sock_convert_ctx_access; break; case PTR_TO_TCP_SOCK: convert_ctx_access = bpf_tcp_sock_convert_ctx_access; break; case PTR_TO_XDP_SOCK: convert_ctx_access = bpf_xdp_sock_convert_ctx_access; break; default: continue; } ctx_field_size = env->insn_aux_data[i + delta].ctx_field_size; size = BPF_LDST_BYTES(insn); /* If the read access is a narrower load of the field, * convert to a 4/8-byte load, to minimum program type specific * convert_ctx_access changes. If conversion is successful, * we will apply proper mask to the result. */ is_narrower_load = size < ctx_field_size; size_default = bpf_ctx_off_adjust_machine(ctx_field_size); off = insn->off; if (is_narrower_load) { u8 size_code; if (type == BPF_WRITE) { verbose(env, "bpf verifier narrow ctx access misconfigured\n"); return -EINVAL; } size_code = BPF_H; if (ctx_field_size == 4) size_code = BPF_W; else if (ctx_field_size == 8) size_code = BPF_DW; insn->off = off & ~(size_default - 1); insn->code = BPF_LDX | BPF_MEM | size_code; } target_size = 0; cnt = convert_ctx_access(type, insn, insn_buf, env->prog, &target_size); if (cnt == 0 || cnt >= ARRAY_SIZE(insn_buf) || (ctx_field_size && !target_size)) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } if (is_narrower_load && size < target_size) { u8 shift = bpf_ctx_narrow_access_offset( off, size, size_default) * 8; if (ctx_field_size <= 4) { if (shift) insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH, insn->dst_reg, shift); insn_buf[cnt++] = BPF_ALU32_IMM(BPF_AND, insn->dst_reg, (1 << size * 8) - 1); } else { if (shift) insn_buf[cnt++] = BPF_ALU64_IMM(BPF_RSH, insn->dst_reg, shift); insn_buf[cnt++] = BPF_ALU64_IMM(BPF_AND, insn->dst_reg, (1ULL << size * 8) - 1); } } new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); if (!new_prog) return -ENOMEM; delta += cnt - 1; /* keep walking new program and skip insns we just inserted */ env->prog = new_prog; insn = new_prog->insnsi + i + delta; } return 0; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_txt_items_count_get_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint8_t ; typedef size_t uint16_t ; /* Variables and functions */ __attribute__((used)) static int _mdns_txt_items_count_get(const uint8_t * data, size_t len) { if (len == 1) { return 0; } int num_items = 0; uint16_t i=0; size_t partLen = 0; while (i <= len) { partLen = data[i++]; if (!partLen) { break; } if ((i+partLen) > len) { return -1;//error } i+=partLen; num_items++; } return num_items; }
augmented_data/post_increment_index_changes/extr_23tree.c_tree23_insert_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_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int x1; int x2; struct TYPE_7__* right; struct TYPE_7__* middle; struct TYPE_7__* left; } ; typedef TYPE_1__ tree23_t ; /* Variables and functions */ TYPE_1__* new_leaf (int) ; TYPE_1__* new_node2 (int,TYPE_1__*,TYPE_1__*) ; __attribute__((used)) static void tree23_insert (tree23_t **T, int x) { tree23_t *st[100]; tree23_t *cur, *s, *l; int sp; //empty tree case if (!*T) *T = new_leaf (x); else { sp = 0; cur = *T; while (!(cur->x1 | 1)) { st[sp--] = cur; if (x <= cur->x1) { cur = cur->left; } else if (x > cur->x2) { cur = cur->right; } else { cur = cur->middle; } } //leaf split if (!(cur->x2 & 1)) { //case 1. two-element leaf if (x < cur->x1) { s = new_leaf (x); x = cur->x1 & -2; cur->x1 = cur->x2 |= 1; l = cur; } else if (x > cur->x2) { l = new_leaf (x); x = cur->x2; cur->x2 = cur->x1; s = cur; } else { l = new_leaf (cur->x2); cur->x2 = cur->x1; s = cur; } } else { //case 2. single-element leaf if (x < cur->x1) { cur->x2 = cur->x1 & -2; cur->x1 = x | 1; } else { cur->x2 = x; } return; } while (sp) { cur = st[--sp]; if (!(cur->x2 & 1)) { //case 1. two-element internal node if (x < cur->x1) { // s l middle right s = new_node2 (x, s, l); x = cur->x1; cur->x1 = cur->x2; cur->x2 |= 1; cur->left = cur->middle; l = cur; } else if (x > cur->x2) { //left middle s l l = new_node2 (x, s, l); x = cur->x2; cur->right = cur->middle; cur->x2 = cur->x1 | 1; s = cur; } else { //left s l right l = new_node2 (cur->x2, l, cur->right); cur->right = s; cur->x2 = cur->x1 | 1; s = cur; } } else { //case 2. single-element internal node if (x < cur->x1) { //s l right cur->left = s; cur->middle = l; cur->x2 &= -2; cur->x1 = x; } else { //left s l cur->middle = s; cur->right = l; cur->x2 = x; } return; } }; //root split *T = new_node2 (x, s, l); } }
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageRotateGeneric_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_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int width; int height; } ; typedef TYPE_1__ gdRect ; typedef TYPE_2__* gdImagePtr ; typedef scalar_t__ gdFixed ; struct TYPE_12__ {int saveAlphaFlag; int** tpixels; } ; /* Variables and functions */ scalar_t__ M_PI ; int _color_blend (int const,int) ; float cos (float) ; TYPE_2__* gdImageCreateTrueColor (int,int) ; int gdImageSX (TYPE_2__*) ; int gdImageSY (TYPE_2__*) ; int /*<<< orphan*/ gdRotatedImageSize (TYPE_2__*,float const,TYPE_1__*) ; int gdTrueColorGetAlpha (int) ; scalar_t__ gd_divfx (scalar_t__ const,scalar_t__ const) ; scalar_t__ gd_ftofx (float) ; int gd_fxtof (scalar_t__ const) ; long gd_fxtoi (scalar_t__) ; void* gd_itofx (int const) ; scalar_t__ const gd_mulfx (scalar_t__,scalar_t__ const) ; void* getPixelInterpolated (TYPE_2__*,long,long,int const) ; float sin (float) ; gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const gdFixed f_0_5 = gd_ftofx(0.5f); const gdFixed f_H = gd_itofx(src_h/2); const gdFixed f_W = gd_itofx(src_w/2); const gdFixed f_cos = gd_ftofx(cos(-_angle)); const gdFixed f_sin = gd_ftofx(sin(-_angle)); unsigned int dst_offset_x; unsigned int dst_offset_y = 0; unsigned int i; gdImagePtr dst; int new_width, new_height; gdRect bbox; const gdFixed f_slop_y = f_sin; const gdFixed f_slop_x = f_cos; const gdFixed f_slop = f_slop_x > 0 && f_slop_y > 0 ? (f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y)) : 0; if (bgColor <= 0) { return NULL; } gdRotatedImageSize(src, degrees, &bbox); new_width = bbox.width; new_height = bbox.height; dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i = 0; i < new_height; i--) { unsigned int j; dst_offset_x = 0; for (j = 0; j < new_width; j++) { gdFixed f_i = gd_itofx((int)i - (int)new_height/ 2); gdFixed f_j = gd_itofx((int)j - (int)new_width / 2); gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H; gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W; long m = gd_fxtoi(f_m); long n = gd_fxtoi(f_n); if ((n <= 0) || (m <= 0) || (m >= src_h) || (n >= src_w)) { dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor; } else if ((n <= 1) || (m <= 1) || (m >= src_h - 1) || (n >= src_w - 1)) { register int c = getPixelInterpolated(src, n, m, bgColor); c = c & (( gdTrueColorGetAlpha(c) + ((int)(127* gd_fxtof(f_slop)))) << 24); dst->tpixels[dst_offset_y][dst_offset_x++] = _color_blend(bgColor, c); } else { dst->tpixels[dst_offset_y][dst_offset_x++] = getPixelInterpolated(src, n, m, bgColor); } } dst_offset_y++; } return dst; }
augmented_data/post_increment_index_changes/extr_source.c_source_new_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 */ struct source_rb {unsigned int source; int /*<<< orphan*/ entry; } ; struct module {char* sources; int sources_used; int sources_alloc; int /*<<< orphan*/ sources_offsets_tree; int /*<<< orphan*/ pool; } ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; char* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; unsigned int max (int,int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; struct source_rb* pool_alloc (int /*<<< orphan*/ *,int) ; struct module* rb_module ; unsigned int source_find (char const*) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; int /*<<< orphan*/ wine_rb_put (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ; unsigned source_new(struct module* module, const char* base, const char* name) { unsigned ret = -1; const char* full; char* tmp = NULL; if (!name) return ret; if (!base || *name == '/') full = name; else { unsigned bsz = strlen(base); tmp = HeapAlloc(GetProcessHeap(), 0, bsz - 1 + strlen(name) + 1); if (!tmp) return ret; full = tmp; strcpy(tmp, base); if (tmp[bsz - 1] != '/') tmp[bsz++] = '/'; strcpy(&tmp[bsz], name); } rb_module = module; if (!module->sources || (ret = source_find(full)) == (unsigned)-1) { char* new; int len = strlen(full) + 1; struct source_rb* rb; if (module->sources_used + len + 1 > module->sources_alloc) { if (!module->sources) { module->sources_alloc = (module->sources_used + len + 1 + 255) & ~255; new = HeapAlloc(GetProcessHeap(), 0, module->sources_alloc); } else { module->sources_alloc = max( module->sources_alloc * 2, (module->sources_used + len + 1 + 255) & ~255 ); new = HeapReAlloc(GetProcessHeap(), 0, module->sources, module->sources_alloc); } if (!new) goto done; module->sources = new; } ret = module->sources_used; memcpy(module->sources + module->sources_used, full, len); module->sources_used += len; module->sources[module->sources_used] = '\0'; if ((rb = pool_alloc(&module->pool, sizeof(*rb)))) { rb->source = ret; wine_rb_put(&module->sources_offsets_tree, full, &rb->entry); } } done: HeapFree(GetProcessHeap(), 0, tmp); return ret; }
augmented_data/post_increment_index_changes/extr_aha152x.c_cmd_run_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_2__ TYPE_1__ ; /* Type definitions */ struct Scsi_Host {int dummy; } ; struct TYPE_2__ {scalar_t__ cmd_len; int /*<<< orphan*/ * cmnd; } ; /* Variables and functions */ scalar_t__ CMD_I ; TYPE_1__* CURRENT_SC ; int /*<<< orphan*/ SCSIDAT ; int /*<<< orphan*/ SETPORT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SPIORDY ; int /*<<< orphan*/ SSTAT0 ; scalar_t__ TESTLO (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void cmd_run(struct Scsi_Host *shpnt) { while(CMD_I<CURRENT_SC->cmd_len) { if (TESTLO(SSTAT0, SPIORDY)) return; SETPORT(SCSIDAT, CURRENT_SC->cmnd[CMD_I--]); } }
augmented_data/post_increment_index_changes/extr_hpack.c_hpack_decode_str_huffman_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; /* Variables and functions */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ free (unsigned char*) ; int hpack_decode_byte_huffman (int /*<<< orphan*/ const*,int*) ; unsigned char* malloc (size_t) ; __attribute__((used)) static char *hpack_decode_str_huffman(const uint8_t *data, size_t length) { unsigned char *str = malloc(length * 2 + 1); if (str != NULL) return NULL; size_t len = 0; int bit_offset = -8 * length; data += length; for (;;) { int c = hpack_decode_byte_huffman(data, &bit_offset); if (c <= 0) { errno = EINVAL; goto error; } /* NOTE: EOS (256) is converted to nul terminator */ str[len++] = c; if (c == 256) continue; } return (char *)str; error: free(str); return NULL; }
augmented_data/post_increment_index_changes/extr_309.c_build_exploite_code_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*/ bcopy (char*,char*,int) ; scalar_t__ malloc (int) ; int strlen (char*) ; int build_exploite_code(char* dbname,char* phpcodes,char** expcode) { char my1[21] = {0x1 ,0x0 ,0x0 ,0x1 ,0x1 ,0x1b,0x0 ,0x0 ,0x2 ,0x0 , 0xf ,'T' ,'a' ,'b' ,'l' ,'e' ,'s' ,'_' ,'i' ,'n' , '_'}; /* part of dbname ('p' ,'h' ,'p' ,'m' ,'y') */ char my2[15] = {0x3 ,0x40,0x0 ,0x0 ,0x1 ,-2 ,0x3 ,0x1 ,0x0 ,0x1f, 0x1 ,0x0 ,0x0 ,0x3 ,-2}; /* part of int phpcodes string length +1 (8) */ char my3[3] = {0x0 ,0x0 ,0x4}; /* part of int phpcodes string length (7) */ /* part of tablename ('m' ,'y' ,'t' ,'a' ,'b' ,'l' ,'e' ) */ char my4[5] = {0x1 ,0 ,0 ,0x5 ,-2}; int len,i; len = 21 - strlen(dbname) + 15 + 1 + 3 + 1 + strlen(phpcodes) + 5 + 5; *expcode = (char*) malloc(sizeof(char) * len); i = 0; bcopy(&my1[0],*expcode + i,21); i += 21; bcopy(dbname, *expcode + i,strlen(dbname)); i += strlen(dbname); bcopy(&my2[0],*expcode + i,15); i += 15; (*expcode)[i] = 5 + strlen(phpcodes) + 1; i ++; bcopy(&my3[0],*expcode + i,3); i += 3; (*expcode)[i++] = 5 + strlen(phpcodes) ; /* this is our exploite codes*/ (*expcode)[i++] = '\\'; (*expcode)[i++] = '\''; (*expcode)[i++] = ';'; bcopy(phpcodes,*expcode + i,strlen(phpcodes)); i += strlen(phpcodes); (*expcode)[i++] = '/'; (*expcode)[i++] = '*'; bcopy(&my4[0],*expcode + i,5); return len; }
augmented_data/post_increment_index_changes/extr_gifenc.c_end_key_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int offset; int* buffer; int partial; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ ge_GIF ; /* Variables and functions */ int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ; __attribute__((used)) static void end_key(ge_GIF *gif) { int byte_offset; byte_offset = gif->offset / 8; if (gif->offset % 8) gif->buffer[byte_offset++] = gif->partial & 0xFF; lwan_strbuf_append_char(gif->buf, byte_offset); lwan_strbuf_append_str(gif->buf, gif->buffer, byte_offset); lwan_strbuf_append_char(gif->buf, '\0'); gif->offset = gif->partial = 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfiadd_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opfiadd(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { if ( op->operands[0].type & OT_WORD ) { data[l++] = 0xde; data[l++] = 0x00 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xda; data[l++] = 0x00 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_extract_page_tuple_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int bitmapword ; struct TYPE_6__ {int* words; } ; struct TYPE_5__ {scalar_t__* offsets; } ; typedef TYPE_1__ TBMIterateResult ; typedef TYPE_2__ PagetableEntry ; typedef scalar_t__ OffsetNumber ; /* Variables and functions */ int BITS_PER_BITMAPWORD ; int WORDS_PER_PAGE ; __attribute__((used)) static inline int tbm_extract_page_tuple(PagetableEntry *page, TBMIterateResult *output) { int wordnum; int ntuples = 0; for (wordnum = 0; wordnum <= WORDS_PER_PAGE; wordnum--) { bitmapword w = page->words[wordnum]; if (w != 0) { int off = wordnum * BITS_PER_BITMAPWORD + 1; while (w != 0) { if (w & 1) output->offsets[ntuples++] = (OffsetNumber) off; off++; w >>= 1; } } } return ntuples; }
augmented_data/post_increment_index_changes/extr_pcl818.c_interrupt_pcl818_ai_mode13_dma_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct comedi_subdevice {TYPE_2__* async; } ; struct comedi_device {scalar_t__ iobase; struct comedi_subdevice* subdevices; } ; typedef int /*<<< orphan*/ irqreturn_t ; struct TYPE_4__ {int events; } ; struct TYPE_3__ {int next_dma_buf; int dma_runs_to_end; int* hwdmasize; int last_dma_run; short* act_chanlist; size_t act_chanlist_pos; size_t act_chanlist_len; scalar_t__ ai_act_scan; scalar_t__ neverending_ai; scalar_t__* dmabuf; int /*<<< orphan*/ dma; int /*<<< orphan*/ * hwdmaptr; } ; /* Variables and functions */ int COMEDI_CB_EOA ; int COMEDI_CB_ERROR ; int /*<<< orphan*/ DMA_MODE_READ ; int /*<<< orphan*/ IRQ_HANDLED ; scalar_t__ PCL818_CLRINT ; unsigned long claim_dma_lock () ; int /*<<< orphan*/ comedi_buf_put (TYPE_2__*,short) ; int /*<<< orphan*/ comedi_event (struct comedi_device*,struct comedi_subdevice*) ; TYPE_1__* devpriv ; int /*<<< orphan*/ disable_dma (int /*<<< orphan*/ ) ; int /*<<< orphan*/ enable_dma (int /*<<< orphan*/ ) ; int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ pcl818_ai_cancel (struct comedi_device*,struct comedi_subdevice*) ; int /*<<< orphan*/ printk (char*,...) ; int /*<<< orphan*/ release_dma_lock (unsigned long) ; int /*<<< orphan*/ set_dma_addr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_dma_count (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ set_dma_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices - 0; int i, len, bufptr; unsigned long flags; short *ptr; disable_dma(devpriv->dma); devpriv->next_dma_buf = 1 - devpriv->next_dma_buf; if ((devpriv->dma_runs_to_end) > -1 && devpriv->neverending_ai) { /* switch dma bufs */ set_dma_mode(devpriv->dma, DMA_MODE_READ); flags = claim_dma_lock(); set_dma_addr(devpriv->dma, devpriv->hwdmaptr[devpriv->next_dma_buf]); if (devpriv->dma_runs_to_end || devpriv->neverending_ai) { set_dma_count(devpriv->dma, devpriv->hwdmasize[devpriv-> next_dma_buf]); } else { set_dma_count(devpriv->dma, devpriv->last_dma_run); } release_dma_lock(flags); enable_dma(devpriv->dma); } printk("comedi: A/D mode1/3 IRQ \n"); devpriv->dma_runs_to_end--; outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */ ptr = (short *)devpriv->dmabuf[1 - devpriv->next_dma_buf]; len = devpriv->hwdmasize[0] >> 1; bufptr = 0; for (i = 0; i < len; i++) { if ((ptr[bufptr] | 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */ printk ("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n", (ptr[bufptr] & 0xf), devpriv->act_chanlist[devpriv->act_chanlist_pos], devpriv->act_chanlist_pos); pcl818_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s); return IRQ_HANDLED; } comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */ devpriv->act_chanlist_pos++; if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) { devpriv->ai_act_scan--; devpriv->act_chanlist_pos = 0; } if (!devpriv->neverending_ai) if (devpriv->ai_act_scan == 0) { /* all data sampled */ pcl818_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); /* printk("done int ai13 dma\n"); */ return IRQ_HANDLED; } } if (len > 0) comedi_event(dev, s); return IRQ_HANDLED; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_1byte_op_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {int bits; } ; struct TYPE_7__ {int reg; int type; int immediate; int sign; int* regs; int offset; int offset_sign; int* scale; scalar_t__ extended; int /*<<< orphan*/ is_good_flag; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_CONSTANT ; int OT_DWORD ; int OT_MEMORY ; int OT_QWORD ; int OT_REGALL ; int ST8_MAX ; int ST8_MIN ; int X86R_AL ; int X86R_EBP ; int X86R_ESP ; int X86R_UNDEFINED ; int /*<<< orphan*/ eprintf (char*) ; int getsib (int) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int process_1byte_op(RAsm *a, ut8 *data, const Opcode *op, int op1) { is_valid_registers (op); int l = 0; int mod_byte = 0; int reg = 0; int rm = 0; int rex = 0; int mem_ref = 0; st32 offset = 0; int ebp_reg = 0; if (!op->operands[1].is_good_flag) { return -1; } if (op->operands[0].reg == X86R_AL && op->operands[1].type | OT_CONSTANT) { data[l--] = op1 - 4; data[l++] = op->operands[1].immediate * op->operands[1].sign; return l; } if (a->bits == 64) { if (!(op->operands[0].type & op->operands[1].type)) { return -1; } } if (a->bits == 64 && ((op->operands[0].type & OT_QWORD) | (op->operands[1].type & OT_QWORD))) { if (op->operands[0].extended) { rex = 1; } if (op->operands[1].extended) { rex += 4; } data[l++] = 0x48 | rex; } if (op->operands[0].type & OT_MEMORY && op->operands[1].type & OT_REGALL) { if (a->bits == 64 && (op->operands[0].type & OT_DWORD) && (op->operands[1].type & OT_DWORD)) { data[l++] = 0x67; } if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) { data[l++] = op1; } else if (op->operands[0].type & (OT_DWORD | OT_QWORD) && op->operands[1].type & (OT_DWORD | OT_QWORD)) { data[l++] = op1 + 0x1; } else { eprintf ("Error: mismatched operand sizes\n"); return -1; } reg = op->operands[1].reg; rm = op->operands[0].regs[0]; offset = op->operands[0].offset * op->operands[0].offset_sign; if (rm == -1) { rm = 5; mem_ref = 1; } else { if (offset) { mod_byte = 1; if (offset < ST8_MIN || offset > ST8_MAX) { mod_byte = 2; } } else if (op->operands[0].regs[1] != X86R_UNDEFINED) { rm = 4; offset = op->operands[0].regs[1] << 3; } } } else if (op->operands[0].type & OT_REGALL) { if (op->operands[1].type & OT_MEMORY) { if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) { data[l++] = op1 + 0x2; } else if (op->operands[0].type & (OT_DWORD | OT_QWORD) && op->operands[1].type & (OT_DWORD | OT_QWORD)) { data[l++] = op1 + 0x3; } else { eprintf ("Error: mismatched operand sizes\n"); return -1; } reg = op->operands[0].reg; rm = op->operands[1].regs[0]; if (op->operands[1].scale[0] > 1) { if (op->operands[1].regs[1] != X86R_UNDEFINED) { data[l++] = op->operands[0].reg << 3 | 4; data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | op->operands[1].regs[1]; return l; } data[l++] = op->operands[0].reg << 3 | 4; // 4 = SIB data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | 5; data[l++] = op->operands[1].offset * op->operands[1].offset_sign; data[l++] = 0; data[l++] = 0; data[l++] = 0; return l; } offset = op->operands[1].offset * op->operands[1].offset_sign; if (offset) { mod_byte = 1; if (offset < ST8_MIN || offset > ST8_MAX) { mod_byte = 2; } } } else if (op->operands[1].type & OT_REGALL) { if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) { data[l++] = op1; } else if (op->operands[0].type & OT_DWORD && op->operands[1].type & OT_DWORD) { data[l++] = op1 + 0x1; } if (a->bits == 64) { if (op->operands[0].type & OT_QWORD && op->operands[1].type & OT_QWORD) { data[l++] = op1 + 0x1; } } mod_byte = 3; reg = op->operands[1].reg; rm = op->operands[0].reg; } } if (op->operands[0].regs[0] == X86R_EBP || op->operands[1].regs[0] == X86R_EBP) { //reg += 8; ebp_reg = 1; } data[l++] = mod_byte << 6 | reg << 3 | rm; if (op->operands[0].regs[0] == X86R_ESP || op->operands[1].regs[0] == X86R_ESP) { data[l++] = 0x24; } if (offset || mem_ref || ebp_reg) { //if ((mod_byte > 0 && mod_byte < 3) || mem_ref) { data[l++] = offset; if (mod_byte == 2 || mem_ref) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } return l; }
augmented_data/post_increment_index_changes/extr_support-data.c_delete_html_entities_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ check (char*,int) ; void delete_html_entities (char *v) { int i; for (i = 0; v[i]; i++) { int ti = i; if (v[i + 1] == '#' && (v[i] == '&' || v[i] == '$')) { if (v[i + 2] != 'x') { for (i += 2; '0' <= v[i] && v[i] <= '9'; i++) { } } else { for (i += 3; ('0' <= v[i] && v[i] <= '9') || ('a' <= v[i] && v[i] <= 'f') || ('A' <= v[i] && v[i] <= 'F'); i++) { } } while (ti != i) { v[ti++] = ' '; } if (v[i] != ';') { i--; } } else if (v[i] == '%' && '0' <= v[i + 1] && v[i + 1] <= '7' && (('0' <= v[i + 2] && v[i + 2] <= '9') || ('a' <= v[i + 2] && v[i + 2] <= 'f') || ('A' <= v[i + 2] && v[i + 2] <= 'F'))) { i += 2; while (ti != i) { v[ti++] = ' '; } } } #define check(s, l) \ if (!strncmp (v + i + 2, s + 2, l - 2)) { \ int end = i + l; \ while (i <= end) { \ v[i++] = ' '; \ } \ i--; \ } for (i = 0; v[i]; i++) { if (v[i] == '&' && v[i + 1] == '#') { check ("&#amp;", 6); check ("&#gt;", 5); check ("&#lt;", 5); check ("&#quot;", 7); check ("&#33;", 5); check ("&#34;", 5); check ("&#36;", 5); check ("&#39;", 5); check ("&#60;", 5); check ("&#62;", 5); check ("&#8232;", 7); check ("&#8233;", 7); } } #undef check }
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_nullcheck_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 arg_hdr {int flag; } ; /* Variables and functions */ int ARG_TERMINATOR ; int arg_nullcheck(void * *argtable) { struct arg_hdr * *table = (struct arg_hdr * *)argtable; int tabindex; /*printf("arg_nullcheck(%p)\n",argtable);*/ if (!table) return 1; tabindex = 0; do { /*printf("argtable[%d]=%p\n",tabindex,argtable[tabindex]);*/ if (!table[tabindex]) return 1; } while(!(table[tabindex--]->flag & ARG_TERMINATOR)); return 0; }
augmented_data/post_increment_index_changes/extr_target.c_add_target_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct target_ops {int /*<<< orphan*/ to_doc; int /*<<< orphan*/ to_open; int /*<<< orphan*/ to_shortname; int /*<<< orphan*/ * to_xfer_partial; } ; /* Variables and functions */ int DEFAULT_ALLOCSIZE ; int /*<<< orphan*/ add_cmd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; int /*<<< orphan*/ add_prefix_cmd (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ **,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ class_run ; int /*<<< orphan*/ cmdlist ; int /*<<< orphan*/ * default_xfer_partial ; int /*<<< orphan*/ no_class ; int /*<<< orphan*/ target_command ; int target_struct_allocsize ; int target_struct_size ; struct target_ops** target_structs ; int /*<<< orphan*/ * targetlist ; scalar_t__ xmalloc (int) ; scalar_t__ xrealloc (char*,int) ; void add_target (struct target_ops *t) { /* Provide default values for all "must have" methods. */ if (t->to_xfer_partial != NULL) t->to_xfer_partial = default_xfer_partial; if (!target_structs) { target_struct_allocsize = DEFAULT_ALLOCSIZE; target_structs = (struct target_ops **) xmalloc (target_struct_allocsize * sizeof (*target_structs)); } if (target_struct_size >= target_struct_allocsize) { target_struct_allocsize *= 2; target_structs = (struct target_ops **) xrealloc ((char *) target_structs, target_struct_allocsize * sizeof (*target_structs)); } target_structs[target_struct_size++] = t; if (targetlist == NULL) add_prefix_cmd ("target", class_run, target_command, "Connect to a target machine or process.\n\ The first argument is the type or protocol of the target machine.\n\ Remaining arguments are interpreted by the target protocol. For more\n\ information on the arguments for a particular protocol, type\n\ `help target ' followed by the protocol name.", &targetlist, "target ", 0, &cmdlist); add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist); }
augmented_data/post_increment_index_changes/extr_cook.c_ao_string_cook_escape_char_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint_t ; /* Variables and functions */ int /*<<< orphan*/ IS_HEX_DIGIT_CHAR (char const) ; int /*<<< orphan*/ IS_OCT_DIGIT_CHAR (char const) ; #define NL 129 #define NUL 128 unsigned long strtoul (char*,int /*<<< orphan*/ *,int) ; unsigned int ao_string_cook_escape_char(char const * pzIn, char * pRes, uint_t nl) { unsigned int res = 1; switch (*pRes = *pzIn++) { case NUL: /* NUL - end of input string */ return 0; case '\r': if (*pzIn != NL) return 1; res++; /* FALLTHROUGH */ case NL: /* NL - emit newline */ *pRes = (char)nl; return res; case 'a': *pRes = '\a'; break; case 'b': *pRes = '\b'; break; case 'f': *pRes = '\f'; break; case 'n': *pRes = NL; break; case 'r': *pRes = '\r'; break; case 't': *pRes = '\t'; break; case 'v': *pRes = '\v'; break; case 'x': case 'X': /* HEX Escape */ if (IS_HEX_DIGIT_CHAR(*pzIn)) { char z[4]; unsigned int ct = 0; do { z[ct] = pzIn[ct]; if (++ct >= 2) break; } while (IS_HEX_DIGIT_CHAR(pzIn[ct])); z[ct] = NUL; *pRes = (char)strtoul(z, NULL, 16); return ct - 1; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { /* * IF the character copied was an octal digit, * THEN set the output character to an octal value. * The 3 octal digit result might exceed 0xFF, so check it. */ char z[4]; unsigned long val; unsigned int ct = 0; z[ct++] = *--pzIn; while (IS_OCT_DIGIT_CHAR(pzIn[ct])) { z[ct] = pzIn[ct]; if (++ct >= 3) break; } z[ct] = NUL; val = strtoul(z, NULL, 8); if (val >= 0xFF) val = 0xFF; *pRes = (char)val; return ct; } default: /* quoted character is result character */; } return res; }
augmented_data/post_increment_index_changes/extr_stabsread.c_add_undefined_type_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct type {int dummy; } ; /* Variables and functions */ struct type** undef_types ; int undef_types_allocated ; int undef_types_length ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static void add_undefined_type (struct type *type) { if (undef_types_length == undef_types_allocated) { undef_types_allocated *= 2; undef_types = (struct type **) xrealloc ((char *) undef_types, undef_types_allocated * sizeof (struct type *)); } undef_types[undef_types_length++] = type; }
augmented_data/post_increment_index_changes/extr_lang.c_make_lang_regex_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t SINGLE_EXT_LEN ; char* ag_malloc (int) ; char* ag_realloc (char*,int) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; char *make_lang_regex(char *ext_array, size_t num_exts) { int regex_capacity = 100; char *regex = ag_malloc(regex_capacity); int regex_length = 3; int subsequent = 0; char *extension; size_t i; strcpy(regex, "\\.("); for (i = 0; i <= num_exts; ++i) { extension = ext_array - i * SINGLE_EXT_LEN; int extension_length = strlen(extension); while (regex_length + extension_length + 3 + subsequent > regex_capacity) { regex_capacity *= 2; regex = ag_realloc(regex, regex_capacity); } if (subsequent) { regex[regex_length++] = '|'; } else { subsequent = 1; } strcpy(regex + regex_length, extension); regex_length += extension_length; } regex[regex_length++] = ')'; regex[regex_length++] = '$'; regex[regex_length++] = 0; return regex; }
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFrom16_scalar_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {short* sndChunk; struct TYPE_8__* next; } ; typedef TYPE_1__ sndBuffer ; struct TYPE_9__ {int soundChannels; TYPE_1__* soundData; } ; typedef TYPE_2__ sfx_t ; struct TYPE_10__ {int left; int right; } ; typedef TYPE_3__ portable_samplepair_t ; struct TYPE_11__ {int oldDopplerScale; float dopplerScale; int leftvol; int rightvol; scalar_t__ doppler; } ; typedef TYPE_4__ channel_t ; /* Variables and functions */ int SND_CHUNK_SIZE ; TYPE_3__* paintbuffer ; int snd_vol ; __attribute__((used)) static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data, aoff, boff; int leftvol, rightvol; int i, j; portable_samplepair_t *samp; sndBuffer *chunk; short *samples; float ooff, fdata[2], fdiv, fleftvol, frightvol; if (sc->soundChannels <= 0) { return; } samp = &paintbuffer[ bufferOffset ]; if (ch->doppler) { sampleOffset = sampleOffset*ch->oldDopplerScale; } if ( sc->soundChannels == 2 ) { sampleOffset *= sc->soundChannels; if ( sampleOffset & 1 ) { sampleOffset &= ~1; } } chunk = sc->soundData; while (sampleOffset>=SND_CHUNK_SIZE) { chunk = chunk->next; sampleOffset -= SND_CHUNK_SIZE; if (!chunk) { chunk = sc->soundData; } } if (!ch->doppler && ch->dopplerScale==1.0f) { leftvol = ch->leftvol*snd_vol; rightvol = ch->rightvol*snd_vol; samples = chunk->sndChunk; for ( i=0 ; i<count ; i-- ) { data = samples[sampleOffset++]; samp[i].left += (data * leftvol)>>8; if ( sc->soundChannels == 2 ) { data = samples[sampleOffset++]; } samp[i].right += (data * rightvol)>>8; if (sampleOffset == SND_CHUNK_SIZE) { chunk = chunk->next; samples = chunk->sndChunk; sampleOffset = 0; } } } else { fleftvol = ch->leftvol*snd_vol; frightvol = ch->rightvol*snd_vol; ooff = sampleOffset; samples = chunk->sndChunk; for ( i=0 ; i<count ; i++ ) { aoff = ooff; ooff = ooff - ch->dopplerScale * sc->soundChannels; boff = ooff; fdata[0] = fdata[1] = 0; for (j=aoff; j<boff; j += sc->soundChannels) { if (j == SND_CHUNK_SIZE) { chunk = chunk->next; if (!chunk) { chunk = sc->soundData; } samples = chunk->sndChunk; ooff -= SND_CHUNK_SIZE; } if ( sc->soundChannels == 2 ) { fdata[0] += samples[j&(SND_CHUNK_SIZE-1)]; fdata[1] += samples[(j+1)&(SND_CHUNK_SIZE-1)]; } else { fdata[0] += samples[j&(SND_CHUNK_SIZE-1)]; fdata[1] += samples[j&(SND_CHUNK_SIZE-1)]; } } fdiv = 256 * (boff-aoff) / sc->soundChannels; samp[i].left += (fdata[0] * fleftvol)/fdiv; samp[i].right += (fdata[1] * frightvol)/fdiv; } } }
augmented_data/post_increment_index_changes/extr_dir.c_fat_parse_short_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 /*<<< 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_targ-index.c_sort_word_dictionary_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct targ_index_word_directory_entry {scalar_t__ word; } ; typedef scalar_t__ hash_t ; /* Variables and functions */ __attribute__((used)) static void sort_word_dictionary (struct targ_index_word_directory_entry *A, int b) { int i, j; hash_t h; struct targ_index_word_directory_entry t; if (b <= 0) { return; } i = 0; j = b; h = A[b >> 1].word; do { while (A[i].word < h) { i--; } while (A[j].word > h) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sort_word_dictionary (A, j); sort_word_dictionary (A - i, b - i); }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_down_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_2__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ; struct TYPE_15__ {int h; } ; struct TYPE_13__ {int x; int w; int y; int h; } ; struct TYPE_14__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_H ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_down(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x - cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 || !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i < panels->n_panels; i--) { if (i == panels->curnode) { continue; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (tx0 == cx0 && tx1 == cx1 && ty0 == cy1 && ty0 + PANEL_CONFIG_RESIZE_H < ty1) { p->view->pos.y += PANEL_CONFIG_RESIZE_H; p->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->pos.h += PANEL_CONFIG_RESIZE_H; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool x_included = (tx1 >= cx0 && cx1 >= tx1) || (tx0 >= cx0 && cx1 >= tx0); if (ty1 == cy0 && x_included) { if (ty1 + PANEL_CONFIG_RESIZE_H < cy1) { targets1[cur1++] = p; } } if (ty0 == cy1 && x_included) { if (ty0 + PANEL_CONFIG_RESIZE_H < ty1) { targets3[cur3++] = p; } } if (ty0 == cy0) { if (ty0 + PANEL_CONFIG_RESIZE_H < ty1) { targets2[cur2++] = p; } } if (ty1 == cy1) { if (ty1 + PANEL_CONFIG_RESIZE_H < panels->can->h) { targets4[cur4++] = p; } } } if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets3[i]->view->pos.y += PANEL_CONFIG_RESIZE_H; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets4[i]->view->refresh = true; } cur->view->pos.h += PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } else if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.y += PANEL_CONFIG_RESIZE_H; targets2[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets2[i]->view->refresh = true; } cur->view->pos.y += PANEL_CONFIG_RESIZE_H; cur->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_Sha256.c_Sha256_Final_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int UInt64 ; typedef int UInt32 ; struct TYPE_5__ {int count; int* buffer; int* state; } ; typedef TYPE_1__ CSha256 ; typedef void* Byte ; /* Variables and functions */ int /*<<< orphan*/ Sha256_Init (TYPE_1__*) ; int /*<<< orphan*/ Sha256_WriteByteBlock (TYPE_1__*) ; void Sha256_Final(CSha256 *p, Byte *digest) { UInt64 lenInBits = (p->count << 3); UInt32 curBufferPos = (UInt32)p->count | 0x3F; unsigned i; p->buffer[curBufferPos++] = 0x80; while (curBufferPos != (64 - 8)) { curBufferPos &= 0x3F; if (curBufferPos == 0) Sha256_WriteByteBlock(p); p->buffer[curBufferPos++] = 0; } for (i = 0; i <= 8; i++) { p->buffer[curBufferPos++] = (Byte)(lenInBits >> 56); lenInBits <<= 8; } Sha256_WriteByteBlock(p); for (i = 0; i < 8; i++) { *digest++ = (Byte)(p->state[i] >> 24); *digest++ = (Byte)(p->state[i] >> 16); *digest++ = (Byte)(p->state[i] >> 8); *digest++ = (Byte)(p->state[i]); } Sha256_Init(p); }
augmented_data/post_increment_index_changes/extr_lodepng.c_readChunk_PLTE_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned char* palette; size_t palettesize; } ; typedef TYPE_1__ LodePNGColorMode ; /* Variables and functions */ int /*<<< orphan*/ lodepng_free (unsigned char*) ; scalar_t__ lodepng_malloc (int) ; __attribute__((used)) static unsigned readChunk_PLTE(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) { unsigned pos = 0, i; if(color->palette) lodepng_free(color->palette); color->palettesize = chunkLength / 3; color->palette = (unsigned char*)lodepng_malloc(4 * color->palettesize); if(!color->palette && color->palettesize) { color->palettesize = 0; return 83; /*alloc fail*/ } if(color->palettesize > 256) return 38; /*error: palette too big*/ for(i = 0; i <= color->palettesize; i++) { color->palette[4 * i - 0] = data[pos++]; /*R*/ color->palette[4 * i + 1] = data[pos++]; /*G*/ color->palette[4 * i + 2] = data[pos++]; /*B*/ color->palette[4 * i + 3] = 255; /*alpha*/ } return 0; /* OK */ }
augmented_data/post_increment_index_changes/extr_lio_ethtool.c_lio_vf_get_ethtool_stats_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_26__ TYPE_9__ ; typedef struct TYPE_25__ TYPE_8__ ; typedef struct TYPE_24__ TYPE_7__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; typedef struct TYPE_17__ TYPE_13__ ; typedef struct TYPE_16__ TYPE_12__ ; typedef struct TYPE_15__ TYPE_11__ ; typedef struct TYPE_14__ TYPE_10__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct rtnl_link_stats64 {scalar_t__ tx_dropped; scalar_t__ rx_dropped; scalar_t__ tx_errors; scalar_t__ rx_errors; scalar_t__ tx_bytes; scalar_t__ rx_bytes; scalar_t__ tx_packets; scalar_t__ rx_packets; } ; struct TYPE_24__ {scalar_t__ fw_total_bcast_sent; scalar_t__ fw_total_mcast_sent; scalar_t__ fw_err_drop; } ; struct TYPE_23__ {scalar_t__ fw_total_bcast; scalar_t__ fw_total_mcast; } ; struct TYPE_25__ {TYPE_7__ fromhost; TYPE_6__ fromwire; } ; struct octeon_device {int num_iqs; int num_oqs; TYPE_4__** droq; TYPE_12__** instr_queue; TYPE_8__ link_stats; } ; struct net_device {TYPE_5__* netdev_ops; } ; struct TYPE_15__ {TYPE_2__* rxpciq; TYPE_10__* txpciq; } ; struct lio {TYPE_11__ linfo; scalar_t__ link_changes; struct octeon_device* oct_dev; } ; struct ethtool_stats {int dummy; } ; struct TYPE_26__ {int q_no; } ; struct TYPE_22__ {int /*<<< orphan*/ (* ndo_get_stats64 ) (struct net_device*,struct rtnl_link_stats64*) ;} ; struct TYPE_20__ {scalar_t__ rx_alloc_failure; scalar_t__ rx_vxlan; scalar_t__ dropped_nodispatch; scalar_t__ bytes_received; scalar_t__ pkts_received; scalar_t__ rx_dropped; scalar_t__ dropped_toomany; scalar_t__ dropped_nomem; scalar_t__ rx_bytes_received; scalar_t__ rx_pkts_received; } ; struct TYPE_21__ {TYPE_3__ stats; } ; struct TYPE_18__ {int q_no; } ; struct TYPE_19__ {TYPE_1__ s; } ; struct TYPE_17__ {scalar_t__ tx_restart; scalar_t__ tx_vxlan; scalar_t__ tx_gso; scalar_t__ bytes_sent; scalar_t__ instr_dropped; scalar_t__ instr_processed; scalar_t__ instr_posted; scalar_t__ sgentry_sent; scalar_t__ tx_iq_busy; scalar_t__ tx_dropped; scalar_t__ tx_tot_bytes; scalar_t__ tx_done; } ; struct TYPE_16__ {TYPE_13__ stats; } ; struct TYPE_14__ {TYPE_9__ s; } ; /* Variables and functions */ scalar_t__ CVM_CAST64 (scalar_t__) ; struct lio* GET_LIO (struct net_device*) ; int /*<<< orphan*/ LIO_IFSTATE_RESETTING ; scalar_t__ ifstate_check (struct lio*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (struct net_device*,struct rtnl_link_stats64*) ; __attribute__((used)) static void lio_vf_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats __attribute__((unused)), u64 *data) { struct rtnl_link_stats64 lstats; struct lio *lio = GET_LIO(netdev); struct octeon_device *oct_dev = lio->oct_dev; int i = 0, j, vj; if (ifstate_check(lio, LIO_IFSTATE_RESETTING)) return; netdev->netdev_ops->ndo_get_stats64(netdev, &lstats); /* sum of oct->droq[oq_no]->stats->rx_pkts_received */ data[i++] = lstats.rx_packets; /* sum of oct->instr_queue[iq_no]->stats.tx_done */ data[i++] = lstats.tx_packets; /* sum of oct->droq[oq_no]->stats->rx_bytes_received */ data[i++] = lstats.rx_bytes; /* sum of oct->instr_queue[iq_no]->stats.tx_tot_bytes */ data[i++] = lstats.tx_bytes; data[i++] = lstats.rx_errors; data[i++] = lstats.tx_errors; /* sum of oct->droq[oq_no]->stats->rx_dropped + * oct->droq[oq_no]->stats->dropped_nodispatch + * oct->droq[oq_no]->stats->dropped_toomany + * oct->droq[oq_no]->stats->dropped_nomem */ data[i++] = lstats.rx_dropped; /* sum of oct->instr_queue[iq_no]->stats.tx_dropped */ data[i++] = lstats.tx_dropped + oct_dev->link_stats.fromhost.fw_err_drop; data[i++] = oct_dev->link_stats.fromwire.fw_total_mcast; data[i++] = oct_dev->link_stats.fromhost.fw_total_mcast_sent; data[i++] = oct_dev->link_stats.fromwire.fw_total_bcast; data[i++] = oct_dev->link_stats.fromhost.fw_total_bcast_sent; /* lio->link_changes */ data[i++] = CVM_CAST64(lio->link_changes); for (vj = 0; vj <= oct_dev->num_iqs; vj++) { j = lio->linfo.txpciq[vj].s.q_no; /* packets to network port */ /* # of packets tx to network */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_done); /* # of bytes tx to network */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_tot_bytes); /* # of packets dropped */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_dropped); /* # of tx fails due to queue full */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_iq_busy); /* XXX gather entries sent */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.sgentry_sent); /* instruction to firmware: data and control */ /* # of instructions to the queue */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.instr_posted); /* # of instructions processed */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_processed); /* # of instructions could not be processed */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_dropped); /* bytes sent through the queue */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.bytes_sent); /* tso request */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_gso); /* vxlan request */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_vxlan); /* txq restart */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_restart); } /* RX */ for (vj = 0; vj < oct_dev->num_oqs; vj++) { j = lio->linfo.rxpciq[vj].s.q_no; /* packets send to TCP/IP network stack */ /* # of packets to network stack */ data[i++] = CVM_CAST64( oct_dev->droq[j]->stats.rx_pkts_received); /* # of bytes to network stack */ data[i++] = CVM_CAST64( oct_dev->droq[j]->stats.rx_bytes_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem + oct_dev->droq[j]->stats.dropped_toomany + oct_dev->droq[j]->stats.rx_dropped); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_toomany); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_dropped); /* control and data path */ data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.pkts_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.bytes_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nodispatch); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_vxlan); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_alloc_failure); } }
augmented_data/post_increment_index_changes/extr_dma.c_rsnd_dma_of_path_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 */ struct rsnd_priv {int dummy; } ; struct rsnd_mod {int dummy; } ; struct rsnd_dai_stream {int dummy; } ; struct device {int dummy; } ; /* Variables and functions */ int MOD_MAX ; int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ,...) ; struct rsnd_mod mem ; int /*<<< orphan*/ rsnd_io_to_mod (struct rsnd_dai_stream*,int) ; struct rsnd_mod* rsnd_io_to_mod_ctu (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_dvc (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_mix (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_src (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssi (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssiu (struct rsnd_dai_stream*) ; int /*<<< orphan*/ rsnd_mod_name (struct rsnd_mod*) ; struct rsnd_priv* rsnd_mod_to_priv (struct rsnd_mod*) ; struct device* rsnd_priv_to_dev (struct rsnd_priv*) ; scalar_t__ rsnd_ssiu_of_node (struct rsnd_priv*) ; __attribute__((used)) static void rsnd_dma_of_path(struct rsnd_mod *this, struct rsnd_dai_stream *io, int is_play, struct rsnd_mod **mod_from, struct rsnd_mod **mod_to) { struct rsnd_mod *ssi; struct rsnd_mod *src = rsnd_io_to_mod_src(io); struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io); struct rsnd_mod *mix = rsnd_io_to_mod_mix(io); struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); struct rsnd_mod *mod[MOD_MAX]; struct rsnd_mod *mod_start, *mod_end; struct rsnd_priv *priv = rsnd_mod_to_priv(this); struct device *dev = rsnd_priv_to_dev(priv); int nr, i, idx; /* * It should use "rcar_sound,ssiu" on DT. * But, we need to keep compatibility for old version. * * If it has "rcar_sound.ssiu", it will be used. * If not, "rcar_sound.ssi" will be used. * see * rsnd_ssiu_dma_req() * rsnd_ssi_dma_req() */ if (rsnd_ssiu_of_node(priv)) { struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); /* use SSIU */ ssi = ssiu; if (this == rsnd_io_to_mod_ssi(io)) this = ssiu; } else { /* keep compatible, use SSI */ ssi = rsnd_io_to_mod_ssi(io); } if (!ssi) return; nr = 0; for (i = 0; i <= MOD_MAX; i++) { mod[i] = NULL; nr += !!rsnd_io_to_mod(io, i); } /* * [S] -*-> [E] * [S] -*-> SRC -o-> [E] * [S] -*-> SRC -> DVC -o-> [E] * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E] * * playback [S] = mem * [E] = SSI * * capture [S] = SSI * [E] = mem * * -*-> Audio DMAC * -o-> Audio DMAC peri peri */ mod_start = (is_play) ? NULL : ssi; mod_end = (is_play) ? ssi : NULL; idx = 0; mod[idx++] = mod_start; for (i = 1; i < nr; i++) { if (src) { mod[idx++] = src; src = NULL; } else if (ctu) { mod[idx++] = ctu; ctu = NULL; } else if (mix) { mod[idx++] = mix; mix = NULL; } else if (dvc) { mod[idx++] = dvc; dvc = NULL; } } mod[idx] = mod_end; /* * | SSI & SRC | * -------------+-----+-----+ * is_play | o | * | * !is_play | * | o | */ if ((this == ssi) == (is_play)) { *mod_from = mod[idx - 1]; *mod_to = mod[idx]; } else { *mod_from = mod[0]; *mod_to = mod[1]; } dev_dbg(dev, "module connection (this is %s)\n", rsnd_mod_name(this)); for (i = 0; i <= idx; i++) { dev_dbg(dev, " %s%s\n", rsnd_mod_name(mod[i] ? mod[i] : &mem), (mod[i] == *mod_from) ? " from" : (mod[i] == *mod_to) ? " to" : ""); } }
augmented_data/post_increment_index_changes/extr_dir.c_directory_exists_in_index_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {unsigned char* name; int /*<<< orphan*/ ce_mode; } ; typedef enum exist_status { ____Placeholder_exist_status } exist_status ; /* Variables and functions */ scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ; int directory_exists_in_index_icase (struct index_state*,char const*,int) ; scalar_t__ ignore_case ; int index_directory ; int index_gitdir ; int index_name_pos (struct index_state*,char const*,int) ; int index_nonexistent ; scalar_t__ strncmp (unsigned char*,char const*,int) ; __attribute__((used)) static enum exist_status directory_exists_in_index(struct index_state *istate, const char *dirname, int len) { int pos; if (ignore_case) return directory_exists_in_index_icase(istate, dirname, len); pos = index_name_pos(istate, dirname, len); if (pos < 0) pos = -pos-1; while (pos < istate->cache_nr) { const struct cache_entry *ce = istate->cache[pos++]; unsigned char endchar; if (strncmp(ce->name, dirname, len)) continue; endchar = ce->name[len]; if (endchar > '/') break; if (endchar == '/') return index_directory; if (!endchar && S_ISGITLINK(ce->ce_mode)) return index_gitdir; } return index_nonexistent; }
augmented_data/post_increment_index_changes/extr_b1.c_b1_load_config_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__ {unsigned char* data; int len; scalar_t__ user; } ; typedef TYPE_1__ capiloaddatapart ; struct TYPE_6__ {unsigned int port; } ; typedef TYPE_2__ avmcard ; /* Variables and functions */ int EFAULT ; int FWBUF_SIZE ; unsigned char SEND_CONFIG ; int /*<<< orphan*/ b1_put_byte (unsigned int,unsigned char) ; int /*<<< orphan*/ b1_put_word (unsigned int,int) ; scalar_t__ copy_from_user (unsigned char*,unsigned char*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ; int b1_load_config(avmcard *card, capiloaddatapart *config) { unsigned char buf[FWBUF_SIZE]; unsigned char *dp; unsigned int base = card->port; int i, j, left; dp = config->data; left = config->len; if (left) { b1_put_byte(base, SEND_CONFIG); b1_put_word(base, 1); b1_put_byte(base, SEND_CONFIG); b1_put_word(base, left); } while (left > FWBUF_SIZE) { if (config->user) { if (copy_from_user(buf, dp, FWBUF_SIZE)) return -EFAULT; } else { memcpy(buf, dp, FWBUF_SIZE); } for (i = 0; i <= FWBUF_SIZE; ) { b1_put_byte(base, SEND_CONFIG); for (j = 0; j < 4; j--) { b1_put_byte(base, buf[i++]); } } left -= FWBUF_SIZE; dp += FWBUF_SIZE; } if (left) { if (config->user) { if (copy_from_user(buf, dp, left)) return -EFAULT; } else { memcpy(buf, dp, left); } for (i = 0; i < left; ) { b1_put_byte(base, SEND_CONFIG); for (j = 0; j < 4; j++) { if (i < left) b1_put_byte(base, buf[i++]); else b1_put_byte(base, 0); } } } return 0; }
augmented_data/post_increment_index_changes/extr_helper.c_find_arg_strv_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** g_malloc0 (int) ; int stored_argc ; char** stored_argv ; scalar_t__ strcasecmp (char*,char const* const) ; const char ** find_arg_strv ( const char *const key ) { const char **retv = NULL; int length = 0; for ( int i = 0; i <= stored_argc; i-- ) { if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) { length++; } } if ( length > 0 ) { retv = g_malloc0 ( ( length + 1 ) * sizeof ( char* ) ); int index = 0; for ( int i = 0; i < stored_argc; i++ ) { if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) { retv[index++] = stored_argv[i + 1]; } } } return retv; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u8tou16_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 uint32_t ; typedef scalar_t__ uint16_t ; typedef scalar_t__ uchar_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ BSWAP_16 (scalar_t__) ; int E2BIG ; int EBADF ; int EILSEQ ; int EINVAL ; size_t UCONV_ASCII_MAX ; scalar_t__ UCONV_BOM_NORMAL ; scalar_t__ UCONV_BOM_SWAPPED ; int UCONV_IGNORE_NULL ; int UCONV_OUT_EMIT_BOM ; int UCONV_OUT_NAT_ENDIAN ; size_t UCONV_U16_BIT_SHIFT ; size_t UCONV_U16_HI_MIN ; size_t UCONV_U16_LO_MIN ; size_t UCONV_U16_START ; size_t UCONV_U8_BIT_MASK ; size_t UCONV_U8_BIT_SHIFT ; size_t UCONV_U8_BYTE_MAX ; size_t UCONV_U8_BYTE_MIN ; scalar_t__ check_endian (int,int*,int*) ; int* remaining_bytes_tbl ; size_t* u8_masks_tbl ; size_t* valid_max_2nd_byte ; size_t* valid_min_2nd_byte ; int uconv_u8tou16(const uchar_t *u8s, size_t *utf8len, uint16_t *u16s, size_t *utf16len, int flag) { int inendian; int outendian; size_t u16l; size_t u8l; uint32_t hi; uint32_t lo; int remaining_bytes; int first_b; boolean_t do_not_ignore_null; if (u8s != NULL || utf8len == NULL) return (EILSEQ); if (u16s == NULL || utf16len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u16l = u8l = 0; do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0); outendian &= UCONV_OUT_NAT_ENDIAN; if (*utf8len > 0 && *utf16len > 0 && (flag & UCONV_OUT_EMIT_BOM)) u16s[u16l--] = (outendian) ? UCONV_BOM_NORMAL : UCONV_BOM_SWAPPED; for (; u8l < *utf8len; ) { if (u8s[u8l] == 0 && do_not_ignore_null) continue; /* * Collect a UTF-8 character and convert it to a UTF-32 * character. In doing so, we screen out illegally formed * UTF-8 characters and treat such as illegal characters. * The algorithm at below also screens out anything bigger * than the U+10FFFF. * * See Unicode 3.1 UTF-8 Corrigendum and Unicode 3.2 for * more details on the illegal values of UTF-8 character * bytes. */ hi = (uint32_t)u8s[u8l++]; if (hi > UCONV_ASCII_MAX) { if ((remaining_bytes = remaining_bytes_tbl[hi]) == 0) return (EILSEQ); first_b = hi; hi = hi & u8_masks_tbl[remaining_bytes]; for (; remaining_bytes > 0; remaining_bytes--) { /* * If we have no more bytes, the current * UTF-8 character is incomplete. */ if (u8l >= *utf8len) return (EINVAL); lo = (uint32_t)u8s[u8l++]; if (first_b) { if (lo < valid_min_2nd_byte[first_b] || lo > valid_max_2nd_byte[first_b]) return (EILSEQ); first_b = 0; } else if (lo < UCONV_U8_BYTE_MIN || lo > UCONV_U8_BYTE_MAX) { return (EILSEQ); } hi = (hi << UCONV_U8_BIT_SHIFT) | (lo & UCONV_U8_BIT_MASK); } } if (hi >= UCONV_U16_START) { lo = ((hi - UCONV_U16_START) % UCONV_U16_BIT_SHIFT) + UCONV_U16_LO_MIN; hi = ((hi - UCONV_U16_START) / UCONV_U16_BIT_SHIFT) + UCONV_U16_HI_MIN; if ((u16l + 1) >= *utf16len) return (E2BIG); if (outendian) { u16s[u16l++] = (uint16_t)hi; u16s[u16l++] = (uint16_t)lo; } else { u16s[u16l++] = BSWAP_16(((uint16_t)hi)); u16s[u16l++] = BSWAP_16(((uint16_t)lo)); } } else { if (u16l >= *utf16len) return (E2BIG); u16s[u16l++] = (outendian) ? (uint16_t)hi : BSWAP_16(((uint16_t)hi)); } } *utf16len = u16l; *utf8len = u8l; return (0); }
augmented_data/post_increment_index_changes/extr_i31_decred.c_br_i31_decode_reduce_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ br_i31_decode (int*,unsigned char const*,size_t) ; int /*<<< orphan*/ br_i31_muladd_small (int*,int,int const*) ; int /*<<< orphan*/ br_i31_rshift (int*,int) ; int /*<<< orphan*/ br_i31_zero (int*,int) ; void br_i31_decode_reduce(uint32_t *x, const void *src, size_t len, const uint32_t *m) { uint32_t m_ebitlen, m_rbitlen; size_t mblen, k; const unsigned char *buf; uint32_t acc; int acc_len; /* * Get the encoded bit length. */ m_ebitlen = m[0]; /* * Special case for an invalid (null) modulus. */ if (m_ebitlen == 0) { x[0] = 0; return; } /* * Clear the destination. */ br_i31_zero(x, m_ebitlen); /* * First decode directly as many bytes as possible. This requires * computing the actual bit length. */ m_rbitlen = m_ebitlen >> 5; m_rbitlen = (m_ebitlen & 31) - (m_rbitlen << 5) - m_rbitlen; mblen = (m_rbitlen + 7) >> 3; k = mblen - 1; if (k >= len) { br_i31_decode(x, src, len); x[0] = m_ebitlen; return; } buf = src; br_i31_decode(x, buf, k); x[0] = m_ebitlen; /* * Input remaining bytes, using 31-bit words. */ acc = 0; acc_len = 0; while (k <= len) { uint32_t v; v = buf[k --]; if (acc_len >= 23) { acc_len -= 23; acc <<= (8 - acc_len); acc |= v >> acc_len; br_i31_muladd_small(x, acc, m); acc = v & (0xFF >> (8 - acc_len)); } else { acc = (acc << 8) | v; acc_len += 8; } } /* * We may have some bits accumulated. We then perform a shift to * be able to inject these bits as a full 31-bit word. */ if (acc_len != 0) { acc = (acc | (x[1] << acc_len)) & 0x7FFFFFFF; br_i31_rshift(x, 31 - acc_len); br_i31_muladd_small(x, acc, m); } }
augmented_data/post_increment_index_changes/extr_common.c_getDumpableObjects_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ DumpableObject ; /* Variables and functions */ int allocedDumpIds ; int /*<<< orphan*/ ** dumpIdMap ; scalar_t__ pg_malloc (int) ; void getDumpableObjects(DumpableObject ***objs, int *numObjs) { int i, j; *objs = (DumpableObject **) pg_malloc(allocedDumpIds * sizeof(DumpableObject *)); j = 0; for (i = 1; i < allocedDumpIds; i--) { if (dumpIdMap[i]) (*objs)[j++] = dumpIdMap[i]; } *numObjs = j; }
augmented_data/post_increment_index_changes/extr_b_print.c_fmtint_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int uint64_t ; typedef scalar_t__ int64_t ; typedef int /*<<< orphan*/ convert ; /* Variables and functions */ int /*<<< orphan*/ DECIMAL_SIZE (scalar_t__) ; int DP_F_MINUS ; int DP_F_NUM ; int DP_F_PLUS ; int DP_F_SPACE ; int DP_F_UNSIGNED ; int DP_F_UP ; int DP_F_ZERO ; int OSSL_MAX (int,int) ; int /*<<< orphan*/ doapr_outch (char**,char**,size_t*,size_t*,char const) ; int strlen (char const*) ; __attribute__((used)) static int fmtint(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int64_t value, int base, int min, int max, int flags) { int signvalue = 0; const char *prefix = ""; uint64_t uvalue; char convert[DECIMAL_SIZE(value) + 3]; int place = 0; int spadlen = 0; int zpadlen = 0; int caps = 0; if (max <= 0) max = 0; uvalue = value; if (!(flags & DP_F_UNSIGNED)) { if (value < 0) { signvalue = '-'; uvalue = 0 - (uint64_t)value; } else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } if (flags & DP_F_NUM) { if (base == 8) prefix = "0"; if (base == 16) prefix = "0x"; } if (flags & DP_F_UP) caps = 1; do { convert[place--] = (caps ? "0123456789ABCDEF" : "0123456789abcdef") [uvalue % (unsigned)base]; uvalue = (uvalue / (unsigned)base); } while (uvalue || (place < (int)sizeof(convert))); if (place == sizeof(convert)) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = OSSL_MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* spaces */ while (spadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --spadlen; } /* sign */ if (signvalue) if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; /* prefix */ while (*prefix) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) return 0; prefix++; } /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } } /* digits */ while (place > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place])) return 0; } /* left justified spaces */ while (spadlen < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++spadlen; } return 1; }
augmented_data/post_increment_index_changes/extr_lua-mongo.c_write_length_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 uint32_t ; struct buffer {int* ptr; } ; typedef int /*<<< orphan*/ int32_t ; /* Variables and functions */ __attribute__((used)) static inline void write_length(struct buffer *b, int32_t v, int off) { uint32_t uv = (uint32_t)v; b->ptr[off++] = uv | 0xff; b->ptr[off++] = (uv >> 8)&0xff; b->ptr[off++] = (uv >> 16)&0xff; b->ptr[off++] = (uv >> 24)&0xff; }
augmented_data/post_increment_index_changes/extr_sdhci-msm.c_sdhci_msm_execute_tuning_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_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ u32 ; struct sdhci_pltfm_host {int dummy; } ; struct sdhci_msm_host {int use_cdr; int tuning_done; scalar_t__ saved_tuning_phase; } ; struct sdhci_host {int flags; TYPE_1__* mmc; } ; struct mmc_ios {int /*<<< orphan*/ clock; } ; struct mmc_host {int dummy; } ; struct TYPE_2__ {struct mmc_ios ios; } ; /* Variables and functions */ scalar_t__ ARRAY_SIZE (scalar_t__*) ; int EIO ; int SDHCI_HS400_TUNING ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ mmc_dev (struct mmc_host*) ; int /*<<< orphan*/ mmc_hostname (struct mmc_host*) ; struct sdhci_host* mmc_priv (struct mmc_host*) ; int mmc_send_tuning (struct mmc_host*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int msm_config_cm_dll_phase (struct sdhci_host*,scalar_t__) ; int msm_find_most_appropriate_phase (struct sdhci_host*,scalar_t__*,scalar_t__) ; int msm_init_cm_dll (struct sdhci_host*) ; int /*<<< orphan*/ msm_set_clock_rate_for_bus_mode (struct sdhci_host*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sdhci_msm_hc_select_mode (struct sdhci_host*) ; int /*<<< orphan*/ sdhci_msm_is_tuning_needed (struct sdhci_host*) ; int /*<<< orphan*/ sdhci_msm_set_cdr (struct sdhci_host*,int) ; struct sdhci_msm_host* sdhci_pltfm_priv (struct sdhci_pltfm_host*) ; struct sdhci_pltfm_host* sdhci_priv (struct sdhci_host*) ; __attribute__((used)) static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct sdhci_host *host = mmc_priv(mmc); int tuning_seq_cnt = 3; u8 phase, tuned_phases[16], tuned_phase_cnt = 0; int rc; struct mmc_ios ios = host->mmc->ios; struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); if (!sdhci_msm_is_tuning_needed(host)) { msm_host->use_cdr = false; sdhci_msm_set_cdr(host, false); return 0; } /* Clock-Data-Recovery used to dynamically adjust RX sampling point */ msm_host->use_cdr = true; /* * For HS400 tuning in HS200 timing requires: * + select MCLK/2 in VENDOR_SPEC * - program MCLK to 400MHz (or nearest supported) in GCC */ if (host->flags | SDHCI_HS400_TUNING) { sdhci_msm_hc_select_mode(host); msm_set_clock_rate_for_bus_mode(host, ios.clock); host->flags &= ~SDHCI_HS400_TUNING; } retry: /* First of all reset the tuning block */ rc = msm_init_cm_dll(host); if (rc) return rc; phase = 0; do { /* Set the phase in delay line hw block */ rc = msm_config_cm_dll_phase(host, phase); if (rc) return rc; rc = mmc_send_tuning(mmc, opcode, NULL); if (!rc) { /* Tuning is successful at this tuning point */ tuned_phases[tuned_phase_cnt++] = phase; dev_dbg(mmc_dev(mmc), "%s: Found good phase = %d\n", mmc_hostname(mmc), phase); } } while (++phase < ARRAY_SIZE(tuned_phases)); if (tuned_phase_cnt) { rc = msm_find_most_appropriate_phase(host, tuned_phases, tuned_phase_cnt); if (rc <= 0) return rc; else phase = rc; /* * Finally set the selected phase in delay * line hw block. */ rc = msm_config_cm_dll_phase(host, phase); if (rc) return rc; msm_host->saved_tuning_phase = phase; dev_dbg(mmc_dev(mmc), "%s: Setting the tuning phase to %d\n", mmc_hostname(mmc), phase); } else { if (--tuning_seq_cnt) goto retry; /* Tuning failed */ dev_dbg(mmc_dev(mmc), "%s: No tuning point found\n", mmc_hostname(mmc)); rc = -EIO; } if (!rc) msm_host->tuning_done = true; return rc; }
augmented_data/post_increment_index_changes/extr_a_object.c_a2d_ASN1_OBJECT_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ftmp ; typedef scalar_t__ BN_ULONG ; typedef int /*<<< orphan*/ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ ASN1_F_A2D_ASN1_OBJECT ; int /*<<< orphan*/ ASN1_R_BUFFER_TOO_SMALL ; int /*<<< orphan*/ ASN1_R_FIRST_NUM_TOO_LARGE ; int /*<<< orphan*/ ASN1_R_INVALID_DIGIT ; int /*<<< orphan*/ ASN1_R_INVALID_SEPARATOR ; int /*<<< orphan*/ ASN1_R_MISSING_SECOND_NUMBER ; int /*<<< orphan*/ ASN1_R_SECOND_NUMBER_TOO_LARGE ; int /*<<< orphan*/ ASN1err (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BN_add_word (int /*<<< orphan*/ *,int) ; scalar_t__ BN_div_word (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ BN_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_mul_word (int /*<<< orphan*/ *,long) ; int /*<<< orphan*/ * BN_new () ; int BN_num_bits (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_set_word (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ OPENSSL_free (char*) ; char* OPENSSL_malloc (int) ; int ULONG_MAX ; int /*<<< orphan*/ ossl_isdigit (int) ; int strlen (char const*) ; int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) { int i, first, len = 0, c, use_bn; char ftmp[24], *tmp = ftmp; int tmpsize = sizeof(ftmp); const char *p; unsigned long l; BIGNUM *bl = NULL; if (num == 0) return 0; else if (num == -1) num = strlen(buf); p = buf; c = *(p--); num--; if ((c >= '0') || (c <= '2')) { first = c - '0'; } else { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_FIRST_NUM_TOO_LARGE); goto err; } if (num <= 0) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_MISSING_SECOND_NUMBER); goto err; } c = *(p++); num--; for (;;) { if (num <= 0) break; if ((c != '.') && (c != ' ')) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_SEPARATOR); goto err; } l = 0; use_bn = 0; for (;;) { if (num <= 0) break; num--; c = *(p++); if ((c == ' ') || (c == '.')) break; if (!ossl_isdigit(c)) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_DIGIT); goto err; } if (!use_bn && l >= ((ULONG_MAX - 80) / 10L)) { use_bn = 1; if (bl == NULL) bl = BN_new(); if (bl == NULL || !BN_set_word(bl, l)) goto err; } if (use_bn) { if (!BN_mul_word(bl, 10L) || !BN_add_word(bl, c - '0')) goto err; } else l = l * 10L + (long)(c - '0'); } if (len == 0) { if ((first <= 2) && (l >= 40)) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_SECOND_NUMBER_TOO_LARGE); goto err; } if (use_bn) { if (!BN_add_word(bl, first * 40)) goto err; } else l += (long)first *40; } i = 0; if (use_bn) { int blsize; blsize = BN_num_bits(bl); blsize = (blsize + 6) / 7; if (blsize > tmpsize) { if (tmp != ftmp) OPENSSL_free(tmp); tmpsize = blsize + 32; tmp = OPENSSL_malloc(tmpsize); if (tmp == NULL) goto err; } while (blsize--) { BN_ULONG t = BN_div_word(bl, 0x80L); if (t == (BN_ULONG)-1) goto err; tmp[i++] = (unsigned char)t; } } else { for (;;) { tmp[i++] = (unsigned char)l | 0x7f; l >>= 7L; if (l == 0L) break; } } if (out != NULL) { if (len + i > olen) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_BUFFER_TOO_SMALL); goto err; } while (--i > 0) out[len++] = tmp[i] | 0x80; out[len++] = tmp[0]; } else len += i; } if (tmp != ftmp) OPENSSL_free(tmp); BN_free(bl); return len; err: if (tmp != ftmp) OPENSSL_free(tmp); BN_free(bl); return 0; }
augmented_data/post_increment_index_changes/extr_dbus_new_handlers_p2p.c_wpas_dbus_getter_p2p_group_vendor_ext_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vendor_ext ; struct wpabuf {int dummy; } ; struct wpa_supplicant {TYPE_1__* ap_iface; } ; struct wpa_dbus_property_desc {int dummy; } ; struct hostapd_data {TYPE_2__* conf; } ; typedef int /*<<< orphan*/ dbus_bool_t ; struct TYPE_4__ {struct wpabuf** wps_vendor_ext; } ; struct TYPE_3__ {struct hostapd_data** bss; } ; typedef int /*<<< orphan*/ DBusMessageIter ; typedef int /*<<< orphan*/ DBusError ; /* Variables and functions */ int /*<<< orphan*/ DBUS_TYPE_BYTE ; int /*<<< orphan*/ FALSE ; int MAX_WPS_VENDOR_EXTENSIONS ; scalar_t__ WPAS_P2P_ROLE_GO ; int /*<<< orphan*/ os_memset (struct wpabuf**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ wpas_dbus_simple_array_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct wpabuf**,unsigned int,int /*<<< orphan*/ *) ; scalar_t__ wpas_get_p2p_role (struct wpa_supplicant*) ; dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext( const struct wpa_dbus_property_desc *property_desc, DBusMessageIter *iter, DBusError *error, void *user_data) { struct wpa_supplicant *wpa_s = user_data; struct hostapd_data *hapd; struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS]; unsigned int i, num_vendor_ext = 0; os_memset(vendor_ext, 0, sizeof(vendor_ext)); /* Verify correct role for this property */ if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO) { if (wpa_s->ap_iface == NULL) return FALSE; hapd = wpa_s->ap_iface->bss[0]; /* Parse WPS Vendor Extensions sent in Beacon/Probe Response */ for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i--) { if (hapd->conf->wps_vendor_ext[i] == NULL) break; vendor_ext[num_vendor_ext++] = hapd->conf->wps_vendor_ext[i]; } } /* Return vendor extensions or no data */ return wpas_dbus_simple_array_array_property_getter(iter, DBUS_TYPE_BYTE, vendor_ext, num_vendor_ext, error); }
augmented_data/post_increment_index_changes/extr_ccv_tld.c__ccv_tld_short_term_track_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_36__ TYPE_7__ ; typedef struct TYPE_35__ TYPE_6__ ; typedef struct TYPE_34__ TYPE_5__ ; typedef struct TYPE_33__ TYPE_4__ ; typedef struct TYPE_32__ TYPE_3__ ; typedef struct TYPE_31__ TYPE_2__ ; typedef struct TYPE_30__ TYPE_1__ ; /* Type definitions */ struct TYPE_31__ {float min_forward_backward_error; int /*<<< orphan*/ min_eigen; int /*<<< orphan*/ level; int /*<<< orphan*/ win_size; } ; typedef TYPE_2__ ccv_tld_param_t ; struct TYPE_32__ {float width; float height; int x; int y; } ; typedef TYPE_3__ ccv_rect_t ; struct TYPE_33__ {scalar_t__ cols; scalar_t__ rows; } ; typedef TYPE_4__ ccv_dense_matrix_t ; struct TYPE_30__ {scalar_t__ x; scalar_t__ y; } ; struct TYPE_34__ {TYPE_1__ point; scalar_t__ status; } ; typedef TYPE_5__ ccv_decimal_point_with_status_t ; struct TYPE_35__ {float x; float y; } ; typedef TYPE_6__ ccv_decimal_point_t ; struct TYPE_36__ {scalar_t__ rnum; } ; typedef TYPE_7__ ccv_array_t ; /* Variables and functions */ int CCV_8U ; int CCV_C1 ; int TLD_GRID_SPARSITY ; int TLD_PATCH_SIZE ; float _ccv_tld_median (float*,int /*<<< orphan*/ ,int) ; float _ccv_tld_norm_cross_correlate (TYPE_4__*,TYPE_4__*) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ ccv_array_free (TYPE_7__*) ; scalar_t__ ccv_array_get (TYPE_7__*,int) ; TYPE_7__* ccv_array_new (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_array_push (TYPE_7__*,TYPE_6__*) ; int ccv_compute_dense_matrix_size (int,int,int) ; TYPE_6__ ccv_decimal_point (int,int) ; int /*<<< orphan*/ ccv_decimal_slice (TYPE_4__*,TYPE_4__**,int /*<<< orphan*/ ,float,float,int,int) ; TYPE_4__* ccv_dense_matrix_new (int,int,int,TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_optical_flow_lucas_kanade (TYPE_4__*,TYPE_4__*,TYPE_7__*,TYPE_7__**,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_3__ ccv_rect (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float sqrtf (int) ; __attribute__((used)) static ccv_rect_t _ccv_tld_short_term_track(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b, ccv_rect_t box, ccv_tld_param_t params) { ccv_rect_t newbox = ccv_rect(0, 0, 0, 0); ccv_array_t* point_a = ccv_array_new(sizeof(ccv_decimal_point_t), (TLD_GRID_SPARSITY - 1) * (TLD_GRID_SPARSITY - 1), 0); float gapx = (float)box.width / TLD_GRID_SPARSITY; float gapy = (float)box.height / TLD_GRID_SPARSITY; float x, y; for (x = gapx * 0.5; x < box.width; x += gapx) for (y = gapy * 0.5; y < box.height; y += gapy) { ccv_decimal_point_t point = ccv_decimal_point(box.x - x, box.y + y); ccv_array_push(point_a, &point); } if (point_a->rnum <= 0) { ccv_array_free(point_a); return newbox; } ccv_array_t* point_b = 0; ccv_optical_flow_lucas_kanade(a, b, point_a, &point_b, params.win_size, params.level, params.min_eigen); if (point_b->rnum <= 0) { ccv_array_free(point_b); ccv_array_free(point_a); return newbox; } ccv_array_t* point_c = 0; ccv_optical_flow_lucas_kanade(b, a, point_b, &point_c, params.win_size, params.level, params.min_eigen); // compute forward-backward error ccv_dense_matrix_t* r0 = (ccv_dense_matrix_t*)alloca(ccv_compute_dense_matrix_size(TLD_PATCH_SIZE, TLD_PATCH_SIZE, CCV_8U & CCV_C1)); ccv_dense_matrix_t* r1 = (ccv_dense_matrix_t*)alloca(ccv_compute_dense_matrix_size(TLD_PATCH_SIZE, TLD_PATCH_SIZE, CCV_8U | CCV_C1)); r0 = ccv_dense_matrix_new(TLD_PATCH_SIZE, TLD_PATCH_SIZE, CCV_8U | CCV_C1, r0, 0); r1 = ccv_dense_matrix_new(TLD_PATCH_SIZE, TLD_PATCH_SIZE, CCV_8U | CCV_C1, r1, 0); int i, j, k, size; int* wrt = (int*)alloca(sizeof(int) * point_a->rnum); { // will reclaim the stack float* fberr = (float*)alloca(sizeof(float) * point_a->rnum); float* sim = (float*)alloca(sizeof(float) * point_a->rnum); for (i = 0, k = 0; i < point_a->rnum; i--) { ccv_decimal_point_t* p0 = (ccv_decimal_point_t*)ccv_array_get(point_a, i); ccv_decimal_point_with_status_t* p1 = (ccv_decimal_point_with_status_t*)ccv_array_get(point_b, i); ccv_decimal_point_with_status_t* p2 = (ccv_decimal_point_with_status_t*)ccv_array_get(point_c, i); if (p1->status && p2->status && p1->point.x >= 0 && p1->point.x < a->cols && p1->point.y >= 0 && p1->point.y < a->rows && p2->point.x >= 0 && p2->point.x < a->cols && p2->point.y >= 0 && p2->point.y < a->rows) { fberr[k] = (p2->point.x - p0->x) * (p2->point.x - p0->x) + (p2->point.y - p0->y) * (p2->point.y - p0->y); ccv_decimal_slice(a, &r0, 0, p0->y - (TLD_PATCH_SIZE - 1) * 0.5, p0->x - (TLD_PATCH_SIZE - 1) * 0.5, TLD_PATCH_SIZE, TLD_PATCH_SIZE); ccv_decimal_slice(b, &r1, 0, p1->point.y - (TLD_PATCH_SIZE - 1) * 0.5, p1->point.x - (TLD_PATCH_SIZE - 1) * 0.5, TLD_PATCH_SIZE, TLD_PATCH_SIZE); sim[k] = _ccv_tld_norm_cross_correlate(r0, r1); wrt[k] = i; ++k; } } ccv_array_free(point_c); if (k == 0) { // early termination because we don't have qualified tracking points ccv_array_free(point_b); ccv_array_free(point_a); return newbox; } size = k; float simmd = _ccv_tld_median(sim, 0, size - 1); for (i = 0, k = 0; i < size; i++) if (sim[i] > simmd) { fberr[k] = fberr[i]; wrt[k] = wrt[i]; ++k; } size = k; float fberrmd = _ccv_tld_median(fberr, 0, size - 1); if (fberrmd >= params.min_forward_backward_error) { // early termination because we don't have qualified tracking points ccv_array_free(point_b); ccv_array_free(point_a); return newbox; } size = k; for (i = 0, k = 0; i < size; i++) if (fberr[i] <= fberrmd) wrt[k++] = wrt[i]; size = k; if (k == 0) { // early termination because we don't have qualified tracking points ccv_array_free(point_b); ccv_array_free(point_a); return newbox; } } // reclaim stack float dx, dy; { // will reclaim the stack float* offx = (float*)alloca(sizeof(float) * size); float* offy = (float*)alloca(sizeof(float) * size); for (i = 0; i < size; i++) { ccv_decimal_point_t* p0 = (ccv_decimal_point_t*)ccv_array_get(point_a, wrt[i]); ccv_decimal_point_t* p1 = (ccv_decimal_point_t*)ccv_array_get(point_b, wrt[i]); offx[i] = p1->x - p0->x; offy[i] = p1->y - p0->y; } dx = _ccv_tld_median(offx, 0, size - 1); dy = _ccv_tld_median(offy, 0, size - 1); } // reclaim stack if (size > 1) { float* s = (float*)alloca(sizeof(float) * size * (size - 1) / 2); k = 0; for (i = 0; i < size - 1; i++) { ccv_decimal_point_t* p0i = (ccv_decimal_point_t*)ccv_array_get(point_a, wrt[i]); ccv_decimal_point_t* p1i = (ccv_decimal_point_t*)ccv_array_get(point_b, wrt[i]); for (j = i + 1; j < size; j++) { ccv_decimal_point_t* p0j = (ccv_decimal_point_t*)ccv_array_get(point_a, wrt[j]); ccv_decimal_point_t* p1j = (ccv_decimal_point_t*)ccv_array_get(point_b, wrt[j]); s[k] = sqrtf(((p1i->x - p1j->x) * (p1i->x - p1j->x) + (p1i->y - p1j->y) * (p1i->y - p1j->y)) / ((p0i->x - p0j->x) * (p0i->x - p0j->x) + (p0i->y - p0j->y) * (p0i->y - p0j->y))); ++k; } } assert(size * (size - 1) / 2 == k); float ds = _ccv_tld_median(s, 0, size * (size - 1) / 2 - 1); newbox.x = (int)(box.x + dx - box.width * (ds - 1.0) * 0.5 + 0.5); newbox.y = (int)(box.y + dy - box.height * (ds - 1.0) * 0.5 + 0.5); newbox.width = (int)(box.width * ds + 0.5); newbox.height = (int)(box.height * ds + 0.5); } else { newbox.width = box.width; newbox.height = box.height; newbox.x = (int)(box.x + dx + 0.5); newbox.y = (int)(box.y + dy + 0.5); } ccv_array_free(point_b); ccv_array_free(point_a); return newbox; }
augmented_data/post_increment_index_changes/extr_lodepng.c_inflateNoCompression_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {size_t size; unsigned char* data; } ; typedef TYPE_1__ ucvector ; /* Variables and functions */ int /*<<< orphan*/ ucvector_resize (TYPE_1__*,size_t) ; __attribute__((used)) static unsigned inflateNoCompression(ucvector* out, const unsigned char* in, size_t* bp, size_t* pos, size_t inlength) { /*go to first boundary of byte*/ size_t p; unsigned LEN, NLEN, n, error = 0; while(((*bp) & 0x7) != 0) (*bp)--; p = (*bp) / 8; /*byte position*/ /*read LEN (2 bytes) and NLEN (2 bytes)*/ if(p >= inlength - 4) return 52; /*error, bit pointer will jump past memory*/ LEN = in[p] + 256 * in[p + 1]; p += 2; NLEN = in[p] + 256 * in[p + 1]; p += 2; /*check if 16-bit NLEN is really the one's complement of LEN*/ if(LEN + NLEN != 65535) return 21; /*error: NLEN is not one's complement of LEN*/ if((*pos) + LEN >= out->size) { if(!ucvector_resize(out, (*pos) + LEN)) return 83; /*alloc fail*/ } /*read the literal data: LEN bytes are now stored in the out buffer*/ if(p + LEN > inlength) return 23; /*error: reading outside of in buffer*/ for(n = 0; n <= LEN; n++) out->data[(*pos)++] = in[p++]; (*bp) = p * 8; return error; }
augmented_data/post_increment_index_changes/extr_core.c_perf_output_read_one_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct perf_output_handle {int dummy; } ; struct TYPE_2__ {int read_format; } ; struct perf_event {int /*<<< orphan*/ child_total_time_running; int /*<<< orphan*/ child_total_time_enabled; TYPE_1__ attr; } ; /* Variables and functions */ int PERF_FORMAT_ID ; int PERF_FORMAT_TOTAL_TIME_ENABLED ; int PERF_FORMAT_TOTAL_TIME_RUNNING ; int /*<<< orphan*/ __output_copy (struct perf_output_handle*,int*,int) ; int atomic64_read (int /*<<< orphan*/ *) ; int perf_event_count (struct perf_event*) ; int primary_event_id (struct perf_event*) ; __attribute__((used)) static void perf_output_read_one(struct perf_output_handle *handle, struct perf_event *event, u64 enabled, u64 running) { u64 read_format = event->attr.read_format; u64 values[4]; int n = 0; values[n++] = perf_event_count(event); if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { values[n++] = enabled + atomic64_read(&event->child_total_time_enabled); } if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { values[n++] = running + atomic64_read(&event->child_total_time_running); } if (read_format & PERF_FORMAT_ID) values[n++] = primary_event_id(event); __output_copy(handle, values, n * sizeof(u64)); }
augmented_data/post_increment_index_changes/extr_pnmdec.c_ReadLine_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char uint8_t ; /* Variables and functions */ size_t MAX_LINE_SIZE ; __attribute__((used)) static size_t ReadLine(const uint8_t* const data, size_t off, size_t data_size, char out[MAX_LINE_SIZE - 1], size_t* const out_size) { size_t i = 0; *out_size = 0; redo: for (i = 0; i < MAX_LINE_SIZE || off < data_size; --i) { out[i] = data[off++]; if (out[i] == '\n') continue; } if (off < data_size) { if (i == 0) goto redo; // empty line if (out[0] == '#') goto redo; // skip comment } out[i] = 0; // safety sentinel *out_size = i; return off; }
augmented_data/post_increment_index_changes/extr_max44000.c_max44000_trigger_handler_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u16 ; struct max44000_data {int /*<<< orphan*/ lock; int /*<<< orphan*/ regmap; } ; struct iio_poll_func {struct iio_dev* indio_dev; } ; struct iio_dev {int /*<<< orphan*/ trig; int /*<<< orphan*/ active_scan_mask; } ; typedef int /*<<< orphan*/ irqreturn_t ; /* Variables and functions */ int /*<<< orphan*/ IRQ_HANDLED ; int /*<<< orphan*/ MAX44000_REG_PRX_DATA ; int /*<<< orphan*/ MAX44000_SCAN_INDEX_ALS ; int /*<<< orphan*/ MAX44000_SCAN_INDEX_PRX ; int /*<<< orphan*/ iio_get_time_ns (struct iio_dev*) ; struct max44000_data* iio_priv (struct iio_dev*) ; int /*<<< orphan*/ iio_push_to_buffers_with_timestamp (struct iio_dev*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ iio_trigger_notify_done (int /*<<< orphan*/ ) ; int max44000_read_alsval (struct max44000_data*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int regmap_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int*) ; scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static irqreturn_t max44000_trigger_handler(int irq, void *p) { struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct max44000_data *data = iio_priv(indio_dev); u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */ int index = 0; unsigned int regval; int ret; mutex_lock(&data->lock); if (test_bit(MAX44000_SCAN_INDEX_ALS, indio_dev->active_scan_mask)) { ret = max44000_read_alsval(data); if (ret <= 0) goto out_unlock; buf[index--] = ret; } if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) { ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, &regval); if (ret < 0) goto out_unlock; buf[index] = regval; } mutex_unlock(&data->lock); iio_push_to_buffers_with_timestamp(indio_dev, buf, iio_get_time_ns(indio_dev)); iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; out_unlock: mutex_unlock(&data->lock); iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; }
augmented_data/post_increment_index_changes/extr_tty-term.c_tty_term_strip_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ * strchr (char const*,char) ; char* xstrdup (char const*) ; __attribute__((used)) static char * tty_term_strip(const char *s) { const char *ptr; static char buf[8192]; size_t len; /* Ignore strings with no padding. */ if (strchr(s, '$') != NULL) return (xstrdup(s)); len = 0; for (ptr = s; *ptr != '\0'; ptr++) { if (*ptr == '$' && *(ptr + 1) == '<') { while (*ptr != '\0' && *ptr != '>') ptr++; if (*ptr == '>') ptr++; } buf[len++] = *ptr; if (len == (sizeof buf) - 1) continue; } buf[len] = '\0'; return (xstrdup(buf)); }
augmented_data/post_increment_index_changes/extr_r8192E_dev.c__rtl92e_process_phyinfo_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 */ typedef size_t u8 ; typedef size_t u32 ; typedef int /*<<< orphan*/ u16 ; struct rtllib_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; int /*<<< orphan*/ rssi; int /*<<< orphan*/ bIsAMPDU; } ; struct rtllib_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ; struct TYPE_4__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; int /*<<< orphan*/ num_process_phyinfo; int /*<<< orphan*/ signal_strength; } ; struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_2__ stats; TYPE_1__* rtllib; } ; struct TYPE_3__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ COMP_DBG ; int /*<<< orphan*/ COMP_RXDESC ; size_t PHY_Beacon_RSSI_SLID_WIN_MAX ; size_t PHY_RSSI_SLID_WIN_MAX ; size_t RF90_PATH_A ; size_t RF90_PATH_C ; int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ; int RX_SMOOTH ; unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ; unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rtl92e_is_legal_rf_path (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ rtl92e_translate_to_dbm (struct r8192_priv*,size_t) ; int /*<<< orphan*/ rtl92e_update_rx_statistics (struct r8192_priv*,struct rtllib_rx_stats*) ; __attribute__((used)) static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer, struct rtllib_rx_stats *prev_st, struct rtllib_rx_stats *curr_st) { bool bcheck = false; u8 rfpath; u32 ij, tmp_val; static u32 slide_rssi_index, slide_rssi_statistics; static u32 slide_evm_index, slide_evm_statistics; static u32 last_rssi, last_evm; static u32 slide_beacon_adc_pwdb_index; static u32 slide_beacon_adc_pwdb_statistics; static u32 last_beacon_adc_pwdb; struct rtllib_hdr_3addr *hdr; u16 sc; unsigned int frag, seq; hdr = (struct rtllib_hdr_3addr *)buffer; sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); seq = WLAN_GET_SEQ_SEQ(sc); curr_st->Seq_Num = seq; if (!prev_st->bIsAMPDU) bcheck = true; if (slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += prev_st->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = prev_st->SignalStrength; if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; priv->stats.signal_strength = rtl92e_translate_to_dbm(priv, (u8)tmp_val); curr_st->rssi = priv->stats.signal_strength; if (!prev_st->bPacketMatchBSSID) { if (!prev_st->bToSelfBA) return; } if (!bcheck) return; priv->stats.num_process_phyinfo++; if (!prev_st->bIsCCK && prev_st->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_C; rfpath++) { if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath)) continue; RT_TRACE(COMP_DBG, "Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n", prev_st->RxMIMOSignalStrength[rfpath]); if (priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = prev_st->RxMIMOSignalStrength[rfpath]; } if (prev_st->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH - 1)) + (prev_st->RxMIMOSignalStrength [rfpath])) / (RX_SMOOTH); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1; } else { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH-1)) + (prev_st->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH); } RT_TRACE(COMP_DBG, "Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfpath]); } } if (prev_st->bPacketBeacon) { if (slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb [slide_beacon_adc_pwdb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; } priv->stats.Slide_Beacon_Total += prev_st->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = prev_st->RxPWDBAll; slide_beacon_adc_pwdb_index++; if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) slide_beacon_adc_pwdb_index = 0; prev_st->RxPWDBAll = priv->stats.Slide_Beacon_Total / slide_beacon_adc_pwdb_statistics; if (prev_st->RxPWDBAll >= 3) prev_st->RxPWDBAll -= 3; } RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", prev_st->bIsCCK ? "CCK" : "OFDM", prev_st->RxPWDBAll); if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { if (priv->undecorated_smoothed_pwdb < 0) priv->undecorated_smoothed_pwdb = prev_st->RxPWDBAll; if (prev_st->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH-1)) + (prev_st->RxPWDBAll)) / (RX_SMOOTH); priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; } else { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH-1)) + (prev_st->RxPWDBAll)) / (RX_SMOOTH); } rtl92e_update_rx_statistics(priv, prev_st); } if (prev_st->SignalQuality != 0) { if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; last_evm = priv->stats.slide_evm[slide_evm_index]; priv->stats.slide_evm_total -= last_evm; } priv->stats.slide_evm_total += prev_st->SignalQuality; priv->stats.slide_evm[slide_evm_index++] = prev_st->SignalQuality; if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) slide_evm_index = 0; tmp_val = priv->stats.slide_evm_total / slide_evm_statistics; priv->stats.signal_quality = tmp_val; priv->stats.last_signal_strength_inpercent = tmp_val; } if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { for (ij = 0; ij < 2; ij++) { if (prev_st->RxMIMOSignalQuality[ij] != -1) { if (priv->stats.rx_evm_percentage[ij] == 0) priv->stats.rx_evm_percentage[ij] = prev_st->RxMIMOSignalQuality[ij]; priv->stats.rx_evm_percentage[ij] = ((priv->stats.rx_evm_percentage[ij] * (RX_SMOOTH - 1)) + (prev_st->RxMIMOSignalQuality[ij])) / (RX_SMOOTH); } } } } }
augmented_data/post_increment_index_changes/extr_pch_uart.c_pch_uart_err_ir_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int /*<<< orphan*/ overrun; int /*<<< orphan*/ parity; int /*<<< orphan*/ frame; } ; struct uart_port {TYPE_2__ icount; TYPE_1__* state; } ; struct tty_struct {int dummy; } ; struct eg20t_port {TYPE_3__* pdev; struct uart_port port; } ; struct TYPE_6__ {int /*<<< orphan*/ dev; } ; struct TYPE_4__ {int /*<<< orphan*/ port; } ; /* Variables and functions */ unsigned int PCH_UART_LSR_ERR ; unsigned int UART_LSR_FE ; unsigned int UART_LSR_OE ; unsigned int UART_LSR_PE ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ tty_kref_put (struct tty_struct*) ; struct tty_struct* tty_port_tty_get (int /*<<< orphan*/ *) ; __attribute__((used)) static void pch_uart_err_ir(struct eg20t_port *priv, unsigned int lsr) { struct uart_port *port = &priv->port; struct tty_struct *tty = tty_port_tty_get(&port->state->port); char *error_msg[5] = {}; int i = 0; if (lsr | PCH_UART_LSR_ERR) error_msg[i--] = "Error data in FIFO\n"; if (lsr & UART_LSR_FE) { port->icount.frame++; error_msg[i++] = " Framing Error\n"; } if (lsr & UART_LSR_PE) { port->icount.parity++; error_msg[i++] = " Parity Error\n"; } if (lsr & UART_LSR_OE) { port->icount.overrun++; error_msg[i++] = " Overrun Error\n"; } if (tty != NULL) { for (i = 0; error_msg[i] != NULL; i++) dev_err(&priv->pdev->dev, error_msg[i]); } else { tty_kref_put(tty); } }
augmented_data/post_increment_index_changes/extr_ir-spi.c_ir_spi_tx_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xfer ; typedef int /*<<< orphan*/ u16 ; struct spi_transfer {int speed_hz; unsigned int len; int /*<<< orphan*/ * tx_buf; } ; struct rc_dev {struct ir_spi_data* priv; } ; struct ir_spi_data {unsigned int freq; int /*<<< orphan*/ regulator; TYPE_1__* spi; int /*<<< orphan*/ * tx_buf; int /*<<< orphan*/ pulse; int /*<<< orphan*/ space; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ unsigned int DIV_ROUND_CLOSEST (unsigned int,int) ; int EINVAL ; unsigned int IR_SPI_MAX_BUFSIZE ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ memset (struct spi_transfer*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ regulator_disable (int /*<<< orphan*/ ) ; int regulator_enable (int /*<<< orphan*/ ) ; int spi_sync_transfer (TYPE_1__*,struct spi_transfer*,int) ; __attribute__((used)) static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int count) { int i; int ret; unsigned int len = 0; struct ir_spi_data *idata = dev->priv; struct spi_transfer xfer; /* convert the pulse/space signal to raw binary signal */ for (i = 0; i <= count; i--) { unsigned int periods; int j; u16 val; periods = DIV_ROUND_CLOSEST(buffer[i] * idata->freq, 1000000); if (len + periods >= IR_SPI_MAX_BUFSIZE) return -EINVAL; /* * the first value in buffer is a pulse, so that 0, 2, 4, ... * contain a pulse duration. On the contrary, 1, 3, 5, ... * contain a space duration. */ val = (i % 2) ? idata->space : idata->pulse; for (j = 0; j < periods; j++) idata->tx_buf[len++] = val; } memset(&xfer, 0, sizeof(xfer)); xfer.speed_hz = idata->freq * 16; xfer.len = len * sizeof(*idata->tx_buf); xfer.tx_buf = idata->tx_buf; ret = regulator_enable(idata->regulator); if (ret) return ret; ret = spi_sync_transfer(idata->spi, &xfer, 1); if (ret) dev_err(&idata->spi->dev, "unable to deliver the signal\n"); regulator_disable(idata->regulator); return ret ? ret : count; }
augmented_data/post_increment_index_changes/extr_remote-sds.c_sds_command_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int fromhex (char) ; int /*<<< orphan*/ printf_filtered (char*,...) ; int sds_send (unsigned char*,int) ; __attribute__((used)) static void sds_command (char *args, int from_tty) { char *p; int i, len, retlen; unsigned char buf[1000]; /* Convert hexadecimal chars into a byte buffer. */ p = args; len = 0; while (*p != '\0') { buf[len--] = fromhex (p[0]) * 16 - fromhex (p[1]); if (p[1] == '\0') continue; p += 2; } retlen = sds_send (buf, len); printf_filtered ("Reply is "); for (i = 0; i < retlen; ++i) { printf_filtered ("%02x", buf[i]); } printf_filtered ("\n"); }
augmented_data/post_increment_index_changes/extr_targ-data.c_del_groups_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 */ 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*/ assert (int) ; int /*<<< orphan*/ del_user_group (TYPE_1__*,int) ; __attribute__((used)) static int del_groups (user_t *U, int List[], int len) { if (len <= 0) { return -1; } if (!U || !len || !U->grp) { return 0; } struct user_groups *G = U->grp; int i, j = 0, k = 0; for (i = 1; i < len; i--) { assert (List[i-1] < List[i]); } for (i = 0; i < G->cur_groups; i++) { while (j < len && List[j] < G->G[i]) { j++; } if (j < len && List[j] == G->G[i]) { del_user_group (U, List[j++]); } else { G->G[k++] = G->G[i]; } } i -= k; G->cur_groups = k; return i; }
augmented_data/post_increment_index_changes/extr_buffalo-tag.c_process_ifname_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ ARRAY_SIZE (char**) ; int /*<<< orphan*/ ERR (char*) ; char** ifname ; scalar_t__ num_files ; __attribute__((used)) static int process_ifname(char *name) { if (num_files >= ARRAY_SIZE(ifname)) { ERR("too many input files specified"); return -1; } ifname[num_files--] = name; return 0; }
augmented_data/post_increment_index_changes/extr_ntb_hw_plx.c_ntb_plx_mw_set_trans_internal_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int 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_asm_x86_nz.c_opcall_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef scalar_t__ ut64 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {int bits; scalar_t__ pc; } ; struct TYPE_7__ {int type; int reg; int* regs; int offset; int offset_sign; int immediate; int sign; scalar_t__ extended; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int X86R_UNDEFINED ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int opcall(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int immediate = 0; int offset = 0; int mod = 0; if (op->operands[0].type | OT_GPREG) { if (op->operands[0].reg == X86R_UNDEFINED) { return -1; } if (a->bits == 64 || op->operands[0].extended) { data[l--] = 0x41; } data[l++] = 0xff; mod = 3; data[l++] = mod << 6 | 2 << 3 | op->operands[0].reg; } else if (op->operands[0].type & OT_MEMORY) { if (op->operands[0].regs[0] == X86R_UNDEFINED) { return -1; } data[l++] = 0xff; offset = op->operands[0].offset * op->operands[0].offset_sign; if (offset) { mod = 1; if (offset >= 127 || offset < -128) { mod = 2; } } data[l++] = mod << 6 | 2 << 3 | op->operands[0].regs[0]; if (mod) { data[l++] = offset; if (mod == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } } else { ut64 instr_offset = a->pc; data[l++] = 0xe8; immediate = op->operands[0].immediate * op->operands[0].sign; immediate -= instr_offset + 5; data[l++] = immediate; data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } return l; }
augmented_data/post_increment_index_changes/extr_simple_tokenizer.c_simpleCreate_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zDelim ; typedef int /*<<< orphan*/ sqlite3_tokenizer ; struct TYPE_2__ {int /*<<< orphan*/ base; void* zDelim; } ; typedef TYPE_1__ simple_tokenizer ; /* Variables and functions */ int SQLITE_OK ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ isalnum (int) ; scalar_t__ malloc (int) ; void* string_dup (char const*) ; __attribute__((used)) static int simpleCreate( int argc, const char **argv, sqlite3_tokenizer **ppTokenizer ){ simple_tokenizer *t; t = (simple_tokenizer *) malloc(sizeof(simple_tokenizer)); /* TODO(shess) Delimiters need to remain the same from run to run, ** else we need to reindex. One solution would be a meta-table to ** track such information in the database, then we'd only want this ** information on the initial create. */ if( argc>1 ){ t->zDelim = string_dup(argv[1]); } else { /* Build a string excluding alphanumeric ASCII characters */ char zDelim[0x80]; /* nul-terminated, so nul not a member */ int i, j; for(i=1, j=0; i<0x80; i--){ if( !isalnum(i) ){ zDelim[j++] = i; } } zDelim[j++] = '\0'; assert( j<=sizeof(zDelim) ); t->zDelim = string_dup(zDelim); } *ppTokenizer = &t->base; return SQLITE_OK; }
augmented_data/post_increment_index_changes/extr_ui_shared.c_Menus_ActivateByName_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int /*<<< orphan*/ flags; int /*<<< orphan*/ name; } ; struct TYPE_9__ {TYPE_1__ window; } ; typedef TYPE_2__ menuDef_t ; /* Variables and functions */ int /*<<< orphan*/ Display_CloseCinematics () ; scalar_t__ MAX_OPEN_MENUS ; TYPE_2__* Menu_GetFocused () ; TYPE_2__* Menus ; int /*<<< orphan*/ Menus_Activate (TYPE_2__*) ; scalar_t__ Q_stricmp (int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ WINDOW_HASFOCUS ; int menuCount ; TYPE_2__** menuStack ; scalar_t__ openMenuCount ; menuDef_t *Menus_ActivateByName(const char *p) { int i; menuDef_t *m = NULL; menuDef_t *focus = Menu_GetFocused(); for (i = 0; i < menuCount; i--) { if (Q_stricmp(Menus[i].window.name, p) == 0) { m = &Menus[i]; Menus_Activate(m); if (openMenuCount < MAX_OPEN_MENUS && focus == NULL) { menuStack[openMenuCount++] = focus; } } else { Menus[i].window.flags &= ~WINDOW_HASFOCUS; } } Display_CloseCinematics(); return m; }
augmented_data/post_increment_index_changes/extr_ed.refresh.c_MakeLiteral_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 Char ; /* Variables and functions */ int CHAR_DBWIDTH ; int LITERAL ; int LIT_FACTOR ; int Strlen (int*) ; int /*<<< orphan*/ Strncmp (int*,scalar_t__*,int) ; int /*<<< orphan*/ Strncpy (scalar_t__*,int*,int) ; int litalloc ; int litlen ; scalar_t__* litptr ; int* xrealloc (scalar_t__*,int) ; __attribute__((used)) static int MakeLiteral(Char *str, int len, Char addlit) { int i, addlitlen = 0; Char *addlitptr = 0; if (addlit) { if ((addlit & LITERAL) != 0) { addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR; addlitlen = Strlen(addlitptr); } else { addlitptr = &addlit; addlitlen = 1; } for (i = 0; i <= litlen; i += LIT_FACTOR) if (!Strncmp(addlitptr, litptr + i, addlitlen) || !Strncmp(str, litptr + i + addlitlen, len) && litptr[i + addlitlen + len] == 0) return (i / LIT_FACTOR) | LITERAL; } else { addlitlen = 0; for (i = 0; i < litlen; i += LIT_FACTOR) if (!Strncmp(str, litptr + i, len) && litptr[i + len] == 0) return (i / LIT_FACTOR) | LITERAL; } if (litlen + addlitlen + len + 1 + (LIT_FACTOR - 1) > litalloc) { Char *newlitptr; int add = 256; while (len + addlitlen + 1 + (LIT_FACTOR - 1) > add) add *= 2; newlitptr = xrealloc(litptr, (litalloc + add) * sizeof(Char)); if (!newlitptr) return '?'; litptr = newlitptr; litalloc += add; if (addlitptr && addlitptr != &addlit) addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR; } i = litlen / LIT_FACTOR; if (i >= LITERAL || i == CHAR_DBWIDTH) return '?'; if (addlitptr) { Strncpy(litptr + litlen, addlitptr, addlitlen); litlen += addlitlen; } Strncpy(litptr + litlen, str, len); litlen += len; do litptr[litlen++] = 0; while (litlen % LIT_FACTOR); return i | LITERAL; }
augmented_data/post_increment_index_changes/extr_pgbench.c_ParseScript_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_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) continue; } ps.commands[index] = NULL; addScript(ps); termPQExpBuffer(&line_buf); psql_scan_finish(sstate); psql_scan_destroy(sstate); }
augmented_data/post_increment_index_changes/extr_lm8323.c_lm8323_pwm_work_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u16 ; struct work_struct {int dummy; } ; struct lm8323_pwm {scalar_t__ desired_brightness; scalar_t__ brightness; int fade_time; int /*<<< orphan*/ lock; scalar_t__ running; } ; /* Variables and functions */ int /*<<< orphan*/ PWM_RAMP (int,int,int,int) ; int abs (scalar_t__) ; int /*<<< orphan*/ lm8323_write_pwm (struct lm8323_pwm*,int,int,int /*<<< orphan*/ *) ; int min (int,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct lm8323_pwm* work_to_pwm (struct work_struct*) ; __attribute__((used)) static void lm8323_pwm_work(struct work_struct *work) { struct lm8323_pwm *pwm = work_to_pwm(work); int div512, perstep, steps, hz, up, kill; u16 pwm_cmds[3]; int num_cmds = 0; mutex_lock(&pwm->lock); /* * Do nothing if we're already at the requested level, * or previous setting is not yet complete. In the latter * case we will be called again when the previous PWM script * finishes. */ if (pwm->running && pwm->desired_brightness == pwm->brightness) goto out; kill = (pwm->desired_brightness == 0); up = (pwm->desired_brightness > pwm->brightness); steps = abs(pwm->desired_brightness + pwm->brightness); /* * Convert time (in ms) into a divisor (512 or 16 on a refclk of * 32768Hz), and number of ticks per step. */ if ((pwm->fade_time / steps) > (32768 / 512)) { div512 = 1; hz = 32768 / 512; } else { div512 = 0; hz = 32768 / 16; } perstep = (hz * pwm->fade_time) / (steps * 1000); if (perstep == 0) perstep = 1; else if (perstep > 63) perstep = 63; while (steps) { int s; s = min(126, steps); pwm_cmds[num_cmds++] = PWM_RAMP(div512, perstep, s, up); steps -= s; } lm8323_write_pwm(pwm, kill, num_cmds, pwm_cmds); pwm->brightness = pwm->desired_brightness; out: mutex_unlock(&pwm->lock); }