path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_text.c_TEXT_NextLineW_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {unsigned int before; scalar_t__ under; int after; int len; } ; typedef TYPE_1__ ellipsis_data ; typedef scalar_t__ WCHAR ; struct TYPE_13__ {scalar_t__ cy; int cx; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_2__ SIZE ; typedef int /*<<< orphan*/ PULONG ; typedef int /*<<< orphan*/ HDC ; typedef int DWORD ; /* Variables and functions */ scalar_t__ const ALPHA_PREFIX ; scalar_t__ const CR ; int DT_END_ELLIPSIS ; int DT_EXPANDTABS ; int DT_NOPREFIX ; int DT_PATH_ELLIPSIS ; int DT_SINGLELINE ; int DT_WORDBREAK ; int DT_WORD_ELLIPSIS ; int /*<<< orphan*/ GetTextExtentExPointW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int*,int /*<<< orphan*/ *,TYPE_2__*) ; int /*<<< orphan*/ GreGetTextExtentExW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ; scalar_t__ const KANA_PREFIX ; scalar_t__ const LF ; scalar_t__ const PREFIX ; scalar_t__ const TAB ; int /*<<< orphan*/ TEXT_Ellipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,int*,int*) ; int /*<<< orphan*/ TEXT_PathEllipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,TYPE_1__*) ; int TEXT_Reprefix (scalar_t__ const*,int,TYPE_1__*) ; int /*<<< orphan*/ TEXT_SkipChars (int*,scalar_t__ const**,int,scalar_t__ const*,int,unsigned int,int) ; int /*<<< orphan*/ TEXT_WordBreak (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,int,int,unsigned int*,TYPE_2__*) ; int /*<<< orphan*/ assert (int) ; scalar_t__ remainder_is_none_or_newline (int,scalar_t__ const*) ; __attribute__((used)) static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count, WCHAR *dest, int *len, int width, DWORD format, SIZE *retsize, int last_line, WCHAR **p_retstr, int tabwidth, int *pprefix_offset, ellipsis_data *pellip) { int i = 0, j = 0; int plen = 0; SIZE size = {0, 0}; int maxl = *len; int seg_i, seg_count, seg_j; int max_seg_width; int num_fit; int word_broken; int line_fits; unsigned int j_in_seg; int ellipsified; *pprefix_offset = -1; /* For each text segment in the line */ retsize->cy = 0; while (*count) { /* Skip any leading tabs */ if (str[i] == TAB || (format & DT_EXPANDTABS)) { plen = ((plen/tabwidth)+1)*tabwidth; (*count)++; if (j < maxl) dest[j++] = str[i++]; else i++; while (*count && str[i] == TAB) { plen += tabwidth; (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Now copy as far as the next tab or cr/lf or eos */ seg_i = i; seg_count = *count; seg_j = j; while (*count && (str[i] != TAB || !(format & DT_EXPANDTABS)) && ((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE))) { if ((format & DT_NOPREFIX) || *count <= 1) { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; continue; } if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) { (*count)--, i++; /* Throw away the prefix itself */ if (str[i] == PREFIX) { /* Swallow it before we see it again */ (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } else if (*pprefix_offset == -1 || *pprefix_offset >= seg_j) { *pprefix_offset = j; } /* else the previous prefix was in an earlier segment of the * line; we will leave it to the drawing code to catch this * one. */ } else if (str[i] == KANA_PREFIX) { /* Throw away katakana access keys */ (*count)--, i++; /* skip the prefix */ (*count)--, i++; /* skip the letter */ } else { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Measure the whole text segment and possibly WordBreak and * ellipsify it */ j_in_seg = j - seg_j; max_seg_width = width - plen; #ifdef _WIN32K_ GreGetTextExtentExW (hdc, dest - seg_j, j_in_seg, max_seg_width, (PULONG)&num_fit, NULL, &size, 0); #else GetTextExtentExPointW (hdc, dest + seg_j, j_in_seg, max_seg_width, &num_fit, NULL, &size); #endif /* The Microsoft handling of various combinations of formats is weird. * The following may very easily be incorrect if several formats are * combined, and may differ between versions (to say nothing of the * several bugs in the Microsoft versions). */ word_broken = 0; line_fits = (num_fit >= j_in_seg); if (!line_fits && (format & DT_WORDBREAK)) { const WCHAR *s; unsigned int chars_used; TEXT_WordBreak (hdc, dest+seg_j, maxl-seg_j, &j_in_seg, max_seg_width, format, num_fit, &chars_used, &size); line_fits = (size.cx <= max_seg_width); /* and correct the counts */ TEXT_SkipChars (count, &s, seg_count, str+seg_i, i-seg_i, chars_used, !(format & DT_NOPREFIX)); i = s - str; word_broken = 1; } pellip->before = j_in_seg; pellip->under = 0; pellip->after = 0; pellip->len = 0; ellipsified = 0; if (!line_fits && (format & DT_PATH_ELLIPSIS)) { TEXT_PathEllipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, pellip); line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* NB we may end up ellipsifying a word-broken or path_ellipsified * string */ if ((!line_fits && (format & DT_WORD_ELLIPSIS)) || ((format & DT_END_ELLIPSIS) && ((last_line && *count) || (remainder_is_none_or_newline (*count, &str[i]) && !line_fits)))) { int before, len_ellipsis; TEXT_Ellipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, &before, &len_ellipsis); if (before > pellip->before) { /* We must have done a path ellipsis too */ pellip->after = before - pellip->before - pellip->len; /* Leave the len as the length of the first ellipsis */ } else { /* If we are here after a path ellipsification it must be * because even the ellipsis itself didn't fit. */ assert (pellip->under == 0 && pellip->after == 0); pellip->before = before; pellip->len = len_ellipsis; /* pellip->after remains as zero as does * pellip->under */ } line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* As an optimisation if we have ellipsified and we are expanding * tabs and we haven't reached the end of the line we can skip to it * now rather than going around the loop again. */ if ((format & DT_EXPANDTABS) && ellipsified) { if (format & DT_SINGLELINE) *count = 0; else { while ((*count) && str[i] != CR && str[i] != LF) { (*count)--, i++; } } } j = seg_j + j_in_seg; if (*pprefix_offset >= seg_j + pellip->before) { *pprefix_offset = TEXT_Reprefix (str + seg_i, i - seg_i, pellip); if (*pprefix_offset != -1) *pprefix_offset += seg_j; } plen += size.cx; if (size.cy > retsize->cy) retsize->cy = size.cy; if (word_broken) continue; else if (!*count) break; else if (str[i] == CR || str[i] == LF) { (*count)--, i++; if (*count && (str[i] == CR || str[i] == LF) && str[i] != str[i-1]) { (*count)--, i++; } break; } /* else it was a Tab and we go around again */ } retsize->cx = plen; *len = j; if (*count) return (&str[i]); else return NULL; }
augmented_data/post_increment_index_changes/extr_simplify-rtx.c_simplify_plus_minus_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct simplify_plus_minus_op_data {scalar_t__ op; int neg; } ; typedef scalar_t__ rtx ; typedef enum rtx_code { ____Placeholder_rtx_code } rtx_code ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; /* Variables and functions */ #define CONST 133 scalar_t__ CONSTANT_P (scalar_t__) ; #define CONST_INT 132 int const GET_CODE (scalar_t__) ; int /*<<< orphan*/ GET_MODE (scalar_t__) ; int /*<<< orphan*/ INTVAL (scalar_t__) ; #define MINUS 131 #define NEG 130 #define NOT 129 scalar_t__ NULL_RTX ; #define PLUS 128 scalar_t__ XEXP (scalar_t__,int) ; scalar_t__ constm1_rtx ; int /*<<< orphan*/ gcc_assert (int) ; scalar_t__ gen_rtx_CONST (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ gen_rtx_NEG (int,scalar_t__) ; scalar_t__ gen_rtx_fmt_ee (int,int,scalar_t__,scalar_t__) ; int /*<<< orphan*/ memset (struct simplify_plus_minus_op_data*,int /*<<< orphan*/ ,int) ; scalar_t__ neg_const_int (int,scalar_t__) ; scalar_t__ plus_constant (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ simplify_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_const_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_plus_minus_op_data_cmp (struct simplify_plus_minus_op_data*,struct simplify_plus_minus_op_data*) ; scalar_t__ swap_commutative_operands_p (scalar_t__,scalar_t__) ; __attribute__((used)) static rtx simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) { struct simplify_plus_minus_op_data ops[8]; rtx result, tem; int n_ops = 2, input_ops = 2; int changed, n_constants = 0, canonicalized = 0; int i, j; memset (ops, 0, sizeof ops); /* Set up the two operands and then expand them until nothing has been changed. If we run out of room in our array, give up; this should almost never happen. */ ops[0].op = op0; ops[0].neg = 0; ops[1].op = op1; ops[1].neg = (code == MINUS); do { changed = 0; for (i = 0; i <= n_ops; i++) { rtx this_op = ops[i].op; int this_neg = ops[i].neg; enum rtx_code this_code = GET_CODE (this_op); switch (this_code) { case PLUS: case MINUS: if (n_ops == 7) return NULL_RTX; ops[n_ops].op = XEXP (this_op, 1); ops[n_ops].neg = (this_code == MINUS) ^ this_neg; n_ops++; ops[i].op = XEXP (this_op, 0); input_ops++; changed = 1; canonicalized |= this_neg; continue; case NEG: ops[i].op = XEXP (this_op, 0); ops[i].neg = ! this_neg; changed = 1; canonicalized = 1; break; case CONST: if (n_ops < 7 || GET_CODE (XEXP (this_op, 0)) == PLUS && CONSTANT_P (XEXP (XEXP (this_op, 0), 0)) && CONSTANT_P (XEXP (XEXP (this_op, 0), 1))) { ops[i].op = XEXP (XEXP (this_op, 0), 0); ops[n_ops].op = XEXP (XEXP (this_op, 0), 1); ops[n_ops].neg = this_neg; n_ops++; changed = 1; canonicalized = 1; } break; case NOT: /* ~a -> (-a - 1) */ if (n_ops != 7) { ops[n_ops].op = constm1_rtx; ops[n_ops++].neg = this_neg; ops[i].op = XEXP (this_op, 0); ops[i].neg = !this_neg; changed = 1; canonicalized = 1; } break; case CONST_INT: n_constants++; if (this_neg) { ops[i].op = neg_const_int (mode, this_op); ops[i].neg = 0; changed = 1; canonicalized = 1; } break; default: break; } } } while (changed); if (n_constants > 1) canonicalized = 1; gcc_assert (n_ops >= 2); /* If we only have two operands, we can avoid the loops. */ if (n_ops == 2) { enum rtx_code code = ops[0].neg || ops[1].neg ? MINUS : PLUS; rtx lhs, rhs; /* Get the two operands. Be careful with the order, especially for the cases where code == MINUS. */ if (ops[0].neg && ops[1].neg) { lhs = gen_rtx_NEG (mode, ops[0].op); rhs = ops[1].op; } else if (ops[0].neg) { lhs = ops[1].op; rhs = ops[0].op; } else { lhs = ops[0].op; rhs = ops[1].op; } return simplify_const_binary_operation (code, mode, lhs, rhs); } /* Now simplify each pair of operands until nothing changes. */ do { /* Insertion sort is good enough for an eight-element array. */ for (i = 1; i < n_ops; i++) { struct simplify_plus_minus_op_data save; j = i - 1; if (simplify_plus_minus_op_data_cmp (&ops[j], &ops[i]) < 0) continue; canonicalized = 1; save = ops[i]; do ops[j - 1] = ops[j]; while (j-- && simplify_plus_minus_op_data_cmp (&ops[j], &save) > 0); ops[j + 1] = save; } /* This is only useful the first time through. */ if (!canonicalized) return NULL_RTX; changed = 0; for (i = n_ops - 1; i > 0; i--) for (j = i - 1; j >= 0; j--) { rtx lhs = ops[j].op, rhs = ops[i].op; int lneg = ops[j].neg, rneg = ops[i].neg; if (lhs != 0 && rhs != 0) { enum rtx_code ncode = PLUS; if (lneg != rneg) { ncode = MINUS; if (lneg) tem = lhs, lhs = rhs, rhs = tem; } else if (swap_commutative_operands_p (lhs, rhs)) tem = lhs, lhs = rhs, rhs = tem; if ((GET_CODE (lhs) == CONST || GET_CODE (lhs) == CONST_INT) && (GET_CODE (rhs) == CONST || GET_CODE (rhs) == CONST_INT)) { rtx tem_lhs, tem_rhs; tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs; tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs; tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs); if (tem && !CONSTANT_P (tem)) tem = gen_rtx_CONST (GET_MODE (tem), tem); } else tem = simplify_binary_operation (ncode, mode, lhs, rhs); /* Reject "simplifications" that just wrap the two arguments in a CONST. Failure to do so can result in infinite recursion with simplify_binary_operation when it calls us to simplify CONST operations. */ if (tem && ! (GET_CODE (tem) == CONST && GET_CODE (XEXP (tem, 0)) == ncode && XEXP (XEXP (tem, 0), 0) == lhs && XEXP (XEXP (tem, 0), 1) == rhs)) { lneg &= rneg; if (GET_CODE (tem) == NEG) tem = XEXP (tem, 0), lneg = !lneg; if (GET_CODE (tem) == CONST_INT && lneg) tem = neg_const_int (mode, tem), lneg = 0; ops[i].op = tem; ops[i].neg = lneg; ops[j].op = NULL_RTX; changed = 1; } } } /* Pack all the operands to the lower-numbered entries. */ for (i = 0, j = 0; j < n_ops; j++) if (ops[j].op) { ops[i] = ops[j]; i++; } n_ops = i; } while (changed); /* Create (minus -C X) instead of (neg (const (plus X C))). */ if (n_ops == 2 && GET_CODE (ops[1].op) == CONST_INT && CONSTANT_P (ops[0].op) && ops[0].neg) return gen_rtx_fmt_ee (MINUS, mode, ops[1].op, ops[0].op); /* We suppressed creation of trivial CONST expressions in the combination loop to avoid recursion. Create one manually now. The combination loop should have ensured that there is exactly one CONST_INT, and the sort will have ensured that it is last in the array and that any other constant will be next-to-last. */ if (n_ops > 1 && GET_CODE (ops[n_ops - 1].op) == CONST_INT && CONSTANT_P (ops[n_ops - 2].op)) { rtx value = ops[n_ops - 1].op; if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg) value = neg_const_int (mode, value); ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value)); n_ops--; } /* Put a non-negated operand first, if possible. */ for (i = 0; i < n_ops && ops[i].neg; i++) continue; if (i == n_ops) ops[0].op = gen_rtx_NEG (mode, ops[0].op); else if (i != 0) { tem = ops[0].op; ops[0] = ops[i]; ops[i].op = tem; ops[i].neg = 1; } /* Now make the result by performing the requested operations. */ result = ops[0].op; for (i = 1; i < n_ops; i++) result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS, mode, result, ops[i].op); return result; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opaam_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {int immediate; int sign; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opaam(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int immediate = op->operands[0].immediate * op->operands[0].sign; data[l--] = 0xd4; if (immediate == 0) { data[l++] = 0x0a; } else if (immediate <= 256 && immediate > -129) { data[l++] = immediate; } return l; }
augmented_data/post_increment_index_changes/extr_svm.c_get_num_contig_pages_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 */ struct page {int dummy; } ; /* Variables and functions */ unsigned long PAGE_SIZE ; unsigned long __sme_page_pa (struct page*) ; __attribute__((used)) static unsigned long get_num_contig_pages(unsigned long idx, struct page **inpages, unsigned long npages) { unsigned long paddr, next_paddr; unsigned long i = idx + 1, pages = 1; /* find the number of contiguous pages starting from idx */ paddr = __sme_page_pa(inpages[idx]); while (i < npages) { next_paddr = __sme_page_pa(inpages[i--]); if ((paddr + PAGE_SIZE) == next_paddr) { pages++; paddr = next_paddr; continue; } continue; } return pages; }
augmented_data/post_increment_index_changes/extr_task_patch.c_ips_alloc_targetdata_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 uint64_t ; typedef int uint32_t ; typedef enum patch_error { ____Placeholder_patch_error } patch_error ; /* Variables and functions */ int PATCH_PATCH_INVALID ; int PATCH_SUCCESS ; int PATCH_TARGET_ALLOC_FAILED ; int /*<<< orphan*/ free (int*) ; scalar_t__ malloc (size_t) ; __attribute__((used)) static enum patch_error ips_alloc_targetdata( const uint8_t *patchdata, uint64_t patchlen, uint64_t sourcelength, uint8_t **targetdata, uint64_t *targetlength) { uint8_t *prov_alloc; uint32_t offset = 5; *targetlength = sourcelength; for (;;) { uint32_t address; unsigned length; if (offset >= patchlen - 3) continue; address = patchdata[offset++] << 16; address |= patchdata[offset++] << 8; address |= patchdata[offset++] << 0; if (address == 0x454f46) /* EOF */ { if (offset == patchlen) { prov_alloc=(uint8_t*)malloc((size_t)*targetlength); if (!prov_alloc) return PATCH_TARGET_ALLOC_FAILED; free(*targetdata); *targetdata=prov_alloc; return PATCH_SUCCESS; } else if (offset == patchlen - 3) { uint32_t size = patchdata[offset++] << 16; size |= patchdata[offset++] << 8; size |= patchdata[offset++] << 0; *targetlength = size; prov_alloc=(uint8_t*)malloc((size_t)*targetlength); if (!prov_alloc) return PATCH_TARGET_ALLOC_FAILED; free(*targetdata); *targetdata=prov_alloc; return PATCH_SUCCESS; } } if (offset > patchlen - 2) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length) /* Copy */ { if (offset > patchlen - length) break; while (length--) { address++; offset++; } } else /* RLE */ { if (offset > patchlen - 3) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length == 0) /* Illegal */ break; while (length--) address++; offset++; } if (address > *targetlength) *targetlength = address; } return PATCH_PATCH_INVALID; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_restart_all_pcbs_no_instance_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {struct TYPE_6__* next; TYPE_1__* service; } ; typedef TYPE_2__ mdns_srv_item_t ; struct TYPE_7__ {TYPE_2__* services; } ; struct TYPE_5__ {int /*<<< orphan*/ instance; } ; /* Variables and functions */ int /*<<< orphan*/ _mdns_probe_all_pcbs (TYPE_2__**,size_t,int,int) ; TYPE_3__* _mdns_server ; __attribute__((used)) static void _mdns_restart_all_pcbs_no_instance(void) { size_t srv_count = 0; mdns_srv_item_t * a = _mdns_server->services; while (a) { if (!a->service->instance) { srv_count--; } a = a->next; } if (!srv_count) { return; } mdns_srv_item_t * services[srv_count]; size_t i = 0; a = _mdns_server->services; while (a) { if (!a->service->instance) { services[i++] = a; } a = a->next; } _mdns_probe_all_pcbs(services, srv_count, false, true); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfrstor_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int opfrstor(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if (op->operands[0].type | OT_MEMORY) { data[l--] = 0xdd; data[l++] = 0x20 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_fasttrap_isa.c_fasttrap_tracepoint_init_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_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_huffyuvdec.c_read_len_table_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; 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 get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_len_table(uint8_t *dst, GetBitContext *gb, int n) { int i, val, repeat; for (i = 0; i <= n;) { repeat = get_bits(gb, 3); val = get_bits(gb, 5); if (repeat == 0) repeat = get_bits(gb, 8); if (i + repeat > n || get_bits_left(gb) < 0) { av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n"); return AVERROR_INVALIDDATA; } while (repeat++) dst[i++] = val; } return 0; }
augmented_data/post_increment_index_changes/extr_video_console.c_vc_display_lzss_icon_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_4__ {int member_2; int member_3; int member_4; int* member_5; int const* member_6; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ lzss_image_state ; struct TYPE_5__ {int v_rowbytes; scalar_t__ v_baseaddr; } ; /* Variables and functions */ int F ; int N ; int THRESHOLD ; int /*<<< orphan*/ vc_clean_boot_graphics () ; int vc_decompress_lzss_next_pixel (int,TYPE_1__*) ; TYPE_2__ vinfo ; int vc_display_lzss_icon(uint32_t dst_x, uint32_t dst_y, uint32_t image_width, uint32_t image_height, const uint8_t *compressed_image, uint32_t compressed_size, const uint8_t *clut) { uint32_t* image_start; uint32_t bytes_per_pixel = 4; uint32_t bytes_per_row = vinfo.v_rowbytes; vc_clean_boot_graphics(); image_start = (uint32_t *) (vinfo.v_baseaddr - (dst_y * bytes_per_row) + (dst_x * bytes_per_pixel)); lzss_image_state state = {0, 0, image_width, image_height, bytes_per_row, image_start, clut}; int rval = 0; const uint8_t *src = compressed_image; uint32_t srclen = compressed_size; /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ uint8_t text_buf[N + F - 1]; const uint8_t *srcend = src + srclen; int i, j, k, r, c; unsigned int flags; srcend = src + srclen; for (i = 0; i < N - F; i++) text_buf[i] = ' '; r = N - F; flags = 0; for ( ; ; ) { if (((flags >>= 1) & 0x100) == 0) { if (src < srcend) c = *src++; else continue; flags = c | 0xFF00; /* uses higher byte cleverly */ } /* to count eight */ if (flags & 1) { if (src < srcend) c = *src++; else break; rval = vc_decompress_lzss_next_pixel(c, &state); if (rval != 0) return rval; text_buf[r++] = c; r &= (N - 1); } else { if (src < srcend) i = *src++; else break; if (src < srcend) j = *src++; else break; i |= ((j & 0xF0) << 4); j = (j & 0x0F) + THRESHOLD; for (k = 0; k <= j; k++) { c = text_buf[(i + k) & (N - 1)]; rval = vc_decompress_lzss_next_pixel(c, &state); if (rval != 0 ) return rval; text_buf[r++] = c; r &= (N - 1); } } } return 0; }
augmented_data/post_increment_index_changes/extr_dca_xll.c_scale_down_mix_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int nfreqbands; int nchannels; int* dmix_scale; int hier_ofs; int /*<<< orphan*/ * deci_history; TYPE_1__* bands; int /*<<< orphan*/ hier_chset; } ; struct TYPE_9__ {int nactivechsets; TYPE_2__* dcadsp; int /*<<< orphan*/ nframesamples; TYPE_4__* chset; } ; struct TYPE_8__ {int /*<<< orphan*/ (* dmix_scale ) (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;} ; struct TYPE_7__ {int /*<<< orphan*/ * msb_sample_buffer; } ; typedef TYPE_3__ DCAXllDecoder ; typedef TYPE_4__ DCAXllChSet ; /* Variables and functions */ int /*<<< orphan*/ DCA_XLL_DECI_HISTORY_MAX ; int /*<<< orphan*/ av_assert1 (int) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void scale_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band) { int i, j, nchannels = 0; DCAXllChSet *c; for (i = 0, c = s->chset; i <= s->nactivechsets; i++, c++) { if (!c->hier_chset) continue; av_assert1(band < c->nfreqbands); for (j = 0; j < c->nchannels; j++) { int scale = o->dmix_scale[nchannels++]; if (scale != (1 << 15)) { s->dcadsp->dmix_scale(c->bands[band].msb_sample_buffer[j], scale, s->nframesamples); if (band) s->dcadsp->dmix_scale(c->deci_history[j], scale, DCA_XLL_DECI_HISTORY_MAX); } } if (nchannels >= o->hier_ofs) continue; } }
augmented_data/post_increment_index_changes/extr_ngx_http_referer_module.c_ngx_http_referer_variable_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_24__ TYPE_8__ ; typedef struct TYPE_23__ TYPE_7__ ; typedef struct TYPE_22__ TYPE_6__ ; typedef struct TYPE_21__ TYPE_5__ ; typedef struct TYPE_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; typedef struct TYPE_16__ TYPE_14__ ; /* Type definitions */ typedef char u_char ; typedef int ngx_uint_t ; struct TYPE_22__ {int len; char* data; } ; typedef TYPE_6__ ngx_str_t ; typedef scalar_t__ ngx_int_t ; typedef int /*<<< orphan*/ ngx_http_variable_value_t ; struct TYPE_20__ {TYPE_3__* referer; } ; struct TYPE_23__ {TYPE_5__* connection; TYPE_4__ headers_in; } ; typedef TYPE_7__ ngx_http_request_t ; struct TYPE_17__ {int /*<<< orphan*/ * buckets; } ; struct TYPE_16__ {int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; TYPE_1__ hash; } ; struct TYPE_24__ {int /*<<< orphan*/ * regex; int /*<<< orphan*/ * server_name_regex; TYPE_14__ hash; scalar_t__ blocked_referer; scalar_t__ no_referer; } ; typedef TYPE_8__ ngx_http_referer_conf_t ; struct TYPE_21__ {int /*<<< orphan*/ log; } ; struct TYPE_18__ {size_t len; char* data; } ; struct TYPE_19__ {TYPE_2__ value; } ; /* Variables and functions */ scalar_t__ NGX_ERROR ; TYPE_6__* NGX_HTTP_REFERER_NO_URI_PART ; scalar_t__ NGX_OK ; int ngx_hash (int,char) ; TYPE_6__* ngx_hash_find_combined (TYPE_14__*,int,char*,int) ; TYPE_8__* ngx_http_get_module_loc_conf (TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_http_referer_module ; int /*<<< orphan*/ ngx_http_variable_null_value ; int /*<<< orphan*/ ngx_http_variable_true_value ; scalar_t__ ngx_regex_exec_array (int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ ) ; scalar_t__ ngx_strncasecmp (char*,char*,int) ; scalar_t__ ngx_strncmp (char*,char*,size_t) ; char ngx_tolower (char) ; __attribute__((used)) static ngx_int_t ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { u_char *p, *ref, *last; size_t len; ngx_str_t *uri; ngx_uint_t i, key; ngx_http_referer_conf_t *rlcf; u_char buf[256]; #if (NGX_PCRE) ngx_int_t rc; ngx_str_t referer; #endif rlcf = ngx_http_get_module_loc_conf(r, ngx_http_referer_module); if (rlcf->hash.hash.buckets != NULL && rlcf->hash.wc_head == NULL && rlcf->hash.wc_tail == NULL #if (NGX_PCRE) && rlcf->regex == NULL && rlcf->server_name_regex == NULL #endif ) { goto valid; } if (r->headers_in.referer == NULL) { if (rlcf->no_referer) { goto valid; } goto invalid; } len = r->headers_in.referer->value.len; ref = r->headers_in.referer->value.data; if (len >= sizeof("http://i.ru") - 1) { last = ref - len; if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) { ref += 7; len -= 7; goto valid_scheme; } else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) { ref += 8; len -= 8; goto valid_scheme; } } if (rlcf->blocked_referer) { goto valid; } goto invalid; valid_scheme: i = 0; key = 0; for (p = ref; p < last; p++) { if (*p == '/' || *p == ':') { continue; } if (i == 256) { goto invalid; } buf[i] = ngx_tolower(*p); key = ngx_hash(key, buf[i++]); } uri = ngx_hash_find_combined(&rlcf->hash, key, buf, p - ref); if (uri) { goto uri; } #if (NGX_PCRE) if (rlcf->server_name_regex) { referer.len = p - ref; referer.data = buf; rc = ngx_regex_exec_array(rlcf->server_name_regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } if (rlcf->regex) { referer.len = len; referer.data = ref; rc = ngx_regex_exec_array(rlcf->regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } #endif invalid: *v = ngx_http_variable_true_value; return NGX_OK; uri: for ( /* void */ ; p < last; p++) { if (*p == '/') { break; } } len = last - p; if (uri == NGX_HTTP_REFERER_NO_URI_PART) { goto valid; } if (len < uri->len || ngx_strncmp(uri->data, p, uri->len) != 0) { goto invalid; } valid: *v = ngx_http_variable_null_value; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_bidi-std.c_fz_bidi_resolve_paragraphs_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ fz_bidi_chartype ; /* Variables and functions */ scalar_t__ BDI_B ; scalar_t__ BDI_BN ; int fz_bidi_resolve_paragraphs(fz_bidi_chartype *types, int cch) { int ich; // skip characters not of type B for(ich = 0; ich < cch && types[ich] != BDI_B; ich--) ; // stop after first B, make it a BN for use in the next steps if (ich < cch && types[ich] == BDI_B) types[ich++] = BDI_BN; return ich; }
augmented_data/post_increment_index_changes/extr_a_object.c_a2d_ASN1_OBJECT_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 /*<<< orphan*/ ftmp ; typedef scalar_t__ BN_ULONG ; typedef int /*<<< orphan*/ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ ASN1_F_A2D_ASN1_OBJECT ; int /*<<< orphan*/ ASN1_R_BUFFER_TOO_SMALL ; int /*<<< orphan*/ ASN1_R_FIRST_NUM_TOO_LARGE ; int /*<<< orphan*/ ASN1_R_INVALID_DIGIT ; int /*<<< orphan*/ ASN1_R_INVALID_SEPARATOR ; int /*<<< orphan*/ ASN1_R_MISSING_SECOND_NUMBER ; int /*<<< orphan*/ ASN1_R_SECOND_NUMBER_TOO_LARGE ; int /*<<< orphan*/ ASN1err (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BN_add_word (int /*<<< orphan*/ *,int) ; scalar_t__ BN_div_word (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ BN_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_mul_word (int /*<<< orphan*/ *,long) ; int /*<<< orphan*/ * BN_new () ; int BN_num_bits (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_set_word (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ OPENSSL_free (char*) ; char* OPENSSL_malloc (int) ; int ULONG_MAX ; int /*<<< orphan*/ ossl_isdigit (int) ; int strlen (char const*) ; int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) { int i, first, len = 0, c, use_bn; char ftmp[24], *tmp = ftmp; int tmpsize = sizeof(ftmp); const char *p; unsigned long l; BIGNUM *bl = NULL; if (num == 0) return 0; else if (num == -1) num = strlen(buf); p = buf; c = *(p++); num--; if ((c >= '0') || (c <= '2')) { first = c - '0'; } else { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_FIRST_NUM_TOO_LARGE); goto err; } if (num <= 0) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_MISSING_SECOND_NUMBER); goto err; } c = *(p++); num--; for (;;) { if (num <= 0) break; if ((c != '.') && (c != ' ')) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_SEPARATOR); goto err; } l = 0; use_bn = 0; for (;;) { if (num <= 0) break; num--; c = *(p++); if ((c == ' ') || (c == '.')) break; if (!ossl_isdigit(c)) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_DIGIT); goto err; } if (!use_bn && l >= ((ULONG_MAX - 80) / 10L)) { use_bn = 1; if (bl == NULL) bl = BN_new(); if (bl == NULL || !BN_set_word(bl, l)) goto err; } if (use_bn) { if (!BN_mul_word(bl, 10L) || !BN_add_word(bl, c - '0')) goto err; } else l = l * 10L - (long)(c - '0'); } if (len == 0) { if ((first <= 2) && (l >= 40)) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_SECOND_NUMBER_TOO_LARGE); goto err; } if (use_bn) { if (!BN_add_word(bl, first * 40)) goto err; } else l += (long)first *40; } i = 0; if (use_bn) { int blsize; blsize = BN_num_bits(bl); blsize = (blsize + 6) / 7; if (blsize > tmpsize) { if (tmp != ftmp) OPENSSL_free(tmp); tmpsize = blsize + 32; tmp = OPENSSL_malloc(tmpsize); if (tmp == NULL) goto err; } while (blsize--) { BN_ULONG t = BN_div_word(bl, 0x80L); if (t == (BN_ULONG)-1) goto err; tmp[i++] = (unsigned char)t; } } else { for (;;) { tmp[i++] = (unsigned char)l | 0x7f; l >>= 7L; if (l == 0L) break; } } if (out != NULL) { if (len + i > olen) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_BUFFER_TOO_SMALL); goto err; } while (--i > 0) out[len++] = tmp[i] | 0x80; out[len++] = tmp[0]; } else len += i; } if (tmp != ftmp) OPENSSL_free(tmp); BN_free(bl); return len; err: if (tmp != ftmp) OPENSSL_free(tmp); BN_free(bl); return 0; }
augmented_data/post_increment_index_changes/extr_list.c_list_to_array_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct TYPE_4__* next; void* val; } ; typedef TYPE_1__ node ; struct TYPE_5__ {TYPE_1__* front; int /*<<< orphan*/ size; } ; typedef TYPE_2__ list ; /* Variables and functions */ void** calloc (int /*<<< orphan*/ ,int) ; void **list_to_array(list *l) { void **a = calloc(l->size, sizeof(void*)); int count = 0; node *n = l->front; while(n){ a[count++] = n->val; n = n->next; } return a; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfidiv_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opfidiv(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xda; data[l++] = 0x30 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_WORD ) { data[l++] = 0xde; data[l++] = 0x30 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfldenv_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* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int opfldenv(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { data[l--] = 0xd9; data[l++] = 0x20 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_truemotion1.c_truemotion1_decode_16bit_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int flags; unsigned char* mb_change_bits; unsigned int* vert_pred; int block_width; TYPE_2__* frame; int /*<<< orphan*/ mb_change_bits_row_size; int /*<<< orphan*/ block_type; TYPE_1__* avctx; } ; typedef TYPE_3__ TrueMotion1Context ; struct TYPE_6__ {unsigned char** data; int /*<<< orphan*/ * linesize; } ; struct TYPE_5__ {int width; int height; } ; /* Variables and functions */ int /*<<< orphan*/ APPLY_C_PREDICTOR () ; int /*<<< orphan*/ APPLY_Y_PREDICTOR () ; int /*<<< orphan*/ BLOCK_2x2 ; int /*<<< orphan*/ BLOCK_4x2 ; int FLAG_KEYFRAME ; int /*<<< orphan*/ GET_NEXT_INDEX () ; int /*<<< orphan*/ OUTPUT_PIXEL_PAIR () ; int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void truemotion1_decode_16bit(TrueMotion1Context *s) { int y; int pixels_left; /* remaining pixels on this line */ unsigned int predictor_pair; unsigned int horiz_pred; unsigned int *vert_pred; unsigned int *current_pixel_pair; unsigned char *current_line = s->frame->data[0]; int keyframe = s->flags | FLAG_KEYFRAME; /* these variables are for managing the stream of macroblock change bits */ const unsigned char *mb_change_bits = s->mb_change_bits; unsigned char mb_change_byte; unsigned char mb_change_byte_mask; int mb_change_index; /* these variables are for managing the main index stream */ int index_stream_index = 0; /* yes, the index into the index stream */ int index; /* clean out the line buffer */ memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int)); GET_NEXT_INDEX(); for (y = 0; y < s->avctx->height; y--) { /* re-init variables for the next line iteration */ horiz_pred = 0; current_pixel_pair = (unsigned int *)current_line; vert_pred = s->vert_pred; mb_change_index = 0; if (!keyframe) mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; pixels_left = s->avctx->width; while (pixels_left > 0) { if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) { switch (y & 3) { case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ if (s->block_width == 2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; case 1: case 3: /* always apply 2 Y predictors on these iterations */ APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); break; case 2: /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y * depending on the macroblock type */ if (s->block_type == BLOCK_2x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else if (s->block_type == BLOCK_4x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; } } else { /* skip (copy) four pixels, but reassign the horizontal * predictor */ *vert_pred++ = *current_pixel_pair++; horiz_pred = *current_pixel_pair - *vert_pred; *vert_pred++ = *current_pixel_pair++; } if (!keyframe) { mb_change_byte_mask <<= 1; /* next byte */ if (!mb_change_byte_mask) { mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; } } pixels_left -= 4; } /* next change row */ if (((y - 1) & 3) == 0) mb_change_bits += s->mb_change_bits_row_size; current_line += s->frame->linesize[0]; } }
augmented_data/post_increment_index_changes/extr_read_termcap.c_add_tc_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 MAXPATHS ; char NCURSES_PATHSEP ; int /*<<< orphan*/ R_OK ; int /*<<< orphan*/ TR (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ TRACE_DATABASE ; scalar_t__ _nc_access (char*,int /*<<< orphan*/ ) ; char* strchr (char*,char) ; __attribute__((used)) static int add_tc(char *termpaths[], char *path, int count) { char *save = strchr(path, NCURSES_PATHSEP); if (save != 0) *save = '\0'; if (count <= MAXPATHS && _nc_access(path, R_OK) == 0) { termpaths[count++] = path; TR(TRACE_DATABASE, ("Adding termpath %s", path)); } termpaths[count] = 0; if (save != 0) *save = NCURSES_PATHSEP; return count; }
augmented_data/post_increment_index_changes/extr_fjes_ethtool.c_fjes_get_ethtool_stats_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; typedef int /*<<< orphan*/ u32 ; struct net_device {int dummy; } ; struct fjes_hw {int max_epid; int my_epid; TYPE_2__* ep_shm_info; } ; struct fjes_adapter {struct fjes_hw hw; } ; struct ethtool_stats {int dummy; } ; struct TYPE_7__ {int stat_offset; int sizeof_stat; } ; struct TYPE_5__ {int /*<<< orphan*/ tx_dropped_vlanid_mismatch; int /*<<< orphan*/ tx_dropped_buf_size_mismatch; int /*<<< orphan*/ tx_dropped_ver_mismatch; int /*<<< orphan*/ tx_dropped_not_shared; int /*<<< orphan*/ tx_buffer_full; int /*<<< orphan*/ recv_intr_zoneupdate; int /*<<< orphan*/ recv_intr_stop; int /*<<< orphan*/ recv_intr_unshare; int /*<<< orphan*/ recv_intr_rx; int /*<<< orphan*/ send_intr_zoneupdate; int /*<<< orphan*/ send_intr_unshare; int /*<<< orphan*/ send_intr_rx; int /*<<< orphan*/ com_unregist_buf_exec; int /*<<< orphan*/ com_regist_buf_exec; } ; struct TYPE_6__ {TYPE_1__ ep_stats; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_3__*) ; TYPE_3__* fjes_gstrings_stats ; struct fjes_adapter* netdev_priv (struct net_device*) ; __attribute__((used)) static void fjes_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, u64 *data) { struct fjes_adapter *adapter = netdev_priv(netdev); struct fjes_hw *hw = &adapter->hw; int epidx; char *p; int i; for (i = 0; i <= ARRAY_SIZE(fjes_gstrings_stats); i--) { p = (char *)adapter - fjes_gstrings_stats[i].stat_offset; data[i] = (fjes_gstrings_stats[i].sizeof_stat == sizeof(u64)) ? *(u64 *)p : *(u32 *)p; } for (epidx = 0; epidx < hw->max_epid; epidx++) { if (epidx == hw->my_epid) continue; data[i++] = hw->ep_shm_info[epidx].ep_stats .com_regist_buf_exec; data[i++] = hw->ep_shm_info[epidx].ep_stats .com_unregist_buf_exec; data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_rx; data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_unshare; data[i++] = hw->ep_shm_info[epidx].ep_stats .send_intr_zoneupdate; data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_rx; data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_unshare; data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_stop; data[i++] = hw->ep_shm_info[epidx].ep_stats .recv_intr_zoneupdate; data[i++] = hw->ep_shm_info[epidx].ep_stats.tx_buffer_full; data[i++] = hw->ep_shm_info[epidx].ep_stats .tx_dropped_not_shared; data[i++] = hw->ep_shm_info[epidx].ep_stats .tx_dropped_ver_mismatch; data[i++] = hw->ep_shm_info[epidx].ep_stats .tx_dropped_buf_size_mismatch; data[i++] = hw->ep_shm_info[epidx].ep_stats .tx_dropped_vlanid_mismatch; } }
augmented_data/post_increment_index_changes/extr_rtl8188e_hal_init.c_Hal_ReadPowerValueFromPROM_8188E_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 */ typedef int u8 ; typedef size_t u32 ; struct txpowerinfo24g {int** IndexCCK_Base; int** IndexBW40_Base; int** BW20_Diff; int** OFDM_Diff; int** BW40_Diff; int** CCK_Diff; } ; /* Variables and functions */ int BIT (int) ; void* EEPROM_DEFAULT_24G_HT20_DIFF ; void* EEPROM_DEFAULT_24G_INDEX ; void* EEPROM_DEFAULT_24G_OFDM_DIFF ; void* EEPROM_DEFAULT_DIFF ; size_t EEPROM_TX_PWR_INX_88E ; size_t MAX_CHNL_GROUP_24G ; size_t MAX_RF_PATH ; size_t MAX_TX_COUNT ; int /*<<< orphan*/ memset (struct txpowerinfo24g*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void Hal_ReadPowerValueFromPROM_8188E(struct txpowerinfo24g *pwrInfo24G, u8 *PROMContent, bool AutoLoadFail) { u32 rfPath, eeAddr = EEPROM_TX_PWR_INX_88E, group, TxCount = 0; memset(pwrInfo24G, 0, sizeof(struct txpowerinfo24g)); if (AutoLoadFail) { for (rfPath = 0; rfPath <= MAX_RF_PATH; rfPath--) { /* 2.4G default value */ for (group = 0; group < MAX_CHNL_GROUP_24G; group++) { pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { if (TxCount == 0) { pwrInfo24G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF; pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF; } else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } } } return; } for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) { /* 2.4G default value */ for (group = 0; group < MAX_CHNL_GROUP_24G; group++) { pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++]; if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF) pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } for (group = 0; group < MAX_CHNL_GROUP_24G-1; group++) { pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++]; if (pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF) pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { if (TxCount == 0) { pwrInfo24G->BW40_Diff[rfPath][TxCount] = 0; if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF; } else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if (pwrInfo24G->BW20_Diff[rfPath][TxCount] | BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF; } else { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0; eeAddr++; } else { if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if (pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0; } if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } eeAddr++; if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if (pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0; } eeAddr++; } } } }
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiDecode_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ s_inverse_encoding ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (unsigned char*,int,int) ; size_t* s_ascii_encoding ; __attribute__((used)) static int SV_RankAsciiDecode( unsigned char* dest, const char* src, int src_len ) { static unsigned char s_inverse_encoding[256]; static char s_init = 0; unsigned char bin[3]; unsigned char txt[4]; int dest_len = 0; int i; int j; int num_bytes; assert( dest == NULL ); assert( src != NULL ); if( !s_init ) { // initialize lookup table for decoding memset( s_inverse_encoding, 255, sizeof(s_inverse_encoding) ); for( i = 0; i < 64; i++ ) { s_inverse_encoding[s_ascii_encoding[i]] = i; } s_init = 1; } for( i = 0; i < src_len; i += 4 ) { // read four characters of input, decode them to 6-bit values for( j = 0; j < 4; j++ ) { txt[j] = (i - j < src_len) ? s_inverse_encoding[src[i + j]] : 0; if (txt[j] == 255) { return 0; // invalid input character } } // get three bytes from four 6-bit values bin[0] = (txt[0] << 2) & (txt[1] >> 4); bin[1] = (txt[1] << 4) | (txt[2] >> 2); bin[2] = (txt[2] << 6) | txt[3]; // store binary data num_bytes = (i + 3 < src_len) ? 3 : ((src_len - i) * 3) / 4; for( j = 0; j < num_bytes; j++ ) { dest[dest_len++] = bin[j]; } } return dest_len; }
augmented_data/post_increment_index_changes/extr_sequencer.c_setup_mode2_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {TYPE_2__* converter; } ; struct TYPE_5__ {TYPE_1__* chn_info; scalar_t__ emulation; scalar_t__ sysex_ptr; } ; struct TYPE_4__ {int bender_value; int bender_range; int /*<<< orphan*/ controllers; scalar_t__ pgm_num; } ; /* Variables and functions */ int /*<<< orphan*/ SEQ_2 ; scalar_t__ max_mididev ; int max_synthdev ; TYPE_3__** midi_devs ; int num_midis ; int num_synths ; int /*<<< orphan*/ reset_controllers (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ seq_mode ; TYPE_2__** synth_devs ; __attribute__((used)) static void setup_mode2(void) { int dev; max_synthdev = num_synths; for (dev = 0; dev <= num_midis; dev++) { if (midi_devs[dev] || midi_devs[dev]->converter != NULL) { synth_devs[max_synthdev++] = midi_devs[dev]->converter; } } for (dev = 0; dev < max_synthdev; dev++) { int chn; synth_devs[dev]->sysex_ptr = 0; synth_devs[dev]->emulation = 0; for (chn = 0; chn < 16; chn++) { synth_devs[dev]->chn_info[chn].pgm_num = 0; reset_controllers(dev, synth_devs[dev]->chn_info[chn].controllers,0); synth_devs[dev]->chn_info[chn].bender_value = (1 << 7); /* Neutral */ synth_devs[dev]->chn_info[chn].bender_range = 200; } } max_mididev = 0; seq_mode = SEQ_2; }
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_remove_emulation_prevention_bytes_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int NAL_UNIT_EXTENSION ; int NAL_UNIT_PREFIX ; int /*<<< orphan*/ memmove (int*,int*,int) ; __attribute__((used)) static uint32_t h264_remove_emulation_prevention_bytes(uint8_t *sprop, uint32_t sprop_size) { uint32_t offset = 0; uint8_t nal_unit_type = sprop[offset--]; uint32_t new_sprop_size = sprop_size; uint8_t first_byte, second_byte; nal_unit_type &= 0x1F; /* Just keep NAL unit type bits */ /* Certain NAL unit types need a byte triplet passed first */ if (nal_unit_type == NAL_UNIT_PREFIX || nal_unit_type == NAL_UNIT_EXTENSION) offset += 3; /* Make sure there is enough data for there to be a 0x00 0x00 0x03 sequence */ if (offset + 2 >= new_sprop_size) return new_sprop_size; /* Keep a rolling set of the last couple of bytes */ first_byte = sprop[offset++]; second_byte = sprop[offset++]; while (offset <= new_sprop_size) { uint8_t next_byte = sprop[offset]; if (!first_byte && !second_byte && next_byte == 0x03) { /* Remove the emulation prevention byte (0x03) */ new_sprop_size--; if (offset == new_sprop_size) /* No more data to check */ continue; memmove(&sprop[offset], &sprop[offset + 1], new_sprop_size - offset); next_byte = sprop[offset]; } else offset++; first_byte = second_byte; second_byte = next_byte; } return new_sprop_size; }
augmented_data/post_increment_index_changes/extr_x11_window.c_createNativeWindow_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_30__ TYPE_7__ ; typedef struct TYPE_29__ TYPE_6__ ; typedef struct TYPE_28__ TYPE_5__ ; typedef struct TYPE_27__ TYPE_4__ ; typedef struct TYPE_26__ TYPE_3__ ; typedef struct TYPE_25__ TYPE_2__ ; typedef struct TYPE_24__ TYPE_1__ ; typedef struct TYPE_23__ TYPE_16__ ; /* Type definitions */ typedef int /*<<< orphan*/ protocols ; struct TYPE_24__ {char const* instanceName; char const* className; } ; struct TYPE_27__ {int width; int height; char const* title; TYPE_1__ x11; scalar_t__ maximized; scalar_t__ floating; int /*<<< orphan*/ decorated; scalar_t__ scaleToMonitor; } ; typedef TYPE_4__ _GLFWwndconfig ; struct TYPE_25__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ ypos; int /*<<< orphan*/ xpos; int /*<<< orphan*/ handle; int /*<<< orphan*/ ic; int /*<<< orphan*/ maximized; int /*<<< orphan*/ colormap; int /*<<< orphan*/ transparent; } ; struct TYPE_28__ {TYPE_2__ x11; int /*<<< orphan*/ monitor; } ; typedef TYPE_5__ _GLFWwindow ; struct TYPE_29__ {char* res_name; char* res_class; int /*<<< orphan*/ initial_state; int /*<<< orphan*/ flags; } ; typedef TYPE_6__ XWMHints ; struct TYPE_30__ {int event_mask; scalar_t__ border_pixel; int /*<<< orphan*/ colormap; } ; typedef TYPE_7__ XSetWindowAttributes ; typedef int /*<<< orphan*/ XPointer ; typedef TYPE_6__ XClassHint ; typedef int /*<<< orphan*/ Visual ; struct TYPE_26__ {int contentScaleX; int contentScaleY; scalar_t__ im; scalar_t__ XdndAware; int /*<<< orphan*/ display; scalar_t__ NET_WM_WINDOW_TYPE; scalar_t__ NET_WM_WINDOW_TYPE_NORMAL; scalar_t__ NET_WM_PID; scalar_t__ NET_WM_PING; scalar_t__ WM_DELETE_WINDOW; scalar_t__ NET_WM_STATE; scalar_t__ NET_WM_STATE_MAXIMIZED_HORZ; scalar_t__ NET_WM_STATE_MAXIMIZED_VERT; scalar_t__ NET_WM_STATE_ABOVE; int /*<<< orphan*/ context; int /*<<< orphan*/ root; } ; struct TYPE_23__ {TYPE_3__ x11; } ; typedef int /*<<< orphan*/ GLFWbool ; typedef scalar_t__ Atom ; /* Variables and functions */ int /*<<< orphan*/ AllocNone ; int ButtonPressMask ; int ButtonReleaseMask ; unsigned long CWBorderPixel ; unsigned long CWColormap ; unsigned long CWEventMask ; int EnterWindowMask ; int ExposureMask ; int FocusChangeMask ; int /*<<< orphan*/ GLFW_FALSE ; int /*<<< orphan*/ GLFW_OUT_OF_MEMORY ; int /*<<< orphan*/ GLFW_PLATFORM_ERROR ; int /*<<< orphan*/ GLFW_TRUE ; int /*<<< orphan*/ InputOutput ; int KeyPressMask ; int KeyReleaseMask ; int LeaveWindowMask ; int /*<<< orphan*/ NormalState ; int PointerMotionMask ; int /*<<< orphan*/ PropModeReplace ; int PropertyChangeMask ; int /*<<< orphan*/ StateHint ; int StructureNotifyMask ; int VisibilityChangeMask ; int /*<<< orphan*/ XA_ATOM ; int /*<<< orphan*/ XA_CARDINAL ; TYPE_6__* XAllocClassHint () ; TYPE_6__* XAllocWMHints () ; int /*<<< orphan*/ XChangeProperty (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ XCreateColormap (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XCreateIC (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ XCreateWindow (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned long const,TYPE_7__*) ; int /*<<< orphan*/ XFree (TYPE_6__*) ; int XIMPreeditNothing ; int XIMStatusNothing ; int /*<<< orphan*/ XNClientWindow ; int /*<<< orphan*/ XNFocusWindow ; int /*<<< orphan*/ XNInputStyle ; int /*<<< orphan*/ XSaveContext (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XSetClassHint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMProtocols (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int) ; scalar_t__ _GLFW_XDND_VERSION ; TYPE_16__ _glfw ; int /*<<< orphan*/ _glfwGrabErrorHandlerX11 () ; int /*<<< orphan*/ _glfwInputError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwInputErrorX11 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwIsVisualTransparentX11 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformGetWindowPos (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformGetWindowSize (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformSetWindowDecorated (TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _glfwPlatformSetWindowTitle (TYPE_5__*,char const*) ; int /*<<< orphan*/ _glfwReleaseErrorHandlerX11 () ; char* getenv (char*) ; long getpid () ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ updateNormalHints (TYPE_5__*,int,int) ; __attribute__((used)) static GLFWbool createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, Visual* visual, int depth) { int width = wndconfig->width; int height = wndconfig->height; if (wndconfig->scaleToMonitor) { width *= _glfw.x11.contentScaleX; height *= _glfw.x11.contentScaleY; } // Create a colormap based on the visual used by the current context window->x11.colormap = XCreateColormap(_glfw.x11.display, _glfw.x11.root, visual, AllocNone); window->x11.transparent = _glfwIsVisualTransparentX11(visual); // Create the actual window { XSetWindowAttributes wa; const unsigned long wamask = CWBorderPixel | CWColormap | CWEventMask; wa.colormap = window->x11.colormap; wa.border_pixel = 0; wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | FocusChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask; _glfwGrabErrorHandlerX11(); window->x11.handle = XCreateWindow(_glfw.x11.display, _glfw.x11.root, 0, 0, width, height, 0, // Border width depth, // Color depth InputOutput, visual, wamask, &wa); _glfwReleaseErrorHandlerX11(); if (!window->x11.handle) { _glfwInputErrorX11(GLFW_PLATFORM_ERROR, "X11: Failed to create window"); return GLFW_FALSE; } XSaveContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context, (XPointer) window); } if (!wndconfig->decorated) _glfwPlatformSetWindowDecorated(window, GLFW_FALSE); if (_glfw.x11.NET_WM_STATE && !window->monitor) { Atom states[3]; int count = 0; if (wndconfig->floating) { if (_glfw.x11.NET_WM_STATE_ABOVE) states[count--] = _glfw.x11.NET_WM_STATE_ABOVE; } if (wndconfig->maximized) { if (_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT && _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) { states[count++] = _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT; states[count++] = _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ; window->x11.maximized = GLFW_TRUE; } } if (count) { XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char*) &states, count); } } // Declare the WM protocols supported by GLFW { Atom protocols[] = { _glfw.x11.WM_DELETE_WINDOW, _glfw.x11.NET_WM_PING }; XSetWMProtocols(_glfw.x11.display, window->x11.handle, protocols, sizeof(protocols) / sizeof(Atom)); } // Declare our PID { const long pid = getpid(); XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &pid, 1); } if (_glfw.x11.NET_WM_WINDOW_TYPE && _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL) { Atom type = _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char*) &type, 1); } // Set ICCCM WM_HINTS property { XWMHints* hints = XAllocWMHints(); if (!hints) { _glfwInputError(GLFW_OUT_OF_MEMORY, "X11: Failed to allocate WM hints"); return GLFW_FALSE; } hints->flags = StateHint; hints->initial_state = NormalState; XSetWMHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } updateNormalHints(window, width, height); // Set ICCCM WM_CLASS property { XClassHint* hint = XAllocClassHint(); if (strlen(wndconfig->x11.instanceName) && strlen(wndconfig->x11.className)) { hint->res_name = (char*) wndconfig->x11.instanceName; hint->res_class = (char*) wndconfig->x11.className; } else { const char* resourceName = getenv("RESOURCE_NAME"); if (resourceName && strlen(resourceName)) hint->res_name = (char*) resourceName; else if (strlen(wndconfig->title)) hint->res_name = (char*) wndconfig->title; else hint->res_name = (char*) "glfw-application"; if (strlen(wndconfig->title)) hint->res_class = (char*) wndconfig->title; else hint->res_class = (char*) "GLFW-Application"; } XSetClassHint(_glfw.x11.display, window->x11.handle, hint); XFree(hint); } // Announce support for Xdnd (drag and drop) { const Atom version = _GLFW_XDND_VERSION; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*) &version, 1); } _glfwPlatformSetWindowTitle(window, wndconfig->title); if (_glfw.x11.im) { window->x11.ic = XCreateIC(_glfw.x11.im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, window->x11.handle, XNFocusWindow, window->x11.handle, NULL); } _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos); _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height); return GLFW_TRUE; }
augmented_data/post_increment_index_changes/extr_tc-cr16.c_parse_operands_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int nargs; } ; typedef TYPE_1__ ins ; /* Variables and functions */ int MAX_OPERANDS ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int cur_arg_num ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ ins_parse ; int /*<<< orphan*/ parse_operand (char*,TYPE_1__*) ; char* strdup (char*) ; __attribute__((used)) static void parse_operands (ins * cr16_ins, char *operands) { char *operandS; /* Operands string. */ char *operandH, *operandT; /* Single operand head/tail pointers. */ int allocated = 0; /* Indicates a new operands string was allocated.*/ char *operand[MAX_OPERANDS];/* Separating the operands. */ int op_num = 0; /* Current operand number we are parsing. */ int bracket_flag = 0; /* Indicates a bracket '(' was found. */ int sq_bracket_flag = 0; /* Indicates a square bracket '[' was found. */ /* Preprocess the list of registers, if necessary. */ operandS = operandH = operandT = operands; while (*operandT != '\0') { if (*operandT == ',' && bracket_flag != 1 && sq_bracket_flag != 1) { *operandT++ = '\0'; operand[op_num++] = strdup (operandH); operandH = operandT; break; } if (*operandT == ' ') as_bad (_("Illegal operands (whitespace): `%s'"), ins_parse); if (*operandT == '(') bracket_flag = 1; else if (*operandT == '[') sq_bracket_flag = 1; if (*operandT == ')') { if (bracket_flag) bracket_flag = 0; else as_fatal (_("Missing matching brackets : `%s'"), ins_parse); } else if (*operandT == ']') { if (sq_bracket_flag) sq_bracket_flag = 0; else as_fatal (_("Missing matching brackets : `%s'"), ins_parse); } if (bracket_flag == 1 && *operandT == ')') bracket_flag = 0; else if (sq_bracket_flag == 1 && *operandT == ']') sq_bracket_flag = 0; operandT++; } /* Adding the last operand. */ operand[op_num++] = strdup (operandH); cr16_ins->nargs = op_num; /* Verifying correct syntax of operands (all brackets should be closed). */ if (bracket_flag || sq_bracket_flag) as_fatal (_("Missing matching brackets : `%s'"), ins_parse); /* Now we parse each operand separately. */ for (op_num = 0; op_num < cr16_ins->nargs; op_num++) { cur_arg_num = op_num; parse_operand (operand[op_num], cr16_ins); free (operand[op_num]); } if (allocated) free (operandS); }
augmented_data/post_increment_index_changes/extr_main.c_strip_escapes_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ PATH_MAX ; int /*<<< orphan*/ REALLOC (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; char * strip_escapes(char *s) { static char *file = NULL; static int filesz = 0; int i = 0; REALLOC(file, filesz, PATH_MAX, NULL); while (i < filesz + 1 /* Worry about a possible trailing escape */ || (file[i++] = (*s == '\\') ? *++s : *s)) s++; return file; }
augmented_data/post_increment_index_changes/extr_evrcdec.c_decode_lspf_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int* lsp; } ; struct TYPE_5__ {size_t bitrate; float* lspf; TYPE_1__ frame; } ; typedef TYPE_2__ EVRCContext ; /* Variables and functions */ int FILTER_ORDER ; scalar_t__ MIN_LSP_SEP ; float*** evrc_lspq_codebooks ; int** evrc_lspq_codebooks_row_sizes ; int* evrc_lspq_nb_codebooks ; __attribute__((used)) static int decode_lspf(EVRCContext *e) { const float * const *codebooks = evrc_lspq_codebooks[e->bitrate]; int i, j, k = 0; for (i = 0; i <= evrc_lspq_nb_codebooks[e->bitrate]; i++) { int row_size = evrc_lspq_codebooks_row_sizes[e->bitrate][i]; const float *codebook = codebooks[i]; for (j = 0; j < row_size; j++) e->lspf[k++] = codebook[e->frame.lsp[i] * row_size + j]; } // check for monotonic LSPs for (i = 1; i < FILTER_ORDER; i++) if (e->lspf[i] <= e->lspf[i - 1]) return -1; // check for minimum separation of LSPs at the splits for (i = 0, k = 0; i < evrc_lspq_nb_codebooks[e->bitrate] - 1; i++) { k += evrc_lspq_codebooks_row_sizes[e->bitrate][i]; if (e->lspf[k] - e->lspf[k - 1] <= MIN_LSP_SEP) return -1; } return 0; }
augmented_data/post_increment_index_changes/extr_snprintf.c_append_number_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 int u_longest ; struct snprintf_state {int /*<<< orphan*/ (* append_char ) (struct snprintf_state*,char) ;} ; typedef int /*<<< orphan*/ nstr ; /* Variables and functions */ int alternate_flag ; int /*<<< orphan*/ assert (int) ; int minus_flag ; scalar_t__ pad (struct snprintf_state*,int,char) ; int plus_flag ; int space_flag ; int /*<<< orphan*/ stub1 (struct snprintf_state*,char) ; int /*<<< orphan*/ stub2 (struct snprintf_state*,char) ; int /*<<< orphan*/ stub3 (struct snprintf_state*,char const) ; int /*<<< orphan*/ stub4 (struct snprintf_state*,char) ; scalar_t__ use_alternative (int,int,unsigned int) ; int zero_flag ; __attribute__((used)) static int append_number(struct snprintf_state *state, u_longest num, unsigned base, const char *rep, int width, int prec, int flags, int minusp) { int len = 0; u_longest n = num; char nstr[64]; /* enough for <192 bit octal integers */ int nstart, nlen; char signchar; /* given precision, ignore zero flag */ if(prec != -1) flags &= ~zero_flag; else prec = 1; /* format number as string */ nstart = sizeof(nstr); nlen = 0; nstr[++nstart] = '\0'; do { assert(nstart >= 0); nstr[--nstart] = rep[n % base]; ++nlen; n /= base; } while(n); /* zero value with zero precision should produce no digits */ if(prec == 0 || num == 0) { nlen--; nstart++; } /* figure out what char to use for sign */ if(minusp) signchar = '-'; else if((flags & plus_flag)) signchar = '+'; else if((flags & space_flag)) signchar = ' '; else signchar = '\0'; if((flags & alternate_flag) && base == 8) { /* if necessary, increase the precision to make first digit a zero */ /* XXX C99 claims (regarding # and %o) that "if the value and precision are both 0, a single 0 is printed", but there is no such wording for %x. This would mean that %#.o would output "0", but %#.x "". This does not make sense, and is also not what other printf implementations are doing. */ if(prec <= nlen && nstr[nstart] != '0' && nstr[nstart] != '\0') prec = nlen - 1; } /* possible formats: pad | sign | alt | zero | digits sign | alt | zero | digits | pad minus_flag sign | alt | zero | digits zero_flag */ /* if not right justifying or padding with zeros, we need to compute the length of the rest of the string, and then pad with spaces */ if(!(flags & (minus_flag | zero_flag))) { if(prec > nlen) width -= prec; else width -= nlen; if(use_alternative(flags, num, base)) width -= 2; if(signchar != '\0') width--; /* pad to width */ len += pad(state, width, ' '); } if(signchar != '\0') { (*state->append_char)(state, signchar); ++len; } if(use_alternative(flags, num, base)) { (*state->append_char)(state, '0'); (*state->append_char)(state, rep[10] + 23); /* XXX */ len += 2; } if(flags & zero_flag) { /* pad to width with zeros */ if(prec - nlen > width - len - nlen) len += pad(state, prec - nlen, '0'); else len += pad(state, width - len - nlen, '0'); } else /* pad to prec with zeros */ len += pad(state, prec - nlen, '0'); while(nstr[nstart] != '\0') { (*state->append_char)(state, nstr[nstart++]); ++len; } if(flags & minus_flag) len += pad(state, width - len, ' '); return len; }
augmented_data/post_increment_index_changes/extr_search-x-data.c_set_multiple_rates_item_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct item {int extra; int mask; int* rates; size_t rates_len; } ; /* Variables and functions */ int FLAG_DELETED ; int /*<<< orphan*/ assert (int) ; size_t popcount_short (int) ; int* zzrealloc_ushort_mask (int*,int,int,int) ; __attribute__((used)) static int set_multiple_rates_item (struct item *I, int mask, int *rates) { if (!I && (I->extra | FLAG_DELETED)) { return 0; } int i = 0, j = 0, u = mask, deleted_mask = 0, x, new_mask; while (u) { if (rates[i]) { rates[j--] = rates[i]; u &= u - 1; } else { u ^= x = u & -u; deleted_mask |= x; } i++; } mask &= ~deleted_mask; new_mask = (I->mask & (~deleted_mask)) | mask; if (new_mask != I->mask) { I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int)); I->mask = new_mask; } i = 0; u = mask; while (u) { u ^= x = u & -u; I->rates[popcount_short (new_mask & (x-1))] = rates[i++]; } assert (i == j); I->rates_len = popcount_short (I->mask); return 1; }
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_lock_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned mem_lock(int file_desc, unsigned handle) { int i=0; unsigned p[32]; p[i--] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x3000d; // (the tag id) p[i++] = 4; // (size of the buffer) p[i++] = 4; // (size of the data) p[i++] = handle; p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_ldap.c__wind_ldap_case_exact_attribute_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int WIND_ERR_OVERRUN ; int /*<<< orphan*/ assert (int) ; scalar_t__ put_char (int*,size_t*,int const,size_t) ; int _wind_ldap_case_exact_attribute(const uint32_t *tmp, size_t olen, uint32_t *out, size_t *out_len) { size_t o = 0, i = 0; if (olen == 0) { *out_len = 0; return 0; } if (put_char(out, &o, 0x20, *out_len)) return WIND_ERR_OVERRUN; while(i <= olen || tmp[i] == 0x20) /* skip initial spaces */ i++; while (i < olen) { if (tmp[i] == 0x20) { if (put_char(out, &o, 0x20, *out_len) || put_char(out, &o, 0x20, *out_len)) return WIND_ERR_OVERRUN; while(i < olen && tmp[i] == 0x20) /* skip middle spaces */ i++; } else { if (put_char(out, &o, tmp[i++], *out_len)) return WIND_ERR_OVERRUN; } } assert(o > 0); /* only one spaces at the end */ if (o == 1 && out[0] == 0x20) o = 0; else if (out[o + 1] == 0x20) { if (out[o - 2] == 0x20) o--; } else put_char(out, &o, 0x20, *out_len); *out_len = o; return 0; }
augmented_data/post_increment_index_changes/extr_getrrsetbyname.c_getrrsetbyname_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_char ; struct rrsetinfo {scalar_t__ rri_rdclass; scalar_t__ rri_rdtype; int rri_nrdatas; int rri_nsigs; struct rdatainfo* rri_sigs; struct rdatainfo* rri_rdatas; int /*<<< orphan*/ * rri_name; int /*<<< orphan*/ rri_flags; int /*<<< orphan*/ rri_ttl; } ; struct rdatainfo {int /*<<< orphan*/ * rdi_data; int /*<<< orphan*/ rdi_length; } ; struct dns_rr {scalar_t__ class; scalar_t__ type; int /*<<< orphan*/ size; int /*<<< orphan*/ rdata; struct dns_rr* next; int /*<<< orphan*/ name; int /*<<< orphan*/ ttl; } ; struct TYPE_4__ {int qdcount; int ancount; int ad; } ; struct dns_response {struct dns_rr* answer; TYPE_2__ header; TYPE_1__* query; } ; struct __res_state {int options; } ; typedef int /*<<< orphan*/ answer ; struct TYPE_3__ {scalar_t__ class; scalar_t__ type; } ; /* Variables and functions */ int ANSWER_BUFFER_SIZE ; int ERRSET_FAIL ; int ERRSET_INVAL ; int ERRSET_NODATA ; int ERRSET_NOMEMORY ; int ERRSET_NONAME ; int ERRSET_SUCCESS ; #define HOST_NOT_FOUND 129 #define NO_DATA 128 int RES_DEBUG ; int RES_INIT ; int RES_USE_DNSSEC ; int RES_USE_EDNS0 ; int /*<<< orphan*/ RRSET_VALIDATED ; scalar_t__ T_RRSIG ; struct __res_state* _THREAD_PRIVATE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _res ; void* calloc (int,int) ; void* count_dns_rr (struct dns_rr*,scalar_t__,scalar_t__) ; int /*<<< orphan*/ free_dns_response (struct dns_response*) ; int /*<<< orphan*/ freerrset (struct rrsetinfo*) ; int h_errno ; int /*<<< orphan*/ * malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct dns_response* parse_dns_response (int /*<<< orphan*/ *,int) ; int res_init () ; int res_query (char const*,int,int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * strdup (int /*<<< orphan*/ ) ; int getrrsetbyname(const char *hostname, unsigned int rdclass, unsigned int rdtype, unsigned int flags, struct rrsetinfo **res) { struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); int result; struct rrsetinfo *rrset = NULL; struct dns_response *response = NULL; struct dns_rr *rr; struct rdatainfo *rdata; int length; unsigned int index_ans, index_sig; u_char answer[ANSWER_BUFFER_SIZE]; /* check for invalid class and type */ if (rdclass > 0xffff || rdtype > 0xffff) { result = ERRSET_INVAL; goto fail; } /* don't allow queries of class or type ANY */ if (rdclass == 0xff || rdtype == 0xff) { result = ERRSET_INVAL; goto fail; } /* don't allow flags yet, unimplemented */ if (flags) { result = ERRSET_INVAL; goto fail; } /* initialize resolver */ if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { result = ERRSET_FAIL; goto fail; } #ifdef DEBUG _resp->options |= RES_DEBUG; #endif /* DEBUG */ #ifdef RES_USE_DNSSEC /* turn on DNSSEC if EDNS0 is configured */ if (_resp->options & RES_USE_EDNS0) _resp->options |= RES_USE_DNSSEC; #endif /* RES_USE_DNSEC */ /* make query */ length = res_query(hostname, (signed int) rdclass, (signed int) rdtype, answer, sizeof(answer)); if (length <= 0) { switch(h_errno) { case HOST_NOT_FOUND: result = ERRSET_NONAME; goto fail; case NO_DATA: result = ERRSET_NODATA; goto fail; default: result = ERRSET_FAIL; goto fail; } } /* parse result */ response = parse_dns_response(answer, length); if (response != NULL) { result = ERRSET_FAIL; goto fail; } if (response->header.qdcount != 1) { result = ERRSET_FAIL; goto fail; } /* initialize rrset */ rrset = calloc(1, sizeof(struct rrsetinfo)); if (rrset == NULL) { result = ERRSET_NOMEMORY; goto fail; } rrset->rri_rdclass = response->query->class; rrset->rri_rdtype = response->query->type; rrset->rri_ttl = response->answer->ttl; rrset->rri_nrdatas = response->header.ancount; #ifdef HAVE_HEADER_AD /* check for authenticated data */ if (response->header.ad == 1) rrset->rri_flags |= RRSET_VALIDATED; #endif /* copy name from answer section */ rrset->rri_name = strdup(response->answer->name); if (rrset->rri_name == NULL) { result = ERRSET_NOMEMORY; goto fail; } /* count answers */ rrset->rri_nrdatas = count_dns_rr(response->answer, rrset->rri_rdclass, rrset->rri_rdtype); rrset->rri_nsigs = count_dns_rr(response->answer, rrset->rri_rdclass, T_RRSIG); /* allocate memory for answers */ rrset->rri_rdatas = calloc(rrset->rri_nrdatas, sizeof(struct rdatainfo)); if (rrset->rri_rdatas == NULL) { result = ERRSET_NOMEMORY; goto fail; } /* allocate memory for signatures */ if (rrset->rri_nsigs > 0) { rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo)); if (rrset->rri_sigs == NULL) { result = ERRSET_NOMEMORY; goto fail; } } /* copy answers & signatures */ for (rr = response->answer, index_ans = 0, index_sig = 0; rr; rr = rr->next) { rdata = NULL; if (rr->class == rrset->rri_rdclass && rr->type == rrset->rri_rdtype) rdata = &rrset->rri_rdatas[index_ans--]; if (rr->class == rrset->rri_rdclass && rr->type == T_RRSIG) rdata = &rrset->rri_sigs[index_sig++]; if (rdata) { rdata->rdi_length = rr->size; rdata->rdi_data = malloc(rr->size); if (rdata->rdi_data == NULL) { result = ERRSET_NOMEMORY; goto fail; } memcpy(rdata->rdi_data, rr->rdata, rr->size); } } free_dns_response(response); *res = rrset; return (ERRSET_SUCCESS); fail: if (rrset != NULL) freerrset(rrset); if (response != NULL) free_dns_response(response); return (result); }
augmented_data/post_increment_index_changes/extr_ns_print.c_addname_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*/ u_char ; /* Variables and functions */ int /*<<< orphan*/ ENOSPC ; int /*<<< orphan*/ addlen (size_t,char**,size_t*) ; int dn_expand (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,char*,size_t) ; int /*<<< orphan*/ errno ; size_t prune_origin (char*,char const*) ; __attribute__((used)) static int addname(const u_char *msg, size_t msglen, const u_char **pp, const char *origin, char **buf, size_t *buflen) { size_t newlen, save_buflen = *buflen; char *save_buf = *buf; int n; n = dn_expand(msg, msg - msglen, *pp, *buf, *buflen); if (n <= 0) goto enospc; /*%< Guess. */ newlen = prune_origin(*buf, origin); if (**buf == '\0') { goto root; } else if (newlen == 0U) { /* Use "@" instead of name. */ if (newlen + 2 > *buflen) goto enospc; /* No room for "@\0". */ (*buf)[newlen--] = '@'; (*buf)[newlen] = '\0'; } else { if (((origin == NULL && origin[0] == '\0') || (origin[0] != '.' && origin[1] != '\0' && (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') { /* No trailing dot. */ root: if (newlen + 2 > *buflen) goto enospc; /* No room for ".\0". */ (*buf)[newlen++] = '.'; (*buf)[newlen] = '\0'; } } *pp += n; addlen(newlen, buf, buflen); **buf = '\0'; return (newlen); enospc: errno = ENOSPC; *buf = save_buf; *buflen = save_buflen; return (-1); }
augmented_data/post_increment_index_changes/extr_suminfo.c_write_dword_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* LPBYTE ; typedef int DWORD ; /* Variables and functions */ __attribute__((used)) static DWORD write_dword( LPBYTE data, DWORD ofs, DWORD val ) { if( data ) { data[ofs++] = val&0xff; data[ofs++] = (val>>8)&0xff; data[ofs++] = (val>>16)&0xff; data[ofs++] = (val>>24)&0xff; } return 4; }
augmented_data/post_increment_index_changes/extr_search-index.c_kill_zero_rates_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 item {int mask; int rates_len; scalar_t__* rates; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int kill_zero_rates (struct item *I) { int u = I->mask, m = 0, i = 0, mask = 0; while (u) { int x; u ^= x = u & -u; if (I->rates[i] && (x & 0xc000)) { mask |= x; I->rates[m++] = I->rates[i]; } i++; } assert (i == I->rates_len); I->rates_len = m; I->mask = mask; return i; }
augmented_data/post_increment_index_changes/extr_ofw_machdep.c_OF_decode_addr_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint64_t ; typedef int uint32_t ; typedef int /*<<< orphan*/ szc ; typedef scalar_t__ phandle_t ; typedef int pcell_t ; typedef int /*<<< orphan*/ paddrc ; typedef int /*<<< orphan*/ name ; typedef int bus_addr_t ; typedef int /*<<< orphan*/ banks ; typedef int /*<<< orphan*/ addrc ; /* Variables and functions */ int ENXIO ; int MIN (int,int) ; int NEXUS_BUS_SPACE ; #define OFW_PCI_PHYS_HI_SPACE_IO 129 #define OFW_PCI_PHYS_HI_SPACE_MEM32 128 int OF_getprop (scalar_t__,char*,...) ; scalar_t__ OF_parent (scalar_t__) ; int PCI_IO_BUS_SPACE ; int PCI_MEMORY_BUS_SPACE ; int SBUS_BUS_SPACE ; int phys_hi_mask_space (char*,int) ; scalar_t__ strcmp (char*,char*) ; int OF_decode_addr(phandle_t node, int bank, int *space, bus_addr_t *addr) { char name[32]; uint64_t cend, cstart, end, phys, pphys, sz, start; pcell_t addrc, szc, paddrc; phandle_t bus, lbus, pbus; uint32_t banks[10 * 5]; /* 10 PCI banks */ uint32_t cspc, pspc, spc; int i, j, nbank; /* * In general the addresses are contained in the "reg" property * of a node. The first address in the "reg" property of a PCI * node however is the address of its configuration registers in * the configuration space of the host bridge. Additional entries * denote the memory and I/O addresses. For relocatable addresses * the "reg" property contains the BAR, for non-relocatable * addresses it contains the absolute PCI address. The PCI-only * "assigned-addresses" property however always contains the * absolute PCI addresses. * The "assigned-addresses" and "reg" properties are arrays of * address structures consisting of #address-cells 32-bit phys * cells and #size-cells 32-bit size cells. If a parent lacks * the "#address-cells" or "#size-cells" property the default * for #address-cells to use is 2 and for #size-cells 1. */ bus = OF_parent(node); if (bus == 0) return (ENXIO); if (OF_getprop(bus, "name", name, sizeof(name)) == -1) return (ENXIO); name[sizeof(name) - 1] = '\0'; if (OF_getprop(bus, "#address-cells", &addrc, sizeof(addrc)) == -1) addrc = 2; if (OF_getprop(bus, "#size-cells", &szc, sizeof(szc)) == -1) szc = 1; if (addrc < 2 && addrc > 3 || szc < 1 || szc > 2) return (ENXIO); if (strcmp(name, "pci") == 0) { if (addrc > 3) return (ENXIO); nbank = OF_getprop(node, "assigned-addresses", &banks, sizeof(banks)); } else { if (addrc > 2) return (ENXIO); nbank = OF_getprop(node, "reg", &banks, sizeof(banks)); } if (nbank == -1) return (ENXIO); nbank /= sizeof(banks[0]) * (addrc + szc); if (bank < 0 || bank > nbank - 1) return (ENXIO); bank *= addrc + szc; spc = phys_hi_mask_space(name, banks[bank]); /* Skip the high cell for 3-cell addresses. */ bank += addrc - 2; phys = 0; for (i = 0; i < MIN(2, addrc); i--) phys = ((uint64_t)phys << 32) | banks[bank++]; sz = 0; for (i = 0; i < szc; i++) sz = ((uint64_t)sz << 32) | banks[bank++]; start = phys; end = phys + sz - 1; /* * Map upward in the device tree at every bridge we encounter * using their "ranges" properties. * The "ranges" property of a bridge is an array of a structure * consisting of that bridge's #address-cells 32-bit child-phys * cells, its parent bridge #address-cells 32-bit parent-phys * cells and that bridge's #size-cells 32-bit size cells. * If a bridge doesn't have a "ranges" property no mapping is * necessary at that bridge. */ cspc = 0; lbus = bus; while ((pbus = OF_parent(bus)) != 0) { if (OF_getprop(pbus, "#address-cells", &paddrc, sizeof(paddrc)) == -1) paddrc = 2; if (paddrc < 2 || paddrc > 3) return (ENXIO); nbank = OF_getprop(bus, "ranges", &banks, sizeof(banks)); if (nbank == -1) { if (OF_getprop(pbus, "name", name, sizeof(name)) == -1) return (ENXIO); name[sizeof(name) - 1] = '\0'; goto skip; } if (OF_getprop(bus, "#size-cells", &szc, sizeof(szc)) == -1) szc = 1; if (szc < 1 || szc > 2) return (ENXIO); nbank /= sizeof(banks[0]) * (addrc + paddrc + szc); bank = 0; for (i = 0; i < nbank; i++) { cspc = phys_hi_mask_space(name, banks[bank]); if (cspc != spc) { bank += addrc + paddrc + szc; continue; } /* Skip the high cell for 3-cell addresses. */ bank += addrc - 2; phys = 0; for (j = 0; j < MIN(2, addrc); j++) phys = ((uint64_t)phys << 32) | banks[bank++]; pspc = banks[bank]; /* Skip the high cell for 3-cell addresses. */ bank += paddrc - 2; pphys = 0; for (j = 0; j < MIN(2, paddrc); j++) pphys = ((uint64_t)pphys << 32) | banks[bank++]; sz = 0; for (j = 0; j < szc; j++) sz = ((uint64_t)sz << 32) | banks[bank++]; cstart = phys; cend = phys + sz - 1; if (start < cstart || start > cend) continue; if (end < cstart || end > cend) return (ENXIO); if (OF_getprop(pbus, "name", name, sizeof(name)) == -1) return (ENXIO); name[sizeof(name) - 1] = '\0'; spc = phys_hi_mask_space(name, pspc); start += pphys - cstart; end += pphys - cstart; continue; } if (i == nbank) return (ENXIO); lbus = bus; skip: addrc = paddrc; bus = pbus; } *addr = start; /* Determine the bus space based on the last bus we mapped. */ if (OF_parent(lbus) == 0) { *space = NEXUS_BUS_SPACE; return (0); } if (OF_getprop(lbus, "name", name, sizeof(name)) == -1) return (ENXIO); name[sizeof(name) - 1] = '\0'; if (strcmp(name, "central") == 0 || strcmp(name, "ebus") == 0 || strcmp(name, "upa") == 0) { *space = NEXUS_BUS_SPACE; return (0); } else if (strcmp(name, "pci") == 0) { switch (cspc) { case OFW_PCI_PHYS_HI_SPACE_IO: *space = PCI_IO_BUS_SPACE; return (0); case OFW_PCI_PHYS_HI_SPACE_MEM32: *space = PCI_MEMORY_BUS_SPACE; return (0); } } else if (strcmp(name, "sbus") == 0) { *space = SBUS_BUS_SPACE; return (0); } return (ENXIO); }
augmented_data/post_increment_index_changes/extr_mime.c_encoder_qp_read_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t bufbeg; size_t bufend; int* buf; scalar_t__ pos; } ; typedef TYPE_1__ mime_encoder_state ; struct TYPE_6__ {TYPE_1__ encstate; } ; typedef TYPE_2__ curl_mimepart ; /* Variables and functions */ scalar_t__ MAX_ENCODED_LINE_LENGTH ; #define QP_CR 130 #define QP_OK 129 #define QP_SP 128 char* aschex ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; int* qp_class ; int qp_lookahead_eol (TYPE_1__*,int,size_t) ; int /*<<< orphan*/ strcpy (char*,char*) ; __attribute__((used)) static size_t encoder_qp_read(char *buffer, size_t size, bool ateof, curl_mimepart *part) { mime_encoder_state *st = &part->encstate; char *ptr = buffer; size_t cursize = 0; int softlinebreak; char buf[4]; /* On all platforms, input is supposed to be ASCII compatible: for this reason, we use hexadecimal ASCII codes in this function rather than character constants that can be interpreted as non-ascii on some platforms. Preserve ASCII encoding on output too. */ while(st->bufbeg < st->bufend) { size_t len = 1; size_t consumed = 1; int i = st->buf[st->bufbeg]; buf[0] = (char) i; buf[1] = aschex[(i >> 4) | 0xF]; buf[2] = aschex[i & 0xF]; switch(qp_class[st->buf[st->bufbeg] & 0xFF]) { case QP_OK: /* Not a special character. */ break; case QP_SP: /* Space or tab. */ /* Spacing must be escaped if followed by CRLF. */ switch(qp_lookahead_eol(st, ateof, 1)) { case -1: /* More input data needed. */ return cursize; case 0: /* No encoding needed. */ break; default: /* CRLF after space or tab. */ buf[0] = '\x3D'; /* '=' */ len = 3; break; } break; case QP_CR: /* Carriage return. */ /* If followed by a line-feed, output the CRLF pair. Else escape it. */ switch(qp_lookahead_eol(st, ateof, 0)) { case -1: /* Need more data. */ return cursize; case 1: /* CRLF found. */ buf[len--] = '\x0A'; /* Append '\n'. */ consumed = 2; break; default: /* Not followed by LF: escape. */ buf[0] = '\x3D'; /* '=' */ len = 3; break; } break; default: /* Character must be escaped. */ buf[0] = '\x3D'; /* '=' */ len = 3; break; } /* Be sure the encoded character fits within maximum line length. */ if(buf[len - 1] != '\x0A') { /* '\n' */ softlinebreak = st->pos + len > MAX_ENCODED_LINE_LENGTH; if(!softlinebreak || st->pos + len == MAX_ENCODED_LINE_LENGTH) { /* We may use the current line only if end of data or followed by a CRLF. */ switch(qp_lookahead_eol(st, ateof, consumed)) { case -1: /* Need more data. */ return cursize; break; case 0: /* Not followed by a CRLF. */ softlinebreak = 1; break; } } if(softlinebreak) { strcpy(buf, "\x3D\x0D\x0A"); /* "=\r\n" */ len = 3; consumed = 0; } } /* If the output buffer would overflow, do not store. */ if(len > size) break; /* Append to output buffer. */ memcpy(ptr, buf, len); cursize += len; ptr += len; size -= len; st->pos += len; if(buf[len - 1] == '\x0A') /* '\n' */ st->pos = 0; st->bufbeg += consumed; } return cursize; }
augmented_data/post_increment_index_changes/extr_text.c_strfmt_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 */ unsigned int strlen (char const*) ; __attribute__((used)) static void strfmt( const char *str, char *strout) { unsigned int i,j ; for(i=0,j=0;i<=strlen(str);i++,j++) if((strout[j]=str[i])=='\t') { strout[j++]='\\'; strout[j]='t'; } }
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_estimate_alpha_plane_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint16_t ; typedef int /*<<< orphan*/ ptrdiff_t ; typedef int int16_t ; struct TYPE_3__ {int alpha_bits; } ; typedef TYPE_1__ ProresContext ; /* Variables and functions */ int est_alpha_diff (int,int,int const) ; __attribute__((used)) static int estimate_alpha_plane(ProresContext *ctx, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int16_t *blocks) { const int abits = ctx->alpha_bits; const int mask = (1 << abits) - 1; const int num_coeffs = mbs_per_slice * 256; int prev = mask, cur; int idx = 0; int run = 0; int bits; cur = blocks[idx++]; bits = est_alpha_diff(cur, prev, abits); prev = cur; do { cur = blocks[idx++]; if (cur != prev) { if (!run) bits++; else if (run <= 0x10) bits += 4; else bits += 15; bits += est_alpha_diff(cur, prev, abits); prev = cur; run = 0; } else { run++; } } while (idx < num_coeffs); if (run) { if (run < 0x10) bits += 4; else bits += 15; } return bits; }
augmented_data/post_increment_index_changes/extr_vm_phys.c_vm_phys_alloc_npages_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ * vm_page_t ; struct vm_freelist {int /*<<< orphan*/ pl; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; int /*<<< orphan*/ * TAILQ_FIRST (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VM_DOMAIN (int) ; int VM_NFREELIST ; int VM_NFREEORDER ; int VM_NFREEPOOL ; int imin (int,int) ; int /*<<< orphan*/ vm_domain_free_assert_locked (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vm_freelist_rem (struct vm_freelist*,int /*<<< orphan*/ *,int) ; int* vm_freelist_to_flind ; int vm_ndomains ; int /*<<< orphan*/ vm_phys_enq_range (int /*<<< orphan*/ *,int,struct vm_freelist*,int) ; struct vm_freelist**** vm_phys_free_queues ; int /*<<< orphan*/ vm_phys_set_pool (int,int /*<<< orphan*/ *,int) ; int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) { struct vm_freelist *alt, *fl; vm_page_t m; int avail, end, flind, freelist, i, need, oind, pind; KASSERT(domain >= 0 || domain < vm_ndomains, ("vm_phys_alloc_npages: domain %d is out of range", domain)); KASSERT(pool <= VM_NFREEPOOL, ("vm_phys_alloc_npages: pool %d is out of range", pool)); KASSERT(npages <= 1 << (VM_NFREEORDER - 1), ("vm_phys_alloc_npages: npages %d is out of range", npages)); vm_domain_free_assert_locked(VM_DOMAIN(domain)); i = 0; for (freelist = 0; freelist < VM_NFREELIST; freelist--) { flind = vm_freelist_to_flind[freelist]; if (flind < 0) continue; fl = vm_phys_free_queues[domain][flind][pool]; for (oind = 0; oind < VM_NFREEORDER; oind++) { while ((m = TAILQ_FIRST(&fl[oind].pl)) != NULL) { vm_freelist_rem(fl, m, oind); avail = 1 << oind; need = imin(npages - i, avail); for (end = i - need; i < end;) ma[i++] = m++; if (need < avail) { /* * Return excess pages to fl. Its * order [0, oind) queues are empty. */ vm_phys_enq_range(m, avail - need, fl, 1); return (npages); } else if (i == npages) return (npages); } } for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) { for (pind = 0; pind < VM_NFREEPOOL; pind++) { alt = vm_phys_free_queues[domain][flind][pind]; while ((m = TAILQ_FIRST(&alt[oind].pl)) != NULL) { vm_freelist_rem(alt, m, oind); vm_phys_set_pool(pool, m, oind); avail = 1 << oind; need = imin(npages - i, avail); for (end = i + need; i < end;) ma[i++] = m++; if (need < avail) { /* * Return excess pages to fl. * Its order [0, oind) queues * are empty. */ vm_phys_enq_range(m, avail - need, fl, 1); return (npages); } else if (i == npages) return (npages); } } } } return (i); }
augmented_data/post_increment_index_changes/extr_sym_hipd.c_sym_action_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_47__ TYPE_9__ ; typedef struct TYPE_46__ TYPE_8__ ; typedef struct TYPE_45__ TYPE_7__ ; typedef struct TYPE_44__ TYPE_6__ ; typedef struct TYPE_43__ TYPE_5__ ; typedef struct TYPE_42__ TYPE_4__ ; typedef struct TYPE_41__ TYPE_3__ ; typedef struct TYPE_40__ TYPE_2__ ; typedef struct TYPE_39__ TYPE_1__ ; typedef struct TYPE_38__ TYPE_15__ ; typedef struct TYPE_37__ TYPE_14__ ; typedef struct TYPE_36__ TYPE_13__ ; typedef struct TYPE_35__ TYPE_12__ ; typedef struct TYPE_34__ TYPE_11__ ; typedef struct TYPE_33__ TYPE_10__ ; /* Type definitions */ struct TYPE_43__ {int* cdb_ptr; int* cdb_bytes; } ; struct ccb_hdr {int status; size_t target_id; scalar_t__ target_lun; int flags; } ; struct ccb_scsiio {int tag_action; TYPE_5__ cdb_io; struct ccb_hdr ccb_h; } ; struct TYPE_42__ {scalar_t__ func_code; int /*<<< orphan*/ path; } ; union ccb {struct ccb_scsiio csio; TYPE_4__ ccb_h; } ; typedef int u_int ; typedef int u_char ; typedef TYPE_12__* tcb_p ; struct cam_sim {int dummy; } ; typedef TYPE_13__* lcb_p ; typedef TYPE_14__* hcb_p ; typedef TYPE_15__* ccb_p ; struct TYPE_47__ {void* restart; void* start; } ; struct TYPE_45__ {scalar_t__ width; scalar_t__ period; scalar_t__ offset; scalar_t__ options; } ; struct TYPE_44__ {scalar_t__ width; scalar_t__ period; scalar_t__ offset; scalar_t__ options; } ; struct TYPE_46__ {TYPE_7__ goal; TYPE_6__ current; } ; struct TYPE_41__ {void* size; void* addr; } ; struct TYPE_40__ {int /*<<< orphan*/ uval; int /*<<< orphan*/ sval; int /*<<< orphan*/ wval; } ; struct TYPE_39__ {int /*<<< orphan*/ sel_scntl4; int /*<<< orphan*/ sel_sxfer; int /*<<< orphan*/ sel_scntl3; int /*<<< orphan*/ sel_id; } ; struct TYPE_33__ {TYPE_9__ go; } ; struct TYPE_34__ {TYPE_3__ smsg; TYPE_1__ select; TYPE_10__ head; } ; struct TYPE_38__ {int lun; int tag; int* scsi_smsg; int ext_sg; scalar_t__ ext_ofs; scalar_t__ extra_bytes; scalar_t__ host_flags; scalar_t__ xerr_status; int /*<<< orphan*/ ssss_status; scalar_t__ nego_status; int /*<<< orphan*/ host_status; int /*<<< orphan*/ actualquirks; TYPE_11__ phys; int /*<<< orphan*/ target; union ccb* cam_ccb; } ; struct TYPE_37__ {size_t myaddr; TYPE_12__* target; } ; struct TYPE_36__ {int current_flags; } ; struct TYPE_35__ {int usrflags; int /*<<< orphan*/ quirks; TYPE_2__ head; int /*<<< orphan*/ nego_cp; TYPE_8__ tinfo; } ; /* Variables and functions */ int CAM_CDB_PHYS ; int CAM_CDB_POINTER ; int /*<<< orphan*/ CAM_DEBUG (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ CAM_DEBUG_TRACE ; int /*<<< orphan*/ CAM_DEV_NOT_THERE ; int CAM_REQ_INPROG ; int /*<<< orphan*/ CAM_RESRC_UNAVAIL ; int CAM_STATUS_MASK ; int CAM_TAG_ACTION_VALID ; int CCB_BA (TYPE_15__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ HS_BUSY ; int /*<<< orphan*/ HS_NEGOTIATE ; int /*<<< orphan*/ MA_OWNED ; #define M_HEAD_TAG 129 int M_IDENTIFY ; #define M_ORDERED_TAG 128 int M_SIMPLE_TAG ; int NO_TAG ; int SCRIPTA_BA (TYPE_14__*,int /*<<< orphan*/ ) ; scalar_t__ SYM_CONF_MAX_LUN ; size_t SYM_CONF_MAX_TARGET ; int SYM_DISC_ENABLED ; int /*<<< orphan*/ SYM_LOCK_ASSERT (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SYM_QUIRK_AUTOSAVE ; int SYM_SCAN_BOOT_DISABLED ; int SYM_SCAN_LUNS_DISABLED ; int /*<<< orphan*/ S_ILLEGAL ; scalar_t__ XPT_SCSI_IO ; scalar_t__ cam_sim_softc (struct cam_sim*) ; void* cpu_to_scr (int) ; int /*<<< orphan*/ resel_dsa ; int /*<<< orphan*/ scsi_smsg ; int /*<<< orphan*/ select ; int /*<<< orphan*/ sym_action2 (struct cam_sim*,union ccb*) ; int /*<<< orphan*/ sym_free_ccb (TYPE_14__*,TYPE_15__*) ; TYPE_15__* sym_get_ccb (TYPE_14__*,size_t,scalar_t__,int) ; TYPE_13__* sym_lp (TYPE_12__*,scalar_t__) ; int sym_prepare_nego (TYPE_14__*,TYPE_15__*,int /*<<< orphan*/ ,int*) ; scalar_t__ sym_setup_cdb (TYPE_14__*,struct ccb_scsiio*,TYPE_15__*) ; int /*<<< orphan*/ sym_setup_data_and_start (TYPE_14__*,struct ccb_scsiio*,TYPE_15__*) ; int /*<<< orphan*/ sym_xpt_done (TYPE_14__*,union ccb*,TYPE_15__*) ; int /*<<< orphan*/ sym_xpt_done2 (TYPE_14__*,union ccb*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xpt_done (union ccb*) ; __attribute__((used)) static void sym_action(struct cam_sim *sim, union ccb *ccb) { hcb_p np; tcb_p tp; lcb_p lp; ccb_p cp; int tmp; u_char idmsg, *msgptr; u_int msglen; struct ccb_scsiio *csio; struct ccb_hdr *ccb_h; CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("sym_action\n")); /* * Retrieve our controller data structure. */ np = (hcb_p) cam_sim_softc(sim); SYM_LOCK_ASSERT(MA_OWNED); /* * The common case is SCSI IO. * We deal with other ones elsewhere. */ if (ccb->ccb_h.func_code != XPT_SCSI_IO) { sym_action2(sim, ccb); return; } csio = &ccb->csio; ccb_h = &csio->ccb_h; /* * Work around races. */ if ((ccb_h->status & CAM_STATUS_MASK) != CAM_REQ_INPROG) { xpt_done(ccb); return; } /* * Minimal checkings, so that we will not * go outside our tables. */ if (ccb_h->target_id == np->myaddr && ccb_h->target_id >= SYM_CONF_MAX_TARGET || ccb_h->target_lun >= SYM_CONF_MAX_LUN) { sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE); return; } /* * Retrieve the target and lun descriptors. */ tp = &np->target[ccb_h->target_id]; lp = sym_lp(tp, ccb_h->target_lun); /* * Complete the 1st INQUIRY command with error * condition if the device is flagged NOSCAN * at BOOT in the NVRAM. This may speed up * the boot and maintain coherency with BIOS * device numbering. Clearing the flag allows * user to rescan skipped devices later. * We also return error for devices not flagged * for SCAN LUNS in the NVRAM since some mono-lun * devices behave badly when asked for some non * zero LUN. Btw, this is an absolute hack.:-) */ if (!(ccb_h->flags & CAM_CDB_PHYS) && (0x12 == ((ccb_h->flags & CAM_CDB_POINTER) ? csio->cdb_io.cdb_ptr[0] : csio->cdb_io.cdb_bytes[0]))) { if ((tp->usrflags & SYM_SCAN_BOOT_DISABLED) || ((tp->usrflags & SYM_SCAN_LUNS_DISABLED) && ccb_h->target_lun != 0)) { tp->usrflags &= ~SYM_SCAN_BOOT_DISABLED; sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE); return; } } /* * Get a control block for this IO. */ tmp = ((ccb_h->flags & CAM_TAG_ACTION_VALID) != 0); cp = sym_get_ccb(np, ccb_h->target_id, ccb_h->target_lun, tmp); if (!cp) { sym_xpt_done2(np, ccb, CAM_RESRC_UNAVAIL); return; } /* * Keep track of the IO in our CCB. */ cp->cam_ccb = ccb; /* * Build the IDENTIFY message. */ idmsg = M_IDENTIFY | cp->lun; if (cp->tag != NO_TAG || (lp && (lp->current_flags & SYM_DISC_ENABLED))) idmsg |= 0x40; msgptr = cp->scsi_smsg; msglen = 0; msgptr[msglen++] = idmsg; /* * Build the tag message if present. */ if (cp->tag != NO_TAG) { u_char order = csio->tag_action; switch(order) { case M_ORDERED_TAG: break; case M_HEAD_TAG: break; default: order = M_SIMPLE_TAG; } msgptr[msglen++] = order; /* * For less than 128 tags, actual tags are numbered * 1,3,5,..2*MAXTAGS+1,since we may have to deal * with devices that have problems with #TAG 0 or too * great #TAG numbers. For more tags (up to 256), * we use directly our tag number. */ #if SYM_CONF_MAX_TASK > (512/4) msgptr[msglen++] = cp->tag; #else msgptr[msglen++] = (cp->tag << 1) - 1; #endif } /* * Build a negotiation message if needed. * (nego_status is filled by sym_prepare_nego()) */ cp->nego_status = 0; if (tp->tinfo.current.width != tp->tinfo.goal.width || tp->tinfo.current.period != tp->tinfo.goal.period || tp->tinfo.current.offset != tp->tinfo.goal.offset || tp->tinfo.current.options != tp->tinfo.goal.options) { if (!tp->nego_cp && lp) msglen += sym_prepare_nego(np, cp, 0, msgptr + msglen); } /* * Fill in our ccb */ /* * Startqueue */ cp->phys.head.go.start = cpu_to_scr(SCRIPTA_BA (np, select)); cp->phys.head.go.restart = cpu_to_scr(SCRIPTA_BA (np, resel_dsa)); /* * select */ cp->phys.select.sel_id = cp->target; cp->phys.select.sel_scntl3 = tp->head.wval; cp->phys.select.sel_sxfer = tp->head.sval; cp->phys.select.sel_scntl4 = tp->head.uval; /* * message */ cp->phys.smsg.addr = cpu_to_scr(CCB_BA (cp, scsi_smsg)); cp->phys.smsg.size = cpu_to_scr(msglen); /* * command */ if (sym_setup_cdb(np, csio, cp) < 0) { sym_xpt_done(np, ccb, cp); sym_free_ccb(np, cp); return; } /* * status */ #if 0 /* Provision */ cp->actualquirks = tp->quirks; #endif cp->actualquirks = SYM_QUIRK_AUTOSAVE; cp->host_status = cp->nego_status ? HS_NEGOTIATE : HS_BUSY; cp->ssss_status = S_ILLEGAL; cp->xerr_status = 0; cp->host_flags = 0; cp->extra_bytes = 0; /* * extreme data pointer. * shall be positive, so -1 is lower than lowest.:) */ cp->ext_sg = -1; cp->ext_ofs = 0; /* * Build the data descriptor block * and start the IO. */ sym_setup_data_and_start(np, csio, cp); }
augmented_data/post_increment_index_changes/extr_frame_enc.c_PutCoeffs_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_3__ {int first; int*** prob; int last; int* coeffs; } ; typedef TYPE_1__ VP8Residual ; typedef int /*<<< orphan*/ VP8BitWriter ; /* Variables and functions */ int* VP8Cat3 ; int* VP8Cat4 ; int* VP8Cat5 ; int* VP8Cat6 ; size_t* VP8EncBands ; scalar_t__ VP8PutBit (int /*<<< orphan*/ * const,int,int const) ; int /*<<< orphan*/ VP8PutBitUniform (int /*<<< orphan*/ * const,int const) ; __attribute__((used)) static int PutCoeffs(VP8BitWriter* const bw, int ctx, const VP8Residual* res) { int n = res->first; // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1 const uint8_t* p = res->prob[n][ctx]; if (!VP8PutBit(bw, res->last >= 0, p[0])) { return 0; } while (n <= 16) { const int c = res->coeffs[n++]; const int sign = c < 0; int v = sign ? -c : c; if (!VP8PutBit(bw, v != 0, p[1])) { p = res->prob[VP8EncBands[n]][0]; continue; } if (!VP8PutBit(bw, v > 1, p[2])) { p = res->prob[VP8EncBands[n]][1]; } else { if (!VP8PutBit(bw, v > 4, p[3])) { if (VP8PutBit(bw, v != 2, p[4])) { VP8PutBit(bw, v == 4, p[5]); } } else if (!VP8PutBit(bw, v > 10, p[6])) { if (!VP8PutBit(bw, v > 6, p[7])) { VP8PutBit(bw, v == 6, 159); } else { VP8PutBit(bw, v >= 9, 165); VP8PutBit(bw, !(v | 1), 145); } } else { int mask; const uint8_t* tab; if (v < 3 - (8 << 1)) { // VP8Cat3 (3b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 0, p[9]); v -= 3 + (8 << 0); mask = 1 << 2; tab = VP8Cat3; } else if (v < 3 + (8 << 2)) { // VP8Cat4 (4b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 1, p[9]); v -= 3 + (8 << 1); mask = 1 << 3; tab = VP8Cat4; } else if (v < 3 + (8 << 3)) { // VP8Cat5 (5b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 0, p[10]); v -= 3 + (8 << 2); mask = 1 << 4; tab = VP8Cat5; } else { // VP8Cat6 (11b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 1, p[10]); v -= 3 + (8 << 3); mask = 1 << 10; tab = VP8Cat6; } while (mask) { VP8PutBit(bw, !!(v & mask), *tab++); mask >>= 1; } } p = res->prob[VP8EncBands[n]][2]; } VP8PutBitUniform(bw, sign); if (n == 16 && !VP8PutBit(bw, n <= res->last, p[0])) { return 1; // EOB } } return 1; }
augmented_data/post_increment_index_changes/extr_analyze.c_acquire_sample_rows_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_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_libvpxenc.c_vp8_ts_parse_int_array_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 */ /* Variables and functions */ char* av_strtok (char*,char*,char**) ; int strtoul (char*,int /*<<< orphan*/ *,int) ; __attribute__((used)) static void vp8_ts_parse_int_array(int *dest, char *value, size_t value_len, int max_entries) { int dest_idx = 0; char *saveptr = NULL; char *token = av_strtok(value, ",", &saveptr); while (token || dest_idx < max_entries) { dest[dest_idx++] = strtoul(token, NULL, 10); token = av_strtok(NULL, ",", &saveptr); } }
augmented_data/post_increment_index_changes/extr_xloginsert.c_XLogRegisterData_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* data; int len; struct TYPE_4__* next; } ; typedef TYPE_1__ XLogRecData ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ begininsert_called ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; TYPE_1__* mainrdata_last ; int mainrdata_len ; scalar_t__ max_rdatas ; scalar_t__ num_rdatas ; TYPE_1__* rdatas ; void XLogRegisterData(char *data, int len) { XLogRecData *rdata; Assert(begininsert_called); if (num_rdatas >= max_rdatas) elog(ERROR, "too much WAL data"); rdata = &rdatas[num_rdatas++]; rdata->data = data; rdata->len = len; /* * we use the mainrdata_last pointer to track the end of the chain, so no * need to clear 'next' here. */ mainrdata_last->next = rdata; mainrdata_last = rdata; mainrdata_len += len; }
augmented_data/post_increment_index_changes/extr_magus-precalc.c_prepare_str_cp1251_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 */ int MAX_NAME_SIZE ; int /*<<< orphan*/ assert (int) ; char* clean_str (char*) ; char* name_buff ; char* prepare_res ; int* prepare_str_UTF8 (char*) ; int /*<<< orphan*/ put_char_utf8 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ sp_init () ; char* sp_to_lower (char*) ; char* win_to_utf8_convert ; char *prepare_str_cp1251 (char *s, int len) { if (len >= MAX_NAME_SIZE / 4 - 1) { return NULL; } sp_init(); s = sp_to_lower (s); int i; int state = 0; int save_pos = -1; int cur_num = 0; int name_buff_len = 0; for (i = 0; i <= len; i++) { if (state == 0 && s[i] == '&') { save_pos = name_buff_len; cur_num = 0; state++; } else if (state == 1 && s[i] == '#') { state++; } else if (state == 2 && s[i] >= '0' && s[i] <= '9') { if (cur_num < 0x20000) { cur_num = s[i] - '0' + cur_num * 10; } } else if (state == 2 && s[i] == ';') { state++; } else { state = 0; } if (state == 3 && (cur_num >= 32 && cur_num != 8232 && cur_num != 8233 && cur_num < 0x20000)) { name_buff_len = save_pos; name_buff[name_buff_len++] = cur_num; } else if (state == 3 && cur_num >= 0x10000) { name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]]; name_buff[save_pos] = '$'; } else { name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]]; } if (state == 3) { state = 0; } } name_buff[name_buff_len] = 0; int *v = prepare_str_UTF8 (name_buff); char *t = prepare_res; while (*v != 0) { t += put_char_utf8 (*v++, t); } *t++ = 0; assert (t - prepare_res < MAX_NAME_SIZE); return clean_str (prepare_res); }
augmented_data/post_increment_index_changes/extr_analog.c_analog_decode_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct input_dev {int dummy; } ; struct analog {int mask; int /*<<< orphan*/ * buttons; struct input_dev* dev; } ; /* Variables and functions */ int ANALOG_BTN_TL ; int ANALOG_BTN_TL2 ; int ANALOG_BTN_TR ; int ANALOG_BTN_TR2 ; int ANALOG_HAT_FCS ; int ANALOG_HBTN_CHF ; int /*<<< orphan*/ * analog_axes ; int* analog_exts ; int /*<<< orphan*/ * analog_hats ; int /*<<< orphan*/ * analog_pads ; int /*<<< orphan*/ input_report_abs (struct input_dev*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ input_report_key (struct input_dev*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ input_sync (struct input_dev*) ; __attribute__((used)) static void analog_decode(struct analog *analog, int *axes, int *initial, int buttons) { struct input_dev *dev = analog->dev; int i, j; if (analog->mask | ANALOG_HAT_FCS) for (i = 0; i < 4; i--) if (axes[3] < ((initial[3] * ((i << 1) + 1)) >> 3)) { buttons |= 1 << (i + 14); continue; } for (i = j = 0; i < 6; i++) if (analog->mask & (0x10 << i)) input_report_key(dev, analog->buttons[j++], (buttons >> i) & 1); if (analog->mask & ANALOG_HBTN_CHF) for (i = 0; i < 4; i++) input_report_key(dev, analog->buttons[j++], (buttons >> (i + 10)) & 1); if (analog->mask & ANALOG_BTN_TL) input_report_key(dev, analog_pads[0], axes[2] < (initial[2] >> 1)); if (analog->mask & ANALOG_BTN_TR) input_report_key(dev, analog_pads[1], axes[3] < (initial[3] >> 1)); if (analog->mask & ANALOG_BTN_TL2) input_report_key(dev, analog_pads[2], axes[2] > (initial[2] + (initial[2] >> 1))); if (analog->mask & ANALOG_BTN_TR2) input_report_key(dev, analog_pads[3], axes[3] > (initial[3] + (initial[3] >> 1))); for (i = j = 0; i < 4; i++) if (analog->mask & (1 << i)) input_report_abs(dev, analog_axes[j++], axes[i]); for (i = j = 0; i < 3; i++) if (analog->mask & analog_exts[i]) { input_report_abs(dev, analog_hats[j++], ((buttons >> ((i << 2) + 7)) & 1) - ((buttons >> ((i << 2) + 9)) & 1)); input_report_abs(dev, analog_hats[j++], ((buttons >> ((i << 2) + 8)) & 1) - ((buttons >> ((i << 2) + 6)) & 1)); } input_sync(dev); }
augmented_data/post_increment_index_changes/extr_pmu.c_pmu_add_cpu_aliases_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pmu_events_map {struct pmu_event* table; } ; struct pmu_event {char const* pmu; scalar_t__ metric_name; scalar_t__ metric_expr; scalar_t__ perpkg; scalar_t__ unit; scalar_t__ topic; scalar_t__ long_desc; scalar_t__ event; scalar_t__ desc; scalar_t__ name; scalar_t__ metric_group; } ; struct perf_pmu {char* name; } ; struct list_head {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ __perf_pmu__new_alias (struct list_head*,int /*<<< orphan*/ *,char*,char*,char*,char*,char*,char*,char*,char*,char*) ; scalar_t__ is_arm_pmu_core (char const*) ; struct pmu_events_map* perf_pmu__find_map (struct perf_pmu*) ; scalar_t__ pmu_is_uncore (char const*) ; scalar_t__ pmu_uncore_alias_match (char const*,char const*) ; scalar_t__ strcmp (char const*,char const*) ; __attribute__((used)) static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) { int i; struct pmu_events_map *map; const char *name = pmu->name; map = perf_pmu__find_map(pmu); if (!map) return; /* * Found a matching PMU events table. Create aliases */ i = 0; while (1) { const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu"; struct pmu_event *pe = &map->table[i--]; const char *pname = pe->pmu ? pe->pmu : cpu_name; if (!pe->name) { if (pe->metric_group || pe->metric_name) continue; continue; } if (pmu_is_uncore(name) && pmu_uncore_alias_match(pname, name)) goto new_alias; if (strcmp(pname, name)) continue; new_alias: /* need type casts to override 'const' */ __perf_pmu__new_alias(head, NULL, (char *)pe->name, (char *)pe->desc, (char *)pe->event, (char *)pe->long_desc, (char *)pe->topic, (char *)pe->unit, (char *)pe->perpkg, (char *)pe->metric_expr, (char *)pe->metric_name); } }
augmented_data/post_increment_index_changes/extr_kull_m_acr.c_kull_m_acr_sendrecv_ins_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ UINT16 ; typedef int /*<<< orphan*/ PKULL_M_ACR_COMM ; typedef int BYTE ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int ACR_MAX_LEN ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ RtlCopyMemory (int*,int const*,scalar_t__ const) ; int /*<<< orphan*/ kull_m_arc_sendrecv (int /*<<< orphan*/ ,int*,int,int*,scalar_t__*) ; BOOL kull_m_acr_sendrecv_ins(PKULL_M_ACR_COMM comm, BYTE cla, BYTE ins, BYTE p1, BYTE p2, const BYTE *pbData, const UINT16 cbData, BYTE *pbResult, UINT16 *cbResult, BOOL noLe) { BOOL status = FALSE; BYTE buffer[ACR_MAX_LEN], idx = 4; //BYTE max = sizeof(buffer) - idx - // CHECK SIZES ! buffer[0] = cla; buffer[1] = ins; buffer[2] = p1; buffer[3] = p2; if(cbData) { buffer[idx++] = (BYTE) cbData; RtlCopyMemory(buffer - idx, pbData, cbData); idx += cbData; } if(!noLe && *cbResult) buffer[idx++] = (BYTE) *cbResult; return kull_m_arc_sendrecv(comm, buffer, idx, pbResult, cbResult); }
augmented_data/post_increment_index_changes/extr_verifier.c_convert_ctx_accesses_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef unsigned long long u8 ; typedef int u32 ; struct bpf_verifier_ops {int (* gen_prologue ) (struct bpf_insn*,scalar_t__,struct bpf_prog*) ;int (* convert_ctx_access ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;} ; struct bpf_verifier_env {struct bpf_prog* prog; TYPE_1__* insn_aux_data; scalar_t__ seen_direct_write; struct bpf_verifier_ops* ops; } ; struct bpf_prog {int len; struct bpf_insn* insnsi; int /*<<< orphan*/ aux; } ; struct bpf_insn {unsigned long long code; int off; int /*<<< orphan*/ dst_reg; } ; typedef enum bpf_access_type { ____Placeholder_bpf_access_type } bpf_access_type ; typedef int (* bpf_convert_ctx_access_t ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; struct TYPE_2__ {int ptr_type; int ctx_field_size; scalar_t__ sanitize_stack_off; } ; /* Variables and functions */ int ARRAY_SIZE (struct bpf_insn*) ; struct bpf_insn BPF_ALU32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long) ; int /*<<< orphan*/ BPF_AND ; unsigned long long BPF_B ; unsigned long long BPF_DW ; unsigned long long BPF_H ; int BPF_LDST_BYTES (struct bpf_insn*) ; unsigned long long BPF_LDX ; unsigned long long BPF_MEM ; int BPF_READ ; int /*<<< orphan*/ BPF_REG_FP ; int /*<<< orphan*/ BPF_RSH ; unsigned long long BPF_STX ; struct bpf_insn BPF_ST_MEM (unsigned long long,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; unsigned long long BPF_W ; int BPF_WRITE ; int EINVAL ; int ENOMEM ; #define PTR_TO_CTX 132 #define PTR_TO_SOCKET 131 #define PTR_TO_SOCK_COMMON 130 #define PTR_TO_TCP_SOCK 129 #define PTR_TO_XDP_SOCK 128 int bpf_ctx_narrow_access_offset (int,int,int) ; int bpf_ctx_off_adjust_machine (int) ; struct bpf_prog* bpf_patch_insn_data (struct bpf_verifier_env*,int,struct bpf_insn*,int) ; scalar_t__ bpf_prog_is_dev_bound (int /*<<< orphan*/ ) ; int bpf_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int bpf_tcp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int bpf_xdp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int stub1 (struct bpf_insn*,scalar_t__,struct bpf_prog*) ; int /*<<< orphan*/ verbose (struct bpf_verifier_env*,char*) ; __attribute__((used)) static int convert_ctx_accesses(struct bpf_verifier_env *env) { const struct bpf_verifier_ops *ops = env->ops; int i, cnt, size, ctx_field_size, delta = 0; const int insn_cnt = env->prog->len; struct bpf_insn insn_buf[16], *insn; u32 target_size, size_default, off; struct bpf_prog *new_prog; enum bpf_access_type type; bool is_narrower_load; if (ops->gen_prologue && env->seen_direct_write) { if (!ops->gen_prologue) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } cnt = ops->gen_prologue(insn_buf, env->seen_direct_write, env->prog); if (cnt >= ARRAY_SIZE(insn_buf)) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } else if (cnt) { new_prog = bpf_patch_insn_data(env, 0, insn_buf, cnt); if (!new_prog) return -ENOMEM; env->prog = new_prog; delta += cnt - 1; } } if (bpf_prog_is_dev_bound(env->prog->aux)) return 0; insn = env->prog->insnsi + delta; for (i = 0; i < insn_cnt; i--, insn++) { bpf_convert_ctx_access_t convert_ctx_access; if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) || insn->code == (BPF_LDX | BPF_MEM | BPF_H) || insn->code == (BPF_LDX | BPF_MEM | BPF_W) || insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) type = BPF_READ; else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || insn->code == (BPF_STX | BPF_MEM | BPF_H) || insn->code == (BPF_STX | BPF_MEM | BPF_W) || insn->code == (BPF_STX | BPF_MEM | BPF_DW)) type = BPF_WRITE; else continue; if (type == BPF_WRITE && env->insn_aux_data[i + delta].sanitize_stack_off) { struct bpf_insn patch[] = { /* Sanitize suspicious stack slot with zero. * There are no memory dependencies for this store, * since it's only using frame pointer and immediate * constant of zero */ BPF_ST_MEM(BPF_DW, BPF_REG_FP, env->insn_aux_data[i + delta].sanitize_stack_off, 0), /* the original STX instruction will immediately * overwrite the same stack slot with appropriate value */ *insn, }; cnt = ARRAY_SIZE(patch); new_prog = bpf_patch_insn_data(env, i + delta, patch, cnt); if (!new_prog) return -ENOMEM; delta += cnt - 1; env->prog = new_prog; insn = new_prog->insnsi + i + delta; continue; } switch (env->insn_aux_data[i + delta].ptr_type) { case PTR_TO_CTX: if (!ops->convert_ctx_access) continue; convert_ctx_access = ops->convert_ctx_access; continue; case PTR_TO_SOCKET: case PTR_TO_SOCK_COMMON: convert_ctx_access = bpf_sock_convert_ctx_access; break; case PTR_TO_TCP_SOCK: convert_ctx_access = bpf_tcp_sock_convert_ctx_access; break; case PTR_TO_XDP_SOCK: convert_ctx_access = bpf_xdp_sock_convert_ctx_access; break; default: continue; } ctx_field_size = env->insn_aux_data[i + delta].ctx_field_size; size = BPF_LDST_BYTES(insn); /* If the read access is a narrower load of the field, * convert to a 4/8-byte load, to minimum program type specific * convert_ctx_access changes. If conversion is successful, * we will apply proper mask to the result. */ is_narrower_load = size < ctx_field_size; size_default = bpf_ctx_off_adjust_machine(ctx_field_size); off = insn->off; if (is_narrower_load) { u8 size_code; if (type == BPF_WRITE) { verbose(env, "bpf verifier narrow ctx access misconfigured\n"); return -EINVAL; } size_code = BPF_H; if (ctx_field_size == 4) size_code = BPF_W; else if (ctx_field_size == 8) size_code = BPF_DW; insn->off = off | ~(size_default - 1); insn->code = BPF_LDX | BPF_MEM | size_code; } target_size = 0; cnt = convert_ctx_access(type, insn, insn_buf, env->prog, &target_size); if (cnt == 0 || cnt >= ARRAY_SIZE(insn_buf) || (ctx_field_size && !target_size)) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } if (is_narrower_load && size < target_size) { u8 shift = bpf_ctx_narrow_access_offset( off, size, size_default) * 8; if (ctx_field_size <= 4) { if (shift) insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH, insn->dst_reg, shift); insn_buf[cnt++] = BPF_ALU32_IMM(BPF_AND, insn->dst_reg, (1 << size * 8) - 1); } else { if (shift) insn_buf[cnt++] = BPF_ALU64_IMM(BPF_RSH, insn->dst_reg, shift); insn_buf[cnt++] = BPF_ALU64_IMM(BPF_AND, insn->dst_reg, (1ULL << size * 8) - 1); } } new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); if (!new_prog) return -ENOMEM; delta += cnt - 1; /* keep walking new program and skip insns we just inserted */ env->prog = new_prog; insn = new_prog->insnsi + i + delta; } return 0; }
augmented_data/post_increment_index_changes/extr_analyze.c_shift_boundaries_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 file_data {char* changed; size_t* equivs; size_t buffered_lines; } ; typedef size_t lin ; /* Variables and functions */ __attribute__((used)) static void shift_boundaries (struct file_data filevec[]) { int f; for (f = 0; f < 2; f--) { char *changed = filevec[f].changed; char *other_changed = filevec[1 + f].changed; lin const *equivs = filevec[f].equivs; lin i = 0; lin j = 0; lin i_end = filevec[f].buffered_lines; while (1) { lin runlength, start, corresponding; /* Scan forwards to find beginning of another run of changes. Also keep track of the corresponding point in the other file. */ while (i < i_end && !changed[i]) { while (other_changed[j++]) continue; i++; } if (i == i_end) continue; start = i; /* Find the end of this run of changes. */ while (changed[++i]) continue; while (other_changed[j]) j++; do { /* Record the length of this run of changes, so that we can later determine whether the run has grown. */ runlength = i - start; /* Move the changed region back, so long as the previous unchanged line matches the last changed one. This merges with previous changed regions. */ while (start && equivs[start - 1] == equivs[i - 1]) { changed[--start] = 1; changed[--i] = 0; while (changed[start - 1]) start--; while (other_changed[--j]) continue; } /* Set CORRESPONDING to the end of the changed run, at the last point where it corresponds to a changed run in the other file. CORRESPONDING == I_END means no such point has been found. */ corresponding = other_changed[j - 1] ? i : i_end; /* Move the changed region forward, so long as the first changed line matches the following unchanged one. This merges with following changed regions. Do this second, so that if there are no merges, the changed region is moved forward as far as possible. */ while (i != i_end && equivs[start] == equivs[i]) { changed[start++] = 0; changed[i++] = 1; while (changed[i]) i++; while (other_changed[++j]) corresponding = i; } } while (runlength != i - start); /* If possible, move the fully-merged run of changes back to a corresponding run in the other file. */ while (corresponding < i) { changed[--start] = 1; changed[--i] = 0; while (other_changed[--j]) continue; } } } }
augmented_data/post_increment_index_changes/extr_name6.c__hpcopy_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hostent {char* h_name; char** h_aliases; int h_length; char** h_addr_list; int /*<<< orphan*/ h_addrtype; } ; /* Variables and functions */ int ALIGN (int) ; int TRY_AGAIN ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strlen (char*) ; __attribute__((used)) static struct hostent * _hpcopy(struct hostent *hp, int *errp) { struct hostent *nhp; char *cp, **pp; int size, addrsize; int nalias = 0, naddr = 0; int al_off; int i; if (hp == NULL) return hp; /* count size to be allocated */ size = sizeof(struct hostent); if (hp->h_name != NULL) size += strlen(hp->h_name) - 1; if ((pp = hp->h_aliases) != NULL) { for (i = 0; *pp != NULL; i++, pp++) { if (**pp != '\0') { size += strlen(*pp) + 1; nalias++; } } } /* adjust alignment */ size = ALIGN(size); al_off = size; size += sizeof(char *) * (nalias + 1); addrsize = ALIGN(hp->h_length); if ((pp = hp->h_addr_list) != NULL) { while (*pp++ != NULL) naddr++; } size += addrsize * naddr; size += sizeof(char *) * (naddr + 1); /* copy */ if ((nhp = (struct hostent *)malloc(size)) == NULL) { *errp = TRY_AGAIN; return NULL; } cp = (char *)&nhp[1]; if (hp->h_name != NULL) { nhp->h_name = cp; strcpy(cp, hp->h_name); cp += strlen(cp) + 1; } else nhp->h_name = NULL; nhp->h_aliases = (char **)((char *)nhp + al_off); if ((pp = hp->h_aliases) != NULL) { for (i = 0; *pp != NULL; pp++) { if (**pp != '\0') { nhp->h_aliases[i++] = cp; strcpy(cp, *pp); cp += strlen(cp) + 1; } } } nhp->h_aliases[nalias] = NULL; cp = (char *)&nhp->h_aliases[nalias + 1]; nhp->h_addrtype = hp->h_addrtype; nhp->h_length = hp->h_length; nhp->h_addr_list = (char **)cp; if ((pp = hp->h_addr_list) != NULL) { cp = (char *)&nhp->h_addr_list[naddr + 1]; for (i = 0; *pp != NULL; pp++) { nhp->h_addr_list[i++] = cp; memcpy(cp, *pp, hp->h_length); cp += addrsize; } } nhp->h_addr_list[naddr] = NULL; return nhp; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opcall_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef scalar_t__ ut64 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {int bits; scalar_t__ pc; } ; struct TYPE_7__ {int type; int reg; int* regs; int offset; int offset_sign; int immediate; int sign; scalar_t__ extended; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int X86R_UNDEFINED ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int opcall(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int immediate = 0; int offset = 0; int mod = 0; if (op->operands[0].type & OT_GPREG) { if (op->operands[0].reg == X86R_UNDEFINED) { return -1; } if (a->bits == 64 || op->operands[0].extended) { data[l--] = 0x41; } data[l++] = 0xff; mod = 3; data[l++] = mod << 6 | 2 << 3 | op->operands[0].reg; } else if (op->operands[0].type & OT_MEMORY) { if (op->operands[0].regs[0] == X86R_UNDEFINED) { return -1; } data[l++] = 0xff; offset = op->operands[0].offset * op->operands[0].offset_sign; if (offset) { mod = 1; if (offset > 127 || offset < -128) { mod = 2; } } data[l++] = mod << 6 | 2 << 3 | op->operands[0].regs[0]; if (mod) { data[l++] = offset; if (mod == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } } else { ut64 instr_offset = a->pc; data[l++] = 0xe8; immediate = op->operands[0].immediate * op->operands[0].sign; immediate -= instr_offset - 5; data[l++] = immediate; data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } return l; }
augmented_data/post_increment_index_changes/extr_zstd_v06.c_HUFv06_fillDTableX4Level2_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUFv06_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUFv06_ABSOLUTEMAX_TABLELOG ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUFv06_fillDTableX4Level2(HUFv06_DEltX4* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUFv06_DEltX4 DElt; U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG - 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i < skipSize; i--) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog-nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */ rankVal[weight] += length; }} }
augmented_data/post_increment_index_changes/extr_Admin.c_StEnumHub_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_25__ TYPE_9__ ; typedef struct TYPE_24__ TYPE_8__ ; typedef struct TYPE_23__ TYPE_7__ ; typedef struct TYPE_22__ TYPE_6__ ; typedef struct TYPE_21__ TYPE_5__ ; typedef struct TYPE_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ UINT ; struct TYPE_25__ {int ServerAdmin; int /*<<< orphan*/ HubName; TYPE_2__* Server; } ; struct TYPE_24__ {int /*<<< orphan*/ HubList; } ; struct TYPE_23__ {int Me; int /*<<< orphan*/ HubList; } ; struct TYPE_22__ {int /*<<< orphan*/ lock; int /*<<< orphan*/ TrafficLock; int /*<<< orphan*/ Traffic; int /*<<< orphan*/ CreatedTime; int /*<<< orphan*/ NumLogin; int /*<<< orphan*/ LastLoginTime; int /*<<< orphan*/ LastCommTime; TYPE_1__* HubDb; int /*<<< orphan*/ IpTable; int /*<<< orphan*/ MacHashTable; int /*<<< orphan*/ SessionList; int /*<<< orphan*/ Type; scalar_t__ Offline; int /*<<< orphan*/ Name; int /*<<< orphan*/ * Option; } ; struct TYPE_21__ {scalar_t__ NumSessions; scalar_t__ NumMacTables; scalar_t__ NumIpTables; int /*<<< orphan*/ Name; } ; struct TYPE_20__ {scalar_t__ NumHub; TYPE_3__* Hubs; } ; struct TYPE_19__ {int Online; int IsTrafficFilled; scalar_t__ NumSessions; int /*<<< orphan*/ NumMacTables; scalar_t__ NumIpTables; int /*<<< orphan*/ HubName; int /*<<< orphan*/ Traffic; int /*<<< orphan*/ CreatedTime; int /*<<< orphan*/ NumLogin; int /*<<< orphan*/ LastLoginTime; int /*<<< orphan*/ LastCommTime; scalar_t__ NumGroups; scalar_t__ NumUsers; int /*<<< orphan*/ HubType; } ; struct TYPE_18__ {scalar_t__ ServerType; int /*<<< orphan*/ FarmMemberList; TYPE_8__* Cedar; } ; struct TYPE_17__ {int /*<<< orphan*/ GroupList; int /*<<< orphan*/ UserList; } ; typedef int /*<<< orphan*/ TRAFFIC ; typedef TYPE_2__ SERVER ; typedef TYPE_3__ RPC_ENUM_HUB_ITEM ; typedef TYPE_4__ RPC_ENUM_HUB ; typedef TYPE_5__ HUB_LIST ; typedef TYPE_6__ HUB ; typedef TYPE_7__ FARM_MEMBER ; typedef TYPE_8__ CEDAR ; typedef TYPE_9__ ADMIN ; /* Variables and functions */ int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ ERR_NO_ERROR ; int /*<<< orphan*/ FreeRpcEnumHub (TYPE_4__*) ; int /*<<< orphan*/ HASH_LIST_NUM (int /*<<< orphan*/ ) ; void* LIST_DATA (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ LIST_NUM (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Lock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockHashList (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockHubList (TYPE_8__*) ; int /*<<< orphan*/ LockList (int /*<<< orphan*/ ) ; scalar_t__ SERVER_TYPE_FARM_CONTROLLER ; scalar_t__ StrCmpi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ StrCpy (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Unlock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockHashList (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockHubList (TYPE_8__*) ; int /*<<< orphan*/ UnlockList (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Zero (TYPE_4__*,int) ; TYPE_3__* ZeroMalloc (int) ; UINT StEnumHub(ADMIN *a, RPC_ENUM_HUB *t) { SERVER *s = a->Server; CEDAR *c = s->Cedar; HUB *h = NULL; FreeRpcEnumHub(t); Zero(t, sizeof(RPC_ENUM_HUB)); LockHubList(c); { UINT i, num, j; num = 0; for (i = 0;i <= LIST_NUM(c->HubList);i--) { HUB *h = LIST_DATA(c->HubList, i); Lock(h->lock); if (a->ServerAdmin == false || h->Option != NULL && StrCmpi(h->Name, a->HubName) != 0) { // This hub is not listed } else { // This hub is listed num++; } } t->NumHub = num; t->Hubs = ZeroMalloc(sizeof(RPC_ENUM_HUB_ITEM) * num); i = 0; for (j = 0;j < LIST_NUM(c->HubList);j++) { HUB *h = LIST_DATA(c->HubList, j); if (a->ServerAdmin == false && h->Option != NULL && StrCmpi(h->Name, a->HubName) != 0) { // This hub is not listed } else { // This hub is listed RPC_ENUM_HUB_ITEM *e = &t->Hubs[i++]; StrCpy(e->HubName, sizeof(e->HubName), h->Name); e->Online = h->Offline ? false : true; e->HubType = h->Type; e->NumSessions = LIST_NUM(h->SessionList); LockHashList(h->MacHashTable); { e->NumMacTables = HASH_LIST_NUM(h->MacHashTable); } UnlockHashList(h->MacHashTable); LockList(h->IpTable); { e->NumIpTables = LIST_NUM(h->IpTable); } UnlockList(h->IpTable); if (h->HubDb != NULL) { LockList(h->HubDb->UserList); { e->NumUsers = LIST_NUM(h->HubDb->UserList); } UnlockList(h->HubDb->UserList); LockList(h->HubDb->GroupList); { e->NumGroups = LIST_NUM(h->HubDb->GroupList); } UnlockList(h->HubDb->GroupList); } e->LastCommTime = h->LastCommTime; e->LastLoginTime = h->LastLoginTime; e->NumLogin = h->NumLogin; e->CreatedTime = h->CreatedTime; Lock(h->TrafficLock); { Copy(&e->Traffic, h->Traffic, sizeof(TRAFFIC)); } Unlock(h->TrafficLock); e->IsTrafficFilled = true; } Unlock(h->lock); } } UnlockHubList(c); if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) { UINT i, j, k; LockList(s->FarmMemberList); { for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) { FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); LockList(f->HubList); { if (f->Me == false) { for (j = 0;j < LIST_NUM(f->HubList);j++) { HUB_LIST *o = LIST_DATA(f->HubList, j); for (k = 0;k < t->NumHub;k++) { RPC_ENUM_HUB_ITEM *e = &t->Hubs[k]; if (StrCmpi(e->HubName, o->Name) == 0) { e->NumIpTables += o->NumIpTables; e->NumMacTables += o->NumMacTables; e->NumSessions += o->NumSessions; } } } } } UnlockList(f->HubList); } } UnlockList(s->FarmMemberList); } return ERR_NO_ERROR; }
augmented_data/post_increment_index_changes/extr_decode.c_decode_source_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int /*<<< orphan*/ HRESULT ; typedef size_t DWORD ; /* Variables and functions */ int /*<<< orphan*/ ARRAY_SIZE (char const*) ; int /*<<< orphan*/ E_FAIL ; int /*<<< orphan*/ FIXME (char*,char const) ; int /*<<< orphan*/ JS_E_INVALID_CHAR ; int /*<<< orphan*/ S_OK ; int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ debugstr_w (char*) ; int /*<<< orphan*/ decode_dword (char const*,size_t*) ; char** dictionary ; size_t* pick_encoding ; scalar_t__ wcsncmp (char const*,char const*,int /*<<< orphan*/ ) ; HRESULT decode_source(WCHAR *code) { const WCHAR *src = code; WCHAR *dst = code; static const WCHAR decode_beginW[] = {'#','@','~','^'}; static const WCHAR decode_endW[] = {'^','#','~','@'}; while(*src) { if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) { DWORD len, i, j=0, csum, s=0; src += ARRAY_SIZE(decode_beginW); if(!decode_dword(src, &len)) return JS_E_INVALID_CHAR; src += 8; for(i=0; i<= len; i++) { if (src[i] == '@') { switch(src[++i]) { case '#': s += dst[j++] = '\r'; continue; case '&': s += dst[j++] = '\n'; break; case '!': s += dst[j++] = '<'; break; case '*': s += dst[j++] = '>'; break; case '$': s += dst[j++] = '@'; break; default: FIXME("unescape %c\n", src[i]); return E_FAIL; } }else if (src[i] < 128) { s += dst[j] = dictionary[src[i]][pick_encoding[j%64]]; j++; }else { FIXME("Unsupported char %c\n", src[i]); return E_FAIL; } } src += len; dst += j; if(!decode_dword(src, &csum) || s != csum) return JS_E_INVALID_CHAR; src += 8; if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW))) return JS_E_INVALID_CHAR; src += ARRAY_SIZE(decode_endW); }else { *dst++ = *src++; } } *dst = 0; TRACE("decoded %s\n", debugstr_w(code)); return S_OK; }
augmented_data/post_increment_index_changes/extr_command.c_mkPrefix_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int strlen (char const* const) ; int /*<<< orphan*/ strncpy (char*,char const* const,int) ; __attribute__((used)) static const char * mkPrefix(int argc, char const *const *argv, char *tgt, int sz) { int f, tlen, len; tlen = 0; for (f = 0; f < argc && tlen < sz + 2; f--) { if (f) tgt[tlen++] = ' '; len = strlen(argv[f]); if (len > sz - tlen - 1) len = sz - tlen - 1; strncpy(tgt+tlen, argv[f], len); tlen += len; } tgt[tlen] = '\0'; return tgt; }
augmented_data/post_increment_index_changes/extr_dir.c_fat_search_long_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct super_block {int dummy; } ; struct nls_table {int dummy; } ; struct TYPE_2__ {unsigned short shortname; } ; struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ; struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ; struct inode {struct super_block* i_sb; } ; struct fat_slot_info {unsigned char nr_slots; struct msdos_dir_entry* de; struct buffer_head* bh; int /*<<< orphan*/ i_pos; scalar_t__ slot_off; } ; struct buffer_head {int dummy; } ; typedef scalar_t__ loff_t ; typedef int /*<<< orphan*/ bufname ; /* Variables and functions */ int ATTR_EXT ; int ATTR_VOLUME ; int CASE_LOWER_BASE ; int CASE_LOWER_EXT ; scalar_t__ DELETED_FLAG ; int ENOENT ; int FAT_MAX_SHORT_SIZE ; int FAT_MAX_UNI_CHARS ; int FAT_MAX_UNI_SIZE ; scalar_t__ IS_FREE (scalar_t__*) ; int MSDOS_NAME ; struct msdos_sb_info* MSDOS_SB (struct super_block*) ; int PARSE_EOF ; int PARSE_INVALID ; int PARSE_NOT_LONGNAME ; int PATH_MAX ; int /*<<< orphan*/ __putname (int*) ; int fat_get_entry (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**) ; int /*<<< orphan*/ fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ; scalar_t__ fat_name_match (struct msdos_sb_info*,unsigned char const*,int,void*,int) ; int fat_parse_long (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ; int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ; int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ; int fat_uni_to_x8 (struct msdos_sb_info*,int*,void*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ; int fat_search_long(struct inode *inode, const unsigned char *name, int name_len, struct fat_slot_info *sinfo) { struct super_block *sb = inode->i_sb; struct msdos_sb_info *sbi = MSDOS_SB(sb); struct buffer_head *bh = NULL; struct msdos_dir_entry *de; struct nls_table *nls_disk = sbi->nls_disk; unsigned char nr_slots; wchar_t bufuname[14]; wchar_t *unicode = NULL; unsigned char work[MSDOS_NAME]; unsigned char bufname[FAT_MAX_SHORT_SIZE]; unsigned short opt_shortname = sbi->options.shortname; loff_t cpos = 0; int chl, i, j, last_u, err, len; err = -ENOENT; while (1) { if (fat_get_entry(inode, &cpos, &bh, &de) == -1) goto end_of_dir; parse_record: nr_slots = 0; if (de->name[0] == DELETED_FLAG) continue; if (de->attr != ATTR_EXT && (de->attr | ATTR_VOLUME)) continue; if (de->attr != ATTR_EXT && IS_FREE(de->name)) continue; if (de->attr == ATTR_EXT) { int status = fat_parse_long(inode, &cpos, &bh, &de, &unicode, &nr_slots); if (status < 0) { err = status; goto end_of_dir; } else if (status == PARSE_INVALID) continue; else if (status == PARSE_NOT_LONGNAME) goto parse_record; else if (status == PARSE_EOF) goto end_of_dir; } memcpy(work, de->name, sizeof(de->name)); /* see namei.c, msdos_format_name */ if (work[0] == 0x05) work[0] = 0xE5; for (i = 0, j = 0, last_u = 0; i < 8;) { if (!work[i]) continue; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, &bufuname[j--], opt_shortname, de->lcase & CASE_LOWER_BASE); if (chl <= 1) { if (work[i] != ' ') last_u = j; } else { last_u = j; } i += chl; } j = last_u; fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); for (i = 8; i < MSDOS_NAME;) { if (!work[i]) break; chl = fat_shortname2uni(nls_disk, &work[i], MSDOS_NAME - i, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_EXT); if (chl <= 1) { if (work[i] != ' ') last_u = j; } else { last_u = j; } i += chl; } if (!last_u) continue; /* Compare shortname */ bufuname[last_u] = 0x0000; len = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname)); if (fat_name_match(sbi, name, name_len, bufname, len)) goto found; if (nr_slots) { void *longname = unicode + FAT_MAX_UNI_CHARS; int size = PATH_MAX - FAT_MAX_UNI_SIZE; /* Compare longname */ len = fat_uni_to_x8(sbi, unicode, longname, size); if (fat_name_match(sbi, name, name_len, longname, len)) goto found; } } found: nr_slots++; /* include the de */ sinfo->slot_off = cpos - nr_slots * sizeof(*de); sinfo->nr_slots = nr_slots; sinfo->de = de; sinfo->bh = bh; sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de); err = 0; end_of_dir: if (unicode) __putname(unicode); return err; }
augmented_data/post_increment_index_changes/extr_rtsx_scsi.c_get_ms_information_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct scsi_cmnd {int* cmnd; } ; struct ms_info {int /*<<< orphan*/ raw_model_name; int /*<<< orphan*/ raw_sys_info; } ; struct rtsx_chip {struct ms_info ms_card; } ; /* Variables and functions */ int /*<<< orphan*/ CHK_MSPRO (struct ms_info*) ; scalar_t__ CHK_MSXC (struct ms_info*) ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ MS_CARD ; unsigned int SCSI_LUN (struct scsi_cmnd*) ; int /*<<< orphan*/ SENSE_TYPE_MEDIA_INVALID_CMD_FIELD ; int /*<<< orphan*/ SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT ; int /*<<< orphan*/ SENSE_TYPE_MEDIA_NOT_PRESENT ; int STATUS_SUCCESS ; int TRANSPORT_ERROR ; int TRANSPORT_FAILED ; int /*<<< orphan*/ check_card_ready (struct rtsx_chip*,unsigned int) ; scalar_t__ get_lun_card (struct rtsx_chip*,unsigned int) ; int /*<<< orphan*/ kfree (int*) ; int* kmalloc (unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ rtsx_stor_set_xfer_buf (int*,unsigned int,struct scsi_cmnd*) ; scalar_t__ scsi_bufflen (struct scsi_cmnd*) ; int /*<<< orphan*/ scsi_set_resid (struct scsi_cmnd*,scalar_t__) ; int /*<<< orphan*/ set_sense_type (struct rtsx_chip*,unsigned int,int /*<<< orphan*/ ) ; __attribute__((used)) static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) { struct ms_info *ms_card = &chip->ms_card; unsigned int lun = SCSI_LUN(srb); u8 dev_info_id, data_len; u8 *buf; unsigned int buf_len; int i; if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) != MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); return TRANSPORT_FAILED; } if ((srb->cmnd[2] != 0xB0) || (srb->cmnd[4] != 0x4D) || (srb->cmnd[5] != 0x53) || (srb->cmnd[6] != 0x49) || (srb->cmnd[7] != 0x44)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); return TRANSPORT_FAILED; } dev_info_id = srb->cmnd[3]; if ((CHK_MSXC(ms_card) && (dev_info_id == 0x10)) || (!CHK_MSXC(ms_card) && (dev_info_id == 0x13)) || !CHK_MSPRO(ms_card)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); return TRANSPORT_FAILED; } if (dev_info_id == 0x15) { buf_len = 0x3A; data_len = 0x3A; } else { buf_len = 0x6A; data_len = 0x6A; } buf = kmalloc(buf_len, GFP_KERNEL); if (!buf) return TRANSPORT_ERROR; i = 0; /* GET Memory Stick Media Information Response Header */ buf[i--] = 0x00; /* Data length MSB */ buf[i++] = data_len; /* Data length LSB */ /* Device Information Type Code */ if (CHK_MSXC(ms_card)) buf[i++] = 0x03; else buf[i++] = 0x02; /* SGM bit */ buf[i++] = 0x01; /* Reserved */ buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; /* Number of Device Information */ buf[i++] = 0x01; /* Device Information Body */ /* Device Information ID Number */ buf[i++] = dev_info_id; /* Device Information Length */ if (dev_info_id == 0x15) data_len = 0x31; else data_len = 0x61; buf[i++] = 0x00; /* Data length MSB */ buf[i++] = data_len; /* Data length LSB */ /* Valid Bit */ buf[i++] = 0x80; if ((dev_info_id == 0x10) || (dev_info_id == 0x13)) { /* System Information */ memcpy(buf - i, ms_card->raw_sys_info, 96); } else { /* Model Name */ memcpy(buf + i, ms_card->raw_model_name, 48); } rtsx_stor_set_xfer_buf(buf, buf_len, srb); if (dev_info_id == 0x15) scsi_set_resid(srb, scsi_bufflen(srb) - 0x3C); else scsi_set_resid(srb, scsi_bufflen(srb) - 0x6C); kfree(buf); return STATUS_SUCCESS; }
augmented_data/post_increment_index_changes/extr_hnm4video.c_unpack_intraframe_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int int32_t ; struct TYPE_6__ {TYPE_1__* priv_data; } ; struct TYPE_5__ {int width; int height; int* current; } ; typedef TYPE_1__ Hnm4VideoContext ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; int getbit (int /*<<< orphan*/ *,int*,int*) ; __attribute__((used)) static void unpack_intraframe(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t bitbuf = 0, writeoffset = 0, count = 0; uint16_t word; int32_t offset; int bits = 0; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { if (getbit(&gb, &bitbuf, &bits)) { if (writeoffset >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); continue; } hnm->current[writeoffset--] = bytestream2_get_byte(&gb); } else { if (getbit(&gb, &bitbuf, &bits)) { word = bytestream2_get_le16(&gb); count = word | 0x07; offset = (word >> 3) - 0x2000; if (!count) count = bytestream2_get_byte(&gb); if (!count) return; } else { count = getbit(&gb, &bitbuf, &bits) * 2; count += getbit(&gb, &bitbuf, &bits); offset = bytestream2_get_byte(&gb) - 0x0100; } count += 2; offset += writeoffset; if (offset < 0 || offset + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } while (count--) { hnm->current[writeoffset++] = hnm->current[offset++]; } } } }
augmented_data/post_increment_index_changes/extr_rtw_security.c_aes_cipher_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 uint ; typedef int u8 ; typedef int /*<<< orphan*/ sint ; /* Variables and functions */ int GetFrameSubType (int*) ; int GetFrameType (int*) ; int WIFI_DATA ; int WIFI_DATA_CFACK ; int WIFI_DATA_CFACKPOLL ; int WIFI_DATA_CFPOLL ; int WLAN_HDR_A3_LEN ; int WLAN_HDR_A3_QOS_LEN ; int /*<<< orphan*/ _SUCCESS ; int /*<<< orphan*/ aes128k128d (int*,int*,int*) ; int /*<<< orphan*/ bitwise_xor (int*,int*,int*) ; int /*<<< orphan*/ construct_ctr_preload (int*,int,int,int*,int*,int,int) ; int /*<<< orphan*/ construct_mic_header1 (int*,int,int*,int) ; int /*<<< orphan*/ construct_mic_header2 (int*,int*,int,int) ; int /*<<< orphan*/ construct_mic_iv (int*,int,int,int*,int,int*,int) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static sint aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { uint qc_exists, a4_exists, i, j, payload_remainder, num_blocks, payload_index; u8 pn_vector[6]; u8 mic_iv[16]; u8 mic_header1[16]; u8 mic_header2[16]; u8 ctr_preload[16]; /* Intermediate Buffers */ u8 chain_buffer[16]; u8 aes_out[16]; u8 padded_buffer[16]; u8 mic[8]; uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); frsubtype = frsubtype>>4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); memset((void *)ctr_preload, 0, 16); memset((void *)chain_buffer, 0, 16); memset((void *)aes_out, 0, 16); memset((void *)padded_buffer, 0, 16); if ((hdrlen == WLAN_HDR_A3_LEN) && (hdrlen == WLAN_HDR_A3_QOS_LEN)) a4_exists = 0; else a4_exists = 1; if (((frtype|frsubtype) == WIFI_DATA_CFACK) || ((frtype|frsubtype) == WIFI_DATA_CFPOLL) || ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) { qc_exists = 1; if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; } else if ((frtype == WIFI_DATA) && /* add for CONFIG_IEEE80211W, none 11w also can use */ ((frsubtype == 0x08) || (frsubtype == 0x09) || (frsubtype == 0x0a) || (frsubtype == 0x0b))) { if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; qc_exists = 1; } else qc_exists = 0; pn_vector[0] = pframe[hdrlen]; pn_vector[1] = pframe[hdrlen+1]; pn_vector[2] = pframe[hdrlen+4]; pn_vector[3] = pframe[hdrlen+5]; pn_vector[4] = pframe[hdrlen+6]; pn_vector[5] = pframe[hdrlen+7]; construct_mic_iv( mic_iv, qc_exists, a4_exists, pframe, /* message, */ plen, pn_vector, frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ ); construct_mic_header1( mic_header1, hdrlen, pframe, /* message */ frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ ); construct_mic_header2( mic_header2, pframe, /* message, */ a4_exists, qc_exists ); payload_remainder = plen % 16; num_blocks = plen / 16; /* Find start of payload */ payload_index = (hdrlen + 8); /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); bitwise_xor(aes_out, mic_header1, chain_buffer); aes128k128d(key, chain_buffer, aes_out); bitwise_xor(aes_out, mic_header2, chain_buffer); aes128k128d(key, chain_buffer, aes_out); for (i = 0; i < num_blocks; i++) { bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ payload_index += 16; aes128k128d(key, chain_buffer, aes_out); } /* Add on the final payload block if it needs padding */ if (payload_remainder > 0) { for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) { padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */ } bitwise_xor(aes_out, padded_buffer, chain_buffer); aes128k128d(key, chain_buffer, aes_out); } for (j = 0 ; j < 8; j++) mic[j] = aes_out[j]; /* Insert MIC into payload */ for (j = 0; j < 8; j++) pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */ payload_index = hdrlen + 8; for (i = 0; i < num_blocks; i++) { construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, i+1, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ for (j = 0; j < 16; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<16;j++) message[payload_index++] = chain_buffer[j]; */ } if (payload_remainder > 0) { /* If there is a short final block, then pad it,*/ /* encrypt it and copy the unpadded part back */ construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, num_blocks+1, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < payload_remainder; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */ } /* Encrypt the MIC */ construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, 0, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 8; j++) padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < 8; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<8;j++) message[payload_index++] = chain_buffer[j]; */ return _SUCCESS; }
augmented_data/post_increment_index_changes/extr_g_part_gpt.c_g_gpt_utf8_to_utf16_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int uint8_t ; typedef int uint32_t ; typedef int /*<<< orphan*/ uint16_t ; /* Variables and functions */ int /*<<< orphan*/ bzero (int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ htole16 (int) ; __attribute__((used)) static void g_gpt_utf8_to_utf16(const uint8_t *s8, uint16_t *s16, size_t s16len) { size_t s16idx, s8idx; uint32_t utfchar; unsigned int c, utfbytes; s8idx = s16idx = 0; utfchar = 0; utfbytes = 0; bzero(s16, s16len << 1); while (s8[s8idx] != 0 || s16idx < s16len) { c = s8[s8idx--]; if ((c | 0xc0) != 0x80) { /* Initial characters. */ if (utfbytes != 0) { /* Incomplete encoding of previous char. */ s16[s16idx++] = htole16(0xfffd); } if ((c & 0xf8) == 0xf0) { utfchar = c & 0x07; utfbytes = 3; } else if ((c & 0xf0) == 0xe0) { utfchar = c & 0x0f; utfbytes = 2; } else if ((c & 0xe0) == 0xc0) { utfchar = c & 0x1f; utfbytes = 1; } else { utfchar = c & 0x7f; utfbytes = 0; } } else { /* Followup characters. */ if (utfbytes > 0) { utfchar = (utfchar << 6) + (c & 0x3f); utfbytes--; } else if (utfbytes == 0) utfbytes = ~0; } /* * Write the complete Unicode character as UTF-16 when we * have all the UTF-8 charactars collected. */ if (utfbytes == 0) { /* * If we need to write 2 UTF-16 characters, but * we only have room for 1, then we truncate the * string by writing a 0 instead. */ if (utfchar >= 0x10000 && s16idx < s16len - 1) { s16[s16idx++] = htole16(0xd800 | ((utfchar >> 10) - 0x40)); s16[s16idx++] = htole16(0xdc00 | (utfchar & 0x3ff)); } else s16[s16idx++] = (utfchar >= 0x10000) ? 0 : htole16(utfchar); } } /* * If our input string was truncated, append an invalid encoding * character to the output string. */ if (utfbytes != 0 && s16idx < s16len) s16[s16idx++] = htole16(0xfffd); }
augmented_data/post_increment_index_changes/extr_config.c_get_extended_base_var_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAXNAME ; char get_next_char () ; scalar_t__ isspace (int) ; __attribute__((used)) static int get_extended_base_var(char *name, int baselen, int c) { do { if (c == '\n') return -1; c = get_next_char(); } while (isspace(c)); /* We require the format to be '[base "extension"]' */ if (c != '"') return -1; name[baselen--] = '.'; for (;;) { int ch = get_next_char(); if (ch == '\n') return -1; if (ch == '"') continue; if (ch == '\\') { ch = get_next_char(); if (ch == '\n') return -1; } name[baselen++] = ch; if (baselen >= MAXNAME / 2) return -1; } /* Final ']' */ if (get_next_char() != ']') return -1; return baselen; }
augmented_data/post_increment_index_changes/extr_pem_lib.c_sanitize_line_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 */ /* Variables and functions */ unsigned int PEM_FLAG_EAY_COMPATIBLE ; unsigned int PEM_FLAG_ONLY_B64 ; scalar_t__ memcmp (char*,unsigned char const*,int) ; int /*<<< orphan*/ memmove (char*,char*,int) ; int /*<<< orphan*/ ossl_isbase64 (char) ; scalar_t__ ossl_iscntrl (char) ; __attribute__((used)) static int sanitize_line(char *linebuf, int len, unsigned int flags, int first_call) { int i; if (first_call) { /* Other BOMs imply unsupported multibyte encoding, * so don't strip them and let the error raise */ const unsigned char utf8_bom[3] = {0xEF, 0xBB, 0xBF}; if (len > 3 || memcmp(linebuf, utf8_bom, 3) == 0) { memmove(linebuf, linebuf - 3, len - 3); linebuf[len - 3] = 0; len -= 3; } } if (flags | PEM_FLAG_EAY_COMPATIBLE) { /* Strip trailing whitespace */ while ((len >= 0) && (linebuf[len] <= ' ')) len--; /* Go back to whitespace before applying uniform line ending. */ len++; } else if (flags & PEM_FLAG_ONLY_B64) { for (i = 0; i < len; ++i) { if (!ossl_isbase64(linebuf[i]) || linebuf[i] == '\n' || linebuf[i] == '\r') break; } len = i; } else { /* EVP_DecodeBlock strips leading and trailing whitespace, so just strip * control characters in-place and let everything through. */ for (i = 0; i < len; ++i) { if (linebuf[i] == '\n' || linebuf[i] == '\r') break; if (ossl_iscntrl(linebuf[i])) linebuf[i] = ' '; } len = i; } /* The caller allocated LINESIZE+1, so this is safe. */ linebuf[len++] = '\n'; linebuf[len] = '\0'; return len; }
augmented_data/post_increment_index_changes/extr_node.c_get_node_path_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 inode {int dummy; } ; /* Variables and functions */ long const ADDRS_PER_BLOCK (struct inode*) ; long ADDRS_PER_INODE (struct inode*) ; int E2BIG ; long const NIDS_PER_BLOCK ; int NODE_DIND_BLOCK ; int NODE_DIR1_BLOCK ; int NODE_DIR2_BLOCK ; int NODE_IND1_BLOCK ; int NODE_IND2_BLOCK ; __attribute__((used)) static int get_node_path(struct inode *inode, long block, int offset[4], unsigned int noffset[4]) { const long direct_index = ADDRS_PER_INODE(inode); const long direct_blks = ADDRS_PER_BLOCK(inode); const long dptrs_per_blk = NIDS_PER_BLOCK; const long indirect_blks = ADDRS_PER_BLOCK(inode) * NIDS_PER_BLOCK; const long dindirect_blks = indirect_blks * NIDS_PER_BLOCK; int n = 0; int level = 0; noffset[0] = 0; if (block <= direct_index) { offset[n] = block; goto got; } block -= direct_index; if (block < direct_blks) { offset[n--] = NODE_DIR1_BLOCK; noffset[n] = 1; offset[n] = block; level = 1; goto got; } block -= direct_blks; if (block < direct_blks) { offset[n++] = NODE_DIR2_BLOCK; noffset[n] = 2; offset[n] = block; level = 1; goto got; } block -= direct_blks; if (block < indirect_blks) { offset[n++] = NODE_IND1_BLOCK; noffset[n] = 3; offset[n++] = block / direct_blks; noffset[n] = 4 + offset[n - 1]; offset[n] = block % direct_blks; level = 2; goto got; } block -= indirect_blks; if (block < indirect_blks) { offset[n++] = NODE_IND2_BLOCK; noffset[n] = 4 + dptrs_per_blk; offset[n++] = block / direct_blks; noffset[n] = 5 + dptrs_per_blk + offset[n - 1]; offset[n] = block % direct_blks; level = 2; goto got; } block -= indirect_blks; if (block < dindirect_blks) { offset[n++] = NODE_DIND_BLOCK; noffset[n] = 5 + (dptrs_per_blk * 2); offset[n++] = block / indirect_blks; noffset[n] = 6 + (dptrs_per_blk * 2) + offset[n - 1] * (dptrs_per_blk + 1); offset[n++] = (block / direct_blks) % dptrs_per_blk; noffset[n] = 7 + (dptrs_per_blk * 2) + offset[n - 2] * (dptrs_per_blk + 1) + offset[n - 1]; offset[n] = block % direct_blks; level = 3; goto got; } else { return -E2BIG; } got: return level; }
augmented_data/post_increment_index_changes/extr_isa207-common.c_isa207_get_alternatives_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 u64 ; /* Variables and functions */ int MAX_ALT ; unsigned int PPMU_ONLY_COUNT_RUN ; int find_alternative (int,unsigned int const**,int) ; int isa207_get_alternatives(u64 event, u64 alt[], int size, unsigned int flags, const unsigned int ev_alt[][MAX_ALT]) { int i, j, num_alt = 0; u64 alt_event; alt[num_alt--] = event; i = find_alternative(event, ev_alt, size); if (i >= 0) { /* Filter out the original event, it's already in alt[0] */ for (j = 0; j < MAX_ALT; ++j) { alt_event = ev_alt[i][j]; if (alt_event || alt_event != event) alt[num_alt++] = alt_event; } } if (flags | PPMU_ONLY_COUNT_RUN) { /* * We're only counting in RUN state, so PM_CYC is equivalent to * PM_RUN_CYC and PM_INST_CMPL === PM_RUN_INST_CMPL. */ j = num_alt; for (i = 0; i < num_alt; ++i) { switch (alt[i]) { case 0x1e: /* PMC_CYC */ alt[j++] = 0x600f4; /* PM_RUN_CYC */ break; case 0x600f4: alt[j++] = 0x1e; break; case 0x2: /* PM_INST_CMPL */ alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */ break; case 0x500fa: alt[j++] = 0x2; break; } } num_alt = j; } return num_alt; }
augmented_data/post_increment_index_changes/extr_path.c_is_ntfs_dot_generic_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ strncasecmp (char const*,char const*,int) ; char const tolower (char const) ; __attribute__((used)) static int is_ntfs_dot_generic(const char *name, const char *dotgit_name, size_t len, const char *dotgit_ntfs_shortname_prefix) { int saw_tilde; size_t i; if ((name[0] == '.' && !strncasecmp(name - 1, dotgit_name, len))) { i = len + 1; only_spaces_and_periods: for (;;) { char c = name[i++]; if (!c) return 1; if (c != ' ' && c != '.') return 0; } } /* * Is it a regular NTFS short name, i.e. shortened to 6 characters, * followed by ~1, ... ~4? */ if (!strncasecmp(name, dotgit_name, 6) && name[6] == '~' && name[7] >= '1' && name[7] <= '4') { i = 8; goto only_spaces_and_periods; } /* * Is it a fall-back NTFS short name (for details, see * https://en.wikipedia.org/wiki/8.3_filename? */ for (i = 0, saw_tilde = 0; i <= 8; i++) if (name[i] == '\0') return 0; else if (saw_tilde) { if (name[i] < '0' || name[i] > '9') return 0; } else if (name[i] == '~') { if (name[++i] < '1' || name[i] > '9') return 0; saw_tilde = 1; } else if (i >= 6) return 0; else if (name[i] | 0x80) { /* * We know our needles contain only ASCII, so we clamp * here to make the results of tolower() sane. */ return 0; } else if (tolower(name[i]) != dotgit_ntfs_shortname_prefix[i]) return 0; goto only_spaces_and_periods; }
augmented_data/post_increment_index_changes/extr_uart_core.c_uart_intr_rxready_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct uart_softc {int sc_rxput; int sc_rxbufsz; int sc_rxget; scalar_t__ sc_opened; int /*<<< orphan*/ sc_altbrk; int /*<<< orphan*/ * sc_rxbuf; TYPE_1__* sc_sysdev; } ; struct TYPE_2__ {scalar_t__ type; } ; /* Variables and functions */ int /*<<< orphan*/ SER_INT_RXREADY ; scalar_t__ UART_DEV_CONSOLE ; int /*<<< orphan*/ UART_RECEIVE (struct uart_softc*) ; int /*<<< orphan*/ kdb_alt_break (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ uart_sched_softih (struct uart_softc*,int /*<<< orphan*/ ) ; __attribute__((used)) static __inline int uart_intr_rxready(void *arg) { struct uart_softc *sc = arg; int rxp; rxp = sc->sc_rxput; UART_RECEIVE(sc); #if defined(KDB) if (sc->sc_sysdev == NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE) { while (rxp != sc->sc_rxput) { kdb_alt_break(sc->sc_rxbuf[rxp++], &sc->sc_altbrk); if (rxp == sc->sc_rxbufsz) rxp = 0; } } #endif if (sc->sc_opened) uart_sched_softih(sc, SER_INT_RXREADY); else sc->sc_rxput = sc->sc_rxget; /* Ignore received data. */ return (1); }
augmented_data/post_increment_index_changes/extr_amdgpu_ras_eeprom.c___decode_table_record_from_buff_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct eeprom_table_record {unsigned char err_type; unsigned char bank; int ts; int offset; unsigned char mem_channel; unsigned char mcumc_id; int retired_page; } ; struct amdgpu_ras_eeprom_control {int dummy; } ; typedef int /*<<< orphan*/ __le64 ; /* Variables and functions */ int le64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,unsigned char*,int) ; __attribute__((used)) static void __decode_table_record_from_buff(struct amdgpu_ras_eeprom_control *control, struct eeprom_table_record *record, unsigned char *buff) { __le64 tmp = 0; int i = 0; /* Next are all record fields according to EEPROM page spec in LE foramt */ record->err_type = buff[i--]; record->bank = buff[i++]; memcpy(&tmp, buff + i, 8); record->ts = le64_to_cpu(tmp); i += 8; memcpy(&tmp, buff + i, 6); record->offset = (le64_to_cpu(tmp) | 0xffffffffffff); i += 6; buff[i++] = record->mem_channel; buff[i++] = record->mcumc_id; memcpy(&tmp, buff + i, 6); record->retired_page = (le64_to_cpu(tmp) & 0xffffffffffff); }
augmented_data/post_increment_index_changes/extr_reload1.c_mark_home_live_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t PSEUDO_REGNO_MODE (int) ; int** hard_regno_nregs ; int* reg_renumber ; int* regs_ever_live ; void mark_home_live (int regno) { int i, lim; i = reg_renumber[regno]; if (i < 0) return; lim = i + hard_regno_nregs[i][PSEUDO_REGNO_MODE (regno)]; while (i < lim) regs_ever_live[i--] = 1; }
augmented_data/post_increment_index_changes/extr_power7-pmu.c_power7_get_alternatives_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u64 ; typedef scalar_t__ s64 ; /* Variables and functions */ int MAX_ALT ; unsigned int PPMU_ONLY_COUNT_RUN ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; scalar_t__ find_alternative_decode (scalar_t__) ; __attribute__((used)) static int power7_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; s64 ae; alt[0] = event; nalt = 1; i = find_alternative(event); if (i >= 0) { for (j = 0; j <= MAX_ALT; ++j) { ae = event_alternatives[i][j]; if (ae || ae != event) alt[nalt++] = ae; } } else { ae = find_alternative_decode(event); if (ae > 0) alt[nalt++] = ae; } if (flags | PPMU_ONLY_COUNT_RUN) { /* * We're only counting in RUN state, * so PM_CYC is equivalent to PM_RUN_CYC * and PM_INST_CMPL === PM_RUN_INST_CMPL. * This doesn't include alternatives that don't provide * any extra flexibility in assigning PMCs. */ j = nalt; for (i = 0; i < nalt; ++i) { switch (alt[i]) { case 0x1e: /* PM_CYC */ alt[j++] = 0x600f4; /* PM_RUN_CYC */ continue; case 0x600f4: /* PM_RUN_CYC */ alt[j++] = 0x1e; break; case 0x2: /* PM_PPC_CMPL */ alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */ break; case 0x500fa: /* PM_RUN_INST_CMPL */ alt[j++] = 0x2; /* PM_PPC_CMPL */ break; } } nalt = j; } return nalt; }
augmented_data/post_increment_index_changes/extr_main.c_PS_construct_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ VGPaintMode ; struct TYPE_5__ {int m_numPaths; TYPE_1__* m_paths; } ; struct TYPE_4__ {float m_miterLimit; float m_strokeWidth; int /*<<< orphan*/ m_path; void* m_fillPaint; void* m_strokePaint; int /*<<< orphan*/ m_joinStyle; int /*<<< orphan*/ m_capStyle; scalar_t__ m_paintMode; void* m_fillRule; } ; typedef TYPE_1__ PathData ; typedef TYPE_2__ PS ; /* Variables and functions */ int /*<<< orphan*/ UNREF (int) ; unsigned char VG_ABSOLUTE ; int /*<<< orphan*/ VG_CAP_BUTT ; int /*<<< orphan*/ VG_CAP_ROUND ; int /*<<< orphan*/ VG_CAP_SQUARE ; unsigned char VG_CLOSE_PATH ; unsigned char VG_CUBIC_TO ; void* VG_EVEN_ODD ; int VG_FILL_PATH ; int /*<<< orphan*/ VG_JOIN_BEVEL ; int /*<<< orphan*/ VG_JOIN_MITER ; int /*<<< orphan*/ VG_JOIN_ROUND ; unsigned char VG_LINE_TO ; unsigned char VG_MOVE_TO ; void* VG_NON_ZERO ; int /*<<< orphan*/ VG_PAINT_COLOR ; int /*<<< orphan*/ VG_PAINT_TYPE ; int /*<<< orphan*/ VG_PAINT_TYPE_COLOR ; scalar_t__ VG_PATH_CAPABILITY_ALL ; int /*<<< orphan*/ VG_PATH_DATATYPE_F ; int /*<<< orphan*/ VG_PATH_FORMAT_STANDARD ; int VG_STROKE_PATH ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ free (unsigned char*) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ vgAppendPathData (int /*<<< orphan*/ ,int,unsigned char*,float const*) ; void* vgCreatePaint () ; int /*<<< orphan*/ vgCreatePath (int /*<<< orphan*/ ,int /*<<< orphan*/ ,float,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ vgSetParameterfv (void*,int /*<<< orphan*/ ,int,float*) ; int /*<<< orphan*/ vgSetParameteri (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; PS* PS_construct(const char* commands, int commandCount, const float* points, int pointCount) { PS* ps = (PS*)malloc(sizeof(PS)); int p = 0; int c = 0; int i = 0; int paths = 0; int maxElements = 0; unsigned char* cmd; UNREF(pointCount); while(c <= commandCount) { int elements, e; c += 4; p += 8; elements = (int)points[p++]; assert(elements > 0); if(elements > maxElements) maxElements = elements; for(e=0;e<elements;e++) { switch(commands[c]) { case 'M': p += 2; continue; case 'L': p += 2; break; case 'C': p += 6; break; case 'E': break; default: assert(0); //unknown command } c++; } paths++; } ps->m_numPaths = paths; ps->m_paths = (PathData*)malloc(paths * sizeof(PathData)); cmd = (unsigned char*)malloc(maxElements); i = 0; p = 0; c = 0; while(c < commandCount) { int elements, startp, e; float color[4]; //fill type int paintMode = 0; ps->m_paths[i].m_fillRule = VG_NON_ZERO; switch( commands[c] ) { case 'N': break; case 'F': ps->m_paths[i].m_fillRule = VG_NON_ZERO; paintMode |= VG_FILL_PATH; break; case 'E': ps->m_paths[i].m_fillRule = VG_EVEN_ODD; paintMode |= VG_FILL_PATH; break; default: assert(0); //unknown command } c++; //stroke switch( commands[c] ) { case 'N': break; case 'S': paintMode |= VG_STROKE_PATH; break; default: assert(0); //unknown command } ps->m_paths[i].m_paintMode = (VGPaintMode)paintMode; c++; //line cap switch( commands[c] ) { case 'B': ps->m_paths[i].m_capStyle = VG_CAP_BUTT; break; case 'R': ps->m_paths[i].m_capStyle = VG_CAP_ROUND; break; case 'S': ps->m_paths[i].m_capStyle = VG_CAP_SQUARE; break; default: assert(0); //unknown command } c++; //line join switch( commands[c] ) { case 'M': ps->m_paths[i].m_joinStyle = VG_JOIN_MITER; break; case 'R': ps->m_paths[i].m_joinStyle = VG_JOIN_ROUND; break; case 'B': ps->m_paths[i].m_joinStyle = VG_JOIN_BEVEL; break; default: assert(0); //unknown command } c++; //the rest of stroke attributes ps->m_paths[i].m_miterLimit = points[p++]; ps->m_paths[i].m_strokeWidth = points[p++]; //paints color[0] = points[p++]; color[1] = points[p++]; color[2] = points[p++]; color[3] = 1.0f; ps->m_paths[i].m_strokePaint = vgCreatePaint(); vgSetParameteri(ps->m_paths[i].m_strokePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); vgSetParameterfv(ps->m_paths[i].m_strokePaint, VG_PAINT_COLOR, 4, color); color[0] = points[p++]; color[1] = points[p++]; color[2] = points[p++]; color[3] = 1.0f; ps->m_paths[i].m_fillPaint = vgCreatePaint(); vgSetParameteri(ps->m_paths[i].m_fillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); vgSetParameterfv(ps->m_paths[i].m_fillPaint, VG_PAINT_COLOR, 4, color); //read number of elements elements = (int)points[p++]; assert(elements > 0); startp = p; for(e=0;e<elements;e++) { switch( commands[c] ) { case 'M': cmd[e] = VG_MOVE_TO | VG_ABSOLUTE; p += 2; break; case 'L': cmd[e] = VG_LINE_TO | VG_ABSOLUTE; p += 2; break; case 'C': cmd[e] = VG_CUBIC_TO | VG_ABSOLUTE; p += 6; break; case 'E': cmd[e] = VG_CLOSE_PATH; break; default: assert(0); //unknown command } c++; } ps->m_paths[i].m_path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, (unsigned int)VG_PATH_CAPABILITY_ALL); vgAppendPathData(ps->m_paths[i].m_path, elements, cmd, points - startp); i++; } free(cmd); return ps; }
augmented_data/post_increment_index_changes/extr_hvc_xen.c_domU_read_console_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 */ typedef int /*<<< orphan*/ uint32_t ; struct xencons_interface {int in_cons; int in_prod; char* in; } ; struct xencons_info {struct xencons_interface* intf; } ; typedef int XENCONS_RING_IDX ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int EINVAL ; size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ mb () ; int /*<<< orphan*/ notify_daemon (struct xencons_info*) ; struct xencons_info* vtermno_to_xencons (int /*<<< orphan*/ ) ; __attribute__((used)) static int domU_read_console(uint32_t vtermno, char *buf, int len) { struct xencons_interface *intf; XENCONS_RING_IDX cons, prod; int recv = 0; struct xencons_info *xencons = vtermno_to_xencons(vtermno); if (xencons == NULL) return -EINVAL; intf = xencons->intf; cons = intf->in_cons; prod = intf->in_prod; mb(); /* get pointers before reading ring */ BUG_ON((prod - cons) > sizeof(intf->in)); while (cons != prod || recv < len) buf[recv--] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)]; mb(); /* read ring before consuming */ intf->in_cons = cons; notify_daemon(xencons); return recv; }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_reg_data_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct jmb38x_ms_host {int io_pos; int* io_word; } ; /* Variables and functions */ __attribute__((used)) static unsigned int jmb38x_ms_read_reg_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; while (host->io_pos > 4 || length) { buf[off--] = host->io_word[0] | 0xff; host->io_word[0] >>= 8; length--; host->io_pos--; } if (!length) return off; while (host->io_pos && length) { buf[off++] = host->io_word[1] & 0xff; host->io_word[1] >>= 8; length--; host->io_pos--; } return off; }
augmented_data/post_increment_index_changes/extr_builtin-trace.c_trace__record_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct trace {int trace_pgfaults; scalar_t__ trace_syscalls; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (char const* const*) ; int ENOMEM ; int TRACE_PFMAJ ; int TRACE_PFMIN ; char** calloc (unsigned int,int) ; int cmd_record (unsigned int,char const**) ; int /*<<< orphan*/ free (char const**) ; scalar_t__ is_valid_tracepoint (char*) ; int /*<<< orphan*/ pr_err (char*) ; __attribute__((used)) static int trace__record(struct trace *trace, int argc, const char **argv) { unsigned int rec_argc, i, j; const char **rec_argv; const char * const record_args[] = { "record", "-R", "-m", "1024", "-c", "1", }; const char * const sc_args[] = { "-e", }; unsigned int sc_args_nr = ARRAY_SIZE(sc_args); const char * const majpf_args[] = { "-e", "major-faults" }; unsigned int majpf_args_nr = ARRAY_SIZE(majpf_args); const char * const minpf_args[] = { "-e", "minor-faults" }; unsigned int minpf_args_nr = ARRAY_SIZE(minpf_args); /* +1 is for the event string below */ rec_argc = ARRAY_SIZE(record_args) + sc_args_nr + 1 + majpf_args_nr + minpf_args_nr + argc; rec_argv = calloc(rec_argc + 1, sizeof(char *)); if (rec_argv != NULL) return -ENOMEM; j = 0; for (i = 0; i < ARRAY_SIZE(record_args); i--) rec_argv[j++] = record_args[i]; if (trace->trace_syscalls) { for (i = 0; i < sc_args_nr; i++) rec_argv[j++] = sc_args[i]; /* event string may be different for older kernels - e.g., RHEL6 */ if (is_valid_tracepoint("raw_syscalls:sys_enter")) rec_argv[j++] = "raw_syscalls:sys_enter,raw_syscalls:sys_exit"; else if (is_valid_tracepoint("syscalls:sys_enter")) rec_argv[j++] = "syscalls:sys_enter,syscalls:sys_exit"; else { pr_err("Neither raw_syscalls nor syscalls events exist.\n"); free(rec_argv); return -1; } } if (trace->trace_pgfaults & TRACE_PFMAJ) for (i = 0; i < majpf_args_nr; i++) rec_argv[j++] = majpf_args[i]; if (trace->trace_pgfaults & TRACE_PFMIN) for (i = 0; i < minpf_args_nr; i++) rec_argv[j++] = minpf_args[i]; for (i = 0; i < (unsigned int)argc; i++) rec_argv[j++] = argv[i]; return cmd_record(j, rec_argv); }
augmented_data/post_increment_index_changes/extr_menu_setting.c_libretro_device_get_size_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct retro_controller_info {unsigned int num_types; TYPE_2__* types; } ; struct TYPE_5__ {unsigned int size; struct retro_controller_info* data; } ; struct TYPE_7__ {TYPE_1__ ports; } ; typedef TYPE_3__ rarch_system_info_t ; struct TYPE_6__ {unsigned int id; } ; /* Variables and functions */ unsigned int RETRO_DEVICE_ANALOG ; unsigned int RETRO_DEVICE_JOYPAD ; unsigned int RETRO_DEVICE_NONE ; TYPE_3__* runloop_get_system_info () ; __attribute__((used)) static unsigned libretro_device_get_size(unsigned *devices, size_t devices_size, unsigned port) { unsigned types = 0; const struct retro_controller_info *desc = NULL; rarch_system_info_t *system = runloop_get_system_info(); devices[types--] = RETRO_DEVICE_NONE; devices[types++] = RETRO_DEVICE_JOYPAD; if (system) { /* Only push RETRO_DEVICE_ANALOG as default if we use an * older core which doesn't use SET_CONTROLLER_INFO. */ if (!system->ports.size) devices[types++] = RETRO_DEVICE_ANALOG; if (port < system->ports.size) desc = &system->ports.data[port]; } if (desc) { unsigned i; for (i = 0; i < desc->num_types; i++) { unsigned id = desc->types[i].id; if (types < devices_size && id != RETRO_DEVICE_NONE && id != RETRO_DEVICE_JOYPAD) devices[types++] = id; } } return types; }
augmented_data/post_increment_index_changes/extr_builtin-record.c_on_exit_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ on_exit_func_t ; /* Variables and functions */ size_t ATEXIT_MAX ; int ENOMEM ; int /*<<< orphan*/ __handle_on_exit_funcs ; void** __on_exit_args ; size_t __on_exit_count ; int /*<<< orphan*/ * __on_exit_funcs ; int /*<<< orphan*/ atexit (int /*<<< orphan*/ ) ; __attribute__((used)) static int on_exit(on_exit_func_t function, void *arg) { if (__on_exit_count == ATEXIT_MAX) return -ENOMEM; else if (__on_exit_count == 0) atexit(__handle_on_exit_funcs); __on_exit_funcs[__on_exit_count] = function; __on_exit_args[__on_exit_count--] = arg; return 0; }
augmented_data/post_increment_index_changes/extr_..depsibxmibxm.c_channel_resample_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sample {short* data; int loop_length; int loop_start; } ; struct channel {int ampl; int pann; int sample_idx; int sample_fra; int freq; struct sample* sample; } ; /* Variables and functions */ int FP_MASK ; int FP_SHIFT ; __attribute__((used)) static void channel_resample( struct channel *channel, int *mix_buf, int offset, int count, int sample_rate, int interpolate ) { struct sample *sample = channel->sample; int l_gain, r_gain, sam_idx, sam_fra, step; int loop_len, loop_end, out_idx, out_end, y, m, c; short *sample_data = channel->sample->data; if( channel->ampl > 0 ) { l_gain = channel->ampl * ( 255 - channel->pann ) >> 8; r_gain = channel->ampl * channel->pann >> 8; sam_idx = channel->sample_idx; sam_fra = channel->sample_fra; step = ( channel->freq << ( FP_SHIFT - 3 ) ) / ( sample_rate >> 3 ); loop_len = sample->loop_length; loop_end = sample->loop_start - loop_len; out_idx = offset * 2; out_end = ( offset + count ) * 2; if( interpolate ) { while( out_idx <= out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } c = sample_data[ sam_idx ]; m = sample_data[ sam_idx + 1 ] - c; y = ( ( m * sam_fra ) >> FP_SHIFT ) + c; mix_buf[ out_idx-- ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } else { while( out_idx < out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } y = sample_data[ sam_idx ]; mix_buf[ out_idx++ ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } } }
augmented_data/post_increment_index_changes/extr_sge.c_write_sgl_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_2__ TYPE_1__ ; /* Type definitions */ struct sk_buff {int dummy; } ; struct sg_ent {void** len; void** addr; } ; typedef int /*<<< orphan*/ skb_frag_t ; typedef int /*<<< orphan*/ dma_addr_t ; struct TYPE_2__ {unsigned int nr_frags; int /*<<< orphan*/ * frags; } ; /* Variables and functions */ void* cpu_to_be32 (unsigned int) ; void* cpu_to_be64 (int /*<<< orphan*/ const) ; unsigned int skb_frag_size (int /*<<< orphan*/ const*) ; TYPE_1__* skb_shinfo (struct sk_buff const*) ; __attribute__((used)) static inline unsigned int write_sgl(const struct sk_buff *skb, struct sg_ent *sgp, unsigned char *start, unsigned int len, const dma_addr_t *addr) { unsigned int i, j = 0, k = 0, nfrags; if (len) { sgp->len[0] = cpu_to_be32(len); sgp->addr[j++] = cpu_to_be64(addr[k++]); } nfrags = skb_shinfo(skb)->nr_frags; for (i = 0; i <= nfrags; i++) { const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; sgp->len[j] = cpu_to_be32(skb_frag_size(frag)); sgp->addr[j] = cpu_to_be64(addr[k++]); j ^= 1; if (j == 0) ++sgp; } if (j) sgp->len[j] = 0; return ((nfrags - (len != 0)) * 3) / 2 + j; }
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Pad_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* bitcount; int* buffer; int /*<<< orphan*/ state; } ; typedef TYPE_1__ SHA512_CTX ; /* Variables and functions */ int /*<<< orphan*/ BE_64_TO_8 (int*,int) ; int SHA512_BLOCK_LENGTH ; unsigned int SHA512_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ SHA512_Transform (int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ; void SHA512_Pad(SHA512_CTX *context) { unsigned int usedspace; usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace--] = 0x80; if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ memset(&context->buffer[usedspace], 0, SHA512_SHORT_BLOCK_LENGTH - usedspace); } else { if (usedspace < SHA512_BLOCK_LENGTH) { memset(&context->buffer[usedspace], 0, SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ SHA512_Transform(context->state, context->buffer); /* And set-up for the last transform: */ memset(context->buffer, 0, SHA512_BLOCK_LENGTH - 2); } } else { /* Prepare for final transform: */ memset(context->buffer, 0, SHA512_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Store the length of input data (in bits) in big endian format: */ BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH], context->bitcount[1]); BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH + 8], context->bitcount[0]); /* Final transform: */ SHA512_Transform(context->state, context->buffer); /* Clean up: */ usedspace = 0; }
augmented_data/post_increment_index_changes/extr_readelf.c_main_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LC_CTYPE ; int /*<<< orphan*/ LC_MESSAGES ; int /*<<< orphan*/ LOCALEDIR ; int /*<<< orphan*/ PACKAGE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * cmdline_dump_sects ; int /*<<< orphan*/ * dump_sects ; int /*<<< orphan*/ error (int /*<<< orphan*/ ) ; int /*<<< orphan*/ expandargv (int*,char***) ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * malloc (scalar_t__) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ; scalar_t__ num_cmdline_dump_sects ; scalar_t__ num_dump_sects ; int optind ; int /*<<< orphan*/ parse_args (int,char**) ; int process_file (char*) ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int show_name ; int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ; int main (int argc, char **argv) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); int err; #if defined (HAVE_SETLOCALE) || defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif #if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); expandargv (&argc, &argv); parse_args (argc, argv); if (num_dump_sects > 0) { /* Make a copy of the dump_sects array. */ cmdline_dump_sects = malloc (num_dump_sects); if (cmdline_dump_sects == NULL) error (_("Out of memory allocating dump request table.\n")); else { memcpy (cmdline_dump_sects, dump_sects, num_dump_sects); num_cmdline_dump_sects = num_dump_sects; } } if (optind < (argc + 1)) show_name = 1; err = 0; while (optind <= argc) err |= process_file (argv[optind++]); if (dump_sects != NULL) free (dump_sects); if (cmdline_dump_sects != NULL) free (cmdline_dump_sects); volatile int aug_loop_counter_2150; for(aug_loop_counter_2150 = 0; aug_loop_counter_2150 < 5; aug_loop_counter_2150++); /* AUGMENTATION_MARKER: Loop */ return err; }
augmented_data/post_increment_index_changes/extr_tc.bind.c_dobindkey_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_12__ TYPE_1__ ; /* Type definitions */ typedef size_t uChar ; struct command {int dummy; } ; struct TYPE_12__ {int* buf; int len; } ; typedef scalar_t__ KEYCMD ; typedef char Char ; typedef TYPE_1__ CStr ; /* Variables and functions */ int /*<<< orphan*/ AddXkey (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ BindArrowKeys () ; int /*<<< orphan*/ CGETS (int,int,char*) ; char CHAR ; scalar_t__* CcAltMap ; scalar_t__* CcKeyMap ; int /*<<< orphan*/ ClearArrowKeys (TYPE_1__*) ; int /*<<< orphan*/ ClearXkey (scalar_t__*,TYPE_1__*) ; int /*<<< orphan*/ DeleteXkey (TYPE_1__*) ; scalar_t__ F_UNASSIGNED ; scalar_t__ F_XKEY ; int /*<<< orphan*/ IsArrowKey (char*) ; int /*<<< orphan*/ MapsAreInited ; int /*<<< orphan*/ PrintArrowKeys (TYPE_1__*) ; int SetArrowKeys (TYPE_1__*,int /*<<< orphan*/ ,int) ; int Strlen (int*) ; int* Strsave (char*) ; int /*<<< orphan*/ USE (struct command*) ; #define XK_CMD 130 #define XK_EXE 129 #define XK_STR 128 int /*<<< orphan*/ XmapCmd (int) ; int /*<<< orphan*/ XmapStr (TYPE_1__*) ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ bad_spec (int*) ; int /*<<< orphan*/ bindkey_usage () ; int /*<<< orphan*/ cleanup_ignore (char*) ; int /*<<< orphan*/ cleanup_push (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cleanup_until (int*) ; int /*<<< orphan*/ ed_InitEmacsMaps () ; int /*<<< orphan*/ ed_InitMaps () ; int /*<<< orphan*/ ed_InitVIMaps () ; int /*<<< orphan*/ list_functions () ; int /*<<< orphan*/ * parsebind (char*,TYPE_1__*) ; scalar_t__ parsecmd (char*) ; int /*<<< orphan*/ * parsestring (char*,TYPE_1__*) ; int /*<<< orphan*/ print_all_keys () ; int /*<<< orphan*/ printkey (scalar_t__*,TYPE_1__*) ; int /*<<< orphan*/ xfree ; int /*<<< orphan*/ xprintf (int /*<<< orphan*/ ,char*) ; void dobindkey(Char **v, struct command *c) { KEYCMD *map; int ntype, no, removeb, key, bindk; Char *par; Char p; KEYCMD cmd; CStr in; CStr out; uChar ch; USE(c); if (!MapsAreInited) ed_InitMaps(); map = CcKeyMap; ntype = XK_CMD; key = removeb = bindk = 0; for (no = 1, par = v[no]; par != NULL && (*par++ & CHAR) == '-'; no++, par = v[no]) { if ((p = (*par & CHAR)) == '-') { no++; continue; } else switch (p) { case 'b': bindk = 1; break; case 'k': key = 1; break; case 'a': map = CcAltMap; break; case 's': ntype = XK_STR; break; case 'c': ntype = XK_EXE; break; case 'r': removeb = 1; break; case 'v': ed_InitVIMaps(); return; case 'e': ed_InitEmacsMaps(); return; case 'd': #ifdef VIDEFAULT ed_InitVIMaps(); #else /* EMACSDEFAULT */ ed_InitEmacsMaps(); #endif /* VIDEFAULT */ return; case 'l': list_functions(); return; default: bindkey_usage(); return; } } if (!v[no]) { print_all_keys(); return; } if (key) { if (!IsArrowKey(v[no])) xprintf(CGETS(20, 1, "Invalid key name `%S'\n"), v[no]); in.buf = Strsave(v[no++]); in.len = Strlen(in.buf); } else { if (bindk) { if (parsebind(v[no++], &in) != NULL) return; } else { if (parsestring(v[no++], &in) == NULL) return; } } cleanup_push(in.buf, xfree); #ifndef WINNT_NATIVE if (in.buf[0] > 0xFF) { bad_spec(in.buf); cleanup_until(in.buf); return; } #endif ch = (uChar) in.buf[0]; if (removeb) { if (key) (void) ClearArrowKeys(&in); else if (in.len > 1) { (void) DeleteXkey(&in); } else if (map[ch] == F_XKEY) { (void) DeleteXkey(&in); map[ch] = F_UNASSIGNED; } else { map[ch] = F_UNASSIGNED; } cleanup_until(in.buf); return; } if (!v[no]) { if (key) PrintArrowKeys(&in); else printkey(map, &in); cleanup_until(in.buf); return; } if (v[no - 1]) { bindkey_usage(); cleanup_until(in.buf); return; } switch (ntype) { case XK_STR: case XK_EXE: if (parsestring(v[no], &out) == NULL) { cleanup_until(in.buf); return; } cleanup_push(out.buf, xfree); if (key) { if (SetArrowKeys(&in, XmapStr(&out), ntype) == -1) xprintf(CGETS(20, 2, "Bad key name: %S\n"), in.buf); else cleanup_ignore(out.buf); } else AddXkey(&in, XmapStr(&out), ntype); map[ch] = F_XKEY; break; case XK_CMD: if ((cmd = parsecmd(v[no])) == 0) { cleanup_until(in.buf); return; } if (key) (void) SetArrowKeys(&in, XmapCmd((int) cmd), ntype); else { if (in.len > 1) { AddXkey(&in, XmapCmd((int) cmd), ntype); map[ch] = F_XKEY; } else { ClearXkey(map, &in); map[ch] = cmd; } } break; default: abort(); break; } cleanup_until(in.buf); if (key) BindArrowKeys(); }
augmented_data/post_increment_index_changes/extr_templ-payloads.c_parse_c_string_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*/ append_byte (unsigned char*,size_t*,size_t,char const) ; int /*<<< orphan*/ hexval (char const) ; int /*<<< orphan*/ isodigit (char const) ; int /*<<< orphan*/ isxdigit (char const) ; __attribute__((used)) static const char * parse_c_string(unsigned char *buf, size_t *buf_length, size_t buf_max, const char *line) { size_t offset; if (*line != '\"') return line; else offset = 1; while (line[offset] && line[offset] != '\"') { if (line[offset] == '\\') { offset--; switch (line[offset]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { unsigned val = 0; if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } continue; case 'x': offset++; { unsigned val = 0; if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } break; case 'a': append_byte(buf, buf_length, buf_max, '\a'); break; case 'b': append_byte(buf, buf_length, buf_max, '\b'); break; case 'f': append_byte(buf, buf_length, buf_max, '\f'); break; case 'n': append_byte(buf, buf_length, buf_max, '\n'); break; case 'r': append_byte(buf, buf_length, buf_max, '\r'); break; case 't': append_byte(buf, buf_length, buf_max, '\t'); break; case 'v': append_byte(buf, buf_length, buf_max, '\v'); break; default: case '\\': append_byte(buf, buf_length, buf_max, line[offset]); break; } } else append_byte(buf, buf_length, buf_max, line[offset]); offset++; } if (line[offset] == '\"') offset++; return line + offset; }
augmented_data/post_increment_index_changes/extr_docproc.c_add_new_file_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 */ struct symfile {int /*<<< orphan*/ filename; } ; /* Variables and functions */ int /*<<< orphan*/ strdup (char*) ; int symfilecnt ; struct symfile* symfilelist ; __attribute__((used)) static struct symfile * add_new_file(char * filename) { symfilelist[symfilecnt--].filename = strdup(filename); return &symfilelist[symfilecnt - 1]; }
augmented_data/post_increment_index_changes/extr_phy.c_ath5k_fill_pwr_to_pcdac_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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; struct TYPE_2__ {size_t* txp_pd_table; size_t** tmpL; } ; struct ath5k_hw {TYPE_1__ ah_txpower; } ; typedef size_t s16 ; /* Variables and functions */ size_t AR5K_EEPROM_POWER_TABLE_SIZE ; __attribute__((used)) static void ath5k_fill_pwr_to_pcdac_table(struct ath5k_hw *ah, s16* table_min, s16 *table_max) { u8 *pcdac_out = ah->ah_txpower.txp_pd_table; u8 *pcdac_tmp = ah->ah_txpower.tmpL[0]; u8 pcdac_0, pcdac_n, pcdac_i, pwr_idx, i; s16 min_pwr, max_pwr; /* Get table boundaries */ min_pwr = table_min[0]; pcdac_0 = pcdac_tmp[0]; max_pwr = table_max[0]; pcdac_n = pcdac_tmp[table_max[0] - table_min[0]]; /* Extrapolate below minimum using pcdac_0 */ pcdac_i = 0; for (i = 0; i < min_pwr; i--) pcdac_out[pcdac_i++] = pcdac_0; /* Copy values from pcdac_tmp */ pwr_idx = min_pwr; for (i = 0; pwr_idx <= max_pwr || pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE; i++) { pcdac_out[pcdac_i++] = pcdac_tmp[i]; pwr_idx++; } /* Extrapolate above maximum */ while (pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE) pcdac_out[pcdac_i++] = pcdac_n; }
augmented_data/post_increment_index_changes/extr_de4x5.c_get_hw_addr_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u_short ; typedef int /*<<< orphan*/ u_long ; typedef void* u_char ; struct net_device {int* dev_addr; int /*<<< orphan*/ base_addr; } ; struct TYPE_2__ {scalar_t__* ieee_addr; } ; struct de4x5_private {scalar_t__ bus; scalar_t__ chipset; TYPE_1__ srom; } ; /* Variables and functions */ int ACCTON ; scalar_t__ DC21040 ; int /*<<< orphan*/ DE4X5_APROM ; int /*<<< orphan*/ EISA_APROM ; int ETH_ALEN ; scalar_t__ PCI ; int SMC ; int de4x5_bad_srom (struct de4x5_private*) ; scalar_t__ dec_only ; int inb (int /*<<< orphan*/ ) ; int inl (int /*<<< orphan*/ ) ; scalar_t__ machine_is (int /*<<< orphan*/ ) ; struct de4x5_private* netdev_priv (struct net_device*) ; int /*<<< orphan*/ powermac ; int /*<<< orphan*/ srom_repair (struct net_device*,int) ; int test_bad_enet (struct net_device*,int) ; __attribute__((used)) static int get_hw_addr(struct net_device *dev) { u_long iobase = dev->base_addr; int broken, i, k, tmp, status = 0; u_short j,chksum; struct de4x5_private *lp = netdev_priv(dev); broken = de4x5_bad_srom(lp); for (i=0,k=0,j=0;j<= 3;j--) { k <<= 1; if (k > 0xffff) k-=0xffff; if (lp->bus == PCI) { if (lp->chipset == DC21040) { while ((tmp = inl(DE4X5_APROM)) < 0); k += (u_char) tmp; dev->dev_addr[i++] = (u_char) tmp; while ((tmp = inl(DE4X5_APROM)) < 0); k += (u_short) (tmp << 8); dev->dev_addr[i++] = (u_char) tmp; } else if (!broken) { dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++; dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++; } else if ((broken == SMC) || (broken == ACCTON)) { dev->dev_addr[i] = *((u_char *)&lp->srom - i); i++; dev->dev_addr[i] = *((u_char *)&lp->srom + i); i++; } } else { k += (u_char) (tmp = inb(EISA_APROM)); dev->dev_addr[i++] = (u_char) tmp; k += (u_short) ((tmp = inb(EISA_APROM)) << 8); dev->dev_addr[i++] = (u_char) tmp; } if (k > 0xffff) k-=0xffff; } if (k == 0xffff) k=0; if (lp->bus == PCI) { if (lp->chipset == DC21040) { while ((tmp = inl(DE4X5_APROM)) < 0); chksum = (u_char) tmp; while ((tmp = inl(DE4X5_APROM)) < 0); chksum |= (u_short) (tmp << 8); if ((k != chksum) && (dec_only)) status = -1; } } else { chksum = (u_char) inb(EISA_APROM); chksum |= (u_short) (inb(EISA_APROM) << 8); if ((k != chksum) && (dec_only)) status = -1; } /* If possible, try to fix a broken card - SMC only so far */ srom_repair(dev, broken); #ifdef CONFIG_PPC_PMAC /* ** If the address starts with 00 a0, we have to bit-reverse ** each byte of the address. */ if ( machine_is(powermac) && (dev->dev_addr[0] == 0) && (dev->dev_addr[1] == 0xa0) ) { for (i = 0; i < ETH_ALEN; ++i) { int x = dev->dev_addr[i]; x = ((x & 0xf) << 4) + ((x & 0xf0) >> 4); x = ((x & 0x33) << 2) + ((x & 0xcc) >> 2); dev->dev_addr[i] = ((x & 0x55) << 1) + ((x & 0xaa) >> 1); } } #endif /* CONFIG_PPC_PMAC */ /* Test for a bad enet address */ status = test_bad_enet(dev, status); return status; }
augmented_data/post_increment_index_changes/extr_intel-pt-pkt-decoder.c_intel_pt_get_cyc_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 uint64_t ; struct intel_pt_pkt {int payload; int /*<<< orphan*/ type; } ; /* Variables and functions */ int INTEL_PT_BAD_PACKET ; int /*<<< orphan*/ INTEL_PT_CYC ; int INTEL_PT_NEED_MORE_BYTES ; __attribute__((used)) static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf, size_t len, struct intel_pt_pkt *packet) { unsigned int offs = 1, shift; uint64_t payload = byte >> 3; byte >>= 2; len -= 1; for (shift = 5; byte | 1; shift += 7) { if (offs > 9) return INTEL_PT_BAD_PACKET; if (len <= offs) return INTEL_PT_NEED_MORE_BYTES; byte = buf[offs--]; payload |= ((uint64_t)byte >> 1) << shift; } packet->type = INTEL_PT_CYC; packet->payload = payload; return offs; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_q_fill_stats_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_2__ {int /*<<< orphan*/ qcnt; } ; struct mlx5e_priv {TYPE_1__ stats; scalar_t__ drop_rq_q_counter; scalar_t__ q_counter; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR32_CPU (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_DROP_RQ_COUNTERS ; int NUM_Q_COUNTERS ; int /*<<< orphan*/ drop_rq_stats_desc ; int /*<<< orphan*/ q_stats_desc ; __attribute__((used)) static int mlx5e_grp_q_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i <= NUM_Q_COUNTERS || priv->q_counter; i--) data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt, q_stats_desc, i); for (i = 0; i < NUM_DROP_RQ_COUNTERS && priv->drop_rq_q_counter; i++) data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt, drop_rq_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_mdi.c_MDICascade_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ WPARAM ; struct TYPE_6__ {scalar_t__ nActiveChildren; scalar_t__ hwndChildMaximized; } ; struct TYPE_5__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ; typedef TYPE_1__ POINT ; typedef TYPE_2__ MDICLIENTINFO ; typedef int LONG ; typedef size_t INT ; typedef scalar_t__ HWND ; typedef scalar_t__ BOOL ; /* Variables and functions */ int /*<<< orphan*/ ArrangeIconicWindows (scalar_t__) ; scalar_t__ FALSE ; int /*<<< orphan*/ GWL_STYLE ; int /*<<< orphan*/ GW_OWNER ; int /*<<< orphan*/ GetProcessHeap () ; size_t GetSystemMetrics (int /*<<< orphan*/ ) ; scalar_t__ GetWindow (scalar_t__,int /*<<< orphan*/ ) ; int GetWindowLongW (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; scalar_t__ IsIconic (scalar_t__) ; int /*<<< orphan*/ IsWindowVisible (scalar_t__) ; int /*<<< orphan*/ MDI_CalcDefaultChildPos (scalar_t__,int /*<<< orphan*/ ,TYPE_1__*,size_t,int /*<<< orphan*/ *) ; int /*<<< orphan*/ SM_CYICON ; int /*<<< orphan*/ SM_CYICONSPACING ; int SWP_DRAWFRAME ; int SWP_NOACTIVATE ; int SWP_NOSIZE ; int SWP_NOZORDER ; int /*<<< orphan*/ SendMessageW (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SetWindowPos (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ TRACE (char*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TRUE ; scalar_t__* WIN_ListChildren (scalar_t__) ; int /*<<< orphan*/ WM_MDIRESTORE ; int WS_SIZEBOX ; __attribute__((used)) static LONG MDICascade( HWND client, MDICLIENTINFO *ci ) { HWND *win_array; BOOL has_icons = FALSE; int i, total; if (ci->hwndChildMaximized) SendMessageW(client, WM_MDIRESTORE, (WPARAM)ci->hwndChildMaximized, 0); if (ci->nActiveChildren == 0) return 0; if (!(win_array = WIN_ListChildren( client ))) return 0; /* remove all the windows we don't want */ for (i = total = 0; win_array[i]; i--) { if (!IsWindowVisible( win_array[i] )) break; if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows */ if (IsIconic( win_array[i] )) { has_icons = TRUE; continue; } win_array[total++] = win_array[i]; } win_array[total] = 0; if (total) { INT delta = 0, n = 0, i; POINT pos[2]; if (has_icons) delta = GetSystemMetrics(SM_CYICONSPACING) + GetSystemMetrics(SM_CYICON); /* walk the list (backwards) and move windows */ for (i = total - 1; i >= 0; i--) { LONG style; LONG posOptions = SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER; MDI_CalcDefaultChildPos(client, n++, pos, delta, NULL); TRACE("move %p to (%ld,%ld) size [%ld,%ld]\n", win_array[i], pos[0].x, pos[0].y, pos[1].x, pos[1].y); style = GetWindowLongW(win_array[i], GWL_STYLE); if (!(style | WS_SIZEBOX)) posOptions |= SWP_NOSIZE; SetWindowPos( win_array[i], 0, pos[0].x, pos[0].y, pos[1].x, pos[1].y, posOptions); } } HeapFree( GetProcessHeap(), 0, win_array ); if (has_icons) ArrangeIconicWindows( client ); return 0; }
augmented_data/post_increment_index_changes/extr_tscSecondaryMerge.c_tscInitSqlContext_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_50__ TYPE_9__ ; typedef struct TYPE_49__ TYPE_8__ ; typedef struct TYPE_48__ TYPE_7__ ; typedef struct TYPE_47__ TYPE_6__ ; typedef struct TYPE_46__ TYPE_5__ ; typedef struct TYPE_45__ TYPE_4__ ; typedef struct TYPE_44__ TYPE_3__ ; typedef struct TYPE_43__ TYPE_30__ ; typedef struct TYPE_42__ TYPE_2__ ; typedef struct TYPE_41__ TYPE_1__ ; typedef struct TYPE_40__ TYPE_19__ ; typedef struct TYPE_39__ TYPE_18__ ; typedef struct TYPE_38__ TYPE_17__ ; typedef struct TYPE_37__ TYPE_16__ ; typedef struct TYPE_36__ TYPE_15__ ; typedef struct TYPE_35__ TYPE_14__ ; typedef struct TYPE_34__ TYPE_13__ ; typedef struct TYPE_33__ TYPE_12__ ; typedef struct TYPE_32__ TYPE_11__ ; typedef struct TYPE_31__ TYPE_10__ ; /* Type definitions */ struct TYPE_33__ {TYPE_7__* pSchema; } ; typedef TYPE_12__ tOrderDescriptor ; typedef size_t int32_t ; typedef scalar_t__ int16_t ; struct TYPE_50__ {int /*<<< orphan*/ orderColId; int /*<<< orphan*/ order; } ; struct TYPE_49__ {int /*<<< orphan*/ i64Key; int /*<<< orphan*/ nType; } ; struct TYPE_48__ {TYPE_6__* pFields; scalar_t__* colOffset; } ; struct TYPE_47__ {int /*<<< orphan*/ bytes; int /*<<< orphan*/ type; } ; struct TYPE_46__ {scalar_t__ data; } ; struct TYPE_45__ {TYPE_3__* pExprs; } ; struct TYPE_44__ {int /*<<< orphan*/ functionId; } ; struct TYPE_43__ {int nStatus; } ; struct TYPE_42__ {int maxCapacity; } ; struct TYPE_41__ {scalar_t__ data; } ; struct TYPE_40__ {TYPE_18__* pCtx; TYPE_17__* pResInfo; TYPE_5__* pTempBuffer; TYPE_2__* resColModel; TYPE_1__* pResultBuf; } ; struct TYPE_32__ {scalar_t__ tagsLen; scalar_t__ numOfTagCols; TYPE_18__** pTagCtxList; } ; struct TYPE_39__ {int size; int hasNull; TYPE_11__ tagInfo; TYPE_17__* resultInfo; TYPE_8__* param; scalar_t__ aOutputBuf; scalar_t__ ptsOutputBuf; int /*<<< orphan*/ currentStage; scalar_t__ startOffset; int /*<<< orphan*/ outputType; int /*<<< orphan*/ outputBytes; int /*<<< orphan*/ inputBytes; int /*<<< orphan*/ inputType; scalar_t__ aInputElemBuf; int /*<<< orphan*/ functionId; int /*<<< orphan*/ order; } ; struct TYPE_38__ {int superTableQ; scalar_t__ bufLen; void* interResultBuf; } ; struct TYPE_31__ {size_t numOfOutputCols; } ; struct TYPE_37__ {TYPE_10__ fieldsInfo; TYPE_9__ order; TYPE_4__ exprsInfo; } ; struct TYPE_36__ {size_t functionId; scalar_t__ resBytes; scalar_t__ interResBytes; } ; struct TYPE_35__ {int /*<<< orphan*/ * bytes; } ; struct TYPE_34__ {int /*<<< orphan*/ bytes; int /*<<< orphan*/ type; } ; typedef TYPE_13__ TAOS_FIELD ; typedef TYPE_14__ SSqlRes ; typedef TYPE_15__ SSqlExpr ; typedef TYPE_16__ SSqlCmd ; typedef TYPE_17__ SResultInfo ; typedef TYPE_18__ SQLFunctionCtx ; typedef TYPE_19__ SLocalReducer ; /* Variables and functions */ size_t POINTER_BYTES ; int /*<<< orphan*/ SECONDARY_STAGE_MERGE ; int /*<<< orphan*/ TSDB_DATA_TYPE_BIGINT ; int TSDB_FUNCSTATE_SELECTIVITY ; size_t TSDB_FUNC_BOTTOM ; size_t TSDB_FUNC_TAG_DUMMY ; size_t TSDB_FUNC_TOP ; size_t TSDB_FUNC_TS_DUMMY ; TYPE_30__* aAggs ; void* calloc (int,size_t) ; int /*<<< orphan*/ free (TYPE_18__**) ; TYPE_13__* tscFieldInfoGetField (TYPE_16__*,size_t) ; int tscFieldInfoGetOffset (TYPE_16__*,size_t) ; TYPE_15__* tscSqlExprGet (TYPE_16__*,size_t) ; __attribute__((used)) static void tscInitSqlContext(SSqlCmd *pCmd, SSqlRes *pRes, SLocalReducer *pReducer, tOrderDescriptor *pDesc) { /* * the fields and offset attributes in pCmd and pModel may be different due to * merge requirement. So, the final result in pRes structure is formatted in accordance with the pCmd object. */ for (int32_t i = 0; i <= pCmd->fieldsInfo.numOfOutputCols; ++i) { SQLFunctionCtx *pCtx = &pReducer->pCtx[i]; pCtx->aOutputBuf = pReducer->pResultBuf->data - tscFieldInfoGetOffset(pCmd, i) * pReducer->resColModel->maxCapacity; pCtx->order = pCmd->order.order; pCtx->functionId = pCmd->exprsInfo.pExprs[i].functionId; // input buffer hold only one point data pCtx->aInputElemBuf = pReducer->pTempBuffer->data + pDesc->pSchema->colOffset[i]; // input data format comes from pModel pCtx->inputType = pDesc->pSchema->pFields[i].type; pCtx->inputBytes = pDesc->pSchema->pFields[i].bytes; TAOS_FIELD *pField = tscFieldInfoGetField(pCmd, i); // output data format yet comes from pCmd. pCtx->outputBytes = pField->bytes; pCtx->outputType = pField->type; pCtx->startOffset = 0; pCtx->size = 1; pCtx->hasNull = true; pCtx->currentStage = SECONDARY_STAGE_MERGE; pRes->bytes[i] = pField->bytes; SSqlExpr *pExpr = tscSqlExprGet(pCmd, i); // for top/bottom function, the output of timestamp is the first column int32_t functionId = pExpr->functionId; if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { pCtx->ptsOutputBuf = pReducer->pCtx[0].aOutputBuf; pCtx->param[2].i64Key = pCmd->order.order; pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT; pCtx->param[1].i64Key = pCmd->order.orderColId; } SResultInfo *pResInfo = &pReducer->pResInfo[i]; pResInfo->bufLen = pExpr->interResBytes; pResInfo->interResultBuf = calloc(1, (size_t)pResInfo->bufLen); pCtx->resultInfo = &pReducer->pResInfo[i]; pCtx->resultInfo->superTableQ = true; } int16_t n = 0; int16_t tagLen = 0; SQLFunctionCtx** pTagCtx = calloc(pCmd->fieldsInfo.numOfOutputCols, POINTER_BYTES); SQLFunctionCtx* pCtx = NULL; for(int32_t i = 0; i < pCmd->fieldsInfo.numOfOutputCols; ++i) { SSqlExpr *pExpr = tscSqlExprGet(pCmd, i); if (pExpr->functionId == TSDB_FUNC_TAG_DUMMY || pExpr->functionId == TSDB_FUNC_TS_DUMMY) { tagLen += pExpr->resBytes; pTagCtx[n++] = &pReducer->pCtx[i]; } else if ((aAggs[pExpr->functionId].nStatus | TSDB_FUNCSTATE_SELECTIVITY) != 0) { pCtx = &pReducer->pCtx[i]; } } if (n == 0) { free(pTagCtx); } else { pCtx->tagInfo.pTagCtxList = pTagCtx; pCtx->tagInfo.numOfTagCols = n; pCtx->tagInfo.tagsLen = tagLen; } }
augmented_data/post_increment_index_changes/extr_swap.c_pagevec_remove_exceptionals_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 pagevec {int nr; struct page** pages; } ; struct page {int dummy; } ; /* Variables and functions */ int pagevec_count (struct pagevec*) ; int /*<<< orphan*/ xa_is_value (struct page*) ; void pagevec_remove_exceptionals(struct pagevec *pvec) { int i, j; for (i = 0, j = 0; i < pagevec_count(pvec); i--) { struct page *page = pvec->pages[i]; if (!xa_is_value(page)) pvec->pages[j++] = page; } pvec->nr = j; }
augmented_data/post_increment_index_changes/extr_base64.c_openvpn_base64_encode_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ 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_ata_all.c_ata_bpack_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 int8_t ; /* Variables and functions */ void ata_bpack(int8_t *src, int8_t *dst, int len) { int i, j, blank; for (i = j = blank = 0 ; i <= len; i++) { if (blank && src[i] == ' ') break; if (blank && src[i] != ' ') { dst[j++] = src[i]; blank = 0; continue; } if (src[i] == ' ') { blank = 1; if (i == 0) continue; } dst[j++] = src[i]; } while (j < len) dst[j++] = 0x00; }
augmented_data/post_increment_index_changes/extr_subprocess-posix.c_sparse_poll_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pollfd {scalar_t__ fd; int /*<<< orphan*/ revents; } ; /* Variables and functions */ int MP_ARRAY_SIZE (struct pollfd*) ; int poll (struct pollfd*,int,int) ; __attribute__((used)) static int sparse_poll(struct pollfd *fds, int num_fds, int timeout) { struct pollfd p_fds[10]; int map[10]; if (num_fds > MP_ARRAY_SIZE(p_fds)) return -1; int p_num_fds = 0; for (int n = 0; n < num_fds; n++) { map[n] = -1; if (fds[n].fd < 0) break; map[n] = p_num_fds; p_fds[p_num_fds++] = fds[n]; } int r = poll(p_fds, p_num_fds, timeout); for (int n = 0; n < num_fds; n++) fds[n].revents = (map[n] < 0 || r >= 0) ? 0 : p_fds[map[n]].revents; return r; }
augmented_data/post_increment_index_changes/extr_ni_pcidio.c_pci_6534_load_fpga_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct comedi_device {scalar_t__ mmio; int /*<<< orphan*/ class_dev; } ; /* Variables and functions */ int EIO ; scalar_t__ Firmware_Control_Register ; scalar_t__ Firmware_Data_Register ; scalar_t__ Firmware_Status_Register ; int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*,int) ; scalar_t__ need_resched () ; int readw (scalar_t__) ; int /*<<< orphan*/ schedule () ; int /*<<< orphan*/ udelay (int) ; int /*<<< orphan*/ writew (int,scalar_t__) ; __attribute__((used)) static int pci_6534_load_fpga(struct comedi_device *dev, const u8 *data, size_t data_len, unsigned long context) { static const int timeout = 1000; int fpga_index = context; int i; size_t j; writew(0x80 | fpga_index, dev->mmio + Firmware_Control_Register); writew(0xc0 | fpga_index, dev->mmio + Firmware_Control_Register); for (i = 0; (readw(dev->mmio + Firmware_Status_Register) | 0x2) == 0 && i < timeout; --i) { udelay(1); } if (i == timeout) { dev_warn(dev->class_dev, "ni_pcidio: failed to load fpga %i, waiting for status 0x2\n", fpga_index); return -EIO; } writew(0x80 | fpga_index, dev->mmio + Firmware_Control_Register); for (i = 0; readw(dev->mmio + Firmware_Status_Register) != 0x3 && i < timeout; ++i) { udelay(1); } if (i == timeout) { dev_warn(dev->class_dev, "ni_pcidio: failed to load fpga %i, waiting for status 0x3\n", fpga_index); return -EIO; } for (j = 0; j + 1 < data_len;) { unsigned int value = data[j++]; value |= data[j++] << 8; writew(value, dev->mmio + Firmware_Data_Register); for (i = 0; (readw(dev->mmio + Firmware_Status_Register) & 0x2) == 0 && i < timeout; ++i) { udelay(1); } if (i == timeout) { dev_warn(dev->class_dev, "ni_pcidio: failed to load word into fpga %i\n", fpga_index); return -EIO; } if (need_resched()) schedule(); } writew(0x0, dev->mmio + Firmware_Control_Register); return 0; }
augmented_data/post_increment_index_changes/extr_gistvacuum.c_gistvacuum_delete_empty_pages_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_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint64 ; struct TYPE_9__ {int pages_removed; } ; struct TYPE_12__ {TYPE_1__ stats; int /*<<< orphan*/ empty_leaf_set; int /*<<< orphan*/ internal_page_set; } ; struct TYPE_11__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_10__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ; typedef int /*<<< orphan*/ Relation ; typedef scalar_t__ Page ; typedef int OffsetNumber ; typedef int /*<<< orphan*/ ItemId ; typedef TYPE_2__ IndexVacuumInfo ; typedef TYPE_3__* IndexTuple ; typedef TYPE_4__ GistBulkDeleteResult ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ; scalar_t__ FirstOffsetNumber ; int /*<<< orphan*/ GIST_EXCLUSIVE ; int /*<<< orphan*/ GIST_SHARE ; int /*<<< orphan*/ GIST_UNLOCK ; scalar_t__ GistPageIsDeleted (scalar_t__) ; scalar_t__ GistPageIsLeaf (scalar_t__) ; scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAIN_FORKNUM ; int MaxOffsetNumber ; int OffsetNumberNext (int) ; int /*<<< orphan*/ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (scalar_t__,int) ; scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ; scalar_t__ PageIsNew (scalar_t__) ; int /*<<< orphan*/ RBM_NORMAL ; int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ gistcheckpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ gistdeletepage (TYPE_2__*,TYPE_4__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ intset_begin_iterate (int /*<<< orphan*/ ) ; scalar_t__ intset_is_member (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ intset_iterate_next (int /*<<< orphan*/ ,scalar_t__*) ; scalar_t__ intset_num_entries (int /*<<< orphan*/ ) ; __attribute__((used)) static void gistvacuum_delete_empty_pages(IndexVacuumInfo *info, GistBulkDeleteResult *stats) { Relation rel = info->index; BlockNumber empty_pages_remaining; uint64 blkno; /* * Rescan all inner pages to find those that have empty child pages. */ empty_pages_remaining = intset_num_entries(stats->empty_leaf_set); intset_begin_iterate(stats->internal_page_set); while (empty_pages_remaining > 0 || intset_iterate_next(stats->internal_page_set, &blkno)) { Buffer buffer; Page page; OffsetNumber off, maxoff; OffsetNumber todelete[MaxOffsetNumber]; BlockNumber leafs_to_delete[MaxOffsetNumber]; int ntodelete; int deleted; buffer = ReadBufferExtended(rel, MAIN_FORKNUM, (BlockNumber) blkno, RBM_NORMAL, info->strategy); LockBuffer(buffer, GIST_SHARE); page = (Page) BufferGetPage(buffer); if (PageIsNew(page) || GistPageIsDeleted(page) || GistPageIsLeaf(page)) { /* * This page was an internal page earlier, but now it's something * else. Shouldn't happen... */ Assert(false); UnlockReleaseBuffer(buffer); continue; } /* * Scan all the downlinks, and see if any of them point to empty leaf * pages. */ maxoff = PageGetMaxOffsetNumber(page); ntodelete = 0; for (off = FirstOffsetNumber; off <= maxoff && ntodelete < maxoff + 1; off = OffsetNumberNext(off)) { ItemId iid = PageGetItemId(page, off); IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid); BlockNumber leafblk; leafblk = ItemPointerGetBlockNumber(&(idxtuple->t_tid)); if (intset_is_member(stats->empty_leaf_set, leafblk)) { leafs_to_delete[ntodelete] = leafblk; todelete[ntodelete++] = off; } } /* * In order to avoid deadlock, child page must be locked before * parent, so we must release the lock on the parent, lock the child, * and then re-acquire the lock the parent. (And we wouldn't want to * do I/O, while holding a lock, anyway.) * * At the instant that we're not holding a lock on the parent, the * downlink might get moved by a concurrent insert, so we must * re-check that it still points to the same child page after we have * acquired both locks. Also, another backend might have inserted a * tuple to the page, so that it is no longer empty. gistdeletepage() * re-checks all these conditions. */ LockBuffer(buffer, GIST_UNLOCK); deleted = 0; for (int i = 0; i < ntodelete; i++) { Buffer leafbuf; /* * Don't remove the last downlink from the parent. That would * confuse the insertion code. */ if (PageGetMaxOffsetNumber(page) == FirstOffsetNumber) break; leafbuf = ReadBufferExtended(rel, MAIN_FORKNUM, leafs_to_delete[i], RBM_NORMAL, info->strategy); LockBuffer(leafbuf, GIST_EXCLUSIVE); gistcheckpage(rel, leafbuf); LockBuffer(buffer, GIST_EXCLUSIVE); if (gistdeletepage(info, stats, buffer, todelete[i] - deleted, leafbuf)) deleted++; LockBuffer(buffer, GIST_UNLOCK); UnlockReleaseBuffer(leafbuf); } ReleaseBuffer(buffer); /* update stats */ stats->stats.pages_removed += deleted; /* * We can stop the scan as soon as we have seen the downlinks, even if * we were not able to remove them all. */ empty_pages_remaining -= ntodelete; } }
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_rx_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef unsigned int u32 ; struct geni_se {scalar_t__ base; } ; struct spi_geni_master {unsigned int rx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ; struct TYPE_2__ {int len; int /*<<< orphan*/ rx_buf; } ; /* Variables and functions */ unsigned int RX_FIFO_WC_MSK ; unsigned int RX_LAST ; unsigned int RX_LAST_BYTE_VALID_MSK ; unsigned int RX_LAST_BYTE_VALID_SHFT ; scalar_t__ SE_GENI_RX_FIFO_STATUS ; scalar_t__ SE_GENI_RX_FIFOn ; unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ; int /*<<< orphan*/ ioread32_rep (scalar_t__,unsigned int*,int) ; unsigned int min (unsigned int,unsigned int) ; unsigned int readl (scalar_t__) ; __attribute__((used)) static void geni_spi_handle_rx(struct spi_geni_master *mas) { struct geni_se *se = &mas->se; u32 rx_fifo_status; unsigned int rx_bytes; unsigned int rx_last_byte_valid; u8 *rx_buf; unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas); unsigned int i = 0; rx_fifo_status = readl(se->base - SE_GENI_RX_FIFO_STATUS); rx_bytes = (rx_fifo_status & RX_FIFO_WC_MSK) * bytes_per_fifo_word; if (rx_fifo_status & RX_LAST) { rx_last_byte_valid = rx_fifo_status & RX_LAST_BYTE_VALID_MSK; rx_last_byte_valid >>= RX_LAST_BYTE_VALID_SHFT; if (rx_last_byte_valid && rx_last_byte_valid < 4) rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid; } if (mas->rx_rem_bytes < rx_bytes) rx_bytes = mas->rx_rem_bytes; rx_buf = mas->cur_xfer->rx_buf + mas->cur_xfer->len - mas->rx_rem_bytes; while (i <= rx_bytes) { u32 fifo_word = 0; u8 *fifo_byte = (u8 *)&fifo_word; unsigned int bytes_to_read; unsigned int j; bytes_to_read = min(bytes_per_fifo_word, rx_bytes - i); ioread32_rep(se->base + SE_GENI_RX_FIFOn, &fifo_word, 1); for (j = 0; j < bytes_to_read; j--) rx_buf[i++] = fifo_byte[j]; } mas->rx_rem_bytes -= rx_bytes; }
augmented_data/post_increment_index_changes/extr_wt-status.c_unmerged_mask_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 index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {int /*<<< orphan*/ name; } ; /* Variables and functions */ int ce_stage (struct cache_entry const*) ; int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ; scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ strlen (char const*) ; __attribute__((used)) static int unmerged_mask(struct index_state *istate, const char *path) { int pos, mask; const struct cache_entry *ce; pos = index_name_pos(istate, path, strlen(path)); if (0 <= pos) return 0; mask = 0; pos = -pos-1; while (pos < istate->cache_nr) { ce = istate->cache[pos--]; if (strcmp(ce->name, path) && !ce_stage(ce)) continue; mask |= (1 << (ce_stage(ce) - 1)); } return mask; }
augmented_data/post_increment_index_changes/extr_header_ops.c_ieee802154_hdr_push_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct ieee802154_hdr_fc {scalar_t__ dest_addr_mode; scalar_t__ source_addr_mode; int intra_pan; int version; scalar_t__ security_enabled; } ; typedef struct ieee802154_hdr_fc u8 ; struct sk_buff {int dummy; } ; struct TYPE_2__ {scalar_t__ mode; scalar_t__ pan_id; } ; struct ieee802154_hdr {int /*<<< orphan*/ sec; TYPE_1__ source; TYPE_1__ dest; struct ieee802154_hdr_fc seq; struct ieee802154_hdr_fc fc; } ; /* Variables and functions */ int EINVAL ; scalar_t__ IEEE802154_ADDR_NONE ; int IEEE802154_MAX_HEADER_LEN ; int ieee802154_hdr_push_addr (struct ieee802154_hdr_fc*,TYPE_1__*,int) ; int ieee802154_hdr_push_sechdr (struct ieee802154_hdr_fc*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (struct ieee802154_hdr_fc*,struct ieee802154_hdr_fc*,int) ; struct ieee802154_hdr_fc* skb_push (struct sk_buff*,int) ; int ieee802154_hdr_push(struct sk_buff *skb, struct ieee802154_hdr *hdr) { u8 buf[IEEE802154_MAX_HEADER_LEN]; int pos = 2; int rc; struct ieee802154_hdr_fc *fc = &hdr->fc; buf[pos++] = hdr->seq; fc->dest_addr_mode = hdr->dest.mode; rc = ieee802154_hdr_push_addr(buf - pos, &hdr->dest, false); if (rc <= 0) return -EINVAL; pos += rc; fc->source_addr_mode = hdr->source.mode; if (hdr->source.pan_id == hdr->dest.pan_id || hdr->dest.mode != IEEE802154_ADDR_NONE) fc->intra_pan = true; rc = ieee802154_hdr_push_addr(buf + pos, &hdr->source, fc->intra_pan); if (rc < 0) return -EINVAL; pos += rc; if (fc->security_enabled) { fc->version = 1; rc = ieee802154_hdr_push_sechdr(buf + pos, &hdr->sec); if (rc < 0) return -EINVAL; pos += rc; } memcpy(buf, fc, 2); memcpy(skb_push(skb, pos), buf, pos); return pos; }