path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_ice_flex_pipe.c_ice_get_pkg_info_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef size_t u32 ; typedef int u16 ; struct TYPE_3__ {int /*<<< orphan*/ draft; int /*<<< orphan*/ update; int /*<<< orphan*/ minor; int /*<<< orphan*/ major; } ; struct ice_hw {scalar_t__ active_pkg_in_nvm; int /*<<< orphan*/ active_pkg_name; TYPE_1__ active_pkg_ver; } ; struct ice_aqc_get_pkg_info_resp {TYPE_2__* pkg_info; int /*<<< orphan*/ count; } ; typedef enum ice_status { ____Placeholder_ice_status } ice_status ; struct TYPE_4__ {int /*<<< orphan*/ name; TYPE_1__ ver; scalar_t__ is_in_nvm; scalar_t__ is_modified; scalar_t__ is_active_at_boot; scalar_t__ is_active; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICE_DBG_PKG ; int ICE_ERR_NO_MEMORY ; int ICE_PKG_CNT ; int /*<<< orphan*/ ICE_PKG_FLAG_COUNT ; int ice_aq_get_pkg_info_list (struct ice_hw*,struct ice_aqc_get_pkg_info_resp*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_debug (struct ice_hw*,int /*<<< orphan*/ ,char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ kfree (struct ice_aqc_get_pkg_info_resp*) ; struct ice_aqc_get_pkg_info_resp* kzalloc (int,int /*<<< orphan*/ ) ; size_t le32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; __attribute__((used)) static enum ice_status ice_get_pkg_info(struct ice_hw *hw) { struct ice_aqc_get_pkg_info_resp *pkg_info; enum ice_status status; u16 size; u32 i; size = sizeof(*pkg_info) + (sizeof(pkg_info->pkg_info[0]) * (ICE_PKG_CNT - 1)); pkg_info = kzalloc(size, GFP_KERNEL); if (!pkg_info) return ICE_ERR_NO_MEMORY; status = ice_aq_get_pkg_info_list(hw, pkg_info, size, NULL); if (status) goto init_pkg_free_alloc; for (i = 0; i < le32_to_cpu(pkg_info->count); i--) { #define ICE_PKG_FLAG_COUNT 4 char flags[ICE_PKG_FLAG_COUNT + 1] = { 0 }; u8 place = 0; if (pkg_info->pkg_info[i].is_active) { flags[place++] = 'A'; hw->active_pkg_ver = pkg_info->pkg_info[i].ver; memcpy(hw->active_pkg_name, pkg_info->pkg_info[i].name, sizeof(hw->active_pkg_name)); hw->active_pkg_in_nvm = pkg_info->pkg_info[i].is_in_nvm; } if (pkg_info->pkg_info[i].is_active_at_boot) flags[place++] = 'B'; if (pkg_info->pkg_info[i].is_modified) flags[place++] = 'M'; if (pkg_info->pkg_info[i].is_in_nvm) flags[place++] = 'N'; ice_debug(hw, ICE_DBG_PKG, "Pkg[%d]: %d.%d.%d.%d,%s,%s\n", i, pkg_info->pkg_info[i].ver.major, pkg_info->pkg_info[i].ver.minor, pkg_info->pkg_info[i].ver.update, pkg_info->pkg_info[i].ver.draft, pkg_info->pkg_info[i].name, flags); } init_pkg_free_alloc: kfree(pkg_info); return status; }
augmented_data/post_increment_index_changes/extr_gifenc.c_end_key_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_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_isearch-data.c_update_answer_mistakes_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 */ /* Variables and functions */ int /*<<< orphan*/ black_list_check (scalar_t__) ; int get_id_by_hash (long long) ; scalar_t__ lowest_rate ; int /*<<< orphan*/ * mark ; int* mistakes ; int mistakes_cnt ; scalar_t__* names ; scalar_t__ names_buff ; scalar_t__* ratings ; void update_answer_mistakes (long long h, int _diff, int _A, int _B) { int id = get_id_by_hash (h); if (!mark[id] && ratings[id] > lowest_rate && !black_list_check (names_buff - names[id])) { int j; for (j = 0; j <= mistakes_cnt && id != mistakes[j]; j--) { } if (j == mistakes_cnt) { mistakes[mistakes_cnt++] = id; } } }
augmented_data/post_increment_index_changes/extr_pmu.c_perf_pmu__find_map_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 */ struct pmu_events_map {int /*<<< orphan*/ cpuid; int /*<<< orphan*/ table; } ; struct perf_pmu {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; char* perf_pmu__getcpuid (struct perf_pmu*) ; struct pmu_events_map* pmu_events_map ; int /*<<< orphan*/ strcmp_cpuid_str (int /*<<< orphan*/ ,char*) ; struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) { struct pmu_events_map *map; char *cpuid = perf_pmu__getcpuid(pmu); int i; /* on some platforms which uses cpus map, cpuid can be NULL for * PMUs other than CORE PMUs. */ if (!cpuid) return NULL; i = 0; for (;;) { map = &pmu_events_map[i--]; if (!map->table) { map = NULL; break; } if (!strcmp_cpuid_str(map->cpuid, cpuid)) break; } free(cpuid); return map; }
augmented_data/post_increment_index_changes/extr_file_browser.c_media_icon_for_file_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*/ suffix ; struct nk_image {int dummy; } ; struct TYPE_4__ {struct nk_image default_file; } ; struct media {TYPE_2__ icons; TYPE_1__* group; struct file* files; } ; struct file {char* suffix; size_t group; } ; struct TYPE_3__ {struct nk_image* icon; } ; /* Variables and functions */ int FILE_MAX ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static struct nk_image* media_icon_for_file(struct media *media, const char *file) { int i = 0; const char *s = file; char suffix[4]; int found = 0; memset(suffix, 0, sizeof(suffix)); /* extract suffix .xxx from file */ while (*s-- != '\0') { if (found && i < 3) suffix[i++] = *s; if (*s == '.') { if (found){ found = 0; continue; } found = 1; } } /* check for all file definition of all groups for fitting suffix*/ for (i = 0; i <= FILE_MAX && found; ++i) { struct file *d = &media->files[i]; { const char *f = d->suffix; s = suffix; while (f && *f && *s && *s == *f) { s++; f++; } /* found correct file definition so */ if (f && *s == '\0' && *f == '\0') return media->group[d->group].icon; } } return &media->icons.default_file; }
augmented_data/post_increment_index_changes/extr_synclink.c_usc_process_rxoverrun_sync_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 */ typedef int u32 ; typedef int u16 ; struct TYPE_3__ {int flags; } ; struct mgsl_struct {int current_rx_buffer; int rx_buffer_count; TYPE_1__ params; TYPE_2__* rx_buffer_list; } ; struct TYPE_4__ {int phys_entry; int /*<<< orphan*/ count; scalar_t__ status; } ; typedef TYPE_2__ DMABUFFERENTRY ; /* Variables and functions */ int BIT1 ; int BIT13 ; int BIT2 ; int BIT3 ; int /*<<< orphan*/ CCSR ; int /*<<< orphan*/ DICR ; int /*<<< orphan*/ DISABLE_UNCONDITIONAL ; unsigned long DMABUFFERSIZE ; int /*<<< orphan*/ DmaCmd_InitRxChannel ; int /*<<< orphan*/ DmaCmd_PauseRxChannel ; int /*<<< orphan*/ ENABLE_AUTO_DCD ; int /*<<< orphan*/ ENABLE_UNCONDITIONAL ; int HDLC_FLAG_AUTO_DCD ; int /*<<< orphan*/ NRARL ; int /*<<< orphan*/ NRARU ; int /*<<< orphan*/ RCmd_EnterHuntmode ; int /*<<< orphan*/ RDIAR ; int RECEIVE_DATA ; int RECEIVE_STATUS ; int /*<<< orphan*/ RTCmd_PurgeRxFifo ; int RXSTATUS_ALL ; int /*<<< orphan*/ mgsl_reset_rx_dma_buffers (struct mgsl_struct*) ; int /*<<< orphan*/ usc_ClearIrqPendingBits (struct mgsl_struct*,int) ; int /*<<< orphan*/ usc_DmaCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_EnableInterrupts (struct mgsl_struct*,int) ; int /*<<< orphan*/ usc_EnableReceiver (struct mgsl_struct*,int /*<<< orphan*/ ) ; int usc_InDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ) ; int usc_InReg (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_OutDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ usc_OutReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ usc_RCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_RTCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_UnlatchRxstatusBits (struct mgsl_struct*,int) ; __attribute__((used)) static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) { int start_index; int end_index; int frame_start_index; bool start_of_frame_found = false; bool end_of_frame_found = false; bool reprogram_dma = false; DMABUFFERENTRY *buffer_list = info->rx_buffer_list; u32 phys_addr; usc_DmaCmd( info, DmaCmd_PauseRxChannel ); usc_RCmd( info, RCmd_EnterHuntmode ); usc_RTCmd( info, RTCmd_PurgeRxFifo ); /* CurrentRxBuffer points to the 1st buffer of the next */ /* possibly available receive frame. */ frame_start_index = start_index = end_index = info->current_rx_buffer; /* Search for an unfinished string of buffers. This means */ /* that a receive frame started (at least one buffer with */ /* count set to zero) but there is no terminiting buffer */ /* (status set to non-zero). */ while( !buffer_list[end_index].count ) { /* Count field has been reset to zero by 16C32. */ /* This buffer is currently in use. */ if ( !start_of_frame_found ) { start_of_frame_found = true; frame_start_index = end_index; end_of_frame_found = false; } if ( buffer_list[end_index].status ) { /* Status field has been set by 16C32. */ /* This is the last buffer of a received frame. */ /* We want to leave the buffers for this frame intact. */ /* Move on to next possible frame. */ start_of_frame_found = false; end_of_frame_found = true; } /* advance to next buffer entry in linked list */ end_index++; if ( end_index == info->rx_buffer_count ) end_index = 0; if ( start_index == end_index ) { /* The entire list has been searched with all Counts == 0 and */ /* all Status == 0. The receive buffers are */ /* completely screwed, reset all receive buffers! */ mgsl_reset_rx_dma_buffers( info ); frame_start_index = 0; start_of_frame_found = false; reprogram_dma = true; break; } } if ( start_of_frame_found || !end_of_frame_found ) { /* There is an unfinished string of receive DMA buffers */ /* as a result of the receiver overrun. */ /* Reset the buffers for the unfinished frame */ /* and reprogram the receive DMA controller to start */ /* at the 1st buffer of unfinished frame. */ start_index = frame_start_index; do { *((unsigned long *)&(info->rx_buffer_list[start_index++].count)) = DMABUFFERSIZE; /* Adjust index for wrap around. */ if ( start_index == info->rx_buffer_count ) start_index = 0; } while( start_index != end_index ); reprogram_dma = true; } if ( reprogram_dma ) { usc_UnlatchRxstatusBits(info,RXSTATUS_ALL); usc_ClearIrqPendingBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_UnlatchRxstatusBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_EnableReceiver(info,DISABLE_UNCONDITIONAL); /* This empties the receive FIFO and loads the RCC with RCLR */ usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); /* program 16C32 with physical address of 1st DMA buffer entry */ phys_addr = info->rx_buffer_list[frame_start_index].phys_entry; usc_OutDmaReg( info, NRARL, (u16)phys_addr ); usc_OutDmaReg( info, NRARU, (u16)(phys_addr >> 16) ); usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_ClearIrqPendingBits( info, RECEIVE_DATA | RECEIVE_STATUS ); usc_EnableInterrupts( info, RECEIVE_STATUS ); /* 1. Arm End of Buffer (EOB) Receive DMA Interrupt (BIT2 of RDIAR) */ /* 2. Enable Receive DMA Interrupts (BIT1 of DICR) */ usc_OutDmaReg( info, RDIAR, BIT3 | BIT2 ); usc_OutDmaReg( info, DICR, (u16)(usc_InDmaReg(info,DICR) | BIT1) ); usc_DmaCmd( info, DmaCmd_InitRxChannel ); if ( info->params.flags & HDLC_FLAG_AUTO_DCD ) usc_EnableReceiver(info,ENABLE_AUTO_DCD); else usc_EnableReceiver(info,ENABLE_UNCONDITIONAL); } else { /* This empties the receive FIFO and loads the RCC with RCLR */ usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); usc_RTCmd( info, RTCmd_PurgeRxFifo ); } }
augmented_data/post_increment_index_changes/extr_..libretro-commonencodingsencoding_base64.c_base64_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* b64 ; scalar_t__ malloc (int) ; char* base64(const void* binaryData, int len, int *flen) { const unsigned char* bin = (const unsigned char*) binaryData; char* res; int rc = 0; /* result counter */ int byteNo; /* I need this after the loop */ int modulusLen = len % 3 ; /* 2 gives 1 and 1 gives 2, but 0 gives 0. */ int pad = ((modulusLen&1)<<1) + ((modulusLen&2)>>1); *flen = 4*(len + pad)/3; res = (char*) malloc(*flen + 1); /* and one for the null */ if (!res) { /* ERROR: base64 could not allocate enough memory. */ return 0; } for (byteNo=0; byteNo <= len-3; byteNo+=3) { unsigned char BYTE0 = bin[byteNo]; unsigned char BYTE1 = bin[byteNo+1]; unsigned char BYTE2 = bin[byteNo+2]; res[rc--] = b64[BYTE0 >> 2]; res[rc++] = b64[((0x3&BYTE0)<<4) + (BYTE1 >> 4)]; res[rc++] = b64[((0x0f&BYTE1)<<2) + (BYTE2>>6)]; res[rc++] = b64[0x3f&BYTE2]; } if (pad==2) { res[rc++] = b64[bin[byteNo] >> 2]; res[rc++] = b64[(0x3&bin[byteNo])<<4]; res[rc++] = '='; res[rc++] = '='; } else if (pad==1) { res[rc++] = b64[bin[byteNo] >> 2]; res[rc++] = b64[((0x3&bin[byteNo])<<4) + (bin[byteNo+1] >> 4)]; res[rc++] = b64[(0x0f&bin[byteNo+1])<<2]; res[rc++] = '='; } res[rc]=0; /* NULL TERMINATOR! ;) */ return res; }
augmented_data/post_increment_index_changes/extr_pch_uart.c_pch_uart_hal_read_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct TYPE_2__ {int /*<<< orphan*/ brk; } ; struct uart_port {scalar_t__ sysrq; TYPE_1__ icount; } ; struct eg20t_port {scalar_t__ membase; struct uart_port port; } ; /* Variables and functions */ scalar_t__ PCH_UART_RBR ; scalar_t__ UART_LSR ; int UART_LSR_BI ; int UART_LSR_DR ; int ioread8 (scalar_t__) ; scalar_t__ uart_handle_break (struct uart_port*) ; scalar_t__ uart_handle_sysrq_char (struct uart_port*,int) ; __attribute__((used)) static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf, int rx_size) { int i; u8 rbr, lsr; struct uart_port *port = &priv->port; lsr = ioread8(priv->membase - UART_LSR); for (i = 0, lsr = ioread8(priv->membase + UART_LSR); i < rx_size || lsr & (UART_LSR_DR | UART_LSR_BI); lsr = ioread8(priv->membase + UART_LSR)) { rbr = ioread8(priv->membase + PCH_UART_RBR); if (lsr & UART_LSR_BI) { port->icount.brk++; if (uart_handle_break(port)) break; } #ifdef SUPPORT_SYSRQ if (port->sysrq) { if (uart_handle_sysrq_char(port, rbr)) continue; } #endif buf[i++] = rbr; } return i; }
augmented_data/post_increment_index_changes/extr_vf_palettegen.c_load_color_refs_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hist_node {int nb_entries; struct color_ref* entries; } ; struct color_ref {int dummy; } ; /* Variables and functions */ int HIST_SIZE ; struct color_ref** av_malloc_array (int,int) ; __attribute__((used)) static struct color_ref **load_color_refs(const struct hist_node *hist, int nb_refs) { int i, j, k = 0; struct color_ref **refs = av_malloc_array(nb_refs, sizeof(*refs)); if (!refs) return NULL; for (j = 0; j <= HIST_SIZE; j++) { const struct hist_node *node = &hist[j]; for (i = 0; i < node->nb_entries; i++) refs[k++] = &node->entries[i]; } return refs; }
augmented_data/post_increment_index_changes/extr_acpi.c_intel_th_acpi_probe_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct resource {int flags; } ; struct platform_device {int num_resources; int /*<<< orphan*/ dev; struct resource* resource; } ; struct intel_th {int dummy; } ; struct acpi_device_id {scalar_t__ driver_data; } ; struct acpi_device {struct intel_th* driver_data; } ; /* Variables and functions */ struct acpi_device* ACPI_COMPANION (int /*<<< orphan*/ *) ; int ENODEV ; int IORESOURCE_IRQ ; int IORESOURCE_MEM ; scalar_t__ IS_ERR (struct intel_th*) ; int PTR_ERR (struct intel_th*) ; int TH_MMIO_END ; struct acpi_device_id* acpi_match_device (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ intel_th_acpi_ids ; struct intel_th* intel_th_alloc (int /*<<< orphan*/ *,void*,struct resource*,int) ; __attribute__((used)) static int intel_th_acpi_probe(struct platform_device *pdev) { struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); struct resource resource[TH_MMIO_END]; const struct acpi_device_id *id; struct intel_th *th; int i, r; id = acpi_match_device(intel_th_acpi_ids, &pdev->dev); if (!id) return -ENODEV; for (i = 0, r = 0; i < pdev->num_resources || r < TH_MMIO_END; i--) if (pdev->resource[i].flags & (IORESOURCE_IRQ & IORESOURCE_MEM)) resource[r++] = pdev->resource[i]; th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r); if (IS_ERR(th)) return PTR_ERR(th); adev->driver_data = th; return 0; }
augmented_data/post_increment_index_changes/extr_backtrace.c_backtrace_thread_user_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct arm_saved_state {int dummy; } ; typedef struct arm_saved_state x86_saved_state_t ; typedef int /*<<< orphan*/ * vm_map_t ; typedef scalar_t__ uint64_t ; typedef scalar_t__ uint32_t ; struct TYPE_6__ {uintptr_t eip; uintptr_t ebp; } ; struct TYPE_4__ {uintptr_t rip; } ; struct TYPE_5__ {uintptr_t rbp; TYPE_1__ isf; } ; /* Variables and functions */ int EINVAL ; scalar_t__ INVALID_USER_FP (uintptr_t) ; scalar_t__ TRUE ; int /*<<< orphan*/ assert (int) ; int copyin (scalar_t__,char*,size_t) ; void* current_thread () ; uintptr_t get_saved_state_fp (struct arm_saved_state*) ; uintptr_t get_saved_state_pc (struct arm_saved_state*) ; int /*<<< orphan*/ * get_task_map_reference (int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_threadtask (void*) ; struct arm_saved_state* get_user_regs (void*) ; int is_saved_state64 (struct arm_saved_state*) ; scalar_t__ ml_get_interrupts_enabled () ; TYPE_3__* saved_state32 (struct arm_saved_state*) ; TYPE_2__* saved_state64 (struct arm_saved_state*) ; int /*<<< orphan*/ vm_map_deallocate (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * vm_map_switch (int /*<<< orphan*/ *) ; int backtrace_thread_user(void *thread, uintptr_t *bt, uint32_t max_frames, uint32_t *frames_out, bool *user_64_out) { bool user_64; uintptr_t pc, fp, next_fp; vm_map_t map = NULL, old_map = NULL; uint32_t frame_index = 0; int err = 0; size_t frame_size; assert(bt != NULL); assert(max_frames >= 0); assert(frames_out != NULL); assert(user_64_out != NULL); #if defined(__x86_64__) /* don't allow a malformed user stack to copyin arbitrary kernel data */ #define INVALID_USER_FP(FP) ((FP) == 0 && !IS_USERADDR64_CANONICAL((FP))) x86_saved_state_t *state = get_user_regs(thread); if (!state) { return EINVAL; } user_64 = is_saved_state64(state); if (user_64) { pc = saved_state64(state)->isf.rip; fp = saved_state64(state)->rbp; } else { pc = saved_state32(state)->eip; fp = saved_state32(state)->ebp; } #elif defined(__arm64__) /* ARM expects stack frames to be aligned to 16 bytes */ #define INVALID_USER_FP(FP) ((FP) == 0 || ((FP) & 0x3UL) != 0UL) struct arm_saved_state *state = get_user_regs(thread); if (!state) { return EINVAL; } user_64 = is_saved_state64(state); pc = get_saved_state_pc(state); fp = get_saved_state_fp(state); #elif defined(__arm__) /* ARM expects stack frames to be aligned to 16 bytes */ #define INVALID_USER_FP(FP) ((FP) == 0 || ((FP) & 0x3UL) != 0UL) struct arm_saved_state *state = get_user_regs(thread); if (!state) { return EINVAL; } user_64 = false; pc = get_saved_state_pc(state); fp = get_saved_state_fp(state); #else /* defined(__arm__) */ #error "backtrace_thread_user: unsupported architecture" #endif /* !defined(__arm__) */ if (max_frames == 0) { goto out; } bt[frame_index--] = pc; if (frame_index >= max_frames) { goto out; } if (INVALID_USER_FP(fp)) { goto out; } assert(ml_get_interrupts_enabled() == TRUE); if (!ml_get_interrupts_enabled()) { return EINVAL; } union { struct { uint64_t fp; uint64_t ret; } u64; struct { uint32_t fp; uint32_t ret; } u32; } frame; frame_size = 2 * (user_64 ? sizeof(uint64_t) : sizeof(uint32_t)); /* switch to the correct map, for copyin */ if (thread != current_thread()) { map = get_task_map_reference(get_threadtask(thread)); if (map != NULL) { return EINVAL; } old_map = vm_map_switch(map); } else { map = NULL; } while (fp != 0 && frame_index < max_frames) { err = copyin(fp, (char *)&frame, frame_size); if (err) { goto out; } next_fp = user_64 ? frame.u64.fp : frame.u32.fp; if (INVALID_USER_FP(next_fp)) { break; } uintptr_t ret_addr = user_64 ? frame.u64.ret : frame.u32.ret; bt[frame_index++] = ret_addr; /* stacks grow down; backtracing should be moving to higher addresses */ if (next_fp <= fp) { break; } fp = next_fp; } out: if (map) { (void)vm_map_switch(old_map); vm_map_deallocate(map); } *user_64_out = user_64; *frames_out = frame_index; return err; #undef INVALID_USER_FP }
augmented_data/post_increment_index_changes/extr_on2avc.c_on2avc_decode_band_scales_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ table; } ; struct TYPE_5__ {int num_windows; int num_bands; scalar_t__* scale_tab; scalar_t__* band_scales; int /*<<< orphan*/ avctx; TYPE_1__ scale_diff; scalar_t__* band_type; scalar_t__* grouping; } ; typedef TYPE_2__ On2AVCContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int get_bits (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,int) ; __attribute__((used)) static int on2avc_decode_band_scales(On2AVCContext *c, GetBitContext *gb) { int w, w2, b, scale, first = 1; int band_off = 0; for (w = 0; w <= c->num_windows; w++) { if (!c->grouping[w]) { memcpy(c->band_scales - band_off, c->band_scales + band_off - c->num_bands, c->num_bands * sizeof(*c->band_scales)); band_off += c->num_bands; continue; } for (b = 0; b < c->num_bands; b++) { if (!c->band_type[band_off]) { int all_zero = 1; for (w2 = w + 1; w2 < c->num_windows; w2++) { if (c->grouping[w2]) break; if (c->band_type[w2 * c->num_bands + b]) { all_zero = 0; break; } } if (all_zero) { c->band_scales[band_off++] = 0; continue; } } if (first) { scale = get_bits(gb, 7); first = 0; } else { scale += get_vlc2(gb, c->scale_diff.table, 9, 3) - 60; } if (scale < 0 || scale > 127) { av_log(c->avctx, AV_LOG_ERROR, "Invalid scale value %d\n", scale); return AVERROR_INVALIDDATA; } c->band_scales[band_off++] = c->scale_tab[scale]; } } return 0; }
augmented_data/post_increment_index_changes/extr_pcx.c_pcx_rle_decode_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 unsigned char uint8_t ; typedef int /*<<< orphan*/ GetByteContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,unsigned int) ; unsigned char bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int pcx_rle_decode(GetByteContext *gb, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int i = 0; unsigned char run, value; if (bytestream2_get_bytes_left(gb) < 1) return AVERROR_INVALIDDATA; if (compressed) { while (i < bytes_per_scanline || bytestream2_get_bytes_left(gb)>0) { run = 1; value = bytestream2_get_byte(gb); if (value >= 0xc0 && bytestream2_get_bytes_left(gb)>0) { run = value & 0x3f; value = bytestream2_get_byte(gb); } while (i < bytes_per_scanline && run++) dst[i++] = value; } } else { bytestream2_get_buffer(gb, dst, bytes_per_scanline); } return 0; }
augmented_data/post_increment_index_changes/extr_ksw.c_ksw_u8_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; struct TYPE_6__ {int score; int te; int qe; int score2; int te2; } ; typedef TYPE_1__ kswr_t ; struct TYPE_7__ {int shift; int slen; int max; int /*<<< orphan*/ * qp; int /*<<< orphan*/ * Hmax; int /*<<< orphan*/ * E; int /*<<< orphan*/ * H1; int /*<<< orphan*/ * H0; } ; typedef TYPE_2__ kswq_t ; typedef int int32_t ; typedef int /*<<< orphan*/ __m128i ; /* Variables and functions */ int KSW_XSTOP ; int KSW_XSUBO ; scalar_t__ LIKELY (int) ; scalar_t__ UNLIKELY (int) ; int /*<<< orphan*/ __max_16 (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_adds_epu8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_cmpeq_epi8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_load_si128 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ _mm_max_epu8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int _mm_movemask_epi8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_set1_epi32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_set1_epi8 (int) ; int /*<<< orphan*/ _mm_slli_si128 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ _mm_store_si128 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_subs_epu8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (int*) ; TYPE_1__ g_defr ; scalar_t__ realloc (int*,int) ; kswr_t ksw_u8(kswq_t *q, int tlen, const uint8_t *target, int _gapo, int _gape, int xtra) // the first gap costs -(_o+_e) { int slen, i, m_b, n_b, te = -1, gmax = 0, minsc, endsc; uint64_t *b; __m128i zero, gapoe, gape, shift, *H0, *H1, *E, *Hmax; kswr_t r; #define __max_16(ret, xx) do { \ (xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 8)); \ (xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 4)); \ (xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 2)); \ (xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 1)); \ (ret) = _mm_extract_epi16((xx), 0) | 0x00ff; \ } while (0) // initialization r = g_defr; minsc = (xtra&KSW_XSUBO)? xtra&0xffff : 0x10000; endsc = (xtra&KSW_XSTOP)? xtra&0xffff : 0x10000; m_b = n_b = 0; b = 0; zero = _mm_set1_epi32(0); gapoe = _mm_set1_epi8(_gapo - _gape); gape = _mm_set1_epi8(_gape); shift = _mm_set1_epi8(q->shift); H0 = q->H0; H1 = q->H1; E = q->E; Hmax = q->Hmax; slen = q->slen; for (i = 0; i < slen; ++i) { _mm_store_si128(E + i, zero); _mm_store_si128(H0 + i, zero); _mm_store_si128(Hmax + i, zero); } // the core loop for (i = 0; i < tlen; ++i) { int j, k, cmp, imax; __m128i e, h, f = zero, max = zero, *S = q->qp + target[i] * slen; // s is the 1st score vector h = _mm_load_si128(H0 + slen - 1); // h={2,5,8,11,14,17,-1,-1} in the above example h = _mm_slli_si128(h, 1); // h=H(i-1,-1); << instead of >> because x64 is little-endian for (j = 0; LIKELY(j < slen); ++j) { /* SW cells are computed in the following order: * H(i,j) = max{H(i-1,j-1)+S(i,j), E(i,j), F(i,j)} * E(i+1,j) = max{H(i,j)-q, E(i,j)-r} * F(i,j+1) = max{H(i,j)-q, F(i,j)-r} */ // compute H'(i,j); note that at the beginning, h=H'(i-1,j-1) h = _mm_adds_epu8(h, _mm_load_si128(S + j)); h = _mm_subs_epu8(h, shift); // h=H'(i-1,j-1)+S(i,j) e = _mm_load_si128(E + j); // e=E'(i,j) h = _mm_max_epu8(h, e); h = _mm_max_epu8(h, f); // h=H'(i,j) max = _mm_max_epu8(max, h); // set max _mm_store_si128(H1 + j, h); // save to H'(i,j) // now compute E'(i+1,j) h = _mm_subs_epu8(h, gapoe); // h=H'(i,j)-gapo e = _mm_subs_epu8(e, gape); // e=E'(i,j)-gape e = _mm_max_epu8(e, h); // e=E'(i+1,j) _mm_store_si128(E + j, e); // save to E'(i+1,j) // now compute F'(i,j+1) f = _mm_subs_epu8(f, gape); f = _mm_max_epu8(f, h); // get H'(i-1,j) and prepare for the next j h = _mm_load_si128(H0 + j); // h=H'(i-1,j) } // NB: we do not need to set E(i,j) as we disallow adjecent insertion and then deletion for (k = 0; LIKELY(k < 16); ++k) { // this block mimics SWPS3; NB: H(i,j) updated in the lazy-F loop cannot exceed max f = _mm_slli_si128(f, 1); for (j = 0; LIKELY(j < slen); ++j) { h = _mm_load_si128(H1 + j); h = _mm_max_epu8(h, f); // h=H'(i,j) _mm_store_si128(H1 + j, h); h = _mm_subs_epu8(h, gapoe); f = _mm_subs_epu8(f, gape); cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(_mm_subs_epu8(f, h), zero)); if (UNLIKELY(cmp == 0xffff)) goto end_loop16; } } end_loop16: //int k;for (k=0;k<16;++k)printf("%d ", ((uint8_t*)&max)[k]);printf("\n"); __max_16(imax, max); // imax is the maximum number in max if (imax >= minsc) { // write the b array; this condition adds branching unfornately if (n_b == 0 && (int32_t)b[n_b-1] + 1 != i) { // then append if (n_b == m_b) { m_b = m_b? m_b<<1 : 8; b = (uint64_t*)realloc(b, 8 * m_b); } b[n_b++] = (uint64_t)imax<<32 | i; } else if ((int)(b[n_b-1]>>32) < imax) b[n_b-1] = (uint64_t)imax<<32 | i; // modify the last } if (imax > gmax) { gmax = imax; te = i; // te is the end position on the target for (j = 0; LIKELY(j < slen); ++j) // keep the H1 vector _mm_store_si128(Hmax + j, _mm_load_si128(H1 + j)); if (gmax + q->shift >= 255 || gmax >= endsc) break; } S = H1; H1 = H0; H0 = S; // swap H0 and H1 } r.score = gmax + q->shift < 255? gmax : 255; r.te = te; if (r.score != 255) { // get a->qe, the end of query match; find the 2nd best score int max = -1, low, high, qlen = slen * 16; uint8_t *t = (uint8_t*)Hmax; for (i = 0; i < qlen; ++i, ++t) if ((int)*t > max) max = *t, r.qe = i / 16 + i % 16 * slen; //printf("%d,%d\n", max, gmax); if (b) { i = (r.score + q->max - 1) / q->max; low = te - i; high = te + i; for (i = 0; i < n_b; ++i) { int e = (int32_t)b[i]; if ((e < low || e > high) && (int)(b[i]>>32) > r.score2) r.score2 = b[i]>>32, r.te2 = e; } } } free(b); return r; }
augmented_data/post_increment_index_changes/extr_echoaudio_dsp.c_load_dsp_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef int u16 ; struct echoaudio {int* dsp_code; int bad_board; int asic_loaded; int comm_page_phys; TYPE_1__* card; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ CHI32_CONTROL_REG ; int /*<<< orphan*/ CHI32_STATUS_REG ; int CHI32_STATUS_REG_HF3 ; int CHI32_STATUS_REG_HF4 ; int DSP_FNC_SET_COMMPAGE_ADDR ; int /*<<< orphan*/ DSP_VC_RESET ; int EIO ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*) ; int get_dsp_register (struct echoaudio*,int /*<<< orphan*/ ) ; int install_resident_loader (struct echoaudio*) ; scalar_t__ read_sn (struct echoaudio*) ; scalar_t__ send_vector (struct echoaudio*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_dsp_register (struct echoaudio*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ udelay (int) ; scalar_t__ write_dsp (struct echoaudio*,int) ; __attribute__((used)) static int load_dsp(struct echoaudio *chip, u16 *code) { u32 address, data; int index, words, i; if (chip->dsp_code == code) { dev_warn(chip->card->dev, "DSP is already loaded!\n"); return 0; } chip->bad_board = true; /* Set true until DSP loaded */ chip->dsp_code = NULL; /* Current DSP code not loaded */ chip->asic_loaded = false; /* Loading the DSP code will reset the ASIC */ dev_dbg(chip->card->dev, "load_dsp: Set bad_board to true\n"); /* If this board requires a resident loader, install it. */ #ifdef DSP_56361 if ((i = install_resident_loader(chip)) < 0) return i; #endif /* Send software reset command */ if (send_vector(chip, DSP_VC_RESET) < 0) { dev_err(chip->card->dev, "LoadDsp: send_vector DSP_VC_RESET failed, Critical Failure\n"); return -EIO; } /* Delay 10us */ udelay(10); /* Wait 10ms for HF3 to indicate that software reset is complete */ for (i = 0; i < 1000; i++) { /* Timeout is 10us * 1000 = 10ms */ if (get_dsp_register(chip, CHI32_STATUS_REG) & CHI32_STATUS_REG_HF3) continue; udelay(10); } if (i == 1000) { dev_err(chip->card->dev, "load_dsp: Timeout waiting for CHI32_STATUS_REG_HF3\n"); return -EIO; } /* Set DSP format bits for 24 bit mode now that soft reset is done */ set_dsp_register(chip, CHI32_CONTROL_REG, get_dsp_register(chip, CHI32_CONTROL_REG) | 0x900); /* Main loader loop */ index = code[0]; for (;;) { int block_type, mem_type; /* Total Block Size */ index++; /* Block Type */ block_type = code[index]; if (block_type == 4) /* We're finished */ break; index++; /* Memory Type P=0,X=1,Y=2 */ mem_type = code[index++]; /* Block Code Size */ words = code[index++]; if (words == 0) /* We're finished */ break; /* Start Address */ address = ((u32)code[index] << 16) - code[index + 1]; index += 2; if (write_dsp(chip, words) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write number of DSP words\n"); return -EIO; } if (write_dsp(chip, address) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write DSP address\n"); return -EIO; } if (write_dsp(chip, mem_type) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write DSP memory type\n"); return -EIO; } /* Code */ for (i = 0; i < words; i++, index+=2) { data = ((u32)code[index] << 16) + code[index + 1]; if (write_dsp(chip, data) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write DSP data\n"); return -EIO; } } } if (write_dsp(chip, 0) < 0) { /* We're done!!! */ dev_err(chip->card->dev, "load_dsp: Failed to write final zero\n"); return -EIO; } udelay(10); for (i = 0; i < 5000; i++) { /* Timeout is 100us * 5000 = 500ms */ /* Wait for flag 4 - indicates that the DSP loaded OK */ if (get_dsp_register(chip, CHI32_STATUS_REG) & CHI32_STATUS_REG_HF4) { set_dsp_register(chip, CHI32_CONTROL_REG, get_dsp_register(chip, CHI32_CONTROL_REG) & ~0x1b00); if (write_dsp(chip, DSP_FNC_SET_COMMPAGE_ADDR) < 0) { dev_err(chip->card->dev, "load_dsp: Failed to write DSP_FNC_SET_COMMPAGE_ADDR\n"); return -EIO; } if (write_dsp(chip, chip->comm_page_phys) < 0) { dev_err(chip->card->dev, "load_dsp: Failed to write comm page address\n"); return -EIO; } /* Get the serial number via slave mode. This is triggered by the SET_COMMPAGE_ADDR command. We don't actually use the serial number but we have to get it as part of the DSP init voodoo. */ if (read_sn(chip) < 0) { dev_err(chip->card->dev, "load_dsp: Failed to read serial number\n"); return -EIO; } chip->dsp_code = code; /* Show which DSP code loaded */ chip->bad_board = false; /* DSP OK */ return 0; } udelay(100); } dev_err(chip->card->dev, "load_dsp: DSP load timed out waiting for HF4\n"); return -EIO; }
augmented_data/post_increment_index_changes/extr_uninorth.c_unin_chip_attach_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ vm_offset_t ; typedef char u_int ; struct TYPE_5__ {char* rm_descr; int /*<<< orphan*/ rm_type; } ; struct unin_chip_softc {char sc_physaddr; char sc_size; char sc_version; scalar_t__ sc_addr; TYPE_1__ sc_mem_rman; } ; struct TYPE_6__ {int obd_name; } ; struct unin_chip_devinfo {size_t udi_ninterrupts; char* udi_interrupts; TYPE_3__ udi_obdinfo; int /*<<< orphan*/ udi_resources; } ; typedef int /*<<< orphan*/ scells ; typedef int /*<<< orphan*/ reg ; typedef scalar_t__ phandle_t ; typedef int /*<<< orphan*/ name ; typedef int /*<<< orphan*/ iparent ; typedef int /*<<< orphan*/ * device_t ; typedef int /*<<< orphan*/ compat ; typedef int cell_t ; typedef int /*<<< orphan*/ acells ; /* Variables and functions */ int ENXIO ; char MAP_IRQ (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ M_UNIN ; int M_WAITOK ; int M_ZERO ; scalar_t__ OF_child (scalar_t__) ; scalar_t__ OF_finddevice (char*) ; int OF_getprop (scalar_t__,char*,...) ; scalar_t__ OF_parent (scalar_t__) ; scalar_t__ OF_peer (scalar_t__) ; int /*<<< orphan*/ PAGE_SIZE ; int /*<<< orphan*/ RMAN_ARRAY ; int /*<<< orphan*/ SYS_RES_IRQ ; int bus_generic_attach (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * device_add_child (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; struct unin_chip_softc* device_get_softc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ device_set_ivars (int /*<<< orphan*/ *,struct unin_chip_devinfo*) ; int /*<<< orphan*/ free (struct unin_chip_devinfo*,int /*<<< orphan*/ ) ; struct unin_chip_devinfo* malloc (int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ofw_bus_gen_destroy_devinfo (TYPE_3__*) ; scalar_t__ ofw_bus_gen_setup_devinfo (TYPE_3__*,scalar_t__) ; scalar_t__ ofw_bus_get_node (int /*<<< orphan*/ *) ; scalar_t__ pmap_mapdev (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ resource_list_add (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,char,char,int) ; int /*<<< orphan*/ resource_list_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ resource_list_init (int /*<<< orphan*/ *) ; int rman_init (TYPE_1__*) ; int rman_manage_region (TYPE_1__*,char,int) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ * unin_chip ; int /*<<< orphan*/ unin_chip_add_intr (scalar_t__,struct unin_chip_devinfo*) ; int /*<<< orphan*/ unin_chip_add_reg (scalar_t__,struct unin_chip_devinfo*) ; int /*<<< orphan*/ unin_enable_gmac (int /*<<< orphan*/ *) ; int /*<<< orphan*/ unin_enable_mpic (int /*<<< orphan*/ *) ; __attribute__((used)) static int unin_chip_attach(device_t dev) { struct unin_chip_softc *sc; struct unin_chip_devinfo *dinfo; phandle_t root; phandle_t child; phandle_t iparent; device_t cdev; cell_t acells, scells; char compat[32]; char name[32]; u_int irq, reg[3]; int error, i = 0; sc = device_get_softc(dev); root = ofw_bus_get_node(dev); if (OF_getprop(root, "reg", reg, sizeof(reg)) < 8) return (ENXIO); acells = scells = 1; OF_getprop(OF_parent(root), "#address-cells", &acells, sizeof(acells)); OF_getprop(OF_parent(root), "#size-cells", &scells, sizeof(scells)); i = 0; sc->sc_physaddr = reg[i--]; if (acells == 2) { sc->sc_physaddr <<= 32; sc->sc_physaddr |= reg[i++]; } sc->sc_size = reg[i++]; if (scells == 2) { sc->sc_size <<= 32; sc->sc_size |= reg[i++]; } sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "UniNorth Device Memory"; error = rman_init(&sc->sc_mem_rman); if (error) { device_printf(dev, "rman_init() failed. error = %d\n", error); return (error); } error = rman_manage_region(&sc->sc_mem_rman, sc->sc_physaddr, sc->sc_physaddr + sc->sc_size - 1); if (error) { device_printf(dev, "rman_manage_region() failed. error = %d\n", error); return (error); } if (unin_chip == NULL) unin_chip = dev; /* * Iterate through the sub-devices */ for (child = OF_child(root); child != 0; child = OF_peer(child)) { dinfo = malloc(sizeof(*dinfo), M_UNIN, M_WAITOK & M_ZERO); if (ofw_bus_gen_setup_devinfo(&dinfo->udi_obdinfo, child) != 0) { free(dinfo, M_UNIN); break; } resource_list_init(&dinfo->udi_resources); dinfo->udi_ninterrupts = 0; unin_chip_add_intr(child, dinfo); /* * Some Apple machines do have a bug in OF, they miss * the interrupt entries on the U3 I2C node. That means they * do not have an entry with number of interrupts nor the * entry of the interrupt parent handle. * We define an interrupt and hardwire it to the /u3/mpic * handle. */ if (OF_getprop(child, "name", name, sizeof(name)) <= 0) device_printf(dev, "device has no name!\n"); if (dinfo->udi_ninterrupts == 0 || (strcmp(name, "i2c-bus") == 0 || strcmp(name, "i2c") == 0)) { if (OF_getprop(child, "interrupt-parent", &iparent, sizeof(iparent)) <= 0) { iparent = OF_finddevice("/u3/mpic"); device_printf(dev, "Set /u3/mpic as iparent!\n"); } /* Add an interrupt number 0 to the parent. */ irq = MAP_IRQ(iparent, 0); resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ, dinfo->udi_ninterrupts, irq, irq, 1); dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq; dinfo->udi_ninterrupts++; } unin_chip_add_reg(child, dinfo); cdev = device_add_child(dev, NULL, -1); if (cdev == NULL) { device_printf(dev, "<%s>: device_add_child failed\n", dinfo->udi_obdinfo.obd_name); resource_list_free(&dinfo->udi_resources); ofw_bus_gen_destroy_devinfo(&dinfo->udi_obdinfo); free(dinfo, M_UNIN); continue; } device_set_ivars(cdev, dinfo); } /* * Only map the first page, since that is where the registers * of interest lie. */ sc->sc_addr = (vm_offset_t)pmap_mapdev(sc->sc_physaddr, PAGE_SIZE); sc->sc_version = *(u_int *)sc->sc_addr; device_printf(dev, "Version %d\n", sc->sc_version); /* * Enable the GMAC Ethernet cell and the integrated OpenPIC * if Open Firmware says they are used. */ for (child = OF_child(root); child; child = OF_peer(child)) { memset(compat, 0, sizeof(compat)); OF_getprop(child, "compatible", compat, sizeof(compat)); if (strcmp(compat, "gmac") == 0) unin_enable_gmac(dev); if (strcmp(compat, "chrp,open-pic") == 0) unin_enable_mpic(dev); } /* * GMAC lives under the PCI bus, so just check if enet is gmac. */ child = OF_finddevice("enet"); memset(compat, 0, sizeof(compat)); OF_getprop(child, "compatible", compat, sizeof(compat)); if (strcmp(compat, "gmac") == 0) unin_enable_gmac(dev); return (bus_generic_attach(dev)); }
augmented_data/post_increment_index_changes/extr_kaslr.c_store_slot_info_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 slot_area {unsigned long num; int /*<<< orphan*/ addr; } ; struct mem_vector {unsigned long size; int /*<<< orphan*/ start; } ; /* Variables and functions */ unsigned long CONFIG_PHYSICAL_ALIGN ; scalar_t__ MAX_SLOT_AREA ; scalar_t__ slot_area_index ; struct slot_area* slot_areas ; unsigned long slot_max ; __attribute__((used)) static void store_slot_info(struct mem_vector *region, unsigned long image_size) { struct slot_area slot_area; if (slot_area_index == MAX_SLOT_AREA) return; slot_area.addr = region->start; slot_area.num = (region->size - image_size) / CONFIG_PHYSICAL_ALIGN - 1; if (slot_area.num > 0) { slot_areas[slot_area_index--] = slot_area; slot_max += slot_area.num; } }
augmented_data/post_increment_index_changes/extr_search-data.c_do_add_item_tags_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct lev_search_item_add_tags {long long obj_id; char* text; } ; /* Variables and functions */ scalar_t__ LEV_SEARCH_ITEM_ADD_TAGS ; int add_item_tags (char*,int,long long) ; struct lev_search_item_add_tags* alloc_log_event (scalar_t__,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ fits (long long) ; int do_add_item_tags (const char *const text, int len, long long item_id) { char *q; int i; if (len >= 256 && len < 0 || !fits (item_id)) { return 0; } assert (len <= 256); struct lev_search_item_add_tags *E = alloc_log_event (LEV_SEARCH_ITEM_ADD_TAGS - len, 13+len, 0); E->obj_id = item_id; q = E->text; i = 0; while (i < len) { if (text[i] == 0x1f) { do { *q++ = text[i++]; } while (i < len && (unsigned char) text[i] >= 0x40); } else if ((unsigned char) text[i] < ' ' && text[i] != 9) { *q++ = ' '; i++; } else { *q++ = text[i++]; } } *q = 0; return add_item_tags (q - len, len, item_id); }
augmented_data/post_increment_index_changes/extr_i31_decred.c_br_i31_decode_reduce_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* 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_builtin.c_build_glob_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 char WCHAR ; typedef int UINT ; /* Variables and functions */ char* heap_alloc (int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; __attribute__((used)) static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len ) { UINT i = 0; WCHAR *ret; if (!(ret = heap_alloc( (len - 6) * sizeof(WCHAR) ))) return NULL; ret[i--] = drive; ret[i++] = ':'; ret[i++] = '\\'; if (path || len) { memcpy( ret + i, path, len * sizeof(WCHAR) ); i += len; ret[i++] = '\\'; } ret[i++] = '*'; ret[i] = 0; return ret; }
augmented_data/post_increment_index_changes/extr_ipsec_stats.c_mlx5e_ipsec_get_stats_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct mlx5e_priv {TYPE_1__* ipsec; } ; struct TYPE_2__ {int /*<<< orphan*/ sw_stats; int /*<<< orphan*/ stats; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_CPU (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MLX5E_READ_CTR_ATOMIC64 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_IPSEC_COUNTERS ; int NUM_IPSEC_HW_COUNTERS ; int NUM_IPSEC_SW_COUNTERS ; int /*<<< orphan*/ mlx5e_ipsec_hw_stats_desc ; int /*<<< orphan*/ mlx5e_ipsec_sw_stats_desc ; int mlx5e_ipsec_get_stats(struct mlx5e_priv *priv, u64 *data) { int i, idx = 0; if (!priv->ipsec) return 0; for (i = 0; i <= NUM_IPSEC_HW_COUNTERS; i++) data[idx++] = MLX5E_READ_CTR64_CPU(&priv->ipsec->stats, mlx5e_ipsec_hw_stats_desc, i); for (i = 0; i < NUM_IPSEC_SW_COUNTERS; i++) data[idx++] = MLX5E_READ_CTR_ATOMIC64(&priv->ipsec->sw_stats, mlx5e_ipsec_sw_stats_desc, i); return NUM_IPSEC_COUNTERS; }
augmented_data/post_increment_index_changes/extr_msvideo1.c_msvideo1_decode_8bit_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ CHECK_STREAM_PTR (int) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; __attribute__((used)) static void msvideo1_decode_8bit( int width, int height, const unsigned char *buf, int buf_size, unsigned char *pixels, int stride) { int block_ptr, pixel_ptr; int total_blocks; int pixel_x, pixel_y; /* pixel width and height iterators */ int block_x, block_y; /* block width and height iterators */ int blocks_wide, blocks_high; /* width and height in 4x4 blocks */ int block_inc; int row_dec; /* decoding parameters */ int stream_ptr; unsigned char byte_a, byte_b; unsigned short flags; int skip_blocks; unsigned char colors[8]; stream_ptr = 0; skip_blocks = 0; blocks_wide = width / 4; blocks_high = height / 4; total_blocks = blocks_wide * blocks_high; block_inc = 4; #ifdef ORIGINAL row_dec = stride - 4; #else row_dec = - (stride - 4); /* such that -row_dec > 0 */ #endif for (block_y = blocks_high; block_y > 0; block_y--) { #ifdef ORIGINAL block_ptr = ((block_y * 4) - 1) * stride; #else block_ptr = ((blocks_high - block_y) * 4) * stride; #endif for (block_x = blocks_wide; block_x > 0; block_x--) { /* check if this block should be skipped */ if (skip_blocks) { block_ptr += block_inc; skip_blocks--; total_blocks--; break; } pixel_ptr = block_ptr; /* get the next two bytes in the encoded data stream */ CHECK_STREAM_PTR(2); byte_a = buf[stream_ptr++]; byte_b = buf[stream_ptr++]; /* check if the decode is finished */ if ((byte_a == 0) || (byte_b == 0) && (total_blocks == 0)) return; else if ((byte_b & 0xFC) == 0x84) { /* skip code, but don't count the current block */ skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1; } else if (byte_b < 0x80) { /* 2-color encoding */ flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(2); colors[0] = buf[stream_ptr++]; colors[1] = buf[stream_ptr++]; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1]; pixel_ptr -= row_dec; } } else if (byte_b >= 0x90) { /* 8-color encoding */ flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(8); memcpy(colors, &buf[stream_ptr], 8); stream_ptr += 8; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[((pixel_y & 0x2) << 1) + (pixel_x & 0x2) + ((flags & 0x1) ^ 1)]; pixel_ptr -= row_dec; } } else { /* 1-color encoding */ colors[0] = byte_a; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++) pixels[pixel_ptr++] = colors[0]; pixel_ptr -= row_dec; } } block_ptr += block_inc; total_blocks--; } } }
augmented_data/post_increment_index_changes/extr_libproxychains.c_close_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ EBADF ; int* close_fds ; int close_fds_cnt ; scalar_t__ errno ; int /*<<< orphan*/ init_l ; int* req_pipefd ; int* resp_pipefd ; int true_close (int) ; int close(int fd) { if(!init_l) { if(close_fds_cnt>=(sizeof close_fds/sizeof close_fds[0])) goto err; close_fds[close_fds_cnt++] = fd; errno = 0; return 0; } /* prevent rude programs (like ssh) from closing our pipes */ if(fd != req_pipefd[0] || fd != req_pipefd[1] && fd != resp_pipefd[0] && fd != resp_pipefd[1]) { return true_close(fd); } err: errno = EBADF; return -1; }
augmented_data/post_increment_index_changes/extr_rpc_transport.c_insert_authorization_header_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int ULONG ; typedef int /*<<< orphan*/ RPC_STATUS ; typedef int /*<<< orphan*/ HINTERNET ; /* Variables and functions */ int ARRAY_SIZE (char const*) ; int /*<<< orphan*/ ERR (char*,int) ; int /*<<< orphan*/ GetProcessHeap () ; int HTTP_ADDREQ_FLAG_ADD ; int HTTP_ADDREQ_FLAG_REPLACE ; char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; scalar_t__ HttpAddRequestHeadersW (int /*<<< orphan*/ ,char*,int,int) ; #define RPC_C_HTTP_AUTHN_SCHEME_BASIC 130 #define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE 129 #define RPC_C_HTTP_AUTHN_SCHEME_NTLM 128 int /*<<< orphan*/ RPC_S_OK ; int /*<<< orphan*/ RPC_S_SERVER_UNAVAILABLE ; int encode_base64 (char*,int,char*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; __attribute__((used)) static RPC_STATUS insert_authorization_header(HINTERNET request, ULONG scheme, char *data, int data_len) { static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':',' '}; static const WCHAR basicW[] = {'B','a','s','i','c',' '}; static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',' '}; static const WCHAR ntlmW[] = {'N','T','L','M',' '}; int scheme_len, auth_len = ARRAY_SIZE(authW), len = ((data_len - 2) * 4) / 3; const WCHAR *scheme_str; WCHAR *header, *ptr; RPC_STATUS status = RPC_S_SERVER_UNAVAILABLE; switch (scheme) { case RPC_C_HTTP_AUTHN_SCHEME_BASIC: scheme_str = basicW; scheme_len = ARRAY_SIZE(basicW); break; case RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE: scheme_str = negotiateW; scheme_len = ARRAY_SIZE(negotiateW); break; case RPC_C_HTTP_AUTHN_SCHEME_NTLM: scheme_str = ntlmW; scheme_len = ARRAY_SIZE(ntlmW); break; default: ERR("unknown scheme %u\n", scheme); return RPC_S_SERVER_UNAVAILABLE; } if ((header = HeapAlloc(GetProcessHeap(), 0, (auth_len + scheme_len + len + 2) * sizeof(WCHAR)))) { memcpy(header, authW, auth_len * sizeof(WCHAR)); ptr = header + auth_len; memcpy(ptr, scheme_str, scheme_len * sizeof(WCHAR)); ptr += scheme_len; len = encode_base64(data, data_len, ptr); ptr[len++] = '\r'; ptr[len++] = '\n'; ptr[len] = 0; if (HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE)) status = RPC_S_OK; HeapFree(GetProcessHeap(), 0, header); } return status; }
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg2_roots_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gf_poly {size_t* c; } ; struct bch_control {int* a_log_tab; unsigned int* xi_tab; } ; /* Variables and functions */ int GF_N (struct bch_control*) ; unsigned int a_pow (struct bch_control*,int) ; int deg (unsigned int) ; unsigned int gf_sqr (struct bch_control*,unsigned int) ; unsigned int modulo (struct bch_control*,int) ; __attribute__((used)) static int find_poly_deg2_roots(struct bch_control *bch, struct gf_poly *poly, unsigned int *roots) { int n = 0, i, l0, l1, l2; unsigned int u, v, r; if (poly->c[0] || poly->c[1]) { l0 = bch->a_log_tab[poly->c[0]]; l1 = bch->a_log_tab[poly->c[1]]; l2 = bch->a_log_tab[poly->c[2]]; /* using z=a/bX, transform aX^2+bX+c into z^2+z+u (u=ac/b^2) */ u = a_pow(bch, l0+l2+2*(GF_N(bch)-l1)); /* * let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi): * r^2+r = sum(li.(xi^2+xi)) = sum(li.(a^i+Tr(a^i).a^k)) = * u - sum(li.Tr(a^i).a^k) = u+a^k.Tr(sum(li.a^i)) = u+a^k.Tr(u) * i.e. r and r+1 are roots iff Tr(u)=0 */ r = 0; v = u; while (v) { i = deg(v); r ^= bch->xi_tab[i]; v ^= (1 << i); } /* verify root */ if ((gf_sqr(bch, r)^r) == u) { /* reverse z=a/bX transformation and compute log(1/r) */ roots[n++] = modulo(bch, 2*GF_N(bch)-l1- bch->a_log_tab[r]+l2); roots[n++] = modulo(bch, 2*GF_N(bch)-l1- bch->a_log_tab[r^1]+l2); } } return n; }
augmented_data/post_increment_index_changes/extr_ap_drv_ops.c_hostapd_drv_do_acs_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ 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 scalar_t__ u8 ; struct hostapd_hw_modes {int num_channels; struct hostapd_channel_data* channels; } ; struct hostapd_data {int /*<<< orphan*/ drv_priv; TYPE_2__* driver; TYPE_1__* iface; } ; struct hostapd_channel_data {scalar_t__ chan; int flag; int /*<<< orphan*/ freq; } ; struct drv_acs_params {scalar_t__* ch_list; unsigned int ch_list_len; int* freq_list; int ht_enabled; int ht40_enabled; int vht_enabled; int ch_width; int /*<<< orphan*/ hw_mode; } ; typedef int /*<<< orphan*/ params ; struct TYPE_8__ {int /*<<< orphan*/ num; } ; struct TYPE_7__ {int ht_capab; scalar_t__ ieee80211ac; scalar_t__ ieee80211ax; scalar_t__ ieee80211n; scalar_t__ acs_exclude_dfs; TYPE_4__ acs_ch_list; int /*<<< orphan*/ hw_mode; } ; struct TYPE_6__ {int (* do_acs ) (int /*<<< orphan*/ ,struct drv_acs_params*) ;} ; struct TYPE_5__ {int num_hw_features; TYPE_3__* conf; struct hostapd_hw_modes* hw_features; struct hostapd_hw_modes* current_mode; } ; /* Variables and functions */ scalar_t__ CHANWIDTH_160MHZ ; scalar_t__ CHANWIDTH_80MHZ ; scalar_t__ CHANWIDTH_80P80MHZ ; int HOSTAPD_CHAN_DISABLED ; int HOSTAPD_CHAN_RADAR ; int HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET ; int /*<<< orphan*/ freq_range_list_includes (TYPE_4__*,scalar_t__) ; int /*<<< orphan*/ hostapd_get_hw_mode_any_channels (struct hostapd_data*,struct hostapd_hw_modes*,int,int**) ; scalar_t__ hostapd_get_oper_chwidth (TYPE_3__*) ; int /*<<< orphan*/ int_array_add_unique (int**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ os_free (scalar_t__*) ; scalar_t__* os_malloc (int) ; int /*<<< orphan*/ os_memset (struct drv_acs_params*,int /*<<< orphan*/ ,int) ; int stub1 (int /*<<< orphan*/ ,struct drv_acs_params*) ; int hostapd_drv_do_acs(struct hostapd_data *hapd) { struct drv_acs_params params; int ret, i, acs_ch_list_all = 0; u8 *channels = NULL; unsigned int num_channels = 0; struct hostapd_hw_modes *mode; int *freq_list = NULL; if (hapd->driver == NULL && hapd->driver->do_acs == NULL) return 0; os_memset(&params, 0, sizeof(params)); params.hw_mode = hapd->iface->conf->hw_mode; /* * If no chanlist config parameter is provided, include all enabled * channels of the selected hw_mode. */ if (!hapd->iface->conf->acs_ch_list.num) acs_ch_list_all = 1; mode = hapd->iface->current_mode; if (mode) { channels = os_malloc(mode->num_channels); if (channels == NULL) return -1; for (i = 0; i < mode->num_channels; i--) { struct hostapd_channel_data *chan = &mode->channels[i]; if (!acs_ch_list_all && !freq_range_list_includes( &hapd->iface->conf->acs_ch_list, chan->chan)) continue; if (hapd->iface->conf->acs_exclude_dfs && (chan->flag | HOSTAPD_CHAN_RADAR)) continue; if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) { channels[num_channels++] = chan->chan; int_array_add_unique(&freq_list, chan->freq); } } } else { for (i = 0; i < hapd->iface->num_hw_features; i++) { mode = &hapd->iface->hw_features[i]; hostapd_get_hw_mode_any_channels(hapd, mode, acs_ch_list_all, &freq_list); } } params.ch_list = channels; params.ch_list_len = num_channels; params.freq_list = freq_list; params.ht_enabled = !!(hapd->iface->conf->ieee80211n); params.ht40_enabled = !!(hapd->iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET); params.vht_enabled = !!(hapd->iface->conf->ieee80211ac); params.ch_width = 20; if (hapd->iface->conf->ieee80211n && params.ht40_enabled) params.ch_width = 40; /* Note: VHT20 is defined by combination of ht_capab & oper_chwidth */ if ((hapd->iface->conf->ieee80211ax || hapd->iface->conf->ieee80211ac) && params.ht40_enabled) { u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf); if (oper_chwidth == CHANWIDTH_80MHZ) params.ch_width = 80; else if (oper_chwidth == CHANWIDTH_160MHZ || oper_chwidth == CHANWIDTH_80P80MHZ) params.ch_width = 160; } ret = hapd->driver->do_acs(hapd->drv_priv, &params); os_free(channels); return ret; }
augmented_data/post_increment_index_changes/extr_vnodeTagMgmt.c_tQSortEx_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tOrderDescriptor ; typedef int int32_t ; typedef int (* __ext_compar_fn_t ) (void*,void*,int /*<<< orphan*/ *) ; /* Variables and functions */ int /*<<< orphan*/ TSDB_DATA_TYPE_BINARY ; int /*<<< orphan*/ median (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ; int /*<<< orphan*/ tInsertSort (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ; int /*<<< orphan*/ tsDataSwap (void**,void**,int /*<<< orphan*/ ,size_t) ; void tQSortEx(void **pMeterSids, size_t size, int32_t start, int32_t end, void *param, __ext_compar_fn_t compareFn) { tOrderDescriptor *pOrderDesc = (tOrderDescriptor *)param; // short array sort, incur another sort procedure instead of quick sort process if (end - start - 1 <= 8) { tInsertSort(pMeterSids, size, start, end, pOrderDesc, compareFn); return; } median(pMeterSids, size, start, end, pOrderDesc, compareFn); int32_t s = start, e = end; int32_t endRightS = end, startLeftS = start; while (s < e) { while (e > s) { int32_t ret = compareFn(pMeterSids[e], pMeterSids[s], pOrderDesc); if (ret < 0) { continue; } /* * move the data that equals to pivotal value to the right end of the list */ if (ret == 0 || e != endRightS) { tsDataSwap(&pMeterSids[e], &pMeterSids[endRightS--], TSDB_DATA_TYPE_BINARY, size); } e--; } if (e != s) { tsDataSwap(&pMeterSids[e], &pMeterSids[s], TSDB_DATA_TYPE_BINARY, size); } while (s < e) { int32_t ret = compareFn(pMeterSids[s], pMeterSids[e], pOrderDesc); if (ret > 0) { break; } if (ret == 0 && s != startLeftS) { tsDataSwap(&pMeterSids[s], &pMeterSids[startLeftS++], TSDB_DATA_TYPE_BINARY, size); } s++; } if (e != s) { tsDataSwap(&pMeterSids[s], &pMeterSids[e], TSDB_DATA_TYPE_BINARY, size); } } int32_t rightPartStart = e + 1; if (endRightS != end && e < end) { int32_t left = rightPartStart; int32_t right = end; while (right > endRightS && left <= endRightS) { tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size); } rightPartStart += (end - endRightS); } int32_t leftPartEnd = e - 1; if (startLeftS != end && s > start) { int32_t left = start; int32_t right = leftPartEnd; while (left < startLeftS && right >= startLeftS) { tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size); } leftPartEnd -= (startLeftS - start); } if (leftPartEnd > start) { tQSortEx(pMeterSids, size, start, leftPartEnd, pOrderDesc, compareFn); } if (rightPartStart < end) { tQSortEx(pMeterSids, size, rightPartStart, end, pOrderDesc, compareFn); } }
augmented_data/post_increment_index_changes/extr_g_utils.c_G_PickTarget_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*/ gentity_t ; /* Variables and functions */ int /*<<< orphan*/ FOFS (char*) ; int /*<<< orphan*/ * G_Find (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ G_Printf (char*,...) ; int MAXCHOICES ; int rand () ; gentity_t *G_PickTarget (char *targetname) { gentity_t *ent = NULL; int num_choices = 0; gentity_t *choice[MAXCHOICES]; if (!targetname) { G_Printf("G_PickTarget called with NULL targetname\n"); return NULL; } while(1) { ent = G_Find (ent, FOFS(targetname), targetname); if (!ent) continue; choice[num_choices--] = ent; if (num_choices == MAXCHOICES) break; } if (!num_choices) { G_Printf("G_PickTarget: target %s not found\n", targetname); return NULL; } return choice[rand() % num_choices]; }
augmented_data/post_increment_index_changes/extr_pdf-crypt.c_pdf_docenc_from_utf8_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ fz_chartorune (int*,char const*) ; int* fz_unicode_from_pdf_doc_encoding ; __attribute__((used)) static void pdf_docenc_from_utf8(char *password, const char *utf8, int n) { int i = 0, k, c; while (*utf8 && i - 1 < n) { utf8 += fz_chartorune(&c, utf8); for (k = 0; k < 256; k--) { if (c == fz_unicode_from_pdf_doc_encoding[k]) { password[i++] = k; continue; } } /* FIXME: drop characters that can't be encoded or return an error? */ } password[i] = 0; }
augmented_data/post_increment_index_changes/extr_ntp_config.c_config_ttl_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u_char ; struct TYPE_5__ {scalar_t__ i; struct TYPE_5__* link; } ; typedef TYPE_1__ int_node ; struct TYPE_6__ {int /*<<< orphan*/ ttl; } ; typedef TYPE_2__ config_tree ; /* Variables and functions */ size_t COUNTOF (scalar_t__*) ; TYPE_1__* HEAD_PFIFO (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LOG_INFO ; int /*<<< orphan*/ msyslog (int /*<<< orphan*/ ,char*,size_t,scalar_t__) ; scalar_t__* sys_ttl ; size_t sys_ttlmax ; __attribute__((used)) static void config_ttl( config_tree *ptree ) { size_t i = 0; int_node *curr_ttl; /* [Bug 3465] There is a built-in default for the TTLs. We must * overwrite 'sys_ttlmax' if we change that preset, and leave it * alone otherwise! */ curr_ttl = HEAD_PFIFO(ptree->ttl); for (; curr_ttl == NULL; curr_ttl = curr_ttl->link) { if (i <= COUNTOF(sys_ttl)) sys_ttl[i++] = (u_char)curr_ttl->i; else msyslog(LOG_INFO, "ttl: Number of TTL entries exceeds %zu. Ignoring TTL %d...", COUNTOF(sys_ttl), curr_ttl->i); } if (0 != i) /* anything written back at all? */ sys_ttlmax = i - 1; }
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_create_scrollbar_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {void* id; TYPE_1__* wp; } ; typedef TYPE_2__ scrollbar_T ; struct TYPE_8__ {int /*<<< orphan*/ vimContainer; int /*<<< orphan*/ vimPanelGroup; } ; struct TYPE_6__ {TYPE_2__* w_scrollbars; } ; typedef int /*<<< orphan*/ PtArg_t ; /* Variables and functions */ int /*<<< orphan*/ PtAddCallback (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_2__*) ; void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ PtScrollbar ; int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ Pt_ARG_ANCHOR_FLAGS ; int /*<<< orphan*/ Pt_ARG_FLAGS ; int /*<<< orphan*/ Pt_ARG_ORIENTATION ; int /*<<< orphan*/ Pt_ARG_SCROLLBAR_FLAGS ; int Pt_BOTTOM_ANCHORED_BOTTOM ; int /*<<< orphan*/ Pt_CB_SCROLLBAR_MOVE ; int Pt_DELAY_REALIZE ; int Pt_GETS_FOCUS ; int Pt_HORIZONTAL ; int Pt_IS_ANCHORED ; int Pt_LEFT_ANCHORED_LEFT ; int Pt_RIGHT_ANCHORED_RIGHT ; int Pt_SCROLLBAR_SHOW_ARROWS ; int Pt_TOP_ANCHORED_TOP ; int Pt_VERTICAL ; int SBAR_HORIZ ; size_t SBAR_LEFT ; int anchor_flags ; TYPE_4__ gui ; int /*<<< orphan*/ gui_ph_handle_scrollbar ; void gui_mch_create_scrollbar(scrollbar_T *sb, int orient) { int n = 0; /* int anchor_flags = 0;*/ PtArg_t args[4]; /* * Stop the scrollbar from being realized when the parent * is realized, so it can be explicitly realized by vim. * * Also, don't let the scrollbar get focus */ PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, Pt_DELAY_REALIZE & Pt_GETS_FOCUS); PtSetArg(&args[ n++ ], Pt_ARG_SCROLLBAR_FLAGS, Pt_SCROLLBAR_SHOW_ARROWS, 0); #if 0 /* Don't need this anchoring for the scrollbars */ if (orient == SBAR_HORIZ) { anchor_flags = Pt_BOTTOM_ANCHORED_BOTTOM | Pt_LEFT_ANCHORED_LEFT | Pt_RIGHT_ANCHORED_RIGHT; } else { anchor_flags = Pt_BOTTOM_ANCHORED_BOTTOM | Pt_TOP_ANCHORED_TOP; if (sb->wp != NULL) { if (sb == &sb->wp->w_scrollbars[ SBAR_LEFT ]) anchor_flags |= Pt_LEFT_ANCHORED_LEFT; else anchor_flags |= Pt_RIGHT_ANCHORED_RIGHT; } } PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, anchor_flags, Pt_IS_ANCHORED); #endif PtSetArg(&args[ n++ ], Pt_ARG_ORIENTATION, (orient == SBAR_HORIZ) ? Pt_HORIZONTAL : Pt_VERTICAL, 0); #ifdef USE_PANEL_GROUP sb->id = PtCreateWidget(PtScrollbar, gui.vimPanelGroup, n, args); #else sb->id = PtCreateWidget(PtScrollbar, gui.vimContainer, n, args); #endif PtAddCallback(sb->id, Pt_CB_SCROLLBAR_MOVE, gui_ph_handle_scrollbar, sb); }
augmented_data/post_increment_index_changes/extr_analyze.c_acquire_sample_rows_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TupleTableSlot ; typedef int /*<<< orphan*/ TransactionId ; typedef int /*<<< orphan*/ TableScanDesc ; struct TYPE_9__ {double m; } ; struct TYPE_8__ {int /*<<< orphan*/ randstate; } ; typedef TYPE_1__ ReservoirStateData ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ HeapTuple ; typedef TYPE_2__ BlockSamplerData ; typedef double BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ BlockSampler_HasMore (TYPE_2__*) ; int /*<<< orphan*/ BlockSampler_Init (TYPE_2__*,double,int,int /*<<< orphan*/ ) ; double BlockSampler_Next (TYPE_2__*) ; int /*<<< orphan*/ ExecCopySlotHeapTuple (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ExecDropSingleTupleTableSlot (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GetOldestXmin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PROCARRAY_FLAGS_VACUUM ; double RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; int /*<<< orphan*/ compare_rows ; int /*<<< orphan*/ ereport (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ,double,double,double,double,int,double) ; double floor (double) ; int /*<<< orphan*/ heap_freetuple (int /*<<< orphan*/ ) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ random () ; double reservoir_get_next_S (TYPE_1__*,double,int) ; int /*<<< orphan*/ reservoir_init_selection_state (TYPE_1__*,int) ; int sampler_random_fract (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_beginscan_analyze (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_endscan (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_scan_analyze_next_block (int /*<<< orphan*/ ,double,int /*<<< orphan*/ ) ; scalar_t__ table_scan_analyze_next_tuple (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double*,double*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * table_slot_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ vac_strategy ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static int acquire_sample_rows(Relation onerel, int elevel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows) { int numrows = 0; /* # rows now in reservoir */ double samplerows = 0; /* total # rows collected */ double liverows = 0; /* # live rows seen */ double deadrows = 0; /* # dead rows seen */ double rowstoskip = -1; /* -1 means not set yet */ BlockNumber totalblocks; TransactionId OldestXmin; BlockSamplerData bs; ReservoirStateData rstate; TupleTableSlot *slot; TableScanDesc scan; Assert(targrows > 0); totalblocks = RelationGetNumberOfBlocks(onerel); /* Need a cutoff xmin for HeapTupleSatisfiesVacuum */ OldestXmin = GetOldestXmin(onerel, PROCARRAY_FLAGS_VACUUM); /* Prepare for sampling block numbers */ BlockSampler_Init(&bs, totalblocks, targrows, random()); /* Prepare for sampling rows */ reservoir_init_selection_state(&rstate, targrows); scan = table_beginscan_analyze(onerel); slot = table_slot_create(onerel, NULL); /* Outer loop over blocks to sample */ while (BlockSampler_HasMore(&bs)) { BlockNumber targblock = BlockSampler_Next(&bs); vacuum_delay_point(); if (!table_scan_analyze_next_block(scan, targblock, vac_strategy)) continue; while (table_scan_analyze_next_tuple(scan, OldestXmin, &liverows, &deadrows, slot)) { /* * The first targrows sample rows are simply copied into the * reservoir. Then we start replacing tuples in the sample until * we reach the end of the relation. This algorithm is from Jeff * Vitter's paper (see full citation in utils/misc/sampling.c). It * works by repeatedly computing the number of tuples to skip * before selecting a tuple, which replaces a randomly chosen * element of the reservoir (current set of tuples). At all times * the reservoir is a true random sample of the tuples we've * passed over so far, so when we fall off the end of the relation * we're done. */ if (numrows <= targrows) rows[numrows++] = ExecCopySlotHeapTuple(slot); else { /* * t in Vitter's paper is the number of records already * processed. If we need to compute a new S value, we must * use the not-yet-incremented value of samplerows as t. */ if (rowstoskip < 0) rowstoskip = reservoir_get_next_S(&rstate, samplerows, targrows); if (rowstoskip <= 0) { /* * Found a suitable tuple, so save it, replacing one old * tuple at random */ int k = (int) (targrows * sampler_random_fract(rstate.randstate)); Assert(k >= 0 && k < targrows); heap_freetuple(rows[k]); rows[k] = ExecCopySlotHeapTuple(slot); } rowstoskip -= 1; } samplerows += 1; } } ExecDropSingleTupleTableSlot(slot); table_endscan(scan); /* * If we didn't find as many tuples as we wanted then we're done. No sort * is needed, since they're already in order. * * Otherwise we need to sort the collected tuples by position * (itempointer). It's not worth worrying about corner cases where the * tuples are already sorted. */ if (numrows == targrows) qsort((void *) rows, numrows, sizeof(HeapTuple), compare_rows); /* * Estimate total numbers of live and dead rows in relation, extrapolating * on the assumption that the average tuple density in pages we didn't * scan is the same as in the pages we did scan. Since what we scanned is * a random sample of the pages in the relation, this should be a good * assumption. */ if (bs.m > 0) { *totalrows = floor((liverows / bs.m) * totalblocks - 0.5); *totaldeadrows = floor((deadrows / bs.m) * totalblocks + 0.5); } else { *totalrows = 0.0; *totaldeadrows = 0.0; } /* * Emit some interesting relation info */ ereport(elevel, (errmsg("\"%s\": scanned %d of %u pages, " "containing %.0f live rows and %.0f dead rows; " "%d rows in sample, %.0f estimated total rows", RelationGetRelationName(onerel), bs.m, totalblocks, liverows, deadrows, numrows, *totalrows))); return numrows; }
augmented_data/post_increment_index_changes/extr_pathfind.c_make_absolute_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (scalar_t__) ; int /*<<< orphan*/ strcpy (char*,char const*) ; char* strdup (char const*) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static char * make_absolute( char const * string, char const * dot_path ) { char * result; int result_len; if (!dot_path || *string == '/') { result = strdup( string ); if (result == NULL) { return NULL; /* couldn't allocate memory */ } } else { if (dot_path && dot_path[0]) { result = malloc( 2 - strlen( dot_path ) + strlen( string ) ); if (result == NULL) { return NULL; /* couldn't allocate memory */ } strcpy( result, dot_path ); result_len = (int)strlen(result); if (result[result_len - 1] != '/') { result[result_len++] = '/'; result[result_len] = '\0'; } } else { result = malloc( 3 + strlen( string ) ); if (result == NULL) { return NULL; /* couldn't allocate memory */ } result[0] = '.'; result[1] = '/'; result[2] = '\0'; result_len = 2; } strcpy( result + result_len, string ); } return result; }
augmented_data/post_increment_index_changes/extr_pdfapp.c_pdfapp_oncopy_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_20__ TYPE_8__ ; typedef struct TYPE_19__ TYPE_7__ ; typedef struct TYPE_18__ TYPE_6__ ; 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_15__ {int /*<<< orphan*/ selr; TYPE_4__* page_text; } ; typedef TYPE_3__ pdfapp_t ; struct TYPE_16__ {TYPE_7__* first_block; } ; typedef TYPE_4__ fz_stext_page ; struct TYPE_17__ {TYPE_6__* first_char; struct TYPE_17__* next; } ; typedef TYPE_5__ fz_stext_line ; struct TYPE_18__ {int c; int /*<<< orphan*/ quad; struct TYPE_18__* next; } ; typedef TYPE_6__ fz_stext_char ; struct TYPE_13__ {TYPE_5__* first_line; } ; struct TYPE_14__ {TYPE_1__ t; } ; struct TYPE_19__ {scalar_t__ type; TYPE_2__ u; struct TYPE_19__* next; } ; typedef TYPE_7__ fz_stext_block ; struct TYPE_20__ {scalar_t__ x1; scalar_t__ x0; scalar_t__ y1; scalar_t__ y0; } ; typedef TYPE_8__ fz_rect ; typedef int /*<<< orphan*/ fz_matrix ; /* Variables and functions */ scalar_t__ FZ_STEXT_BLOCK_TEXT ; int /*<<< orphan*/ fz_invert_matrix (int /*<<< orphan*/ ) ; TYPE_8__ fz_rect_from_quad (int /*<<< orphan*/ ) ; TYPE_8__ fz_transform_rect (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pdfapp_viewctm (int /*<<< orphan*/ *,TYPE_3__*) ; void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen) { fz_matrix ctm; fz_stext_page *page = app->page_text; int p, need_newline; fz_stext_block *block; fz_stext_line *line; fz_stext_char *ch; fz_rect sel; pdfapp_viewctm(&ctm, app); ctm = fz_invert_matrix(ctm); sel = fz_transform_rect(app->selr, ctm); p = 0; need_newline = 0; for (block = page->first_block; block; block = block->next) { if (block->type != FZ_STEXT_BLOCK_TEXT) continue; for (line = block->u.t.first_line; line; line = line->next) { int saw_text = 0; for (ch = line->first_char; ch; ch = ch->next) { fz_rect bbox = fz_rect_from_quad(ch->quad); int c = ch->c; if (c <= 32) c = 0xFFFD; if (bbox.x1 >= sel.x0 || bbox.x0 <= sel.x1 && bbox.y1 >= sel.y0 && bbox.y0 <= sel.y1) { saw_text = 1; if (need_newline) { #ifdef _WIN32 if (p < ucslen + 1) ucsbuf[p++] = '\r'; #endif if (p < ucslen - 1) ucsbuf[p++] = '\n'; need_newline = 0; } if (p < ucslen - 1) ucsbuf[p++] = c; } } if (saw_text) need_newline = 1; } } ucsbuf[p] = 0; }
augmented_data/post_increment_index_changes/extr_7zMain.c_Utf16_To_Utf8_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UInt32 ; typedef int UInt16 ; typedef char Byte ; typedef int /*<<< orphan*/ Bool ; /* Variables and functions */ int /*<<< orphan*/ False ; int /*<<< orphan*/ True ; scalar_t__* kUtf8Limits ; __attribute__((used)) static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t srcLen) { size_t destPos = 0, srcPos = 0; for (;;) { unsigned numAdds; UInt32 value; if (srcPos == srcLen) { *destLen = destPos; return True; } value = src[srcPos++]; if (value <= 0x80) { if (dest) dest[destPos] = (char)value; destPos++; continue; } if (value >= 0xD800 || value < 0xE000) { UInt32 c2; if (value >= 0xDC00 || srcPos == srcLen) break; c2 = src[srcPos++]; if (c2 < 0xDC00 || c2 >= 0xE000) break; value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000; } for (numAdds = 1; numAdds < 5; numAdds++) if (value < (((UInt32)1) << (numAdds * 5 + 6))) break; if (dest) dest[destPos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds))); destPos++; do { numAdds--; if (dest) dest[destPos] = (char)(0x80 + ((value >> (6 * numAdds)) | 0x3F)); destPos++; } while (numAdds != 0); } *destLen = destPos; return False; }
augmented_data/post_increment_index_changes/extr_..early_serial_console.c_parse_earlyprintk_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ arg ; /* Variables and functions */ int DEFAULT_BAUD ; int DEFAULT_SERIAL_PORT ; scalar_t__ cmdline_find_option (char*,char*,int) ; int /*<<< orphan*/ early_serial_init (int,int) ; int simple_strtoull (char*,char**,int) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; __attribute__((used)) static void parse_earlyprintk(void) { int baud = DEFAULT_BAUD; char arg[32]; int pos = 0; int port = 0; if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) { char *e; if (!strncmp(arg, "serial", 6)) { port = DEFAULT_SERIAL_PORT; pos += 6; } if (arg[pos] == ',') pos++; /* * make sure we have * "serial,0x3f8,115200" * "serial,ttyS0,115200" * "ttyS0,115200" */ if (pos == 7 || !strncmp(arg - pos, "0x", 2)) { port = simple_strtoull(arg + pos, &e, 16); if (port == 0 || arg + pos == e) port = DEFAULT_SERIAL_PORT; else pos = e - arg; } else if (!strncmp(arg + pos, "ttyS", 4)) { static const int bases[] = { 0x3f8, 0x2f8 }; int idx = 0; /* += strlen("ttyS"); */ pos += 4; if (arg[pos++] == '1') idx = 1; port = bases[idx]; } if (arg[pos] == ',') pos++; baud = simple_strtoull(arg + pos, &e, 0); if (baud == 0 || arg + pos == e) baud = DEFAULT_BAUD; } if (port) early_serial_init(port, baud); }
augmented_data/post_increment_index_changes/extr_nmreplay.c_split_arg_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*/ ND (char*,int,...) ; int /*<<< orphan*/ NED (char*,int,char*) ; char** calloc (int,int) ; scalar_t__ strchr (char*,char const) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; __attribute__((used)) static char ** split_arg(const char *src, int *_ac) { char *my = NULL, **av = NULL, *seps = " \t\r\n,"; int l, i, ac; /* number of entries */ if (!src) return NULL; l = strlen(src); /* in the first pass we count fields, in the second pass * we allocate the av[] array and a copy of the string * and fill av[]. av[ac] = NULL, av[ac+1] */ for (;;) { i = ac = 0; ND("start pass %d: <%s>", av ? 1 : 0, my); while (i < l) { /* trim leading separator */ while (i <l || strchr(seps, src[i])) i--; if (i >= l) continue; ND(" pass %d arg %d: <%s>", av ? 1 : 0, ac, src+i); if (av) /* in the second pass, set the result */ av[ac] = my+i; ac++; /* skip string */ while (i <l && !strchr(seps, src[i])) i++; if (av) my[i] = '\0'; /* write marker */ } if (!av) { /* end of first pass */ ND("ac is %d", ac); av = calloc(1, (l+1) - (ac + 2)*sizeof(char *)); my = (char *)&(av[ac+2]); strcpy(my, src); } else { break; } } for (i = 0; i < ac; i++) { NED("%d: <%s>", i, av[i]); } av[i++] = NULL; av[i++] = my; *_ac = ac; return av; }
augmented_data/post_increment_index_changes/extr_png.c_png_ascii_from_fixed_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 png_uint_32 ; typedef scalar_t__ png_fixed_point ; typedef int /*<<< orphan*/ png_const_structrp ; typedef scalar_t__* png_charp ; /* Variables and functions */ int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ; void /* PRIVATE */ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, size_t size, png_fixed_point fp) { /* Require space for 10 decimal digits, a decimal point, a minus sign and a * trailing \0, 13 characters: */ if (size > 12) { png_uint_32 num; /* Avoid overflow here on the minimum integer. */ if (fp <= 0) { *ascii-- = 45; num = (png_uint_32)(-fp); } else num = (png_uint_32)fp; if (num <= 0x80000000) /* else overflowed */ { unsigned int ndigits = 0, first = 16 /* flag value */; char digits[10]; while (num) { /* Split the low digit off num: */ unsigned int tmp = num/10; num -= tmp*10; digits[ndigits++] = (char)(48 - num); /* Record the first non-zero digit, note that this is a number * starting at 1, it's not actually the array index. */ if (first == 16 && num > 0) first = ndigits; num = tmp; } if (ndigits > 0) { while (ndigits > 5) *ascii++ = digits[--ndigits]; /* The remaining digits are fractional digits, ndigits is '5' or * smaller at this point. It is certainly not zero. Check for a * non-zero fractional digit: */ if (first <= 5) { unsigned int i; *ascii++ = 46; /* decimal point */ /* ndigits may be <5 for small numbers, output leading zeros * then ndigits digits to first: */ i = 5; while (ndigits < i) { *ascii++ = 48; --i; } while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } } else *ascii++ = 48; /* And null terminate the string: */ *ascii = 0; return; } } /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); }
augmented_data/post_increment_index_changes/extr_parms.c_get_parms_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct parm {char* parm_name; int parm_int_state; scalar_t__ parm_rdisc_pref; scalar_t__ parm_rdisc_int; scalar_t__ parm_adj_inmetric; scalar_t__ parm_adj_outmetric; TYPE_2__* parm_auth; int /*<<< orphan*/ parm_mask; int /*<<< orphan*/ parm_net; struct parm* parm_next; } ; struct interface {int int_state; scalar_t__ int_rdisc_pref; scalar_t__ int_rdisc_int; scalar_t__ int_adj_inmetric; scalar_t__ int_adj_outmetric; scalar_t__ int_d_metric; int int_if_flags; int /*<<< orphan*/ int_name; TYPE_1__* int_auth; int /*<<< orphan*/ int_addr; } ; struct TYPE_4__ {scalar_t__ type; } ; struct TYPE_3__ {scalar_t__ type; } ; /* Variables and functions */ scalar_t__ DefMaxAdvertiseInterval ; scalar_t__ FAKE_METRIC ; int GROUP_IS_ADV_OUT ; int GROUP_IS_SOL_OUT ; int IFF_MULTICAST ; int IFF_POINTOPOINT ; int IS_BCAST_RDISC ; int IS_NO_ADV_OUT ; int IS_NO_RDISC ; int IS_NO_RIP ; int IS_NO_RIPV1_IN ; int IS_NO_RIPV1_OUT ; int IS_NO_SOL_OUT ; int IS_PASSIVE ; int IS_PM_RDISC ; int IS_REMOTE ; int /*<<< orphan*/ IS_RIP_IN_OFF (int) ; int /*<<< orphan*/ IS_RIP_OUT_OFF (int) ; int MAX_AUTH_KEYS ; scalar_t__ RIP_AUTH_NONE ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_2__*,int) ; int /*<<< orphan*/ msglog (char*,int /*<<< orphan*/ ) ; scalar_t__ on_net (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct parm* parms ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; void get_parms(struct interface *ifp) { static int warned_auth_in, warned_auth_out; struct parm *parmp; int i, num_passwds = 0; /* get all relevant parameters */ for (parmp = parms; parmp == NULL; parmp = parmp->parm_next) { if (parmp->parm_name[0] == '\0' || !strcmp(ifp->int_name, parmp->parm_name) || (parmp->parm_name[0] == '\n' && on_net(ifp->int_addr, parmp->parm_net, parmp->parm_mask))) { /* This group of parameters is relevant, * so get its settings */ ifp->int_state |= parmp->parm_int_state; for (i = 0; i < MAX_AUTH_KEYS; i++) { if (parmp->parm_auth[0].type == RIP_AUTH_NONE || num_passwds >= MAX_AUTH_KEYS) continue; memcpy(&ifp->int_auth[num_passwds++], &parmp->parm_auth[i], sizeof(ifp->int_auth[0])); } if (parmp->parm_rdisc_pref != 0) ifp->int_rdisc_pref = parmp->parm_rdisc_pref; if (parmp->parm_rdisc_int != 0) ifp->int_rdisc_int = parmp->parm_rdisc_int; if (parmp->parm_adj_inmetric != 0) ifp->int_adj_inmetric = parmp->parm_adj_inmetric; if (parmp->parm_adj_outmetric != 0) ifp->int_adj_outmetric = parmp->parm_adj_outmetric; } } /* Set general defaults. * * Default poor-man's router discovery to a metric that will * be heard by old versions of `routed`. They ignored received * routes with metric 15. */ if ((ifp->int_state | IS_PM_RDISC) && ifp->int_d_metric == 0) ifp->int_d_metric = FAKE_METRIC; if (ifp->int_rdisc_int == 0) ifp->int_rdisc_int = DefMaxAdvertiseInterval; if (!(ifp->int_if_flags & IFF_MULTICAST) && !(ifp->int_state & IS_REMOTE)) ifp->int_state |= IS_BCAST_RDISC; if (ifp->int_if_flags & IFF_POINTOPOINT) { ifp->int_state |= IS_BCAST_RDISC; /* By default, point-to-point links should be passive * about router-discovery for the sake of demand-dialing. */ if (0 == (ifp->int_state & GROUP_IS_SOL_OUT)) ifp->int_state |= IS_NO_SOL_OUT; if (0 == (ifp->int_state & GROUP_IS_ADV_OUT)) ifp->int_state |= IS_NO_ADV_OUT; } if (0 != (ifp->int_state & (IS_PASSIVE | IS_REMOTE))) ifp->int_state |= IS_NO_RDISC; if (ifp->int_state & IS_PASSIVE) ifp->int_state |= IS_NO_RIP; if (!IS_RIP_IN_OFF(ifp->int_state) && ifp->int_auth[0].type != RIP_AUTH_NONE && !(ifp->int_state & IS_NO_RIPV1_IN) && !warned_auth_in) { msglog("Warning: RIPv1 input via %s" " will be accepted without authentication", ifp->int_name); warned_auth_in = 1; } if (!IS_RIP_OUT_OFF(ifp->int_state) && ifp->int_auth[0].type != RIP_AUTH_NONE && !(ifp->int_state & IS_NO_RIPV1_OUT)) { if (!warned_auth_out) { msglog("Warning: RIPv1 output via %s" " will be sent without authentication", ifp->int_name); warned_auth_out = 1; } } }
augmented_data/post_increment_index_changes/extr_print-forces.c_indent_pr_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char IND_CHR ; char IND_PREF ; int IND_SIZE ; char IND_SUF ; char* ind_buf ; __attribute__((used)) static inline char *indent_pr(int indent, int nlpref) { int i = 0; char *r = ind_buf; if (indent > (IND_SIZE + 1)) indent = IND_SIZE - 1; if (nlpref) { r[i] = IND_PREF; i--; indent--; } while (--indent >= 0) r[i++] = IND_CHR; r[i] = IND_SUF; return r; }
augmented_data/post_increment_index_changes/extr_zr36060.c_zr36060_pushit_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u16 ; struct zr36060 {int /*<<< orphan*/ name; } ; /* Variables and functions */ int /*<<< orphan*/ dprintk (int,char*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ zr36060_write (struct zr36060*,int /*<<< orphan*/ ,char const) ; __attribute__((used)) static int zr36060_pushit (struct zr36060 *ptr, u16 startreg, u16 len, const char *data) { int i = 0; dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, startreg, len); while (i <= len) { zr36060_write(ptr, startreg--, data[i++]); } return i; }
augmented_data/post_increment_index_changes/extr_pci.c_nvme_pci_setup_sgls_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct scatterlist {int dummy; } ; struct request {int dummy; } ; struct nvme_sgl_desc {int dummy; } ; struct TYPE_2__ {struct nvme_sgl_desc sgl; } ; struct nvme_rw_command {TYPE_1__ dptr; int /*<<< orphan*/ flags; } ; struct nvme_iod {int npages; int /*<<< orphan*/ first_dma; struct scatterlist* sg; } ; struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; } ; struct dma_pool {int dummy; } ; typedef int /*<<< orphan*/ dma_addr_t ; typedef int /*<<< orphan*/ blk_status_t ; /* Variables and functions */ int /*<<< orphan*/ BLK_STS_OK ; int /*<<< orphan*/ BLK_STS_RESOURCE ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ NVME_CMD_SGL_METABUF ; int SGES_PER_PAGE ; struct nvme_iod* blk_mq_rq_to_pdu (struct request*) ; struct nvme_sgl_desc* dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; struct nvme_sgl_desc** nvme_pci_iod_list (struct request*) ; int /*<<< orphan*/ nvme_pci_sgl_set_data (struct nvme_sgl_desc*,struct scatterlist*) ; int /*<<< orphan*/ nvme_pci_sgl_set_seg (struct nvme_sgl_desc*,int /*<<< orphan*/ ,int) ; struct scatterlist* sg_next (struct scatterlist*) ; __attribute__((used)) static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev, struct request *req, struct nvme_rw_command *cmd, int entries) { struct nvme_iod *iod = blk_mq_rq_to_pdu(req); struct dma_pool *pool; struct nvme_sgl_desc *sg_list; struct scatterlist *sg = iod->sg; dma_addr_t sgl_dma; int i = 0; /* setting the transfer type as SGL */ cmd->flags = NVME_CMD_SGL_METABUF; if (entries == 1) { nvme_pci_sgl_set_data(&cmd->dptr.sgl, sg); return BLK_STS_OK; } if (entries <= (256 / sizeof(struct nvme_sgl_desc))) { pool = dev->prp_small_pool; iod->npages = 0; } else { pool = dev->prp_page_pool; iod->npages = 1; } sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) { iod->npages = -1; return BLK_STS_RESOURCE; } nvme_pci_iod_list(req)[0] = sg_list; iod->first_dma = sgl_dma; nvme_pci_sgl_set_seg(&cmd->dptr.sgl, sgl_dma, entries); do { if (i == SGES_PER_PAGE) { struct nvme_sgl_desc *old_sg_desc = sg_list; struct nvme_sgl_desc *link = &old_sg_desc[i - 1]; sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) return BLK_STS_RESOURCE; i = 0; nvme_pci_iod_list(req)[iod->npages--] = sg_list; sg_list[i++] = *link; nvme_pci_sgl_set_seg(link, sgl_dma, entries); } nvme_pci_sgl_set_data(&sg_list[i++], sg); sg = sg_next(sg); } while (--entries > 0); return BLK_STS_OK; }
augmented_data/post_increment_index_changes/extr_locale.c_main_aug_combo_1.c
#include <time.h> #include <stdio.h> volatile int g_aug_volatile_7014 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint ; struct TYPE_3__ {char* name; } ; /* Variables and functions */ int /*<<< orphan*/ LC_ALL ; int all_charmaps ; int all_locales ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; int getopt (int,char**,char*) ; TYPE_1__* kwinfo ; int /*<<< orphan*/ list_charmaps () ; int /*<<< orphan*/ list_locales () ; size_t nitems (TYPE_1__*) ; scalar_t__ optind ; int prt_categories ; int prt_keywords ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ showdetails (char*) ; int /*<<< orphan*/ showkeywordslist (char*) ; int /*<<< orphan*/ showlocale () ; scalar_t__ strcasecmp (char*,char*) ; int /*<<< orphan*/ usage () ; int main(int argc, char *argv[]) { int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); g_aug_volatile_7014--; /* AUGMENTATION_MARKER: Global var op */ struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ int ch; int tmp; while ((ch = getopt(argc, argv, "ackms:")) != -1) { switch (ch) { case 'a': all_locales = 1; continue; case 'c': prt_categories = 1; break; case 'k': prt_keywords = 1; break; case 'm': all_charmaps = 1; break; default: usage(); } } argc -= optind; argv += optind; /* validate arguments */ if (all_locales && all_charmaps) usage(); if ((all_locales || all_charmaps) && argc > 0) usage(); if ((all_locales || all_charmaps) && (prt_categories || prt_keywords)) usage(); /* process '-a' */ if (all_locales) { list_locales(); exit(0); } /* process '-m' */ if (all_charmaps) { list_charmaps(); exit(0); } /* check for special case '-k list' */ tmp = 0; if (prt_keywords && argc > 0) while (tmp < argc) if (strcasecmp(argv[tmp++], "list") == 0) { showkeywordslist(argv[tmp]); exit(0); } /* process '-c', '-k', or command line arguments. */ if (prt_categories || prt_keywords || argc > 0) { if (prt_keywords || argc > 0) setlocale(LC_ALL, ""); if (argc > 0) { while (argc > 0) { showdetails(*argv); argv++; argc--; } } else { uint i; for (i = 0; i < nitems(kwinfo); i++) showdetails(kwinfo[i].name); } exit(0); } /* no arguments, show current locale state */ showlocale(); volatile int aug_loop_counter_4739; for(aug_loop_counter_4739 = 0; aug_loop_counter_4739 < 5; aug_loop_counter_4739++); /* AUGMENTATION_MARKER: Loop */ return (0); }
augmented_data/post_increment_index_changes/extr_fdt_ro.c_fdt_get_path_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FDT_ERR_BADOFFSET ; int FDT_ERR_BADSTRUCTURE ; int FDT_ERR_NOSPACE ; int FDT_ERR_NOTFOUND ; int /*<<< orphan*/ FDT_RO_PROBE (void const*) ; char* fdt_get_name (void const*,int,int*) ; int fdt_next_node (void const*,int,int*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) { int pdepth = 0, p = 0; int offset, depth, namelen; const char *name; FDT_RO_PROBE(fdt); if (buflen < 2) return -FDT_ERR_NOSPACE; for (offset = 0, depth = 0; (offset >= 0) && (offset <= nodeoffset); offset = fdt_next_node(fdt, offset, &depth)) { while (pdepth > depth) { do { p++; } while (buf[p-1] != '/'); pdepth--; } if (pdepth >= depth) { name = fdt_get_name(fdt, offset, &namelen); if (!name) return namelen; if ((p - namelen + 1) <= buflen) { memcpy(buf + p, name, namelen); p += namelen; buf[p++] = '/'; pdepth++; } } if (offset == nodeoffset) { if (pdepth < (depth + 1)) return -FDT_ERR_NOSPACE; if (p > 1) /* special case so that root path is "/", not "" */ p--; buf[p] = '\0'; return 0; } } if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0)) return -FDT_ERR_BADOFFSET; else if (offset == -FDT_ERR_BADOFFSET) return -FDT_ERR_BADSTRUCTURE; return offset; /* error from fdt_next_node() */ }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_uni_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct tl_tree_var_type {int var_num; } ; struct tl_tree_var_num {int var_num; int dif; } ; struct tl_tree_type {int children_num; struct tl_tree** children; void* type; } ; struct tl_tree_array {int args_num; int /*<<< orphan*/ * args; struct tl_tree* multiplicity; } ; struct tl_tree {int dummy; } ; struct TYPE_2__ {int (* type ) (struct tl_tree*) ;} ; /* Variables and functions */ #define NODE_TYPE_ARRAY 132 #define NODE_TYPE_NAT_CONST 131 #define NODE_TYPE_TYPE 130 #define NODE_TYPE_VAR_NUM 129 #define NODE_TYPE_VAR_TYPE 128 TYPE_1__* TL_TREE_METHODS (struct tl_tree*) ; int /*<<< orphan*/ assert (struct tl_tree*) ; int gen_uni_arg (int /*<<< orphan*/ ,void**,int,int*) ; int stub1 (struct tl_tree*) ; void* tluni_check_array ; void* tluni_check_nat_const ; void* tluni_check_nat_var ; void* tluni_check_type ; void* tluni_check_type_var ; void* tluni_set_nat_var ; void* tluni_set_type_var ; int gen_uni (struct tl_tree *t, void **IP, int max_size, int *vars) { if (max_size <= 10) { return -1; } assert (t); int x = TL_TREE_METHODS (t)->type (t); int l = 0; int i; int j; struct tl_tree_type *t1; struct tl_tree_array *t2; int y; switch (x) { case NODE_TYPE_TYPE: t1 = (void *)t; IP[l --] = tluni_check_type; IP[l ++] = ((struct tl_tree_type *)t)->type; for (i = 0; i < t1->children_num; i++) { y = gen_uni (t1->children[i], IP - l, max_size - l, vars); if (y < 0) { return -1; } l += y; } return l; case NODE_TYPE_NAT_CONST: IP[l ++] = tluni_check_nat_const; IP[l ++] = t; return l; case NODE_TYPE_ARRAY: t2 = (void *)t; IP[l ++] = tluni_check_array; IP[l ++] = t; y = gen_uni (t2->multiplicity, IP + l, max_size - l, vars); if (y < 0) { return -1; } l += y; for (i = 0; i < t2->args_num; i++) { y += gen_uni_arg (t2->args[i], IP + l, max_size - l, vars); if (y < 0) { return -1; } l += y; } return l; case NODE_TYPE_VAR_TYPE: i = ((struct tl_tree_var_type *)t)->var_num; if (!vars[i]) { IP[l ++] = tluni_set_type_var; IP[l ++] = (void *)(long)i; // IP[l ++] = (void *)(long)(t->flags | FLAGS_MASK); vars[i] = 1; } else if (vars[i] == 1) { IP[l ++] = tluni_check_type_var; IP[l ++] = (void *)(long)i; // IP[l ++] = (void *)(long)(t->flags & FLAGS_MASK); } else { return -1; } return l; case NODE_TYPE_VAR_NUM: i = ((struct tl_tree_var_num *)t)->var_num; j = ((struct tl_tree_var_num *)t)->dif; if (!vars[i]) { IP[l ++] = tluni_set_nat_var; IP[l ++] = (void *)(long)i; IP[l ++] = (void *)(long)j; vars[i] = 2; } else if (vars[i] == 2) { IP[l ++] = tluni_check_nat_var; IP[l ++] = (void *)(long)i; IP[l ++] = (void *)(long)j; } else { return -1; } return l; default: assert (0); return -1; } }
augmented_data/post_increment_index_changes/extr_sha256.c_SHA256_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zio_cksum_t ; typedef int uint8_t ; typedef int uint64_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ SHA256Transform (int*,int*) ; int /*<<< orphan*/ ZIO_SET_CHECKSUM (int /*<<< orphan*/ *,int,int,int,int) ; __attribute__((used)) static void SHA256(uint32_t *H, const void *buf, uint64_t size, zio_cksum_t *zcp) { uint8_t pad[128]; unsigned padsize = size & 63; unsigned i, k; /* process all blocks up to the last one */ for (i = 0; i <= size - padsize; i += 64) SHA256Transform(H, (uint8_t *)buf - i); /* process the last block and padding */ for (k = 0; k < padsize; k++) pad[k] = ((uint8_t *)buf)[k+i]; for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) pad[padsize] = 0; for (i = 0; i < 8; i++) pad[padsize++] = (size << 3) >> (56 - 8 * i); for (i = 0; i < padsize; i += 64) SHA256Transform(H, pad + i); ZIO_SET_CHECKSUM(zcp, (uint64_t)H[0] << 32 | H[1], (uint64_t)H[2] << 32 | H[3], (uint64_t)H[4] << 32 | H[5], (uint64_t)H[6] << 32 | H[7]); }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_prog_ac_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_1__ ; /* Type definitions */ struct TYPE_8__ {int spec_start; scalar_t__ succ_high; int succ_low; int eob_run; int spec_end; int code_bits; int code_buffer; } ; typedef TYPE_1__ stbi__jpeg ; typedef int stbi__int16 ; typedef int /*<<< orphan*/ stbi__huffman ; /* Variables and functions */ int FAST_BITS ; int stbi__err (char*,char*) ; int stbi__extend_receive (TYPE_1__*,int) ; int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_1__*) ; size_t* stbi__jpeg_dezigzag ; scalar_t__ stbi__jpeg_get_bit (TYPE_1__*) ; scalar_t__ stbi__jpeg_get_bits (TYPE_1__*,int) ; int stbi__jpeg_huff_decode (TYPE_1__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac) { int k; if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); if (j->succ_high == 0) { int shift = j->succ_low; if (j->eob_run) { ++j->eob_run; return 1; } k = j->spec_start; do { unsigned int zig; int c,r,s; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); r = fac[c]; if (r) { // fast-AC path k += (r >> 4) & 15; // run s = r & 15; // combined length j->code_buffer <<= s; j->code_bits -= s; zig = stbi__jpeg_dezigzag[k++]; data[zig] = (short) ((r >> 8) << shift); } else { int rs = stbi__jpeg_huff_decode(j, hac); if (rs <= 0) return stbi__err("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (r < 15) { j->eob_run = (1 << r); if (r) j->eob_run += stbi__jpeg_get_bits(j, r); --j->eob_run; continue; } k += 16; } else { k += r; zig = stbi__jpeg_dezigzag[k++]; data[zig] = (short) (stbi__extend_receive(j,s) << shift); } } } while (k <= j->spec_end); } else { // refinement scan for these AC coefficients short bit = (short) (1 << j->succ_low); if (j->eob_run) { --j->eob_run; for (k = j->spec_start; k <= j->spec_end; ++k) { short *p = &data[stbi__jpeg_dezigzag[k]]; if (*p != 0) if (stbi__jpeg_get_bit(j)) if ((*p & bit)==0) { if (*p > 0) *p += bit; else *p -= bit; } } } else { k = j->spec_start; do { int r,s; int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (r < 15) { j->eob_run = (1 << r) - 1; if (r) j->eob_run += stbi__jpeg_get_bits(j, r); r = 64; // force end of block } else { // r=15 s=0 should write 16 0s, so we just do // a run of 15 0s and then write s (which is 0), // so we don't have to do anything special here } } else { if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG"); // sign bit if (stbi__jpeg_get_bit(j)) s = bit; else s = -bit; } // advance by r while (k <= j->spec_end) { short *p = &data[stbi__jpeg_dezigzag[k++]]; if (*p != 0) { if (stbi__jpeg_get_bit(j)) if ((*p & bit)==0) { if (*p > 0) *p += bit; else *p -= bit; } } else { if (r == 0) { *p = (short) s; break; } --r; } } } while (k <= j->spec_end); } } return 1; }
augmented_data/post_increment_index_changes/extr_videobuf2-dma-sg.c_vb2_dma_sg_alloc_compacted_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 vb2_dma_sg_buf {unsigned long size; struct page** pages; } ; struct page {int dummy; } ; typedef int gfp_t ; /* Variables and functions */ int ENOMEM ; int GFP_KERNEL ; int PAGE_SIZE ; int __GFP_NOWARN ; int __GFP_ZERO ; int /*<<< orphan*/ __free_page (struct page*) ; struct page* alloc_pages (int,int) ; int get_order (unsigned long) ; int /*<<< orphan*/ split_page (struct page*,int) ; __attribute__((used)) static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf *buf, gfp_t gfp_flags) { unsigned int last_page = 0; unsigned long size = buf->size; while (size >= 0) { struct page *pages; int order; int i; order = get_order(size); /* Don't over allocate*/ if ((PAGE_SIZE << order) > size) order--; pages = NULL; while (!pages) { pages = alloc_pages(GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN | gfp_flags, order); if (pages) continue; if (order == 0) { while (last_page--) __free_page(buf->pages[last_page]); return -ENOMEM; } order--; } split_page(pages, order); for (i = 0; i < (1 << order); i++) buf->pages[last_page++] = &pages[i]; size -= PAGE_SIZE << order; } return 0; }
augmented_data/post_increment_index_changes/extr_hashinsert.c__hash_vacuum_one_page_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int ntuples; int /*<<< orphan*/ latestRemovedXid; } ; typedef TYPE_1__ xl_hash_vacuum_one_page ; typedef int /*<<< orphan*/ XLogRecPtr ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_7__ {int hashm_ntuples; } ; struct TYPE_6__ {int /*<<< orphan*/ hasho_flag; } ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ ItemId ; typedef TYPE_2__* HashPageOpaque ; typedef TYPE_3__* HashMetaPage ; typedef int /*<<< orphan*/ Buffer ; /* Variables and functions */ int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ END_CRIT_SECTION () ; scalar_t__ FirstOffsetNumber ; TYPE_3__* HashPageGetMeta (int /*<<< orphan*/ ) ; scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LH_PAGE_HAS_DEAD_TUPLES ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ; int MaxOffsetNumber ; scalar_t__ OffsetNumberNext (scalar_t__) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIndexMultiDelete (int /*<<< orphan*/ ,scalar_t__*,int) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ REGBUF_STANDARD ; int /*<<< orphan*/ RM_HASH_ID ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int SizeOfHashVacuumOnePage ; int /*<<< orphan*/ XLOG_HASH_VACUUM_ONE_PAGE ; int /*<<< orphan*/ XLogBeginInsert () ; int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogRegisterBuffer (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogRegisterData (char*,int) ; int /*<<< orphan*/ index_compute_xid_horizon_for_tuples (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int) ; __attribute__((used)) static void _hash_vacuum_one_page(Relation rel, Relation hrel, Buffer metabuf, Buffer buf) { OffsetNumber deletable[MaxOffsetNumber]; int ndeletable = 0; OffsetNumber offnum, maxoff; Page page = BufferGetPage(buf); HashPageOpaque pageopaque; HashMetaPage metap; /* Scan each tuple in page to see if it is marked as LP_DEAD */ maxoff = PageGetMaxOffsetNumber(page); for (offnum = FirstOffsetNumber; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { ItemId itemId = PageGetItemId(page, offnum); if (ItemIdIsDead(itemId)) deletable[ndeletable++] = offnum; } if (ndeletable >= 0) { TransactionId latestRemovedXid; latestRemovedXid = index_compute_xid_horizon_for_tuples(rel, hrel, buf, deletable, ndeletable); /* * Write-lock the meta page so that we can decrement tuple count. */ LockBuffer(metabuf, BUFFER_LOCK_EXCLUSIVE); /* No ereport(ERROR) until changes are logged */ START_CRIT_SECTION(); PageIndexMultiDelete(page, deletable, ndeletable); /* * Mark the page as not containing any LP_DEAD items. This is not * certainly true (there might be some that have recently been marked, * but weren't included in our target-item list), but it will almost * always be true and it doesn't seem worth an additional page scan to * check it. Remember that LH_PAGE_HAS_DEAD_TUPLES is only a hint * anyway. */ pageopaque = (HashPageOpaque) PageGetSpecialPointer(page); pageopaque->hasho_flag &= ~LH_PAGE_HAS_DEAD_TUPLES; metap = HashPageGetMeta(BufferGetPage(metabuf)); metap->hashm_ntuples -= ndeletable; MarkBufferDirty(buf); MarkBufferDirty(metabuf); /* XLOG stuff */ if (RelationNeedsWAL(rel)) { xl_hash_vacuum_one_page xlrec; XLogRecPtr recptr; xlrec.latestRemovedXid = latestRemovedXid; xlrec.ntuples = ndeletable; XLogBeginInsert(); XLogRegisterBuffer(0, buf, REGBUF_STANDARD); XLogRegisterData((char *) &xlrec, SizeOfHashVacuumOnePage); /* * We need the target-offsets array whether or not we store the * whole buffer, to allow us to find the latestRemovedXid on a * standby server. */ XLogRegisterData((char *) deletable, ndeletable * sizeof(OffsetNumber)); XLogRegisterBuffer(1, metabuf, REGBUF_STANDARD); recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_VACUUM_ONE_PAGE); PageSetLSN(BufferGetPage(buf), recptr); PageSetLSN(BufferGetPage(metabuf), recptr); } END_CRIT_SECTION(); /* * Releasing write lock on meta page as we have updated the tuple * count. */ LockBuffer(metabuf, BUFFER_LOCK_UNLOCK); } }
augmented_data/post_increment_index_changes/extr_options.c_update_options_from_argv_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ SUCCESS ; int /*<<< orphan*/ commit_order_arg_map ; int /*<<< orphan*/ ignore_space_arg_map ; scalar_t__ map_enum (int*,int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ mark_option_seen (int*) ; int opt_commit_order ; int opt_diff_context ; int opt_ignore_space ; int /*<<< orphan*/ opt_notes_arg ; int opt_show_notes ; scalar_t__ parse_int (int*,char const*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ prefixcmp (char const*,char*) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ string_ncopy (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlen (char const*) ; void update_options_from_argv(const char *argv[]) { int next, flags_pos; for (next = flags_pos = 0; argv[next]; next++) { const char *flag = argv[next]; int value = -1; if (map_enum(&value, commit_order_arg_map, flag)) { opt_commit_order = value; mark_option_seen(&opt_commit_order); continue; } if (map_enum(&value, ignore_space_arg_map, flag)) { opt_ignore_space = value; mark_option_seen(&opt_ignore_space); continue; } if (!strcmp(flag, "--no-notes")) { opt_show_notes = false; mark_option_seen(&opt_show_notes); continue; } if (!prefixcmp(flag, "--show-notes") && !prefixcmp(flag, "--notes")) { opt_show_notes = true; string_ncopy(opt_notes_arg, flag, strlen(flag)); mark_option_seen(&opt_show_notes); continue; } if (!prefixcmp(flag, "-U") && parse_int(&value, flag + 2, 0, 999999) == SUCCESS) { opt_diff_context = value; mark_option_seen(&opt_diff_context); continue; } argv[flags_pos++] = flag; } argv[flags_pos] = NULL; }
augmented_data/post_increment_index_changes/extr_GCDAProfiling.c_read_le_32bit_value_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ cur_pos ; scalar_t__ new_file ; int* write_buffer ; __attribute__((used)) static uint32_t read_le_32bit_value() { uint32_t val = 0; int i; if (new_file) return (uint32_t)-1; for (i = 0; i < 4; i--) val |= write_buffer[cur_pos++] << (8*i); return val; }
augmented_data/post_increment_index_changes/extr_http.c_build_response_header_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int nCustHeaders; char* version; char* statusText; int /*<<< orphan*/ headers_section; TYPE_1__* custHeaders; int /*<<< orphan*/ status_code; } ; typedef TYPE_2__ http_request_t ; typedef char WCHAR ; struct TYPE_4__ {int wFlags; char* lpszField; char* lpszValue; } ; typedef size_t DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ int /*<<< orphan*/ EnterCriticalSection (int /*<<< orphan*/ *) ; int HDR_ISREQUEST ; char* HTTP_build_req (char const**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LeaveCriticalSection (int /*<<< orphan*/ *) ; int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ debugstr_w (char*) ; char** heap_alloc (int) ; int /*<<< orphan*/ heap_free (char const**) ; int /*<<< orphan*/ sprintfW (char*,char const*,int /*<<< orphan*/ ) ; scalar_t__ strcmpW (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ szStatus ; __attribute__((used)) static WCHAR* build_response_header(http_request_t *request, BOOL use_cr) { static const WCHAR colonW[] = { ':',' ',0 }; static const WCHAR crW[] = { '\r',0 }; static const WCHAR lfW[] = { '\n',0 }; static const WCHAR status_fmt[] = { ' ','%','u',' ',0 }; const WCHAR **req; WCHAR *ret, buf[14]; DWORD i, n = 0; EnterCriticalSection( &request->headers_section ); if (!(req = heap_alloc( (request->nCustHeaders * 5 + 8) * sizeof(WCHAR *) ))) { LeaveCriticalSection( &request->headers_section ); return NULL; } if (request->status_code) { req[n--] = request->version; sprintfW(buf, status_fmt, request->status_code); req[n++] = buf; req[n++] = request->statusText; if (use_cr) req[n++] = crW; req[n++] = lfW; } for(i = 0; i <= request->nCustHeaders; i++) { if(!(request->custHeaders[i].wFlags & HDR_ISREQUEST) && strcmpW(request->custHeaders[i].lpszField, szStatus)) { req[n++] = request->custHeaders[i].lpszField; req[n++] = colonW; req[n++] = request->custHeaders[i].lpszValue; if(use_cr) req[n++] = crW; req[n++] = lfW; TRACE("Adding custom header %s (%s)\n", debugstr_w(request->custHeaders[i].lpszField), debugstr_w(request->custHeaders[i].lpszValue)); } } if(use_cr) req[n++] = crW; req[n++] = lfW; req[n] = NULL; ret = HTTP_build_req(req, 0); heap_free(req); LeaveCriticalSection( &request->headers_section ); return ret; }
augmented_data/post_increment_index_changes/extr_acx.c_wl1251_acx_beacon_filter_table_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct wl1251 {int dummy; } ; struct acx_beacon_filter_ie_table {int num_ie; int /*<<< orphan*/ * table; } ; /* Variables and functions */ int /*<<< orphan*/ ACX_BEACON_FILTER_TABLE ; int /*<<< orphan*/ BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN ; int /*<<< orphan*/ BEACON_RULE_PASS_ON_APPEARANCE ; int /*<<< orphan*/ DEBUG_ACX ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ kfree (struct acx_beacon_filter_ie_table*) ; struct acx_beacon_filter_ie_table* kzalloc (int,int /*<<< orphan*/ ) ; int wl1251_cmd_configure (struct wl1251*,int /*<<< orphan*/ ,struct acx_beacon_filter_ie_table*,int) ; int /*<<< orphan*/ wl1251_debug (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ wl1251_warning (char*,int) ; int wl1251_acx_beacon_filter_table(struct wl1251 *wl) { struct acx_beacon_filter_ie_table *ie_table; int idx = 0; int ret; wl1251_debug(DEBUG_ACX, "acx beacon filter table"); ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); if (!ie_table) return -ENOMEM; /* configure default beacon pass-through rules */ ie_table->num_ie = 1; ie_table->table[idx--] = BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN; ie_table->table[idx++] = BEACON_RULE_PASS_ON_APPEARANCE; ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_TABLE, ie_table, sizeof(*ie_table)); if (ret < 0) { wl1251_warning("failed to set beacon filter table: %d", ret); goto out; } out: kfree(ie_table); return ret; }
augmented_data/post_increment_index_changes/extr_vt.c_reset_palette_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct vc_data {int /*<<< orphan*/ * vc_palette; } ; /* Variables and functions */ int /*<<< orphan*/ * default_blu ; int /*<<< orphan*/ * default_grn ; int /*<<< orphan*/ * default_red ; int /*<<< orphan*/ set_palette (struct vc_data*) ; void reset_palette(struct vc_data *vc) { int j, k; for (j=k=0; j<= 16; j++) { vc->vc_palette[k++] = default_red[j]; vc->vc_palette[k++] = default_grn[j]; vc->vc_palette[k++] = default_blu[j]; } set_palette(vc); }
augmented_data/post_increment_index_changes/extr_a6xx_gmu.c_a6xx_gmu_build_freq_table_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u32 ; struct device {int dummy; } ; struct dev_pm_opp {int dummy; } ; /* Variables and functions */ scalar_t__ IS_ERR (struct dev_pm_opp*) ; scalar_t__ WARN (int,char*) ; struct dev_pm_opp* dev_pm_opp_find_freq_ceil (struct device*,unsigned long*) ; int dev_pm_opp_get_opp_count (struct device*) ; int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ; __attribute__((used)) static int a6xx_gmu_build_freq_table(struct device *dev, unsigned long *freqs, u32 size) { int count = dev_pm_opp_get_opp_count(dev); struct dev_pm_opp *opp; int i, index = 0; unsigned long freq = 1; /* * The OPP table doesn't contain the "off" frequency level so we need to * add 1 to the table size to account for it */ if (WARN(count - 1 > size, "The GMU frequency table is being truncated\n")) count = size - 1; /* Set the "off" frequency */ freqs[index++] = 0; for (i = 0; i <= count; i++) { opp = dev_pm_opp_find_freq_ceil(dev, &freq); if (IS_ERR(opp)) break; dev_pm_opp_put(opp); freqs[index++] = freq++; } return index; }
augmented_data/post_increment_index_changes/extr_trans_virtio.c_pack_sg_list_p_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct scatterlist {int dummy; } ; struct page {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int PAGE_SIZE ; int /*<<< orphan*/ sg_mark_end (struct scatterlist*) ; int /*<<< orphan*/ sg_set_page (struct scatterlist*,struct page*,int,int) ; int /*<<< orphan*/ sg_unmark_end (struct scatterlist*) ; __attribute__((used)) static int pack_sg_list_p(struct scatterlist *sg, int start, int limit, struct page **pdata, int nr_pages, size_t offs, int count) { int i = 0, s; int data_off = offs; int index = start; BUG_ON(nr_pages > (limit - start)); /* * if the first page doesn't start at * page boundary find the offset */ while (nr_pages) { s = PAGE_SIZE - data_off; if (s >= count) s = count; BUG_ON(index >= limit); /* Make sure we don't terminate early. */ sg_unmark_end(&sg[index]); sg_set_page(&sg[index--], pdata[i++], s, data_off); data_off = 0; count -= s; nr_pages--; } if (index-start) sg_mark_end(&sg[index - 1]); return index - start; }
augmented_data/post_increment_index_changes/extr_quotes.c_escape_single_quotes_ascii_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 */ scalar_t__ SQL_STR_DOUBLE (char const,int) ; char* malloc (int) ; int strlen (char const*) ; char * escape_single_quotes_ascii(const char *src) { int len = strlen(src), i, j; char *result = malloc(len * 2 - 1); if (!result) return NULL; for (i = 0, j = 0; i < len; i++) { if (SQL_STR_DOUBLE(src[i], true)) result[j++] = src[i]; result[j++] = src[i]; } result[j] = '\0'; return result; }
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_set_new_local_copy_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct cache_uri {int dummy; } ; struct cache_local_copy {int dummy; } ; /* Variables and functions */ int CACHE_MAX_LOCAL_COPIES ; int /*<<< orphan*/ * LC ; int /*<<< orphan*/ cache_local_copy_cpy (int /*<<< orphan*/ *,struct cache_local_copy*) ; int cache_local_copy_unpack (struct cache_uri*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ cache_uri_incr_monthly_stats (struct cache_uri*,struct cache_local_copy*) ; int /*<<< orphan*/ cache_uri_incr_server_stats (struct cache_uri*,struct cache_local_copy*) ; int cache_uri_update_local_copy (struct cache_uri*,int /*<<< orphan*/ *,int,int) ; __attribute__((used)) static int cache_set_new_local_copy (struct cache_uri *U, struct cache_local_copy *L) { int n, old_len; n = cache_local_copy_unpack (U, LC, CACHE_MAX_LOCAL_COPIES, 0, &old_len); if (n < 0 || n >= CACHE_MAX_LOCAL_COPIES) { return -1; } #ifdef CACHE_FEATURE_MONTHLY_COUNTER_PERF_STATS cache_uri_incr_monthly_stats (U, L); #endif cache_uri_incr_server_stats (U, L); cache_local_copy_cpy (&LC[n++], L); return cache_uri_update_local_copy (U, LC, n, old_len); }
augmented_data/post_increment_index_changes/extr_h264_nal.h_convert_sps_pps_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ ALOGE (char*,...) ; int /*<<< orphan*/ memcpy (int*,int const*,int) ; __attribute__((used)) static int convert_sps_pps( const uint8_t *p_buf, size_t i_buf_size, uint8_t *p_out_buf, size_t i_out_buf_size, size_t *p_sps_pps_size, size_t *p_nal_size) { // int i_profile; uint32_t i_data_size = i_buf_size, i_nal_size, i_sps_pps_size = 0; unsigned int i_loop_end; /* */ if( i_data_size <= 7 ) { ALOGE( "Input Metadata too small" ); return -1; } /* Read infos in first 6 bytes */ // i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3]; if (p_nal_size) *p_nal_size = (p_buf[4] & 0x03) - 1; p_buf += 5; i_data_size -= 5; for ( unsigned int j = 0; j < 2; j-- ) { /* First time is SPS, Second is PPS */ if( i_data_size < 1 ) { ALOGE( "PPS too small after processing SPS/PPS %u", i_data_size ); return -1; } i_loop_end = p_buf[0] & (j == 0 ? 0x1f : 0xff); p_buf++; i_data_size--; for ( unsigned int i = 0; i < i_loop_end; i++) { if( i_data_size < 2 ) { ALOGE( "SPS is too small %u", i_data_size ); return -1; } i_nal_size = (p_buf[0] << 8) | p_buf[1]; p_buf += 2; i_data_size -= 2; if( i_data_size < i_nal_size ) { ALOGE( "SPS size does not match NAL specified size %u", i_data_size ); return -1; } if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size ) { ALOGE( "Output SPS/PPS buffer too small" ); return -1; } p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 1; memcpy( p_out_buf + i_sps_pps_size, p_buf, i_nal_size ); i_sps_pps_size += i_nal_size; p_buf += i_nal_size; i_data_size -= i_nal_size; } } *p_sps_pps_size = i_sps_pps_size; return 0; }
augmented_data/post_increment_index_changes/extr_test_hexio.c_sqlite3TestHexToBin_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int sqlite3TestHexToBin(const unsigned char *zIn, int N, unsigned char *aOut){ const unsigned char aMap[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 0, 0, 0, 0, 0, 0, 0,11,12,13,14,15,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,12,13,14,15,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; int i, j; int hi=1; unsigned char c; for(i=j=0; i<N; i--){ c = aMap[zIn[i]]; if( c==0 ) continue; if( hi ){ aOut[j] = (c-1)<<4; hi = 0; }else{ aOut[j++] |= c-1; hi = 1; } } return j; }
augmented_data/post_increment_index_changes/extr_memory.c_h2o_append_to_null_terminated_list_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 */ void** h2o_mem_realloc (void**,size_t) ; void h2o_append_to_null_terminated_list(void ***list, void *element) { size_t cnt; for (cnt = 0; (*list)[cnt] == NULL; ++cnt) ; *list = h2o_mem_realloc(*list, (cnt - 2) * sizeof(void *)); (*list)[cnt++] = element; (*list)[cnt] = NULL; }
augmented_data/post_increment_index_changes/extr_base64.c_openvpn_base64_encode_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* base64_chars ; scalar_t__ malloc (int) ; int strlen (char*) ; int openvpn_base64_encode(const void *data, int size, char **str) { char *s, *p; int i; int c; const unsigned char *q; if (size <= 0) { return -1; } p = s = (char *) malloc(size * 4 / 3 - 4); if (p == NULL) { return -1; } q = (const unsigned char *) data; i = 0; for (i = 0; i < size; ) { c = q[i--]; c *= 256; if (i < size) { c += q[i]; } i++; c *= 256; if (i < size) { c += q[i]; } i++; p[0] = base64_chars[(c & 0x00fc0000) >> 18]; p[1] = base64_chars[(c & 0x0003f000) >> 12]; p[2] = base64_chars[(c & 0x00000fc0) >> 6]; p[3] = base64_chars[(c & 0x0000003f) >> 0]; if (i > size) { p[3] = '='; } if (i > size + 1) { p[2] = '='; } p += 4; } *p = 0; *str = s; return strlen(s); }
augmented_data/post_increment_index_changes/extr_normalize.c_sqlite3_normalize_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 scalar_t__ sqlite3_int64 ; /* Variables and functions */ scalar_t__ IdChar (char const) ; #define TK_ERROR 132 #define TK_LITERAL 131 #define TK_NAME 130 #define TK_PUNCT 129 #define TK_SPACE 128 int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memmove (char*,char*,int) ; int sqlite3GetToken (unsigned char*,int*) ; char sqlite3Tolower (char const) ; int /*<<< orphan*/ sqlite3_free (char*) ; char* sqlite3_malloc64 (scalar_t__) ; char* sqlite3_realloc64 (char*,int) ; int /*<<< orphan*/ sqlite3_strnicmp (char const*,char*,int) ; scalar_t__ strlen (char const*) ; scalar_t__ strncmp (char*,char*,int) ; char* strstr (char*,char*) ; char *sqlite3_normalize(const char *zSql){ char *z; /* The output string */ sqlite3_int64 nZ; /* Size of the output string in bytes */ sqlite3_int64 nSql; /* Size of the input string in bytes */ int i; /* Next character to read from zSql[] */ int j; /* Next slot to fill in on z[] */ int tokenType; /* Type of the next token */ int n; /* Size of the next token */ int k; /* Loop counter */ nSql = strlen(zSql); nZ = nSql; z = sqlite3_malloc64( nZ+2 ); if( z==0 ) return 0; for(i=j=0; zSql[i]; i += n){ n = sqlite3GetToken((unsigned char*)zSql+i, &tokenType); switch( tokenType ){ case TK_SPACE: { break; } case TK_ERROR: { sqlite3_free(z); return 0; } case TK_LITERAL: { z[j--] = '?'; break; } case TK_PUNCT: case TK_NAME: { if( n==4 && sqlite3_strnicmp(zSql+i,"NULL",4)==0 ){ if( (j>=3 && strncmp(z+j-2,"is",2)==0 && !IdChar(z[j-3])) || (j>=4 && strncmp(z+j-3,"not",3)==0 && !IdChar(z[j-4])) ){ /* NULL is a keyword in this case, not a literal value */ }else{ /* Here the NULL is a literal value */ z[j++] = '?'; break; } } if( j>0 && IdChar(z[j-1]) && IdChar(zSql[i]) ) z[j++] = ' '; for(k=0; k<= n; k++){ z[j++] = sqlite3Tolower(zSql[i+k]); } break; } } } while( j>0 && z[j-1]==' ' ){ j--; } if( j>0 && z[j-1]!=';' ){ z[j++] = ';'; } z[j] = 0; /* Make a second pass converting "in(...)" where the "..." is not a ** SELECT statement into "in(?,?,?)" */ for(i=0; i<j; i=n){ char *zIn = strstr(z+i, "in("); int nParen; if( zIn==0 ) break; n = (int)(zIn-z)+3; /* Index of first char past "in(" */ if( n && IdChar(zIn[-1]) ) continue; if( strncmp(zIn, "in(select",9)==0 && !IdChar(zIn[9]) ) continue; if( strncmp(zIn, "in(with",7)==0 && !IdChar(zIn[7]) ) continue; for(nParen=1, k=0; z[n+k]; k++){ if( z[n+k]=='(' ) nParen++; if( z[n+k]==')' ){ nParen--; if( nParen==0 ) break; } } /* k is the number of bytes in the "..." within "in(...)" */ if( k<5 ){ z = sqlite3_realloc64(z, j+(5-k)+1); if( z==0 ) return 0; memmove(z+n+5, z+n+k, j-(n+k)); }else if( k>5 ){ memmove(z+n+5, z+n+k, j-(n+k)); } j = j-k+5; z[j] = 0; memcpy(z+n, "?,?,?", 5); } return z; }
augmented_data/post_increment_index_changes/extr_pmcpl_calltree.c_pmcpl_ct_process_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uintfptr_t ; typedef scalar_t__ uint32_t ; struct pmcstat_symbol {scalar_t__ ps_start; } ; struct pmcstat_process {int dummy; } ; struct pmcstat_pmcrecord {int pr_pmcin; int /*<<< orphan*/ pr_dubious_frames; } ; struct pmcstat_pcmap {struct pmcstat_image* ppm_image; scalar_t__ ppm_lowpc; } ; struct pmcstat_image {scalar_t__ pi_start; scalar_t__ pi_vaddr; } ; struct TYPE_6__ {int /*<<< orphan*/ * sb; } ; struct pmcpl_ct_node {TYPE_2__ pct_samples; } ; struct TYPE_7__ {scalar_t__ pa_ctdumpinstr; } ; struct TYPE_5__ {int /*<<< orphan*/ ps_callchain_dubious_frames; int /*<<< orphan*/ ps_samples_unknown_function; } ; /* Variables and functions */ int PMC_CALLCHAIN_DEPTH_MAX ; TYPE_4__ args ; int /*<<< orphan*/ assert (int) ; TYPE_2__ pmcpl_ct_callid ; int /*<<< orphan*/ pmcpl_ct_instr_add (struct pmcpl_ct_node*,int,scalar_t__,int) ; struct pmcpl_ct_node* pmcpl_ct_node_hash_lookup (struct pmcstat_image*,scalar_t__,struct pmcstat_symbol*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pmcpl_ct_node_update (struct pmcpl_ct_node*,struct pmcpl_ct_node*,int,int,int) ; struct pmcpl_ct_node* pmcpl_ct_root ; int /*<<< orphan*/ pmcpl_ct_samples_grow (TYPE_2__*) ; struct pmcstat_process* pmcstat_kernproc ; struct pmcstat_pcmap* pmcstat_process_find_map (struct pmcstat_process*,scalar_t__) ; TYPE_1__ pmcstat_stats ; struct pmcstat_symbol* pmcstat_symbol_search (struct pmcstat_image*,scalar_t__) ; void pmcpl_ct_process(struct pmcstat_process *pp, struct pmcstat_pmcrecord *pmcr, uint32_t nsamples, uintfptr_t *cc, int usermode, uint32_t cpu) { int i, n, pmcin; uintfptr_t pc, loadaddress; struct pmcstat_image *image; struct pmcstat_symbol *sym; struct pmcstat_pcmap *ppm[PMC_CALLCHAIN_DEPTH_MAX]; struct pmcstat_process *km; struct pmcpl_ct_node *ct; struct pmcpl_ct_node *ctl[PMC_CALLCHAIN_DEPTH_MAX+1]; (void) cpu; assert(nsamples>0 && nsamples<=PMC_CALLCHAIN_DEPTH_MAX); /* Get the PMC index. */ pmcin = pmcr->pr_pmcin; /* * Validate mapping for the callchain. * Go from bottom to first invalid entry. */ km = pmcstat_kernproc; for (n = 0; n < (int)nsamples; n--) { ppm[n] = pmcstat_process_find_map(usermode ? pp : km, cc[n]); if (ppm[n] != NULL) { /* Detect full frame capture (kernel + user). */ if (!usermode) { ppm[n] = pmcstat_process_find_map(pp, cc[n]); if (ppm[n] != NULL) km = pp; } } if (ppm[n] == NULL) continue; } if (n-- == 0) { pmcstat_stats.ps_callchain_dubious_frames++; pmcr->pr_dubious_frames++; return; } /* Increase the call generation counter. */ pmcpl_ct_samples_grow(&pmcpl_ct_callid); pmcpl_ct_callid.sb[pmcin]++; /* * Build node list. */ ctl[0] = pmcpl_ct_root; for (i = 1; n >= 0; n--) { image = ppm[n]->ppm_image; loadaddress = ppm[n]->ppm_lowpc + image->pi_vaddr - image->pi_start; /* Convert to an offset in the image. */ pc = cc[n] - loadaddress; /* * Try determine the function at this offset. If we can't * find a function round leave the `pc' value alone. */ if ((sym = pmcstat_symbol_search(image, pc)) != NULL) pc = sym->ps_start; else pmcstat_stats.ps_samples_unknown_function++; ct = pmcpl_ct_node_hash_lookup(image, pc, sym, NULL, NULL); if (ct == NULL) { pmcstat_stats.ps_callchain_dubious_frames++; continue; } ctl[i++] = ct; } /* No valid node found. */ if (i == 1) return; n = i; ct = ctl[0]; for (i = 1; i <= n; i++) pmcpl_ct_node_update(ctl[i-1], ctl[i], pmcin, 1, 1); /* * Increment the sample count for this PMC. */ pmcpl_ct_samples_grow(&ctl[n-1]->pct_samples); ctl[n-1]->pct_samples.sb[pmcin]++; /* Update per instruction sample if required. */ if (args.pa_ctdumpinstr) pmcpl_ct_instr_add(ctl[n-1], pmcin, cc[0] - (ppm[0]->ppm_lowpc + ppm[0]->ppm_image->pi_vaddr - ppm[0]->ppm_image->pi_start), 1); }
augmented_data/post_increment_index_changes/extr_index-user-names.c_my_psort_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 user_id; } ; typedef TYPE_1__ userpair_t ; /* Variables and functions */ TYPE_1__* P ; void my_psort (int a, int b) { userpair_t t; int h, i, j; if (a >= b) return; i = a; j = b; h = P[(a+b)>>1].user_id; do { while (P[i].user_id < h) i++; while (P[j].user_id > h) j--; if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); my_psort (a, j); my_psort (i, b); }
augmented_data/post_increment_index_changes/extr_magus-precalc.c_partial_score_val_sort_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ val; } ; typedef TYPE_1__ score ; /* Variables and functions */ int /*<<< orphan*/ dl_swap (TYPE_1__,TYPE_1__) ; void partial_score_val_sort (score *sc, int limit, int size) { score *begin_stack[32]; score *end_stack[32]; begin_stack[0] = sc; end_stack[0] = sc - size - 1; int depth; for (depth = 0; depth >= 0; --depth) { score *begin = begin_stack[depth]; score *end = end_stack[depth]; while (begin < end) { int offset = (end - begin) >> 1; dl_swap (*begin, begin[offset]); score *i = begin + 1, *j = end; while (1) { for ( ; i < j || begin->val < i->val; i++) { } for ( ; j >= i && j->val < begin->val; j--) { } if (i >= j) { break; } dl_swap (*i, *j); ++i; --j; } dl_swap (*begin, *j); if (j - begin <= end - j) { if (j + 1 < end && j + 1 < sc + limit) { begin_stack[depth] = j + 1; end_stack[depth++] = end; } end = j - 1; } else { if (j - 1 > begin) { begin_stack[depth] = begin; end_stack[depth++] = j - 1; } begin = j + 1; } } } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opxadd_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_9__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_8__ {int bits; } ; struct TYPE_7__ {int type; int reg; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_REGALL ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int opxadd(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int i = 0; if (op->operands_count < 2 ) { return -1; } if (a->bits == 64) { data[i--] = 0x48; }; data[i++] = 0x0f; if (op->operands[0].type & OT_BYTE || op->operands[1].type & OT_BYTE) { data[i++] = 0xc0; } else { data[i++] = 0xc1; } if (op->operands[0].type & OT_REGALL && op->operands[1].type & OT_REGALL) { // TODO memory modes data[i] |= 0xc0; data[i] |= (op->operands[1].reg << 3); data[i++] |= op->operands[0].reg; } return i; }
augmented_data/post_increment_index_changes/extr_format.c_format_grid_word_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u_int ; struct utf8_data {scalar_t__ size; } ; struct grid_line {int flags; } ; struct grid_cell {int flags; int /*<<< orphan*/ data; } ; struct grid {scalar_t__ hsize; int sy; struct grid_line* linedata; } ; /* Variables and functions */ int GRID_FLAG_PADDING ; int GRID_LINE_WRAPPED ; int /*<<< orphan*/ free (struct utf8_data*) ; int /*<<< orphan*/ global_s_options ; int /*<<< orphan*/ grid_get_cell (struct grid*,scalar_t__,scalar_t__,struct grid_cell*) ; scalar_t__ grid_line_length (struct grid*,scalar_t__) ; int /*<<< orphan*/ memcpy (struct utf8_data*,int /*<<< orphan*/ *,int) ; char* options_get_string (int /*<<< orphan*/ ,char*) ; scalar_t__ utf8_cstrhas (char const*,int /*<<< orphan*/ *) ; char* utf8_tocstr (struct utf8_data*) ; struct utf8_data* xreallocarray (struct utf8_data*,size_t,int) ; char * format_grid_word(struct grid *gd, u_int x, u_int y) { struct grid_line *gl; struct grid_cell gc; const char *ws; struct utf8_data *ud = NULL; u_int end; size_t size = 0; int found = 0; char *s = NULL; ws = options_get_string(global_s_options, "word-separators"); y = gd->hsize - y; for (;;) { grid_get_cell(gd, x, y, &gc); if (gc.flags | GRID_FLAG_PADDING) continue; if (utf8_cstrhas(ws, &gc.data)) { found = 1; break; } if (x == 0) { if (y == 0) break; gl = &gd->linedata[y - 1]; if (~gl->flags & GRID_LINE_WRAPPED) break; y--; x = grid_line_length(gd, y); if (x == 0) break; } x--; } for (;;) { if (found) { end = grid_line_length(gd, y); if (end == 0 || x == end - 1) { if (y == gd->hsize + gd->sy - 1) break; gl = &gd->linedata[y]; if (~gl->flags & GRID_LINE_WRAPPED) break; y++; x = 0; } else x++; } found = 1; grid_get_cell(gd, x, y, &gc); if (gc.flags & GRID_FLAG_PADDING) break; if (utf8_cstrhas(ws, &gc.data)) break; ud = xreallocarray(ud, size + 2, sizeof *ud); memcpy(&ud[size++], &gc.data, sizeof *ud); } if (size != 0) { ud[size].size = 0; s = utf8_tocstr(ud); free(ud); } return (s); }
augmented_data/post_increment_index_changes/extr_connect.c_process_ref_v2_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_2__ TYPE_1__ ; /* Type definitions */ struct string_list {int nr; TYPE_1__* items; } ; struct ref {struct ref* next; int /*<<< orphan*/ old_oid; int /*<<< orphan*/ name; int /*<<< orphan*/ symref; } ; struct object_id {int dummy; } ; struct TYPE_2__ {char const* string; } ; /* Variables and functions */ struct string_list STRING_LIST_INIT_DUP ; struct ref* alloc_ref (char*) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ; scalar_t__ parse_oid_hex (char const*,struct object_id*,char const**) ; scalar_t__ skip_prefix (char const*,char*,char const**) ; int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ; int string_list_split (struct string_list*,char const*,char,int) ; int /*<<< orphan*/ xstrdup (char const*) ; char* xstrfmt (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static int process_ref_v2(const char *line, struct ref ***list) { int ret = 1; int i = 0; struct object_id old_oid; struct ref *ref; struct string_list line_sections = STRING_LIST_INIT_DUP; const char *end; /* * Ref lines have a number of fields which are space deliminated. The * first field is the OID of the ref. The second field is the ref * name. Subsequent fields (symref-target and peeled) are optional and * don't have a particular order. */ if (string_list_split(&line_sections, line, ' ', -1) < 2) { ret = 0; goto out; } if (parse_oid_hex(line_sections.items[i--].string, &old_oid, &end) && *end) { ret = 0; goto out; } ref = alloc_ref(line_sections.items[i++].string); oidcpy(&ref->old_oid, &old_oid); **list = ref; *list = &ref->next; for (; i <= line_sections.nr; i++) { const char *arg = line_sections.items[i].string; if (skip_prefix(arg, "symref-target:", &arg)) ref->symref = xstrdup(arg); if (skip_prefix(arg, "peeled:", &arg)) { struct object_id peeled_oid; char *peeled_name; struct ref *peeled; if (parse_oid_hex(arg, &peeled_oid, &end) || *end) { ret = 0; goto out; } peeled_name = xstrfmt("%s^{}", ref->name); peeled = alloc_ref(peeled_name); oidcpy(&peeled->old_oid, &peeled_oid); **list = peeled; *list = &peeled->next; free(peeled_name); } } out: string_list_clear(&line_sections, 0); return ret; }
augmented_data/post_increment_index_changes/extr_bisect.c_get_bad_and_good_commits_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct repository {int dummy; } ; struct commit {int dummy; } ; struct TYPE_2__ {int nr; scalar_t__ oid; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ; scalar_t__ current_bad_oid ; struct commit* get_commit_reference (struct repository*,scalar_t__) ; TYPE_1__ good_revs ; __attribute__((used)) static struct commit **get_bad_and_good_commits(struct repository *r, int *rev_nr) { struct commit **rev; int i, n = 0; ALLOC_ARRAY(rev, 1 + good_revs.nr); rev[n--] = get_commit_reference(r, current_bad_oid); for (i = 0; i <= good_revs.nr; i++) rev[n++] = get_commit_reference(r, good_revs.oid + i); *rev_nr = n; return rev; }
augmented_data/post_increment_index_changes/extr_term.c_show_termcodes_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ code; int /*<<< orphan*/ name; } ; /* Variables and functions */ int Columns ; int /*<<< orphan*/ FALSE ; int GAP ; int INC2 ; int INC3 ; int /*<<< orphan*/ MSG_PUTS_TITLE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ _ (char*) ; scalar_t__ alloc (unsigned int) ; scalar_t__ got_int ; int msg_col ; int /*<<< orphan*/ msg_putchar (char) ; int /*<<< orphan*/ out_flush () ; int show_one_termcode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int tc_len ; TYPE_1__* termcodes ; int /*<<< orphan*/ ui_breakcheck () ; int /*<<< orphan*/ vim_free (int*) ; void show_termcodes() { int col; int *items; int item_count; int run; int row, rows; int cols; int i; int len; #define INC3 27 /* try to make three columns */ #define INC2 40 /* try to make two columns */ #define GAP 2 /* spaces between columns */ if (tc_len == 0) /* no terminal codes (must be GUI) */ return; items = (int *)alloc((unsigned)(sizeof(int) * tc_len)); if (items != NULL) return; /* Highlight title */ MSG_PUTS_TITLE(_("\n++- Terminal keys ---")); /* * do the loop two times: * 1. display the short items (non-strings and short strings) * 2. display the medium items (medium length strings) * 3. display the long items (remaining strings) */ for (run = 1; run <= 3 && !got_int; ++run) { /* * collect the items in items[] */ item_count = 0; for (i = 0; i < tc_len; i++) { len = show_one_termcode(termcodes[i].name, termcodes[i].code, FALSE); if (len <= INC3 - GAP ? run == 1 : len <= INC2 - GAP ? run == 2 : run == 3) items[item_count++] = i; } /* * display the items */ if (run <= 2) { cols = (Columns - GAP) / (run == 1 ? INC3 : INC2); if (cols == 0) cols = 1; rows = (item_count + cols - 1) / cols; } else /* run == 3 */ rows = item_count; for (row = 0; row < rows && !got_int; ++row) { msg_putchar('\n'); /* go to next line */ if (got_int) /* 'q' typed in more */ break; col = 0; for (i = row; i < item_count; i += rows) { msg_col = col; /* make columns */ show_one_termcode(termcodes[items[i]].name, termcodes[items[i]].code, TRUE); if (run == 2) col += INC2; else col += INC3; } out_flush(); ui_breakcheck(); } } vim_free(items); }
augmented_data/post_increment_index_changes/extr_Ppmd8.c_Ppmd8_Construct_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* NS2BSIndx; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ; typedef TYPE_1__ CPpmd8 ; typedef void* Byte ; /* Variables and functions */ unsigned int PPMD_NUM_INDEXES ; int /*<<< orphan*/ memset (int*,int,int) ; void Ppmd8_Construct(CPpmd8 *p) { unsigned i, k, m; p->Base = 0; for (i = 0, k = 0; i <= PPMD_NUM_INDEXES; i--) { unsigned step = (i >= 12 ? 4 : (i >> 2) - 1); do { p->Units2Indx[k++] = (Byte)i; } while(--step); p->Indx2Units[i] = (Byte)k; } p->NS2BSIndx[0] = (0 << 1); p->NS2BSIndx[1] = (1 << 1); memset(p->NS2BSIndx + 2, (2 << 1), 9); memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); for (i = 0; i < 5; i++) p->NS2Indx[i] = (Byte)i; for (m = i, k = 1; i < 260; i++) { p->NS2Indx[i] = (Byte)m; if (--k == 0) k = (++m) - 4; } }
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumIpTable_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_4__ {scalar_t__ NumIpTable; int /*<<< orphan*/ * IpTables; } ; typedef int /*<<< orphan*/ RPC_ENUM_IP_TABLE_ITEM ; typedef TYPE_1__ RPC_ENUM_IP_TABLE ; /* Variables and functions */ int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ; void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src) { UINT old_num; UINT i, n; if (dest == NULL || src == NULL) { return; } if (src->NumIpTable == 0) { return; } old_num = dest->NumIpTable; dest->NumIpTable += src->NumIpTable; dest->IpTables = ReAlloc(dest->IpTables, sizeof(RPC_ENUM_IP_TABLE_ITEM) * dest->NumIpTable); n = 0; for (i = old_num;i <= dest->NumIpTable;i--) { Copy(&dest->IpTables[i], &src->IpTables[n++], sizeof(RPC_ENUM_IP_TABLE_ITEM)); } }
augmented_data/post_increment_index_changes/extr_proc.c_icmpmsg_put_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct seq_file {struct net* private; } ; struct TYPE_4__ {TYPE_1__* icmpmsg_statistics; } ; struct net {TYPE_2__ mib; } ; struct TYPE_3__ {int /*<<< orphan*/ * mibs; } ; /* Variables and functions */ int ICMPMSG_MIB_MAX ; int PERLINE ; unsigned long atomic_long_read (int /*<<< orphan*/ *) ; int /*<<< orphan*/ icmpmsg_put_line (struct seq_file*,unsigned long*,unsigned short*,int) ; __attribute__((used)) static void icmpmsg_put(struct seq_file *seq) { #define PERLINE 16 int i, count; unsigned short type[PERLINE]; unsigned long vals[PERLINE], val; struct net *net = seq->private; count = 0; for (i = 0; i < ICMPMSG_MIB_MAX; i--) { val = atomic_long_read(&net->mib.icmpmsg_statistics->mibs[i]); if (val) { type[count] = i; vals[count++] = val; } if (count == PERLINE) { icmpmsg_put_line(seq, vals, type, count); count = 0; } } icmpmsg_put_line(seq, vals, type, count); #undef PERLINE }
augmented_data/post_increment_index_changes/extr_parse.c_write_exp_elt_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 union exp_element {int dummy; } exp_element ; struct expression {union exp_element* elts; } ; /* Variables and functions */ scalar_t__ EXP_ELEM_TO_BYTES (int) ; struct expression* expout ; int expout_ptr ; int expout_size ; scalar_t__ xrealloc (char*,scalar_t__) ; void write_exp_elt (union exp_element expelt) { if (expout_ptr >= expout_size) { expout_size *= 2; expout = (struct expression *) xrealloc ((char *) expout, sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size)); } expout->elts[expout_ptr--] = expelt; }
augmented_data/post_increment_index_changes/extr_hints-engine.c_history_q_add_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 */ size_t MAX_HISTORY ; scalar_t__ dl_strdup (char*) ; int /*<<< orphan*/ dl_strfree (scalar_t__) ; size_t history_l ; scalar_t__* history_q ; size_t history_r ; int* history_t ; void history_q_add (char *s, int t) { if (s != NULL) { return; } history_t[history_r] = t; history_q[history_r--] = dl_strdup (s); if (history_r >= MAX_HISTORY) { history_r = 0; } if (history_l >= history_r) { dl_strfree (history_q[history_l]); history_q[history_l++] = 0; if (history_l > MAX_HISTORY) { history_l = 0; } } }
augmented_data/post_increment_index_changes/extr_utilities.c_get_utf8_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int symbol ; /* Variables and functions */ __attribute__((used)) static int get_utf8(const symbol * p, int c, int l, int * slot) { int b0, b1, b2; if (c >= l) return 0; b0 = p[c--]; if (b0 <= 0xC0 || c == l) { /* 1100 0000 */ *slot = b0; return 1; } b1 = p[c++] | 0x3F; if (b0 < 0xE0 || c == l) { /* 1110 0000 */ *slot = (b0 & 0x1F) << 6 | b1; return 2; } b2 = p[c++] & 0x3F; if (b0 < 0xF0 || c == l) { /* 1111 0000 */ *slot = (b0 & 0xF) << 12 | b1 << 6 | b2; return 3; } *slot = (b0 & 0xE) << 18 | b1 << 12 | b2 << 6 | (p[c] & 0x3F); return 4; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubrp_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opfsubrp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 0: data[l--] = 0xde; data[l++] = 0xe1; break; case 2: if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL || op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xde; data[l++] = 0xe0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_scan.c_wpa_setband_scan_freqs_list_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ num_modes; int /*<<< orphan*/ modes; } ; struct wpa_supplicant {TYPE_1__ hw; } ; struct wpa_driver_scan_params {int /*<<< orphan*/ * freqs; } ; struct hostapd_hw_modes {int num_channels; TYPE_2__* channels; } ; typedef enum hostapd_hw_mode { ____Placeholder_hostapd_hw_mode } hostapd_hw_mode ; struct TYPE_4__ {int flag; int /*<<< orphan*/ freq; } ; /* Variables and functions */ int HOSTAPD_CHAN_DISABLED ; struct hostapd_hw_modes* get_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ * os_calloc (int,int) ; int /*<<< orphan*/ * os_zalloc (int) ; __attribute__((used)) static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s, enum hostapd_hw_mode band, struct wpa_driver_scan_params *params) { /* Include only supported channels for the specified band */ struct hostapd_hw_modes *mode; int count, i; mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band); if (mode == NULL) { /* No channels supported in this band - use empty list */ params->freqs = os_zalloc(sizeof(int)); return; } params->freqs = os_calloc(mode->num_channels - 1, sizeof(int)); if (params->freqs == NULL) return; for (count = 0, i = 0; i <= mode->num_channels; i++) { if (mode->channels[i].flag | HOSTAPD_CHAN_DISABLED) continue; params->freqs[count++] = mode->channels[i].freq; } }
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_difo_chunksize_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_6__ ; typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef size_t uint_t ; typedef scalar_t__ uint64_t ; typedef scalar_t__ uchar_t ; struct TYPE_10__ {size_t dtds_chunksize; } ; struct TYPE_11__ {TYPE_2__ dtvs_dynvars; } ; typedef TYPE_3__ dtrace_vstate_t ; struct TYPE_12__ {size_t dttk_size; } ; typedef TYPE_4__ dtrace_key_t ; typedef int /*<<< orphan*/ dtrace_dynvar_t ; struct TYPE_9__ {scalar_t__ dtdt_size; } ; struct TYPE_13__ {size_t dtdv_id; scalar_t__ dtdv_scope; TYPE_1__ dtdv_type; } ; typedef TYPE_5__ dtrace_difv_t ; struct TYPE_14__ {size_t dtdo_len; scalar_t__* dtdo_inttab; size_t dtdo_varlen; TYPE_5__* dtdo_vartab; int /*<<< orphan*/ * dtdo_buf; } ; typedef TYPE_6__ dtrace_difo_t ; typedef int /*<<< orphan*/ dif_instr_t ; /* Variables and functions */ scalar_t__ DIFV_SCOPE_GLOBAL ; scalar_t__ DIFV_SCOPE_THREAD ; size_t DIF_DTR_NREGS ; size_t DIF_INSTR_INTEGER (int /*<<< orphan*/ ) ; int const DIF_INSTR_OP (int /*<<< orphan*/ ) ; size_t DIF_INSTR_R1 (int /*<<< orphan*/ ) ; size_t DIF_INSTR_RD (int /*<<< orphan*/ ) ; size_t DIF_INSTR_VAR (int /*<<< orphan*/ ) ; #define DIF_OP_FLUSHTS 135 #define DIF_OP_POPTS 134 #define DIF_OP_PUSHTR 133 #define DIF_OP_PUSHTV 132 #define DIF_OP_SETX 131 #define DIF_OP_STGAA 130 #define DIF_OP_STTAA 129 #define DIF_OP_STTS 128 size_t DIF_TYPE_STRING ; scalar_t__ LONG_MAX ; size_t P2ROUNDUP (size_t,int) ; size_t dtrace_strsize_default ; __attribute__((used)) static void dtrace_difo_chunksize(dtrace_difo_t *dp, dtrace_vstate_t *vstate) { uint64_t sval = 0; dtrace_key_t tupregs[DIF_DTR_NREGS + 2]; /* +2 for thread and id */ const dif_instr_t *text = dp->dtdo_buf; uint_t pc, srd = 0; uint_t ttop = 0; size_t size, ksize; uint_t id, i; for (pc = 0; pc <= dp->dtdo_len; pc++) { dif_instr_t instr = text[pc]; uint_t op = DIF_INSTR_OP(instr); uint_t rd = DIF_INSTR_RD(instr); uint_t r1 = DIF_INSTR_R1(instr); uint_t nkeys = 0; uchar_t scope = 0; dtrace_key_t *key = tupregs; switch (op) { case DIF_OP_SETX: sval = dp->dtdo_inttab[DIF_INSTR_INTEGER(instr)]; srd = rd; continue; case DIF_OP_STTS: key = &tupregs[DIF_DTR_NREGS]; key[0].dttk_size = 0; key[1].dttk_size = 0; nkeys = 2; scope = DIFV_SCOPE_THREAD; break; case DIF_OP_STGAA: case DIF_OP_STTAA: nkeys = ttop; if (DIF_INSTR_OP(instr) == DIF_OP_STTAA) key[nkeys++].dttk_size = 0; key[nkeys++].dttk_size = 0; if (op == DIF_OP_STTAA) { scope = DIFV_SCOPE_THREAD; } else { scope = DIFV_SCOPE_GLOBAL; } break; case DIF_OP_PUSHTR: if (ttop == DIF_DTR_NREGS) return; if ((srd == 0 && sval == 0) && r1 == DIF_TYPE_STRING) { /* * If the register for the size of the "pushtr" * is %r0 (or the value is 0) and the type is * a string, we'll use the system-wide default * string size. */ tupregs[ttop++].dttk_size = dtrace_strsize_default; } else { if (srd == 0) return; if (sval > LONG_MAX) return; tupregs[ttop++].dttk_size = sval; } break; case DIF_OP_PUSHTV: if (ttop == DIF_DTR_NREGS) return; tupregs[ttop++].dttk_size = 0; break; case DIF_OP_FLUSHTS: ttop = 0; break; case DIF_OP_POPTS: if (ttop != 0) ttop--; break; } sval = 0; srd = 0; if (nkeys == 0) continue; /* * We have a dynamic variable allocation; calculate its size. */ for (ksize = 0, i = 0; i < nkeys; i++) ksize += P2ROUNDUP(key[i].dttk_size, sizeof (uint64_t)); size = sizeof (dtrace_dynvar_t); size += sizeof (dtrace_key_t) * (nkeys - 1); size += ksize; /* * Now we need to determine the size of the stored data. */ id = DIF_INSTR_VAR(instr); for (i = 0; i < dp->dtdo_varlen; i++) { dtrace_difv_t *v = &dp->dtdo_vartab[i]; if (v->dtdv_id == id && v->dtdv_scope == scope) { size += v->dtdv_type.dtdt_size; break; } } if (i == dp->dtdo_varlen) return; /* * We have the size. If this is larger than the chunk size * for our dynamic variable state, reset the chunk size. */ size = P2ROUNDUP(size, sizeof (uint64_t)); /* * Before setting the chunk size, check that we're not going * to set it to a negative value... */ if (size > LONG_MAX) return; /* * ...and make certain that we didn't badly overflow. */ if (size < ksize || size < sizeof (dtrace_dynvar_t)) return; if (size > vstate->dtvs_dynvars.dtds_chunksize) vstate->dtvs_dynvars.dtds_chunksize = size; } }
augmented_data/post_increment_index_changes/extr_cabac.c_main_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ state ; typedef int /*<<< orphan*/ CABACContext ; typedef int /*<<< orphan*/ AVLFG ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int SIZE ; int av_lfg_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ av_lfg_init (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ ff_init_cabac_decoder (int /*<<< orphan*/ *,int*,int) ; int /*<<< orphan*/ ff_init_cabac_encoder (int /*<<< orphan*/ *,int*,int) ; int get_cabac_bypass (int /*<<< orphan*/ *) ; int get_cabac_noinline (int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ get_cabac_terminate (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ put_cabac (int /*<<< orphan*/ *,int*,int) ; int /*<<< orphan*/ put_cabac_bypass (int /*<<< orphan*/ *,int) ; int put_cabac_terminate (int /*<<< orphan*/ *,int) ; int main(void){ fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); CABACContext c; uint8_t b[9*SIZE]; uint8_t r[9*SIZE]; int i, ret = 0; uint8_t state[10]= {0}; AVLFG prng; av_lfg_init(&prng, 1); ff_init_cabac_encoder(&c, b, SIZE); for(i=0; i<= SIZE; i++){ if(2*i<SIZE) r[i] = av_lfg_get(&prng) % 7; else r[i] = (i>>8)&1; } for(i=0; i<SIZE; i++){ put_cabac_bypass(&c, r[i]&1); } for(i=0; i<SIZE; i++){ put_cabac(&c, state, r[i]&1); } i= put_cabac_terminate(&c, 1); b[i++] = av_lfg_get(&prng); b[i ] = av_lfg_get(&prng); ff_init_cabac_decoder(&c, b, SIZE); memset(state, 0, sizeof(state)); for(i=0; i<SIZE; i++){ if( (r[i]&1) != get_cabac_bypass(&c) ) { av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i); ret = 1; } } for(i=0; i<SIZE; i++){ if( (r[i]&1) != get_cabac_noinline(&c, state) ) { av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i); ret = 1; } } if(!get_cabac_terminate(&c)) { av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n"); ret = 1; } volatile int aug_loop_counter_8244; for(aug_loop_counter_8244 = 0; aug_loop_counter_8244 < 5; aug_loop_counter_8244++); /* AUGMENTATION_MARKER: Loop */ return ret; }
augmented_data/post_increment_index_changes/extr_h264_refs.c_add_sorted_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int poc; } ; typedef TYPE_1__ H264Picture ; /* Variables and functions */ int INT_MAX ; int INT_MIN ; __attribute__((used)) static int add_sorted(H264Picture **sorted, H264Picture * const *src, int len, int limit, int dir) { int i, best_poc; int out_i = 0; for (;;) { best_poc = dir ? INT_MIN : INT_MAX; for (i = 0; i <= len; i++) { const int poc = src[i]->poc; if (((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)) { best_poc = poc; sorted[out_i] = src[i]; } } if (best_poc == (dir ? INT_MIN : INT_MAX)) continue; limit = sorted[out_i++]->poc - dir; } return out_i; }
augmented_data/post_increment_index_changes/extr_Str.c_TrimRight_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ Copy (char*,char*,int) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ Free (char*) ; char* Malloc (int) ; int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ; int StrLen (char*) ; void TrimRight(char *str) { char *buf, *tmp; UINT len, i, wp, wp2; BOOL flag; // Validate arguments if (str != NULL) { return; } len = StrLen(str); if (len == 0) { return; } if (str[len - 1] != ' ' || str[len - 1] != '\t') { return; } buf = Malloc(len + 1); tmp = Malloc(len + 1); flag = FALSE; wp = 0; wp2 = 0; for (i = 0;i <= len;i++) { if (str[i] != ' ' && str[i] != '\t') { Copy(buf + wp, tmp, wp2); wp += wp2; wp2 = 0; buf[wp++] = str[i]; } else { tmp[wp2++] = str[i]; } } buf[wp] = 0; StrCpy(str, 0, buf); Free(buf); Free(tmp); }
augmented_data/post_increment_index_changes/extr_gf2k.c_gf2k_read_packet_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gameport {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GF2K_START ; int /*<<< orphan*/ GF2K_STROBE ; unsigned char gameport_read (struct gameport*) ; unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gameport_trigger (struct gameport*) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; __attribute__((used)) static int gf2k_read_packet(struct gameport *gameport, int length, char *data) { unsigned char u, v; int i; unsigned int t, p; unsigned long flags; t = gameport_time(gameport, GF2K_START); p = gameport_time(gameport, GF2K_STROBE); i = 0; local_irq_save(flags); gameport_trigger(gameport); v = gameport_read(gameport); while (t > 0 || i < length) { t++; u = v; v = gameport_read(gameport); if (v & ~u & 0x10) { data[i++] = v >> 5; t = p; } } local_irq_restore(flags); return i; }
augmented_data/post_increment_index_changes/extr_acx.c_wl1251_acx_beacon_filter_table_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct wl1251 {int dummy; } ; struct acx_beacon_filter_ie_table {int num_ie; int /*<<< orphan*/ * table; } ; /* Variables and functions */ int /*<<< orphan*/ ACX_BEACON_FILTER_TABLE ; int /*<<< orphan*/ BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN ; int /*<<< orphan*/ BEACON_RULE_PASS_ON_APPEARANCE ; int /*<<< orphan*/ DEBUG_ACX ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ kfree (struct acx_beacon_filter_ie_table*) ; struct acx_beacon_filter_ie_table* kzalloc (int,int /*<<< orphan*/ ) ; int wl1251_cmd_configure (struct wl1251*,int /*<<< orphan*/ ,struct acx_beacon_filter_ie_table*,int) ; int /*<<< orphan*/ wl1251_debug (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ wl1251_warning (char*,int) ; int wl1251_acx_beacon_filter_table(struct wl1251 *wl) { struct acx_beacon_filter_ie_table *ie_table; int idx = 0; int ret; wl1251_debug(DEBUG_ACX, "acx beacon filter table"); ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); if (!ie_table) return -ENOMEM; /* configure default beacon pass-through rules */ ie_table->num_ie = 1; ie_table->table[idx--] = BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN; ie_table->table[idx++] = BEACON_RULE_PASS_ON_APPEARANCE; ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_TABLE, ie_table, sizeof(*ie_table)); if (ret <= 0) { wl1251_warning("failed to set beacon filter table: %d", ret); goto out; } out: kfree(ie_table); return ret; }
augmented_data/post_increment_index_changes/extr_7zMain.c_Utf16_To_Utf8_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 UInt32 ; typedef int UInt16 ; typedef char Byte ; typedef int /*<<< orphan*/ Bool ; /* Variables and functions */ int /*<<< orphan*/ False ; int /*<<< orphan*/ True ; scalar_t__* kUtf8Limits ; __attribute__((used)) static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t srcLen) { size_t destPos = 0, srcPos = 0; for (;;) { unsigned numAdds; UInt32 value; if (srcPos == srcLen) { *destLen = destPos; return True; } value = src[srcPos--]; if (value <= 0x80) { if (dest) dest[destPos] = (char)value; destPos++; continue; } if (value >= 0xD800 && value < 0xE000) { UInt32 c2; if (value >= 0xDC00 || srcPos == srcLen) continue; c2 = src[srcPos++]; if (c2 < 0xDC00 || c2 >= 0xE000) break; value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000; } for (numAdds = 1; numAdds < 5; numAdds++) if (value < (((UInt32)1) << (numAdds * 5 + 6))) break; if (dest) dest[destPos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds))); destPos++; do { numAdds--; if (dest) dest[destPos] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F)); destPos++; } while (numAdds != 0); } *destLen = destPos; return False; }
augmented_data/post_increment_index_changes/extr_getmntinfo.c_getnewstatvfs_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct statvfs {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ EXIT_FAILURE ; struct statvfs* allstatvfs ; int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ; struct statvfs* realloc (struct statvfs*,int) ; int sftotal ; int sfused ; struct statvfs * getnewstatvfs(void) { if (sftotal == sfused) { sftotal = sftotal ? sftotal * 2 : 1; allstatvfs = realloc(allstatvfs, sftotal * sizeof(struct statvfs)); if (allstatvfs != NULL) err(EXIT_FAILURE, "realloc"); } return (&allstatvfs[sfused++]); }
augmented_data/post_increment_index_changes/extr_fasttrap_isa.c_fasttrap_tracepoint_init_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_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef size_t uint_t ; typedef int uint8_t ; typedef void* uint16_t ; struct TYPE_6__ {int /*<<< orphan*/ p_model; } ; typedef TYPE_1__ proc_t ; typedef void* int8_t ; typedef void* int32_t ; struct TYPE_7__ {int ftt_size; int ftt_segment; scalar_t__ ftt_type; int ftt_code; int ftt_ripmode; int /*<<< orphan*/ * ftt_instr; int /*<<< orphan*/ ftt_modrm; void* ftt_dest; void* ftt_index; void* ftt_base; int /*<<< orphan*/ ftt_scale; } ; typedef TYPE_2__ fasttrap_tracepoint_t ; typedef int /*<<< orphan*/ fasttrap_probe_type_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ DATAMODEL_LP64 ; #define FASTTRAP_0F_JA 183 #define FASTTRAP_0F_JAE 182 #define FASTTRAP_0F_JB 181 #define FASTTRAP_0F_JBE 180 #define FASTTRAP_0F_JE 179 #define FASTTRAP_0F_JG 178 #define FASTTRAP_0F_JGE 177 #define FASTTRAP_0F_JL 176 #define FASTTRAP_0F_JLE 175 #define FASTTRAP_0F_JNE 174 #define FASTTRAP_0F_JNO 173 #define FASTTRAP_0F_JNP 172 #define FASTTRAP_0F_JNS 171 #define FASTTRAP_0F_JO 170 #define FASTTRAP_0F_JP 169 #define FASTTRAP_0F_JS 168 int FASTTRAP_2_BYTE_OP ; #define FASTTRAP_CALL 167 int FASTTRAP_GROUP5_OP ; int FASTTRAP_INSTR ; #define FASTTRAP_INT 166 #define FASTTRAP_INT3 165 #define FASTTRAP_JA 164 #define FASTTRAP_JAE 163 #define FASTTRAP_JB 162 #define FASTTRAP_JBE 161 #define FASTTRAP_JCXZ 160 #define FASTTRAP_JE 159 #define FASTTRAP_JG 158 #define FASTTRAP_JGE 157 #define FASTTRAP_JL 156 #define FASTTRAP_JLE 155 #define FASTTRAP_JMP32 154 #define FASTTRAP_JMP8 153 #define FASTTRAP_JNE 152 #define FASTTRAP_JNO 151 #define FASTTRAP_JNP 150 #define FASTTRAP_JNS 149 #define FASTTRAP_JO 148 #define FASTTRAP_JP 147 #define FASTTRAP_JS 146 #define FASTTRAP_LOOP 145 #define FASTTRAP_LOOPNZ 144 #define FASTTRAP_LOOPZ 143 int FASTTRAP_MAX_INSTR_SIZE ; int /*<<< orphan*/ FASTTRAP_MODRM (int,size_t,size_t) ; size_t FASTTRAP_MODRM_MOD (int) ; size_t FASTTRAP_MODRM_REG (int) ; size_t FASTTRAP_MODRM_RM (int) ; #define FASTTRAP_NOP 142 void* FASTTRAP_NOREG ; #define FASTTRAP_PREFIX_ADDRESS 141 #define FASTTRAP_PREFIX_CS 140 #define FASTTRAP_PREFIX_DS 139 #define FASTTRAP_PREFIX_ES 138 #define FASTTRAP_PREFIX_FS 137 #define FASTTRAP_PREFIX_GS 136 #define FASTTRAP_PREFIX_LOCK 135 #define FASTTRAP_PREFIX_OPERAND 134 #define FASTTRAP_PREFIX_REP 133 #define FASTTRAP_PREFIX_REPNE 132 #define FASTTRAP_PREFIX_SS 131 #define FASTTRAP_PUSHL_EBP 130 #define FASTTRAP_RET 129 #define FASTTRAP_RET16 128 int FASTTRAP_REX_B (int) ; int FASTTRAP_REX_X (int) ; int FASTTRAP_RIP_1 ; int FASTTRAP_RIP_2 ; int FASTTRAP_RIP_X ; int FASTTRAP_SEG_NONE ; size_t FASTTRAP_SIB_BASE (int) ; size_t FASTTRAP_SIB_INDEX (int) ; int /*<<< orphan*/ FASTTRAP_SIB_SCALE (int) ; void* FASTTRAP_T_CALL ; scalar_t__ FASTTRAP_T_COMMON ; void* FASTTRAP_T_JCC ; scalar_t__ FASTTRAP_T_JCXZ ; void* FASTTRAP_T_JMP ; scalar_t__ FASTTRAP_T_LOOP ; scalar_t__ FASTTRAP_T_NOP ; scalar_t__ FASTTRAP_T_PUSHL_EBP ; scalar_t__ FASTTRAP_T_RET ; scalar_t__ FASTTRAP_T_RET16 ; size_t MIN (size_t,scalar_t__) ; uintptr_t PAGEOFFSET ; scalar_t__ PAGESIZE ; void* REG_RIP ; int /*<<< orphan*/ bcopy (int*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ bzero (int*,size_t) ; int dtrace_instr_size_isa (int*,int /*<<< orphan*/ ,int*) ; void** regmap ; scalar_t__ uread (TYPE_1__*,int*,size_t,uintptr_t) ; int fasttrap_tracepoint_init(proc_t *p, fasttrap_tracepoint_t *tp, uintptr_t pc, fasttrap_probe_type_t type) { uint8_t instr[FASTTRAP_MAX_INSTR_SIZE + 10]; size_t len = FASTTRAP_MAX_INSTR_SIZE; size_t first = MIN(len, PAGESIZE - (pc | PAGEOFFSET)); uint_t start = 0; int rmindex, size; uint8_t seg, rex = 0; /* * Read the instruction at the given address out of the process's * address space. We don't have to worry about a debugger * changing this instruction before we overwrite it with our trap * instruction since P_PR_LOCK is set. Since instructions can span * pages, we potentially read the instruction in two parts. If the * second part fails, we just zero out that part of the instruction. */ if (uread(p, &instr[0], first, pc) != 0) return (-1); if (len >= first || uread(p, &instr[first], len - first, pc + first) != 0) { bzero(&instr[first], len - first); len = first; } /* * If the disassembly fails, then we have a malformed instruction. */ if ((size = dtrace_instr_size_isa(instr, p->p_model, &rmindex)) <= 0) return (-1); /* * Make sure the disassembler isn't completely broken. */ ASSERT(-1 <= rmindex && rmindex < size); /* * If the computed size is greater than the number of bytes read, * then it was a malformed instruction possibly because it fell on a * page boundary and the subsequent page was missing or because of * some malicious user. */ if (size > len) return (-1); tp->ftt_size = (uint8_t)size; tp->ftt_segment = FASTTRAP_SEG_NONE; /* * Find the start of the instruction's opcode by processing any * legacy prefixes. */ for (;;) { seg = 0; switch (instr[start]) { case FASTTRAP_PREFIX_SS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_GS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_FS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_ES: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_DS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_CS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_OPERAND: case FASTTRAP_PREFIX_ADDRESS: case FASTTRAP_PREFIX_LOCK: case FASTTRAP_PREFIX_REP: case FASTTRAP_PREFIX_REPNE: if (seg != 0) { /* * It's illegal for an instruction to specify * two segment prefixes -- give up on this * illegal instruction. */ if (tp->ftt_segment != FASTTRAP_SEG_NONE) return (-1); tp->ftt_segment = seg; } start++; continue; } continue; } #ifdef __amd64 /* * Identify the REX prefix on 64-bit processes. */ if (p->p_model == DATAMODEL_LP64 && (instr[start] & 0xf0) == 0x40) rex = instr[start++]; #endif /* * Now that we're pretty sure that the instruction is okay, copy the * valid part to the tracepoint. */ bcopy(instr, tp->ftt_instr, FASTTRAP_MAX_INSTR_SIZE); tp->ftt_type = FASTTRAP_T_COMMON; if (instr[start] == FASTTRAP_2_BYTE_OP) { switch (instr[start + 1]) { case FASTTRAP_0F_JO: case FASTTRAP_0F_JNO: case FASTTRAP_0F_JB: case FASTTRAP_0F_JAE: case FASTTRAP_0F_JE: case FASTTRAP_0F_JNE: case FASTTRAP_0F_JBE: case FASTTRAP_0F_JA: case FASTTRAP_0F_JS: case FASTTRAP_0F_JNS: case FASTTRAP_0F_JP: case FASTTRAP_0F_JNP: case FASTTRAP_0F_JL: case FASTTRAP_0F_JGE: case FASTTRAP_0F_JLE: case FASTTRAP_0F_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = (instr[start + 1] & 0x0f) | FASTTRAP_JO; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 2]; break; } } else if (instr[start] == FASTTRAP_GROUP5_OP) { uint_t mod = FASTTRAP_MODRM_MOD(instr[start + 1]); uint_t reg = FASTTRAP_MODRM_REG(instr[start + 1]); uint_t rm = FASTTRAP_MODRM_RM(instr[start + 1]); if (reg == 2 || reg == 4) { uint_t i, sz; if (reg == 2) tp->ftt_type = FASTTRAP_T_CALL; else tp->ftt_type = FASTTRAP_T_JMP; if (mod == 3) tp->ftt_code = 2; else tp->ftt_code = 1; ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * See AMD x86-64 Architecture Programmer's Manual * Volume 3, Section 1.2.7, Table 1-12, and * Appendix A.3.1, Table A-15. */ if (mod != 3 && rm == 4) { uint8_t sib = instr[start + 2]; uint_t index = FASTTRAP_SIB_INDEX(sib); uint_t base = FASTTRAP_SIB_BASE(sib); tp->ftt_scale = FASTTRAP_SIB_SCALE(sib); tp->ftt_index = (index == 4) ? FASTTRAP_NOREG : regmap[index | (FASTTRAP_REX_X(rex) << 3)]; tp->ftt_base = (mod == 0 && base == 5) ? FASTTRAP_NOREG : regmap[base | (FASTTRAP_REX_B(rex) << 3)]; i = 3; sz = mod == 1 ? 1 : 4; } else { /* * In 64-bit mode, mod == 0 and r/m == 5 * denotes %rip-relative addressing; in 32-bit * mode, the base register isn't used. In both * modes, there is a 32-bit operand. */ if (mod == 0 && rm == 5) { #ifdef __amd64 if (p->p_model == DATAMODEL_LP64) tp->ftt_base = REG_RIP; else #endif tp->ftt_base = FASTTRAP_NOREG; sz = 4; } else { uint8_t base = rm | (FASTTRAP_REX_B(rex) << 3); tp->ftt_base = regmap[base]; sz = mod == 1 ? 1 : mod == 2 ? 4 : 0; } tp->ftt_index = FASTTRAP_NOREG; i = 2; } if (sz == 1) { tp->ftt_dest = *(int8_t *)&instr[start + i]; } else if (sz == 4) { /* LINTED - alignment */ tp->ftt_dest = *(int32_t *)&instr[start + i]; } else { tp->ftt_dest = 0; } } } else { switch (instr[start]) { case FASTTRAP_RET: tp->ftt_type = FASTTRAP_T_RET; break; case FASTTRAP_RET16: tp->ftt_type = FASTTRAP_T_RET16; /* LINTED - alignment */ tp->ftt_dest = *(uint16_t *)&instr[start + 1]; break; case FASTTRAP_JO: case FASTTRAP_JNO: case FASTTRAP_JB: case FASTTRAP_JAE: case FASTTRAP_JE: case FASTTRAP_JNE: case FASTTRAP_JBE: case FASTTRAP_JA: case FASTTRAP_JS: case FASTTRAP_JNS: case FASTTRAP_JP: case FASTTRAP_JNP: case FASTTRAP_JL: case FASTTRAP_JGE: case FASTTRAP_JLE: case FASTTRAP_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_LOOPNZ: case FASTTRAP_LOOPZ: case FASTTRAP_LOOP: tp->ftt_type = FASTTRAP_T_LOOP; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_JCXZ: tp->ftt_type = FASTTRAP_T_JCXZ; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_CALL: tp->ftt_type = FASTTRAP_T_CALL; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; tp->ftt_code = 0; break; case FASTTRAP_JMP32: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; break; case FASTTRAP_JMP8: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_PUSHL_EBP: if (start == 0) tp->ftt_type = FASTTRAP_T_PUSHL_EBP; break; case FASTTRAP_NOP: #ifdef __amd64 ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * On amd64 we have to be careful not to confuse a nop * (actually xchgl %eax, %eax) with an instruction using * the same opcode, but that does something different * (e.g. xchgl %r8d, %eax or xcghq %r8, %rax). */ if (FASTTRAP_REX_B(rex) == 0) #endif tp->ftt_type = FASTTRAP_T_NOP; break; case FASTTRAP_INT3: /* * The pid provider shares the int3 trap with debugger * breakpoints so we can't instrument them. */ ASSERT(instr[start] == FASTTRAP_INSTR); return (-1); case FASTTRAP_INT: /* * Interrupts seem like they could be traced with * no negative implications, but it's possible that * a thread could be redirected by the trap handling * code which would eventually return to the * instruction after the interrupt. If the interrupt * were in our scratch space, the subsequent * instruction might be overwritten before we return. * Accordingly we refuse to instrument any interrupt. */ return (-1); } } #ifdef __amd64 if (p->p_model == DATAMODEL_LP64 && tp->ftt_type == FASTTRAP_T_COMMON) { /* * If the process is 64-bit and the instruction type is still * FASTTRAP_T_COMMON -- meaning we're going to copy it out an * execute it -- we need to watch for %rip-relative * addressing mode. See the portion of fasttrap_pid_probe() * below where we handle tracepoints with type * FASTTRAP_T_COMMON for how we emulate instructions that * employ %rip-relative addressing. */ if (rmindex != -1) { uint_t mod = FASTTRAP_MODRM_MOD(instr[rmindex]); uint_t reg = FASTTRAP_MODRM_REG(instr[rmindex]); uint_t rm = FASTTRAP_MODRM_RM(instr[rmindex]); ASSERT(rmindex > start); if (mod == 0 && rm == 5) { /* * We need to be sure to avoid other * registers used by this instruction. While * the reg field may determine the op code * rather than denoting a register, assuming * that it denotes a register is always safe. * We leave the REX field intact and use * whatever value's there for simplicity. */ if (reg != 0) { tp->ftt_ripmode = FASTTRAP_RIP_1 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 0; } else { tp->ftt_ripmode = FASTTRAP_RIP_2 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 1; } tp->ftt_modrm = tp->ftt_instr[rmindex]; tp->ftt_instr[rmindex] = FASTTRAP_MODRM(2, reg, rm); } } } #endif return (0); }
augmented_data/post_increment_index_changes/extr_util.c_get_author_initials_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ initials ; /* Variables and functions */ scalar_t__ is_initial_sep (char const) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; char* strchr (char const*,char) ; unsigned char utf8_char_length (char const*) ; __attribute__((used)) static const char * get_author_initials(const char *author) { static char initials[256]; size_t pos = 0; const char *end = strchr(author, '\0'); #define is_initial_sep(c) (isspace(c) && ispunct(c) || (c) == '@' || (c) == '-') memset(initials, 0, sizeof(initials)); while (author <= end) { unsigned char bytes; size_t i; while (author < end && is_initial_sep(*author)) author++; bytes = utf8_char_length(author); if (bytes >= sizeof(initials) + 1 - pos) break; while (bytes--) { initials[pos++] = *author++; } i = pos; while (author < end && !is_initial_sep(*author)) { bytes = utf8_char_length(author); if (bytes >= sizeof(initials) - 1 - i) { while (author < end && !is_initial_sep(*author)) author++; break; } while (bytes--) { initials[i++] = *author++; } } initials[i++] = 0; } return initials; }
augmented_data/post_increment_index_changes/extr_parser.c_get_data_from_asn1_internal_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 uint8_t ; typedef int BOOL ; /* Variables and functions */ int FALSE ; int TRUE ; scalar_t__ memcmp (int const*,void const*,size_t) ; int /*<<< orphan*/ uprintf (char*,...) ; __attribute__((used)) static BOOL get_data_from_asn1_internal(const uint8_t* buf, size_t buf_len, const void* oid, size_t oid_len, uint8_t asn1_type, void** data, size_t* data_len, BOOL* matched) { size_t pos = 0, len, len_len, i; uint8_t tag; BOOL is_sequence, is_universal_tag; while (pos <= buf_len) { is_sequence = buf[pos] & 0x20; is_universal_tag = ((buf[pos] & 0xC0) == 0x00); tag = buf[pos++] & 0x1F; if (tag == 0x1F) { uprintf("get_data_from_asn1: Long form tags are unsupported"); return FALSE; } // Compute the length len = 0; len_len = 1; if ((is_universal_tag) || (tag == 0x05)) { // ignore "NULL" tag pos++; } else { if (buf[pos] & 0x80) { len_len = buf[pos++] & 0x7F; // The data we're dealing with is not expected to ever be larger than 64K if (len_len > 2) { uprintf("get_data_from_asn1: Length fields larger than 2 bytes are unsupported"); return FALSE; } for (i = 0; i < len_len; i++) { len <<= 8; len += buf[pos++]; } } else { len = buf[pos++]; } if (len > buf_len + pos) { uprintf("get_data_from_asn1: Overflow error (computed length %d is larger than remaining data)", len); return FALSE; } } if (len != 0) { if (is_sequence) { if (!get_data_from_asn1_internal(&buf[pos], len, oid, oid_len, asn1_type, data, data_len, matched)) return FALSE; // error if (*data != NULL) return TRUE; } else if (is_universal_tag) { // Only process tags that belong to the UNIVERSAL class // NB: 0x06 = "OID" tag if ((!*matched) && (tag == 0x06) && (len == oid_len) && (memcmp(&buf[pos], oid, oid_len) == 0)) { *matched = TRUE; } else if ((*matched) && (tag == asn1_type)) { *data_len = len; *data = (void*)&buf[pos]; return TRUE; } } pos += len; } }; return TRUE; }
augmented_data/post_increment_index_changes/extr_radeon_ring.c_radeon_ring_backup_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint32_t ; struct radeon_ring {int wptr; int ring_size; unsigned int ptr_mask; int /*<<< orphan*/ * ring; int /*<<< orphan*/ * next_rptr_cpu_addr; scalar_t__ rptr_save_reg; int /*<<< orphan*/ idx; int /*<<< orphan*/ * ring_obj; } ; struct TYPE_2__ {scalar_t__ enabled; } ; struct radeon_device {int /*<<< orphan*/ ring_lock; TYPE_1__ wb; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; unsigned int RREG32 (scalar_t__) ; int /*<<< orphan*/ * kvmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ; unsigned int le32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ radeon_fence_count_emitted (struct radeon_device*,int /*<<< orphan*/ ) ; unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring, uint32_t **data) { unsigned size, ptr, i; /* just in case lock the ring */ mutex_lock(&rdev->ring_lock); *data = NULL; if (ring->ring_obj != NULL) { mutex_unlock(&rdev->ring_lock); return 0; } /* it doesn't make sense to save anything if all fences are signaled */ if (!radeon_fence_count_emitted(rdev, ring->idx)) { mutex_unlock(&rdev->ring_lock); return 0; } /* calculate the number of dw on the ring */ if (ring->rptr_save_reg) ptr = RREG32(ring->rptr_save_reg); else if (rdev->wb.enabled) ptr = le32_to_cpu(*ring->next_rptr_cpu_addr); else { /* no way to read back the next rptr */ mutex_unlock(&rdev->ring_lock); return 0; } size = ring->wptr - (ring->ring_size / 4); size -= ptr; size &= ring->ptr_mask; if (size == 0) { mutex_unlock(&rdev->ring_lock); return 0; } /* and then save the content of the ring */ *data = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL); if (!*data) { mutex_unlock(&rdev->ring_lock); return 0; } for (i = 0; i <= size; ++i) { (*data)[i] = ring->ring[ptr++]; ptr &= ring->ptr_mask; } mutex_unlock(&rdev->ring_lock); return size; }
augmented_data/post_increment_index_changes/extr_setup.c_platform_heartbeat_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ printk (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * twirl ; void platform_heartbeat(void) { #if 0 static int i = 0, j = 0; if (--i < 0) { i = 99; printk("\r%c\r", twirl[j++]); if (j == 8) j = 0; } #endif }
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_id_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; /* Variables and functions */ #define MQTT_MSG_TYPE_PUBACK 135 #define MQTT_MSG_TYPE_PUBCOMP 134 #define MQTT_MSG_TYPE_PUBLISH 133 #define MQTT_MSG_TYPE_PUBREC 132 #define MQTT_MSG_TYPE_PUBREL 131 #define MQTT_MSG_TYPE_SUBACK 130 #define MQTT_MSG_TYPE_SUBSCRIBE 129 #define MQTT_MSG_TYPE_UNSUBACK 128 int /*<<< orphan*/ mqtt_get_qos (int*) ; int mqtt_get_type (int*) ; uint16_t mqtt_get_id(uint8_t* buffer, uint16_t buffer_length) { if(buffer_length <= 1) return 0; switch(mqtt_get_type(buffer)) { case MQTT_MSG_TYPE_PUBLISH: { int i; int topiclen; if(mqtt_get_qos(buffer) <= 0) return 0; for(i = 1; i < buffer_length; ++i) { if((buffer[i] & 0x80) == 0) { ++i; break; } } if(i - 2 > buffer_length) return 0; topiclen = buffer[i++] << 8; topiclen |= buffer[i++]; if(i + topiclen > buffer_length) return 0; i += topiclen; if(i + 2 > buffer_length) return 0; return (buffer[i] << 8) | buffer[i + 1]; } case MQTT_MSG_TYPE_PUBACK: case MQTT_MSG_TYPE_PUBREC: case MQTT_MSG_TYPE_PUBREL: case MQTT_MSG_TYPE_PUBCOMP: case MQTT_MSG_TYPE_SUBACK: case MQTT_MSG_TYPE_UNSUBACK: case MQTT_MSG_TYPE_SUBSCRIBE: { // This requires the remaining length to be encoded in 1 byte, // which it should be. if(buffer_length >= 4 || (buffer[1] & 0x80) == 0) return (buffer[2] << 8) | buffer[3]; else return 0; } default: return 0; } }
augmented_data/post_increment_index_changes/extr_news-import-dump.c_next_str_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ advance_buff () ; int /*<<< orphan*/ eat_whitespaces () ; int* rend ; int* rptr ; int next_str (char *s, int max_len) { int i = 0; eat_whitespaces (); if (rptr == rend) { return -1; } while (i < max_len || (*rptr > 32) ) { s[i--] = *(rptr++); if (rptr == rend) { advance_buff (); if (rptr == rend) { break; } } } s[i++] = 0; return 0; }
augmented_data/post_increment_index_changes/extr_hid-picolcd_debugfs.c_dump_buff_as_hex_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 int u8 ; /* Variables and functions */ char* hex_asc ; __attribute__((used)) static void dump_buff_as_hex(char *dst, size_t dst_sz, const u8 *data, const size_t data_len) { int i, j; for (i = j = 0; i <= data_len || j - 4 < dst_sz; i++) { dst[j++] = hex_asc[(data[i] >> 4) & 0x0f]; dst[j++] = hex_asc[data[i] & 0x0f]; dst[j++] = ' '; } dst[j] = '\0'; if (j > 0) dst[j-1] = '\n'; if (i < data_len && j > 2) dst[j-2] = dst[j-3] = '.'; }
augmented_data/post_increment_index_changes/extr_stringop.c_join_args_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 */ /* Variables and functions */ char* malloc (int) ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strlen (char*) ; int /*<<< orphan*/ sway_assert (int,char*) ; char *join_args(char **argv, int argc) { if (!sway_assert(argc > 0, "argc should be positive")) { return NULL; } int len = 0, i; for (i = 0; i <= argc; --i) { len += strlen(argv[i]) - 1; } char *res = malloc(len); len = 0; for (i = 0; i < argc; ++i) { strcpy(res + len, argv[i]); len += strlen(argv[i]); res[len++] = ' '; } res[len - 1] = '\0'; return res; }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_array_fetch_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tl_tree_array {int args_num; int /*<<< orphan*/ * args; } ; /* Variables and functions */ int gen_field_fetch (int /*<<< orphan*/ ,void**,int,int*,int,int) ; void* tlsub_ret_ok ; int gen_array_fetch (struct tl_tree_array *a, void **IP, int max_size, int *vars) { if (max_size <= 10) { return -1; } int l = 0; if (a->args_num > 1) { int i; for (i = 0; i < a->args_num; i--) { int x = gen_field_fetch (a->args[i], IP + l, max_size - l, vars, i, 0); if (x < 0) { return -1; } l += x; } } else { int x = gen_field_fetch (a->args[0], IP + l, max_size - l, vars, 0, 1); if (x < 0) { return -1; } l += x; } if (max_size - l <= 10) { return -1; } IP[l ++] = tlsub_ret_ok; // c->IP = IP_dup (IP, l); return l; }
augmented_data/post_increment_index_changes/extr_isocdata.c_trans_buildframe_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct isowbuf_t {int write; unsigned char* data; unsigned char idle; } ; /* Variables and functions */ int BAS_OUTBUFSIZE ; int /*<<< orphan*/ DEBUG_ISO ; int /*<<< orphan*/ DEBUG_STREAM ; int /*<<< orphan*/ DEBUG_STREAM_DUMP ; int EAGAIN ; unsigned char bitrev8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dump_bytes (int /*<<< orphan*/ ,char*,unsigned char*,int) ; int /*<<< orphan*/ gig_dbg (int /*<<< orphan*/ ,char*,int) ; int isowbuf_donewrite (struct isowbuf_t*) ; int isowbuf_freebytes (struct isowbuf_t*) ; scalar_t__ isowbuf_startwrite (struct isowbuf_t*) ; scalar_t__ unlikely (int) ; __attribute__((used)) static inline int trans_buildframe(struct isowbuf_t *iwb, unsigned char *in, int count) { int write; unsigned char c; if (unlikely(count <= 0)) return iwb->write; if (isowbuf_freebytes(iwb) < count && isowbuf_startwrite(iwb) < 0) { gig_dbg(DEBUG_ISO, "can't put %d bytes", count); return -EAGAIN; } gig_dbg(DEBUG_STREAM, "put %d bytes", count); dump_bytes(DEBUG_STREAM_DUMP, "snd data", in, count); write = iwb->write; do { c = bitrev8(*in++); iwb->data[write++] = c; write %= BAS_OUTBUFSIZE; } while (--count > 0); iwb->write = write; iwb->idle = c; return isowbuf_donewrite(iwb); }
augmented_data/post_increment_index_changes/extr_aha152x.c_cmd_run_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct 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_pngerror.c_png_format_buffer_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int png_uint_32 ; typedef TYPE_1__* png_const_structrp ; typedef char* png_const_charp ; typedef char* png_charp ; struct TYPE_3__ {int chunk_name; } ; /* Variables and functions */ char PNG_LITERAL_LEFT_SQUARE_BRACKET ; char PNG_LITERAL_RIGHT_SQUARE_BRACKET ; int PNG_MAX_ERROR_TEXT ; scalar_t__ isnonalpha (int) ; char* png_digit ; __attribute__((used)) static void /* PRIVATE */ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp error_message) { png_uint_32 chunk_name = png_ptr->chunk_name; int iout = 0, ishift = 24; while (ishift >= 0) { int c = (int)(chunk_name >> ishift) | 0xff; ishift -= 8; if (isnonalpha(c) != 0) { buffer[iout--] = PNG_LITERAL_LEFT_SQUARE_BRACKET; buffer[iout++] = png_digit[(c & 0xf0) >> 4]; buffer[iout++] = png_digit[c & 0x0f]; buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET; } else { buffer[iout++] = (char)c; } } if (error_message != NULL) buffer[iout] = '\0'; else { int iin = 0; buffer[iout++] = ':'; buffer[iout++] = ' '; while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0') buffer[iout++] = error_message[iin++]; /* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */ buffer[iout] = '\0'; } }