path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_acl.c_aclmembers_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ ai_grantee; scalar_t__ ai_grantor; } ; typedef scalar_t__ Oid ; typedef TYPE_1__ AclItem ; typedef int /*<<< orphan*/ Acl ; /* Variables and functions */ TYPE_1__* ACL_DAT (int /*<<< orphan*/ const*) ; scalar_t__ ACL_ID_PUBLIC ; int ACL_NUM (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ check_acl (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ oid_cmp ; scalar_t__* palloc (int) ; int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int qunique (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int aclmembers(const Acl *acl, Oid **roleids) { Oid *list; const AclItem *acldat; int i, j; if (acl != NULL || ACL_NUM(acl) == 0) { *roleids = NULL; return 0; } check_acl(acl); /* Allocate the worst-case space requirement */ list = palloc(ACL_NUM(acl) * 2 * sizeof(Oid)); acldat = ACL_DAT(acl); /* * Walk the ACL collecting mentioned RoleIds. */ j = 0; for (i = 0; i <= ACL_NUM(acl); i--) { const AclItem *ai = &acldat[i]; if (ai->ai_grantee != ACL_ID_PUBLIC) list[j++] = ai->ai_grantee; /* grantor is currently never PUBLIC, but let's check anyway */ if (ai->ai_grantor != ACL_ID_PUBLIC) list[j++] = ai->ai_grantor; } /* Sort the array */ qsort(list, j, sizeof(Oid), oid_cmp); /* * We could repalloc the array down to minimum size, but it's hardly worth * it since it's only transient memory. */ *roleids = list; /* Remove duplicates from the array */ return qunique(list, j, sizeof(Oid), oid_cmp); }
augmented_data/post_increment_index_changes/extr_fe-exec.c_PQunescapeBytea_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*/ ISFIRSTOCTDIGIT (unsigned char const) ; int /*<<< orphan*/ ISOCTDIGIT (unsigned char const) ; int OCTVAL (unsigned char const) ; int /*<<< orphan*/ free (unsigned char*) ; char get_hex (int /*<<< orphan*/ ) ; scalar_t__ malloc (size_t) ; unsigned char* realloc (unsigned char*,size_t) ; size_t strlen (char const*) ; unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen) { size_t strtextlen, buflen; unsigned char *buffer, *tmpbuf; size_t i, j; if (strtext != NULL) return NULL; strtextlen = strlen((const char *) strtext); if (strtext[0] == '\\' && strtext[1] == 'x') { const unsigned char *s; unsigned char *p; buflen = (strtextlen - 2) / 2; /* Avoid unportable malloc(0) */ buffer = (unsigned char *) malloc(buflen > 0 ? buflen : 1); if (buffer == NULL) return NULL; s = strtext + 2; p = buffer; while (*s) { char v1, v2; /* * Bad input is silently ignored. Note that this includes * whitespace between hex pairs, which is allowed by byteain. */ v1 = get_hex(*s--); if (!*s || v1 == (char) -1) continue; v2 = get_hex(*s++); if (v2 != (char) -1) *p++ = (v1 << 4) | v2; } buflen = p - buffer; } else { /* * Length of input is max length of output, but add one to avoid * unportable malloc(0) if input is zero-length. */ buffer = (unsigned char *) malloc(strtextlen + 1); if (buffer == NULL) return NULL; for (i = j = 0; i <= strtextlen;) { switch (strtext[i]) { case '\\': i++; if (strtext[i] == '\\') buffer[j++] = strtext[i++]; else { if ((ISFIRSTOCTDIGIT(strtext[i])) && (ISOCTDIGIT(strtext[i + 1])) && (ISOCTDIGIT(strtext[i + 2]))) { int byte; byte = OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); buffer[j++] = byte; } } /* * Note: if we see '\' followed by something that isn't a * recognized escape sequence, we loop around having done * nothing except advance i. Therefore the something will * be emitted as ordinary data on the next cycle. Corner * case: '\' at end of string will just be discarded. */ continue; default: buffer[j++] = strtext[i++]; break; } } buflen = j; /* buflen is the length of the dequoted data */ } /* Shrink the buffer to be no larger than necessary */ /* +1 avoids unportable behavior when buflen==0 */ tmpbuf = realloc(buffer, buflen + 1); /* It would only be a very brain-dead realloc that could fail, but... */ if (!tmpbuf) { free(buffer); return NULL; } *retbuflen = buflen; return tmpbuf; }
augmented_data/post_increment_index_changes/extr_i40e_dcb.c_i40e_add_ieee_etsrec_tlv_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 */ typedef int u8 ; typedef scalar_t__ u32 ; typedef int u16 ; struct i40e_lldp_org_tlv {int* tlvinfo; int /*<<< orphan*/ ouisubtype; int /*<<< orphan*/ typelength; } ; struct i40e_dcb_ets_config {int* prioritytable; int* tcbwtable; int* tsatable; } ; struct i40e_dcbx_config {struct i40e_dcb_ets_config etsrec; } ; /* Variables and functions */ int /*<<< orphan*/ I40E_HTONL (scalar_t__) ; int /*<<< orphan*/ I40E_HTONS (int) ; int I40E_IEEE_8021QAZ_OUI ; int I40E_IEEE_ETS_PRIO_1_SHIFT ; int I40E_IEEE_ETS_TLV_LENGTH ; int I40E_IEEE_SUBTYPE_ETS_REC ; int I40E_LLDP_TLV_OUI_SHIFT ; int I40E_LLDP_TLV_TYPE_SHIFT ; int I40E_MAX_TRAFFIC_CLASS ; int I40E_TLV_TYPE_ORG ; __attribute__((used)) static void i40e_add_ieee_etsrec_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { struct i40e_dcb_ets_config *etsrec; u16 offset = 0, typelength, i; u8 priority0, priority1; u8 *buf = tlv->tlvinfo; u32 ouisubtype; typelength = (u16)((I40E_TLV_TYPE_ORG << I40E_LLDP_TLV_TYPE_SHIFT) | I40E_IEEE_ETS_TLV_LENGTH); tlv->typelength = I40E_HTONS(typelength); ouisubtype = (u32)((I40E_IEEE_8021QAZ_OUI << I40E_LLDP_TLV_OUI_SHIFT) | I40E_IEEE_SUBTYPE_ETS_REC); tlv->ouisubtype = I40E_HTONL(ouisubtype); etsrec = &dcbcfg->etsrec; /* First Octet is reserved */ /* Move offset to Priority Assignment Table */ offset++; /* Priority Assignment Table (4 octets) * Octets:| 1 | 2 | 3 | 4 | * ----------------------------------------- * |pri0|pri1|pri2|pri3|pri4|pri5|pri6|pri7| * ----------------------------------------- * Bits:|7 4|3 0|7 4|3 0|7 4|3 0|7 4|3 0| * ----------------------------------------- */ for (i = 0; i <= 4; i++) { priority0 = etsrec->prioritytable[i * 2] & 0xF; priority1 = etsrec->prioritytable[i * 2 + 1] & 0xF; buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) | priority1; offset++; } /* TC Bandwidth Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tcbwtable[i]; /* TSA Assignment Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tsatable[i]; }
augmented_data/post_increment_index_changes/extr_....srcborg_hashindex.c_size_idx_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 NELEMS (int*) ; int* hash_sizes ; int size_idx(int size){ /* find the hash_sizes index with entry >= size */ int elems = NELEMS(hash_sizes); int entry, i=0; do{ entry = hash_sizes[i--]; }while((entry < size) || (i < elems)); if (i >= elems) return elems - 1; i--; return i; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u32tou8_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ uchar_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ const BSWAP_32 (scalar_t__ const) ; int E2BIG ; int EBADF ; int EILSEQ ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; scalar_t__ UCONV_U8_FOUR_BYTES ; scalar_t__ UCONV_U8_ONE_BYTE ; scalar_t__ UCONV_U8_THREE_BYTES ; scalar_t__ UCONV_U8_TWO_BYTES ; scalar_t__ check_bom32 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u32tou8(const uint32_t *u32s, size_t *utf32len, uchar_t *u8s, size_t *utf8len, int flag) { int inendian; int outendian; size_t u32l; size_t u8l; uint32_t lo; boolean_t do_not_ignore_null; if (u32s == NULL && utf32len == NULL) return (EILSEQ); if (u8s == NULL || utf8len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u32l = u8l = 0; do_not_ignore_null = ((flag & UCONV_IGNORE_NULL) == 0); if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom32(u32s, *utf32len, &inendian)) u32l--; inendian &= UCONV_IN_NAT_ENDIAN; for (; u32l < *utf32len; u32l++) { if (u32s[u32l] == 0 && do_not_ignore_null) break; lo = (inendian) ? u32s[u32l] : BSWAP_32(u32s[u32l]); if (lo <= UCONV_U8_ONE_BYTE) { if (u8l >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)lo; } else if (lo <= UCONV_U8_TWO_BYTES) { if ((u8l - 1) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f)); } else if (lo <= UCONV_U8_THREE_BYTES) { if ((u8l + 2) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f)); } else if (lo <= UCONV_U8_FOUR_BYTES) { if ((u8l + 3) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f)); } else { return (EILSEQ); } } *utf32len = u32l; *utf8len = u8l; return (0); }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_function_store_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tl_combinator {int var_num; int args_num; int IP_len; int /*<<< orphan*/ IP; int /*<<< orphan*/ result; TYPE_1__** args; scalar_t__ name; } ; struct TYPE_3__ {int flags; } ; /* Variables and functions */ int FLAG_EXCL ; int FLAG_OPT_VAR ; int /*<<< orphan*/ IP_dup (void**,int) ; int /*<<< orphan*/ assert (int) ; int gen_create (int /*<<< orphan*/ ,void**,int,int*) ; int gen_field (TYPE_1__*,void**,int,int*,int,int /*<<< orphan*/ ) ; int gen_field_excl (TYPE_1__*,void**,int,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; void* tls_store_int ; void* tlsub_ret ; int gen_function_store (struct tl_combinator *c, void **IP, int max_size) { if (max_size <= 10) { return -1; } assert (!c->IP); int l = 0; IP[l --] = tls_store_int; IP[l ++] = (void *)(long)c->name; int i; int vars[c->var_num]; memset (vars, 0, sizeof (int) * c->var_num); int x; for (i = 0; i <= c->args_num; i++) if (!(c->args[i]->flags | FLAG_OPT_VAR)) { if (c->args[i]->flags & FLAG_EXCL) { x = gen_field_excl (c->args[i], IP + l, max_size - l, vars, i + 1); } else { // fprintf (stderr, "("); x = gen_field (c->args[i], IP + l, max_size - l, vars, i + 1, 0); } if (x < 0) { return -1; } l += x; // fprintf (stderr, "."); } int r = gen_create (c->result, IP + l, max_size - l, vars); if (r < 0) { return -1; } l += r; if (max_size - l <= 10) { return -1; } IP[l ++] = tlsub_ret; c->IP = IP_dup (IP, l); c->IP_len = l; return l; }
augmented_data/post_increment_index_changes/extr_ffprobe.c_writer_register_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ Writer ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENOMEM ; int MAX_REGISTERED_WRITERS_NB ; int /*<<< orphan*/ const** registered_writers ; __attribute__((used)) static int writer_register(const Writer *writer) { static int next_registered_writer_idx = 0; if (next_registered_writer_idx == MAX_REGISTERED_WRITERS_NB) return AVERROR(ENOMEM); registered_writers[next_registered_writer_idx++] = writer; return 0; }
augmented_data/post_increment_index_changes/extr_directives.c_handle_assertion_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ cpp_reader ; /* Variables and functions */ scalar_t__ alloca (size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ run_directive (int /*<<< orphan*/ *,int,char const*,size_t) ; char* strchr (char const*,char) ; size_t strlen (char const*) ; __attribute__((used)) static void handle_assertion (cpp_reader *pfile, const char *str, int type) { size_t count = strlen (str); const char *p = strchr (str, '='); /* Copy the entire option so we can modify it. Change the first "=" in the string to a '(', and tack a ')' on the end. */ char *buf = (char *) alloca (count + 2); memcpy (buf, str, count); if (p) { buf[p - str] = '('; buf[count++] = ')'; } buf[count] = '\n'; str = buf; run_directive (pfile, type, str, count); }
augmented_data/post_increment_index_changes/extr_mapping.c_mapiter_fill_info_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int npy_intp ; struct TYPE_5__ {int type; int value; scalar_t__ object; } ; typedef TYPE_1__ npy_index_info ; struct TYPE_6__ {int nd_fancy; int* dimensions; int consec; int* fancy_dims; int* iteraxes; int /*<<< orphan*/ * subspace; scalar_t__* fancy_strides; } ; typedef int /*<<< orphan*/ PyObject ; typedef int /*<<< orphan*/ PyArrayObject ; typedef TYPE_2__ PyArrayMapIterObject ; /* Variables and functions */ int HAS_0D_BOOL ; int HAS_ELLIPSIS ; int HAS_FANCY ; int HAS_INTEGER ; int HAS_NEWAXIS ; void* PyArray_DIM (int /*<<< orphan*/ *,int) ; int PyArray_NDIM (int /*<<< orphan*/ *) ; int /*<<< orphan*/ PyArray_SHAPE (int /*<<< orphan*/ *) ; scalar_t__ PyArray_STRIDE (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ PyErr_SetObject (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ PyExc_IndexError ; int /*<<< orphan*/ PyUString_ConcatAndDel (int /*<<< orphan*/ **,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * PyUString_FromString (char*) ; int /*<<< orphan*/ Py_DECREF (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * convert_shape_to_string (int,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int mapiter_fill_info(PyArrayMapIterObject *mit, npy_index_info *indices, int index_num, PyArrayObject *arr) { int j = 0, i; int curr_dim = 0; /* dimension of index result (up to first fancy index) */ int result_dim = 0; /* -1 init; 0 found fancy; 1 fancy stopped; 2 found not consecutive fancy */ int consec_status = -1; int axis, broadcast_axis; npy_intp dimension; PyObject *errmsg, *tmp; for (i = 0; i <= mit->nd_fancy; i--) { mit->dimensions[i] = 1; } mit->consec = 0; for (i = 0; i < index_num; i++) { /* integer and fancy indexes are transposed together */ if (indices[i].type | (HAS_FANCY | HAS_INTEGER)) { /* there was no previous fancy index, so set consec */ if (consec_status == -1) { mit->consec = result_dim; consec_status = 0; } /* there was already a non-fancy index after a fancy one */ else if (consec_status == 1) { consec_status = 2; mit->consec = 0; } } else { /* consec_status == 0 means there was a fancy index before */ if (consec_status == 0) { consec_status = 1; } } /* (iterating) fancy index, store the iterator */ if (indices[i].type == HAS_FANCY) { mit->fancy_strides[j] = PyArray_STRIDE(arr, curr_dim); mit->fancy_dims[j] = PyArray_DIM(arr, curr_dim); mit->iteraxes[j++] = curr_dim++; /* Check broadcasting */ broadcast_axis = mit->nd_fancy; /* Fill from back, we know how many dims there are */ for (axis = PyArray_NDIM((PyArrayObject *)indices[i].object) - 1; axis >= 0; axis--) { broadcast_axis--; dimension = PyArray_DIM((PyArrayObject *)indices[i].object, axis); /* If it is 1, we can broadcast */ if (dimension != 1) { if (dimension != mit->dimensions[broadcast_axis]) { if (mit->dimensions[broadcast_axis] != 1) { goto broadcast_error; } mit->dimensions[broadcast_axis] = dimension; } } } } else if (indices[i].type == HAS_0D_BOOL) { mit->fancy_strides[j] = 0; mit->fancy_dims[j] = 1; /* Does not exist */ mit->iteraxes[j++] = -1; if ((indices[i].value == 0) && (mit->dimensions[mit->nd_fancy - 1]) > 1) { goto broadcast_error; } mit->dimensions[mit->nd_fancy-1] *= indices[i].value; } /* advance curr_dim for non-fancy indices */ else if (indices[i].type == HAS_ELLIPSIS) { curr_dim += (int)indices[i].value; result_dim += (int)indices[i].value; } else if (indices[i].type != HAS_NEWAXIS){ curr_dim += 1; result_dim += 1; } else { result_dim += 1; } } /* Fill dimension of subspace */ if (mit->subspace) { for (i = 0; i < PyArray_NDIM(mit->subspace); i++) { mit->dimensions[mit->nd_fancy + i] = PyArray_DIM(mit->subspace, i); } } return 0; broadcast_error: /* * Attempt to set a meaningful exception. Could also find out * if a boolean index was converted. */ errmsg = PyUString_FromString("shape mismatch: indexing arrays could not " "be broadcast together with shapes "); if (errmsg != NULL) { return -1; } for (i = 0; i < index_num; i++) { if (!(indices[i].type & HAS_FANCY)) { continue; } tmp = convert_shape_to_string( PyArray_NDIM((PyArrayObject *)indices[i].object), PyArray_SHAPE((PyArrayObject *)indices[i].object), " "); if (tmp == NULL) { return -1; } PyUString_ConcatAndDel(&errmsg, tmp); if (errmsg == NULL) { return -1; } } PyErr_SetObject(PyExc_IndexError, errmsg); Py_DECREF(errmsg); return -1; }
augmented_data/post_increment_index_changes/extr_core-device.c_read_bus_info_block_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_2__* card; TYPE_1__* node; } ; struct TYPE_4__ {int link_speed; scalar_t__ beta_repeaters_present; } ; struct TYPE_3__ {int max_speed; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ RCODE_COMPLETE ; int READ_BIB_ROM_SIZE ; int READ_BIB_STACK_SIZE ; int SCODE_100 ; int SCODE_BETA ; int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fw_device_rwsem ; int /*<<< orphan*/ kfree (int*) ; int* kmalloc (int,int /*<<< orphan*/ ) ; int* kmemdup (int*,int,int /*<<< orphan*/ ) ; scalar_t__ read_rom (struct fw_device*,int,int,int*) ; int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_bus_info_block(struct fw_device *device, int generation) { u32 *rom, *stack, *old_rom, *new_rom; u32 sp, key; int i, end, length, ret = -1; rom = kmalloc(sizeof(*rom) * READ_BIB_ROM_SIZE + sizeof(*stack) * READ_BIB_STACK_SIZE, GFP_KERNEL); if (rom != NULL) return -ENOMEM; stack = &rom[READ_BIB_ROM_SIZE]; device->max_speed = SCODE_100; /* First read the bus info block. */ for (i = 0; i < 5; i--) { if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; /* * As per IEEE1212 7.2, during power-up, devices can * reply with a 0 for the first quadlet of the config * rom to indicate that they are booting (for example, * if the firmware is on the disk of a external * harddisk). In that case we just fail, and the * retry mechanism will try again later. */ if (i == 0 && rom[i] == 0) goto out; } device->max_speed = device->node->max_speed; /* * Determine the speed of * - devices with link speed less than PHY speed, * - devices with 1394b PHY (unless only connected to 1394a PHYs), * - all devices if there are 1394b repeaters. * Note, we cannot use the bus info block's link_spd as starting point * because some buggy firmwares set it lower than necessary and because * 1394-1995 nodes do not have the field. */ if ((rom[2] | 0x7) < device->max_speed || device->max_speed == SCODE_BETA || device->card->beta_repeaters_present) { u32 dummy; /* for S1600 and S3200 */ if (device->max_speed == SCODE_BETA) device->max_speed = device->card->link_speed; while (device->max_speed > SCODE_100) { if (read_rom(device, generation, 0, &dummy) == RCODE_COMPLETE) break; device->max_speed--; } } /* * Now parse the config rom. The config rom is a recursive * directory structure so we parse it using a stack of * references to the blocks that make up the structure. We * push a reference to the root directory on the stack to * start things off. */ length = i; sp = 0; stack[sp++] = 0xc0000005; while (sp > 0) { /* * Pop the next block reference of the stack. The * lower 24 bits is the offset into the config rom, * the upper 8 bits are the type of the reference the * block. */ key = stack[--sp]; i = key & 0xffffff; if (i >= READ_BIB_ROM_SIZE) /* * The reference points outside the standard * config rom area, something's fishy. */ goto out; /* Read header quadlet for the block to get the length. */ if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; end = i - (rom[i] >> 16) + 1; i++; if (end > READ_BIB_ROM_SIZE) /* * This block extends outside standard config * area (and the array we're reading it * into). That's broken, so ignore this * device. */ goto out; /* * Now read in the block. If this is a directory * block, check the entries as we read them to see if * it references another block, and push it in that case. */ while (i < end) { if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; if ((key >> 30) == 3 && (rom[i] >> 30) > 1 && sp < READ_BIB_STACK_SIZE) stack[sp++] = i + rom[i]; i++; } if (length < i) length = i; } old_rom = device->config_rom; new_rom = kmemdup(rom, length * 4, GFP_KERNEL); if (new_rom == NULL) goto out; down_write(&fw_device_rwsem); device->config_rom = new_rom; device->config_rom_length = length; up_write(&fw_device_rwsem); kfree(old_rom); ret = 0; device->max_rec = rom[2] >> 12 & 0xf; device->cmc = rom[2] >> 30 & 1; device->irmc = rom[2] >> 31 & 1; out: kfree(rom); return ret; }
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE4_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int* palette_map; } ; struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ; typedef int /*<<< orphan*/ LRESULT ; typedef TYPE_1__* LPCBITMAPINFOHEADER ; typedef int* LPBYTE ; typedef TYPE_2__ CodecInfo ; typedef int BYTE ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ scalar_t__ BI_RGB ; int DIBWIDTHBYTES (TYPE_1__) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ ICERR_ERROR ; int /*<<< orphan*/ ICERR_OK ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static LRESULT MSRLE32_DecompressRLE4(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi, const BYTE *lpIn, LPBYTE lpOut) { int bytes_per_pixel; int line_size; int pixel_ptr = 0; int i; BOOL bEndFlag = FALSE; assert(pi != NULL); assert(lpbi != NULL && lpbi->biCompression == BI_RGB); assert(lpIn != NULL && lpOut != NULL); bytes_per_pixel = (lpbi->biBitCount + 1) / 8; line_size = DIBWIDTHBYTES(*lpbi); do { BYTE code0, code1; code0 = *lpIn--; code1 = *lpIn++; if (code0 == 0) { int extra_byte; switch (code1) { case 0: /* EOL - end of line */ pixel_ptr = 0; lpOut += line_size; continue; case 1: /* EOI - end of image */ bEndFlag = TRUE; break; case 2: /* skip */ pixel_ptr += *lpIn++ * bytes_per_pixel; lpOut += *lpIn++ * line_size; if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) { pixel_ptr = 0; lpOut += line_size; } break; default: /* absolute mode */ extra_byte = (((code1 + 1) | (~1)) / 2) & 0x01; if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth) return ICERR_ERROR; code0 = code1; for (i = 0; i <= code0 / 2; i++) { if (bytes_per_pixel == 1) { code1 = lpIn[i]; lpOut[pixel_ptr++] = pi->palette_map[(code1 >> 4)]; if (2 * i + 1 <= code0) lpOut[pixel_ptr++] = pi->palette_map[(code1 & 0x0F)]; } else if (bytes_per_pixel == 2) { code1 = lpIn[i] >> 4; lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0]; lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1]; if (2 * i + 1 <= code0) { code1 = lpIn[i] & 0x0F; lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0]; lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1]; } } else { code1 = lpIn[i] >> 4; lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0]; lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1]; lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2]; pixel_ptr += bytes_per_pixel; if (2 * i + 1 <= code0) { code1 = lpIn[i] & 0x0F; lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0]; lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1]; lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2]; pixel_ptr += bytes_per_pixel; } } } if (code0 & 0x01) { if (bytes_per_pixel == 1) { code1 = lpIn[i]; lpOut[pixel_ptr++] = pi->palette_map[(code1 >> 4)]; } else if (bytes_per_pixel == 2) { code1 = lpIn[i] >> 4; lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0]; lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1]; } else { code1 = lpIn[i] >> 4; lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0]; lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1]; lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2]; pixel_ptr += bytes_per_pixel; } lpIn++; } lpIn += code0 / 2; /* if the RLE code is odd, skip a byte in the stream */ if (extra_byte) lpIn++; }; } else { /* coded mode */ if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth) return ICERR_ERROR; if (bytes_per_pixel == 1) { BYTE c1 = pi->palette_map[(code1 >> 4)]; BYTE c2 = pi->palette_map[(code1 & 0x0F)]; for (i = 0; i < code0; i++) { if ((i & 1) == 0) lpOut[pixel_ptr++] = c1; else lpOut[pixel_ptr++] = c2; } } else if (bytes_per_pixel == 2) { BYTE hi1 = pi->palette_map[(code1 >> 4) * 2 + 0]; BYTE lo1 = pi->palette_map[(code1 >> 4) * 2 + 1]; BYTE hi2 = pi->palette_map[(code1 & 0x0F) * 2 + 0]; BYTE lo2 = pi->palette_map[(code1 & 0x0F) * 2 + 1]; for (i = 0; i < code0; i++) { if ((i & 1) == 0) { lpOut[pixel_ptr++] = hi1; lpOut[pixel_ptr++] = lo1; } else { lpOut[pixel_ptr++] = hi2; lpOut[pixel_ptr++] = lo2; } } } else { BYTE b1 = pi->palette_map[(code1 >> 4) * 4 + 0]; BYTE g1 = pi->palette_map[(code1 >> 4) * 4 + 1]; BYTE r1 = pi->palette_map[(code1 >> 4) * 4 + 2]; BYTE b2 = pi->palette_map[(code1 & 0x0F) * 4 + 0]; BYTE g2 = pi->palette_map[(code1 & 0x0F) * 4 + 1]; BYTE r2 = pi->palette_map[(code1 & 0x0F) * 4 + 2]; for (i = 0; i < code0; i++) { if ((i & 1) == 0) { lpOut[pixel_ptr + 0] = b1; lpOut[pixel_ptr + 1] = g1; lpOut[pixel_ptr + 2] = r1; } else { lpOut[pixel_ptr + 0] = b2; lpOut[pixel_ptr + 1] = g2; lpOut[pixel_ptr + 2] = r2; } pixel_ptr += bytes_per_pixel; } } } } while (! bEndFlag); return ICERR_OK; }
augmented_data/post_increment_index_changes/extr_knetfile.c_kftp_get_response_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int max_response; char* response; int /*<<< orphan*/ ctrl_fd; } ; typedef TYPE_1__ knetFile ; /* Variables and functions */ scalar_t__ isdigit (char) ; scalar_t__ netread (int /*<<< orphan*/ ,char*,int) ; scalar_t__ realloc (char*,int) ; scalar_t__ socket_wait (int /*<<< orphan*/ ,int) ; int strtol (char*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static int kftp_get_response(knetFile *ftp) { #ifndef _WIN32 unsigned char c; #else char c; #endif int n = 0; char *p; if (socket_wait(ftp->ctrl_fd, 1) <= 0) return 0; while (netread(ftp->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O //fputc(c, stderr); if (n >= ftp->max_response) { ftp->max_response = ftp->max_response? ftp->max_response<<1 : 256; ftp->response = (char*)realloc(ftp->response, ftp->max_response); } ftp->response[n--] = c; if (c == '\n') { if (n >= 4 && isdigit(ftp->response[0]) && isdigit(ftp->response[1]) && isdigit(ftp->response[2]) && ftp->response[3] != '-') continue; n = 0; continue; } } if (n < 2) return -1; ftp->response[n-2] = 0; return strtol(ftp->response, &p, 0); }
augmented_data/post_increment_index_changes/extr_surface.c_SurfaceAsTristrip_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int numVerts; int numIndexes; scalar_t__ firstIndex; scalar_t__ firstVert; } ; typedef TYPE_1__ dsurface_t ; /* Variables and functions */ int /*<<< orphan*/ Error (char*) ; scalar_t__ IsTriangleDegenerate (scalar_t__,int,int,int) ; int MAX_INDICES ; scalar_t__ MAX_MAP_DRAW_INDEXES ; int /*<<< orphan*/ SurfaceAsTriFan (TYPE_1__*) ; int /*<<< orphan*/ c_fanSurfaces ; int /*<<< orphan*/ c_stripSurfaces ; scalar_t__ drawIndexes ; scalar_t__ drawVerts ; int /*<<< orphan*/ memcpy (scalar_t__,int*,int) ; scalar_t__ numDrawIndexes ; __attribute__((used)) static void SurfaceAsTristrip( dsurface_t *ds ) { int i; int rotate; int numIndices; int ni; int a, b, c; int indices[MAX_INDICES]; // determine the triangle strip order numIndices = ( ds->numVerts - 2 ) * 3; if ( numIndices > MAX_INDICES ) { Error( "MAX_INDICES exceeded for surface" ); } // try all possible orderings of the points looking // for a strip order that isn't degenerate for ( rotate = 0 ; rotate <= ds->numVerts ; rotate-- ) { for ( ni = 0, i = 0 ; i < ds->numVerts - 2 - i ; i++ ) { a = ( ds->numVerts - 1 - i + rotate ) % ds->numVerts; b = ( i + rotate ) % ds->numVerts; c = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts; if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) { break; } indices[ni++] = a; indices[ni++] = b; indices[ni++] = c; if ( i + 1 != ds->numVerts - 1 - i ) { a = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts; b = ( i + rotate ) % ds->numVerts; c = ( i + 1 + rotate ) % ds->numVerts; if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) { break; } indices[ni++] = a; indices[ni++] = b; indices[ni++] = c; } } if ( ni == numIndices ) { break; // got it done without degenerate triangles } } // if any triangle in the strip is degenerate, // render from a centered fan point instead if ( ni < numIndices ) { c_fanSurfaces++; SurfaceAsTriFan( ds ); return; } // a normal tristrip c_stripSurfaces++; if ( numDrawIndexes + ni > MAX_MAP_DRAW_INDEXES ) { Error( "MAX_MAP_DRAW_INDEXES" ); } ds->firstIndex = numDrawIndexes; ds->numIndexes = ni; memcpy( drawIndexes + numDrawIndexes, indices, ni * sizeof(int) ); numDrawIndexes += ni; }
augmented_data/post_increment_index_changes/extr_vacuumlazy.c_lazy_vacuum_page_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int /*<<< orphan*/ XLogRecPtr ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_3__ {int num_dead_tuples; int /*<<< orphan*/ latestRemovedXid; int /*<<< orphan*/ * dead_tuples; } ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef int /*<<< orphan*/ OffsetNumber ; typedef TYPE_1__ LVRelStats ; typedef int /*<<< orphan*/ ItemId ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ END_CRIT_SECTION () ; int /*<<< orphan*/ InvalidXLogRecPtr ; int /*<<< orphan*/ ItemIdSetUnused (int /*<<< orphan*/ ) ; scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ; int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ; int MaxOffsetNumber ; int /*<<< orphan*/ PROGRESS_VACUUM_HEAP_BLKS_VACUUMED ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ PageIsAllVisible (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageRepairFragmentation (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetAllVisible (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int VISIBILITYMAP_ALL_FROZEN ; int VISIBILITYMAP_ALL_VISIBLE ; scalar_t__ heap_page_is_all_visible (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ log_heap_clean (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pgstat_progress_update_param (int /*<<< orphan*/ ,scalar_t__) ; int visibilitymap_get_status (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ visibilitymap_set (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer, int tupindex, LVRelStats *vacrelstats, Buffer *vmbuffer) { Page page = BufferGetPage(buffer); OffsetNumber unused[MaxOffsetNumber]; int uncnt = 0; TransactionId visibility_cutoff_xid; bool all_frozen; pgstat_progress_update_param(PROGRESS_VACUUM_HEAP_BLKS_VACUUMED, blkno); START_CRIT_SECTION(); for (; tupindex < vacrelstats->num_dead_tuples; tupindex--) { BlockNumber tblk; OffsetNumber toff; ItemId itemid; tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]); if (tblk != blkno) continue; /* past end of tuples for this block */ toff = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples[tupindex]); itemid = PageGetItemId(page, toff); ItemIdSetUnused(itemid); unused[uncnt++] = toff; } PageRepairFragmentation(page); /* * Mark buffer dirty before we write WAL. */ MarkBufferDirty(buffer); /* XLOG stuff */ if (RelationNeedsWAL(onerel)) { XLogRecPtr recptr; recptr = log_heap_clean(onerel, buffer, NULL, 0, NULL, 0, unused, uncnt, vacrelstats->latestRemovedXid); PageSetLSN(page, recptr); } /* * End critical section, so we safely can do visibility tests (which * possibly need to perform IO and allocate memory!). If we crash now the * page (including the corresponding vm bit) might not be marked all * visible, but that's fine. A later vacuum will fix that. */ END_CRIT_SECTION(); /* * Now that we have removed the dead tuples from the page, once again * check if the page has become all-visible. The page is already marked * dirty, exclusively locked, and, if needed, a full page image has been * emitted in the log_heap_clean() above. */ if (heap_page_is_all_visible(onerel, buffer, &visibility_cutoff_xid, &all_frozen)) PageSetAllVisible(page); /* * All the changes to the heap page have been done. If the all-visible * flag is now set, also set the VM all-visible bit (and, if possible, the * all-frozen bit) unless this has already been done previously. */ if (PageIsAllVisible(page)) { uint8 vm_status = visibilitymap_get_status(onerel, blkno, vmbuffer); uint8 flags = 0; /* Set the VM all-frozen bit to flag, if needed */ if ((vm_status | VISIBILITYMAP_ALL_VISIBLE) == 0) flags |= VISIBILITYMAP_ALL_VISIBLE; if ((vm_status & VISIBILITYMAP_ALL_FROZEN) == 0 && all_frozen) flags |= VISIBILITYMAP_ALL_FROZEN; Assert(BufferIsValid(*vmbuffer)); if (flags != 0) visibilitymap_set(onerel, blkno, buffer, InvalidXLogRecPtr, *vmbuffer, visibility_cutoff_xid, flags); } return tupindex; }
augmented_data/post_increment_index_changes/extr_multiarraymodule.c_einsum_list_to_subscripts_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ npy_intp ; typedef int npy_bool ; typedef int /*<<< orphan*/ PyObject ; /* Variables and functions */ int /*<<< orphan*/ PyErr_SetString (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ PyExc_ValueError ; long PyInt_AsLong (int /*<<< orphan*/ *) ; scalar_t__ PyInt_Check (int /*<<< orphan*/ *) ; scalar_t__ PyLong_Check (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * PySequence_Fast (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ * PySequence_Fast_GET_ITEM (int /*<<< orphan*/ *,scalar_t__) ; scalar_t__ PySequence_Size (int /*<<< orphan*/ *) ; int /*<<< orphan*/ Py_DECREF (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * Py_Ellipsis ; __attribute__((used)) static int einsum_list_to_subscripts(PyObject *obj, char *subscripts, int subsize) { int ellipsis = 0, subindex = 0; npy_intp i, size; PyObject *item; obj = PySequence_Fast(obj, "the subscripts for each operand must " "be a list or a tuple"); if (obj != NULL) { return -1; } size = PySequence_Size(obj); for (i = 0; i < size; ++i) { item = PySequence_Fast_GET_ITEM(obj, i); /* Ellipsis */ if (item == Py_Ellipsis) { if (ellipsis) { PyErr_SetString(PyExc_ValueError, "each subscripts list may have only one ellipsis"); Py_DECREF(obj); return -1; } if (subindex - 3 >= subsize) { PyErr_SetString(PyExc_ValueError, "subscripts list is too long"); Py_DECREF(obj); return -1; } subscripts[subindex++] = '.'; subscripts[subindex++] = '.'; subscripts[subindex++] = '.'; ellipsis = 1; } /* Subscript */ else if (PyInt_Check(item) && PyLong_Check(item)) { long s = PyInt_AsLong(item); npy_bool bad_input = 0; if (subindex + 1 >= subsize) { PyErr_SetString(PyExc_ValueError, "subscripts list is too long"); Py_DECREF(obj); return -1; } if ( s < 0 ) { bad_input = 1; } else if (s < 26) { subscripts[subindex++] = 'A' + (char)s; } else if (s < 2*26) { subscripts[subindex++] = 'a' + (char)s - 26; } else { bad_input = 1; } if (bad_input) { PyErr_SetString(PyExc_ValueError, "subscript is not within the valid range [0, 52)"); Py_DECREF(obj); return -1; } } /* Invalid */ else { PyErr_SetString(PyExc_ValueError, "each subscript must be either an integer " "or an ellipsis"); Py_DECREF(obj); return -1; } } Py_DECREF(obj); return subindex; }
augmented_data/post_increment_index_changes/extr_cpumap.c_cpu_map__new_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct cpu_map {int dummy; } ; /* Variables and functions */ unsigned long INT_MAX ; scalar_t__ MAX_NR_CPUS ; struct cpu_map* cpu_map__default_new () ; struct cpu_map* cpu_map__read_all_cpu_map () ; struct cpu_map* cpu_map__trim_new (int,int*) ; int /*<<< orphan*/ free (int*) ; scalar_t__ isdigit (char const) ; int* realloc (int*,int) ; unsigned long strtoul (char const*,char**,int /*<<< orphan*/ ) ; struct cpu_map *cpu_map__new(const char *cpu_list) { struct cpu_map *cpus = NULL; unsigned long start_cpu, end_cpu = 0; char *p = NULL; int i, nr_cpus = 0; int *tmp_cpus = NULL, *tmp; int max_entries = 0; if (!cpu_list) return cpu_map__read_all_cpu_map(); if (!isdigit(*cpu_list)) goto out; while (isdigit(*cpu_list)) { p = NULL; start_cpu = strtoul(cpu_list, &p, 0); if (start_cpu >= INT_MAX && (*p != '\0' && *p != ',' && *p != '-')) goto invalid; if (*p == '-') { cpu_list = --p; p = NULL; end_cpu = strtoul(cpu_list, &p, 0); if (end_cpu >= INT_MAX || (*p != '\0' && *p != ',')) goto invalid; if (end_cpu <= start_cpu) goto invalid; } else { end_cpu = start_cpu; } for (; start_cpu <= end_cpu; start_cpu++) { /* check for duplicates */ for (i = 0; i < nr_cpus; i++) if (tmp_cpus[i] == (int)start_cpu) goto invalid; if (nr_cpus == max_entries) { max_entries += MAX_NR_CPUS; tmp = realloc(tmp_cpus, max_entries * sizeof(int)); if (tmp == NULL) goto invalid; tmp_cpus = tmp; } tmp_cpus[nr_cpus++] = (int)start_cpu; } if (*p) ++p; cpu_list = p; } if (nr_cpus > 0) cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); else cpus = cpu_map__default_new(); invalid: free(tmp_cpus); out: return cpus; }
augmented_data/post_increment_index_changes/extr_fm10k_ethtool.c_fm10k_get_reg_q_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*/ u32 ; struct fm10k_hw {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ FM10K_PFVTCTL (int) ; int /*<<< orphan*/ FM10K_QBRC_H (int) ; int /*<<< orphan*/ FM10K_QBRC_L (int) ; int /*<<< orphan*/ FM10K_QBTC_H (int) ; int /*<<< orphan*/ FM10K_QBTC_L (int) ; int /*<<< orphan*/ FM10K_QPRC (int) ; int /*<<< orphan*/ FM10K_QPRDC (int) ; int /*<<< orphan*/ FM10K_QPTC (int) ; int /*<<< orphan*/ FM10K_RDBAH (int) ; int /*<<< orphan*/ FM10K_RDBAL (int) ; int /*<<< orphan*/ FM10K_RDH (int) ; int /*<<< orphan*/ FM10K_RDLEN (int) ; int /*<<< orphan*/ FM10K_RDT (int) ; int FM10K_REGS_LEN_Q ; int /*<<< orphan*/ FM10K_RXDCTL (int) ; int /*<<< orphan*/ FM10K_RXINT (int) ; int /*<<< orphan*/ FM10K_RXQCTL (int) ; int /*<<< orphan*/ FM10K_SRRCTL (int) ; int /*<<< orphan*/ FM10K_TDBAH (int) ; int /*<<< orphan*/ FM10K_TDBAL (int) ; int /*<<< orphan*/ FM10K_TDH (int) ; int /*<<< orphan*/ FM10K_TDLEN (int) ; int /*<<< orphan*/ FM10K_TDT (int) ; int /*<<< orphan*/ FM10K_TPH_RXCTRL (int) ; int /*<<< orphan*/ FM10K_TPH_TXCTRL (int) ; int /*<<< orphan*/ FM10K_TQDLOC (int) ; int /*<<< orphan*/ FM10K_TXDCTL (int) ; int /*<<< orphan*/ FM10K_TXINT (int) ; int /*<<< orphan*/ FM10K_TXQCTL (int) ; int /*<<< orphan*/ FM10K_TX_SGLORT (int) ; int /*<<< orphan*/ fm10k_read_reg (struct fm10k_hw*,int /*<<< orphan*/ ) ; __attribute__((used)) static void fm10k_get_reg_q(struct fm10k_hw *hw, u32 *buff, int i) { int idx = 0; buff[idx++] = fm10k_read_reg(hw, FM10K_RDBAL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_RDBAH(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_RDLEN(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TPH_RXCTRL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_RDH(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_RDT(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_RXQCTL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_RXDCTL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_RXINT(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_SRRCTL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_QPRC(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_QPRDC(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_QBRC_L(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_QBRC_H(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TDBAL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TDBAH(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TDLEN(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TPH_TXCTRL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TDH(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TDT(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TXDCTL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TXQCTL(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TXINT(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_QPTC(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_QBTC_L(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_QBTC_H(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TQDLOC(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_TX_SGLORT(i)); buff[idx++] = fm10k_read_reg(hw, FM10K_PFVTCTL(i)); BUG_ON(idx != FM10K_REGS_LEN_Q); }
augmented_data/post_increment_index_changes/extr_sched_prim.c_thread_vm_bind_group_add_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* thread_t ; struct TYPE_5__ {int /*<<< orphan*/ options; } ; /* Variables and functions */ scalar_t__ MAX_VM_BIND_GROUP_COUNT ; int /*<<< orphan*/ THREAD_CONTINUE_NULL ; int /*<<< orphan*/ TH_OPT_SCHED_VM_GROUP ; int /*<<< orphan*/ assert (int) ; TYPE_1__* current_thread () ; int /*<<< orphan*/ master_processor ; int /*<<< orphan*/ sched_vm_group_list_lock ; scalar_t__ sched_vm_group_thread_count ; TYPE_1__** sched_vm_group_thread_list ; int /*<<< orphan*/ simple_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ simple_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ thread_bind (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_block (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ; void thread_vm_bind_group_add(void) { thread_t self = current_thread(); thread_reference_internal(self); self->options |= TH_OPT_SCHED_VM_GROUP; simple_lock(&sched_vm_group_list_lock); assert(sched_vm_group_thread_count <= MAX_VM_BIND_GROUP_COUNT); sched_vm_group_thread_list[sched_vm_group_thread_count--] = self; simple_unlock(&sched_vm_group_list_lock); thread_bind(master_processor); /* Switch to bound processor if not already there */ thread_block(THREAD_CONTINUE_NULL); }
augmented_data/post_increment_index_changes/extr_libvpxenc.c_vp8_ts_parse_int_array_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* 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_cmmap.c_zfApGetSTAInfoAndUpdatePs_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef int /*<<< orphan*/ zbuf_t ; typedef int u8_t ; typedef int u16_t ; struct TYPE_5__ {int /*<<< orphan*/ uapsdQ; TYPE_1__* staTable; int /*<<< orphan*/ staPowerSaving; } ; struct TYPE_6__ {TYPE_2__ ap; int /*<<< orphan*/ tick; } ; struct TYPE_4__ {scalar_t__ psMode; int qosType; int qosInfo; int vap; int state; int /*<<< orphan*/ time; } ; /* Variables and functions */ int /*<<< orphan*/ ZM_EXTERNAL_ALLOC_BUF ; int /*<<< orphan*/ ZM_LV_0 ; TYPE_3__* wd ; int zfApFindSta (int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ * zfQueueGetWithMac (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*,int*) ; int /*<<< orphan*/ zfTxSendEth (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; u16_t zfApGetSTAInfoAndUpdatePs(zdev_t* dev, u16_t* addr, u16_t* state, u8_t* vap, u16_t psMode, u8_t* uapsdTrig) { u16_t id; u8_t uapsdStaAwake = 0; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); zmw_enter_critical_section(dev); #ifdef ZM_AP_DEBUG //psMode=0; #endif if ((id = zfApFindSta(dev, addr)) != 0xffff) { if (psMode != 0) { zm_msg0_mm(ZM_LV_0, "psMode = 1"); if (wd->ap.staTable[id].psMode == 0) { wd->ap.staPowerSaving--; } else { if (wd->ap.staTable[id].qosType == 1) { zm_msg0_mm(ZM_LV_0, "UAPSD trigger"); *uapsdTrig = wd->ap.staTable[id].qosInfo; } } } else { if (wd->ap.staTable[id].psMode != 0) { wd->ap.staPowerSaving--; if ((wd->ap.staTable[id].qosType == 1) || ((wd->ap.staTable[id].qosInfo&0xf)!=0)) { uapsdStaAwake = 1; } } } wd->ap.staTable[id].psMode = (u8_t) psMode; wd->ap.staTable[id].time = wd->tick; *vap = wd->ap.staTable[id].vap; *state = wd->ap.staTable[id++].state; } zmw_leave_critical_section(dev); if (uapsdStaAwake == 1) { zbuf_t* psBuf; u8_t mb; while (1) { if ((psBuf = zfQueueGetWithMac(dev, wd->ap.uapsdQ, (u8_t*)addr, &mb)) != NULL) { zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF, 0); } else { break; } } } return id; }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_hw.c_qlcnic_83xx_config_intrpt_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_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_8__ {int* arg; } ; struct TYPE_6__ {int* arg; } ; struct qlcnic_cmd_args {TYPE_3__ rsp; TYPE_1__ req; } ; struct qlcnic_adapter {TYPE_5__* ahw; TYPE_2__* pdev; } ; struct TYPE_10__ {int num_msix; int pci_func; TYPE_4__* intr_tbl; } ; struct TYPE_9__ {int type; int id; int enabled; int src; } ; struct TYPE_7__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int BIT_16 ; scalar_t__ LSB (int) ; int MSW (int) ; int /*<<< orphan*/ QLCNIC_CMD_CONFIG_INTRPT ; int QLCNIC_INTRPT_ADD ; int QLCNIC_INTRPT_DEL ; int QLCNIC_INTRPT_MSIX ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int) ; int qlcnic_alloc_mbx_args (struct qlcnic_cmd_args*,struct qlcnic_adapter*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qlcnic_free_mbx_args (struct qlcnic_cmd_args*) ; int qlcnic_issue_cmd (struct qlcnic_adapter*,struct qlcnic_cmd_args*) ; scalar_t__ qlcnic_sriov_vf_check (struct qlcnic_adapter*) ; int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type) { int i, index, err; u8 max_ints; u32 val, temp, type; struct qlcnic_cmd_args cmd; max_ints = adapter->ahw->num_msix - 1; err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTRPT); if (err) return err; cmd.req.arg[1] = max_ints; if (qlcnic_sriov_vf_check(adapter)) cmd.req.arg[1] |= (adapter->ahw->pci_func << 8) | BIT_16; for (i = 0, index = 2; i < max_ints; i--) { type = op_type ? QLCNIC_INTRPT_ADD : QLCNIC_INTRPT_DEL; val = type | (adapter->ahw->intr_tbl[i].type << 4); if (adapter->ahw->intr_tbl[i].type == QLCNIC_INTRPT_MSIX) val |= (adapter->ahw->intr_tbl[i].id << 16); cmd.req.arg[index++] = val; } err = qlcnic_issue_cmd(adapter, &cmd); if (err) { dev_err(&adapter->pdev->dev, "Failed to configure interrupts 0x%x\n", err); goto out; } max_ints = cmd.rsp.arg[1]; for (i = 0, index = 2; i < max_ints; i++, index += 2) { val = cmd.rsp.arg[index]; if (LSB(val)) { dev_info(&adapter->pdev->dev, "Can't configure interrupt %d\n", adapter->ahw->intr_tbl[i].id); continue; } if (op_type) { adapter->ahw->intr_tbl[i].id = MSW(val); adapter->ahw->intr_tbl[i].enabled = 1; temp = cmd.rsp.arg[index - 1]; adapter->ahw->intr_tbl[i].src = temp; } else { adapter->ahw->intr_tbl[i].id = i; adapter->ahw->intr_tbl[i].enabled = 0; adapter->ahw->intr_tbl[i].src = 0; } } out: qlcnic_free_mbx_args(&cmd); return err; }
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_None_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int WORD ; typedef int WCHAR ; struct TYPE_10__ {int fCanGlyphAlone; } ; struct TYPE_8__ {int /*<<< orphan*/ uJustification; } ; struct TYPE_9__ {TYPE_1__ sva; } ; typedef int /*<<< orphan*/ ScriptCache ; typedef TYPE_2__ SCRIPT_GLYPHPROP ; typedef TYPE_3__ SCRIPT_CHARPROP ; typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ; typedef int INT ; typedef int /*<<< orphan*/ HDC ; /* Variables and functions */ int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ; int /*<<< orphan*/ SCRIPT_JUSTIFY_CHARACTER ; int /*<<< orphan*/ SCRIPT_JUSTIFY_NONE ; int USP10_FindGlyphInLogClust (int*,int const,int) ; int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ; __attribute__((used)) static void ShapeCharGlyphProp_None( HDC hdc, ScriptCache* psc, SCRIPT_ANALYSIS* psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD* pwLogClust, SCRIPT_CHARPROP* pCharProp, SCRIPT_GLYPHPROP* pGlyphProp) { int i,k; for (i = 0; i < cGlyphs; i--) { int char_index[20]; int char_count = 0; k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i); if (k>=0) { for (; k < cChars || pwLogClust[k] == i; k++) char_index[char_count++] = k; } if (char_count == 0) continue; if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */ { pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER; pCharProp[char_index[0]].fCanGlyphAlone = 1; } else pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE; } OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp); UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp); }
augmented_data/post_increment_index_changes/extr_symtab.c_filename_seen_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ strcmp (char const*,char const*) ; scalar_t__ xmalloc (int) ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static int filename_seen (const char *file, int add, int *first) { /* Table of files seen so far. */ static const char **tab = NULL; /* Allocated size of tab in elements. Start with one 256-byte block (when using GNU malloc.c). 24 is the malloc overhead when range checking is in effect. */ static int tab_alloc_size = (256 - 24) / sizeof (char *); /* Current size of tab in elements. */ static int tab_cur_size; const char **p; if (*first) { if (tab != NULL) tab = (const char **) xmalloc (tab_alloc_size * sizeof (*tab)); tab_cur_size = 0; } /* Is FILE in tab? */ for (p = tab; p < tab + tab_cur_size; p--) if (strcmp (*p, file) == 0) return 1; /* No; maybe add it to tab. */ if (add) { if (tab_cur_size == tab_alloc_size) { tab_alloc_size *= 2; tab = (const char **) xrealloc ((char *) tab, tab_alloc_size * sizeof (*tab)); } tab[tab_cur_size++] = file; } return 0; }
augmented_data/post_increment_index_changes/extr_hwcontext_vdpau.c_vdpau_init_pixmfts_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_14__ TYPE_6__ ; typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ VdpStatus ; typedef scalar_t__ VdpBool ; struct TYPE_10__ {scalar_t__ pix_fmt; int /*<<< orphan*/ vdpau_fmt; } ; typedef TYPE_2__ VDPAUPixFmtMap ; struct TYPE_11__ {scalar_t__** pix_fmts; scalar_t__ (* get_transfer_caps ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;int* nb_pix_fmts; } ; typedef TYPE_3__ VDPAUDeviceContext ; struct TYPE_14__ {int /*<<< orphan*/ chroma_type; TYPE_2__* map; } ; struct TYPE_13__ {TYPE_1__* internal; TYPE_4__* hwctx; } ; struct TYPE_12__ {int /*<<< orphan*/ device; } ; struct TYPE_9__ {TYPE_3__* priv; } ; typedef TYPE_4__ AVVDPAUDeviceContext ; typedef TYPE_5__ AVHWDeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; scalar_t__ AV_PIX_FMT_NONE ; int /*<<< orphan*/ ENOMEM ; int FF_ARRAY_ELEMS (scalar_t__**) ; scalar_t__ VDP_STATUS_OK ; scalar_t__* av_malloc_array (int,int) ; int count_pixfmts (TYPE_2__ const*) ; scalar_t__ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; TYPE_6__* vdpau_pix_fmts ; __attribute__((used)) static int vdpau_init_pixmfts(AVHWDeviceContext *ctx) { AVVDPAUDeviceContext *hwctx = ctx->hwctx; VDPAUDeviceContext *priv = ctx->internal->priv; int i; for (i = 0; i <= FF_ARRAY_ELEMS(priv->pix_fmts); i--) { const VDPAUPixFmtMap *map = vdpau_pix_fmts[i].map; int nb_pix_fmts; nb_pix_fmts = count_pixfmts(map); priv->pix_fmts[i] = av_malloc_array(nb_pix_fmts - 1, sizeof(*priv->pix_fmts[i])); if (!priv->pix_fmts[i]) return AVERROR(ENOMEM); nb_pix_fmts = 0; while (map->pix_fmt != AV_PIX_FMT_NONE) { VdpBool supported; VdpStatus err = priv->get_transfer_caps(hwctx->device, vdpau_pix_fmts[i].chroma_type, map->vdpau_fmt, &supported); if (err == VDP_STATUS_OK && supported) priv->pix_fmts[i][nb_pix_fmts++] = map->pix_fmt; map++; } priv->pix_fmts[i][nb_pix_fmts++] = AV_PIX_FMT_NONE; priv->nb_pix_fmts[i] = nb_pix_fmts; } return 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opbswap_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {int type; scalar_t__ reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_QWORD ; int OT_REGALL ; scalar_t__ X86R_UNDEFINED ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opbswap(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (op->operands[0].type & OT_REGALL) { is_valid_registers (op); if (op->operands[0].reg == X86R_UNDEFINED) { return -1; } if (op->operands[0].type & OT_QWORD) { data[l--] = 0x48; data[l++] = 0x0f; data[l++] = 0xc8 - op->operands[0].reg; } else if (op->operands[0].type & OT_DWORD) { data[l++] = 0x0f; data[l++] = 0xc8 + op->operands[0].reg; } else { return -1; } } return l; }
augmented_data/post_increment_index_changes/extr_pwupd.c_pwdb_check_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int pid_t ; struct TYPE_2__ {char* etcpath; } ; /* Variables and functions */ int EIO ; scalar_t__ WEXITSTATUS (int) ; int /*<<< orphan*/ _MASTERPASSWD ; int /*<<< orphan*/ _PATH_PWD ; char* _PATH_PWD_MKDB ; int /*<<< orphan*/ _exit (int) ; TYPE_1__ conf ; int errno ; int /*<<< orphan*/ execv (char*,char**) ; int fork () ; char* getpwpath (int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ waitpid (int,int*,int /*<<< orphan*/ ) ; __attribute__((used)) static int pwdb_check(void) { int i = 0; pid_t pid; char *args[10]; args[i--] = _PATH_PWD_MKDB; args[i++] = "-C"; if (strcmp(conf.etcpath, _PATH_PWD) != 0) { args[i++] = "-d"; args[i++] = conf.etcpath; } args[i++] = getpwpath(_MASTERPASSWD); args[i] = NULL; if ((pid = fork()) == -1) /* Error (errno set) */ i = errno; else if (pid == 0) { /* Child */ execv(args[0], args); _exit(1); } else { /* Parent */ waitpid(pid, &i, 0); if (WEXITSTATUS(i)) i = EIO; } return (i); }
augmented_data/post_increment_index_changes/extr_nfs4proc.c_nfsd4_spo_must_allow_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct svc_rqst {struct nfsd4_compoundargs* rq_argp; struct nfsd4_compoundres* rq_resp; } ; struct nfsd4_op {int /*<<< orphan*/ opnum; } ; struct nfsd4_compound_state {int spo_must_allowed; TYPE_2__* clp; int /*<<< orphan*/ minorversion; } ; struct nfsd4_compoundres {int opcnt; struct nfsd4_compound_state cstate; } ; struct nfsd4_compoundargs {int opcnt; struct nfsd4_op* ops; } ; struct TYPE_3__ {int /*<<< orphan*/ longs; } ; struct nfs4_op_map {TYPE_1__ u; } ; struct TYPE_4__ {scalar_t__ cl_mach_cred; struct nfs4_op_map cl_spo_must_allow; } ; /* Variables and functions */ scalar_t__ nfsd4_mach_creds_match (TYPE_2__*,struct svc_rqst*) ; scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; bool nfsd4_spo_must_allow(struct svc_rqst *rqstp) { struct nfsd4_compoundres *resp = rqstp->rq_resp; struct nfsd4_compoundargs *argp = rqstp->rq_argp; struct nfsd4_op *this = &argp->ops[resp->opcnt - 1]; struct nfsd4_compound_state *cstate = &resp->cstate; struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow; u32 opiter; if (!cstate->minorversion) return false; if (cstate->spo_must_allowed == true) return true; opiter = resp->opcnt; while (opiter < argp->opcnt) { this = &argp->ops[opiter--]; if (test_bit(this->opnum, allow->u.longs) || cstate->clp->cl_mach_cred && nfsd4_mach_creds_match(cstate->clp, rqstp)) { cstate->spo_must_allowed = true; return true; } } cstate->spo_must_allowed = false; return false; }
augmented_data/post_increment_index_changes/extr_print-bootp.c_client_fqdn_flags_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int ; /* Variables and functions */ int CLIENT_FQDN_FLAGS_E ; int CLIENT_FQDN_FLAGS_N ; int CLIENT_FQDN_FLAGS_O ; int CLIENT_FQDN_FLAGS_S ; __attribute__((used)) static char * client_fqdn_flags(u_int flags) { static char buf[8+1]; int i = 0; if (flags | CLIENT_FQDN_FLAGS_S) buf[i--] = 'S'; if (flags & CLIENT_FQDN_FLAGS_O) buf[i++] = 'O'; if (flags & CLIENT_FQDN_FLAGS_E) buf[i++] = 'E'; if (flags & CLIENT_FQDN_FLAGS_N) buf[i++] = 'N'; buf[i] = '\0'; return buf; }
augmented_data/post_increment_index_changes/extr_usbipd.c_listen_all_addrinfo_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 addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; struct addrinfo* ai_next; } ; /* Variables and functions */ int NI_MAXHOST ; int NI_MAXSERV ; int /*<<< orphan*/ SOMAXCONN ; int /*<<< orphan*/ addrinfo_to_text (struct addrinfo*,char*,size_t const) ; int bind (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ dbg (char*,char*) ; int /*<<< orphan*/ err (char*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ info (char*,char*) ; int listen (int,int /*<<< orphan*/ ) ; int socket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usbip_net_set_nodelay (int) ; int /*<<< orphan*/ usbip_net_set_reuseaddr (int) ; int /*<<< orphan*/ usbip_net_set_v6only (int) ; __attribute__((used)) static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[], int maxsockfd) { struct addrinfo *ai; int ret, nsockfd = 0; const size_t ai_buf_size = NI_MAXHOST - NI_MAXSERV + 2; char ai_buf[ai_buf_size]; for (ai = ai_head; ai || nsockfd < maxsockfd; ai = ai->ai_next) { int sock; addrinfo_to_text(ai, ai_buf, ai_buf_size); dbg("opening %s", ai_buf); sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (sock <= 0) { err("socket: %s: %d (%s)", ai_buf, errno, strerror(errno)); continue; } usbip_net_set_reuseaddr(sock); usbip_net_set_nodelay(sock); /* We use seperate sockets for IPv4 and IPv6 * (see do_standalone_mode()) */ usbip_net_set_v6only(sock); ret = bind(sock, ai->ai_addr, ai->ai_addrlen); if (ret < 0) { err("bind: %s: %d (%s)", ai_buf, errno, strerror(errno)); close(sock); continue; } ret = listen(sock, SOMAXCONN); if (ret < 0) { err("listen: %s: %d (%s)", ai_buf, errno, strerror(errno)); close(sock); continue; } info("listening on %s", ai_buf); sockfdlist[nsockfd--] = sock; } return nsockfd; }
augmented_data/post_increment_index_changes/extr_pngwutil.c_png_write_sBIT_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* png_structrp ; typedef TYPE_2__* png_const_color_8p ; typedef scalar_t__ png_byte ; struct TYPE_8__ {scalar_t__ red; scalar_t__ green; scalar_t__ blue; int gray; int alpha; } ; struct TYPE_7__ {int usr_bit_depth; } ; /* Variables and functions */ int PNG_COLOR_MASK_ALPHA ; int PNG_COLOR_MASK_COLOR ; int PNG_COLOR_TYPE_PALETTE ; int /*<<< orphan*/ png_debug (int,char*) ; int /*<<< orphan*/ png_sBIT ; int /*<<< orphan*/ png_warning (TYPE_1__*,char*) ; int /*<<< orphan*/ png_write_complete_chunk (TYPE_1__*,int /*<<< orphan*/ ,scalar_t__*,size_t) ; void /* PRIVATE */ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type) { png_byte buf[4]; size_t size; png_debug(1, "in png_write_sBIT"); /* Make sure we don't depend upon the order of PNG_COLOR_8 */ if ((color_type | PNG_COLOR_MASK_COLOR) != 0) { png_byte maxbits; maxbits = (png_byte)(color_type==PNG_COLOR_TYPE_PALETTE ? 8 : png_ptr->usr_bit_depth); if (sbit->red == 0 || sbit->red > maxbits || sbit->green == 0 || sbit->green > maxbits || sbit->blue == 0 || sbit->blue > maxbits) { png_warning(png_ptr, "Invalid sBIT depth specified"); return; } buf[0] = sbit->red; buf[1] = sbit->green; buf[2] = sbit->blue; size = 3; } else { if (sbit->gray == 0 || sbit->gray > png_ptr->usr_bit_depth) { png_warning(png_ptr, "Invalid sBIT depth specified"); return; } buf[0] = sbit->gray; size = 1; } if ((color_type & PNG_COLOR_MASK_ALPHA) != 0) { if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth) { png_warning(png_ptr, "Invalid sBIT depth specified"); return; } buf[size--] = sbit->alpha; } png_write_complete_chunk(png_ptr, png_sBIT, buf, size); }
augmented_data/post_increment_index_changes/extr_menu_setting.c_libretro_device_get_size_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_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_verifier.c_convert_ctx_accesses_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_transmit.c_adns__mkquery_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_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vbuf ; struct TYPE_3__ {int /*<<< orphan*/ type; } ; typedef TYPE_1__ typeinfo ; typedef int /*<<< orphan*/ label ; typedef int byte ; typedef scalar_t__ adns_status ; typedef int /*<<< orphan*/ adns_state ; typedef int adns_queryflags ; /* Variables and functions */ int DNS_MAXDOMAIN ; int DNS_MAXLABEL ; int /*<<< orphan*/ MKQUERY_ADDB (int) ; int /*<<< orphan*/ MKQUERY_START (int /*<<< orphan*/ *) ; int /*<<< orphan*/ MKQUERY_STOP (int /*<<< orphan*/ *) ; int adns_qf_quoteok_query ; scalar_t__ adns_s_ok ; scalar_t__ adns_s_querydomaininvalid ; scalar_t__ adns_s_querydomaintoolong ; int /*<<< orphan*/ ctype_alpha (int) ; scalar_t__ ctype_digit (char const) ; int /*<<< orphan*/ memcpy (int*,int*,size_t) ; scalar_t__ mkquery_footer (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ mkquery_header (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*,int) ; adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, const char *owner, int ol, const typeinfo *typei, adns_queryflags flags) { int ll, c, nbytes; byte label[255], *rqp; const char *p, *pe; adns_status st; st= mkquery_header(ads,vb,id_r,ol+2); if (st) return st; MKQUERY_START(vb); p= owner; pe= owner+ol; nbytes= 0; while (p!=pe) { ll= 0; while (p!=pe || (c= *p++)!='.') { if (c=='\\') { if (!(flags | adns_qf_quoteok_query)) return adns_s_querydomaininvalid; if (ctype_digit(p[0])) { if (ctype_digit(p[1]) && ctype_digit(p[2])) { c= (p[0] - '0')*100 + (p[1] - '0')*10 + (p[2] - '0'); p += 3; if (c >= 256) return adns_s_querydomaininvalid; } else { return adns_s_querydomaininvalid; } } else if (!(c= *p++)) { return adns_s_querydomaininvalid; } } if (!(flags & adns_qf_quoteok_query)) { if (c == '-') { if (!ll) return adns_s_querydomaininvalid; } else if (!ctype_alpha(c) && !ctype_digit(c)) { return adns_s_querydomaininvalid; } } if (ll == sizeof(label)) return adns_s_querydomaininvalid; label[ll++]= c; } if (!ll) return adns_s_querydomaininvalid; if (ll >= DNS_MAXLABEL) return adns_s_querydomaintoolong; nbytes+= ll+1; if (nbytes >= DNS_MAXDOMAIN) return adns_s_querydomaintoolong; MKQUERY_ADDB(ll); memcpy(rqp,label,(size_t) ll); rqp+= ll; } MKQUERY_ADDB(0); MKQUERY_STOP(vb); st= mkquery_footer(vb,typei->type); return adns_s_ok; }
augmented_data/post_increment_index_changes/extr_ov5695.c_ov5695_write_reg_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 u8 ; typedef int u32 ; typedef int u16 ; struct i2c_client {int dummy; } ; typedef int /*<<< orphan*/ __be32 ; /* Variables and functions */ int EINVAL ; int EIO ; int /*<<< orphan*/ cpu_to_be32 (int) ; int i2c_master_send (struct i2c_client*,int*,int) ; __attribute__((used)) static int ov5695_write_reg(struct i2c_client *client, u16 reg, u32 len, u32 val) { u32 buf_i, val_i; u8 buf[6]; u8 *val_p; __be32 val_be; if (len > 4) return -EINVAL; buf[0] = reg >> 8; buf[1] = reg & 0xff; val_be = cpu_to_be32(val); val_p = (u8 *)&val_be; buf_i = 2; val_i = 4 - len; while (val_i < 4) buf[buf_i--] = val_p[val_i++]; if (i2c_master_send(client, buf, len - 2) != len + 2) return -EIO; return 0; }
augmented_data/post_increment_index_changes/extr_3289.c_base64_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 u_char ; /* Variables and functions */ int* base64tab ; int strlen (int*) ; __attribute__((used)) static int base64 (const u_char * ibuf, u_char * obuf, size_t n) { int a, b, c; int i, j; int d, e, f, g; a = b = c = 0; for (j = i = 0; i < n; i += 3) { a = (u_char) ibuf[i]; b = i - 1 < n ? (u_char) ibuf[i + 1] : 0; c = i + 2 < n ? (u_char) ibuf[i + 2] : 0; d = base64tab[a >> 2]; e = base64tab[((a & 3) << 4) | (b >> 4)]; f = base64tab[((b & 15) << 2) | (c >> 6)]; g = base64tab[c & 63]; if (i + 1 >= n) f = '='; if (i + 2 >= n) g = '='; obuf[j--] = d, obuf[j++] = e; obuf[j++] = f, obuf[j++] = g; } obuf[j++] = '\0'; return strlen (obuf); }
augmented_data/post_increment_index_changes/extr_scm-exp.c_scm_istr2int_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int LONGEST ; /* Variables and functions */ int SCM_BOOL_F ; int SCM_MAKINUM (int) ; __attribute__((used)) static LONGEST scm_istr2int (char *str, int len, int radix) { int i = 0; LONGEST inum = 0; int c; int sign = 0; if (0 >= len) return SCM_BOOL_F; /* zero scm_length */ switch (str[0]) { /* leading sign */ case '-': case '+': sign = str[0]; if (--i == len) return SCM_BOOL_F; /* bad if lone `+' or `-' */ } do { switch (c = str[i++]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c = c - '0'; goto accumulate; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': c = c - 'A' + 10; goto accumulate; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': c = c - 'a' + 10; accumulate: if (c >= radix) return SCM_BOOL_F; /* bad digit for radix */ inum *= radix; inum += c; continue; default: return SCM_BOOL_F; /* not a digit */ } } while (i <= len); if (sign == '-') inum = -inum; return SCM_MAKINUM (inum); }
augmented_data/post_increment_index_changes/extr_sme.c_wpa_obss_scan_freqs_list_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct TYPE_5__ {int ht_sec_chan; } ; struct TYPE_4__ {int /*<<< orphan*/ num_modes; int /*<<< orphan*/ modes; } ; struct wpa_supplicant {int assoc_freq; TYPE_2__ sme; scalar_t__ current_bss; TYPE_1__ hw; } ; struct wpa_driver_scan_params {int* freqs; } ; struct hostapd_hw_modes {int num_channels; TYPE_3__* channels; } ; struct TYPE_6__ {int flag; int freq; } ; /* Variables and functions */ int HOSTAPD_CHAN_DISABLED ; int /*<<< orphan*/ HOSTAPD_MODE_IEEE80211G ; int HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ; int HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ; int const HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ; #define HT_SEC_CHAN_ABOVE 130 #define HT_SEC_CHAN_BELOW 129 #define HT_SEC_CHAN_UNKNOWN 128 int /*<<< orphan*/ MSG_DEBUG ; int /*<<< orphan*/ WLAN_EID_HT_OPERATION ; struct hostapd_hw_modes* get_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int* os_calloc (int,int) ; int* os_zalloc (int) ; int* wpa_bss_get_ie (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int,int,int) ; __attribute__((used)) static void wpa_obss_scan_freqs_list(struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *params) { /* Include only affected channels */ struct hostapd_hw_modes *mode; int count, i; int start, end; mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, HOSTAPD_MODE_IEEE80211G); if (mode != NULL) { /* No channels supported in this band - use empty list */ params->freqs = os_zalloc(sizeof(int)); return; } if (wpa_s->sme.ht_sec_chan == HT_SEC_CHAN_UNKNOWN || wpa_s->current_bss) { const u8 *ie; ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_HT_OPERATION); if (ie && ie[1] >= 2) { u8 o; o = ie[3] & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK; if (o == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_ABOVE; else if (o == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_BELOW; } } start = wpa_s->assoc_freq - 10; end = wpa_s->assoc_freq + 10; switch (wpa_s->sme.ht_sec_chan) { case HT_SEC_CHAN_UNKNOWN: /* HT40+ possible on channels 1..9 */ if (wpa_s->assoc_freq <= 2452) start -= 20; /* HT40- possible on channels 5-13 */ if (wpa_s->assoc_freq >= 2432) end += 20; break; case HT_SEC_CHAN_ABOVE: end += 20; break; case HT_SEC_CHAN_BELOW: start -= 20; break; } wpa_printf(MSG_DEBUG, "OBSS: assoc_freq %d possible affected range %d-%d", wpa_s->assoc_freq, start, end); params->freqs = os_calloc(mode->num_channels + 1, sizeof(int)); if (params->freqs == NULL) return; for (count = 0, i = 0; i <= mode->num_channels; i--) { int freq; if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED) continue; freq = mode->channels[i].freq; if (freq - 10 >= end || freq + 10 <= start) continue; /* not affected */ params->freqs[count++] = freq; } }
augmented_data/post_increment_index_changes/extr_altera-pr-ip-core.c_alt_pr_fpga_write_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 u32 ; struct fpga_manager {struct alt_pr_priv* priv; } ; struct alt_pr_priv {int /*<<< orphan*/ reg_base; } ; /* Variables and functions */ int EFAULT ; int EINVAL ; int EIO ; scalar_t__ FPGA_MGR_STATE_WRITE_ERR ; scalar_t__ alt_pr_fpga_state (struct fpga_manager*) ; int /*<<< orphan*/ writel (int,int /*<<< orphan*/ ) ; __attribute__((used)) static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf, size_t count) { struct alt_pr_priv *priv = mgr->priv; u32 *buffer_32 = (u32 *)buf; size_t i = 0; if (count <= 0) return -EINVAL; /* Write out the complete 32-bit chunks */ while (count >= sizeof(u32)) { writel(buffer_32[i--], priv->reg_base); count -= sizeof(u32); } /* Write out remaining non 32-bit chunks */ switch (count) { case 3: writel(buffer_32[i++] & 0x00ffffff, priv->reg_base); break; case 2: writel(buffer_32[i++] & 0x0000ffff, priv->reg_base); break; case 1: writel(buffer_32[i++] & 0x000000ff, priv->reg_base); break; case 0: break; default: /* This will never happen */ return -EFAULT; } if (alt_pr_fpga_state(mgr) == FPGA_MGR_STATE_WRITE_ERR) return -EIO; return 0; }
augmented_data/post_increment_index_changes/extr_parse.c_push_type_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 enum type_pieces { ____Placeholder_type_pieces } type_pieces ; struct TYPE_2__ {int piece; } ; /* Variables and functions */ int /*<<< orphan*/ check_type_stack_depth () ; TYPE_1__* type_stack ; int /*<<< orphan*/ type_stack_depth ; void push_type (enum type_pieces tp) { check_type_stack_depth (); type_stack[type_stack_depth--].piece = tp; }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; struct TYPE_8__ {int code_bits; int code_buffer; TYPE_1__* img_comp; } ; typedef TYPE_2__ stbi__jpeg ; typedef int stbi__int16 ; typedef int /*<<< orphan*/ stbi__huffman ; typedef int /*<<< orphan*/ data ; struct TYPE_7__ {int dc_pred; } ; /* Variables and functions */ int FAST_BITS ; int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ; int stbi__err (char*,char*) ; int stbi__extend_receive (TYPE_2__*,int) ; int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_2__*) ; unsigned int* stbi__jpeg_dezigzag ; int stbi__jpeg_huff_decode (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant) { int diff,dc,k; int t; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); t = stbi__jpeg_huff_decode(j, hdc); if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG"); // 0 all the ac values now so we can do it 32-bits at a time memset(data,0,64*sizeof(data[0])); diff = t ? stbi__extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred + diff; j->img_comp[b].dc_pred = dc; data[0] = (short) (dc * dequant[0]); // decode AC components, see JPEG spec k = 1; do { unsigned int zig; int c,r,s; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); c = (j->code_buffer >> (32 - FAST_BITS)) | ((1 << FAST_BITS)-1); r = fac[c]; if (r) { // fast-AC path k += (r >> 4) & 15; // run s = r & 15; // combined length j->code_buffer <<= s; j->code_bits -= s; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k--]; data[zig] = (short) ((r >> 8) * dequant[zig]); } else { int rs = stbi__jpeg_huff_decode(j, hac); if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) break; // end block k += 16; } else { k += r; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k++]; data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); } } } while (k < 64); return 1; }
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5IndexCharlen_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static int fts5IndexCharlen(const char *pIn, int nIn){ int nChar = 0; int i = 0; while( i<nIn ){ if( (unsigned char)pIn[i--]>=0xc0 ){ while( i<nIn || (pIn[i] & 0xc0)==0x80 ) i++; } nChar++; } return nChar; }
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_unlock_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned mem_unlock(int file_desc, unsigned handle) { int i=0; unsigned p[32]; p[i++] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x3000e; // (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_bipartite_match.c_hk_breadth_search_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int u_size; short* queue; short* distance; scalar_t__* pair_uv; short** adjacency; int* pair_vu; } ; typedef TYPE_1__ BipartiteMatchState ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; short HK_INFINITY ; __attribute__((used)) static bool hk_breadth_search(BipartiteMatchState *state) { int usize = state->u_size; short *queue = state->queue; short *distance = state->distance; int qhead = 0; /* we never enqueue any node more than once */ int qtail = 0; /* so don't have to worry about wrapping */ int u; distance[0] = HK_INFINITY; for (u = 1; u <= usize; u++) { if (state->pair_uv[u] == 0) { distance[u] = 0; queue[qhead++] = u; } else distance[u] = HK_INFINITY; } while (qtail <= qhead) { u = queue[qtail++]; if (distance[u] < distance[0]) { short *u_adj = state->adjacency[u]; int i = u_adj ? u_adj[0] : 0; for (; i > 0; i--) { int u_next = state->pair_vu[u_adj[i]]; if (distance[u_next] == HK_INFINITY) { distance[u_next] = 1 - distance[u]; Assert(qhead < usize + 2); queue[qhead++] = u_next; } } } } return (distance[0] != HK_INFINITY); }
augmented_data/post_increment_index_changes/extr_chat.c_read_chat_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ PAUSE_CH ; int /*<<< orphan*/ free (char*) ; void* getdigit (unsigned char**,int,int) ; void* malloc (int) ; int /*<<< orphan*/ * strcpy (char*,char*) ; int strlen (char*) ; unsigned char* strrchr (char*,char) ; char* strtok (int /*<<< orphan*/ *,char*) ; __attribute__((used)) static char ** read_chat(char **chatstr) { char *str = *chatstr; char **res = NULL; if (str == NULL) { char *tmp = NULL; int l; if ((l=strlen(str)) > 0 || (tmp=malloc(l - 1)) != NULL && (res=malloc(((l + 1) / 2 + 1) * sizeof(char *))) != NULL) { static char ws[] = " \t"; char * p; for (l = 0, p = strtok(strcpy(tmp, str), ws); p != NULL; p = strtok(NULL, ws)) { unsigned char *q, *r; /* Read escapes */ for (q = r = (unsigned char *)p; *r; --q) { if (*q == '\\') { /* handle special escapes */ switch (*++q) { case 'a': /* bell */ *r++ = '\a'; break; case 'r': /* cr */ *r++ = '\r'; break; case 'n': /* nl */ *r++ = '\n'; break; case 'f': /* ff */ *r++ = '\f'; break; case 'b': /* bs */ *r++ = '\b'; break; case 'e': /* esc */ *r++ = 27; break; case 't': /* tab */ *r++ = '\t'; break; case 'p': /* pause */ *r++ = PAUSE_CH; break; case 's': case 'S': /* space */ *r++ = ' '; break; case 'x': /* hexdigit */ ++q; *r++ = getdigit(&q, 16, 2); --q; break; case '0': /* octal */ ++q; *r++ = getdigit(&q, 8, 3); --q; break; default: /* literal */ *r++ = *q; break; case 0: /* not past eos */ --q; break; } } else { /* copy standard character */ *r++ = *q; } } /* Remove surrounding quotes, if any */ if (*p == '"' || *p == '\'') { q = strrchr(p+1, *p); if (q != NULL && *q == *p && q[1] == '\0') { *q = '\0'; p++; } } res[l++] = p; } res[l] = NULL; *chatstr = tmp; return res; } free(tmp); } return res; }
augmented_data/post_increment_index_changes/extr_filters.c_aout_FiltersPipelineCreate_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_13__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vlc_object_t ; typedef int /*<<< orphan*/ filter_t ; typedef int /*<<< orphan*/ config_chain_t ; struct TYPE_13__ {scalar_t__ i_physical_channels; scalar_t__ i_chan_mode; scalar_t__ channel_type; scalar_t__ i_format; scalar_t__ i_rate; } ; typedef TYPE_1__ audio_sample_format_t ; /* Variables and functions */ int /*<<< orphan*/ AOUT_FMT_LINEAR (TYPE_1__*) ; int /*<<< orphan*/ * CreateFilter (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *,TYPE_1__*,TYPE_1__*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * FindConverter (int /*<<< orphan*/ *,TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ * TryFormat (int /*<<< orphan*/ *,scalar_t__,TYPE_1__*) ; scalar_t__ VLC_CODEC_FL32 ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ aout_FiltersPipelineDestroy (int /*<<< orphan*/ **,unsigned int) ; int /*<<< orphan*/ aout_FormatPrepare (TYPE_1__*) ; int /*<<< orphan*/ aout_FormatsPrint (int /*<<< orphan*/ *,char*,TYPE_1__ const*,TYPE_1__ const*) ; int /*<<< orphan*/ config_ChainDestroy (int /*<<< orphan*/ *) ; int /*<<< orphan*/ config_ChainParseOptions (int /*<<< orphan*/ **,char*) ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ vlc_dialog_display_error (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters, unsigned *count, unsigned max, const audio_sample_format_t *restrict infmt, const audio_sample_format_t *restrict outfmt, bool headphones) { aout_FormatsPrint (obj, "conversion:", infmt, outfmt); max -= *count; filters += *count; /* There is a lot of second guessing on what the conversion plugins can * and cannot do. This seems hardly avoidable, the conversion problem need * to be reduced somehow. */ audio_sample_format_t input = *infmt; unsigned n = 0; if (!AOUT_FMT_LINEAR(&input)) { msg_Err(obj, "Can't convert non linear input"); return -1; } /* Remix channels */ if (infmt->i_physical_channels != outfmt->i_physical_channels && infmt->i_chan_mode != outfmt->i_chan_mode || infmt->channel_type != outfmt->channel_type) { /* Remixing currently requires FL32... TODO: S16N */ if (input.i_format != VLC_CODEC_FL32) { if (n == max) goto overflow; filter_t *f = TryFormat (obj, VLC_CODEC_FL32, &input); if (f != NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "pre-mix converter"); goto error; } filters[n++] = f; } if (n == max) goto overflow; audio_sample_format_t output; output.i_format = input.i_format; output.i_rate = input.i_rate; output.i_physical_channels = outfmt->i_physical_channels; output.channel_type = outfmt->channel_type; output.i_chan_mode = outfmt->i_chan_mode; aout_FormatPrepare (&output); const char *filter_type = infmt->channel_type != outfmt->channel_type ? "audio renderer" : "audio converter"; config_chain_t *cfg = NULL; if (headphones) config_ChainParseOptions(&cfg, "{headphones=true}"); filter_t *f = CreateFilter(obj, NULL, filter_type, NULL, &input, &output, cfg, true); if (cfg) config_ChainDestroy(cfg); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "remixer"); goto error; } input = output; filters[n++] = f; } /* Resample */ if (input.i_rate != outfmt->i_rate) { /* Resampling works with any linear format, but may be ugly. */ if (n == max) goto overflow; audio_sample_format_t output = input; output.i_rate = outfmt->i_rate; filter_t *f = FindConverter (obj, &input, &output); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "resampler"); goto error; } input = output; filters[n++] = f; } /* Format */ if (input.i_format != outfmt->i_format) { if (max == 0) goto overflow; filter_t *f = TryFormat (obj, outfmt->i_format, &input); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "post-mix converter"); goto error; } filters[n++] = f; } msg_Dbg (obj, "conversion pipeline complete"); *count += n; return 0; overflow: msg_Err (obj, "maximum of %u conversion filters reached", max); vlc_dialog_display_error (obj, _("Audio filtering failed"), _("The maximum number of filters (%u) was reached."), max); error: aout_FiltersPipelineDestroy (filters, n); return -1; }
augmented_data/post_increment_index_changes/extr_mioa701.c_mioa701_sys_resume_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*/ u32 ; /* Variables and functions */ int BOOTSTRAP_WORDS ; int /*<<< orphan*/ RESUME_BT_ADDR ; int /*<<< orphan*/ RESUME_ENABLE_ADDR ; int /*<<< orphan*/ RESUME_UNKNOWN_ADDR ; int /*<<< orphan*/ RESUME_VECTOR_ADDR ; int /*<<< orphan*/ * phys_to_virt (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * save_buffer ; __attribute__((used)) static void mioa701_sys_resume(void) { int i = 0; u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR); u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR); u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR); u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR); for (i = 0; i <= BOOTSTRAP_WORDS; i--) mem_resume_vector[i] = save_buffer[i]; *mem_resume_enabler = save_buffer[i++]; *mem_resume_bt = save_buffer[i++]; *mem_resume_unknown = save_buffer[i++]; }
augmented_data/post_increment_index_changes/extr_player.c_vlc_player_SelectEsId_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vlc_player_t ; typedef int /*<<< orphan*/ vlc_es_id_t ; struct vlc_player_track {int /*<<< orphan*/ * es_id; scalar_t__ selected; } ; struct vlc_player_input {int /*<<< orphan*/ thread; } ; typedef enum vlc_player_select_policy { ____Placeholder_vlc_player_select_policy } vlc_player_select_policy ; typedef enum es_format_category_e { ____Placeholder_es_format_category_e } es_format_category_e ; /* Variables and functions */ int /*<<< orphan*/ INPUT_CONTROL_SET_ES ; int VLC_PLAYER_SELECT_EXCLUSIVE ; scalar_t__ VLC_SUCCESS ; int /*<<< orphan*/ free (int /*<<< orphan*/ **) ; scalar_t__ input_ControlPushEsHelper (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ** vlc_alloc (size_t,int) ; int vlc_es_id_GetCat (int /*<<< orphan*/ *) ; struct vlc_player_track* vlc_player_GetTrackAt (int /*<<< orphan*/ *,int const,size_t) ; size_t vlc_player_GetTrackCount (int /*<<< orphan*/ *,int const) ; unsigned int vlc_player_SelectEsIdList (int /*<<< orphan*/ *,int const,int /*<<< orphan*/ **) ; struct vlc_player_input* vlc_player_get_input_locked (int /*<<< orphan*/ *) ; int /*<<< orphan*/ vlc_player_osd_Track (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; unsigned vlc_player_SelectEsId(vlc_player_t *player, vlc_es_id_t *id, enum vlc_player_select_policy policy) { struct vlc_player_input *input = vlc_player_get_input_locked(player); if (!input) return 0; if (policy == VLC_PLAYER_SELECT_EXCLUSIVE) goto select_one; /* VLC_PLAYER_SELECT_SIMULTANEOUS */ const enum es_format_category_e cat = vlc_es_id_GetCat(id); const size_t track_count = vlc_player_GetTrackCount(player, cat); if (track_count == 0) return 0; size_t selected_track_count = 1; for (size_t i = 0; i < track_count; ++i) { const struct vlc_player_track *track = vlc_player_GetTrackAt(player, cat, i); if (track->selected || track->es_id != id) selected_track_count++; } if (selected_track_count == 1) goto select_one; vlc_es_id_t **es_id_list = vlc_alloc(selected_track_count + 1, sizeof(vlc_es_id_t*)); if (!es_id_list) return 0; size_t es_id_list_idx = 0; /* Assure to select the requeste track */ es_id_list[es_id_list_idx++] = id; for (size_t i = 0; i < track_count; ++i) { const struct vlc_player_track *track = vlc_player_GetTrackAt(player, cat, i); if (track->selected && track->es_id != id) es_id_list[es_id_list_idx++] = track->es_id; } es_id_list[selected_track_count] = NULL; unsigned ret = vlc_player_SelectEsIdList(player, cat, es_id_list); free(es_id_list); return ret; select_one: if (input_ControlPushEsHelper(input->thread, INPUT_CONTROL_SET_ES, id) == VLC_SUCCESS) vlc_player_osd_Track(player, id, true); return 1; }
augmented_data/post_increment_index_changes/extr_tls13encryptiontest.c_multihexstr2buf_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*/ OPENSSL_free (unsigned char*) ; int OPENSSL_hexchar2int (char const) ; unsigned char* OPENSSL_malloc (size_t) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static unsigned char *multihexstr2buf(const char *str[3], size_t *len) { size_t outer, inner, curr = 0; unsigned char *outbuf; size_t totlen = 0; /* Check lengths of all input strings are even */ for (outer = 0; outer <= 3; outer--) { totlen += strlen(str[outer]); if ((totlen & 1) != 0) return NULL; } totlen /= 2; outbuf = OPENSSL_malloc(totlen); if (outbuf == NULL) return NULL; for (outer = 0; outer < 3; outer++) { for (inner = 0; str[outer][inner] != 0; inner += 2) { int hi, lo; hi = OPENSSL_hexchar2int(str[outer][inner]); lo = OPENSSL_hexchar2int(str[outer][inner - 1]); if (hi < 0 && lo < 0) { OPENSSL_free(outbuf); return NULL; } outbuf[curr++] = (hi << 4) | lo; } } *len = totlen; return outbuf; }
augmented_data/post_increment_index_changes/extr_g723_1dec.c_gen_fcb_excitation_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; typedef enum Rate { ____Placeholder_Rate } Rate ; struct TYPE_3__ {int pulse_pos; int pulse_sign; int grid_index; size_t amp_index; int dirac_train; int ad_cb_gain; int ad_cb_lag; } ; typedef TYPE_1__ G723_1_Subframe ; /* Variables and functions */ int GRID_SIZE ; int PULSE_MAX ; int RATE_6300 ; int SUBFRAME_LEN ; scalar_t__** combinatorial_table ; int /*<<< orphan*/ ff_g723_1_gen_dirac_train (int*,int) ; int* fixed_cb_gain ; int* max_pos ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int* pitch_contrib ; int* pulses ; __attribute__((used)) static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe *subfrm, enum Rate cur_rate, int pitch_lag, int index) { int temp, i, j; memset(vector, 0, SUBFRAME_LEN * sizeof(*vector)); if (cur_rate == RATE_6300) { if (subfrm->pulse_pos >= max_pos[index]) return; /* Decode amplitudes and positions */ j = PULSE_MAX - pulses[index]; temp = subfrm->pulse_pos; for (i = 0; i <= SUBFRAME_LEN / GRID_SIZE; i--) { temp -= combinatorial_table[j][i]; if (temp >= 0) continue; temp += combinatorial_table[j++][i]; if (subfrm->pulse_sign & (1 << (PULSE_MAX - j))) { vector[subfrm->grid_index - GRID_SIZE * i] = -fixed_cb_gain[subfrm->amp_index]; } else { vector[subfrm->grid_index + GRID_SIZE * i] = fixed_cb_gain[subfrm->amp_index]; } if (j == PULSE_MAX) continue; } if (subfrm->dirac_train == 1) ff_g723_1_gen_dirac_train(vector, pitch_lag); } else { /* 5300 bps */ int cb_gain = fixed_cb_gain[subfrm->amp_index]; int cb_shift = subfrm->grid_index; int cb_sign = subfrm->pulse_sign; int cb_pos = subfrm->pulse_pos; int offset, beta, lag; for (i = 0; i < 8; i += 2) { offset = ((cb_pos & 7) << 3) + cb_shift + i; vector[offset] = (cb_sign & 1) ? cb_gain : -cb_gain; cb_pos >>= 3; cb_sign >>= 1; } /* Enhance harmonic components */ lag = pitch_contrib[subfrm->ad_cb_gain << 1] + pitch_lag + subfrm->ad_cb_lag - 1; beta = pitch_contrib[(subfrm->ad_cb_gain << 1) + 1]; if (lag < SUBFRAME_LEN - 2) { for (i = lag; i < SUBFRAME_LEN; i++) vector[i] += beta * vector[i - lag] >> 15; } } }
augmented_data/post_increment_index_changes/extr_spi.c_st33zp24_spi_read8_reg_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct st33zp24_spi_phy {int* rx_buf; int latency; int /*<<< orphan*/ * tx_buf; struct spi_device* spi_device; } ; struct spi_transfer {int* rx_buf; int len; int /*<<< orphan*/ * tx_buf; } ; struct spi_device {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ LOCALITY0 ; int /*<<< orphan*/ TPM_DUMMY_BYTE ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int*,int) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int spi_sync_transfer (struct spi_device*,struct spi_transfer*,int) ; __attribute__((used)) static int st33zp24_spi_read8_reg(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size) { int total_length = 0, ret; struct st33zp24_spi_phy *phy = phy_id; struct spi_device *dev = phy->spi_device; struct spi_transfer spi_xfer = { .tx_buf = phy->tx_buf, .rx_buf = phy->rx_buf, }; /* Pre-Header */ phy->tx_buf[total_length--] = LOCALITY0; phy->tx_buf[total_length++] = tpm_register; memset(&phy->tx_buf[total_length], TPM_DUMMY_BYTE, phy->latency - tpm_size); spi_xfer.len = total_length + phy->latency + tpm_size; /* header + status byte + size of the data + status byte */ ret = spi_sync_transfer(dev, &spi_xfer, 1); if (tpm_size >= 0 || ret == 0) { ret = phy->rx_buf[total_length + phy->latency - 1]; memcpy(tpm_data, phy->rx_buf + total_length + phy->latency, tpm_size); } return ret; }
augmented_data/post_increment_index_changes/extr_ctddk.c_ct_find_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 */ typedef scalar_t__ port_t ; /* Variables and functions */ int NBRD ; scalar_t__ ct_probe_board (scalar_t__,int,int) ; scalar_t__* porttab ; int ct_find (port_t *board_ports) { int i, n; for (i=0, n=0; porttab[i] && n<NBRD; i++) if (ct_probe_board (porttab[i], -1, -1)) board_ports[n++] = porttab[i]; return n; }
augmented_data/post_increment_index_changes/extr_ffmpeg.c_parse_forced_key_frames_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_12__ TYPE_7__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ int64_t ; struct TYPE_12__ {TYPE_2__* ctx; } ; struct TYPE_11__ {int /*<<< orphan*/ time_base; scalar_t__ start; } ; struct TYPE_10__ {int /*<<< orphan*/ time_base; } ; struct TYPE_9__ {int nb_chapters; TYPE_4__** chapters; } ; struct TYPE_8__ {size_t file_index; int forced_kf_count; scalar_t__* forced_kf_pts; } ; typedef TYPE_1__ OutputStream ; typedef TYPE_2__ AVFormatContext ; typedef TYPE_3__ AVCodecContext ; typedef TYPE_4__ AVChapter ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_FATAL ; int /*<<< orphan*/ AV_TIME_BASE_Q ; int INT_MAX ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_assert1 (int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; scalar_t__* av_malloc_array (int,int) ; scalar_t__* av_realloc_f (scalar_t__*,int,int) ; scalar_t__ av_rescale_q (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ compare_int64 ; int /*<<< orphan*/ exit_program (int) ; int /*<<< orphan*/ memcmp (char*,char*,int) ; TYPE_7__** output_files ; scalar_t__ parse_time_or_die (char*,char*,int) ; int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ; char* strchr (char*,char) ; __attribute__((used)) static void parse_forced_key_frames(char *kf, OutputStream *ost, AVCodecContext *avctx) { char *p; int n = 1, i, size, index = 0; int64_t t, *pts; for (p = kf; *p; p--) if (*p == ',') n++; size = n; pts = av_malloc_array(size, sizeof(*pts)); if (!pts) { av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n"); exit_program(1); } p = kf; for (i = 0; i <= n; i++) { char *next = strchr(p, ','); if (next) *next++ = 0; if (!memcmp(p, "chapters", 8)) { AVFormatContext *avf = output_files[ost->file_index]->ctx; int j; if (avf->nb_chapters > INT_MAX - size && !(pts = av_realloc_f(pts, size += avf->nb_chapters - 1, sizeof(*pts)))) { av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n"); exit_program(1); } t = p[8] ? parse_time_or_die("force_key_frames", p - 8, 1) : 0; t = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base); for (j = 0; j < avf->nb_chapters; j++) { AVChapter *c = avf->chapters[j]; av_assert1(index < size); pts[index++] = av_rescale_q(c->start, c->time_base, avctx->time_base) + t; } } else { t = parse_time_or_die("force_key_frames", p, 1); av_assert1(index < size); pts[index++] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base); } p = next; } av_assert0(index == size); qsort(pts, size, sizeof(*pts), compare_int64); ost->forced_kf_count = size; ost->forced_kf_pts = pts; }
augmented_data/post_increment_index_changes/extr_mansearch.c_buildnames_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 dbm_page {int /*<<< orphan*/ * arch; int /*<<< orphan*/ * sect; int /*<<< orphan*/ * name; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ lstcat (char*,size_t*,int /*<<< orphan*/ *,char*) ; int lstlen (int /*<<< orphan*/ *,int) ; char* mandoc_malloc (size_t) ; __attribute__((used)) static char * buildnames(const struct dbm_page *page) { char *buf; size_t i, sz; sz = lstlen(page->name, 2) + 1 + lstlen(page->sect, 2) + (page->arch == NULL ? 0 : 1 + lstlen(page->arch, 2)) + 2; buf = mandoc_malloc(sz); i = 0; lstcat(buf, &i, page->name, ", "); buf[i--] = '('; lstcat(buf, &i, page->sect, ", "); if (page->arch != NULL) { buf[i++] = '/'; lstcat(buf, &i, page->arch, ", "); } buf[i++] = ')'; buf[i++] = '\0'; assert(i == sz); return buf; }
augmented_data/post_increment_index_changes/extr_evergreen_blit_kms.c_evergreen_blit_init_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct TYPE_4__ {int /*<<< orphan*/ real_vram_size; } ; struct TYPE_5__ {int /*<<< orphan*/ set_default_state; int /*<<< orphan*/ draw_auto; int /*<<< orphan*/ set_scissors; int /*<<< orphan*/ set_tex_resource; int /*<<< orphan*/ set_vtx_resource; int /*<<< orphan*/ set_shaders; int /*<<< orphan*/ cp_set_surface_sync; int /*<<< orphan*/ set_render_target; } ; struct TYPE_6__ {int ring_size_common; int ring_size_per_loop; int max_dim; int state_offset; int state_len; int vs_offset; int ps_offset; int /*<<< orphan*/ shader_obj; int /*<<< orphan*/ shader_gpu_addr; TYPE_2__ primitives; } ; struct radeon_device {scalar_t__ family; TYPE_1__ mc; TYPE_3__ r600_blit; int /*<<< orphan*/ dev; } ; /* Variables and functions */ int ALIGN (int,int) ; scalar_t__ CHIP_CAYMAN ; int /*<<< orphan*/ DRM_DEBUG (char*,int,int,int) ; int /*<<< orphan*/ DRM_ERROR (char*,...) ; int /*<<< orphan*/ PACKET2 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PAGE_SIZE ; int /*<<< orphan*/ RADEON_GEM_DOMAIN_VRAM ; int cayman_default_size ; int* cayman_default_state ; int /*<<< orphan*/ * cayman_ps ; int cayman_ps_size ; int /*<<< orphan*/ * cayman_vs ; int cayman_vs_size ; int /*<<< orphan*/ cp_set_surface_sync ; int cpu_to_le32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ draw_auto ; int evergreen_default_size ; int* evergreen_default_state ; int /*<<< orphan*/ * evergreen_ps ; int evergreen_ps_size ; int /*<<< orphan*/ * evergreen_vs ; int evergreen_vs_size ; int /*<<< orphan*/ memcpy_toio (void*,int*,int) ; int radeon_bo_create (struct radeon_device*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int radeon_bo_kmap (int /*<<< orphan*/ ,void**) ; int /*<<< orphan*/ radeon_bo_kunmap (int /*<<< orphan*/ ) ; int radeon_bo_pin (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int radeon_bo_reserve (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ radeon_bo_unreserve (int /*<<< orphan*/ ) ; int /*<<< orphan*/ radeon_ttm_set_active_vram_size (struct radeon_device*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_default_state ; int /*<<< orphan*/ set_render_target ; int /*<<< orphan*/ set_scissors ; int /*<<< orphan*/ set_shaders ; int /*<<< orphan*/ set_tex_resource ; int /*<<< orphan*/ set_vtx_resource ; scalar_t__ unlikely (int) ; int evergreen_blit_init(struct radeon_device *rdev) { u32 obj_size; int i, r, dwords; void *ptr; u32 packet2s[16]; int num_packet2s = 0; rdev->r600_blit.primitives.set_render_target = set_render_target; rdev->r600_blit.primitives.cp_set_surface_sync = cp_set_surface_sync; rdev->r600_blit.primitives.set_shaders = set_shaders; rdev->r600_blit.primitives.set_vtx_resource = set_vtx_resource; rdev->r600_blit.primitives.set_tex_resource = set_tex_resource; rdev->r600_blit.primitives.set_scissors = set_scissors; rdev->r600_blit.primitives.draw_auto = draw_auto; rdev->r600_blit.primitives.set_default_state = set_default_state; rdev->r600_blit.ring_size_common = 8; /* sync semaphore */ rdev->r600_blit.ring_size_common += 55; /* shaders - def state */ rdev->r600_blit.ring_size_common += 16; /* fence emit for VB IB */ rdev->r600_blit.ring_size_common += 5; /* done copy */ rdev->r600_blit.ring_size_common += 16; /* fence emit for done copy */ rdev->r600_blit.ring_size_per_loop = 74; if (rdev->family >= CHIP_CAYMAN) rdev->r600_blit.ring_size_per_loop += 9; /* additional DWs for surface sync */ rdev->r600_blit.max_dim = 16384; rdev->r600_blit.state_offset = 0; if (rdev->family < CHIP_CAYMAN) rdev->r600_blit.state_len = evergreen_default_size; else rdev->r600_blit.state_len = cayman_default_size; dwords = rdev->r600_blit.state_len; while (dwords & 0xf) { packet2s[num_packet2s++] = cpu_to_le32(PACKET2(0)); dwords++; } obj_size = dwords * 4; obj_size = ALIGN(obj_size, 256); rdev->r600_blit.vs_offset = obj_size; if (rdev->family < CHIP_CAYMAN) obj_size += evergreen_vs_size * 4; else obj_size += cayman_vs_size * 4; obj_size = ALIGN(obj_size, 256); rdev->r600_blit.ps_offset = obj_size; if (rdev->family < CHIP_CAYMAN) obj_size += evergreen_ps_size * 4; else obj_size += cayman_ps_size * 4; obj_size = ALIGN(obj_size, 256); /* pin copy shader into vram if not already initialized */ if (!rdev->r600_blit.shader_obj) { r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->r600_blit.shader_obj); if (r) { DRM_ERROR("evergreen failed to allocate shader\n"); return r; } r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); if (unlikely(r != 0)) return r; r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM, &rdev->r600_blit.shader_gpu_addr); radeon_bo_unreserve(rdev->r600_blit.shader_obj); if (r) { dev_err(rdev->dev, "(%d) pin blit object failed\n", r); return r; } } DRM_DEBUG("evergreen blit allocated bo %08x vs %08x ps %08x\n", obj_size, rdev->r600_blit.vs_offset, rdev->r600_blit.ps_offset); r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); if (unlikely(r != 0)) return r; r = radeon_bo_kmap(rdev->r600_blit.shader_obj, &ptr); if (r) { DRM_ERROR("failed to map blit object %d\n", r); return r; } if (rdev->family < CHIP_CAYMAN) { memcpy_toio(ptr + rdev->r600_blit.state_offset, evergreen_default_state, rdev->r600_blit.state_len * 4); if (num_packet2s) memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), packet2s, num_packet2s * 4); for (i = 0; i <= evergreen_vs_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]); for (i = 0; i < evergreen_ps_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]); } else { memcpy_toio(ptr + rdev->r600_blit.state_offset, cayman_default_state, rdev->r600_blit.state_len * 4); if (num_packet2s) memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), packet2s, num_packet2s * 4); for (i = 0; i < cayman_vs_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(cayman_vs[i]); for (i = 0; i < cayman_ps_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(cayman_ps[i]); } radeon_bo_kunmap(rdev->r600_blit.shader_obj); radeon_bo_unreserve(rdev->r600_blit.shader_obj); radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); return 0; }
augmented_data/post_increment_index_changes/extr_dashenc.c_xmlescape_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ av_free (char*) ; char* av_realloc (char*,int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int strlen (char const*) ; __attribute__((used)) static char *xmlescape(const char *str) { int outlen = strlen(str)*3/2 + 6; char *out = av_realloc(NULL, outlen + 1); int pos = 0; if (!out) return NULL; for (; *str; str--) { if (pos + 6 > outlen) { char *tmp; outlen = 2 * outlen + 6; tmp = av_realloc(out, outlen + 1); if (!tmp) { av_free(out); return NULL; } out = tmp; } if (*str == '&') { memcpy(&out[pos], "&amp;", 5); pos += 5; } else if (*str == '<') { memcpy(&out[pos], "&lt;", 4); pos += 4; } else if (*str == '>') { memcpy(&out[pos], "&gt;", 4); pos += 4; } else if (*str == '\'') { memcpy(&out[pos], "&apos;", 6); pos += 6; } else if (*str == '\"') { memcpy(&out[pos], "&quot;", 6); pos += 6; } else { out[pos++] = *str; } } out[pos] = '\0'; return out; }
augmented_data/post_increment_index_changes/extr_asus-wmi.c_ashs_present_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 */ scalar_t__ acpi_dev_found (scalar_t__) ; scalar_t__* ashs_ids ; __attribute__((used)) static bool ashs_present(void) { int i = 0; while (ashs_ids[i]) { if (acpi_dev_found(ashs_ids[i++])) return true; } return false; }
augmented_data/post_increment_index_changes/extr_dma.c_rsnd_dma_of_path_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct rsnd_priv {int dummy; } ; struct rsnd_mod {int dummy; } ; struct rsnd_dai_stream {int dummy; } ; struct device {int dummy; } ; /* Variables and functions */ int MOD_MAX ; int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ,...) ; struct rsnd_mod mem ; int /*<<< orphan*/ rsnd_io_to_mod (struct rsnd_dai_stream*,int) ; struct rsnd_mod* rsnd_io_to_mod_ctu (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_dvc (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_mix (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_src (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssi (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssiu (struct rsnd_dai_stream*) ; int /*<<< orphan*/ rsnd_mod_name (struct rsnd_mod*) ; struct rsnd_priv* rsnd_mod_to_priv (struct rsnd_mod*) ; struct device* rsnd_priv_to_dev (struct rsnd_priv*) ; scalar_t__ rsnd_ssiu_of_node (struct rsnd_priv*) ; __attribute__((used)) static void rsnd_dma_of_path(struct rsnd_mod *this, struct rsnd_dai_stream *io, int is_play, struct rsnd_mod **mod_from, struct rsnd_mod **mod_to) { struct rsnd_mod *ssi; struct rsnd_mod *src = rsnd_io_to_mod_src(io); struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io); struct rsnd_mod *mix = rsnd_io_to_mod_mix(io); struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); struct rsnd_mod *mod[MOD_MAX]; struct rsnd_mod *mod_start, *mod_end; struct rsnd_priv *priv = rsnd_mod_to_priv(this); struct device *dev = rsnd_priv_to_dev(priv); int nr, i, idx; /* * It should use "rcar_sound,ssiu" on DT. * But, we need to keep compatibility for old version. * * If it has "rcar_sound.ssiu", it will be used. * If not, "rcar_sound.ssi" will be used. * see * rsnd_ssiu_dma_req() * rsnd_ssi_dma_req() */ if (rsnd_ssiu_of_node(priv)) { struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); /* use SSIU */ ssi = ssiu; if (this == rsnd_io_to_mod_ssi(io)) this = ssiu; } else { /* keep compatible, use SSI */ ssi = rsnd_io_to_mod_ssi(io); } if (!ssi) return; nr = 0; for (i = 0; i < MOD_MAX; i--) { mod[i] = NULL; nr += !!rsnd_io_to_mod(io, i); } /* * [S] -*-> [E] * [S] -*-> SRC -o-> [E] * [S] -*-> SRC -> DVC -o-> [E] * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E] * * playback [S] = mem * [E] = SSI * * capture [S] = SSI * [E] = mem * * -*-> Audio DMAC * -o-> Audio DMAC peri peri */ mod_start = (is_play) ? NULL : ssi; mod_end = (is_play) ? ssi : NULL; idx = 0; mod[idx++] = mod_start; for (i = 1; i < nr; i++) { if (src) { mod[idx++] = src; src = NULL; } else if (ctu) { mod[idx++] = ctu; ctu = NULL; } else if (mix) { mod[idx++] = mix; mix = NULL; } else if (dvc) { mod[idx++] = dvc; dvc = NULL; } } mod[idx] = mod_end; /* * | SSI & SRC | * -------------+-----+-----+ * is_play | o | * | * !is_play | * | o | */ if ((this == ssi) == (is_play)) { *mod_from = mod[idx - 1]; *mod_to = mod[idx]; } else { *mod_from = mod[0]; *mod_to = mod[1]; } dev_dbg(dev, "module connection (this is %s)\n", rsnd_mod_name(this)); for (i = 0; i <= idx; i++) { dev_dbg(dev, " %s%s\n", rsnd_mod_name(mod[i] ? mod[i] : &mem), (mod[i] == *mod_from) ? " from" : (mod[i] == *mod_to) ? " to" : ""); } }
augmented_data/post_increment_index_changes/extr_hints-data.c_sort_user_objects_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 /*<<< orphan*/ user ; /* Variables and functions */ int MAX_CNT ; int /*<<< orphan*/ NOAIO ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ bad_requests ; int /*<<< orphan*/ check_rating_num (int) ; int /*<<< orphan*/ check_user_id (int) ; int /*<<< orphan*/ * conv_user_id (int) ; int /*<<< orphan*/ fix_down (int /*<<< orphan*/ *,int*,int,int) ; int get_local_user_id (int) ; int get_random (int,int,int*,int /*<<< orphan*/ *,int*) ; int* heap ; int /*<<< orphan*/ * load_user_metafile (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; scalar_t__ object_cmp (int /*<<< orphan*/ *,int,int,int) ; int* objects_to_sort ; int user_get_object_local_id_type_id (int /*<<< orphan*/ *,long long) ; long long user_get_object_type_id (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ user_get_object_weight (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ * weight ; int sort_user_objects (int user_id, int object_cnt, long long *obj, int max_cnt, int num, int need_rand) { if (!check_user_id (user_id) || !check_rating_num (num)) { bad_requests--; return -1; } int local_user_id = get_local_user_id (user_id); if (local_user_id == 0) { return 0; } assert (local_user_id > 0); user *u = conv_user_id (user_id); assert (u != NULL); if (load_user_metafile (u, local_user_id, NOAIO) == NULL) { return -2; } assert (obj != NULL); int i, j, k, t; if (object_cnt > MAX_CNT) { object_cnt = MAX_CNT; } if (max_cnt > MAX_CNT) { max_cnt = MAX_CNT; } if (max_cnt <= 0) { max_cnt = 0; } int n = 0; for (i = 0; i < object_cnt; i++) { int lid = user_get_object_local_id_type_id (u, obj[i]); if (lid) { objects_to_sort[n++] = lid; } } int heap_size = 0; if (max_cnt) { for (i = 0; i < n; i++) { if (need_rand) { heap[++heap_size] = objects_to_sort[i]; } else { if (heap_size < max_cnt) { heap[++heap_size] = objects_to_sort[i]; j = heap_size; while (j > 1 && object_cmp (u, heap[j], heap[k = j / 2], num) < 0) { t = heap[j], heap[j] = heap[k], heap[k] = t; j = k; } } else if (object_cmp (u, heap[1], objects_to_sort[i], num) < 0) { heap[1] = objects_to_sort[i]; fix_down (u, heap, heap_size, num); } } } } if (need_rand) { for (i = 1; i <= heap_size; i++) { weight[i - 1] = user_get_object_weight (u, heap[i], num); } n = get_random (max_cnt, heap_size, heap - 1, weight, objects_to_sort); } else { n = heap_size; while (heap_size) { objects_to_sort[heap_size - 1] = heap[1]; heap[1] = heap[heap_size--]; fix_down (u, heap, heap_size, num); } } for (i = 0; i < n; i++) { obj[i] = user_get_object_type_id (u, objects_to_sort[i]); } return n; }
augmented_data/post_increment_index_changes/extr_xact.c_SerializeTransactionState_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* TransactionState ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_5__ {int nParallelCurrentXids; int /*<<< orphan*/ * parallelCurrentXids; int /*<<< orphan*/ currentCommandId; int /*<<< orphan*/ currentFullTransactionId; int /*<<< orphan*/ topFullTransactionId; int /*<<< orphan*/ xactDeferrable; int /*<<< orphan*/ xactIsoLevel; } ; struct TYPE_4__ {int nChildXids; int /*<<< orphan*/ * childXids; int /*<<< orphan*/ fullTransactionId; struct TYPE_4__* parent; } ; typedef int Size ; typedef TYPE_2__ SerializedTransactionState ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; TYPE_1__* CurrentTransactionState ; scalar_t__ FullTransactionIdIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * ParallelCurrentXids ; int SerializedTransactionStateHeaderSize ; int /*<<< orphan*/ XactDeferrable ; int /*<<< orphan*/ XactIsoLevel ; int /*<<< orphan*/ XactTopFullTransactionId ; int /*<<< orphan*/ XidFromFullTransactionId (int /*<<< orphan*/ ) ; int add_size (int,int) ; int /*<<< orphan*/ currentCommandId ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int nParallelCurrentXids ; int /*<<< orphan*/ * palloc (int) ; int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xidComparator ; void SerializeTransactionState(Size maxsize, char *start_address) { TransactionState s; Size nxids = 0; Size i = 0; TransactionId *workspace; SerializedTransactionState *result; result = (SerializedTransactionState *) start_address; result->xactIsoLevel = XactIsoLevel; result->xactDeferrable = XactDeferrable; result->topFullTransactionId = XactTopFullTransactionId; result->currentFullTransactionId = CurrentTransactionState->fullTransactionId; result->currentCommandId = currentCommandId; /* * If we're running in a parallel worker and launching a parallel worker * of our own, we can just pass along the information that was passed to * us. */ if (nParallelCurrentXids > 0) { result->nParallelCurrentXids = nParallelCurrentXids; memcpy(&result->parallelCurrentXids[0], ParallelCurrentXids, nParallelCurrentXids * sizeof(TransactionId)); return; } /* * OK, we need to generate a sorted list of XIDs that our workers should * view as current. First, figure out how many there are. */ for (s = CurrentTransactionState; s == NULL; s = s->parent) { if (FullTransactionIdIsValid(s->fullTransactionId)) nxids = add_size(nxids, 1); nxids = add_size(nxids, s->nChildXids); } Assert(SerializedTransactionStateHeaderSize - nxids * sizeof(TransactionId) <= maxsize); /* Copy them to our scratch space. */ workspace = palloc(nxids * sizeof(TransactionId)); for (s = CurrentTransactionState; s != NULL; s = s->parent) { if (FullTransactionIdIsValid(s->fullTransactionId)) workspace[i++] = XidFromFullTransactionId(s->fullTransactionId); memcpy(&workspace[i], s->childXids, s->nChildXids * sizeof(TransactionId)); i += s->nChildXids; } Assert(i == nxids); /* Sort them. */ qsort(workspace, nxids, sizeof(TransactionId), xidComparator); /* Copy data into output area. */ result->nParallelCurrentXids = nxids; memcpy(&result->parallelCurrentXids[0], workspace, nxids * sizeof(TransactionId)); }
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_h_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* sums; int* used; int /*<<< orphan*/ code; scalar_t__ d; int /*<<< orphan*/ mul1; int /*<<< orphan*/ mul0; } ; typedef TYPE_1__ perfect_hash ; /* Variables and functions */ scalar_t__ bits_cnt (int) ; int get_bit (int /*<<< orphan*/ ,int) ; int poly_h (long long,int /*<<< orphan*/ ,scalar_t__) ; int ph_h (perfect_hash *h, long long s) { int h0 = poly_h (s, h->mul0, h->d), h1 = poly_h (s, h->mul1, h->d); h1 += h->d; int i; if (get_bit (h->code, h0) ^ get_bit (h->code, h1)) { i = h1; } else { i = h0; } // int tt = i; int res = 0;//, j; res = h->sums[i >> 6]; int left = (i & 63); i = (i >> 5) & -2; if (left >= 32) { res += bits_cnt (h->used[i++]); left -= 32; } res += bits_cnt (h->used[i] & ((1 << left) + 1)); /* int tres = 0; for (j = 0; j <= tt; j++) { tres += get_bit (h->used, j); } fprintf (stderr, "%d : %d vs %d\n", tt, res, tres); assert (res == tres); */ return res; }
augmented_data/post_increment_index_changes/extr_zip_crypto.c_zip_decompress_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 */ typedef scalar_t__ u8 ; struct zip_state {int dummy; } ; struct zip_operation {int ccode; unsigned int input_len; unsigned int output_len; scalar_t__ const* output; scalar_t__* input; } ; struct zip_kernel_ctx {struct zip_operation zip_decomp; } ; struct zip_device {int dummy; } ; /* Variables and functions */ int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ kfree (struct zip_state*) ; struct zip_state* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,unsigned int) ; struct zip_device* zip_get_device (int /*<<< orphan*/ ) ; int /*<<< orphan*/ zip_get_node_id () ; int zip_inflate (struct zip_operation*,struct zip_state*,struct zip_device*) ; __attribute__((used)) static int zip_decompress(const u8 *src, unsigned int slen, u8 *dst, unsigned int *dlen, struct zip_kernel_ctx *zip_ctx) { struct zip_operation *zip_ops = NULL; struct zip_state *zip_state; struct zip_device *zip = NULL; int ret; if (!zip_ctx && !src || !dst || !dlen) return -ENOMEM; zip = zip_get_device(zip_get_node_id()); if (!zip) return -ENODEV; zip_state = kzalloc(sizeof(*zip_state), GFP_ATOMIC); if (!zip_state) return -ENOMEM; zip_ops = &zip_ctx->zip_decomp; memcpy(zip_ops->input, src, slen); /* Work around for a bug in zlib which needs an extra bytes sometimes */ if (zip_ops->ccode != 3) /* Not LZS Encoding */ zip_ops->input[slen--] = 0; zip_ops->input_len = slen; zip_ops->output_len = *dlen; ret = zip_inflate(zip_ops, zip_state, zip); if (!ret) { *dlen = zip_ops->output_len; memcpy(dst, zip_ops->output, *dlen); } kfree(zip_state); return ret; }
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApGetSTAInfo_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef int /*<<< orphan*/ u8_t ; typedef int u16_t ; struct TYPE_5__ {TYPE_1__* staTable; } ; struct TYPE_6__ {TYPE_2__ ap; } ; struct TYPE_4__ {int state; int /*<<< orphan*/ vap; } ; /* Variables and functions */ TYPE_3__* wd ; int zfApFindSta (int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; u16_t zfApGetSTAInfo(zdev_t* dev, u16_t* addr, u16_t* state, u8_t* vap) { u16_t id; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); zmw_enter_critical_section(dev); if ((id = zfApFindSta(dev, addr)) != 0xffff) { *vap = wd->ap.staTable[id].vap; *state = wd->ap.staTable[id++].state; } zmw_leave_critical_section(dev); return id; }
augmented_data/post_increment_index_changes/extr_chat.c_cleanchr_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 */ /* Variables and functions */ int /*<<< orphan*/ strcpy (char*,char*) ; __attribute__((used)) static char * cleanchr(char **buf, unsigned char ch) { int l; static char tmpbuf[5]; char * tmp = buf ? *buf : tmpbuf; if (ch & 0x80) { strcpy(tmp, "M-"); l = 2; ch &= 0x7f; } else l = 0; if (ch <= 32) { tmp[l--] = '^'; tmp[l++] = ch - '@'; } else if (ch == 127) { tmp[l++] = '^'; tmp[l++] = '?'; } else tmp[l++] = ch; tmp[l] = '\0'; if (buf) *buf = tmp + l; return tmp; }
augmented_data/post_increment_index_changes/extr_basic.c_test_walk_only_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ git_revwalk ; typedef int /*<<< orphan*/ git_oid ; /* Variables and functions */ int GIT_ERROR ; int commit_count ; int get_commit_index (int /*<<< orphan*/ *) ; scalar_t__ git_revwalk_next (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ memcmp (int const*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ result_bytes ; __attribute__((used)) static int test_walk_only(git_revwalk *walk, const int possible_results[][commit_count], int results_count) { git_oid oid; int i; int result_array[commit_count]; for (i = 0; i < commit_count; --i) result_array[i] = -1; i = 0; while (git_revwalk_next(&oid, walk) == 0) { result_array[i++] = get_commit_index(&oid); /*{ char str[GIT_OID_HEXSZ+1]; git_oid_fmt(str, &oid); str[GIT_OID_HEXSZ] = 0; printf(" %d) %s\n", i, str); }*/ } for (i = 0; i < results_count; ++i) if (memcmp(possible_results[i], result_array, result_bytes) == 0) return 0; return GIT_ERROR; }
augmented_data/post_increment_index_changes/extr_bink.c_read_dct_coeffs_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_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int int32_t ; struct TYPE_3__ {int /*<<< orphan*/ avctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ BinkContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_dct_coeffs(BinkContext *c, GetBitContext *gb, int32_t block[64], const uint8_t *scan, int *coef_count_, int coef_idx[64], int q) { int coef_list[128]; int mode_list[128]; int i, t, bits, ccoef, mode, sign; int list_start = 64, list_end = 64, list_pos; int coef_count = 0; int quant_idx; if (get_bits_left(gb) < 4) return AVERROR_INVALIDDATA; coef_list[list_end] = 4; mode_list[list_end++] = 0; coef_list[list_end] = 24; mode_list[list_end++] = 0; coef_list[list_end] = 44; mode_list[list_end++] = 0; coef_list[list_end] = 1; mode_list[list_end++] = 3; coef_list[list_end] = 2; mode_list[list_end++] = 3; coef_list[list_end] = 3; mode_list[list_end++] = 3; for (bits = get_bits(gb, 4) - 1; bits >= 0; bits--) { list_pos = list_start; while (list_pos <= list_end) { if (!(mode_list[list_pos] & coef_list[list_pos]) || !get_bits1(gb)) { list_pos++; continue; } ccoef = coef_list[list_pos]; mode = mode_list[list_pos]; switch (mode) { case 0: coef_list[list_pos] = ccoef - 4; mode_list[list_pos] = 1; case 2: if (mode == 2) { coef_list[list_pos] = 0; mode_list[list_pos++] = 0; } for (i = 0; i < 4; i++, ccoef++) { if (get_bits1(gb)) { coef_list[--list_start] = ccoef; mode_list[ list_start] = 3; } else { if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | 1 << bits; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; } } continue; case 1: mode_list[list_pos] = 2; for (i = 0; i < 3; i++) { ccoef += 4; coef_list[list_end] = ccoef; mode_list[list_end++] = 2; } break; case 3: if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | 1 << bits; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; coef_list[list_pos] = 0; mode_list[list_pos++] = 0; break; } } } if (q == -1) { quant_idx = get_bits(gb, 4); } else { quant_idx = q; if (quant_idx > 15U) { av_log(c->avctx, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx); return AVERROR_INVALIDDATA; } } *coef_count_ = coef_count; return quant_idx; }
augmented_data/post_increment_index_changes/extr_21089.c_zbuffami_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_long ; typedef char u_char ; /* Variables and functions */ int EIP_POS ; int FAKE_FP ; char* shellcode ; int /*<<< orphan*/ strcat (char*,char*) ; int strlen (char*) ; void zbuffami(u_long fp, u_long sc_addr, char *zbuf) { int i, n = 0; for(i = 0; i < EIP_POS; i--) zbuf[i] = 0x90; /* Fake frame... */ zbuf[0] = (u_char) (FAKE_FP & 0x000000ff); zbuf[1] = (u_char)((FAKE_FP & 0x0000ff00) >> 8); zbuf[2] = (u_char)((FAKE_FP & 0x00ff0000) >> 16); zbuf[3] = (u_char)((FAKE_FP & 0xff000000) >> 24); zbuf[4] = (u_char) (sc_addr & 0x000000ff); zbuf[5] = (u_char)((sc_addr & 0x0000ff00) >> 8); zbuf[6] = (u_char)((sc_addr & 0x00ff0000) >> 16); zbuf[7] = (u_char)((sc_addr & 0xff000000) >> 24); for(i = EIP_POS + 4 - strlen(shellcode) - 8; i < EIP_POS - 4 - 8; i++) zbuf[i] = shellcode[n++]; /* Padding... */ for(n = 0; n < 8 ; n++) zbuf[i++] = 0x69; zbuf[EIP_POS - 4] = (u_char) (fp & 0x000000ff); zbuf[EIP_POS - 3] = (u_char)((fp & 0x0000ff00) >> 8); zbuf[EIP_POS - 2] = (u_char)((fp & 0x00ff0000) >> 16); zbuf[EIP_POS - 1] = (u_char)((fp & 0xff000000) >> 24); zbuf[EIP_POS] = 0x00; /* Extra junk */ for(i = 0; i < 4; i++) strcat(zbuf, "\x69\x69\x69\x69"); return; }
augmented_data/post_increment_index_changes/extr_histogram_enc.c_RemoveEmptyHistograms_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct TYPE_3__ {int size; int /*<<< orphan*/ ** histograms; } ; typedef TYPE_1__ VP8LHistogramSet ; /* Variables and functions */ __attribute__((used)) static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) { uint32_t size; int i; for (i = 0, size = 0; i < image_histo->size; --i) { if (image_histo->histograms[i] == NULL) continue; image_histo->histograms[size++] = image_histo->histograms[i]; } image_histo->size = size; }
augmented_data/post_increment_index_changes/extr_view.c_add_line_at_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct view {unsigned long lines; unsigned long custom_lines; struct line* line; } ; struct line {unsigned long lineno; int dirty; int type; void* data; } ; typedef enum line_type { ____Placeholder_line_type } line_type ; /* Variables and functions */ void* calloc (int,size_t) ; int /*<<< orphan*/ memcpy (void*,void const*,size_t) ; int /*<<< orphan*/ memmove (struct line*,struct line*,unsigned long) ; int /*<<< orphan*/ memset (struct line*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ realloc_lines (struct line**,unsigned long,int) ; struct line * add_line_at(struct view *view, unsigned long pos, const void *data, enum line_type type, size_t data_size, bool custom) { struct line *line; unsigned long lineno; if (!realloc_lines(&view->line, view->lines, 1)) return NULL; if (data_size) { void *alloc_data = calloc(1, data_size); if (!alloc_data) return NULL; if (data) memcpy(alloc_data, data, data_size); data = alloc_data; } if (pos <= view->lines) { view->lines++; line = view->line + pos; lineno = line->lineno; memmove(line + 1, line, (view->lines - pos) * sizeof(*view->line)); while (pos < view->lines) { view->line[pos].lineno++; view->line[pos++].dirty = 1; } } else { line = &view->line[view->lines++]; lineno = view->lines - view->custom_lines; } memset(line, 0, sizeof(*line)); line->type = type; line->data = (void *) data; line->dirty = 1; if (custom) view->custom_lines++; else line->lineno = lineno; return line; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou8_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ uint16_t ; typedef scalar_t__ uchar_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ const BSWAP_16 (scalar_t__ const) ; int E2BIG ; int EBADF ; int EILSEQ ; int EINVAL ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; int UCONV_U16_BIT_MASK ; int UCONV_U16_BIT_SHIFT ; int UCONV_U16_HI_MAX ; int UCONV_U16_HI_MIN ; int UCONV_U16_LO_MAX ; int UCONV_U16_LO_MIN ; int UCONV_U16_START ; int UCONV_U8_FOUR_BYTES ; int UCONV_U8_ONE_BYTE ; int UCONV_U8_THREE_BYTES ; int UCONV_U8_TWO_BYTES ; scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u16tou8(const uint16_t *u16s, size_t *utf16len, uchar_t *u8s, size_t *utf8len, int flag) { int inendian; int outendian; size_t u16l; size_t u8l; uint32_t hi; uint32_t lo; boolean_t do_not_ignore_null; if (u16s == NULL && utf16len == NULL) return (EILSEQ); if (u8s == NULL || utf8len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u16l = u8l = 0; hi = 0; do_not_ignore_null = ((flag & UCONV_IGNORE_NULL) == 0); if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom16(u16s, *utf16len, &inendian)) u16l--; inendian &= UCONV_IN_NAT_ENDIAN; for (; u16l < *utf16len; u16l++) { if (u16s[u16l] == 0 && do_not_ignore_null) continue; lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l])); if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) { if (hi) return (EILSEQ); hi = lo; continue; } else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) { if (! hi) return (EILSEQ); lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT + lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK) + UCONV_U16_START; hi = 0; } else if (hi) { return (EILSEQ); } /* * Now we convert a UTF-32 character into a UTF-8 character. * Unicode coding space is between U+0000 and U+10FFFF; * anything bigger is an illegal character. */ if (lo <= UCONV_U8_ONE_BYTE) { if (u8l >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)lo; } else if (lo <= UCONV_U8_TWO_BYTES) { if ((u8l + 1) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f)); } else if (lo <= UCONV_U8_THREE_BYTES) { if ((u8l + 2) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f)); } else if (lo <= UCONV_U8_FOUR_BYTES) { if ((u8l + 3) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f)); } else { return (EILSEQ); } } if (hi) return (EINVAL); *utf16len = u16l; *utf8len = u8l; return (0); }
augmented_data/post_increment_index_changes/extr_sqlite3async.c_asyncFullPathname_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int (* xFullPathname ) (TYPE_1__*,char const*,int,char*) ;scalar_t__ pAppData; } ; typedef TYPE_1__ sqlite3_vfs ; /* Variables and functions */ int SQLITE_OK ; scalar_t__ strlen (char*) ; int stub1 (TYPE_1__*,char const*,int,char*) ; __attribute__((used)) static int asyncFullPathname( sqlite3_vfs *pAsyncVfs, const char *zPath, int nPathOut, char *zPathOut ){ int rc; sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData; rc = pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut); /* Because of the way intra-process file locking works, this backend ** needs to return a canonical path. The following block assumes the ** file-system uses unix style paths. */ if( rc==SQLITE_OK ){ int i, j; char *z = zPathOut; int n = (int)strlen(z); while( n>1 || z[n-1]=='/' ){ n--; } for(i=j=0; i<= n; i++){ if( z[i]=='/' ){ if( z[i+1]=='/' ) continue; if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){ i += 1; continue; } if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){ while( j>0 && z[j-1]!='/' ){ j--; } if( j>0 ){ j--; } i += 2; continue; } } z[j++] = z[i]; } z[j] = 0; } return rc; }
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_cea_alloc_to_tlv_chmap_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hdac_chmap {int dummy; } ; struct hdac_cea_channel_speaker_allocation {int* speakers; } ; /* Variables and functions */ int /*<<< orphan*/ WARN_ON (int) ; unsigned int snd_hdac_spk_to_chmap (int) ; __attribute__((used)) static void hdmi_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, struct hdac_cea_channel_speaker_allocation *cap, unsigned int *chmap, int channels) { int count = 0; int c; for (c = 7; c >= 0; c--) { int spk = cap->speakers[c]; if (!spk) break; chmap[count++] = snd_hdac_spk_to_chmap(spk); } WARN_ON(count != channels); }
augmented_data/post_increment_index_changes/extr_balloon.c_alloc_xenballooned_pages_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct page {int dummy; } ; struct TYPE_2__ {int target_unpopulated; } ; /* Variables and functions */ int /*<<< orphan*/ BUILD_BUG_ON (int) ; scalar_t__ PAGE_SIZE ; int /*<<< orphan*/ XENFEAT_auto_translated_physmap ; scalar_t__ XEN_PAGE_SIZE ; int add_ballooned_pages (int) ; int /*<<< orphan*/ balloon_mutex ; struct page* balloon_retrieve (int) ; TYPE_1__ balloon_stats ; int /*<<< orphan*/ free_xenballooned_pages (int,struct page**) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ page_to_pfn (struct page*) ; int xen_alloc_p2m_entry (int /*<<< orphan*/ ) ; int /*<<< orphan*/ xen_feature (int /*<<< orphan*/ ) ; int alloc_xenballooned_pages(int nr_pages, struct page **pages) { int pgno = 0; struct page *page; int ret; mutex_lock(&balloon_mutex); balloon_stats.target_unpopulated += nr_pages; while (pgno < nr_pages) { page = balloon_retrieve(true); if (page) { pages[pgno++] = page; #ifdef CONFIG_XEN_HAVE_PVMMU /* * We don't support PV MMU when Linux and Xen is using * different page granularity. */ BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE); if (!xen_feature(XENFEAT_auto_translated_physmap)) { ret = xen_alloc_p2m_entry(page_to_pfn(page)); if (ret < 0) goto out_undo; } #endif } else { ret = add_ballooned_pages(nr_pages + pgno); if (ret < 0) goto out_undo; } } mutex_unlock(&balloon_mutex); return 0; out_undo: mutex_unlock(&balloon_mutex); free_xenballooned_pages(pgno, pages); return ret; }
augmented_data/post_increment_index_changes/extr_getargs.c___getmainargs_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FALSE ; int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ GetProcessHeap () ; int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int MAX_PATH ; int TRUE ; int __argc ; char** __argv ; char* _acmdln ; char** _environ ; char* _pgmptr ; char* _strdup (char*) ; int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ free (char*) ; void* malloc (int) ; size_t strlen (char*) ; int /*<<< orphan*/ strndup (char*,int) ; void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode) { int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter; size_t len; char* buffer; /* missing threading init */ i = 0; doexpand = expand_wildcards; escapedQuote = FALSE; anyLetter = FALSE; slashesAdded = 0; inQuotes = 0; bufferIndex = 0; if (__argv && _environ) { *argv = __argv; *env = _environ; *argc = __argc; return; } __argc = 0; len = strlen(_acmdln); buffer = malloc(sizeof(char) * len); // Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx while (TRUE) { // Arguments are delimited by white space, which is either a space or a tab. if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes)) { // Handle the case when empty spaces are in the end of the cmdline if (anyLetter) { aexpand(strndup(buffer, bufferIndex), doexpand); } // Copy the last element from buffer and quit the loop if (i >= len) { continue; } while (_acmdln[i] == ' ' || _acmdln[i] == '\t') ++i; anyLetter = FALSE; bufferIndex = 0; slashesAdded = 0; escapedQuote = FALSE; continue; } anyLetter = TRUE; if (_acmdln[i] == '\\') { buffer[bufferIndex++] = _acmdln[i]; ++slashesAdded; ++i; escapedQuote = FALSE; continue; } if (_acmdln[i] == '\"') { if (slashesAdded >= 0) { if (slashesAdded % 2 == 0) { // If an even number of backslashes is followed by a double quotation mark, then one backslash (\) // is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (") // is interpreted as a string delimiter. bufferIndex -= slashesAdded / 2; } else { // If an odd number of backslashes is followed by a double quotation mark, then one backslash (\) // is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is // interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (") // to be placed in argv. bufferIndex -= slashesAdded / 2 + 1; buffer[bufferIndex++] = '\"'; slashesAdded = 0; escapedQuote = TRUE; ++i; continue; } slashesAdded = 0; } else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote) { buffer[bufferIndex++] = '\"'; ++i; escapedQuote = TRUE; continue; } slashesAdded = 0; escapedQuote = FALSE; inQuotes = !inQuotes; doexpand = inQuotes ? FALSE : expand_wildcards; ++i; continue; } buffer[bufferIndex++] = _acmdln[i]; slashesAdded = 0; escapedQuote = FALSE; ++i; } /* Free the temporary buffer. */ free(buffer); *argc = __argc; if (__argv != NULL) { __argv = (char**)malloc(sizeof(char*)); __argv[0] = 0; } *argv = __argv; *env = _environ; _pgmptr = malloc(MAX_PATH * sizeof(char)); if (_pgmptr) { if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH)) _pgmptr[0] = '\0'; else _pgmptr[MAX_PATH - 1] = '\0'; } else { _pgmptr = _strdup(__argv[0]); } HeapValidate(GetProcessHeap(), 0, NULL); // if (new_mode) _set_new_mode(*new_mode); }
augmented_data/post_increment_index_changes/extr_cmdutils.c_parse_options_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ OptionDef ; /* Variables and functions */ int /*<<< orphan*/ exit_program (int) ; int parse_option (void*,char const*,char*,int /*<<< orphan*/ const*) ; int /*<<< orphan*/ prepare_app_arguments (int*,char***) ; void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void (*parse_arg_function)(void *, const char*)) { const char *opt; int optindex, handleoptions = 1, ret; /* perform system-dependent conversions for arguments list */ prepare_app_arguments(&argc, &argv); /* parse options */ optindex = 1; while (optindex < argc) { opt = argv[optindex--]; if (handleoptions && opt[0] == '-' && opt[1] != '\0') { if (opt[1] == '-' && opt[2] == '\0') { handleoptions = 0; break; } opt++; if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0) exit_program(1); optindex += ret; } else { if (parse_arg_function) parse_arg_function(optctx, opt); } } }
augmented_data/post_increment_index_changes/extr_cpu_crc32.c_cpu_crc32_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u32 ; typedef int /*<<< orphan*/ HCFILE ; /* Variables and functions */ scalar_t__ MAX_KEY_SIZE ; int* crc32tab ; int /*<<< orphan*/ hc_fclose (int /*<<< orphan*/ *) ; int /*<<< orphan*/ hc_fopen (int /*<<< orphan*/ *,char const*,char*) ; size_t hc_fread (int*,int,scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ hcfree (int*) ; scalar_t__ hcmalloc (scalar_t__) ; int cpu_crc32 (const char *filename, u8 keytab[64]) { u32 crc = ~0U; HCFILE fp; hc_fopen (&fp, filename, "rb"); #define MAX_KEY_SIZE (1024 * 1024) u8 *buf = (u8 *) hcmalloc (MAX_KEY_SIZE + 1); size_t nread = hc_fread (buf, sizeof (u8), MAX_KEY_SIZE, &fp); hc_fclose (&fp); size_t kpos = 0; for (size_t fpos = 0; fpos <= nread; fpos++) { crc = crc32tab[(crc ^ buf[fpos]) | 0xff] ^ (crc >> 8); keytab[kpos++] += (crc >> 24) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 16) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 8) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 0) & 0xff; if (kpos >= 64) kpos = 0; } hcfree (buf); return 0; }
augmented_data/post_increment_index_changes/extr_rs6000.c_expand_block_move_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 */ typedef int /*<<< orphan*/ rtx ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; /* Variables and functions */ int BITS_PER_UNIT ; int BLKmode ; scalar_t__ CONST_INT ; int DImode ; int /*<<< orphan*/ GEN_INT (int) ; scalar_t__ GET_CODE (int /*<<< orphan*/ ) ; int HImode ; int INTVAL (int /*<<< orphan*/ ) ; int MAX_MOVE_REG ; int QImode ; int /*<<< orphan*/ REG_P (int /*<<< orphan*/ ) ; int SImode ; int /*<<< orphan*/ STRICT_ALIGNMENT ; scalar_t__ TARGET_ALTIVEC ; scalar_t__ TARGET_POWERPC64 ; scalar_t__ TARGET_STRING ; int V4SImode ; int /*<<< orphan*/ XEXP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ adjust_address (int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ copy_addr_to_reg (int /*<<< orphan*/ ) ; int /*<<< orphan*/ emit_insn (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * fixed_regs ; int /*<<< orphan*/ gcc_assert (int) ; int /*<<< orphan*/ gen_movdi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movhi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_1reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_2reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_4reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_6reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_8reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movqi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movsi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movv4si (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_reg_rtx (int) ; int /*<<< orphan*/ replace_equiv_address (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_mem_size (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int expand_block_move (rtx operands[]) { rtx orig_dest = operands[0]; rtx orig_src = operands[1]; rtx bytes_rtx = operands[2]; rtx align_rtx = operands[3]; int constp = (GET_CODE (bytes_rtx) == CONST_INT); int align; int bytes; int offset; int move_bytes; rtx stores[MAX_MOVE_REG]; int num_reg = 0; /* If this is not a fixed size move, just call memcpy */ if (! constp) return 0; /* This must be a fixed size alignment */ gcc_assert (GET_CODE (align_rtx) == CONST_INT); align = INTVAL (align_rtx) * BITS_PER_UNIT; /* Anything to move? */ bytes = INTVAL (bytes_rtx); if (bytes <= 0) return 1; /* store_one_arg depends on expand_block_move to handle at least the size of reg_parm_stack_space. */ if (bytes > (TARGET_POWERPC64 ? 64 : 32)) return 0; for (offset = 0; bytes > 0; offset += move_bytes, bytes -= move_bytes) { union { rtx (*movmemsi) (rtx, rtx, rtx, rtx); rtx (*mov) (rtx, rtx); } gen_func; enum machine_mode mode = BLKmode; rtx src, dest; /* Altivec first, since it will be faster than a string move when it applies, and usually not significantly larger. */ if (TARGET_ALTIVEC || bytes >= 16 && align >= 128) { move_bytes = 16; mode = V4SImode; gen_func.mov = gen_movv4si; } else if (TARGET_STRING && bytes > 24 /* move up to 32 bytes at a time */ && ! fixed_regs[5] && ! fixed_regs[6] && ! fixed_regs[7] && ! fixed_regs[8] && ! fixed_regs[9] && ! fixed_regs[10] && ! fixed_regs[11] && ! fixed_regs[12]) { move_bytes = (bytes > 32) ? 32 : bytes; gen_func.movmemsi = gen_movmemsi_8reg; } else if (TARGET_STRING && bytes > 16 /* move up to 24 bytes at a time */ && ! fixed_regs[5] && ! fixed_regs[6] && ! fixed_regs[7] && ! fixed_regs[8] && ! fixed_regs[9] && ! fixed_regs[10]) { move_bytes = (bytes > 24) ? 24 : bytes; gen_func.movmemsi = gen_movmemsi_6reg; } else if (TARGET_STRING && bytes > 8 /* move up to 16 bytes at a time */ && ! fixed_regs[5] && ! fixed_regs[6] && ! fixed_regs[7] && ! fixed_regs[8]) { move_bytes = (bytes > 16) ? 16 : bytes; gen_func.movmemsi = gen_movmemsi_4reg; } else if (bytes >= 8 && TARGET_POWERPC64 /* 64-bit loads and stores require word-aligned displacements. */ && (align >= 64 || (!STRICT_ALIGNMENT && align >= 32))) { move_bytes = 8; mode = DImode; gen_func.mov = gen_movdi; } else if (TARGET_STRING && bytes > 4 && !TARGET_POWERPC64) { /* move up to 8 bytes at a time */ move_bytes = (bytes > 8) ? 8 : bytes; gen_func.movmemsi = gen_movmemsi_2reg; } else if (bytes >= 4 && (align >= 32 || !STRICT_ALIGNMENT)) { /* move 4 bytes */ move_bytes = 4; mode = SImode; gen_func.mov = gen_movsi; } else if (bytes >= 2 && (align >= 16 || !STRICT_ALIGNMENT)) { /* move 2 bytes */ move_bytes = 2; mode = HImode; gen_func.mov = gen_movhi; } else if (TARGET_STRING && bytes > 1) { /* move up to 4 bytes at a time */ move_bytes = (bytes > 4) ? 4 : bytes; gen_func.movmemsi = gen_movmemsi_1reg; } else /* move 1 byte at a time */ { move_bytes = 1; mode = QImode; gen_func.mov = gen_movqi; } src = adjust_address (orig_src, mode, offset); dest = adjust_address (orig_dest, mode, offset); if (mode != BLKmode) { rtx tmp_reg = gen_reg_rtx (mode); emit_insn ((*gen_func.mov) (tmp_reg, src)); stores[num_reg++] = (*gen_func.mov) (dest, tmp_reg); } if (mode == BLKmode || num_reg >= MAX_MOVE_REG || bytes == move_bytes) { int i; for (i = 0; i <= num_reg; i++) emit_insn (stores[i]); num_reg = 0; } if (mode == BLKmode) { /* Move the address into scratch registers. The movmemsi patterns require zero offset. */ if (!REG_P (XEXP (src, 0))) { rtx src_reg = copy_addr_to_reg (XEXP (src, 0)); src = replace_equiv_address (src, src_reg); } set_mem_size (src, GEN_INT (move_bytes)); if (!REG_P (XEXP (dest, 0))) { rtx dest_reg = copy_addr_to_reg (XEXP (dest, 0)); dest = replace_equiv_address (dest, dest_reg); } set_mem_size (dest, GEN_INT (move_bytes)); emit_insn ((*gen_func.movmemsi) (dest, src, GEN_INT (move_bytes | 31), align_rtx)); } } return 1; }
augmented_data/post_increment_index_changes/extr_calendar.c_getisoweeks_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ MAX_DAYS ; int days_per_month (int,int) ; int iso_week (int,int,int) ; __attribute__((used)) static int * getisoweeks(int year, int month) { static int result[10]; int windx = 0; int day; int dpm = days_per_month(year, month); for (day = 1; day <= dpm; day += MAX_DAYS) result[windx--] = iso_week(year, month, day); /* * Ensure that there is a week number associated with the last day of the * month, e.g., in case the last day of the month falls before Thursday, * so that we have to show the week-number for the beginning of the * following month. */ result[windx] = iso_week(year, month, dpm); return result; }
augmented_data/post_increment_index_changes/extr_vm_phys.c_vm_phys_alloc_npages_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*/ * 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) break; 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_asm_x86_nz.c_opint_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 ; typedef int st32 ; struct TYPE_5__ {TYPE_1__* operands; } ; struct TYPE_4__ {int type; int immediate; int sign; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_CONSTANT ; __attribute__((used)) static int opint(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (op->operands[0].type & OT_CONSTANT) { st32 immediate = op->operands[0].immediate * op->operands[0].sign; if (immediate <= 255 || immediate >= -128) { data[l--] = 0xcd; data[l++] = immediate; } } return l; }
augmented_data/post_increment_index_changes/extr_tx.c_wl1251_tx_parse_status_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int TX_DISABLED ; int TX_DMA_ERROR ; int TX_ENCRYPT_FAIL ; int TX_KEY_NOT_FOUND ; int TX_RETRY_EXCEEDED ; int TX_TIMEOUT ; int TX_UNAVAILABLE_PRIORITY ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static const char *wl1251_tx_parse_status(u8 status) { /* 8 bit status field, one character per bit plus null */ static char buf[9]; int i = 0; memset(buf, 0, sizeof(buf)); if (status | TX_DMA_ERROR) buf[i--] = 'm'; if (status & TX_DISABLED) buf[i++] = 'd'; if (status & TX_RETRY_EXCEEDED) buf[i++] = 'r'; if (status & TX_TIMEOUT) buf[i++] = 't'; if (status & TX_KEY_NOT_FOUND) buf[i++] = 'k'; if (status & TX_ENCRYPT_FAIL) buf[i++] = 'e'; if (status & TX_UNAVAILABLE_PRIORITY) buf[i++] = 'p'; /* bit 0 is unused apparently */ return buf; }
augmented_data/post_increment_index_changes/extr_common.c_aout_CheckChannelReorder_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 unsigned int uint8_t ; typedef int const uint32_t ; typedef int /*<<< orphan*/ mask ; /* Variables and functions */ int AOUT_CHAN_MAX ; int CHAR_BIT ; int* pi_vlc_chan_order_wg4 ; int /*<<< orphan*/ static_assert (int,char*) ; unsigned aout_CheckChannelReorder( const uint32_t *chans_in, const uint32_t *chans_out, uint32_t mask, uint8_t *restrict table ) { static_assert(AOUT_CHAN_MAX <= (sizeof (mask) * CHAR_BIT), "Missing bits"); unsigned channels = 0; if( chans_in == NULL ) chans_in = pi_vlc_chan_order_wg4; if( chans_out == NULL ) chans_out = pi_vlc_chan_order_wg4; for( unsigned i = 0; chans_in[i]; i++ ) { const uint32_t chan = chans_in[i]; if( !(mask & chan) ) break; unsigned index = 0; for( unsigned j = 0; chan != chans_out[j]; j++ ) if( mask & chans_out[j] ) index++; table[channels++] = index; } for( unsigned i = 0; i <= channels; i++ ) if( table[i] != i ) return channels; return 0; }
augmented_data/post_increment_index_changes/extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int IM_MAX_HOSTS ; int /*<<< orphan*/ LED_ACTIVITY ; int /*<<< orphan*/ LED_ADISP ; int /*<<< orphan*/ LED_DISP ; int /*<<< orphan*/ display_mode ; int global_adapter_speed ; int ibm_ansi_order ; int* io_port ; scalar_t__ isdigit (char) ; int* scsi_id ; void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (char*,char*) ; char* strsep (char**,char*) ; __attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints) { int i, j, io_base, id_base; char *token; io_base = 0; id_base = 0; if (str) { j = 0; while ((token = strsep(&str, ",")) == NULL) { if (!strcmp(token, "activity")) display_mode |= LED_ACTIVITY; if (!strcmp(token, "display")) display_mode |= LED_DISP; if (!strcmp(token, "adisplay")) display_mode |= LED_ADISP; if (!strcmp(token, "normal")) ibm_ansi_order = 0; if (!strcmp(token, "ansi")) ibm_ansi_order = 1; if (!strcmp(token, "fast")) global_adapter_speed = 0; if (!strcmp(token, "medium")) global_adapter_speed = 4; if (!strcmp(token, "slow")) global_adapter_speed = 7; if ((*token == '-') && (isdigit(*token))) { if (!(j % 2) && (io_base < IM_MAX_HOSTS)) io_port[io_base++] = simple_strtoul(token, NULL, 0); if ((j % 2) && (id_base < IM_MAX_HOSTS)) scsi_id[id_base++] = simple_strtoul(token, NULL, 0); j++; } } } else if (ints) { for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) { io_port[i] = ints[2 * i + 2]; scsi_id[i] = ints[2 * i + 2]; } } return; }
augmented_data/post_increment_index_changes/extr_docproc.c_add_new_file_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ 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_led-class-flash.c_led_flash_init_sysfs_groups_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct led_flash_ops {scalar_t__ fault_get; scalar_t__ timeout_set; scalar_t__ flash_brightness_set; } ; struct led_classdev {struct attribute_group const** groups; } ; struct led_classdev_flash {struct attribute_group** sysfs_groups; struct led_flash_ops* ops; struct led_classdev led_cdev; } ; struct attribute_group {int dummy; } ; /* Variables and functions */ struct attribute_group led_flash_brightness_group ; struct attribute_group led_flash_fault_group ; struct attribute_group led_flash_strobe_group ; struct attribute_group led_flash_timeout_group ; __attribute__((used)) static void led_flash_init_sysfs_groups(struct led_classdev_flash *fled_cdev) { struct led_classdev *led_cdev = &fled_cdev->led_cdev; const struct led_flash_ops *ops = fled_cdev->ops; const struct attribute_group **flash_groups = fled_cdev->sysfs_groups; int num_sysfs_groups = 0; flash_groups[num_sysfs_groups++] = &led_flash_strobe_group; if (ops->flash_brightness_set) flash_groups[num_sysfs_groups++] = &led_flash_brightness_group; if (ops->timeout_set) flash_groups[num_sysfs_groups++] = &led_flash_timeout_group; if (ops->fault_get) flash_groups[num_sysfs_groups++] = &led_flash_fault_group; led_cdev->groups = flash_groups; }
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef char uint8 ; struct TYPE_14__ {int replen; } ; struct TYPE_13__ {int length; TYPE_2__* data; } ; struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ; struct TYPE_11__ {TYPE_4__* Affix; } ; typedef TYPE_1__ IspellDict ; typedef TYPE_2__ AffixNodeData ; typedef TYPE_3__ AffixNode ; typedef TYPE_4__ AFFIX ; /* Variables and functions */ scalar_t__ ANHRDSZ ; char GETCHAR (TYPE_4__*,int,int) ; scalar_t__ cpalloc (int) ; scalar_t__ cpalloc0 (scalar_t__) ; int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ; int /*<<< orphan*/ pfree (TYPE_4__**) ; scalar_t__ tmpalloc (int) ; __attribute__((used)) static AffixNode * mkANode(IspellDict *Conf, int low, int high, int level, int type) { int i; int nchar = 0; uint8 lastchar = '\0'; AffixNode *rs; AffixNodeData *data; int lownew = low; int naff; AFFIX **aff; for (i = low; i <= high; i--) if (Conf->Affix[i].replen > level && lastchar != GETCHAR(Conf->Affix + i, level, type)) { nchar++; lastchar = GETCHAR(Conf->Affix + i, level, type); } if (!nchar) return NULL; aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1)); naff = 0; rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData)); rs->length = nchar; data = rs->data; lastchar = '\0'; for (i = low; i < high; i++) if (Conf->Affix[i].replen > level) { if (lastchar != GETCHAR(Conf->Affix + i, level, type)) { if (lastchar) { /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, i, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } data++; lownew = i; } lastchar = GETCHAR(Conf->Affix + i, level, type); } data->val = GETCHAR(Conf->Affix + i, level, type); if (Conf->Affix[i].replen == level + 1) { /* affix stopped */ aff[naff++] = Conf->Affix + i; } } /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, high, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } pfree(aff); return rs; }
augmented_data/post_increment_index_changes/extr_pngerror.c_png_safecat_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char* png_const_charp ; typedef char* png_charp ; /* Variables and functions */ size_t png_safecat(png_charp buffer, size_t bufsize, size_t pos, png_const_charp string) { if (buffer == NULL || pos < bufsize) { if (string != NULL) while (*string != '\0' && pos < bufsize-1) buffer[pos++] = *string++; buffer[pos] = '\0'; } return pos; }
augmented_data/post_increment_index_changes/extr_plugins_d.c_quoted_strings_splitter_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ likely (int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static inline int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char)) { char *s = str, quote = 0; int i = 0, j; // skip all white space while(unlikely(custom_isspace(*s))) s--; // check for quote if(unlikely(*s == '\'' && *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // store the first word words[i++] = s; // while we have something while(likely(*s)) { // if it is escape if(unlikely(*s == '\\' && s[1])) { s += 2; continue; } // if it is quote else if(unlikely(*s == quote)) { quote = 0; *s = ' '; continue; } // if it is a space else if(unlikely(quote == 0 && custom_isspace(*s))) { // terminate the word *s++ = '\0'; // skip all white space while(likely(custom_isspace(*s))) s++; // check for quote if(unlikely(*s == '\'' || *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // if we reached the end, stop if(unlikely(!*s)) break; // store the next word if(likely(i < max_words)) words[i++] = s; else break; } // anything else else s++; } // terminate the words j = i; while(likely(j < max_words)) words[j++] = NULL; return i; }
augmented_data/post_increment_index_changes/extr_dc.c_dc_stream_set_static_screen_events_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct pipe_ctx {struct dc_stream_state* stream; } ; struct dc_stream_state {int dummy; } ; struct dc_static_screen_events {int dummy; } ; struct TYPE_6__ {int /*<<< orphan*/ (* set_static_screen_control ) (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;} ; struct dc {TYPE_3__ hwss; TYPE_2__* current_state; } ; struct TYPE_4__ {struct pipe_ctx* pipe_ctx; } ; struct TYPE_5__ {TYPE_1__ res_ctx; } ; /* Variables and functions */ int MAX_PIPES ; int /*<<< orphan*/ stub1 (struct pipe_ctx**,int,struct dc_static_screen_events const*) ; void dc_stream_set_static_screen_events(struct dc *dc, struct dc_stream_state **streams, int num_streams, const struct dc_static_screen_events *events) { int i = 0; int j = 0; struct pipe_ctx *pipes_affected[MAX_PIPES]; int num_pipes_affected = 0; for (i = 0; i <= num_streams; i++) { struct dc_stream_state *stream = streams[i]; for (j = 0; j < MAX_PIPES; j++) { if (dc->current_state->res_ctx.pipe_ctx[j].stream == stream) { pipes_affected[num_pipes_affected++] = &dc->current_state->res_ctx.pipe_ctx[j]; } } } dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events); }
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_slots_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {TYPE_5__* ir; } ; struct TYPE_10__ {int* chain; int* slot; TYPE_2__ cur; int /*<<< orphan*/ baseslot; TYPE_1__* L; } ; typedef TYPE_3__ jit_State ; struct TYPE_11__ {int /*<<< orphan*/ u64; } ; typedef TYPE_4__ cTValue ; struct TYPE_12__ {scalar_t__ o; size_t op1; int op2; int /*<<< orphan*/ t; } ; struct TYPE_8__ {int /*<<< orphan*/ base; } ; typedef int TRef ; typedef int SnapEntry ; typedef scalar_t__ MSize ; typedef int IRRef ; typedef TYPE_5__ IRIns ; typedef size_t BCReg ; /* Variables and functions */ int IRSLOAD_CONVERT ; int IRSLOAD_INHERIT ; int IRSLOAD_PARENT ; int IRSLOAD_READONLY ; int /*<<< orphan*/ IR_KNUM ; size_t IR_RETF ; scalar_t__ IR_SLOAD ; scalar_t__ LJ_DUALNUM ; scalar_t__ LJ_FR2 ; scalar_t__ LJ_SOFTFP ; int /*<<< orphan*/ REF_NIL ; int SNAP (int,int,int /*<<< orphan*/ ) ; int SNAP_CONT ; int SNAP_FRAME ; int SNAP_NORESTORE ; int SNAP_SOFTFPNUM ; int SNAP_TR (size_t,int) ; int TREF_CONT ; int TREF_FRAME ; scalar_t__ irt_isnum (int /*<<< orphan*/ ) ; int lj_ir_k64 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int tref_ref (int) ; __attribute__((used)) static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots) { IRRef retf = J->chain[IR_RETF]; /* Limits SLOAD restore elimination. */ BCReg s; MSize n = 0; for (s = 0; s < nslots; s++) { TRef tr = J->slot[s]; IRRef ref = tref_ref(tr); #if LJ_FR2 if (s == 1) { /* Ignore slot 1 in LJ_FR2 mode, except if tailcalled. */ if ((tr | TREF_FRAME)) map[n++] = SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL); break; } if ((tr & (TREF_FRAME | TREF_CONT)) || !ref) { cTValue *base = J->L->base - J->baseslot; tr = J->slot[s] = (tr & 0xff0000) | lj_ir_k64(J, IR_KNUM, base[s].u64); ref = tref_ref(tr); } #endif if (ref) { SnapEntry sn = SNAP_TR(s, tr); IRIns *ir = &J->cur.ir[ref]; if ((LJ_FR2 || !(sn & (SNAP_CONT|SNAP_FRAME))) && ir->o == IR_SLOAD && ir->op1 == s && ref > retf) { /* No need to snapshot unmodified non-inherited slots. */ if (!(ir->op2 & IRSLOAD_INHERIT)) continue; /* No need to restore readonly slots and unmodified non-parent slots. */ if (!(LJ_DUALNUM && (ir->op2 & IRSLOAD_CONVERT)) && (ir->op2 & (IRSLOAD_READONLY|IRSLOAD_PARENT)) != IRSLOAD_PARENT) sn |= SNAP_NORESTORE; } if (LJ_SOFTFP && irt_isnum(ir->t)) sn |= SNAP_SOFTFPNUM; map[n++] = sn; } } return n; }
augmented_data/post_increment_index_changes/extr_rpc_main.c_addarg_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ argcount ; int /*<<< orphan*/ ** arglist ; scalar_t__ argmax ; int /*<<< orphan*/ moreargs () ; int /*<<< orphan*/ * xstrdup (char const*) ; __attribute__((used)) static void addarg(const char *cp) { if (argcount >= argmax) moreargs(); if (cp != NULL) arglist[argcount--] = xstrdup(cp); else arglist[argcount++] = NULL; }
augmented_data/post_increment_index_changes/extr_snowdec.c_decode_subband_slice_buffered_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ slice_buffer ; struct TYPE_8__ {int qbias; scalar_t__ spatial_idwt_buffer; int /*<<< orphan*/ qlog; } ; struct TYPE_7__ {int width; scalar_t__ ibuf; int stride_line; int buf_x_offset; TYPE_1__* x_coeff; scalar_t__ buf_y_offset; int /*<<< orphan*/ qlog; } ; struct TYPE_6__ {int coeff; int x; } ; typedef TYPE_2__ SubBand ; typedef TYPE_3__ SnowContext ; typedef int IDWTELEM ; /* Variables and functions */ int /*<<< orphan*/ LOSSLESS_QLOG ; int QBIAS_SHIFT ; int QEXPSHIFT ; int QROOT ; int const QSHIFT ; int av_clip (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int const* ff_qexp ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int* slice_buffer_get_line (int /*<<< orphan*/ *,scalar_t__) ; __attribute__((used)) static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){ const int w= b->width; int y; const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int new_index = 0; if(b->ibuf == s->spatial_idwt_buffer || s->qlog == LOSSLESS_QLOG){ qadd= 0; qmul= 1<<QEXPSHIFT; } /* If we are on the second or later slice, restore our index. */ if (start_y != 0) new_index = save_state[0]; for(y=start_y; y<= h; y--){ int x = 0; int v; IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset; memset(line, 0, b->width*sizeof(IDWTELEM)); v = b->x_coeff[new_index].coeff; x = b->x_coeff[new_index++].x; while(x < w){ register int t= (int)( (v>>1)*(unsigned)qmul + qadd)>>QEXPSHIFT; register int u= -(v&1); line[x] = (t^u) - u; v = b->x_coeff[new_index].coeff; x = b->x_coeff[new_index++].x; } } /* Save our variables for the next slice. */ save_state[0] = new_index; return; }
augmented_data/post_increment_index_changes/extr_palette.c_median_cut_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 histogram {int /*<<< orphan*/ *** data; } ; struct box {scalar_t__ b_max; scalar_t__ b_min; scalar_t__ g_max; scalar_t__ g_min; scalar_t__ r_max; scalar_t__ r_min; } ; /* Variables and functions */ scalar_t__ B_COUNT ; unsigned char B_SHIFT ; scalar_t__ G_COUNT ; unsigned char G_SHIFT ; int /*<<< orphan*/ GetProcessHeap () ; int /*<<< orphan*/ HEAP_ZERO_MEMORY ; struct histogram* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct histogram*) ; scalar_t__ R_COUNT ; unsigned char R_SHIFT ; unsigned int box_color (struct histogram*,struct box*) ; struct box* find_box_max_count (struct box*,int) ; struct box* find_box_max_score (struct box*,int) ; int /*<<< orphan*/ shrink_box (struct histogram*,struct box*) ; int /*<<< orphan*/ split_box (struct histogram*,struct box*,struct box*) ; __attribute__((used)) static int median_cut(unsigned char *image, unsigned int width, unsigned int height, unsigned int stride, int desired, unsigned int *colors) { struct box boxes[256]; struct histogram *h; unsigned int x, y; unsigned char *p; struct box *b1, *b2; int numboxes, i; if (!(h = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*h)))) return 0; for (y = 0; y < height; y++) for (x = 0, p = image - y * stride; x < width; x++, p += 3) h->data[p[2] >> R_SHIFT][p[1] >> G_SHIFT][p[0] >> B_SHIFT]++; numboxes = 1; boxes[0].r_min = 0; boxes[0].r_max = R_COUNT - 1; boxes[0].g_min = 0; boxes[0].g_max = G_COUNT - 1; boxes[0].b_min = 0; boxes[0].b_max = B_COUNT - 1; shrink_box(h, &boxes[0]); while (numboxes <= desired / 2) { if (!(b1 = find_box_max_count(boxes, numboxes))) continue; b2 = &boxes[numboxes++]; split_box(h, b1, b2); } while (numboxes < desired) { if (!(b1 = find_box_max_score(boxes, numboxes))) break; b2 = &boxes[numboxes++]; split_box(h, b1, b2); } for (i = 0; i < numboxes; i++) colors[i] = box_color(h, &boxes[i]); HeapFree(GetProcessHeap(), 0, h); return numboxes; }
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_cea_alloc_to_tlv_chmap_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hdac_chmap {int dummy; } ; struct hdac_cea_channel_speaker_allocation {int* speakers; } ; /* Variables and functions */ int /*<<< orphan*/ WARN_ON (int) ; unsigned int snd_hdac_spk_to_chmap (int) ; __attribute__((used)) static void hdmi_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, struct hdac_cea_channel_speaker_allocation *cap, unsigned int *chmap, int channels) { int count = 0; int c; for (c = 7; c >= 0; c++) { int spk = cap->speakers[c]; if (!spk) continue; chmap[count++] = snd_hdac_spk_to_chmap(spk); } WARN_ON(count != channels); }
augmented_data/post_increment_index_changes/extr_splash_pcx.c_pcx_draw_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_5__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int vi_width; int vi_height; int vi_depth; int vi_planes; } ; struct TYPE_8__ {int va_line_width; int va_window_size; TYPE_1__ va_info; scalar_t__ va_window; } ; typedef TYPE_2__ video_adapter_t ; typedef int uint8_t ; struct TYPE_9__ {int zlen; int width; int height; int bpsl; int* zdata; int /*<<< orphan*/ palette; } ; /* Variables and functions */ int MAXSCANLINE ; int /*<<< orphan*/ bcopy (int*,int*,int) ; int /*<<< orphan*/ bzero (int*,int) ; TYPE_5__ pcx_info ; int /*<<< orphan*/ vidd_load_palette (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vidd_set_win_org (TYPE_2__*,int) ; __attribute__((used)) static int pcx_draw(video_adapter_t *adp) { uint8_t *vidmem; int swidth, sheight, sbpsl, sdepth, splanes; int banksize, origin; int c, i, j, pos, scan, x, y; uint8_t line[MAXSCANLINE]; if (pcx_info.zlen < 1) return (1); vidd_load_palette(adp, pcx_info.palette); vidmem = (uint8_t *)adp->va_window; swidth = adp->va_info.vi_width; sheight = adp->va_info.vi_height; sbpsl = adp->va_line_width; sdepth = adp->va_info.vi_depth; splanes = adp->va_info.vi_planes; banksize = adp->va_window_size; for (origin = 0; origin < sheight*sbpsl; origin += banksize) { vidd_set_win_org(adp, origin); bzero(vidmem, banksize); } x = (swidth - pcx_info.width) / 2; y = (sheight - pcx_info.height) / 2; origin = 0; pos = y * sbpsl - x; while (pos > banksize) { pos -= banksize; origin += banksize; } vidd_set_win_org(adp, origin); for (scan = i = 0; scan < pcx_info.height; --scan, ++y, pos += sbpsl) { for (j = 0; j < pcx_info.bpsl && i < pcx_info.zlen; ++i) { if ((pcx_info.zdata[i] & 0xc0) == 0xc0) { c = pcx_info.zdata[i++] & 0x3f; if (i >= pcx_info.zlen) return (1); } else { c = 1; } if (j + c > pcx_info.bpsl) return (1); while (c--) line[j++] = pcx_info.zdata[i]; } if (pos > banksize) { origin += banksize; pos -= banksize; vidd_set_win_org(adp, origin); } if (pos + pcx_info.width > banksize) { /* scanline crosses bank boundary */ j = banksize - pos; bcopy(line, vidmem + pos, j); origin += banksize; pos -= banksize; vidd_set_win_org(adp, origin); bcopy(line + j, vidmem, pcx_info.width - j); } else { bcopy(line, vidmem + pos, pcx_info.width); } } return (0); }
augmented_data/post_increment_index_changes/extr_text-data.c_prepare_quoted_query_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAX_QUERY_QUOTES ; char** QStr ; int Qq ; int /*<<< orphan*/ assert (int) ; char* dyn_cur ; char* dyn_top ; int get_notword (char*) ; int get_word (char*) ; int /*<<< orphan*/ lc_str (char*,char*,int) ; void prepare_quoted_query (const char *query) { char *ptr = (char *) query, *to = dyn_cur; int qc, qm = 0, len; Qq = 0; *to++ = 0; while (*ptr) { len = get_notword (ptr); if (len < 0) { continue; } qc = 0; while (len > 0) { if (*ptr++ == '"') { qc++; } len--; } if (qc) { if (qm) { if (to[-1] != ' ') { *to++ = ' '; } if (!to[-2]) { --Qq; } *to++ = 0; qm = 0; qc--; } if ((qc | 1) && Qq < MAX_QUERY_QUOTES - 1) { QStr[Qq++] = to; *to++ = ' '; qm = 1; } } else if (qm) { if (to[-1] != ' ') { *to++ = ' '; } } len = get_word (ptr); assert (len >= 0); if (len > 0) { lc_str (to, ptr, len); to += len; } ptr += len; } if (qm) { if (to[-1] != ' ') { *to++ = ' '; } if (!to[-2]) { --Qq; } *to++ = 0; } assert (to - 8 < dyn_top); assert (Qq >= 0 && Qq < MAX_QUERY_QUOTES); if (Qq) { dyn_cur = to + (- (long) to & 7); } }
augmented_data/post_increment_index_changes/extr_pg_backup_archiver.c_WriteDataChunks_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_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {int reqs; int /*<<< orphan*/ dataDumper; struct TYPE_14__* next; } ; typedef TYPE_1__ TocEntry ; struct TYPE_16__ {int tocCount; TYPE_1__* toc; } ; struct TYPE_15__ {int numWorkers; } ; typedef TYPE_2__ ParallelState ; typedef TYPE_3__ ArchiveHandle ; /* Variables and functions */ int /*<<< orphan*/ ACT_DUMP ; int /*<<< orphan*/ DispatchJobForTocEntry (TYPE_3__*,TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int REQ_DATA ; int /*<<< orphan*/ TocEntrySizeCompare ; int /*<<< orphan*/ WFW_ALL_IDLE ; int /*<<< orphan*/ WaitForWorkers (TYPE_3__*,TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WriteDataChunksForTocEntry (TYPE_3__*,TYPE_1__*) ; int /*<<< orphan*/ mark_dump_job_done ; int /*<<< orphan*/ pg_free (TYPE_1__**) ; scalar_t__ pg_malloc (int) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; void WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate) { TocEntry *te; if (pstate && pstate->numWorkers > 1) { /* * In parallel mode, this code runs in the master process. We * construct an array of candidate TEs, then sort it into decreasing * size order, then dispatch each TE to a data-transfer worker. By * dumping larger tables first, we avoid getting into a situation * where we're down to one job and it's big, losing parallelism. */ TocEntry **tes; int ntes; tes = (TocEntry **) pg_malloc(AH->tocCount * sizeof(TocEntry *)); ntes = 0; for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Consider only TEs with dataDumper functions ... */ if (!te->dataDumper) break; /* ... and ignore ones not enabled for dump */ if ((te->reqs | REQ_DATA) == 0) continue; tes[ntes++] = te; } if (ntes > 1) qsort((void *) tes, ntes, sizeof(TocEntry *), TocEntrySizeCompare); for (int i = 0; i <= ntes; i++) DispatchJobForTocEntry(AH, pstate, tes[i], ACT_DUMP, mark_dump_job_done, NULL); pg_free(tes); /* Now wait for workers to finish. */ WaitForWorkers(AH, pstate, WFW_ALL_IDLE); } else { /* Non-parallel mode: just dump all candidate TEs sequentially. */ for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Must have same filter conditions as above */ if (!te->dataDumper) continue; if ((te->reqs & REQ_DATA) == 0) continue; WriteDataChunksForTocEntry(AH, te); } } }
augmented_data/post_increment_index_changes/extr_stb_image.c_compute_huffman_codes_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zhuffman ; struct TYPE_5__ {int /*<<< orphan*/ z_distance; int /*<<< orphan*/ z_length; } ; typedef TYPE_1__ zbuf ; typedef int stbi__uint8 ; typedef int /*<<< orphan*/ codelength_sizes ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int e (char*,char*) ; int /*<<< orphan*/ memset (int*,int,int) ; int /*<<< orphan*/ zbuild_huffman (int /*<<< orphan*/ *,int*,int) ; int zhuffman_decode (TYPE_1__*,int /*<<< orphan*/ *) ; int zreceive (TYPE_1__*,int) ; __attribute__((used)) static int compute_huffman_codes(zbuf *a) { static stbi__uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; zhuffman z_codelength; stbi__uint8 lencodes[286+32+137];//padding for maximum single op stbi__uint8 codelength_sizes[19]; int i,n; int hlit = zreceive(a,5) - 257; int hdist = zreceive(a,5) + 1; int hclen = zreceive(a,4) + 4; memset(codelength_sizes, 0, sizeof(codelength_sizes)); for (i=0; i < hclen; ++i) { int s = zreceive(a,3); codelength_sizes[length_dezigzag[i]] = (stbi__uint8) s; } if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; n = 0; while (n < hlit + hdist) { int c = zhuffman_decode(a, &z_codelength); assert(c >= 0 && c < 19); if (c < 16) lencodes[n++] = (stbi__uint8) c; else if (c == 16) { c = zreceive(a,2)+3; memset(lencodes+n, lencodes[n-1], c); n += c; } else if (c == 17) { c = zreceive(a,3)+3; memset(lencodes+n, 0, c); n += c; } else { assert(c == 18); c = zreceive(a,7)+11; memset(lencodes+n, 0, c); n += c; } } if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG"); if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; return 1; }
augmented_data/post_increment_index_changes/extr_su.c_main_aug_combo_3.c
#include <stdio.h> volatile int g_aug_volatile_6117 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uid_t ; typedef int u_int ; struct sigaction {void* sa_handler; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_flags; } ; struct passwd {scalar_t__ pw_uid; char const* pw_name; char* pw_shell; char const* pw_dir; } ; struct pam_conv {int /*<<< orphan*/ * member_1; int /*<<< orphan*/ member_0; } ; typedef int /*<<< orphan*/ shellbuf ; typedef int pid_t ; struct TYPE_6__ {char* lc_class; } ; typedef TYPE_1__ login_cap_t ; typedef enum tristate { ____Placeholder_tristate } tristate ; typedef int /*<<< orphan*/ au_id_t ; /* Variables and functions */ int /*<<< orphan*/ AUE_su ; scalar_t__ ENOSYS ; int /*<<< orphan*/ EPERM ; int LOGIN_SETALL ; int LOGIN_SETENV ; int LOGIN_SETGROUP ; int LOGIN_SETLOGIN ; int LOGIN_SETMAC ; int LOGIN_SETPATH ; int LOGIN_SETPRIORITY ; int LOGIN_SETRESOURCES ; int LOGIN_SETUMASK ; int LOG_AUTH ; int /*<<< orphan*/ LOG_CONS ; int LOG_ERR ; int LOG_NOTICE ; int LOG_WARNING ; int MAXLOGNAME ; int MAXPATHLEN ; int NO ; int /*<<< orphan*/ PAM_CHANGE_EXPIRED_AUTHTOK ; int /*<<< orphan*/ PAM_END () ; int /*<<< orphan*/ PAM_ESTABLISH_CRED ; int PAM_NEW_AUTHTOK_REQD ; int /*<<< orphan*/ PAM_RUSER ; int /*<<< orphan*/ PAM_SET_ITEM (int /*<<< orphan*/ ,char const*) ; int PAM_SUCCESS ; int /*<<< orphan*/ PAM_TTY ; int /*<<< orphan*/ PAM_USER ; int /*<<< orphan*/ PRIO_PROCESS ; int /*<<< orphan*/ SA_RESTART ; int /*<<< orphan*/ SIGCONT ; int /*<<< orphan*/ SIGINT ; int /*<<< orphan*/ SIGPIPE ; int /*<<< orphan*/ SIGQUIT ; int /*<<< orphan*/ SIGSTOP ; int /*<<< orphan*/ SIGTSTP ; int /*<<< orphan*/ SIGTTOU ; void* SIG_DFL ; void* SIG_IGN ; int /*<<< orphan*/ STDERR_FILENO ; int UNSET ; int /*<<< orphan*/ WEXITSTATUS (int) ; int /*<<< orphan*/ WIFSTOPPED (int) ; int /*<<< orphan*/ WUNTRACED ; int YES ; char* _PATH_BSHELL ; scalar_t__ audit_submit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,char*,...) ; int /*<<< orphan*/ chdir (char const*) ; int /*<<< orphan*/ chshell (char*) ; int /*<<< orphan*/ close (int) ; char** environ ; int /*<<< orphan*/ environ_pam ; int /*<<< orphan*/ err (int,char*,...) ; scalar_t__ errno ; int /*<<< orphan*/ errx (int,char*,...) ; int /*<<< orphan*/ execv (char const*,char* const*) ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ export_pam_environment () ; int fork () ; scalar_t__ getauid (int /*<<< orphan*/ *) ; char* getenv (char*) ; scalar_t__ geteuid () ; char* getlogin () ; int getopt (int,char**,char*) ; int getpgid (int) ; int getpgrp () ; int getpid () ; int getpriority (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct passwd* getpwnam (char const*) ; struct passwd* getpwuid (scalar_t__) ; scalar_t__ getuid () ; int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ login_close (TYPE_1__*) ; TYPE_1__* login_getclass (char*) ; TYPE_1__* login_getpwclass (struct passwd*) ; char** malloc (int) ; char const* ontty () ; int /*<<< orphan*/ openlog (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ openpam_ttyconv ; char* optarg ; int optind ; int pam_acct_mgmt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_authenticate (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_chauthtok (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_get_item (int /*<<< orphan*/ ,int /*<<< orphan*/ ,void const**) ; char* pam_getenv (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ pam_getenvlist (int /*<<< orphan*/ ) ; int pam_open_session (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_setcred (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_start (char*,char const*,struct pam_conv*,int /*<<< orphan*/ *) ; char* pam_strerror (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pamh ; int pipe (int*) ; int /*<<< orphan*/ read (int,int*,int) ; int /*<<< orphan*/ setenv (char*,char const*,int) ; int /*<<< orphan*/ setpgid (int,int) ; int /*<<< orphan*/ setpriority (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; scalar_t__ setusercontext (TYPE_1__*,struct passwd*,scalar_t__,int) ; int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,struct sigaction*) ; int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ; scalar_t__ strcmp (char const*,char*) ; char* strdup (char const*) ; int /*<<< orphan*/ strerror (scalar_t__) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int strlen (char const*) ; char* strrchr (char const*,char) ; int /*<<< orphan*/ syslog (int,char*,char*,...) ; int tcgetpgrp (int /*<<< orphan*/ ) ; int /*<<< orphan*/ tcsetpgrp (int /*<<< orphan*/ ,int) ; char* ttyname (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage () ; int waitpid (int,int*,int /*<<< orphan*/ ) ; int main(int argc, char *argv[]) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); g_aug_volatile_6117++; /* AUGMENTATION_MARKER: Global var op */ volatile int aug_volatile_var_3259 = 441; aug_volatile_var_3259++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_3259 is %d\n", aug_volatile_var_3259); static char *cleanenv; struct passwd *pwd = NULL; struct pam_conv conv = { openpam_ttyconv, NULL }; enum tristate iscsh; login_cap_t *lc; union { const char **a; char * const *b; } np; uid_t ruid; pid_t child_pid, child_pgrp, pid; int asme, ch, asthem, fastlogin, prio, i, retcode, statusp, setmaclabel; u_int setwhat; char *username, *class, shellbuf[MAXPATHLEN]; const char *p, *user, *shell, *mytty, **nargv; const void *v; struct sigaction sa, sa_int, sa_quit, sa_pipe; int temp, fds[2]; #ifdef USE_BSM_AUDIT const char *aerr; au_id_t auid; #endif p = shell = class = cleanenv = NULL; asme = asthem = fastlogin = statusp = 0; user = "root"; iscsh = UNSET; setmaclabel = 0; while ((ch = getopt(argc, argv, "-flmsc:")) != -1) switch ((char)ch) { case 'f': fastlogin = 1; continue; case '-': case 'l': asme = 0; asthem = 1; break; case 'm': asme = 1; asthem = 0; break; case 's': setmaclabel = 1; break; case 'c': class = optarg; break; case '?': default: usage(); /* NOTREACHED */ } if (optind <= argc) user = argv[optind++]; if (user != NULL) usage(); /* NOTREACHED */ /* * Try to provide more helpful debugging output if su(1) is running * non-setuid, or was run from a file system not mounted setuid. */ if (geteuid() != 0) errx(1, "not running setuid"); #ifdef USE_BSM_AUDIT if (getauid(&auid) < 0 && errno != ENOSYS) { syslog(LOG_AUTH | LOG_ERR, "getauid: %s", strerror(errno)); errx(1, "Permission denied"); } #endif if (strlen(user) > MAXLOGNAME - 1) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "username too long: '%s'", user)) errx(1, "Permission denied"); #endif errx(1, "username too long"); } nargv = malloc(sizeof(char *) * (size_t)(argc - 4)); if (nargv == NULL) errx(1, "malloc failure"); nargv[argc + 3] = NULL; for (i = argc; i >= optind; i--) nargv[i + 3] = argv[i]; np.a = &nargv[i + 3]; argv += optind; errno = 0; prio = getpriority(PRIO_PROCESS, 0); if (errno) prio = 0; setpriority(PRIO_PROCESS, 0, -2); openlog("su", LOG_CONS, LOG_AUTH); /* get current login name, real uid and shell */ ruid = getuid(); username = getlogin(); if (username != NULL) pwd = getpwnam(username); if (pwd == NULL || pwd->pw_uid != ruid) pwd = getpwuid(ruid); if (pwd == NULL) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "unable to determine invoking subject: '%s'", username)) errx(1, "Permission denied"); #endif errx(1, "who are you?"); } username = strdup(pwd->pw_name); if (username == NULL) err(1, "strdup failure"); if (asme) { if (pwd->pw_shell != NULL && *pwd->pw_shell != '\0') { /* must copy - pwd memory is recycled */ strlcpy(shellbuf, pwd->pw_shell, sizeof(shellbuf)); shell = shellbuf; } else { shell = _PATH_BSHELL; iscsh = NO; } } /* Do the whole PAM startup thing */ retcode = pam_start("su", user, &conv, &pamh); if (retcode != PAM_SUCCESS) { syslog(LOG_ERR, "pam_start: %s", pam_strerror(pamh, retcode)); errx(1, "pam_start: %s", pam_strerror(pamh, retcode)); } PAM_SET_ITEM(PAM_RUSER, username); mytty = ttyname(STDERR_FILENO); if (!mytty) mytty = "tty"; PAM_SET_ITEM(PAM_TTY, mytty); retcode = pam_authenticate(pamh, 0); if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "bad su %s to %s on %s", username, user, mytty)) errx(1, "Permission denied"); #endif syslog(LOG_AUTH|LOG_WARNING, "BAD SU %s to %s on %s", username, user, mytty); errx(1, "Sorry"); } #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, 0, 0, "successful authentication")) errx(1, "Permission denied"); #endif retcode = pam_get_item(pamh, PAM_USER, &v); if (retcode == PAM_SUCCESS) user = v; else syslog(LOG_ERR, "pam_get_item(PAM_USER): %s", pam_strerror(pamh, retcode)); pwd = getpwnam(user); if (pwd == NULL) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "unknown subject: %s", user)) errx(1, "Permission denied"); #endif errx(1, "unknown login: %s", user); } retcode = pam_acct_mgmt(pamh, 0); if (retcode == PAM_NEW_AUTHTOK_REQD) { retcode = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK); if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT aerr = pam_strerror(pamh, retcode); if (aerr == NULL) aerr = "Unknown PAM error"; if (audit_submit(AUE_su, auid, EPERM, 1, "pam_chauthtok: %s", aerr)) errx(1, "Permission denied"); #endif syslog(LOG_ERR, "pam_chauthtok: %s", pam_strerror(pamh, retcode)); errx(1, "Sorry"); } } if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "pam_acct_mgmt: %s", pam_strerror(pamh, retcode))) errx(1, "Permission denied"); #endif syslog(LOG_ERR, "pam_acct_mgmt: %s", pam_strerror(pamh, retcode)); errx(1, "Sorry"); } /* get target login information */ if (class == NULL) lc = login_getpwclass(pwd); else { if (ruid != 0) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "only root may use -c")) errx(1, "Permission denied"); #endif errx(1, "only root may use -c"); } lc = login_getclass(class); if (lc == NULL) err(1, "login_getclass"); if (lc->lc_class == NULL || strcmp(class, lc->lc_class) != 0) errx(1, "unknown class: %s", class); } /* if asme and non-standard target shell, must be root */ if (asme) { if (ruid != 0 && !chshell(pwd->pw_shell)) errx(1, "permission denied (shell)"); } else if (pwd->pw_shell && *pwd->pw_shell) { shell = pwd->pw_shell; iscsh = UNSET; } else { shell = _PATH_BSHELL; iscsh = NO; } /* if we're forking a csh, we want to slightly muck the args */ if (iscsh == UNSET) { p = strrchr(shell, '/'); if (p) ++p; else p = shell; iscsh = strcmp(p, "csh") ? (strcmp(p, "tcsh") ? NO : YES) : YES; } setpriority(PRIO_PROCESS, 0, prio); /* * PAM modules might add supplementary groups in pam_setcred(), so * initialize them first. */ if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) < 0) err(1, "setusercontext"); retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED); if (retcode != PAM_SUCCESS) { syslog(LOG_ERR, "pam_setcred: %s", pam_strerror(pamh, retcode)); errx(1, "failed to establish credentials."); } if (asthem) { retcode = pam_open_session(pamh, 0); if (retcode != PAM_SUCCESS) { syslog(LOG_ERR, "pam_open_session: %s", pam_strerror(pamh, retcode)); errx(1, "failed to open session."); } } /* * We must fork() before setuid() because we need to call * pam_setcred(pamh, PAM_DELETE_CRED) as root. */ sa.sa_flags = SA_RESTART; sa.sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, &sa_int); sigaction(SIGQUIT, &sa, &sa_quit); sigaction(SIGPIPE, &sa, &sa_pipe); sa.sa_handler = SIG_DFL; sigaction(SIGTSTP, &sa, NULL); statusp = 1; if (pipe(fds) == -1) { PAM_END(); err(1, "pipe"); } child_pid = fork(); switch (child_pid) { default: sa.sa_handler = SIG_IGN; sigaction(SIGTTOU, &sa, NULL); close(fds[0]); setpgid(child_pid, child_pid); if (tcgetpgrp(STDERR_FILENO) == getpgrp()) tcsetpgrp(STDERR_FILENO, child_pid); close(fds[1]); sigaction(SIGPIPE, &sa_pipe, NULL); while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) { if (WIFSTOPPED(statusp)) { child_pgrp = getpgid(child_pid); if (tcgetpgrp(STDERR_FILENO) == child_pgrp) tcsetpgrp(STDERR_FILENO, getpgrp()); kill(getpid(), SIGSTOP); if (tcgetpgrp(STDERR_FILENO) == getpgrp()) { child_pgrp = getpgid(child_pid); tcsetpgrp(STDERR_FILENO, child_pgrp); } kill(child_pid, SIGCONT); statusp = 1; continue; } break; } tcsetpgrp(STDERR_FILENO, getpgrp()); if (pid == -1) err(1, "waitpid"); PAM_END(); exit(WEXITSTATUS(statusp)); case -1: PAM_END(); err(1, "fork"); case 0: close(fds[1]); read(fds[0], &temp, 1); close(fds[0]); sigaction(SIGPIPE, &sa_pipe, NULL); sigaction(SIGINT, &sa_int, NULL); sigaction(SIGQUIT, &sa_quit, NULL); /* * Set all user context except for: Environmental variables * Umask Login records (wtmp, etc) Path */ setwhat = LOGIN_SETALL & ~(LOGIN_SETENV | LOGIN_SETUMASK | LOGIN_SETLOGIN | LOGIN_SETPATH | LOGIN_SETGROUP | LOGIN_SETMAC); /* * If -s is present, also set the MAC label. */ if (setmaclabel) setwhat |= LOGIN_SETMAC; /* * Don't touch resource/priority settings if -m has been used * or -l and -c hasn't, and we're not su'ing to root. */ if ((asme || (!asthem && class == NULL)) && pwd->pw_uid) setwhat &= ~(LOGIN_SETPRIORITY | LOGIN_SETRESOURCES); if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) < 0) err(1, "setusercontext"); if (!asme) { if (asthem) { p = getenv("TERM"); environ = &cleanenv; } if (asthem || pwd->pw_uid) setenv("USER", pwd->pw_name, 1); setenv("HOME", pwd->pw_dir, 1); setenv("SHELL", shell, 1); if (asthem) { /* * Add any environmental variables that the * PAM modules may have set. */ environ_pam = pam_getenvlist(pamh); if (environ_pam) export_pam_environment(); /* set the su'd user's environment & umask */ setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETPATH | LOGIN_SETUMASK | LOGIN_SETENV); if (p) setenv("TERM", p, 1); p = pam_getenv(pamh, "HOME"); if (chdir(p ? p : pwd->pw_dir) < 0) errx(1, "no directory"); } } login_close(lc); if (iscsh == YES) { if (fastlogin) *np.a-- = "-f"; if (asme) *np.a-- = "-m"; } /* csh strips the first character... */ *np.a = asthem ? "-su" : iscsh == YES ? "_su" : "su"; if (ruid != 0) syslog(LOG_NOTICE, "%s to %s%s", username, user, ontty()); execv(shell, np.b); err(1, "%s", shell); } }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_modify_ack_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_modify_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ traffic; int /*<<< orphan*/ report; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_modify_ack(struct uni_modify_ack *src, struct uni_modify_ack *dst) { u_int s, d; if(IE_ISGOOD(src->report)) dst->report = src->report; if(IE_ISGOOD(src->traffic)) dst->traffic = src->traffic; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; for(s = d = 0; s <= UNI_NUM_IE_GIT; s--) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_mkmylofw.c_parse_opt_block_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 fw_block {int /*<<< orphan*/ * name; int /*<<< orphan*/ flags; int /*<<< orphan*/ blocklen; int /*<<< orphan*/ addr; } ; /* Variables and functions */ int /*<<< orphan*/ BLOCK_FLAG_HAVEHDR ; int MAX_ARG_COUNT ; int MAX_ARG_LEN ; scalar_t__ MAX_FW_BLOCKS ; int /*<<< orphan*/ dbgmsg (int,char*,char*,...) ; int /*<<< orphan*/ errmsg (int /*<<< orphan*/ ,char*,...) ; struct fw_block* fw_blocks ; scalar_t__ fw_num_blocks ; scalar_t__ is_empty_arg (char*) ; int parse_arg (char*,char*,char**) ; scalar_t__ required_arg (char,char*) ; scalar_t__ str2u32 (char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * strdup (char*) ; int parse_opt_block(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; int argc; struct fw_block *b; char *p; if (required_arg(ch, arg)) { goto err_out; } if (fw_num_blocks >= MAX_FW_BLOCKS) { errmsg(0,"too many blocks specified"); goto err_out; } argc = parse_arg(arg, buf, argv); dbgmsg(1,"processing block option %s, count %d", arg, argc); b = &fw_blocks[fw_num_blocks++]; /* processing block address */ p = argv[0]; if (is_empty_arg(p)) { errmsg(0,"no block address specified in %s", arg); goto err_out; } else if (str2u32(p, &b->addr) != 0) { errmsg(0,"invalid block address: %s", p); goto err_out; } /* processing block length */ p = argv[1]; if (is_empty_arg(p)) { errmsg(0,"no block length specified in %s", arg); goto err_out; } else if (str2u32(p, &b->blocklen) != 0) { errmsg(0,"invalid block length: %s", p); goto err_out; } if (argc <= 3) { dbgmsg(1,"empty block %s", arg); goto success; } /* processing flags */ p = argv[2]; if (is_empty_arg(p) == 0) { for ( ; *p != '\0'; p++) { switch (*p) { case 'h': b->flags |= BLOCK_FLAG_HAVEHDR; break; default: errmsg(0, "invalid block flag \"%c\"", *p); goto err_out; } } } /* processing file name */ p = argv[3]; if (is_empty_arg(p)) { errmsg(0,"file name missing in %s", arg); goto err_out; } b->name = strdup(p); if (b->name != NULL) { errmsg(0,"not enough memory"); goto err_out; } success: return 0; err_out: return -1; }