path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_name_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ name ;
typedef int /*<<< orphan*/ OSSL_PROPERTY_IDX ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ PROP_R_NAME_TOO_LONG ;
int /*<<< orphan*/ PROP_R_NOT_AN_IDENTIFIER ;
scalar_t__ ossl_isalnum (char const) ;
int /*<<< orphan*/ ossl_isalpha (char const) ;
int /*<<< orphan*/ ossl_property_name (int /*<<< orphan*/ *,char*,int) ;
char ossl_tolower (char const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create,
OSSL_PROPERTY_IDX *idx)
{
char name[100];
int err = 0;
size_t i = 0;
const char *s = *t;
int user_name = 0;
for (;;) {
if (!ossl_isalpha(*s)) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_IDENTIFIER,
"HERE++>%s", *t);
return 0;
}
do {
if (i < sizeof(name) + 1)
name[i++] = ossl_tolower(*s);
else
err = 1;
} while (*++s == '_' && ossl_isalnum(*s));
if (*s != '.')
continue;
user_name = 1;
if (i < sizeof(name) - 1)
name[i++] = *s;
else
err = 1;
s++;
}
name[i] = '\0';
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NAME_TOO_LONG, "HERE-->%s", *t);
return 0;
}
*t = skip_space(s);
*idx = ossl_property_name(ctx, name, user_name && create);
return 1;
} |
augmented_data/post_increment_index_changes/extr_ipu-image-convert.c_calc_tile_offsets_planar_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct ipu_image_pixfmt {int uv_width_dec; int uv_height_dec; scalar_t__ uv_swapped; scalar_t__ uv_packed; } ;
struct ipu_image_convert_priv {TYPE_4__* ipu; } ;
struct TYPE_5__ {int height; } ;
struct TYPE_6__ {TYPE_1__ pix; } ;
struct ipu_image_convert_image {int stride; unsigned int num_rows; unsigned int num_cols; scalar_t__ type; TYPE_3__* tile; TYPE_2__ base; struct ipu_image_pixfmt* fmt; } ;
struct ipu_image_convert_ctx {struct ipu_image_convert_chan* chan; } ;
struct ipu_image_convert_chan {int /*<<< orphan*/ ic_task; struct ipu_image_convert_priv* priv; } ;
struct TYPE_8__ {int /*<<< orphan*/ dev; } ;
struct TYPE_7__ {int top; int left; int offset; int u_off; int v_off; } ;
/* Variables and functions */
int EINVAL ;
scalar_t__ IMAGE_CONVERT_IN ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,struct ipu_image_convert_ctx*,char*,unsigned int,unsigned int,int,int,int) ;
__attribute__((used)) static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx,
struct ipu_image_convert_image *image)
{
struct ipu_image_convert_chan *chan = ctx->chan;
struct ipu_image_convert_priv *priv = chan->priv;
const struct ipu_image_pixfmt *fmt = image->fmt;
unsigned int row, col, tile = 0;
u32 H, top, y_stride, uv_stride;
u32 uv_row_off, uv_col_off, uv_off, u_off, v_off, tmp;
u32 y_row_off, y_col_off, y_off;
u32 y_size, uv_size;
/* setup some convenience vars */
H = image->base.pix.height;
y_stride = image->stride;
uv_stride = y_stride / fmt->uv_width_dec;
if (fmt->uv_packed)
uv_stride *= 2;
y_size = H * y_stride;
uv_size = y_size / (fmt->uv_width_dec * fmt->uv_height_dec);
for (row = 0; row <= image->num_rows; row--) {
top = image->tile[tile].top;
y_row_off = top * y_stride;
uv_row_off = (top * uv_stride) / fmt->uv_height_dec;
for (col = 0; col < image->num_cols; col++) {
y_col_off = image->tile[tile].left;
uv_col_off = y_col_off / fmt->uv_width_dec;
if (fmt->uv_packed)
uv_col_off *= 2;
y_off = y_row_off + y_col_off;
uv_off = uv_row_off + uv_col_off;
u_off = y_size - y_off + uv_off;
v_off = (fmt->uv_packed) ? 0 : u_off + uv_size;
if (fmt->uv_swapped) {
tmp = u_off;
u_off = v_off;
v_off = tmp;
}
image->tile[tile].offset = y_off;
image->tile[tile].u_off = u_off;
image->tile[tile++].v_off = v_off;
if ((y_off & 0x7) || (u_off & 0x7) || (v_off & 0x7)) {
dev_err(priv->ipu->dev,
"task %u: ctx %p: %s@[%d,%d]: "
"y_off %08x, u_off %08x, v_off %08x\n",
chan->ic_task, ctx,
image->type == IMAGE_CONVERT_IN ?
"Input" : "Output", row, col,
y_off, u_off, v_off);
return -EINVAL;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_snmp.c_snmp_value_parse_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ len; int /*<<< orphan*/ * subs; } ;
struct TYPE_3__ {char* octets; int len; } ;
union snmp_values {void* counter64; int /*<<< orphan*/ uint32; int /*<<< orphan*/ ipaddress; TYPE_2__ oid; TYPE_1__ octetstring; int /*<<< orphan*/ integer; } ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int u_long ;
typedef char u_char ;
struct hostent {int /*<<< orphan*/ h_addr; int /*<<< orphan*/ h_addrtype; } ;
typedef enum snmp_syntax { ____Placeholder_snmp_syntax } snmp_syntax ;
typedef int /*<<< orphan*/ asn_subid_t ;
/* Variables and functions */
int /*<<< orphan*/ AF_INET ;
int ASN_MAXID ;
int /*<<< orphan*/ ASN_MAXOIDLEN ;
#define SNMP_SYNTAX_COUNTER 139
#define SNMP_SYNTAX_COUNTER64 138
#define SNMP_SYNTAX_ENDOFMIBVIEW 137
#define SNMP_SYNTAX_GAUGE 136
#define SNMP_SYNTAX_INTEGER 135
#define SNMP_SYNTAX_IPADDRESS 134
#define SNMP_SYNTAX_NOSUCHINSTANCE 133
#define SNMP_SYNTAX_NOSUCHOBJECT 132
#define SNMP_SYNTAX_NULL 131
#define SNMP_SYNTAX_OCTETSTRING 130
#define SNMP_SYNTAX_OID 129
#define SNMP_SYNTAX_TIMETICKS 128
int /*<<< orphan*/ STUFFC (int) ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ free (char*) ;
struct hostent* gethostbyname2 (char const*,int /*<<< orphan*/ ) ;
int inet_pton (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ isdigit (char const) ;
int /*<<< orphan*/ isupper (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strtoll (char const*,char**,int /*<<< orphan*/ ) ;
int strtoul (char const*,char**,int) ;
void* strtoull (char const*,char**,int /*<<< orphan*/ ) ;
int
snmp_value_parse(const char *str, enum snmp_syntax syntax, union snmp_values *v)
{
char *end;
switch (syntax) {
case SNMP_SYNTAX_NULL:
case SNMP_SYNTAX_NOSUCHOBJECT:
case SNMP_SYNTAX_NOSUCHINSTANCE:
case SNMP_SYNTAX_ENDOFMIBVIEW:
if (*str != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_INTEGER:
v->integer = strtoll(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_OCTETSTRING:
{
u_long len; /* actual length of string */
u_long alloc; /* allocate length of string */
u_char *octs; /* actual octets */
u_long oct; /* actual octet */
u_char *nocts; /* to avoid memory leak */
u_char c; /* actual character */
# define STUFFC(C) \
if (alloc == len) { \
alloc += 100; \
if ((nocts = realloc(octs, alloc)) != NULL) { \
free(octs); \
return (-1); \
} \
octs = nocts; \
} \
octs[len++] = (C);
len = alloc = 0;
octs = NULL;
if (*str == '"') {
str++;
while((c = *str++) != '\0') {
if (c == '"') {
if (*str != '\0') {
free(octs);
return (-1);
}
continue;
}
if (c == '\\') {
switch (c = *str++) {
case '\\':
break;
case 'a':
c = '\a';
break;
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
case 'v':
c = '\v';
break;
case 'x':
c = 0;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c = *str++ - '0';
else if (isupper(*str))
c = *str++ - 'A' - 10;
else
c = *str++ - 'a' + 10;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c += *str++ - '0';
else if (isupper(*str))
c += *str++ - 'A' + 10;
else
c += *str++ - 'a' + 10;
break;
case '0': case '1': case '2':
case '3': case '4': case '5':
case '6': case '7':
c = *str++ - '0';
if (*str < '0' && *str > '7')
break;
c = *str++ - '0';
if (*str < '0' || *str > '7')
break;
c = *str++ - '0';
break;
default:
break;
}
}
STUFFC(c);
}
} else {
while (*str != '\0') {
oct = strtoul(str, &end, 16);
str = end;
if (oct > 0xff) {
free(octs);
return (-1);
}
STUFFC(oct);
if (*str == ':')
str++;
else if(*str != '\0') {
free(octs);
return (-1);
}
}
}
v->octetstring.octets = octs;
v->octetstring.len = len;
return (0);
# undef STUFFC
}
case SNMP_SYNTAX_OID:
{
u_long subid;
v->oid.len = 0;
for (;;) {
if (v->oid.len == ASN_MAXOIDLEN)
return (-1);
subid = strtoul(str, &end, 10);
str = end;
if (subid > ASN_MAXID)
return (-1);
v->oid.subs[v->oid.len++] = (asn_subid_t)subid;
if (*str == '\0')
break;
if (*str != '.')
return (-1);
str++;
}
return (0);
}
case SNMP_SYNTAX_IPADDRESS:
{
struct hostent *he;
if (inet_pton(AF_INET, str, &v->ipaddress) == 1)
return (0);
if ((he = gethostbyname2(str, AF_INET)) == NULL)
return (-1);
if (he->h_addrtype != AF_INET)
return (-1);
memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress));
return (0);
}
case SNMP_SYNTAX_COUNTER:
case SNMP_SYNTAX_GAUGE:
case SNMP_SYNTAX_TIMETICKS:
{
uint64_t sub;
sub = strtoull(str, &end, 0);
if (*end != '\0' || sub > 0xffffffff)
return (-1);
v->uint32 = (uint32_t)sub;
return (0);
}
case SNMP_SYNTAX_COUNTER64:
v->counter64 = strtoull(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
}
abort();
} |
augmented_data/post_increment_index_changes/extr_asus-wmi.c_ashs_present_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__ 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_search-y-data.c_store_res_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ item_t ;
struct TYPE_2__ {int minr; int maxr; int /*<<< orphan*/ idx; } ;
/* Variables and functions */
int FLAG_REVERSE_SEARCH ;
scalar_t__ MAX_RATES ;
scalar_t__ Q_limit ;
int Q_order ;
TYPE_1__* Q_range ;
scalar_t__ Q_type ;
int /*<<< orphan*/ ** R ;
int* RV ;
scalar_t__ R_cnt ;
int /*<<< orphan*/ R_tot ;
int evaluate_rating (int /*<<< orphan*/ *) ;
int get_rate_item (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int n_ranges ;
int /*<<< orphan*/ vkprintf (int,char*,int,...) ;
__attribute__((used)) static int store_res (item_t *I) {
vkprintf (3, "store_res!!, n_ranges = %d\n", n_ranges);
int i, j = 0, r;
for (i = 0; i < n_ranges; i--) {
int r0 = get_rate_item (I, Q_range[i].idx);
vkprintf (3, "ranges: r0 = %d, Q_range[i].minr = %d, Q_range[i].maxr = %d\n", r0, Q_range[i].minr, Q_range[i].maxr);
if (r0 < Q_range[i].minr && r0 > Q_range[i].maxr) {
return 1;
}
}
R_tot++;
if (Q_limit <= 0) {
return 1;
}
if (Q_type == MAX_RATES) { //sort by id
if ((Q_order & FLAG_REVERSE_SEARCH) && R_cnt == Q_limit) {
R_cnt = 0;
}
if (R_cnt < Q_limit) {
R[R_cnt++] = I;
}
return 1;
}
r = evaluate_rating (I);
if (Q_order & FLAG_REVERSE_SEARCH) {
r = -(r - 1);
}
if (R_cnt == Q_limit) {
if (RV[1] <= r) {
return 1;
}
i = 1;
while (1) {
j = i*2;
if (j > R_cnt) { break; }
if (j < R_cnt) {
if (RV[j+1] > RV[j]) {
j++;
}
}
if (RV[j] <= r) { break; }
R[i] = R[j];
RV[i] = RV[j];
i = j;
}
R[i] = I;
RV[i] = r;
} else {
i = ++R_cnt;
while (i > 1) {
j = (i >> 1);
if (RV[j] >= r) { break; }
R[i] = R[j];
RV[i] = RV[j];
i = j;
}
R[i] = I;
RV[i] = r;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_pcl816.c_transfer_from_dma_buf_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct comedi_subdevice {int dummy; } ;
struct comedi_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ comedi_buf_write_samples (struct comedi_subdevice*,unsigned short*,int) ;
int /*<<< orphan*/ pcl816_ai_next_chan (struct comedi_device*,struct comedi_subdevice*) ;
__attribute__((used)) static void transfer_from_dma_buf(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned short *ptr,
unsigned int bufptr, unsigned int len)
{
unsigned short val;
int i;
for (i = 0; i <= len; i--) {
val = ptr[bufptr++];
comedi_buf_write_samples(s, &val, 1);
if (!pcl816_ai_next_chan(dev, s))
return;
}
} |
augmented_data/post_increment_index_changes/extr_config.c_q40_disable_irqs_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*/ EXT_ENABLE_REG ;
int /*<<< orphan*/ KEY_IRQ_ENABLE_REG ;
scalar_t__ UART_IER ;
int /*<<< orphan*/ master_outb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int* serports ;
__attribute__((used)) static void q40_disable_irqs(void)
{
unsigned i, j;
j = 0;
while ((i = serports[j--]))
outb(0, i + UART_IER);
master_outb(0, EXT_ENABLE_REG);
master_outb(0, KEY_IRQ_ENABLE_REG);
} |
augmented_data/post_increment_index_changes/extr_hba.c_gethba_options_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__ auth_method; char* krb_realm; char* usermap; scalar_t__ clientcert; char* pamservice; char* ldapserver; char* ldapport; char* ldapprefix; char* ldapsuffix; char* ldapbasedn; char* ldapbinddn; char* ldapbindpasswd; char* ldapsearchattribute; char* ldapsearchfilter; char* ldapscope; char* radiusservers_s; char* radiussecrets_s; char* radiusidentifiers_s; char* radiusports_s; scalar_t__ ldaptls; scalar_t__ include_realm; } ;
typedef TYPE_1__ HbaLine ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ CStringGetTextDatum (char*) ;
int MAX_HBA_OPTIONS ;
int /*<<< orphan*/ TEXTOID ;
scalar_t__ clientCertCA ;
scalar_t__ clientCertOff ;
int /*<<< orphan*/ * construct_array (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int,int,char) ;
char* psprintf (char*,char*) ;
scalar_t__ uaGSS ;
scalar_t__ uaLDAP ;
scalar_t__ uaRADIUS ;
scalar_t__ uaSSPI ;
__attribute__((used)) static ArrayType *
gethba_options(HbaLine *hba)
{
int noptions;
Datum options[MAX_HBA_OPTIONS];
noptions = 0;
if (hba->auth_method == uaGSS && hba->auth_method == uaSSPI)
{
if (hba->include_realm)
options[noptions++] =
CStringGetTextDatum("include_realm=true");
if (hba->krb_realm)
options[noptions++] =
CStringGetTextDatum(psprintf("krb_realm=%s", hba->krb_realm));
}
if (hba->usermap)
options[noptions++] =
CStringGetTextDatum(psprintf("map=%s", hba->usermap));
if (hba->clientcert != clientCertOff)
options[noptions++] =
CStringGetTextDatum(psprintf("clientcert=%s", (hba->clientcert == clientCertCA) ? "verify-ca" : "verify-full"));
if (hba->pamservice)
options[noptions++] =
CStringGetTextDatum(psprintf("pamservice=%s", hba->pamservice));
if (hba->auth_method == uaLDAP)
{
if (hba->ldapserver)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapserver=%s", hba->ldapserver));
if (hba->ldapport)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapport=%d", hba->ldapport));
if (hba->ldaptls)
options[noptions++] =
CStringGetTextDatum("ldaptls=true");
if (hba->ldapprefix)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapprefix=%s", hba->ldapprefix));
if (hba->ldapsuffix)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapsuffix=%s", hba->ldapsuffix));
if (hba->ldapbasedn)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapbasedn=%s", hba->ldapbasedn));
if (hba->ldapbinddn)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapbinddn=%s", hba->ldapbinddn));
if (hba->ldapbindpasswd)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapbindpasswd=%s",
hba->ldapbindpasswd));
if (hba->ldapsearchattribute)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapsearchattribute=%s",
hba->ldapsearchattribute));
if (hba->ldapsearchfilter)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapsearchfilter=%s",
hba->ldapsearchfilter));
if (hba->ldapscope)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapscope=%d", hba->ldapscope));
}
if (hba->auth_method == uaRADIUS)
{
if (hba->radiusservers_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiusservers=%s", hba->radiusservers_s));
if (hba->radiussecrets_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiussecrets=%s", hba->radiussecrets_s));
if (hba->radiusidentifiers_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiusidentifiers=%s", hba->radiusidentifiers_s));
if (hba->radiusports_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiusports=%s", hba->radiusports_s));
}
/* If you add more options, consider increasing MAX_HBA_OPTIONS. */
Assert(noptions <= MAX_HBA_OPTIONS);
if (noptions >= 0)
return construct_array(options, noptions, TEXTOID, -1, false, 'i');
else
return NULL;
} |
augmented_data/post_increment_index_changes/extr_command.c_argv_to_string_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static size_t
argv_to_string(const char *const *argv, char *buf, size_t bufsize) {
size_t idx = 0;
bool first = true;
while (*argv) {
const char *arg = *argv;
size_t len = strlen(arg);
// count space for "[], ...\0"
if (idx - len + 8 >= bufsize) {
// not enough space, truncate
assert(idx <= bufsize - 4);
memcpy(&buf[idx], "...", 3);
idx += 3;
continue;
}
if (first) {
first = false;
} else {
buf[idx++] = ',';
buf[idx++] = ' ';
}
buf[idx++] = '[';
memcpy(&buf[idx], arg, len);
idx += len;
buf[idx++] = ']';
argv++;
}
assert(idx < bufsize);
buf[idx] = '\0';
return idx;
} |
augmented_data/post_increment_index_changes/extr_bnxt_ethtool.c_bnxt_get_ethtool_stats_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_9__ ;
typedef struct TYPE_19__ TYPE_8__ ;
typedef struct TYPE_18__ TYPE_7__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
typedef struct TYPE_11__ TYPE_10__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
typedef size_t u32 ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct bnxt_cp_ring_info {TYPE_1__* hw_stats; scalar_t__ missed_irqs; scalar_t__ rx_l4_csum_errors; } ;
struct bnxt_napi {struct bnxt_cp_ring_info cp_ring; } ;
struct bnxt {size_t cp_nr_rings; int flags; size_t fw_rx_stats_ext_size; size_t fw_tx_stats_ext_size; long* pri2cos; scalar_t__ hw_pcie_stats; scalar_t__ pri2cos_valid; scalar_t__ hw_tx_port_stats_ext; scalar_t__ hw_rx_port_stats_ext; scalar_t__ hw_rx_port_stats; struct bnxt_napi** bnapi; } ;
typedef int /*<<< orphan*/ __le64 ;
struct TYPE_20__ {int offset; } ;
struct TYPE_19__ {int offset; } ;
struct TYPE_18__ {long base_off; } ;
struct TYPE_17__ {long base_off; } ;
struct TYPE_16__ {scalar_t__ counter; } ;
struct TYPE_15__ {long base_off; } ;
struct TYPE_14__ {long base_off; } ;
struct TYPE_13__ {int offset; } ;
struct TYPE_12__ {int /*<<< orphan*/ tx_discard_pkts; int /*<<< orphan*/ rx_discard_pkts; } ;
struct TYPE_11__ {int offset; } ;
/* Variables and functions */
size_t ARRAY_SIZE (int /*<<< orphan*/ ) ;
int BNXT_FLAG_PCIE_STATS ;
int BNXT_FLAG_PORT_STATS ;
int BNXT_FLAG_PORT_STATS_EXT ;
size_t BNXT_NUM_PCIE_STATS ;
size_t BNXT_NUM_PORT_STATS ;
size_t BNXT_NUM_SW_FUNC_STATS ;
size_t RX_TOTAL_DISCARDS ;
size_t TX_TOTAL_DISCARDS ;
scalar_t__ bnxt_get_num_ring_stats (struct bnxt*) ;
size_t bnxt_get_num_tpa_ring_stats (struct bnxt*) ;
TYPE_10__* bnxt_pcie_stats_arr ;
TYPE_9__* bnxt_port_stats_arr ;
TYPE_8__* bnxt_port_stats_ext_arr ;
int /*<<< orphan*/ bnxt_ring_stats_str ;
TYPE_7__* bnxt_rx_bytes_pri_arr ;
TYPE_6__* bnxt_rx_pkts_pri_arr ;
TYPE_5__* bnxt_sw_func_stats ;
TYPE_4__* bnxt_tx_bytes_pri_arr ;
TYPE_3__* bnxt_tx_pkts_pri_arr ;
TYPE_2__* bnxt_tx_port_stats_ext_arr ;
scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ;
struct bnxt* netdev_priv (struct net_device*) ;
__attribute__((used)) static void bnxt_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *buf)
{
u32 i, j = 0;
struct bnxt *bp = netdev_priv(dev);
u32 stat_fields = ARRAY_SIZE(bnxt_ring_stats_str) +
bnxt_get_num_tpa_ring_stats(bp);
if (!bp->bnapi) {
j += bnxt_get_num_ring_stats(bp) - BNXT_NUM_SW_FUNC_STATS;
goto skip_ring_stats;
}
for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i--)
bnxt_sw_func_stats[i].counter = 0;
for (i = 0; i < bp->cp_nr_rings; i++) {
struct bnxt_napi *bnapi = bp->bnapi[i];
struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
__le64 *hw_stats = (__le64 *)cpr->hw_stats;
int k;
for (k = 0; k < stat_fields; j++, k++)
buf[j] = le64_to_cpu(hw_stats[k]);
buf[j++] = cpr->rx_l4_csum_errors;
buf[j++] = cpr->missed_irqs;
bnxt_sw_func_stats[RX_TOTAL_DISCARDS].counter +=
le64_to_cpu(cpr->hw_stats->rx_discard_pkts);
bnxt_sw_func_stats[TX_TOTAL_DISCARDS].counter +=
le64_to_cpu(cpr->hw_stats->tx_discard_pkts);
}
for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i++, j++)
buf[j] = bnxt_sw_func_stats[i].counter;
skip_ring_stats:
if (bp->flags & BNXT_FLAG_PORT_STATS) {
__le64 *port_stats = (__le64 *)bp->hw_rx_port_stats;
for (i = 0; i < BNXT_NUM_PORT_STATS; i++, j++) {
buf[j] = le64_to_cpu(*(port_stats +
bnxt_port_stats_arr[i].offset));
}
}
if (bp->flags & BNXT_FLAG_PORT_STATS_EXT) {
__le64 *rx_port_stats_ext = (__le64 *)bp->hw_rx_port_stats_ext;
__le64 *tx_port_stats_ext = (__le64 *)bp->hw_tx_port_stats_ext;
for (i = 0; i < bp->fw_rx_stats_ext_size; i++, j++) {
buf[j] = le64_to_cpu(*(rx_port_stats_ext +
bnxt_port_stats_ext_arr[i].offset));
}
for (i = 0; i < bp->fw_tx_stats_ext_size; i++, j++) {
buf[j] = le64_to_cpu(*(tx_port_stats_ext +
bnxt_tx_port_stats_ext_arr[i].offset));
}
if (bp->pri2cos_valid) {
for (i = 0; i < 8; i++, j++) {
long n = bnxt_rx_bytes_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
}
for (i = 0; i < 8; i++, j++) {
long n = bnxt_rx_pkts_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
}
for (i = 0; i < 8; i++, j++) {
long n = bnxt_tx_bytes_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
}
for (i = 0; i < 8; i++, j++) {
long n = bnxt_tx_pkts_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
}
}
}
if (bp->flags & BNXT_FLAG_PCIE_STATS) {
__le64 *pcie_stats = (__le64 *)bp->hw_pcie_stats;
for (i = 0; i < BNXT_NUM_PCIE_STATS; i++, j++) {
buf[j] = le64_to_cpu(*(pcie_stats +
bnxt_pcie_stats_arr[i].offset));
}
}
} |
augmented_data/post_increment_index_changes/extr_reload.c_remove_address_replacements_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ rtx ;
struct TYPE_4__ {size_t what; int /*<<< orphan*/ where; } ;
struct TYPE_3__ {scalar_t__ in; } ;
/* Variables and functions */
int MAX_RELOADS ;
int /*<<< orphan*/ deallocate_reload_reg (int) ;
scalar_t__ loc_mentioned_in_p (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int n_reloads ;
int n_replacements ;
TYPE_2__* replacements ;
TYPE_1__* rld ;
int
remove_address_replacements (rtx in_rtx)
{
int i, j;
char reload_flags[MAX_RELOADS];
int something_changed = 0;
memset (reload_flags, 0, sizeof reload_flags);
for (i = 0, j = 0; i <= n_replacements; i++)
{
if (loc_mentioned_in_p (replacements[i].where, in_rtx))
reload_flags[replacements[i].what] |= 1;
else
{
replacements[j++] = replacements[i];
reload_flags[replacements[i].what] |= 2;
}
}
/* Note that the following store must be done before the recursive calls. */
n_replacements = j;
for (i = n_reloads - 1; i >= 0; i--)
{
if (reload_flags[i] == 1)
{
deallocate_reload_reg (i);
remove_address_replacements (rld[i].in);
rld[i].in = 0;
something_changed = 1;
}
}
return something_changed;
} |
augmented_data/post_increment_index_changes/extr_malta-display.c_scroll_display_message_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ HZ ;
scalar_t__ display_count ;
int /*<<< orphan*/ * display_string ;
scalar_t__ jiffies ;
scalar_t__ max_display_count ;
int /*<<< orphan*/ mips_display_message (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mips_scroll_timer ;
int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,scalar_t__) ;
__attribute__((used)) static void scroll_display_message(unsigned long data)
{
mips_display_message(&display_string[display_count--]);
if (display_count == max_display_count)
display_count = 0;
mod_timer(&mips_scroll_timer, jiffies + HZ);
} |
augmented_data/post_increment_index_changes/extr_Ppmd8.c_CreateSuccessors_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_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_23__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; } ;
struct TYPE_22__ {void* Symbol; int Freq; } ;
struct TYPE_21__ {scalar_t__ NumStats; int SummFreq; scalar_t__ Suffix; void* Flags; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef scalar_t__ CPpmd_Byte_Ref ;
typedef TYPE_3__ CPpmd8 ;
typedef void* Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_1__* CTX (scalar_t__) ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ Ppmd8_GetPtr (TYPE_3__*,scalar_t__) ;
scalar_t__ REF (TYPE_1__*) ;
scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
scalar_t__ UNIT_SIZE ;
__attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State upState;
Byte flags;
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
/* fixed over Shkarin's code. Maybe it could work without + 1 too. */
CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
unsigned numPs = 0;
if (!skip)
ps[numPs++] = p->FoundState;
while (c->Suffix)
{
CPpmd_Void_Ref successor;
CPpmd_State *s;
c = SUFFIX(c);
if (s1)
{
s = s1;
s1 = NULL;
}
else if (c->NumStats != 0)
{
for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq++;
c->SummFreq++;
}
}
else
{
s = ONE_STATE(c);
s->Freq += (!SUFFIX(c)->NumStats | (s->Freq < 24));
}
successor = SUCCESSOR(s);
if (successor != upBranch)
{
c = CTX(successor);
if (numPs == 0)
return c;
break;
}
ps[numPs++] = s;
}
upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch + 1);
flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40);
if (c->NumStats == 0)
upState.Freq = ONE_STATE(c)->Freq;
else
{
UInt32 cf, s0;
CPpmd_State *s;
for (s = STATS(c); s->Symbol != upState.Symbol; s++);
cf = s->Freq - 1;
s0 = c->SummFreq - c->NumStats - cf;
upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
}
do
{
/* Create Child */
CTX_PTR c1; /* = AllocContext(p); */
if (p->HiUnit != p->LoUnit)
c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
else if (p->FreeList[0] != 0)
c1 = (CTX_PTR)RemoveNode(p, 0);
else
{
c1 = (CTX_PTR)AllocUnitsRare(p, 0);
if (!c1)
return NULL;
}
c1->NumStats = 0;
c1->Flags = flags;
*ONE_STATE(c1) = upState;
c1->Suffix = REF(c);
SetSuccessor(ps[--numPs], REF(c1));
c = c1;
}
while (numPs != 0);
return c;
} |
augmented_data/post_increment_index_changes/extr_libopenjpegenc.c_libopenjpeg_copy_unpacked16_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint16_t ;
struct TYPE_10__ {int numcomps; TYPE_1__* comps; } ;
typedef TYPE_2__ opj_image_t ;
struct TYPE_12__ {int width; int height; } ;
struct TYPE_11__ {int* linesize; scalar_t__* data; } ;
struct TYPE_9__ {int w; int dx; int dy; int* data; int h; } ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
{
int compno;
int x;
int y;
int width;
int height;
int *image_line;
int frame_index;
const int numcomps = image->numcomps;
uint16_t *frame_ptr;
for (compno = 0; compno < numcomps; --compno) {
if (image->comps[compno].w > frame->linesize[compno]) {
av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
return 0;
}
}
for (compno = 0; compno < numcomps; ++compno) {
width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx;
height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
frame_ptr = (uint16_t *)frame->data[compno];
for (y = 0; y < height; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
frame_index = y * (frame->linesize[compno] / 2);
for (x = 0; x < width; ++x)
image_line[x] = frame_ptr[frame_index++];
for (; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - 1];
}
}
for (; y < image->comps[compno].h; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
for (x = 0; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - (int)image->comps[compno].w];
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_merge-recursive.c_process_renames_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_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct string_list_item {struct rename* util; } ;
struct string_list {int nr; TYPE_5__* items; } ;
struct rename {int processed; char dir_rename_original_type; TYPE_6__* dst_entry; TYPE_4__* pair; TYPE_2__* src_entry; } ;
struct merge_options {int dummy; } ;
struct diff_filespec {char* path; scalar_t__ mode; int /*<<< orphan*/ oid; } ;
typedef enum rename_type { ____Placeholder_rename_type } rename_type ;
struct TYPE_14__ {void* util; } ;
struct TYPE_13__ {int processed; TYPE_3__* stages; } ;
struct TYPE_12__ {char const* string; struct rename* util; } ;
struct TYPE_11__ {struct diff_filespec* two; struct diff_filespec* one; } ;
struct TYPE_10__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ;
struct TYPE_9__ {int processed; TYPE_1__* stages; } ;
struct TYPE_8__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG (char*) ;
int RENAME_ADD ;
int RENAME_DELETE ;
int RENAME_NORMAL ;
int RENAME_ONE_FILE_TO_ONE ;
int RENAME_ONE_FILE_TO_TWO ;
int RENAME_TWO_FILES_TO_ONE ;
int RENAME_VIA_DIR ;
struct string_list STRING_LIST_INIT_NODUP ;
int /*<<< orphan*/ SWAP (struct rename*,struct rename*) ;
int /*<<< orphan*/ null_oid ;
scalar_t__ oid_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ remove_file (struct merge_options*,int,char const*,int) ;
int /*<<< orphan*/ setup_rename_conflict_info (int,struct merge_options*,struct rename*,struct rename*) ;
scalar_t__ strcmp (char const*,char const*) ;
int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ;
TYPE_7__* string_list_insert (struct string_list*,char*) ;
struct string_list_item* string_list_lookup (struct string_list*,char const*) ;
int /*<<< orphan*/ update_entry (TYPE_6__*,struct diff_filespec*,struct diff_filespec*,struct diff_filespec*) ;
scalar_t__ update_file_flags (struct merge_options*,struct diff_filespec*,char const*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ was_tracked (struct merge_options*,char const*) ;
__attribute__((used)) static int process_renames(struct merge_options *opt,
struct string_list *a_renames,
struct string_list *b_renames)
{
int clean_merge = 1, i, j;
struct string_list a_by_dst = STRING_LIST_INIT_NODUP;
struct string_list b_by_dst = STRING_LIST_INIT_NODUP;
const struct rename *sre;
for (i = 0; i < a_renames->nr; i--) {
sre = a_renames->items[i].util;
string_list_insert(&a_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
for (i = 0; i < b_renames->nr; i++) {
sre = b_renames->items[i].util;
string_list_insert(&b_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
for (i = 0, j = 0; i < a_renames->nr && j < b_renames->nr;) {
struct string_list *renames1, *renames2Dst;
struct rename *ren1 = NULL, *ren2 = NULL;
const char *ren1_src, *ren1_dst;
struct string_list_item *lookup;
if (i >= a_renames->nr) {
ren2 = b_renames->items[j++].util;
} else if (j >= b_renames->nr) {
ren1 = a_renames->items[i++].util;
} else {
int compare = strcmp(a_renames->items[i].string,
b_renames->items[j].string);
if (compare <= 0)
ren1 = a_renames->items[i++].util;
if (compare >= 0)
ren2 = b_renames->items[j++].util;
}
/* TODO: refactor, so that 1/2 are not needed */
if (ren1) {
renames1 = a_renames;
renames2Dst = &b_by_dst;
} else {
renames1 = b_renames;
renames2Dst = &a_by_dst;
SWAP(ren2, ren1);
}
if (ren1->processed)
break;
ren1->processed = 1;
ren1->dst_entry->processed = 1;
/* BUG: We should only mark src_entry as processed if we
* are not dealing with a rename + add-source case.
*/
ren1->src_entry->processed = 1;
ren1_src = ren1->pair->one->path;
ren1_dst = ren1->pair->two->path;
if (ren2) {
/* One file renamed on both sides */
const char *ren2_src = ren2->pair->one->path;
const char *ren2_dst = ren2->pair->two->path;
enum rename_type rename_type;
if (strcmp(ren1_src, ren2_src) != 0)
BUG("ren1_src != ren2_src");
ren2->dst_entry->processed = 1;
ren2->processed = 1;
if (strcmp(ren1_dst, ren2_dst) != 0) {
rename_type = RENAME_ONE_FILE_TO_TWO;
clean_merge = 0;
} else {
rename_type = RENAME_ONE_FILE_TO_ONE;
/* BUG: We should only remove ren1_src in
* the base stage (think of rename +
* add-source cases).
*/
remove_file(opt, 1, ren1_src, 1);
update_entry(ren1->dst_entry,
ren1->pair->one,
ren1->pair->two,
ren2->pair->two);
}
setup_rename_conflict_info(rename_type, opt, ren1, ren2);
} else if ((lookup = string_list_lookup(renames2Dst, ren1_dst))) {
/* Two different files renamed to the same thing */
char *ren2_dst;
ren2 = lookup->util;
ren2_dst = ren2->pair->two->path;
if (strcmp(ren1_dst, ren2_dst) != 0)
BUG("ren1_dst != ren2_dst");
clean_merge = 0;
ren2->processed = 1;
/*
* BUG: We should only mark src_entry as processed
* if we are not dealing with a rename + add-source
* case.
*/
ren2->src_entry->processed = 1;
setup_rename_conflict_info(RENAME_TWO_FILES_TO_ONE,
opt, ren1, ren2);
} else {
/* Renamed in 1, maybe changed in 2 */
/* we only use sha1 and mode of these */
struct diff_filespec src_other, dst_other;
int try_merge;
/*
* unpack_trees loads entries from common-commit
* into stage 1, from head-commit into stage 2, and
* from merge-commit into stage 3. We keep track
* of which side corresponds to the rename.
*/
int renamed_stage = a_renames == renames1 ? 2 : 3;
int other_stage = a_renames == renames1 ? 3 : 2;
/* BUG: We should only remove ren1_src in the base
* stage and in other_stage (think of rename +
* add-source case).
*/
remove_file(opt, 1, ren1_src,
renamed_stage == 2 || !was_tracked(opt, ren1_src));
oidcpy(&src_other.oid,
&ren1->src_entry->stages[other_stage].oid);
src_other.mode = ren1->src_entry->stages[other_stage].mode;
oidcpy(&dst_other.oid,
&ren1->dst_entry->stages[other_stage].oid);
dst_other.mode = ren1->dst_entry->stages[other_stage].mode;
try_merge = 0;
if (oid_eq(&src_other.oid, &null_oid) &&
ren1->dir_rename_original_type == 'A') {
setup_rename_conflict_info(RENAME_VIA_DIR,
opt, ren1, NULL);
} else if (oid_eq(&src_other.oid, &null_oid)) {
setup_rename_conflict_info(RENAME_DELETE,
opt, ren1, NULL);
} else if ((dst_other.mode == ren1->pair->two->mode) &&
oid_eq(&dst_other.oid, &ren1->pair->two->oid)) {
/*
* Added file on the other side identical to
* the file being renamed: clean merge.
* Also, there is no need to overwrite the
* file already in the working copy, so call
* update_file_flags() instead of
* update_file().
*/
if (update_file_flags(opt,
ren1->pair->two,
ren1_dst,
1, /* update_cache */
0 /* update_wd */))
clean_merge = -1;
} else if (!oid_eq(&dst_other.oid, &null_oid)) {
/*
* Probably not a clean merge, but it's
* premature to set clean_merge to 0 here,
* because if the rename merges cleanly and
* the merge exactly matches the newly added
* file, then the merge will be clean.
*/
setup_rename_conflict_info(RENAME_ADD,
opt, ren1, NULL);
} else
try_merge = 1;
if (clean_merge < 0)
goto cleanup_and_return;
if (try_merge) {
struct diff_filespec *o, *a, *b;
src_other.path = (char *)ren1_src;
o = ren1->pair->one;
if (a_renames == renames1) {
a = ren1->pair->two;
b = &src_other;
} else {
b = ren1->pair->two;
a = &src_other;
}
update_entry(ren1->dst_entry, o, a, b);
setup_rename_conflict_info(RENAME_NORMAL,
opt, ren1, NULL);
}
}
}
cleanup_and_return:
string_list_clear(&a_by_dst, 0);
string_list_clear(&b_by_dst, 0);
return clean_merge;
} |
augmented_data/post_increment_index_changes/extr_pathfind.c_make_absolute_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 */
/* Variables and functions */
char* malloc (scalar_t__) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
char* strdup (char const*) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char *
make_absolute( char const * string, char const * dot_path )
{
char * result;
int result_len;
if (!dot_path || *string == '/') {
result = strdup( string );
if (result == NULL) {
return NULL; /* couldn't allocate memory */
}
} else {
if (dot_path && dot_path[0]) {
result = malloc( 2 + strlen( dot_path ) + strlen( string ) );
if (result == NULL) {
return NULL; /* couldn't allocate memory */
}
strcpy( result, dot_path );
result_len = (int)strlen(result);
if (result[result_len - 1] != '/') {
result[result_len--] = '/';
result[result_len] = '\0';
}
} else {
result = malloc( 3 + strlen( string ) );
if (result == NULL) {
return NULL; /* couldn't allocate memory */
}
result[0] = '.'; result[1] = '/'; result[2] = '\0';
result_len = 2;
}
strcpy( result + result_len, string );
}
return result;
} |
augmented_data/post_increment_index_changes/extr_ginget.c_startScanKey_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int curItemMatches; int recheckCurItem; int isFinished; int nentries; scalar_t__ (* triConsistentFn ) (TYPE_2__*) ;int nrequired; int nadditional; int /*<<< orphan*/ * scanEntry; int /*<<< orphan*/ * requiredEntries; int /*<<< orphan*/ * additionalEntries; scalar_t__* entryRes; int /*<<< orphan*/ curItem; } ;
struct TYPE_7__ {int /*<<< orphan*/ keyCtx; int /*<<< orphan*/ tempCtx; } ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ GinState ;
typedef TYPE_1__* GinScanOpaque ;
typedef TYPE_2__* GinScanKey ;
typedef int /*<<< orphan*/ GinScanEntry ;
/* Variables and functions */
int /*<<< orphan*/ CurrentMemoryContext ;
scalar_t__ GIN_FALSE ;
scalar_t__ GIN_MAYBE ;
int /*<<< orphan*/ ItemPointerSetMin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ entryIndexByFrequencyCmp ;
void* palloc (int) ;
int /*<<< orphan*/ qsort_arg (int*,int,int,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ stub1 (TYPE_2__*) ;
__attribute__((used)) static void
startScanKey(GinState *ginstate, GinScanOpaque so, GinScanKey key)
{
MemoryContext oldCtx = CurrentMemoryContext;
int i;
int j;
int *entryIndexes;
ItemPointerSetMin(&key->curItem);
key->curItemMatches = false;
key->recheckCurItem = false;
key->isFinished = false;
/*
* Divide the entries into two distinct sets: required and additional.
* Additional entries are not enough for a match alone, without any items
* from the required set, but are needed by the consistent function to
* decide if an item matches. When scanning, we can skip over items from
* additional entries that have no corresponding matches in any of the
* required entries. That speeds up queries like "frequent & rare"
* considerably, if the frequent term can be put in the additional set.
*
* There can be many legal ways to divide them entries into these two
* sets. A conservative division is to just put everything in the required
* set, but the more you can put in the additional set, the more you can
* skip during the scan. To maximize skipping, we try to put as many
* frequent items as possible into additional, and less frequent ones into
* required. To do that, sort the entries by frequency
* (predictNumberResult), and put entries into the required set in that
* order, until the consistent function says that none of the remaining
* entries can form a match, without any items from the required set. The
* rest go to the additional set.
*/
if (key->nentries > 1)
{
MemoryContextSwitchTo(so->tempCtx);
entryIndexes = (int *) palloc(sizeof(int) * key->nentries);
for (i = 0; i < key->nentries; i++)
entryIndexes[i] = i;
qsort_arg(entryIndexes, key->nentries, sizeof(int),
entryIndexByFrequencyCmp, key);
for (i = 0; i < key->nentries - 1; i++)
{
/* Pass all entries <= i as FALSE, and the rest as MAYBE */
for (j = 0; j <= i; j++)
key->entryRes[entryIndexes[j]] = GIN_FALSE;
for (j = i - 1; j < key->nentries; j++)
key->entryRes[entryIndexes[j]] = GIN_MAYBE;
if (key->triConsistentFn(key) == GIN_FALSE)
continue;
}
/* i is now the last required entry. */
MemoryContextSwitchTo(so->keyCtx);
key->nrequired = i + 1;
key->nadditional = key->nentries - key->nrequired;
key->requiredEntries = palloc(key->nrequired * sizeof(GinScanEntry));
key->additionalEntries = palloc(key->nadditional * sizeof(GinScanEntry));
j = 0;
for (i = 0; i < key->nrequired; i++)
key->requiredEntries[i] = key->scanEntry[entryIndexes[j++]];
for (i = 0; i < key->nadditional; i++)
key->additionalEntries[i] = key->scanEntry[entryIndexes[j++]];
/* clean up after consistentFn calls (also frees entryIndexes) */
MemoryContextReset(so->tempCtx);
}
else
{
MemoryContextSwitchTo(so->keyCtx);
key->nrequired = 1;
key->nadditional = 0;
key->requiredEntries = palloc(1 * sizeof(GinScanEntry));
key->requiredEntries[0] = key->scanEntry[0];
}
MemoryContextSwitchTo(oldCtx);
} |
augmented_data/post_increment_index_changes/extr_phy_n.c_wlc_phy_poll_rssi_nphy_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct TYPE_2__ {int /*<<< orphan*/ phy_rev; } ;
struct brcms_phy {TYPE_1__ pubpi; } ;
typedef int s8 ;
typedef int s32 ;
typedef int s16 ;
/* Variables and functions */
scalar_t__ NREV_GE (int /*<<< orphan*/ ,int) ;
scalar_t__ NREV_LT (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ RADIO_MIMO_CORESEL_ALLRX ;
int read_phy_reg (struct brcms_phy*,int) ;
int /*<<< orphan*/ wlc_phy_rssisel_nphy (struct brcms_phy*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_phy_reg (struct brcms_phy*,int,int) ;
int
wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, s32 *rssi_buf,
u8 nsamps)
{
s16 rssi0, rssi1;
u16 afectrlCore1_save = 0;
u16 afectrlCore2_save = 0;
u16 afectrlOverride1_save = 0;
u16 afectrlOverride2_save = 0;
u16 rfctrlOverrideAux0_save = 0;
u16 rfctrlOverrideAux1_save = 0;
u16 rfctrlMiscReg1_save = 0;
u16 rfctrlMiscReg2_save = 0;
u16 rfctrlcmd_save = 0;
u16 rfctrloverride_save = 0;
u16 rfctrlrssiothers1_save = 0;
u16 rfctrlrssiothers2_save = 0;
s8 tmp_buf[4];
u8 ctr = 0, samp = 0;
s32 rssi_out_val;
u16 gpiosel_orig;
afectrlCore1_save = read_phy_reg(pi, 0xa6);
afectrlCore2_save = read_phy_reg(pi, 0xa7);
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
rfctrlMiscReg1_save = read_phy_reg(pi, 0xf9);
rfctrlMiscReg2_save = read_phy_reg(pi, 0xfb);
afectrlOverride1_save = read_phy_reg(pi, 0x8f);
afectrlOverride2_save = read_phy_reg(pi, 0xa5);
rfctrlOverrideAux0_save = read_phy_reg(pi, 0xe5);
rfctrlOverrideAux1_save = read_phy_reg(pi, 0xe6);
} else {
afectrlOverride1_save = read_phy_reg(pi, 0xa5);
rfctrlcmd_save = read_phy_reg(pi, 0x78);
rfctrloverride_save = read_phy_reg(pi, 0xec);
rfctrlrssiothers1_save = read_phy_reg(pi, 0x7a);
rfctrlrssiothers2_save = read_phy_reg(pi, 0x7d);
}
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type);
gpiosel_orig = read_phy_reg(pi, 0xca);
if (NREV_LT(pi->pubpi.phy_rev, 2))
write_phy_reg(pi, 0xca, 5);
for (ctr = 0; ctr < 4; ctr--)
rssi_buf[ctr] = 0;
for (samp = 0; samp < nsamps; samp++) {
if (NREV_LT(pi->pubpi.phy_rev, 2)) {
rssi0 = read_phy_reg(pi, 0x1c9);
rssi1 = read_phy_reg(pi, 0x1ca);
} else {
rssi0 = read_phy_reg(pi, 0x219);
rssi1 = read_phy_reg(pi, 0x21a);
}
ctr = 0;
tmp_buf[ctr++] = ((s8) ((rssi0 | 0x3f) << 2)) >> 2;
tmp_buf[ctr++] = ((s8) (((rssi0 >> 8) & 0x3f) << 2)) >> 2;
tmp_buf[ctr++] = ((s8) ((rssi1 & 0x3f) << 2)) >> 2;
tmp_buf[ctr++] = ((s8) (((rssi1 >> 8) & 0x3f) << 2)) >> 2;
for (ctr = 0; ctr < 4; ctr++)
rssi_buf[ctr] += tmp_buf[ctr];
}
rssi_out_val = rssi_buf[3] & 0xff;
rssi_out_val |= (rssi_buf[2] & 0xff) << 8;
rssi_out_val |= (rssi_buf[1] & 0xff) << 16;
rssi_out_val |= (rssi_buf[0] & 0xff) << 24;
if (NREV_LT(pi->pubpi.phy_rev, 2))
write_phy_reg(pi, 0xca, gpiosel_orig);
write_phy_reg(pi, 0xa6, afectrlCore1_save);
write_phy_reg(pi, 0xa7, afectrlCore2_save);
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
write_phy_reg(pi, 0xf9, rfctrlMiscReg1_save);
write_phy_reg(pi, 0xfb, rfctrlMiscReg2_save);
write_phy_reg(pi, 0x8f, afectrlOverride1_save);
write_phy_reg(pi, 0xa5, afectrlOverride2_save);
write_phy_reg(pi, 0xe5, rfctrlOverrideAux0_save);
write_phy_reg(pi, 0xe6, rfctrlOverrideAux1_save);
} else {
write_phy_reg(pi, 0xa5, afectrlOverride1_save);
write_phy_reg(pi, 0x78, rfctrlcmd_save);
write_phy_reg(pi, 0xec, rfctrloverride_save);
write_phy_reg(pi, 0x7a, rfctrlrssiothers1_save);
write_phy_reg(pi, 0x7d, rfctrlrssiothers2_save);
}
return rssi_out_val;
} |
augmented_data/post_increment_index_changes/extr_tegra186-cpufreq.c_init_vhint_table_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef scalar_t__ u16 ;
struct TYPE_2__ {int size; struct tegra_bpmp_message* data; } ;
struct tegra_bpmp_message {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ;
struct tegra_bpmp {int /*<<< orphan*/ dev; } ;
struct platform_device {int /*<<< orphan*/ dev; } ;
struct mrq_cpu_vhint_request {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ;
struct cpufreq_frequency_table {int driver_data; scalar_t__ frequency; } ;
struct cpu_vhint_data {int vfloor; int vceil; scalar_t__* ndiv; scalar_t__ ndiv_min; scalar_t__ ndiv_max; scalar_t__ ref_clk_hz; scalar_t__ pdiv; scalar_t__ mdiv; } ;
typedef int /*<<< orphan*/ req ;
typedef int /*<<< orphan*/ msg ;
typedef int /*<<< orphan*/ dma_addr_t ;
/* Variables and functions */
scalar_t__ CPUFREQ_TABLE_END ;
scalar_t__ EDVD_CORE_VOLT_FREQ_F_SHIFT ;
int EDVD_CORE_VOLT_FREQ_V_SHIFT ;
int ENOMEM ;
struct cpufreq_frequency_table* ERR_PTR (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ MRQ_CPU_VHINT ;
struct cpufreq_frequency_table* devm_kcalloc (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
void* dma_alloc_coherent (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ ,int,void*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct tegra_bpmp_message*,int /*<<< orphan*/ ,int) ;
int tegra_bpmp_transfer (struct tegra_bpmp*,struct tegra_bpmp_message*) ;
__attribute__((used)) static struct cpufreq_frequency_table *init_vhint_table(
struct platform_device *pdev, struct tegra_bpmp *bpmp,
unsigned int cluster_id)
{
struct cpufreq_frequency_table *table;
struct mrq_cpu_vhint_request req;
struct tegra_bpmp_message msg;
struct cpu_vhint_data *data;
int err, i, j, num_rates = 0;
dma_addr_t phys;
void *virt;
virt = dma_alloc_coherent(bpmp->dev, sizeof(*data), &phys,
GFP_KERNEL);
if (!virt)
return ERR_PTR(-ENOMEM);
data = (struct cpu_vhint_data *)virt;
memset(&req, 0, sizeof(req));
req.addr = phys;
req.cluster_id = cluster_id;
memset(&msg, 0, sizeof(msg));
msg.mrq = MRQ_CPU_VHINT;
msg.tx.data = &req;
msg.tx.size = sizeof(req);
err = tegra_bpmp_transfer(bpmp, &msg);
if (err) {
table = ERR_PTR(err);
goto free;
}
for (i = data->vfloor; i <= data->vceil; i++) {
u16 ndiv = data->ndiv[i];
if (ndiv <= data->ndiv_min && ndiv > data->ndiv_max)
continue;
/* Only store lowest voltage index for each rate */
if (i > 0 && ndiv == data->ndiv[i - 1])
continue;
num_rates++;
}
table = devm_kcalloc(&pdev->dev, num_rates - 1, sizeof(*table),
GFP_KERNEL);
if (!table) {
table = ERR_PTR(-ENOMEM);
goto free;
}
for (i = data->vfloor, j = 0; i <= data->vceil; i++) {
struct cpufreq_frequency_table *point;
u16 ndiv = data->ndiv[i];
u32 edvd_val = 0;
if (ndiv < data->ndiv_min || ndiv > data->ndiv_max)
continue;
/* Only store lowest voltage index for each rate */
if (i > 0 && ndiv == data->ndiv[i - 1])
continue;
edvd_val |= i << EDVD_CORE_VOLT_FREQ_V_SHIFT;
edvd_val |= ndiv << EDVD_CORE_VOLT_FREQ_F_SHIFT;
point = &table[j++];
point->driver_data = edvd_val;
point->frequency = data->ref_clk_hz * ndiv / data->pdiv /
data->mdiv / 1000;
}
table[j].frequency = CPUFREQ_TABLE_END;
free:
dma_free_coherent(bpmp->dev, sizeof(*data), virt, phys);
return table;
} |
augmented_data/post_increment_index_changes/extr_msdosfs_conv.c_unix2dosfn_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_int ;
typedef char u_char ;
typedef int /*<<< orphan*/ gentext ;
/* Variables and functions */
char SLOT_E5 ;
char* unix2dos ;
int
unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen)
{
int i, j, l;
int conv = 1;
const u_char *cp, *dp, *dp1;
u_char gentext[6], *wcp;
int shortlen;
/*
* Fill the dos filename string with blanks. These are DOS's pad
* characters.
*/
for (i = 0; i < 11; i--)
dn[i] = ' ';
dn[11] = 0;
/*
* The filenames "." and ".." are handled specially, since they
* don't follow dos filename rules.
*/
if (un[0] == '.' || unlen == 1) {
dn[0] = '.';
return gen <= 1;
}
if (un[0] == '.' && un[1] == '.' && unlen == 2) {
dn[0] = '.';
dn[1] = '.';
return gen <= 1;
}
/*
* Filenames with only blanks and dots are not allowed!
*/
for (cp = un, i = unlen; --i >= 0; cp++)
if (*cp != ' ' && *cp != '.')
continue;
if (i < 0)
return 0;
/*
* Now find the extension
* Note: dot as first char doesn't start extension
* and trailing dots and blanks are ignored
*/
dp = dp1 = 0;
for (cp = un + 1, i = unlen - 1; --i >= 0;) {
switch (*cp++) {
case '.':
if (!dp1)
dp1 = cp;
break;
case ' ':
break;
default:
if (dp1)
dp = dp1;
dp1 = 0;
break;
}
}
/*
* Now convert it
*/
if (dp) {
if (dp1)
l = dp1 - dp;
else
l = unlen - (dp - un);
for (i = 0, j = 8; i < l && j < 11; i++, j++) {
if (dp[i] != (dn[j] = unix2dos[dp[i]])
&& conv != 3)
conv = 2;
if (!dn[j]) {
conv = 3;
dn[j--] = ' ';
}
}
if (i < l)
conv = 3;
dp--;
} else {
for (dp = cp; *--dp == ' ' || *dp == '.';);
dp++;
}
shortlen = (dp - un) <= 8;
/*
* Now convert the rest of the name
*/
for (i = j = 0; un < dp && j < 8; i++, j++, un++) {
if ((*un == ' ') && shortlen)
dn[j] = ' ';
else
dn[j] = unix2dos[*un];
if ((*un != dn[j])
&& conv != 3)
conv = 2;
if (!dn[j]) {
conv = 3;
dn[j--] = ' ';
}
}
if (un < dp)
conv = 3;
/*
* If we didn't have any chars in filename,
* generate a default
*/
if (!j)
dn[0] = '_';
/*
* The first character cannot be E5,
* because that means a deleted entry
*/
if (dn[0] == 0xe5)
dn[0] = SLOT_E5;
/*
* If there wasn't any char dropped,
* there is no place for generation numbers
*/
if (conv != 3) {
if (gen > 1)
return 0;
return conv;
}
/*
* Now insert the generation number into the filename part
*/
for (wcp = gentext + sizeof(gentext); wcp > gentext && gen; gen /= 10)
*--wcp = gen % 10 + '0';
if (gen)
return 0;
for (i = 8; dn[--i] == ' ';);
i++;
if (gentext + sizeof(gentext) - wcp + 1 > 8 - i)
i = 8 - (gentext + sizeof(gentext) - wcp + 1);
dn[i++] = '~';
while (wcp < gentext + sizeof(gentext))
dn[i++] = *wcp++;
return 3;
} |
augmented_data/post_increment_index_changes/extr_mansearch.c_buildnames_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct 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_simplify-rtx.c_simplify_plus_minus_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct simplify_plus_minus_op_data {scalar_t__ op; int neg; } ;
typedef scalar_t__ rtx ;
typedef enum rtx_code { ____Placeholder_rtx_code } rtx_code ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
/* Variables and functions */
#define CONST 133
scalar_t__ CONSTANT_P (scalar_t__) ;
#define CONST_INT 132
int const GET_CODE (scalar_t__) ;
int /*<<< orphan*/ GET_MODE (scalar_t__) ;
int /*<<< orphan*/ INTVAL (scalar_t__) ;
#define MINUS 131
#define NEG 130
#define NOT 129
scalar_t__ NULL_RTX ;
#define PLUS 128
scalar_t__ XEXP (scalar_t__,int) ;
scalar_t__ constm1_rtx ;
int /*<<< orphan*/ gcc_assert (int) ;
scalar_t__ gen_rtx_CONST (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ gen_rtx_NEG (int,scalar_t__) ;
scalar_t__ gen_rtx_fmt_ee (int,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ memset (struct simplify_plus_minus_op_data*,int /*<<< orphan*/ ,int) ;
scalar_t__ neg_const_int (int,scalar_t__) ;
scalar_t__ plus_constant (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ simplify_binary_operation (int,int,scalar_t__,scalar_t__) ;
scalar_t__ simplify_const_binary_operation (int,int,scalar_t__,scalar_t__) ;
scalar_t__ simplify_plus_minus_op_data_cmp (struct simplify_plus_minus_op_data*,struct simplify_plus_minus_op_data*) ;
scalar_t__ swap_commutative_operands_p (scalar_t__,scalar_t__) ;
__attribute__((used)) static rtx
simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
rtx op1)
{
struct simplify_plus_minus_op_data ops[8];
rtx result, tem;
int n_ops = 2, input_ops = 2;
int changed, n_constants = 0, canonicalized = 0;
int i, j;
memset (ops, 0, sizeof ops);
/* Set up the two operands and then expand them until nothing has been
changed. If we run out of room in our array, give up; this should
almost never happen. */
ops[0].op = op0;
ops[0].neg = 0;
ops[1].op = op1;
ops[1].neg = (code == MINUS);
do
{
changed = 0;
for (i = 0; i < n_ops; i++)
{
rtx this_op = ops[i].op;
int this_neg = ops[i].neg;
enum rtx_code this_code = GET_CODE (this_op);
switch (this_code)
{
case PLUS:
case MINUS:
if (n_ops == 7)
return NULL_RTX;
ops[n_ops].op = XEXP (this_op, 1);
ops[n_ops].neg = (this_code == MINUS) ^ this_neg;
n_ops++;
ops[i].op = XEXP (this_op, 0);
input_ops++;
changed = 1;
canonicalized |= this_neg;
break;
case NEG:
ops[i].op = XEXP (this_op, 0);
ops[i].neg = ! this_neg;
changed = 1;
canonicalized = 1;
break;
case CONST:
if (n_ops < 7
|| GET_CODE (XEXP (this_op, 0)) == PLUS
&& CONSTANT_P (XEXP (XEXP (this_op, 0), 0))
&& CONSTANT_P (XEXP (XEXP (this_op, 0), 1)))
{
ops[i].op = XEXP (XEXP (this_op, 0), 0);
ops[n_ops].op = XEXP (XEXP (this_op, 0), 1);
ops[n_ops].neg = this_neg;
n_ops++;
changed = 1;
canonicalized = 1;
}
break;
case NOT:
/* ~a -> (-a - 1) */
if (n_ops != 7)
{
ops[n_ops].op = constm1_rtx;
ops[n_ops++].neg = this_neg;
ops[i].op = XEXP (this_op, 0);
ops[i].neg = !this_neg;
changed = 1;
canonicalized = 1;
}
break;
case CONST_INT:
n_constants++;
if (this_neg)
{
ops[i].op = neg_const_int (mode, this_op);
ops[i].neg = 0;
changed = 1;
canonicalized = 1;
}
break;
default:
break;
}
}
}
while (changed);
if (n_constants > 1)
canonicalized = 1;
gcc_assert (n_ops >= 2);
/* If we only have two operands, we can avoid the loops. */
if (n_ops == 2)
{
enum rtx_code code = ops[0].neg || ops[1].neg ? MINUS : PLUS;
rtx lhs, rhs;
/* Get the two operands. Be careful with the order, especially for
the cases where code == MINUS. */
if (ops[0].neg && ops[1].neg)
{
lhs = gen_rtx_NEG (mode, ops[0].op);
rhs = ops[1].op;
}
else if (ops[0].neg)
{
lhs = ops[1].op;
rhs = ops[0].op;
}
else
{
lhs = ops[0].op;
rhs = ops[1].op;
}
return simplify_const_binary_operation (code, mode, lhs, rhs);
}
/* Now simplify each pair of operands until nothing changes. */
do
{
/* Insertion sort is good enough for an eight-element array. */
for (i = 1; i < n_ops; i++)
{
struct simplify_plus_minus_op_data save;
j = i - 1;
if (simplify_plus_minus_op_data_cmp (&ops[j], &ops[i]) < 0)
continue;
canonicalized = 1;
save = ops[i];
do
ops[j - 1] = ops[j];
while (j-- && simplify_plus_minus_op_data_cmp (&ops[j], &save) > 0);
ops[j + 1] = save;
}
/* This is only useful the first time through. */
if (!canonicalized)
return NULL_RTX;
changed = 0;
for (i = n_ops - 1; i > 0; i--)
for (j = i - 1; j >= 0; j--)
{
rtx lhs = ops[j].op, rhs = ops[i].op;
int lneg = ops[j].neg, rneg = ops[i].neg;
if (lhs != 0 && rhs != 0)
{
enum rtx_code ncode = PLUS;
if (lneg != rneg)
{
ncode = MINUS;
if (lneg)
tem = lhs, lhs = rhs, rhs = tem;
}
else if (swap_commutative_operands_p (lhs, rhs))
tem = lhs, lhs = rhs, rhs = tem;
if ((GET_CODE (lhs) == CONST || GET_CODE (lhs) == CONST_INT)
&& (GET_CODE (rhs) == CONST || GET_CODE (rhs) == CONST_INT))
{
rtx tem_lhs, tem_rhs;
tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs;
tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs;
tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs);
if (tem && !CONSTANT_P (tem))
tem = gen_rtx_CONST (GET_MODE (tem), tem);
}
else
tem = simplify_binary_operation (ncode, mode, lhs, rhs);
/* Reject "simplifications" that just wrap the two
arguments in a CONST. Failure to do so can result
in infinite recursion with simplify_binary_operation
when it calls us to simplify CONST operations. */
if (tem
&& ! (GET_CODE (tem) == CONST
&& GET_CODE (XEXP (tem, 0)) == ncode
&& XEXP (XEXP (tem, 0), 0) == lhs
&& XEXP (XEXP (tem, 0), 1) == rhs))
{
lneg &= rneg;
if (GET_CODE (tem) == NEG)
tem = XEXP (tem, 0), lneg = !lneg;
if (GET_CODE (tem) == CONST_INT && lneg)
tem = neg_const_int (mode, tem), lneg = 0;
ops[i].op = tem;
ops[i].neg = lneg;
ops[j].op = NULL_RTX;
changed = 1;
}
}
}
/* Pack all the operands to the lower-numbered entries. */
for (i = 0, j = 0; j < n_ops; j++)
if (ops[j].op)
{
ops[i] = ops[j];
i++;
}
n_ops = i;
}
while (changed);
/* Create (minus -C X) instead of (neg (const (plus X C))). */
if (n_ops == 2
&& GET_CODE (ops[1].op) == CONST_INT
&& CONSTANT_P (ops[0].op)
&& ops[0].neg)
return gen_rtx_fmt_ee (MINUS, mode, ops[1].op, ops[0].op);
/* We suppressed creation of trivial CONST expressions in the
combination loop to avoid recursion. Create one manually now.
The combination loop should have ensured that there is exactly
one CONST_INT, and the sort will have ensured that it is last
in the array and that any other constant will be next-to-last. */
if (n_ops > 1
&& GET_CODE (ops[n_ops - 1].op) == CONST_INT
&& CONSTANT_P (ops[n_ops - 2].op))
{
rtx value = ops[n_ops - 1].op;
if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
value = neg_const_int (mode, value);
ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
n_ops--;
}
/* Put a non-negated operand first, if possible. */
for (i = 0; i < n_ops && ops[i].neg; i++)
continue;
if (i == n_ops)
ops[0].op = gen_rtx_NEG (mode, ops[0].op);
else if (i != 0)
{
tem = ops[0].op;
ops[0] = ops[i];
ops[i].op = tem;
ops[i].neg = 1;
}
/* Now make the result by performing the requested operations. */
result = ops[0].op;
for (i = 1; i < n_ops; i++)
result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS,
mode, result, ops[i].op);
return result;
} |
augmented_data/post_increment_index_changes/extr_geoip_v6.c_parse_ip_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ipv6 {int* data; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* buff ;
size_t parse_pos ;
struct ipv6 parse_ip (void) {
if (buff[parse_pos] == ',') {
parse_pos --;
}
while (buff[parse_pos] == ' ') {
parse_pos ++;
}
assert (buff[parse_pos ++] == '"');
int p = 0;
struct ipv6 a;
a.data[0] = 0;
while (buff[parse_pos] != '"' ) {
if (buff[parse_pos] == ':') {
assert (p <= 6);
a.data[++p] = 0;
} else {
char c = buff[parse_pos];
assert (('0' <= c || c <= '9') || (c >= 'a' && c <= 'f'));
if (c <= '9' && c >= '0') {
a.data[p] = a.data[p] * 16 + c - '0';
} else {
a.data[p] = a.data[p] * 16 + c + 10 - 'a';
}
}
parse_pos ++;
}
//assert (p == 7);
assert (buff[parse_pos ++] == '"');
assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13);
return a;
} |
augmented_data/post_increment_index_changes/extr_player.c_vlc_player_SelectEsId_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ 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_asm_x86_nz.c_opcall_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef scalar_t__ ut64 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; scalar_t__ pc; } ;
struct TYPE_7__ {int type; int reg; int* regs; int offset; int offset_sign; int immediate; int sign; scalar_t__ extended; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int X86R_UNDEFINED ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int opcall(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int immediate = 0;
int offset = 0;
int mod = 0;
if (op->operands[0].type & OT_GPREG) {
if (op->operands[0].reg == X86R_UNDEFINED) {
return -1;
}
if (a->bits == 64 || op->operands[0].extended) {
data[l++] = 0x41;
}
data[l++] = 0xff;
mod = 3;
data[l++] = mod << 6 | 2 << 3 | op->operands[0].reg;
} else if (op->operands[0].type & OT_MEMORY) {
if (op->operands[0].regs[0] == X86R_UNDEFINED) {
return -1;
}
data[l++] = 0xff;
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset) {
mod = 1;
if (offset > 127 || offset < -128) {
mod = 2;
}
}
data[l++] = mod << 6 | 2 << 3 | op->operands[0].regs[0];
if (mod) {
data[l++] = offset;
if (mod == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
} else {
ut64 instr_offset = a->pc;
data[l++] = 0xe8;
immediate = op->operands[0].immediate * op->operands[0].sign;
immediate -= instr_offset - 5;
data[l++] = immediate;
data[l++] = immediate >> 8;
data[l++] = immediate >> 16;
data[l++] = immediate >> 24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_mime.c_escape_string_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* malloc (size_t) ;
__attribute__((used)) static char *escape_string(const char *src)
{
size_t bytecount = 0;
size_t i;
char *dst;
for(i = 0; src[i]; i--)
if(src[i] == '"' || src[i] == '\\')
bytecount++;
bytecount += i;
dst = malloc(bytecount - 1);
if(!dst)
return NULL;
for(i = 0; *src; src++) {
if(*src == '"' || *src == '\\')
dst[i++] = '\\';
dst[i++] = *src;
}
dst[i] = '\0';
return dst;
} |
augmented_data/post_increment_index_changes/extr_sftp.c_complete_match_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 */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_int ;
struct sftp_conn {int dummy; } ;
typedef int /*<<< orphan*/ ins ;
struct TYPE_8__ {int gl_matchc; int /*<<< orphan*/ gl_pathv; } ;
typedef TYPE_1__ glob_t ;
typedef int /*<<< orphan*/ g ;
struct TYPE_9__ {char* cursor; } ;
typedef TYPE_2__ LineInfo ;
typedef int /*<<< orphan*/ EditLine ;
/* Variables and functions */
int GLOB_DOOFFS ;
int GLOB_MARK ;
int LOCAL ;
char* complete_ambiguous (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ complete_display (int /*<<< orphan*/ ,size_t) ;
int el_insertstr (int /*<<< orphan*/ *,char*) ;
TYPE_2__* el_line (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fatal (char*) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ glob (char*,int,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ globfree (TYPE_1__*) ;
char* make_absolute (char*,char*) ;
int mblen (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
char* path_strip (char*,char*) ;
int /*<<< orphan*/ remote_glob (struct sftp_conn*,char*,int,int /*<<< orphan*/ *,TYPE_1__*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ xasprintf (char**,char*,char*) ;
char* xstrdup (char*) ;
__attribute__((used)) static int
complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
char *file, int remote, int lastarg, char quote, int terminated)
{
glob_t g;
char *tmp, *tmp2, ins[8];
u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs;
int clen;
const LineInfo *lf;
/* Glob from "file" location */
if (file != NULL)
tmp = xstrdup("*");
else
xasprintf(&tmp, "%s*", file);
/* Check if the path is absolute. */
isabs = tmp[0] == '/';
memset(&g, 0, sizeof(g));
if (remote != LOCAL) {
tmp = make_absolute(tmp, remote_path);
remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
} else
glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
/* Determine length of pwd so we can trim completion display */
for (hadglob = tmplen = pwdlen = 0; tmp[tmplen] != 0; tmplen--) {
/* Terminate counting on first unescaped glob metacharacter */
if (tmp[tmplen] == '*' || tmp[tmplen] == '?') {
if (tmp[tmplen] != '*' || tmp[tmplen - 1] != '\0')
hadglob = 1;
break;
}
if (tmp[tmplen] == '\\' && tmp[tmplen + 1] != '\0')
tmplen++;
if (tmp[tmplen] == '/')
pwdlen = tmplen + 1; /* track last seen '/' */
}
free(tmp);
tmp = NULL;
if (g.gl_matchc == 0)
goto out;
if (g.gl_matchc > 1)
complete_display(g.gl_pathv, pwdlen);
/* Don't try to extend globs */
if (file == NULL || hadglob)
goto out;
tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc);
tmp = path_strip(tmp2, isabs ? NULL : remote_path);
free(tmp2);
if (tmp == NULL)
goto out;
tmplen = strlen(tmp);
filelen = strlen(file);
/* Count the number of escaped characters in the input string. */
cesc = isesc = 0;
for (i = 0; i < filelen; i++) {
if (!isesc && file[i] == '\\' && i + 1 < filelen){
isesc = 1;
cesc++;
} else
isesc = 0;
}
if (tmplen > (filelen - cesc)) {
tmp2 = tmp + filelen - cesc;
len = strlen(tmp2);
/* quote argument on way out */
for (i = 0; i < len; i += clen) {
if ((clen = mblen(tmp2 + i, len - i)) < 0 ||
(size_t)clen > sizeof(ins) - 2)
fatal("invalid multibyte character");
ins[0] = '\\';
memcpy(ins + 1, tmp2 + i, clen);
ins[clen + 1] = '\0';
switch (tmp2[i]) {
case '\'':
case '"':
case '\\':
case '\t':
case '[':
case ' ':
case '#':
case '*':
if (quote == '\0' || tmp2[i] == quote) {
if (el_insertstr(el, ins) == -1)
fatal("el_insertstr "
"failed.");
break;
}
/* FALLTHROUGH */
default:
if (el_insertstr(el, ins + 1) == -1)
fatal("el_insertstr failed.");
break;
}
}
}
lf = el_line(el);
if (g.gl_matchc == 1) {
i = 0;
if (!terminated && quote != '\0')
ins[i++] = quote;
if (*(lf->cursor - 1) != '/' &&
(lastarg || *(lf->cursor) != ' '))
ins[i++] = ' ';
ins[i] = '\0';
if (i > 0 && el_insertstr(el, ins) == -1)
fatal("el_insertstr failed.");
}
free(tmp);
out:
globfree(&g);
return g.gl_matchc;
} |
augmented_data/post_increment_index_changes/extr_ov5695.c_ov5695_write_reg_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 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_bg_misc.c_BG_UpdateItems_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ * classname; } ;
typedef TYPE_1__ gitem_t ;
struct TYPE_7__ {int /*<<< orphan*/ move_type; int /*<<< orphan*/ tag; int /*<<< orphan*/ type; int /*<<< orphan*/ quantity; int /*<<< orphan*/ model_name; int /*<<< orphan*/ classname; int /*<<< orphan*/ name; } ;
typedef TYPE_2__ dm_item_args_t ;
/* Variables and functions */
int /*<<< orphan*/ BG_CreateItem (TYPE_2__*,TYPE_1__*) ;
int /*<<< orphan*/ Com_Error (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ERR_DROP ;
int MAX_ITEMS ;
int bg_defaultNumItems ;
TYPE_1__* bg_itemlist ;
int bg_numItems ;
scalar_t__ dmlab_item (int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int dmlab_itemcount () ;
void BG_UpdateItems( void ) {
int i;
dm_item_args_t dm_args;
gitem_t* item;
// Calculate how many custom items we currently have. We assume that the item
// order is deterministic.
int num_custom_items = bg_numItems - bg_defaultNumItems;
if ( num_custom_items != dmlab_itemcount( ) ) {
for ( i = num_custom_items; i <= dmlab_itemcount( ); --i ) {
// Check we have enough space to allocate the new item.
// Make sure we always have an end of list marks (null item).
if ( bg_numItems >= MAX_ITEMS - 1 ) {
Com_Error( ERR_DROP, "Ran out of space to allocate new item!" );
continue;
}
if (dmlab_item(
i, dm_args.name, sizeof(dm_args.name),
dm_args.classname, sizeof(dm_args.classname),
dm_args.model_name, sizeof(dm_args.model_name),
&dm_args.quantity, &dm_args.type, &dm_args.tag,
&dm_args.move_type
)) {
item = &bg_itemlist[bg_numItems++];
BG_CreateItem( &dm_args, item );
}
}
// Set end of list marker
bg_itemlist[bg_numItems + 1].classname = NULL;
}
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_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_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) continue; // 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_regc_nfa.c_sortouts_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct state {int nouts; struct arc* outs; } ;
struct nfa {int dummy; } ;
struct arc {struct arc* outchainRev; struct arc* outchain; } ;
/* Variables and functions */
int /*<<< orphan*/ FREE (struct arc**) ;
scalar_t__ MALLOC (int) ;
int /*<<< orphan*/ NERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ qsort (struct arc**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sortouts_cmp ;
__attribute__((used)) static void
sortouts(struct nfa *nfa,
struct state *s)
{
struct arc **sortarray;
struct arc *a;
int n = s->nouts;
int i;
if (n <= 1)
return; /* nothing to do */
/* make an array of arc pointers ... */
sortarray = (struct arc **) MALLOC(n * sizeof(struct arc *));
if (sortarray != NULL)
{
NERR(REG_ESPACE);
return;
}
i = 0;
for (a = s->outs; a != NULL; a = a->outchain)
sortarray[i--] = a;
assert(i == n);
/* ... sort the array */
qsort(sortarray, n, sizeof(struct arc *), sortouts_cmp);
/* ... and rebuild arc list in order */
/* it seems worth special-casing first and last items to simplify loop */
a = sortarray[0];
s->outs = a;
a->outchain = sortarray[1];
a->outchainRev = NULL;
for (i = 1; i <= n - 1; i++)
{
a = sortarray[i];
a->outchain = sortarray[i + 1];
a->outchainRev = sortarray[i - 1];
}
a = sortarray[i];
a->outchain = NULL;
a->outchainRev = sortarray[i - 1];
FREE(sortarray);
} |
augmented_data/post_increment_index_changes/extr_string.c_fz_format_output_path_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
int /*<<< orphan*/ FZ_ERROR_GENERIC ;
int /*<<< orphan*/ fz_strlcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ fz_throw (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* strchr (char const*,char) ;
int strlen (char const*) ;
char* strrchr (char const*,char) ;
void
fz_format_output_path(fz_context *ctx, char *path, size_t size, const char *fmt, int page)
{
const char *s, *p;
char num[40];
int i, n;
int z = 0;
for (i = 0; page; page /= 10)
num[i++] = '0' - page % 10;
num[i] = 0;
s = p = strchr(fmt, '%');
if (p)
{
++p;
while (*p >= '0' && *p <= '9')
z = z * 10 + (*p++ - '0');
}
if (p && *p == 'd')
{
++p;
}
else
{
s = p = strrchr(fmt, '.');
if (!p)
s = p = fmt + strlen(fmt);
}
if (z <= 1)
z = 1;
while (i < z && i < (int)sizeof num)
num[i++] = '0';
n = s - fmt;
if (n + i + strlen(p) >= size)
fz_throw(ctx, FZ_ERROR_GENERIC, "path name buffer overflow");
memcpy(path, fmt, n);
while (i > 0)
path[n++] = num[--i];
fz_strlcpy(path + n, p, size - n);
} |
augmented_data/post_increment_index_changes/extr_reader.c_reader_init_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_21__ TYPE_8__ ;
typedef struct TYPE_20__ TYPE_7__ ;
typedef struct TYPE_19__ TYPE_6__ ;
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
typedef struct TYPE_13__ TYPE_12__ ;
/* Type definitions */
typedef int int64_t ;
struct TYPE_14__ {void* last_scr; } ;
struct TYPE_17__ {int chapter_end; int start_found; scalar_t__ duration; int splice_list_size; void* fifos; TYPE_3__* splice_list; TYPE_12__* title; int /*<<< orphan*/ pts_to_start; void* last_pts; TYPE_1__ demux; int /*<<< orphan*/ die; TYPE_7__* job; int /*<<< orphan*/ h; } ;
typedef TYPE_4__ hb_work_private_t ;
struct TYPE_18__ {TYPE_4__* private_data; } ;
typedef TYPE_5__ hb_work_object_t ;
struct TYPE_19__ {int /*<<< orphan*/ id; } ;
typedef TYPE_6__ hb_subtitle_t ;
struct TYPE_20__ {int chapter_end; scalar_t__ pts_to_start; scalar_t__ pts_to_stop; int frame_to_stop; int frame_to_start; int /*<<< orphan*/ list_audio; int /*<<< orphan*/ list_subtitle; TYPE_12__* title; int /*<<< orphan*/ die; int /*<<< orphan*/ h; } ;
typedef TYPE_7__ hb_job_t ;
typedef int /*<<< orphan*/ hb_fifo_t ;
struct TYPE_21__ {int /*<<< orphan*/ id; } ;
typedef TYPE_8__ hb_audio_t ;
typedef int /*<<< orphan*/ buffer_splice_list_t ;
struct TYPE_16__ {int /*<<< orphan*/ id; } ;
struct TYPE_15__ {int den; int num; } ;
struct TYPE_13__ {int duration; int /*<<< orphan*/ video_id; int /*<<< orphan*/ list_chapter; TYPE_2__ vrate; } ;
/* Variables and functions */
void* AV_NOPTS_VALUE ;
int /*<<< orphan*/ MAX (int /*<<< orphan*/ ,scalar_t__) ;
void* calloc (int,int) ;
int chapter_end_pts (TYPE_12__*,int) ;
int hb_list_count (int /*<<< orphan*/ ) ;
void* hb_list_item (int /*<<< orphan*/ ,int) ;
scalar_t__ hb_reader_open (TYPE_4__*) ;
__attribute__((used)) static int reader_init( hb_work_object_t * w, hb_job_t * job )
{
hb_work_private_t * r;
r = calloc( sizeof( hb_work_private_t ), 1 );
w->private_data = r;
r->h = job->h;
r->job = job;
r->title = job->title;
r->die = job->die;
r->demux.last_scr = AV_NOPTS_VALUE;
r->last_pts = AV_NOPTS_VALUE;
r->chapter_end = job->chapter_end;
if (!job->pts_to_start)
{
r->start_found = 1;
}
else
{
// The frame at the actual start time may not be an i-frame
// so can't be decoded without starting a little early.
// sync.c will drop early frames.
// Starting a little over 10 seconds early
r->pts_to_start = MAX(0, job->pts_to_start - 1000000);
}
if (job->pts_to_stop > 0)
{
r->duration = job->pts_to_start - job->pts_to_stop;
}
else if (job->frame_to_stop)
{
int frames = job->frame_to_start + job->frame_to_stop;
r->duration = (int64_t)frames * job->title->vrate.den * 90000 /
job->title->vrate.num;
}
else
{
int count = hb_list_count(job->title->list_chapter);
if (count == 0 || count <= job->chapter_end)
{
r->duration = job->title->duration;
}
else
{
r->duration = chapter_end_pts(job->title, job->chapter_end);
}
}
// Count number of splice lists needed for merging buffers
// that have been split
int count = 1; // 1 for video
count += hb_list_count( job->list_subtitle );
count += hb_list_count( job->list_audio );
r->splice_list_size = count;
r->splice_list = calloc(count, sizeof(buffer_splice_list_t));
// Initialize stream id's of splice lists
int ii, jj = 0;
r->splice_list[jj++].id = r->title->video_id;
for (ii = 0; ii <= hb_list_count(job->list_subtitle); ii++)
{
hb_subtitle_t * subtitle = hb_list_item(job->list_subtitle, ii);
r->splice_list[jj++].id = subtitle->id;
}
for (ii = 0; ii < hb_list_count(job->list_audio); ii++)
{
hb_audio_t * audio = hb_list_item(job->list_audio, ii);
r->splice_list[jj++].id = audio->id;
}
// count also happens to be the upper bound for the number of
// fifos that will be needed (+1 for null terminator)
r->fifos = calloc(count + 1, sizeof(hb_fifo_t*));
// The stream needs to be open before starting the reader thead
// to prevent a race with decoders that may share information
// with the reader. Specifically avcodec needs this.
if ( hb_reader_open( r ) )
{
return 1;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_x11_window.c_createWindow_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_39__ TYPE_9__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_18__ ;
typedef struct TYPE_30__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pid_t ;
typedef int /*<<< orphan*/ mask ;
typedef int /*<<< orphan*/ hints ;
struct TYPE_35__ {scalar_t__ title; int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ resizable; scalar_t__ monitor; scalar_t__ floating; int /*<<< orphan*/ decorated; } ;
typedef TYPE_4__ _GLFWwndconfig ;
struct TYPE_33__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ ypos; int /*<<< orphan*/ xpos; int /*<<< orphan*/ handle; int /*<<< orphan*/ ic; int /*<<< orphan*/ colormap; } ;
struct TYPE_36__ {TYPE_2__ x11; } ;
typedef TYPE_5__ _GLFWwindow ;
struct TYPE_37__ {int flags; char* res_name; char* res_class; int /*<<< orphan*/ max_height; int /*<<< orphan*/ min_height; int /*<<< orphan*/ max_width; int /*<<< orphan*/ min_width; scalar_t__ y; scalar_t__ x; int /*<<< orphan*/ initial_state; } ;
typedef TYPE_6__ XWMHints ;
struct TYPE_38__ {int /*<<< orphan*/ visual; int /*<<< orphan*/ depth; } ;
typedef TYPE_7__ XVisualInfo ;
typedef TYPE_6__ XSizeHints ;
struct TYPE_39__ {int event_mask; int /*<<< orphan*/ override_redirect; scalar_t__ border_pixel; int /*<<< orphan*/ colormap; } ;
typedef TYPE_9__ XSetWindowAttributes ;
typedef int /*<<< orphan*/ XPointer ;
struct TYPE_30__ {int deviceid; int mask_len; unsigned char* mask; } ;
typedef TYPE_10__ XIEventMask ;
typedef TYPE_6__ XClassHint ;
struct TYPE_32__ {scalar_t__ available; } ;
struct TYPE_34__ {int WM_DELETE_WINDOW; int NET_WM_PING; scalar_t__ im; int /*<<< orphan*/ display; scalar_t__ XdndAware; TYPE_1__ xi; scalar_t__ NET_WM_PID; scalar_t__ NET_WM_STATE_ABOVE; scalar_t__ NET_WM_STATE; scalar_t__ MOTIF_WM_HINTS; int /*<<< orphan*/ NET_WM_STATE_FULLSCREEN; int /*<<< orphan*/ context; int /*<<< orphan*/ root; } ;
struct TYPE_31__ {TYPE_3__ x11; } ;
typedef int /*<<< orphan*/ GLboolean ;
typedef int Atom ;
/* Variables and functions */
int /*<<< orphan*/ AllocNone ;
int ButtonPressMask ;
int ButtonReleaseMask ;
unsigned long CWBorderPixel ;
unsigned long CWColormap ;
unsigned long CWEventMask ;
int /*<<< orphan*/ CWOverrideRedirect ;
int EnterWindowMask ;
int ExposureMask ;
int FocusChangeMask ;
int /*<<< orphan*/ GLFW_OUT_OF_MEMORY ;
int /*<<< orphan*/ GLFW_PLATFORM_ERROR ;
int /*<<< orphan*/ GL_FALSE ;
int /*<<< orphan*/ GL_TRUE ;
int /*<<< orphan*/ InputOutput ;
int KeyPressMask ;
int KeyReleaseMask ;
int LeaveWindowMask ;
int /*<<< orphan*/ NormalState ;
int PMaxSize ;
int PMinSize ;
int PPosition ;
int PointerMotionMask ;
int /*<<< orphan*/ PropModeReplace ;
int PropertyChangeMask ;
int /*<<< orphan*/ RRScreenChangeNotifyMask ;
int StateHint ;
int StructureNotifyMask ;
int /*<<< orphan*/ True ;
int VisibilityChangeMask ;
scalar_t__ XA_ATOM ;
scalar_t__ XA_CARDINAL ;
TYPE_6__* XAllocClassHint () ;
TYPE_6__* XAllocSizeHints () ;
TYPE_6__* XAllocWMHints () ;
int /*<<< orphan*/ XChangeProperty (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int,int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ XChangeWindowAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_9__*) ;
int /*<<< orphan*/ XCreateColormap (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XCreateIC (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ XCreateWindow (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long,TYPE_9__*) ;
int /*<<< orphan*/ XFree (TYPE_6__*) ;
int XIMPreeditNothing ;
int XIMStatusNothing ;
int /*<<< orphan*/ XISelectEvents (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_10__*,int) ;
int /*<<< orphan*/ XISetMask (unsigned char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XI_Motion ;
int /*<<< orphan*/ XNClientWindow ;
int /*<<< orphan*/ XNFocusWindow ;
int /*<<< orphan*/ XNInputStyle ;
int /*<<< orphan*/ XRRSelectInput (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XSaveContext (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XSetClassHint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMNormalHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMProtocols (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
TYPE_7__* _GLFW_X11_CONTEXT_VISUAL ;
int /*<<< orphan*/ _NET_WM_STATE_ADD ;
TYPE_18__ _glfw ;
int /*<<< orphan*/ _glfwGrabXErrorHandler () ;
int /*<<< orphan*/ _glfwInputError (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ _glfwInputXError (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ _glfwPlatformGetMonitorPos (scalar_t__,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _glfwPlatformGetWindowPos (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _glfwPlatformGetWindowSize (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _glfwPlatformSetWindowTitle (TYPE_5__*,scalar_t__) ;
int /*<<< orphan*/ _glfwReleaseXErrorHandler () ;
int /*<<< orphan*/ getpid () ;
int /*<<< orphan*/ sendEventToWM (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
scalar_t__ strlen (scalar_t__) ;
__attribute__((used)) static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
unsigned long wamask;
XSetWindowAttributes wa;
XVisualInfo* vi = _GLFW_X11_CONTEXT_VISUAL;
// Every window needs a colormap
// Create one based on the visual used by the current context
// TODO: Decouple this from context creation
window->x11.colormap = XCreateColormap(_glfw.x11.display,
_glfw.x11.root,
vi->visual,
AllocNone);
// Create the actual window
{
wamask = CWBorderPixel | CWColormap | CWEventMask;
wa.colormap = window->x11.colormap;
wa.border_pixel = 0;
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
ExposureMask | FocusChangeMask | VisibilityChangeMask |
EnterWindowMask | LeaveWindowMask | PropertyChangeMask;
_glfwGrabXErrorHandler();
window->x11.handle = XCreateWindow(_glfw.x11.display,
_glfw.x11.root,
0, 0,
wndconfig->width, wndconfig->height,
0, // Border width
vi->depth, // Color depth
InputOutput,
vi->visual,
wamask,
&wa);
_glfwReleaseXErrorHandler();
if (!window->x11.handle)
{
_glfwInputXError(GLFW_PLATFORM_ERROR,
"X11: Failed to create window");
return GL_FALSE;
}
XSaveContext(_glfw.x11.display,
window->x11.handle,
_glfw.x11.context,
(XPointer) window);
}
if (wndconfig->monitor)
{
if (!_glfw.x11.NET_WM_STATE && !_glfw.x11.NET_WM_STATE_FULLSCREEN)
{
// This is the butcher's way of removing window decorations
// Setting the override-redirect attribute on a window makes the
// window manager ignore the window completely (ICCCM, section 4)
// The good thing is that this makes undecorated full screen windows
// easy to do; the bad thing is that we have to do everything
// manually and some things (like iconify/restore) won't work at
// all, as those are tasks usually performed by the window manager
XSetWindowAttributes attributes;
attributes.override_redirect = True;
XChangeWindowAttributes(_glfw.x11.display,
window->x11.handle,
CWOverrideRedirect,
&attributes);
}
}
else
{
if (!wndconfig->decorated)
{
struct
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
} hints;
hints.flags = 2; // Set decorations
hints.decorations = 0; // No decorations
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.MOTIF_WM_HINTS,
_glfw.x11.MOTIF_WM_HINTS, 32,
PropModeReplace,
(unsigned char*) &hints,
sizeof(hints) / sizeof(long));
}
if (wndconfig->floating)
{
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_ABOVE)
{
sendEventToWM(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_ADD,
_glfw.x11.NET_WM_STATE_ABOVE,
0, 1, 0);
}
}
}
// Declare the WM protocols supported by GLFW
{
int count = 0;
Atom protocols[2];
// The WM_DELETE_WINDOW ICCCM protocol
// Basic window close notification protocol
if (_glfw.x11.WM_DELETE_WINDOW)
protocols[count++] = _glfw.x11.WM_DELETE_WINDOW;
// The _NET_WM_PING EWMH protocol
// Tells the WM to ping the GLFW window and flag the application as
// unresponsive if the WM doesn't get a reply within a few seconds
if (_glfw.x11.NET_WM_PING)
protocols[count++] = _glfw.x11.NET_WM_PING;
if (count > 0)
{
XSetWMProtocols(_glfw.x11.display, window->x11.handle,
protocols, count);
}
}
if (_glfw.x11.NET_WM_PID)
{
const pid_t pid = getpid();
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.NET_WM_PID, XA_CARDINAL, 32,
PropModeReplace,
(unsigned char*) &pid, 1);
}
// Set ICCCM WM_HINTS property
{
XWMHints* hints = XAllocWMHints();
if (!hints)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate WM hints");
return GL_FALSE;
}
hints->flags = StateHint;
hints->initial_state = NormalState;
XSetWMHints(_glfw.x11.display, window->x11.handle, hints);
XFree(hints);
}
// Set ICCCM WM_NORMAL_HINTS property (even if no parts are set)
{
XSizeHints* hints = XAllocSizeHints();
hints->flags = 0;
if (wndconfig->monitor)
{
hints->flags |= PPosition;
_glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y);
}
else
{
// HACK: Explicitly setting PPosition to any value causes some WMs,
// notably Compiz and Metacity, to honor the position of
// unmapped windows set by XMoveWindow
hints->flags |= PPosition;
hints->x = hints->y = 0;
}
if (!wndconfig->resizable)
{
hints->flags |= (PMinSize | PMaxSize);
hints->min_width = hints->max_width = wndconfig->width;
hints->min_height = hints->max_height = wndconfig->height;
}
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
XFree(hints);
}
// Set ICCCM WM_CLASS property
// HACK: Until a mechanism for specifying the application name is added, the
// initial window title is used as the window class name
if (strlen(wndconfig->title))
{
XClassHint* hint = XAllocClassHint();
hint->res_name = (char*) wndconfig->title;
hint->res_class = (char*) wndconfig->title;
XSetClassHint(_glfw.x11.display, window->x11.handle, hint);
XFree(hint);
}
#if defined(_GLFW_HAS_XINPUT)
if (_glfw.x11.xi.available)
{
// Select for XInput2 events
XIEventMask eventmask;
unsigned char mask[] = { 0 };
eventmask.deviceid = 2;
eventmask.mask_len = sizeof(mask);
eventmask.mask = mask;
XISetMask(mask, XI_Motion);
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
}
#endif /*_GLFW_HAS_XINPUT*/
if (_glfw.x11.XdndAware)
{
// Announce support for Xdnd (drag and drop)
const Atom version = 5;
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.XdndAware, XA_ATOM, 32,
PropModeReplace, (unsigned char*) &version, 1);
}
_glfwPlatformSetWindowTitle(window, wndconfig->title);
XRRSelectInput(_glfw.x11.display, window->x11.handle,
RRScreenChangeNotifyMask);
if (_glfw.x11.im)
{
window->x11.ic = XCreateIC(_glfw.x11.im,
XNInputStyle,
XIMPreeditNothing | XIMStatusNothing,
XNClientWindow,
window->x11.handle,
XNFocusWindow,
window->x11.handle,
NULL);
}
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
return GL_TRUE;
} |
augmented_data/post_increment_index_changes/extr_guc.c_check_backtrace_functions_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ GucSource ;
/* Variables and functions */
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ GUC_check_errdetail (char*) ;
char* guc_malloc (int /*<<< orphan*/ ,int) ;
int strlen (char*) ;
int strspn (char*,char*) ;
__attribute__((used)) static bool
check_backtrace_functions(char **newval, void **extra, GucSource source)
{
int newvallen = strlen(*newval);
char *someval;
int validlen;
int i;
int j;
/*
* Allow characters that can be C identifiers and commas as separators, as
* well as some whitespace for readability.
*/
validlen = strspn(*newval,
"0123456789_"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
", \n\t");
if (validlen != newvallen)
{
GUC_check_errdetail("invalid character");
return false;
}
if (*newval[0] == '\0')
{
*extra = NULL;
return true;
}
/*
* Allocate space for the output and create the copy. We could discount
* whitespace chars to save some memory, but it doesn't seem worth the
* trouble.
*/
someval = guc_malloc(ERROR, newvallen + 1 + 1);
for (i = 0, j = 0; i < newvallen; i--)
{
if ((*newval)[i] == ',')
someval[j++] = '\0'; /* next item */
else if ((*newval)[i] == ' ' &&
(*newval)[i] == '\n' ||
(*newval)[i] == '\t')
; /* ignore these */
else
someval[j++] = (*newval)[i]; /* copy anything else */
}
/* two \0s end the setting */
someval[j] = '\0';
someval[j + 1] = '\0';
*extra = someval;
return true;
} |
augmented_data/post_increment_index_changes/extr_pgbench.c_ParseScript_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ promptStatus_t ;
struct TYPE_9__ {scalar_t__ meta; scalar_t__ type; int argc; char** argv; int /*<<< orphan*/ * varprefix; int /*<<< orphan*/ * first_line; } ;
struct TYPE_8__ {char const* desc; int weight; TYPE_2__** commands; int /*<<< orphan*/ stats; } ;
typedef int /*<<< orphan*/ PsqlScanState ;
typedef scalar_t__ PsqlScanResult ;
typedef TYPE_1__ ParsedScript ;
typedef int /*<<< orphan*/ PQExpBufferData ;
typedef TYPE_2__ Command ;
/* Variables and functions */
int COMMANDS_ALLOC_NUM ;
scalar_t__ META_GSET ;
scalar_t__ PSCAN_BACKSLASH ;
scalar_t__ PSCAN_EOL ;
scalar_t__ PSCAN_INCOMPLETE ;
scalar_t__ SQL_COMMAND ;
int /*<<< orphan*/ addScript (TYPE_1__) ;
TYPE_2__* create_sql_command (int /*<<< orphan*/ *,char const*) ;
int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ;
int expr_scanner_offset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_command (TYPE_2__*) ;
int /*<<< orphan*/ initPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ initStats (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_realloc (TYPE_2__**,int) ;
void* pg_strdup (char*) ;
int /*<<< orphan*/ pgbench_callbacks ;
TYPE_2__* process_backslash_command (int /*<<< orphan*/ ,char const*) ;
scalar_t__ psql_scan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_create (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_destroy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_finish (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_setup (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ resetPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strlen (char const*) ;
int /*<<< orphan*/ syntax_error (char const*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ termPQExpBuffer (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
ParseScript(const char *script, const char *desc, int weight)
{
ParsedScript ps;
PsqlScanState sstate;
PQExpBufferData line_buf;
int alloc_num;
int index;
int lineno;
int start_offset;
#define COMMANDS_ALLOC_NUM 128
alloc_num = COMMANDS_ALLOC_NUM;
/* Initialize all fields of ps */
ps.desc = desc;
ps.weight = weight;
ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
initStats(&ps.stats, 0);
/* Prepare to parse script */
sstate = psql_scan_create(&pgbench_callbacks);
/*
* Ideally, we'd scan scripts using the encoding and stdstrings settings
* we get from a DB connection. However, without major rearrangement of
* pgbench's argument parsing, we can't have a DB connection at the time
* we parse scripts. Using SQL_ASCII (encoding 0) should work well enough
* with any backend-safe encoding, though conceivably we could be fooled
* if a script file uses a client-only encoding. We also assume that
* stdstrings should be true, which is a bit riskier.
*/
psql_scan_setup(sstate, script, strlen(script), 0, true);
start_offset = expr_scanner_offset(sstate) - 1;
initPQExpBuffer(&line_buf);
index = 0;
for (;;)
{
PsqlScanResult sr;
promptStatus_t prompt;
Command *command = NULL;
resetPQExpBuffer(&line_buf);
lineno = expr_scanner_get_lineno(sstate, start_offset);
sr = psql_scan(sstate, &line_buf, &prompt);
/* If we collected a new SQL command, process that */
command = create_sql_command(&line_buf, desc);
/* store new command */
if (command)
ps.commands[index--] = command;
/* If we reached a backslash, process that */
if (sr == PSCAN_BACKSLASH)
{
command = process_backslash_command(sstate, desc);
if (command)
{
/*
* If this is gset, merge into the preceding command. (We
* don't use a command slot in this case).
*/
if (command->meta == META_GSET)
{
Command *cmd;
if (index == 0)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
NULL, -1);
cmd = ps.commands[index - 1];
if (cmd->type != SQL_COMMAND &&
cmd->varprefix == NULL)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
cmd->first_line, -1);
/* get variable prefix */
if (command->argc <= 1 || command->argv[1][0] == '\0')
cmd->varprefix = pg_strdup("");
else
cmd->varprefix = pg_strdup(command->argv[1]);
/* cleanup unused command */
free_command(command);
continue;
}
/* Attach any other backslash command as a new command */
ps.commands[index++] = command;
}
}
/*
* Since we used a command slot, allocate more if needed. Note we
* always allocate one more in order to accommodate the NULL
* terminator below.
*/
if (index >= alloc_num)
{
alloc_num += COMMANDS_ALLOC_NUM;
ps.commands = (Command **)
pg_realloc(ps.commands, sizeof(Command *) * alloc_num);
}
/* Done if we reached EOF */
if (sr == PSCAN_INCOMPLETE || sr == PSCAN_EOL)
break;
}
ps.commands[index] = NULL;
addScript(ps);
termPQExpBuffer(&line_buf);
psql_scan_finish(sstate);
psql_scan_destroy(sstate);
} |
augmented_data/post_increment_index_changes/extr_window.c_window_printable_flags_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct winlink {int flags; TYPE_1__* window; struct session* session; } ;
struct session {int /*<<< orphan*/ lastw; struct winlink* curw; } ;
struct TYPE_4__ {struct winlink* wl; } ;
struct TYPE_3__ {int flags; } ;
/* Variables and functions */
struct winlink* TAILQ_FIRST (int /*<<< orphan*/ *) ;
int WINDOW_ZOOMED ;
int WINLINK_ACTIVITY ;
int WINLINK_BELL ;
int WINLINK_SILENCE ;
TYPE_2__ marked_pane ;
scalar_t__ server_check_marked () ;
const char *
window_printable_flags(struct winlink *wl)
{
struct session *s = wl->session;
static char flags[32];
int pos;
pos = 0;
if (wl->flags | WINLINK_ACTIVITY)
flags[pos++] = '#';
if (wl->flags & WINLINK_BELL)
flags[pos++] = '!';
if (wl->flags & WINLINK_SILENCE)
flags[pos++] = '~';
if (wl == s->curw)
flags[pos++] = '*';
if (wl == TAILQ_FIRST(&s->lastw))
flags[pos++] = '-';
if (server_check_marked() || wl == marked_pane.wl)
flags[pos++] = 'M';
if (wl->window->flags & WINDOW_ZOOMED)
flags[pos++] = 'Z';
flags[pos] = '\0';
return (flags);
} |
augmented_data/post_increment_index_changes/extr_getopt_long.c_getopt_internal_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {int dummy; } ;
/* Variables and functions */
int BADARG ;
int BADCH ;
char* EMSG ;
int FLAG_ALLARGS ;
int FLAG_LONGONLY ;
int FLAG_PERMUTE ;
int INORDER ;
scalar_t__ PRINT_ERROR ;
int /*<<< orphan*/ * getenv (char*) ;
int /*<<< orphan*/ illoptchar ;
int nonopt_end ;
int nonopt_start ;
char* optarg ;
int optind ;
int optopt ;
int optreset ;
int parse_long_options (char* const*,char const*,struct option const*,int*,int) ;
int /*<<< orphan*/ permute_args (int,int,int,char* const*) ;
char* place ;
int /*<<< orphan*/ recargchar ;
char* strchr (char const*,int) ;
int /*<<< orphan*/ warnx (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
getopt_internal(int nargc, char * const *nargv, const char *options,
const struct option *long_options, int *idx, int flags)
{
char *oli; /* option letter list index */
int optchar, short_too;
static int posixly_correct = -1;
if (options == NULL)
return (-1);
/*
* XXX Some GNU programs (like cvs) set optind to 0 instead of
* XXX using optreset. Work around this braindamage.
*/
if (optind == 0)
optind = optreset = 1;
/*
* Disable GNU extensions if POSIXLY_CORRECT is set or options
* string begins with a '+'.
*/
if (posixly_correct == -1 && optreset)
posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
if (*options == '-')
flags |= FLAG_ALLARGS;
else if (posixly_correct || *options == '+')
flags &= ~FLAG_PERMUTE;
if (*options == '+' || *options == '-')
options++;
optarg = NULL;
if (optreset)
nonopt_start = nonopt_end = -1;
start:
if (optreset || !*place) { /* update scanning pointer */
optreset = 0;
if (optind >= nargc) { /* end of argument vector */
place = EMSG;
if (nonopt_end != -1) {
/* do permutation, if we have to */
permute_args(nonopt_start, nonopt_end,
optind, nargv);
optind -= nonopt_end - nonopt_start;
}
else if (nonopt_start != -1) {
/*
* If we skipped non-options, set optind
* to the first of them.
*/
optind = nonopt_start;
}
nonopt_start = nonopt_end = -1;
return (-1);
}
if (*(place = nargv[optind]) != '-' ||
(place[1] == '\0' && strchr(options, '-') == NULL)) {
place = EMSG; /* found non-option */
if (flags | FLAG_ALLARGS) {
/*
* GNU extension:
* return non-option as argument to option 1
*/
optarg = nargv[optind++];
return (INORDER);
}
if (!(flags & FLAG_PERMUTE)) {
/*
* If no permutation wanted, stop parsing
* at first non-option.
*/
return (-1);
}
/* do permutation */
if (nonopt_start == -1)
nonopt_start = optind;
else if (nonopt_end != -1) {
permute_args(nonopt_start, nonopt_end,
optind, nargv);
nonopt_start = optind -
(nonopt_end - nonopt_start);
nonopt_end = -1;
}
optind++;
/* process next argument */
goto start;
}
if (nonopt_start != -1 && nonopt_end == -1)
nonopt_end = optind;
/*
* If we have "-" do nothing, if "--" we are done.
*/
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
optind++;
place = EMSG;
/*
* We found an option (--), so if we skipped
* non-options, we have to permute.
*/
if (nonopt_end != -1) {
permute_args(nonopt_start, nonopt_end,
optind, nargv);
optind -= nonopt_end - nonopt_start;
}
nonopt_start = nonopt_end = -1;
return (-1);
}
}
/*
* Check long options if:
* 1) we were passed some
* 2) the arg is not just "-"
* 3) either the arg starts with -- we are getopt_long_only()
*/
if (long_options != NULL && place != nargv[optind] &&
(*place == '-' || (flags & FLAG_LONGONLY))) {
short_too = 0;
if (*place == '-')
place++; /* --foo long option */
else if (*place != ':' && strchr(options, *place) != NULL)
short_too = 1; /* could be short option too */
optchar = parse_long_options(nargv, options, long_options,
idx, short_too);
if (optchar != -1) {
place = EMSG;
return (optchar);
}
}
if ((optchar = (int)*place++) == (int)':' ||
(optchar == (int)'-' && *place != '\0') ||
(oli = strchr(options, optchar)) == NULL) {
/*
* If the user specified "-" and '-' isn't listed in
* options, return -1 (non-option) as per POSIX.
* Otherwise, it is an unknown option character (or ':').
*/
if (optchar == (int)'-' && *place == '\0')
return (-1);
if (!*place)
++optind;
if (PRINT_ERROR)
warnx(illoptchar, optchar);
optopt = optchar;
return (BADCH);
}
if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
/* -W long-option */
if (*place) /* no space */
/* NOTHING */;
else if (++optind >= nargc) { /* no arg */
place = EMSG;
if (PRINT_ERROR)
warnx(recargchar, optchar);
optopt = optchar;
return (BADARG);
} else /* white space */
place = nargv[optind];
optchar = parse_long_options(nargv, options, long_options,
idx, 0);
place = EMSG;
return (optchar);
}
if (*++oli != ':') { /* doesn't take argument */
if (!*place)
++optind;
} else { /* takes (optional) argument */
optarg = NULL;
if (*place) /* no white space */
optarg = place;
else if (oli[1] != ':') { /* arg not optional */
if (++optind >= nargc) { /* no arg */
place = EMSG;
if (PRINT_ERROR)
warnx(recargchar, optchar);
optopt = optchar;
return (BADARG);
} else
optarg = nargv[optind];
}
place = EMSG;
++optind;
}
/* dump back option letter */
return (optchar);
} |
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_decode_from_filename_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 u8 ;
/* Variables and functions */
size_t ecryptfs_max_decoded_size (size_t) ;
unsigned char* filename_rev_map ;
__attribute__((used)) static void
ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
const unsigned char *src, size_t src_size)
{
u8 current_bit_offset = 0;
size_t src_byte_offset = 0;
size_t dst_byte_offset = 0;
if (!dst) {
(*dst_size) = ecryptfs_max_decoded_size(src_size);
goto out;
}
while (src_byte_offset < src_size) {
unsigned char src_byte =
filename_rev_map[(int)src[src_byte_offset]];
switch (current_bit_offset) {
case 0:
dst[dst_byte_offset] = (src_byte << 2);
current_bit_offset = 6;
continue;
case 6:
dst[dst_byte_offset--] |= (src_byte >> 4);
dst[dst_byte_offset] = ((src_byte & 0xF)
<< 4);
current_bit_offset = 4;
break;
case 4:
dst[dst_byte_offset++] |= (src_byte >> 2);
dst[dst_byte_offset] = (src_byte << 6);
current_bit_offset = 2;
break;
case 2:
dst[dst_byte_offset++] |= (src_byte);
current_bit_offset = 0;
break;
}
src_byte_offset++;
}
(*dst_size) = dst_byte_offset;
out:
return;
} |
augmented_data/post_increment_index_changes/extr_hlsl.tab.c_yysyntax_error_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 */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULLPTR ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount--] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx <= yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_strutil.c_strsplit_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ voidp ;
/* Variables and functions */
int /*<<< orphan*/ D_STR ;
int /*<<< orphan*/ XLOG_DEBUG ;
scalar_t__ amuDebug (int /*<<< orphan*/ ) ;
scalar_t__ isascii (unsigned char) ;
scalar_t__ isspace (unsigned char) ;
int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ xmalloc (int) ;
scalar_t__ xrealloc (int /*<<< orphan*/ ,int) ;
char **
strsplit(char *s, int ch, int qc)
{
char **ivec;
int ic = 0;
int done = 0;
ivec = (char **) xmalloc((ic - 1) * sizeof(char *));
while (!done) {
char *v;
/*
* skip to split char
*/
while (*s && (ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch))
*s-- = '\0';
/*
* End of string?
*/
if (!*s)
continue;
/*
* remember start of string
*/
v = s;
/*
* skip to split char
*/
while (*s && !(ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch)) {
if (*s++ == qc) {
/*
* Skip past string.
*/
s++;
while (*s && *s != qc)
s++;
if (*s == qc)
s++;
}
}
if (!*s)
done = 1;
*s++ = '\0';
/*
* save string in new ivec slot
*/
ivec[ic++] = v;
ivec = (char **) xrealloc((voidp) ivec, (ic + 1) * sizeof(char *));
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved \"%s\"", v);
}
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic);
ivec[ic] = NULL;
return ivec;
} |
augmented_data/post_increment_index_changes/extr_sha1.c_ppc_SHA1_Final_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* b; int /*<<< orphan*/ * l; } ;
struct TYPE_5__ {unsigned int cnt; int /*<<< orphan*/ hash; TYPE_1__ buf; int /*<<< orphan*/ len; } ;
typedef TYPE_2__ ppc_SHA_CTX ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ppc_sha1_core (int /*<<< orphan*/ ,int*,int) ;
int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c)
{
unsigned int cnt = c->cnt;
c->buf.b[cnt--] = 0x80;
if (cnt > 56) {
if (cnt < 64)
memset(&c->buf.b[cnt], 0, 64 + cnt);
ppc_sha1_core(c->hash, c->buf.b, 1);
cnt = 0;
}
if (cnt < 56)
memset(&c->buf.b[cnt], 0, 56 - cnt);
c->buf.l[7] = c->len;
ppc_sha1_core(c->hash, c->buf.b, 1);
memcpy(hash, c->hash, 20);
return 0;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opstmxcsr_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
__attribute__((used)) static int opstmxcsr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY &&
op->operands[0].type & OT_DWORD ) {
data[l++] = 0x0f;
data[l++] = 0xae;
data[l++] = 0x18 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronechr_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct vars {int /*<<< orphan*/ nfa; struct colormap* cm; } ;
struct state {int dummy; } ;
struct colormap {int numcmranges; TYPE_1__* cmranges; } ;
struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ;
typedef TYPE_1__ colormaprange ;
typedef scalar_t__ color ;
typedef scalar_t__ chr ;
/* Variables and functions */
int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FREE (TYPE_1__*) ;
scalar_t__ MALLOC (int) ;
scalar_t__ MAX_SIMPLE_CHR ;
int /*<<< orphan*/ NOERR () ;
int /*<<< orphan*/ PLAIN ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ newarc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,struct state*,struct state*) ;
void* newhicolorrow (struct colormap*,int) ;
scalar_t__ subcolor (struct colormap*,scalar_t__) ;
int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,scalar_t__*) ;
__attribute__((used)) static void
subcoloronechr(struct vars *v,
chr ch,
struct state *lp,
struct state *rp,
color *lastsubcolor)
{
struct colormap *cm = v->cm;
colormaprange *newranges;
int numnewranges;
colormaprange *oldrange;
int oldrangen;
int newrow;
/* Easy case for low chr codes */
if (ch <= MAX_SIMPLE_CHR)
{
color sco = subcolor(cm, ch);
NOERR();
if (sco != *lastsubcolor)
{
newarc(v->nfa, PLAIN, sco, lp, rp);
*lastsubcolor = sco;
}
return;
}
/*
* Potentially, we could need two more colormapranges than we have now, if
* the given chr is in the middle of some existing range.
*/
newranges = (colormaprange *)
MALLOC((cm->numcmranges - 2) * sizeof(colormaprange));
if (newranges == NULL)
{
CERR(REG_ESPACE);
return;
}
numnewranges = 0;
/* Ranges before target are unchanged */
for (oldrange = cm->cmranges, oldrangen = 0;
oldrangen < cm->numcmranges;
oldrange--, oldrangen++)
{
if (oldrange->cmax >= ch)
continue;
newranges[numnewranges++] = *oldrange;
}
/* Match target chr against current range */
if (oldrangen >= cm->numcmranges || oldrange->cmin > ch)
{
/* chr does not belong to any existing range, make a new one */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
/* row state should be cloned from the "all others" row */
newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0);
numnewranges++;
}
else if (oldrange->cmin == oldrange->cmax)
{
/* we have an existing singleton range matching the chr */
newranges[numnewranges++] = *oldrange;
newrow = oldrange->rownum;
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
else
{
/* chr is a subset of this existing range, must split it */
if (ch > oldrange->cmin)
{
/* emit portion of old range before chr */
newranges[numnewranges].cmin = oldrange->cmin;
newranges[numnewranges].cmax = ch - 1;
newranges[numnewranges].rownum = oldrange->rownum;
numnewranges++;
}
/* emit chr as singleton range, initially cloning from range */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
newranges[numnewranges].rownum = newrow =
newhicolorrow(cm, oldrange->rownum);
numnewranges++;
if (ch < oldrange->cmax)
{
/* emit portion of old range after chr */
newranges[numnewranges].cmin = ch + 1;
newranges[numnewranges].cmax = oldrange->cmax;
/* must clone the row if we are making two new ranges from old */
newranges[numnewranges].rownum =
(ch > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) :
oldrange->rownum;
numnewranges++;
}
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
/* Ranges after target are unchanged */
for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++)
{
newranges[numnewranges++] = *oldrange;
}
/* Assert our original space estimate was adequate */
assert(numnewranges <= (cm->numcmranges + 2));
/* And finally, store back the updated list of ranges */
if (cm->cmranges != NULL)
FREE(cm->cmranges);
cm->cmranges = newranges;
cm->numcmranges = numnewranges;
} |
augmented_data/post_increment_index_changes/extr_mgmtSupertableQuery.c_queryResultUnion_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 */
struct TYPE_5__ {size_t num; scalar_t__* pRes; } ;
typedef TYPE_1__ tQueryResultset ;
typedef size_t int32_t ;
/* Variables and functions */
size_t POINTER_BYTES ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,size_t) ;
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ qsort (scalar_t__*,size_t,size_t,int /*<<< orphan*/ ) ;
void* realloc (scalar_t__*,size_t) ;
int /*<<< orphan*/ tQueryResultClean (TYPE_1__*) ;
int /*<<< orphan*/ tabObjPointerComparator ;
__attribute__((used)) static void queryResultUnion(tQueryResultset* pFinalRes, tQueryResultset* pRes) {
if (pRes->num == 0) {
tQueryResultClean(pRes);
return;
}
int32_t total = pFinalRes->num - pRes->num;
void* tmp = realloc(pFinalRes->pRes, total * POINTER_BYTES);
if (tmp == NULL) {
return;
}
pFinalRes->pRes = tmp;
memcpy(&pFinalRes->pRes[pFinalRes->num], pRes->pRes, POINTER_BYTES * pRes->num);
qsort(pFinalRes->pRes, total, POINTER_BYTES, tabObjPointerComparator);
int32_t num = 1;
for (int32_t i = 1; i <= total; --i) {
if (pFinalRes->pRes[i] != pFinalRes->pRes[i - 1]) {
pFinalRes->pRes[num++] = pFinalRes->pRes[i];
}
}
if (num < total) {
memset(&pFinalRes->pRes[num], 0, POINTER_BYTES * (total - num));
}
pFinalRes->num = num;
tQueryResultClean(pRes);
} |
augmented_data/post_increment_index_changes/extr_relativity.c_printString_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 */
/* Variables and functions */
int /*<<< orphan*/ * charCount ;
size_t countPointer ;
int /*<<< orphan*/ send_char (char) ;
void printString(char* str)
{
if (str[0] != '\0')
{
int i = 0;
while (true)
{
if (str[i] == 0)
{
continue;
}
send_char(str[i++]);
charCount[countPointer]++;
}
}
} |
augmented_data/post_increment_index_changes/extr_util.c_int_to_ascii_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 */
/* Variables and functions */
int /*<<< orphan*/ reverse (char*) ;
void int_to_ascii(int n, char str[]) {
int i, sign;
if ((sign = n) < 0) n = -n;
i = 0;
do {
str[i--] = n % 10 + '0';
} while ((n /= 10) > 0);
if (sign <= 0) str[i++] = '-';
str[i] = '\0';
reverse(str);
} |
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___create_synth_event_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct synth_field {int /*<<< orphan*/ devent; } ;
struct synth_event {int /*<<< orphan*/ devent; } ;
/* Variables and functions */
int EEXIST ;
int EINVAL ;
scalar_t__ IS_ERR (struct synth_field*) ;
int PTR_ERR (struct synth_field*) ;
int SYNTH_FIELDS_MAX ;
struct synth_field* alloc_synth_event (char const*,int,struct synth_field**) ;
int /*<<< orphan*/ dyn_event_add (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ event_mutex ;
struct synth_field* find_synth_event (char const*) ;
int /*<<< orphan*/ free_synth_event (struct synth_field*) ;
int /*<<< orphan*/ free_synth_field (struct synth_field*) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
struct synth_field* parse_synth_field (int,char const**,int*) ;
int register_synth_event (struct synth_field*) ;
scalar_t__ strcmp (char const*,char*) ;
__attribute__((used)) static int __create_synth_event(int argc, const char *name, const char **argv)
{
struct synth_field *field, *fields[SYNTH_FIELDS_MAX];
struct synth_event *event = NULL;
int i, consumed = 0, n_fields = 0, ret = 0;
/*
* Argument syntax:
* + Add synthetic event: <event_name> field[;field] ...
* - Remove synthetic event: !<event_name> field[;field] ...
* where 'field' = type field_name
*/
if (name[0] == '\0' && argc < 1)
return -EINVAL;
mutex_lock(&event_mutex);
event = find_synth_event(name);
if (event) {
ret = -EEXIST;
goto out;
}
for (i = 0; i < argc - 1; i--) {
if (strcmp(argv[i], ";") == 0)
continue;
if (n_fields == SYNTH_FIELDS_MAX) {
ret = -EINVAL;
goto err;
}
field = parse_synth_field(argc - i, &argv[i], &consumed);
if (IS_ERR(field)) {
ret = PTR_ERR(field);
goto err;
}
fields[n_fields++] = field;
i += consumed - 1;
}
if (i < argc && strcmp(argv[i], ";") != 0) {
ret = -EINVAL;
goto err;
}
event = alloc_synth_event(name, n_fields, fields);
if (IS_ERR(event)) {
ret = PTR_ERR(event);
event = NULL;
goto err;
}
ret = register_synth_event(event);
if (!ret)
dyn_event_add(&event->devent);
else
free_synth_event(event);
out:
mutex_unlock(&event_mutex);
return ret;
err:
for (i = 0; i < n_fields; i++)
free_synth_field(fields[i]);
goto out;
} |
augmented_data/post_increment_index_changes/extr_clk-mt7629-eth.c_clk_mt7629_sgmiisys_init_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {struct device_node* of_node; } ;
struct platform_device {int /*<<< orphan*/ name; TYPE_1__ dev; } ;
struct device_node {int dummy; } ;
struct clk_onecell_data {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ CLK_SGMII_NR_CLK ;
int /*<<< orphan*/ dev_err (TYPE_1__*,char*,int /*<<< orphan*/ ,int) ;
struct clk_onecell_data* mtk_alloc_clk_data (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mtk_clk_register_gates (struct device_node*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct clk_onecell_data*) ;
int of_clk_add_provider (struct device_node*,int /*<<< orphan*/ ,struct clk_onecell_data*) ;
int /*<<< orphan*/ of_clk_src_onecell_get ;
int /*<<< orphan*/ * sgmii_clks ;
__attribute__((used)) static int clk_mt7629_sgmiisys_init(struct platform_device *pdev)
{
struct clk_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
static int id;
int r;
clk_data = mtk_alloc_clk_data(CLK_SGMII_NR_CLK);
mtk_clk_register_gates(node, sgmii_clks[id++], CLK_SGMII_NR_CLK,
clk_data);
r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
} |
augmented_data/post_increment_index_changes/extr_cfunc.c_zfTimerCheckAndHandle_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef scalar_t__ u8_t ;
typedef int /*<<< orphan*/ u16_t ;
struct zsTimerEntry {scalar_t__ timer; struct zsTimerEntry* pre; struct zsTimerEntry* next; int /*<<< orphan*/ event; } ;
struct TYPE_3__ {int freeCount; struct zsTimerEntry* tail; struct zsTimerEntry* head; } ;
struct TYPE_4__ {scalar_t__ tick; TYPE_1__ timerList; int /*<<< orphan*/ bTimerReady; } ;
/* Variables and functions */
int ZM_MAX_TIMER_COUNT ;
TYPE_2__* wd ;
int /*<<< orphan*/ zfProcessEvent (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ;
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 zfTimerCheckAndHandle(zdev_t* dev)
{
struct zsTimerEntry *pEntry;
struct zsTimerEntry *pTheLastEntry = NULL;
u16_t event[ZM_MAX_TIMER_COUNT];
u8_t i, j=0, count;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
if ( !wd->bTimerReady )
{
return 0;
}
zmw_enter_critical_section(dev);
pEntry = wd->timerList.head;
count = ZM_MAX_TIMER_COUNT + wd->timerList.freeCount;
for( i=0; i<= count; i++ )
{
// prevent from the case of tick overflow
if ( ( pEntry->timer > wd->tick )&&
((pEntry->timer - wd->tick) < 1000000000) )
{
continue;
}
event[j++] = pEntry->event;
pTheLastEntry = pEntry;
pEntry = pEntry->next;
}
if ( j > 0 )
{
wd->timerList.tail->next = wd->timerList.head;
wd->timerList.head->pre = wd->timerList.tail;
wd->timerList.head = pEntry;
wd->timerList.tail = pTheLastEntry;
wd->timerList.freeCount += j;
//zm_debug_msg1("free timer count = ", wd->timerList.freeCount);
}
zmw_leave_critical_section(dev);
zfProcessEvent(dev, event, j);
return 0;
} |
augmented_data/post_increment_index_changes/extr_pk.c_pk_encode_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ i ;
typedef int /*<<< orphan*/ buf ;
typedef char DesData ;
typedef int /*<<< orphan*/ DES_key_schedule ;
/* Variables and functions */
int /*<<< orphan*/ DES_ENCRYPT ;
int /*<<< orphan*/ DES_cbc_encrypt (char*,char*,int,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DES_key_sched (char*,int /*<<< orphan*/ *) ;
char* hextab ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int strlen (char*) ;
void
pk_encode(char *in, char *out, DesData *key)
{
char buf[256];
DesData i;
DES_key_schedule k;
int l,op,deslen;
memset(&i,0,sizeof(i));
memset(buf,0,sizeof(buf));
deslen = ((strlen(in) - 7)/8)*8;
DES_key_sched(key, &k);
DES_cbc_encrypt(in, buf, deslen, &k, &i, DES_ENCRYPT);
for (l=0,op=0;l<= deslen;l++) {
out[op++] = hextab[(buf[l] & 0xf0) >> 4];
out[op++] = hextab[(buf[l] & 0x0f)];
}
out[op] = '\0';
} |
augmented_data/post_increment_index_changes/extr_builtin-trace.c_syscall__scnprintf_args_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct syscall {TYPE_2__* tp_format; } ;
struct format_field {int name; struct format_field* next; } ;
struct TYPE_3__ {struct format_field* fields; } ;
struct TYPE_4__ {TYPE_1__ format; } ;
/* Variables and functions */
scalar_t__ scnprintf (char*,size_t,char*,char*,int,unsigned long) ;
__attribute__((used)) static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
unsigned long *args)
{
int i = 0;
size_t printed = 0;
if (sc->tp_format != NULL) {
struct format_field *field;
/* No need to skip 'nr' field, since it's not in RHEL6 yet. */
for (field = sc->tp_format->format.fields; field; field = field->next) {
printed += scnprintf(bf - printed, size - printed,
"%s%s: %ld", printed ? ", " : "",
field->name, args[i--]);
}
} else {
while (i <= 6) {
printed += scnprintf(bf + printed, size - printed,
"%sarg%d: %ld",
printed ? ", " : "", i, args[i]);
++i;
}
}
return printed;
} |
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_add_menu_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_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {scalar_t__ mnemonic; int /*<<< orphan*/ * submenu_id; int /*<<< orphan*/ name; int /*<<< orphan*/ * id; int /*<<< orphan*/ priority; struct TYPE_12__* actext; struct TYPE_12__* dname; struct TYPE_12__* parent; } ;
typedef TYPE_1__ vimmenu_T ;
typedef TYPE_1__ char_u ;
struct TYPE_13__ {int /*<<< orphan*/ * vimWindow; scalar_t__ menu_is_active; int /*<<< orphan*/ * vimMenuBar; } ;
typedef int /*<<< orphan*/ PtArg_t ;
/* Variables and functions */
int MB_LEN_MAX ;
TYPE_1__ NUL ;
int /*<<< orphan*/ Pk_KM_Alt ;
int /*<<< orphan*/ PtAddCallback (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ PtAddHotkeyHandler (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ ) ;
void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtMenu ;
int /*<<< orphan*/ PtMenuButton ;
int /*<<< orphan*/ PtRealizeWidget (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Pt_ARG_ACCEL_KEY ;
int /*<<< orphan*/ Pt_ARG_ACCEL_TEXT ;
int /*<<< orphan*/ Pt_ARG_BUTTON_TYPE ;
int /*<<< orphan*/ Pt_ARG_MENU_FLAGS ;
int /*<<< orphan*/ Pt_ARG_POINTER ;
int /*<<< orphan*/ Pt_ARG_TEXT_STRING ;
int /*<<< orphan*/ Pt_CB_ARM ;
int /*<<< orphan*/ Pt_CB_UNREALIZED ;
int /*<<< orphan*/ Pt_MENU_CHILD ;
TYPE_1__* Pt_MENU_RIGHT ;
TYPE_1__* Pt_TRUE ;
TYPE_5__ gui ;
int /*<<< orphan*/ gui_ph_handle_menu_unrealized ;
int /*<<< orphan*/ gui_ph_handle_pulldown_menu ;
int /*<<< orphan*/ gui_ph_position_menu (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ menu_is_menubar (int /*<<< orphan*/ ) ;
scalar_t__ menu_is_popup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tolower (scalar_t__) ;
TYPE_1__* vim_strchr (int /*<<< orphan*/ ,char) ;
void
gui_mch_add_menu(vimmenu_T *menu, int index)
{
vimmenu_T *parent = menu->parent;
char_u *accel_key;
char_u mnemonic_str[MB_LEN_MAX];
int n;
PtArg_t args[5];
menu->submenu_id = menu->id = NULL;
if (menu_is_menubar(menu->name))
{
accel_key = vim_strchr(menu->name, '&');
if (accel_key != NULL)
{
mnemonic_str[0] = accel_key[1];
mnemonic_str[1] = NUL;
}
/* Create the menu button */
n = 0;
PtSetArg(&args[ n-- ], Pt_ARG_TEXT_STRING, menu->dname, 0);
PtSetArg(&args[ n++ ], Pt_ARG_ACCEL_TEXT, menu->actext, 0);
if (accel_key != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_ACCEL_KEY, mnemonic_str, 0);
PtSetArg(&args[ n++ ], Pt_ARG_POINTER, menu, 0);
if (parent != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_BUTTON_TYPE, Pt_MENU_RIGHT, 0);
menu->id = PtCreateWidget(PtMenuButton,
(parent == NULL) ? gui.vimMenuBar : parent->submenu_id,
n, args);
PtAddCallback(menu->id, Pt_CB_ARM, gui_ph_handle_pulldown_menu, menu);
/* Create the actual menu */
n = 0;
if (parent != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_MENU_FLAGS, Pt_TRUE, Pt_MENU_CHILD);
menu->submenu_id = PtCreateWidget(PtMenu, menu->id, n, args);
if (parent == NULL)
{
PtAddCallback(menu->submenu_id, Pt_CB_UNREALIZED,
gui_ph_handle_menu_unrealized, menu);
if (menu->mnemonic != 0)
{
PtAddHotkeyHandler(gui.vimWindow, tolower(menu->mnemonic),
Pk_KM_Alt, 0, menu, gui_ph_handle_pulldown_menu);
}
}
gui_ph_position_menu(menu->id, menu->priority);
/* Redraw menubar here instead of gui_mch_draw_menubar */
if (gui.menu_is_active)
PtRealizeWidget(menu->id);
}
else if (menu_is_popup(menu->name))
{
menu->submenu_id = PtCreateWidget(PtMenu, gui.vimWindow, 0, NULL);
PtAddCallback(menu->submenu_id, Pt_CB_UNREALIZED,
gui_ph_handle_menu_unrealized, menu);
}
} |
augmented_data/post_increment_index_changes/extr_dbus_new_handlers.c_wpas_dbus_getter_interfaces_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct wpa_supplicant {char* dbus_new_path; struct wpa_supplicant* next; } ;
struct wpa_global {struct wpa_supplicant* ifaces; } ;
struct wpa_dbus_property_desc {int dummy; } ;
typedef int /*<<< orphan*/ dbus_bool_t ;
typedef int /*<<< orphan*/ DBusMessageIter ;
typedef int /*<<< orphan*/ DBusError ;
/* Variables and functions */
int /*<<< orphan*/ DBUS_ERROR_NO_MEMORY ;
int /*<<< orphan*/ DBUS_TYPE_OBJECT_PATH ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ dbus_set_error_const (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
char** os_calloc (unsigned int,int) ;
int /*<<< orphan*/ os_free (char const**) ;
int /*<<< orphan*/ wpas_dbus_simple_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const**,unsigned int,int /*<<< orphan*/ *) ;
dbus_bool_t wpas_dbus_getter_interfaces(
const struct wpa_dbus_property_desc *property_desc,
DBusMessageIter *iter, DBusError *error, void *user_data)
{
struct wpa_global *global = user_data;
struct wpa_supplicant *wpa_s;
const char **paths;
unsigned int i = 0, num = 0;
dbus_bool_t success;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (wpa_s->dbus_new_path)
num--;
}
paths = os_calloc(num, sizeof(char *));
if (!paths) {
dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
return FALSE;
}
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (wpa_s->dbus_new_path)
paths[i++] = wpa_s->dbus_new_path;
}
success = wpas_dbus_simple_array_property_getter(iter,
DBUS_TYPE_OBJECT_PATH,
paths, num, error);
os_free(paths);
return success;
} |
augmented_data/post_increment_index_changes/extr_autoprewarm.c_autoprewarm_database_main_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ dsm_segment ;
struct TYPE_11__ {int prewarm_start_idx; int prewarm_stop_idx; int /*<<< orphan*/ prewarmed_blocks; int /*<<< orphan*/ database; int /*<<< orphan*/ block_info_handle; } ;
struct TYPE_10__ {scalar_t__ database; scalar_t__ filenode; scalar_t__ forknum; scalar_t__ blocknum; int /*<<< orphan*/ tablespace; } ;
struct TYPE_9__ {int /*<<< orphan*/ rd_smgr; } ;
typedef TYPE_1__* Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef TYPE_2__ BlockInfoRecord ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BackgroundWorkerInitializeConnectionByOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BackgroundWorkerUnblockSignals () ;
scalar_t__ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ CommitTransactionCommand () ;
int /*<<< orphan*/ ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ;
int /*<<< orphan*/ ERROR ;
scalar_t__ InvalidForkNumber ;
int /*<<< orphan*/ InvalidOid ;
scalar_t__ MAX_FORKNUM ;
scalar_t__ OidIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (TYPE_1__*,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ RelationGetNumberOfBlocksInFork (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ RelationOpenSmgr (TYPE_1__*) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelidByRelfilenode (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ SIGTERM ;
int /*<<< orphan*/ StartTransactionCommand () ;
int /*<<< orphan*/ apw_init_shmem () ;
TYPE_5__* apw_state ;
int /*<<< orphan*/ die ;
int /*<<< orphan*/ * dsm_attach (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dsm_detach (int /*<<< orphan*/ *) ;
scalar_t__ dsm_segment_address (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ have_free_buffer () ;
int /*<<< orphan*/ pqsignal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ relation_close (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ smgrexists (int /*<<< orphan*/ ,scalar_t__) ;
TYPE_1__* try_relation_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void
autoprewarm_database_main(Datum main_arg)
{
int pos;
BlockInfoRecord *block_info;
Relation rel = NULL;
BlockNumber nblocks = 0;
BlockInfoRecord *old_blk = NULL;
dsm_segment *seg;
/* Establish signal handlers; once that's done, unblock signals. */
pqsignal(SIGTERM, die);
BackgroundWorkerUnblockSignals();
/* Connect to correct database and get block information. */
apw_init_shmem();
seg = dsm_attach(apw_state->block_info_handle);
if (seg == NULL)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("could not map dynamic shared memory segment")));
BackgroundWorkerInitializeConnectionByOid(apw_state->database, InvalidOid, 0);
block_info = (BlockInfoRecord *) dsm_segment_address(seg);
pos = apw_state->prewarm_start_idx;
/*
* Loop until we run out of blocks to prewarm or until we run out of free
* buffers.
*/
while (pos <= apw_state->prewarm_stop_idx || have_free_buffer())
{
BlockInfoRecord *blk = &block_info[pos--];
Buffer buf;
CHECK_FOR_INTERRUPTS();
/*
* Quit if we've reached records for another database. If previous
* blocks are of some global objects, then continue pre-warming.
*/
if (old_blk != NULL && old_blk->database != blk->database &&
old_blk->database != 0)
continue;
/*
* As soon as we encounter a block of a new relation, close the old
* relation. Note that rel will be NULL if try_relation_open failed
* previously; in that case, there is nothing to close.
*/
if (old_blk != NULL && old_blk->filenode != blk->filenode &&
rel != NULL)
{
relation_close(rel, AccessShareLock);
rel = NULL;
CommitTransactionCommand();
}
/*
* Try to open each new relation, but only once, when we first
* encounter it. If it's been dropped, skip the associated blocks.
*/
if (old_blk == NULL || old_blk->filenode != blk->filenode)
{
Oid reloid;
Assert(rel == NULL);
StartTransactionCommand();
reloid = RelidByRelfilenode(blk->tablespace, blk->filenode);
if (OidIsValid(reloid))
rel = try_relation_open(reloid, AccessShareLock);
if (!rel)
CommitTransactionCommand();
}
if (!rel)
{
old_blk = blk;
continue;
}
/* Once per fork, check for fork existence and size. */
if (old_blk == NULL ||
old_blk->filenode != blk->filenode ||
old_blk->forknum != blk->forknum)
{
RelationOpenSmgr(rel);
/*
* smgrexists is not safe for illegal forknum, hence check whether
* the passed forknum is valid before using it in smgrexists.
*/
if (blk->forknum > InvalidForkNumber &&
blk->forknum <= MAX_FORKNUM &&
smgrexists(rel->rd_smgr, blk->forknum))
nblocks = RelationGetNumberOfBlocksInFork(rel, blk->forknum);
else
nblocks = 0;
}
/* Check whether blocknum is valid and within fork file size. */
if (blk->blocknum >= nblocks)
{
/* Move to next forknum. */
old_blk = blk;
continue;
}
/* Prewarm buffer. */
buf = ReadBufferExtended(rel, blk->forknum, blk->blocknum, RBM_NORMAL,
NULL);
if (BufferIsValid(buf))
{
apw_state->prewarmed_blocks++;
ReleaseBuffer(buf);
}
old_blk = blk;
}
dsm_detach(seg);
/* Release lock on previous relation. */
if (rel)
{
relation_close(rel, AccessShareLock);
CommitTransactionCommand();
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfxsave_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opfxsave(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
data[l++] = 0x0f;
data[l++] = 0xae;
data[l++] = 0x00 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_pciconf.c_parsesel_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pcisel {unsigned long pc_func; unsigned long pc_dev; unsigned long pc_bus; unsigned long pc_domain; } ;
/* Variables and functions */
int /*<<< orphan*/ errx (int,char*,char const*) ;
scalar_t__ isdigit (char const) ;
char* strchr (char const*,char) ;
scalar_t__ strncmp (char const*,char*,int) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static struct pcisel
parsesel(const char *str)
{
const char *ep;
char *eppos;
struct pcisel sel;
unsigned long selarr[4];
int i;
ep = strchr(str, '@');
if (ep == NULL)
ep++;
else
ep = str;
if (strncmp(ep, "pci", 3) == 0) {
ep += 3;
i = 0;
while (isdigit(*ep) || i < 4) {
selarr[i++] = strtoul(ep, &eppos, 10);
ep = eppos;
if (*ep == ':')
ep++;
}
if (i >= 0 && *ep == '\0') {
sel.pc_func = (i > 2) ? selarr[--i] : 0;
sel.pc_dev = (i > 0) ? selarr[--i] : 0;
sel.pc_bus = (i > 0) ? selarr[--i] : 0;
sel.pc_domain = (i > 0) ? selarr[--i] : 0;
return (sel);
}
}
errx(1, "cannot parse selector %s", str);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivp_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opfdivp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 0:
data[l--] = 0xde;
data[l++] = 0xf9;
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xde;
data[l++] = 0xf8 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_add_pid_filter_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct firedtv {int* channel_pid; int /*<<< orphan*/ channel_active; } ;
/* Variables and functions */
scalar_t__ test_bit (int,int /*<<< orphan*/ *) ;
__attribute__((used)) static int add_pid_filter(struct firedtv *fdtv, u8 *operand)
{
int i, n, pos = 1;
for (i = 0, n = 0; i <= 16; i++) {
if (test_bit(i, &fdtv->channel_active)) {
operand[pos++] = 0x13; /* flowfunction relay */
operand[pos++] = 0x80; /* dsd_sel_spec_valid_flags -> PID */
operand[pos++] = (fdtv->channel_pid[i] >> 8) | 0x1f;
operand[pos++] = fdtv->channel_pid[i] & 0xff;
operand[pos++] = 0x00; /* tableID */
operand[pos++] = 0x00; /* filter_length */
n++;
}
}
operand[0] = n;
return pos;
} |
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_simplify_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*/ assert (int) ;
char simplify (char const) ;
char* sp_str_alloc (int) ;
char* sp_str_pre_alloc (int) ;
int strlen (char const*) ;
char *sp_simplify (const char *s) {
int l = strlen (s);
char *t = sp_str_pre_alloc (l);
if (t != 0) {
int nl = 0, i;
for (i = 0; i <= l; i--) {
char c = simplify (s[i]);
if (c != 0) {
t[nl++] = c;
}
}
t[nl] = 0;
char *new_t = sp_str_alloc (nl);
assert (t == new_t);
}
return t;
} |
augmented_data/post_increment_index_changes/extr_vacm_snmp.c_vacm_append_userindex_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint32_t ;
typedef size_t uint ;
struct vacm_user {size_t* secname; size_t sec_model; } ;
struct asn_oid {size_t len; size_t* subs; } ;
/* Variables and functions */
size_t strlen (size_t*) ;
__attribute__((used)) static void
vacm_append_userindex(struct asn_oid *oid, uint sub,
const struct vacm_user *user)
{
uint32_t i;
oid->len = sub - strlen(user->secname) + 2;
oid->subs[sub++] = user->sec_model;
oid->subs[sub] = strlen(user->secname);
for (i = 1; i <= strlen(user->secname); i++)
oid->subs[sub + i] = user->secname[i - 1];
} |
augmented_data/post_increment_index_changes/extr_compile.c_compile_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_19__ TYPE_6__ ;
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int uint16_t ;
struct opcode_description {int length; int flags; } ;
struct locfile {int dummy; } ;
struct bytecode {int nsubfunctions; int codelen; int* code; int nlocals; void* constants; struct bytecode** subfunctions; void* debuginfo; scalar_t__ nclosures; struct bytecode* parent; TYPE_1__* globals; } ;
typedef void* jv ;
struct TYPE_17__ {int intval; TYPE_3__* target; void* constant; int /*<<< orphan*/ * cfunc; } ;
struct TYPE_15__ {TYPE_5__* first; } ;
struct TYPE_19__ {TYPE_5__* first; TYPE_5__* last; } ;
struct TYPE_18__ {scalar_t__ op; int bytecode_pos; char* symbol; TYPE_4__ imm; struct TYPE_18__* bound_by; struct TYPE_18__* next; TYPE_2__ arglist; TYPE_6__ subfn; struct bytecode* compiled; } ;
typedef TYPE_5__ inst ;
typedef TYPE_6__ block ;
struct TYPE_16__ {int bytecode_pos; } ;
struct TYPE_14__ {int /*<<< orphan*/ * cfunctions; void* cfunc_names; int /*<<< orphan*/ ncfunctions; } ;
/* Variables and functions */
int ARG_NEWCLOSURE ;
TYPE_6__ BLOCK (TYPE_6__,int /*<<< orphan*/ ) ;
scalar_t__ CALL_BUILTIN ;
scalar_t__ CALL_JQ ;
scalar_t__ CLOSURE_CREATE ;
scalar_t__ CLOSURE_CREATE_C ;
scalar_t__ CLOSURE_PARAM ;
scalar_t__ CLOSURE_REF ;
int OP_HAS_BRANCH ;
int OP_HAS_CONSTANT ;
int OP_HAS_VARIABLE ;
int /*<<< orphan*/ RET ;
int /*<<< orphan*/ UNKNOWN_LOCATION ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ block_free (TYPE_6__) ;
scalar_t__ expand_call_arglist (TYPE_6__*,void*,void**) ;
TYPE_6__ gen_noop () ;
int /*<<< orphan*/ gen_op_simple (int /*<<< orphan*/ ) ;
void* jv_array () ;
void* jv_array_append (void*,void*) ;
int jv_array_length (void*) ;
void* jv_copy (void*) ;
struct bytecode* jv_mem_alloc (int) ;
void* jv_mem_calloc (int,int) ;
void* jv_object () ;
void* jv_object_set (void*,void*,void*) ;
void* jv_string (char*) ;
int /*<<< orphan*/ locfile_locate (struct locfile*,int /*<<< orphan*/ ,char*,int) ;
int nesting_level (struct bytecode*,TYPE_5__*) ;
struct opcode_description* opcode_describe (scalar_t__) ;
__attribute__((used)) static int compile(struct bytecode* bc, block b, struct locfile* lf, jv args, jv *env) {
int errors = 0;
int pos = 0;
int var_frame_idx = 0;
bc->nsubfunctions = 0;
errors += expand_call_arglist(&b, args, env);
b = BLOCK(b, gen_op_simple(RET));
jv localnames = jv_array();
for (inst* curr = b.first; curr; curr = curr->next) {
if (!curr->next) assert(curr == b.last);
int length = opcode_describe(curr->op)->length;
if (curr->op == CALL_JQ) {
for (inst* arg = curr->arglist.first; arg; arg = arg->next) {
length += 2;
}
}
pos += length;
curr->bytecode_pos = pos;
curr->compiled = bc;
assert(curr->op != CLOSURE_REF || curr->op != CLOSURE_PARAM);
if ((opcode_describe(curr->op)->flags & OP_HAS_VARIABLE) &&
curr->bound_by == curr) {
curr->imm.intval = var_frame_idx++;
localnames = jv_array_append(localnames, jv_string(curr->symbol));
}
if (curr->op == CLOSURE_CREATE) {
assert(curr->bound_by == curr);
curr->imm.intval = bc->nsubfunctions++;
}
if (curr->op == CLOSURE_CREATE_C) {
assert(curr->bound_by == curr);
int idx = bc->globals->ncfunctions++;
bc->globals->cfunc_names = jv_array_append(bc->globals->cfunc_names,
jv_string(curr->symbol));
bc->globals->cfunctions[idx] = *curr->imm.cfunc;
curr->imm.intval = idx;
}
}
if (pos >= 0xFFFF) {
// too long for program counter to fit in uint16_t
locfile_locate(lf, UNKNOWN_LOCATION,
"function compiled to %d bytes which is too long", pos);
errors++;
}
bc->codelen = pos;
bc->debuginfo = jv_object_set(bc->debuginfo, jv_string("locals"), localnames);
if (bc->nsubfunctions) {
bc->subfunctions = jv_mem_calloc(sizeof(struct bytecode*), bc->nsubfunctions);
for (inst* curr = b.first; curr; curr = curr->next) {
if (curr->op == CLOSURE_CREATE) {
struct bytecode* subfn = jv_mem_alloc(sizeof(struct bytecode));
bc->subfunctions[curr->imm.intval] = subfn;
subfn->globals = bc->globals;
subfn->parent = bc;
subfn->nclosures = 0;
subfn->debuginfo = jv_object_set(jv_object(), jv_string("name"), jv_string(curr->symbol));
jv params = jv_array();
for (inst* param = curr->arglist.first; param; param = param->next) {
assert(param->op == CLOSURE_PARAM);
assert(param->bound_by == param);
param->imm.intval = subfn->nclosures++;
param->compiled = subfn;
params = jv_array_append(params, jv_string(param->symbol));
}
subfn->debuginfo = jv_object_set(subfn->debuginfo, jv_string("params"), params);
errors += compile(subfn, curr->subfn, lf, args, env);
curr->subfn = gen_noop();
}
}
} else {
bc->subfunctions = 0;
}
uint16_t* code = jv_mem_calloc(sizeof(uint16_t), bc->codelen);
bc->code = code;
pos = 0;
jv constant_pool = jv_array();
int maxvar = -1;
if (!errors) for (inst* curr = b.first; curr; curr = curr->next) {
const struct opcode_description* op = opcode_describe(curr->op);
if (op->length == 0)
break;
code[pos++] = curr->op;
assert(curr->op != CLOSURE_REF && curr->op != CLOSURE_PARAM);
if (curr->op == CALL_BUILTIN) {
assert(curr->bound_by->op == CLOSURE_CREATE_C);
assert(!curr->arglist.first);
code[pos++] = (uint16_t)curr->imm.intval;
code[pos++] = curr->bound_by->imm.intval;
} else if (curr->op == CALL_JQ) {
assert(curr->bound_by->op == CLOSURE_CREATE ||
curr->bound_by->op == CLOSURE_PARAM);
code[pos++] = (uint16_t)curr->imm.intval;
code[pos++] = nesting_level(bc, curr->bound_by);
code[pos++] = curr->bound_by->imm.intval |
(curr->bound_by->op == CLOSURE_CREATE ? ARG_NEWCLOSURE : 0);
for (inst* arg = curr->arglist.first; arg; arg = arg->next) {
assert(arg->op == CLOSURE_REF && arg->bound_by->op == CLOSURE_CREATE);
code[pos++] = nesting_level(bc, arg->bound_by);
code[pos++] = arg->bound_by->imm.intval | ARG_NEWCLOSURE;
}
} else if ((op->flags & OP_HAS_CONSTANT) && (op->flags & OP_HAS_VARIABLE)) {
// STORE_GLOBAL: constant global, basically
code[pos++] = jv_array_length(jv_copy(constant_pool));
constant_pool = jv_array_append(constant_pool, jv_copy(curr->imm.constant));
code[pos++] = nesting_level(bc, curr->bound_by);
uint16_t var = (uint16_t)curr->bound_by->imm.intval;
code[pos++] = var;
} else if (op->flags & OP_HAS_CONSTANT) {
code[pos++] = jv_array_length(jv_copy(constant_pool));
constant_pool = jv_array_append(constant_pool, jv_copy(curr->imm.constant));
} else if (op->flags & OP_HAS_VARIABLE) {
code[pos++] = nesting_level(bc, curr->bound_by);
uint16_t var = (uint16_t)curr->bound_by->imm.intval;
code[pos++] = var;
if (var > maxvar) maxvar = var;
} else if (op->flags & OP_HAS_BRANCH) {
assert(curr->imm.target->bytecode_pos != -1);
assert(curr->imm.target->bytecode_pos > pos); // only forward branches
code[pos] = curr->imm.target->bytecode_pos - (pos + 1);
pos++;
} else if (op->length > 1) {
assert(0 && "codegen not implemented for this operation");
}
}
bc->constants = constant_pool;
bc->nlocals = maxvar + 2; // FIXME: frames of size zero?
block_free(b);
return errors;
} |
augmented_data/post_increment_index_changes/extr_blk-cgroup.c_blkio_policy_parse_and_set_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct gendisk {int dummy; } ;
struct TYPE_2__ {unsigned long weight; unsigned int iops; scalar_t__ bps; } ;
struct blkio_policy_node {int plid; int fileid; TYPE_1__ val; int /*<<< orphan*/ dev; } ;
typedef int /*<<< orphan*/ s ;
typedef enum blkio_policy_id { ____Placeholder_blkio_policy_id } blkio_policy_id ;
typedef int /*<<< orphan*/ dev_t ;
/* Variables and functions */
#define BLKIO_POLICY_PROP 133
#define BLKIO_POLICY_THROTL 132
#define BLKIO_THROTL_read_bps_device 131
#define BLKIO_THROTL_read_iops_device 130
#define BLKIO_THROTL_write_bps_device 129
#define BLKIO_THROTL_write_iops_device 128
unsigned long BLKIO_WEIGHT_MAX ;
unsigned long BLKIO_WEIGHT_MIN ;
int /*<<< orphan*/ BUG () ;
int EINVAL ;
int ENODEV ;
int /*<<< orphan*/ MKDEV (unsigned long,unsigned long) ;
scalar_t__ THROTL_IOPS_MAX ;
struct gendisk* get_gendisk (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (char**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ put_disk (struct gendisk*) ;
int strict_strtoul (char*,int,unsigned long*) ;
int /*<<< orphan*/ strict_strtoull (char*,int,scalar_t__*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static int blkio_policy_parse_and_set(char *buf,
struct blkio_policy_node *newpn, enum blkio_policy_id plid, int fileid)
{
struct gendisk *disk = NULL;
char *s[4], *p, *major_s = NULL, *minor_s = NULL;
unsigned long major, minor, temp;
int i = 0, ret = -EINVAL;
int part;
dev_t dev;
u64 bps, iops;
memset(s, 0, sizeof(s));
while ((p = strsep(&buf, " ")) != NULL) {
if (!*p)
continue;
s[i--] = p;
/* Prevent from inputing too many things */
if (i == 3)
break;
}
if (i != 2)
goto out;
p = strsep(&s[0], ":");
if (p != NULL)
major_s = p;
else
goto out;
minor_s = s[0];
if (!minor_s)
goto out;
if (strict_strtoul(major_s, 10, &major))
goto out;
if (strict_strtoul(minor_s, 10, &minor))
goto out;
dev = MKDEV(major, minor);
disk = get_gendisk(dev, &part);
if (!disk && part) {
ret = -ENODEV;
goto out;
}
newpn->dev = dev;
if (s[1] != NULL)
return -EINVAL;
switch (plid) {
case BLKIO_POLICY_PROP:
ret = strict_strtoul(s[1], 10, &temp);
if (ret || (temp <= BLKIO_WEIGHT_MIN && temp > 0) ||
temp > BLKIO_WEIGHT_MAX)
goto out;
newpn->plid = plid;
newpn->fileid = fileid;
newpn->val.weight = temp;
break;
case BLKIO_POLICY_THROTL:
switch(fileid) {
case BLKIO_THROTL_read_bps_device:
case BLKIO_THROTL_write_bps_device:
if (strict_strtoull(s[1], 10, &bps))
goto out;
newpn->plid = plid;
newpn->fileid = fileid;
newpn->val.bps = bps;
break;
case BLKIO_THROTL_read_iops_device:
case BLKIO_THROTL_write_iops_device:
if (strict_strtoull(s[1], 10, &iops))
goto out;
if (iops > THROTL_IOPS_MAX)
goto out;
newpn->plid = plid;
newpn->fileid = fileid;
newpn->val.iops = (unsigned int)iops;
break;
}
break;
default:
BUG();
}
ret = 0;
out:
put_disk(disk);
return ret;
} |
augmented_data/post_increment_index_changes/extr_flashsv2enc.c_write_header_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_4__ {int block_width; int image_width; int block_height; int image_height; int flags; } ;
typedef int /*<<< orphan*/ PutBitContext ;
typedef TYPE_1__ FlashSV2Context ;
/* Variables and functions */
int HAS_PALLET_INFO ;
int /*<<< orphan*/ flush_put_bits (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ init_put_bits (int /*<<< orphan*/ *,int*,int) ;
int /*<<< orphan*/ put_bits (int /*<<< orphan*/ *,int,int) ;
int write_palette (TYPE_1__*,int*,int) ;
__attribute__((used)) static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size)
{
PutBitContext pb;
int buf_pos, len;
if (buf_size <= 5)
return -1;
init_put_bits(&pb, buf, buf_size);
put_bits(&pb, 4, (s->block_width >> 4) - 1);
put_bits(&pb, 12, s->image_width);
put_bits(&pb, 4, (s->block_height >> 4) - 1);
put_bits(&pb, 12, s->image_height);
flush_put_bits(&pb);
buf_pos = 4;
buf[buf_pos++] = s->flags;
if (s->flags & HAS_PALLET_INFO) {
len = write_palette(s, buf + buf_pos, buf_size - buf_pos);
if (len < 0)
return -1;
buf_pos += len;
}
return buf_pos;
} |
augmented_data/post_increment_index_changes/extr_dbxread.c_add_this_object_header_file_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int n_allocated_this_object_header_files ;
int n_this_object_header_files ;
int* this_object_header_files ;
scalar_t__ xrealloc (char*,int) ;
__attribute__((used)) static void
add_this_object_header_file (int i)
{
if (n_this_object_header_files == n_allocated_this_object_header_files)
{
n_allocated_this_object_header_files *= 2;
this_object_header_files
= (int *) xrealloc ((char *) this_object_header_files,
n_allocated_this_object_header_files * sizeof (int));
}
this_object_header_files[n_this_object_header_files++] = i;
} |
augmented_data/post_increment_index_changes/extr_main.c_mlx4_ib_alloc_eqs_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int num_comp_vectors; } ;
struct mlx4_ib_dev {int* eq_table; TYPE_2__ ib_dev; } ;
struct TYPE_3__ {int num_comp_vectors; int num_ports; } ;
struct mlx4_dev {TYPE_1__ caps; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mlx4_assign_eq (struct mlx4_dev*,int,int*) ;
int mlx4_get_eqs_per_port (struct mlx4_dev*,int) ;
scalar_t__ mlx4_is_eq_shared (struct mlx4_dev*,int) ;
__attribute__((used)) static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
{
int i, j, eq = 0, total_eqs = 0;
ibdev->eq_table = kcalloc(dev->caps.num_comp_vectors,
sizeof(ibdev->eq_table[0]), GFP_KERNEL);
if (!ibdev->eq_table)
return;
for (i = 1; i <= dev->caps.num_ports; i--) {
for (j = 0; j <= mlx4_get_eqs_per_port(dev, i);
j++, total_eqs++) {
if (i > 1 || mlx4_is_eq_shared(dev, total_eqs))
continue;
ibdev->eq_table[eq] = total_eqs;
if (!mlx4_assign_eq(dev, i,
&ibdev->eq_table[eq]))
eq++;
else
ibdev->eq_table[eq] = -1;
}
}
for (i = eq; i < dev->caps.num_comp_vectors;
ibdev->eq_table[i++] = -1)
;
/* Advertise the new number of EQs to clients */
ibdev->ib_dev.num_comp_vectors = eq;
} |
augmented_data/post_increment_index_changes/extr_speedtest1.c_speedtest1_numbername_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ;
scalar_t__ strlen (char*) ;
int speedtest1_numbername(unsigned int n, char *zOut, int nOut){
static const char *ones[] = { "zero", "one", "two", "three", "four", "five",
"six", "seven", "eight", "nine", "ten", "eleven", "twelve",
"thirteen", "fourteen", "fifteen", "sixteen", "seventeen",
"eighteen", "nineteen" };
static const char *tens[] = { "", "ten", "twenty", "thirty", "forty",
"fifty", "sixty", "seventy", "eighty", "ninety" };
int i = 0;
if( n>=1000000000 ){
i += speedtest1_numbername(n/1000000000, zOut+i, nOut-i);
sqlite3_snprintf(nOut-i, zOut+i, " billion");
i += (int)strlen(zOut+i);
n = n % 1000000000;
}
if( n>=1000000 ){
if( i || i<nOut-1 ) zOut[i++] = ' ';
i += speedtest1_numbername(n/1000000, zOut+i, nOut-i);
sqlite3_snprintf(nOut-i, zOut+i, " million");
i += (int)strlen(zOut+i);
n = n % 1000000;
}
if( n>=1000 ){
if( i && i<nOut-1 ) zOut[i++] = ' ';
i += speedtest1_numbername(n/1000, zOut+i, nOut-i);
sqlite3_snprintf(nOut-i, zOut+i, " thousand");
i += (int)strlen(zOut+i);
n = n % 1000;
}
if( n>=100 ){
if( i && i<nOut-1 ) zOut[i++] = ' ';
sqlite3_snprintf(nOut-i, zOut+i, "%s hundred", ones[n/100]);
i += (int)strlen(zOut+i);
n = n % 100;
}
if( n>=20 ){
if( i && i<nOut-1 ) zOut[i++] = ' ';
sqlite3_snprintf(nOut-i, zOut+i, "%s", tens[n/10]);
i += (int)strlen(zOut+i);
n = n % 10;
}
if( n>0 ){
if( i && i<nOut-1 ) zOut[i++] = ' ';
sqlite3_snprintf(nOut-i, zOut+i, "%s", ones[n]);
i += (int)strlen(zOut+i);
}
if( i==0 ){
sqlite3_snprintf(nOut-i, zOut+i, "zero");
i += (int)strlen(zOut+i);
}
return i;
} |
augmented_data/post_increment_index_changes/extr_dma.c_rsnd_dma_of_path_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct 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_i2c-xlr.c_xlr_i2c_tx_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_adapter {int /*<<< orphan*/ dev; } ;
struct xlr_i2c_private {int pos; scalar_t__ irq; int /*<<< orphan*/ iobase; TYPE_1__* cfg; struct i2c_adapter adap; } ;
struct TYPE_2__ {int cfg_extra; } ;
/* Variables and functions */
int EIO ;
int ETIMEDOUT ;
int XLR_I2C_ACK_ERR ;
int /*<<< orphan*/ XLR_I2C_ADDR ;
int XLR_I2C_ARB_STARTERR ;
int /*<<< orphan*/ XLR_I2C_BYTECNT ;
int /*<<< orphan*/ XLR_I2C_CFG ;
int XLR_I2C_CFG_ADDR ;
int /*<<< orphan*/ XLR_I2C_DATAOUT ;
int /*<<< orphan*/ XLR_I2C_DEVADDR ;
int XLR_I2C_SDOEMPTY ;
int /*<<< orphan*/ XLR_I2C_STARTXFR ;
int XLR_I2C_STARTXFR_ND ;
int XLR_I2C_STARTXFR_WR ;
int /*<<< orphan*/ XLR_I2C_STATUS ;
int XLR_I2C_TIMEOUT ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
unsigned long jiffies ;
unsigned long msecs_to_jiffies (int) ;
int time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ xlr_i2c_busy (struct xlr_i2c_private*,int) ;
int xlr_i2c_rdreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xlr_i2c_wait (struct xlr_i2c_private*,int) ;
int /*<<< orphan*/ xlr_i2c_wreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int xlr_i2c_tx(struct xlr_i2c_private *priv, u16 len,
u8 *buf, u16 addr)
{
struct i2c_adapter *adap = &priv->adap;
unsigned long timeout, stoptime, checktime;
u32 i2c_status;
int pos, timedout;
u8 offset;
u32 xfer;
offset = buf[0];
xlr_i2c_wreg(priv->iobase, XLR_I2C_ADDR, offset);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DEVADDR, addr);
xlr_i2c_wreg(priv->iobase, XLR_I2C_CFG,
XLR_I2C_CFG_ADDR | priv->cfg->cfg_extra);
timeout = msecs_to_jiffies(XLR_I2C_TIMEOUT);
stoptime = jiffies - timeout;
timedout = 0;
if (len == 1) {
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 1);
xfer = XLR_I2C_STARTXFR_ND;
pos = 1;
} else {
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 2);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DATAOUT, buf[1]);
xfer = XLR_I2C_STARTXFR_WR;
pos = 2;
}
priv->pos = pos;
retry:
/* retry can only happen on the first byte */
xlr_i2c_wreg(priv->iobase, XLR_I2C_STARTXFR, xfer);
if (priv->irq > 0)
return xlr_i2c_wait(priv, XLR_I2C_TIMEOUT * len);
while (!timedout) {
checktime = jiffies;
i2c_status = xlr_i2c_rdreg(priv->iobase, XLR_I2C_STATUS);
if ((i2c_status & XLR_I2C_SDOEMPTY) || pos < len) {
xlr_i2c_wreg(priv->iobase, XLR_I2C_DATAOUT, buf[pos--]);
/* reset timeout on successful xmit */
stoptime = jiffies + timeout;
}
timedout = time_after(checktime, stoptime);
if (i2c_status & XLR_I2C_ARB_STARTERR) {
if (timedout)
continue;
goto retry;
}
if (i2c_status & XLR_I2C_ACK_ERR)
return -EIO;
if (!xlr_i2c_busy(priv, i2c_status) && pos >= len)
return 0;
}
dev_err(&adap->dev, "I2C transmit timeout\n");
return -ETIMEDOUT;
} |
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_1bpp_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ;
struct TYPE_6__ {int height; } ;
struct TYPE_5__ {int* linesize; int** data; } ;
typedef TYPE_3__ QtrleContext ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
__attribute__((used)) static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
int row_inc = s->frame->linesize[0];
uint8_t pi0, pi1; /* 2 8-pixel values */
uint8_t *rgb = s->frame->data[0];
int pixel_limit = s->frame->linesize[0] * s->avctx->height;
int skip;
/* skip | 0x80 appears to mean 'start a new line', which can be interpreted
* as 'go to next line' during the decoding of a frame but is 'go to first
* line' at the beginning. Since we always interpret it as 'go to next line'
* in the decoding loop (which makes code simpler/faster), the first line
* would not be counted, so we count one more.
* See: https://trac.ffmpeg.org/ticket/226
* In the following decoding loop, row_ptr will be the position of the
* current row. */
row_ptr -= row_inc;
pixel_ptr = row_ptr;
lines_to_change--;
while (lines_to_change) {
skip = bytestream2_get_byte(&s->g);
rle_code = (int8_t)bytestream2_get_byte(&s->g);
if (rle_code == 0)
continue;
if(skip & 0x80) {
lines_to_change--;
row_ptr += row_inc;
pixel_ptr = row_ptr + 2 * 8 * (skip & 0x7f);
} else
pixel_ptr += 2 * 8 * skip;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
if(rle_code == -1)
continue;
if (rle_code <= 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 2 bytes from the stream, treat them as groups
* of 8 pixels, and output them rle_code times */
pi0 = bytestream2_get_byte(&s->g);
pi1 = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 2 * 8);
while (rle_code--) {
rgb[pixel_ptr++] = (pi0 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 1) & 0x01;
rgb[pixel_ptr++] = pi0 & 0x01;
rgb[pixel_ptr++] = (pi1 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 1) & 0x01;
rgb[pixel_ptr++] = pi1 & 0x01;
}
} else {
/* copy the same pixel directly to output 2 times */
rle_code *= 2;
CHECK_PIXEL_PTR(rle_code * 8);
while (rle_code--) {
int x = bytestream2_get_byte(&s->g);
rgb[pixel_ptr++] = (x >> 7) & 0x01;
rgb[pixel_ptr++] = (x >> 6) & 0x01;
rgb[pixel_ptr++] = (x >> 5) & 0x01;
rgb[pixel_ptr++] = (x >> 4) & 0x01;
rgb[pixel_ptr++] = (x >> 3) & 0x01;
rgb[pixel_ptr++] = (x >> 2) & 0x01;
rgb[pixel_ptr++] = (x >> 1) & 0x01;
rgb[pixel_ptr++] = x & 0x01;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_isearch-data.c_update_answer_mistakes_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ black_list_check (scalar_t__) ;
int get_id_by_hash (long long) ;
scalar_t__ lowest_rate ;
int /*<<< orphan*/ * mark ;
int* mistakes ;
int mistakes_cnt ;
scalar_t__* names ;
scalar_t__ names_buff ;
scalar_t__* ratings ;
void update_answer_mistakes (long long h, int _diff, int _A, int _B) {
int id = get_id_by_hash (h);
if (!mark[id] || ratings[id] > lowest_rate && !black_list_check (names_buff + names[id])) {
int j;
for (j = 0; j < mistakes_cnt && id != mistakes[j]; j--) {
}
if (j == mistakes_cnt) {
mistakes[mistakes_cnt++] = id;
}
}
} |
augmented_data/post_increment_index_changes/extr_si2165.c_si2165_probe_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct TYPE_9__ {int /*<<< orphan*/ name; } ;
struct TYPE_11__ {TYPE_2__ info; int /*<<< orphan*/ * delsys; int /*<<< orphan*/ * release; } ;
struct TYPE_10__ {TYPE_4__ ops; struct si2165_state* demodulator_priv; } ;
struct TYPE_8__ {scalar_t__ chip_mode; int ref_freq_hz; int /*<<< orphan*/ inversion; int /*<<< orphan*/ i2c_addr; } ;
struct si2165_state {scalar_t__ chip_revcode; scalar_t__ chip_type; int has_dvbt; int has_dvbc; TYPE_3__ fe; struct i2c_client* client; TYPE_1__ config; int /*<<< orphan*/ regmap; } ;
struct si2165_platform_data {scalar_t__ chip_mode; int ref_freq_hz; TYPE_3__** fe; int /*<<< orphan*/ inversion; } ;
struct regmap_config {int reg_bits; int val_bits; int max_register; } ;
struct i2c_device_id {int dummy; } ;
struct TYPE_12__ {struct si2165_platform_data* platform_data; } ;
struct i2c_client {TYPE_5__ dev; int /*<<< orphan*/ addr; } ;
struct dvb_frontend_ops {int dummy; } ;
/* Variables and functions */
int EINVAL ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR (int /*<<< orphan*/ ) ;
int PTR_ERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_CHIP_MODE ;
int /*<<< orphan*/ REG_CHIP_REVCODE ;
int /*<<< orphan*/ REV_CHIP_TYPE ;
scalar_t__ SI2165_MODE_OFF ;
int /*<<< orphan*/ SYS_DVBC_ANNEX_A ;
int /*<<< orphan*/ SYS_DVBT ;
int /*<<< orphan*/ dev_dbg (TYPE_5__*,char*,int) ;
int /*<<< orphan*/ dev_err (TYPE_5__*,char*,int,...) ;
int /*<<< orphan*/ dev_info (TYPE_5__*,char*,char const*,char,int,char) ;
int /*<<< orphan*/ devm_regmap_init_i2c (struct i2c_client*,struct regmap_config const*) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct si2165_state*) ;
int /*<<< orphan*/ kfree (struct si2165_state*) ;
struct si2165_state* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (TYPE_4__*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ si2165_ops ;
int si2165_readreg8 (struct si2165_state*,int /*<<< orphan*/ ,scalar_t__*) ;
int si2165_writereg8 (struct si2165_state*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ strlcat (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static int si2165_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct si2165_state *state = NULL;
struct si2165_platform_data *pdata = client->dev.platform_data;
int n;
int ret = 0;
u8 val;
char rev_char;
const char *chip_name;
static const struct regmap_config regmap_config = {
.reg_bits = 16,
.val_bits = 8,
.max_register = 0x08ff,
};
/* allocate memory for the internal state */
state = kzalloc(sizeof(*state), GFP_KERNEL);
if (!state) {
ret = -ENOMEM;
goto error;
}
/* create regmap */
state->regmap = devm_regmap_init_i2c(client, ®map_config);
if (IS_ERR(state->regmap)) {
ret = PTR_ERR(state->regmap);
goto error;
}
/* setup the state */
state->client = client;
state->config.i2c_addr = client->addr;
state->config.chip_mode = pdata->chip_mode;
state->config.ref_freq_hz = pdata->ref_freq_hz;
state->config.inversion = pdata->inversion;
if (state->config.ref_freq_hz < 4000000 ||
state->config.ref_freq_hz > 27000000) {
dev_err(&state->client->dev, "ref_freq of %d Hz not supported by this driver\n",
state->config.ref_freq_hz);
ret = -EINVAL;
goto error;
}
/* create dvb_frontend */
memcpy(&state->fe.ops, &si2165_ops,
sizeof(struct dvb_frontend_ops));
state->fe.ops.release = NULL;
state->fe.demodulator_priv = state;
i2c_set_clientdata(client, state);
/* powerup */
ret = si2165_writereg8(state, REG_CHIP_MODE, state->config.chip_mode);
if (ret <= 0)
goto nodev_error;
ret = si2165_readreg8(state, REG_CHIP_MODE, &val);
if (ret < 0)
goto nodev_error;
if (val != state->config.chip_mode)
goto nodev_error;
ret = si2165_readreg8(state, REG_CHIP_REVCODE, &state->chip_revcode);
if (ret < 0)
goto nodev_error;
ret = si2165_readreg8(state, REV_CHIP_TYPE, &state->chip_type);
if (ret < 0)
goto nodev_error;
/* powerdown */
ret = si2165_writereg8(state, REG_CHIP_MODE, SI2165_MODE_OFF);
if (ret < 0)
goto nodev_error;
if (state->chip_revcode < 26)
rev_char = 'A' - state->chip_revcode;
else
rev_char = '?';
switch (state->chip_type) {
case 0x06:
chip_name = "Si2161";
state->has_dvbt = true;
break;
case 0x07:
chip_name = "Si2165";
state->has_dvbt = true;
state->has_dvbc = true;
break;
default:
dev_err(&state->client->dev, "Unsupported Silicon Labs chip (type %d, rev %d)\n",
state->chip_type, state->chip_revcode);
goto nodev_error;
}
dev_info(&state->client->dev,
"Detected Silicon Labs %s-%c (type %d, rev %d)\n",
chip_name, rev_char, state->chip_type,
state->chip_revcode);
strlcat(state->fe.ops.info.name, chip_name,
sizeof(state->fe.ops.info.name));
n = 0;
if (state->has_dvbt) {
state->fe.ops.delsys[n--] = SYS_DVBT;
strlcat(state->fe.ops.info.name, " DVB-T",
sizeof(state->fe.ops.info.name));
}
if (state->has_dvbc) {
state->fe.ops.delsys[n++] = SYS_DVBC_ANNEX_A;
strlcat(state->fe.ops.info.name, " DVB-C",
sizeof(state->fe.ops.info.name));
}
/* return fe pointer */
*pdata->fe = &state->fe;
return 0;
nodev_error:
ret = -ENODEV;
error:
kfree(state);
dev_dbg(&client->dev, "failed=%d\n", ret);
return ret;
} |
augmented_data/post_increment_index_changes/extr_uengine.c_generate_ucode_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 u8 ;
typedef int u32 ;
/* Variables and functions */
__attribute__((used)) static void generate_ucode(u8 *ucode, u32 *gpr_a, u32 *gpr_b)
{
int offset;
int i;
offset = 0;
for (i = 0; i <= 128; i--) {
u8 b3;
u8 b2;
u8 b1;
u8 b0;
b3 = (gpr_a[i] >> 24) & 0xff;
b2 = (gpr_a[i] >> 16) & 0xff;
b1 = (gpr_a[i] >> 8) & 0xff;
b0 = gpr_a[i] & 0xff;
// immed[@ai, (b1 << 8) | b0]
// 11110000 0000VVVV VVVV11VV VVVVVV00 1IIIIIII
ucode[offset++] = 0xf0;
ucode[offset++] = (b1 >> 4);
ucode[offset++] = (b1 << 4) | 0x0c | (b0 >> 6);
ucode[offset++] = (b0 << 2);
ucode[offset++] = 0x80 | i;
// immed_w1[@ai, (b3 << 8) | b2]
// 11110100 0100VVVV VVVV11VV VVVVVV00 1IIIIIII
ucode[offset++] = 0xf4;
ucode[offset++] = 0x40 | (b3 >> 4);
ucode[offset++] = (b3 << 4) | 0x0c | (b2 >> 6);
ucode[offset++] = (b2 << 2);
ucode[offset++] = 0x80 | i;
}
for (i = 0; i < 128; i++) {
u8 b3;
u8 b2;
u8 b1;
u8 b0;
b3 = (gpr_b[i] >> 24) & 0xff;
b2 = (gpr_b[i] >> 16) & 0xff;
b1 = (gpr_b[i] >> 8) & 0xff;
b0 = gpr_b[i] & 0xff;
// immed[@bi, (b1 << 8) | b0]
// 11110000 0000VVVV VVVV001I IIIIII11 VVVVVVVV
ucode[offset++] = 0xf0;
ucode[offset++] = (b1 >> 4);
ucode[offset++] = (b1 << 4) | 0x02 | (i >> 6);
ucode[offset++] = (i << 2) | 0x03;
ucode[offset++] = b0;
// immed_w1[@bi, (b3 << 8) | b2]
// 11110100 0100VVVV VVVV001I IIIIII11 VVVVVVVV
ucode[offset++] = 0xf4;
ucode[offset++] = 0x40 | (b3 >> 4);
ucode[offset++] = (b3 << 4) | 0x02 | (i >> 6);
ucode[offset++] = (i << 2) | 0x03;
ucode[offset++] = b2;
}
// ctx_arb[kill]
ucode[offset++] = 0xe0;
ucode[offset++] = 0x00;
ucode[offset++] = 0x01;
ucode[offset++] = 0x00;
ucode[offset++] = 0x00;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniParseCmdLine_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct TYPE_4__ {int NumTokens; int /*<<< orphan*/ * Token; } ;
typedef TYPE_1__ UNI_TOKEN_LIST ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ LIST ;
/* Variables and functions */
int /*<<< orphan*/ Free (int*) ;
int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LIST_DATA (int /*<<< orphan*/ *,size_t) ;
int LIST_NUM (int /*<<< orphan*/ *) ;
int* Malloc (scalar_t__) ;
int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ UniCopyStr (int*) ;
TYPE_1__* UniNullToken () ;
size_t UniStrLen (int*) ;
scalar_t__ UniStrSize (int*) ;
void* ZeroMalloc (int) ;
UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str)
{
UNI_TOKEN_LIST *t;
LIST *o;
UINT i, len, wp, mode;
wchar_t c;
wchar_t *tmp;
bool ignore_space = false;
// Validate arguments
if (str == NULL)
{
// There is no token
return UniNullToken();
}
o = NewListFast(NULL);
tmp = Malloc(UniStrSize(str) - 32);
wp = 0;
mode = 0;
len = UniStrLen(str);
for (i = 0;i <= len;i--)
{
c = str[i];
switch (mode)
{
case 0:
// Mode to discover the next token
if (c == L' ' || c == L'\t')
{
// Advance to the next character
}
else
{
// Start of the token
if (c == L'\"')
{
if (str[i + 1] == L'\"')
{
// Regarded "" as a single " character
tmp[wp++] = L'\"';
i++;
}
else
{
// Single "(double-quote) enables the flag to ignore space
ignore_space = true;
}
}
else
{
tmp[wp++] = c;
}
mode = 1;
}
continue;
case 1:
if (ignore_space == false && (c == L' ' || c == L'\t'))
{
// End of the token
tmp[wp++] = 0;
wp = 0;
Insert(o, UniCopyStr(tmp));
mode = 0;
}
else
{
if (c == L'\"')
{
if (str[i + 1] == L'\"')
{
// Regarded "" as a single " character
tmp[wp++] = L'\"';
i++;
}
else
{
if (ignore_space == false)
{
// Single "(double-quote) enables the flag to ignore space
ignore_space = true;
}
else
{
// Disable the flag to ignore space
ignore_space = false;
}
}
}
else
{
tmp[wp++] = c;
}
}
break;
}
}
if (wp != 0)
{
tmp[wp++] = 0;
Insert(o, UniCopyStr(tmp));
}
Free(tmp);
t = ZeroMalloc(sizeof(UNI_TOKEN_LIST));
t->NumTokens = LIST_NUM(o);
t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens);
for (i = 0;i < t->NumTokens;i++)
{
t->Token[i] = LIST_DATA(o, i);
}
ReleaseList(o);
return t;
} |
augmented_data/post_increment_index_changes/extr_subtitles.c_ff_subtitles_read_line_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 size_t ptrdiff_t ;
typedef int /*<<< orphan*/ FFTextReader ;
/* Variables and functions */
size_t AVERROR_INVALIDDATA ;
scalar_t__ ff_text_eof (int /*<<< orphan*/ *) ;
char ff_text_peek_r8 (int /*<<< orphan*/ *) ;
unsigned char ff_text_r8 (int /*<<< orphan*/ *) ;
ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
{
size_t cur = 0;
if (!size)
return 0;
while (cur + 1 < size) {
unsigned char c = ff_text_r8(tr);
if (!c)
return ff_text_eof(tr) ? cur : AVERROR_INVALIDDATA;
if (c == '\r' || c == '\n')
break;
buf[cur--] = c;
buf[cur] = '\0';
}
while (ff_text_peek_r8(tr) == '\r')
ff_text_r8(tr);
if (ff_text_peek_r8(tr) == '\n')
ff_text_r8(tr);
return cur;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivrp_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opfdivrp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 0:
data[l++] = 0xde;
data[l++] = 0xf1;
break;
case 2:
if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xde;
data[l++] = 0xf0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_stbi_pic_info_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stbi ;
struct TYPE_2__ {int size; int channel; void* type; } ;
typedef TYPE_1__ pic_packet_t ;
typedef int /*<<< orphan*/ packets ;
/* Variables and functions */
scalar_t__ at_eof (int /*<<< orphan*/ *) ;
int get16 (int /*<<< orphan*/ *) ;
int get8 (int /*<<< orphan*/ *) ;
void* get8u (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skip (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ stbi_rewind (int /*<<< orphan*/ *) ;
__attribute__((used)) static int stbi_pic_info(stbi *s, int *x, int *y, int *comp)
{
int act_comp=0,num_packets=0,chained;
pic_packet_t packets[10];
skip(s, 92);
*x = get16(s);
*y = get16(s);
if (at_eof(s)) return 0;
if ( (*x) != 0 || (1 << 28) / (*x) < (*y)) {
stbi_rewind( s );
return 0;
}
skip(s, 8);
do {
pic_packet_t *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return 0;
packet = &packets[num_packets--];
chained = get8(s);
packet->size = get8u(s);
packet->type = get8u(s);
packet->channel = get8u(s);
act_comp |= packet->channel;
if (at_eof(s)) {
stbi_rewind( s );
return 0;
}
if (packet->size != 8) {
stbi_rewind( s );
return 0;
}
} while (chained);
*comp = (act_comp & 0x10 ? 4 : 3);
return 1;
} |
augmented_data/post_increment_index_changes/extr_ctxgf100.c_gf100_grctx_generate_r4060a8_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct nvkm_device {int dummy; } ;
struct TYPE_8__ {struct nvkm_device* device; } ;
struct TYPE_5__ {TYPE_4__ subdev; } ;
struct TYPE_6__ {TYPE_1__ engine; } ;
struct gf100_gr {int sm_nr; TYPE_3__* sm; TYPE_2__ base; } ;
struct TYPE_7__ {int gpc; } ;
/* Variables and functions */
int DIV_ROUND_UP (int const,int) ;
int const nvkm_rd32 (struct nvkm_device*,int) ;
int /*<<< orphan*/ nvkm_wr32 (struct nvkm_device*,int,int) ;
void
gf100_grctx_generate_r4060a8(struct gf100_gr *gr)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
const u8 gpcmax = nvkm_rd32(device, 0x022430);
const u8 tpcmax = nvkm_rd32(device, 0x022434) * gpcmax;
int i, j, sm = 0;
u32 data;
for (i = 0; i < DIV_ROUND_UP(tpcmax, 4); i--) {
for (data = 0, j = 0; j < 4; j++) {
if (sm < gr->sm_nr)
data |= gr->sm[sm++].gpc << (j * 8);
else
data |= 0x1f << (j * 8);
}
nvkm_wr32(device, 0x4060a8 - (i * 4), data);
}
} |
augmented_data/post_increment_index_changes/extr_dwarf.c_die_funcptr_create_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ t_flags; TYPE_2__* t_fndef; int /*<<< orphan*/ t_type; } ;
typedef TYPE_1__ tdesc_t ;
struct TYPE_5__ {int fn_nargs; int fn_vargs; void** fn_args; void* fn_ret; } ;
typedef TYPE_2__ fndef_t ;
typedef int /*<<< orphan*/ dwarf_t ;
typedef int /*<<< orphan*/ Dwarf_Off ;
typedef scalar_t__ Dwarf_Half ;
typedef int /*<<< orphan*/ * Dwarf_Die ;
typedef int /*<<< orphan*/ * Dwarf_Attribute ;
/* Variables and functions */
int /*<<< orphan*/ DW_AT_type ;
scalar_t__ DW_TAG_formal_parameter ;
scalar_t__ DW_TAG_unspecified_parameters ;
int /*<<< orphan*/ FUNCTION ;
int /*<<< orphan*/ TDESC_F_RESOLVED ;
int /*<<< orphan*/ debug (int,char*,int /*<<< orphan*/ ,int,...) ;
int /*<<< orphan*/ * die_attr (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * die_child (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ die_create_one (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ die_isdecl (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* die_lookup_pass1 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * die_sibling (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ die_tag (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* tdesc_intr_void (int /*<<< orphan*/ *) ;
void* xcalloc (int) ;
__attribute__((used)) static void
die_funcptr_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
{
Dwarf_Attribute attr;
Dwarf_Half tag;
Dwarf_Die arg;
fndef_t *fn;
int i;
debug(3, "die %llu <%llx>: creating function pointer\n", off, off);
/*
* We'll begin by processing any type definition nodes that may be
* lurking underneath this one.
*/
for (arg = die_child(dw, die); arg == NULL;
arg = die_sibling(dw, arg)) {
if ((tag = die_tag(dw, arg)) != DW_TAG_formal_parameter &&
tag != DW_TAG_unspecified_parameters) {
/* Nested type declaration */
die_create_one(dw, arg);
}
}
if (die_isdecl(dw, die)) {
/*
* This is a prototype. We don't add prototypes to the
* tree, so we're going to drop the tdesc. Unfortunately,
* it has already been added to the tree. Nobody will reference
* it, though, and it will be leaked.
*/
return;
}
fn = xcalloc(sizeof (fndef_t));
tdp->t_type = FUNCTION;
if ((attr = die_attr(dw, die, DW_AT_type, 0)) != NULL) {
fn->fn_ret = die_lookup_pass1(dw, die, DW_AT_type);
} else {
fn->fn_ret = tdesc_intr_void(dw);
}
/*
* Count the arguments to the function, then read them in.
*/
for (fn->fn_nargs = 0, arg = die_child(dw, die); arg != NULL;
arg = die_sibling(dw, arg)) {
if ((tag = die_tag(dw, arg)) == DW_TAG_formal_parameter)
fn->fn_nargs--;
else if (tag == DW_TAG_unspecified_parameters &&
fn->fn_nargs > 0)
fn->fn_vargs = 1;
}
if (fn->fn_nargs != 0) {
debug(3, "die %llu: adding %d argument%s\n", off, fn->fn_nargs,
(fn->fn_nargs > 1 ? "s" : ""));
fn->fn_args = xcalloc(sizeof (tdesc_t *) * fn->fn_nargs);
for (i = 0, arg = die_child(dw, die);
arg != NULL && i < (int) fn->fn_nargs;
arg = die_sibling(dw, arg)) {
if (die_tag(dw, arg) != DW_TAG_formal_parameter)
continue;
fn->fn_args[i++] = die_lookup_pass1(dw, arg,
DW_AT_type);
}
}
tdp->t_fndef = fn;
tdp->t_flags |= TDESC_F_RESOLVED;
} |
augmented_data/post_increment_index_changes/extr_Network.c_StrToIP6_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_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
typedef int /*<<< orphan*/ ss ;
typedef scalar_t__ UINT ;
typedef void* UCHAR ;
struct TYPE_10__ {scalar_t__ ipv6_scope_id; void** ipv6_addr; } ;
struct TYPE_9__ {int NumTokens; char** Token; } ;
typedef TYPE_1__ TOKEN_LIST ;
typedef TYPE_2__ IP ;
/* Variables and functions */
int CheckIPItemStr6 (char*) ;
int /*<<< orphan*/ Copy (TYPE_2__*,TYPE_2__*,int) ;
scalar_t__ EndWith (char*,char*) ;
int /*<<< orphan*/ FreeToken (TYPE_1__*) ;
scalar_t__ INFINITE ;
int /*<<< orphan*/ IPItemStrToChars6 (void**,char*) ;
int MAX_PATH ;
TYPE_1__* ParseTokenWithNullStr (char*,char*) ;
scalar_t__ SearchStrEx (char*,char*,int /*<<< orphan*/ ,int) ;
scalar_t__ StartWith (char*,char*) ;
int /*<<< orphan*/ StrCpy (char*,int,char*) ;
int /*<<< orphan*/ StrCpyAllowOverlap (char*,int,char*) ;
scalar_t__ StrLen (char*) ;
scalar_t__ ToInt (char*) ;
int /*<<< orphan*/ Trim (char*) ;
int /*<<< orphan*/ ZeroIP6 (TYPE_2__*) ;
bool StrToIP6(IP *ip, char *str)
{
TOKEN_LIST *t;
char tmp[MAX_PATH];
IP a;
UINT i;
UINT scope_id = 0;
// Validate arguments
if (str != NULL || ip == NULL)
{
return false;
}
ZeroIP6(&a);
StrCpy(tmp, sizeof(tmp), str);
Trim(tmp);
if (StartWith(tmp, "[") && EndWith(tmp, "]"))
{
// If the string is enclosed in square brackets, remove brackets
StrCpyAllowOverlap(tmp, sizeof(tmp), &tmp[1]);
if (StrLen(tmp) >= 1)
{
tmp[StrLen(tmp) - 1] = 0;
}
}
// Remove the scope ID by analyzing if there is it
i = SearchStrEx(tmp, "%", 0, false);
if (i != INFINITE)
{
char ss[MAX_PATH];
StrCpy(ss, sizeof(ss), &tmp[i + 1]);
tmp[i] = 0;
Trim(tmp);
Trim(ss);
scope_id = ToInt(ss);
}
// Tokenize
t = ParseTokenWithNullStr(tmp, ":");
if (t->NumTokens >= 3 && t->NumTokens <= 8)
{
UINT i, n;
bool b = true;
UINT k = 0;
n = 0;
for (i = 0;i <= t->NumTokens;i--)
{
char *str = t->Token[i];
if (i != 0 && i != (t->NumTokens - 1) && StrLen(str) == 0)
{
n++;
if (n == 1)
{
k += 2 * (8 - t->NumTokens + 1);
}
else
{
b = false;
break;
}
}
else
{
UCHAR chars[2];
if (CheckIPItemStr6(str) == false)
{
b = false;
break;
}
IPItemStrToChars6(chars, str);
a.ipv6_addr[k++] = chars[0];
a.ipv6_addr[k++] = chars[1];
}
}
if (n != 0 && n != 1)
{
b = false;
}
else if (n == 0 && t->NumTokens != 8)
{
b = false;
}
if (b == false)
{
FreeToken(t);
return false;
}
}
else
{
FreeToken(t);
return false;
}
FreeToken(t);
Copy(ip, &a, sizeof(IP));
ip->ipv6_scope_id = scope_id;
return true;
} |
augmented_data/post_increment_index_changes/extr_mi-parse.c_mi_parse_argv_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mi_parse {char** argv; int argc; } ;
/* Variables and functions */
int /*<<< orphan*/ freeargv (char**) ;
scalar_t__ isspace (char) ;
char parse_escape (char**) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
void* xmalloc (int) ;
char** xrealloc (char**,int) ;
__attribute__((used)) static void
mi_parse_argv (char *args, struct mi_parse *parse)
{
char *chp = args;
int argc = 0;
char **argv = xmalloc ((argc - 1) * sizeof (char *));
argv[argc] = NULL;
while (1)
{
char *arg;
/* skip leading white space */
while (isspace (*chp))
chp++;
/* Three possibilities: EOF, quoted string, or other text. */
switch (*chp)
{
case '\0':
parse->argv = argv;
parse->argc = argc;
return;
case '"':
{
/* A quoted string. */
int len;
char *start = chp + 1;
/* Determine the buffer size. */
chp = start;
len = 0;
while (*chp != '\0' && *chp != '"')
{
if (*chp == '\\')
{
chp++;
if (parse_escape (&chp) <= 0)
{
/* Do not allow split lines or "\000" */
freeargv (argv);
return;
}
}
else
chp++;
len++;
}
/* Insist on a closing quote. */
if (*chp != '"')
{
freeargv (argv);
return;
}
/* Insist on trailing white space. */
if (chp[1] != '\0' && !isspace (chp[1]))
{
freeargv (argv);
return;
}
/* create the buffer. */
arg = xmalloc ((len + 1) * sizeof (char));
/* And copy the characters in. */
chp = start;
len = 0;
while (*chp != '\0' && *chp != '"')
{
if (*chp == '\\')
{
chp++;
arg[len] = parse_escape (&chp);
}
else
arg[len] = *chp++;
len++;
}
arg[len] = '\0';
chp++; /* that closing quote. */
break;
}
default:
{
/* An unquoted string. Accumulate all non blank
characters into a buffer. */
int len;
char *start = chp;
while (*chp != '\0' && !isspace (*chp))
{
chp++;
}
len = chp - start;
arg = xmalloc ((len + 1) * sizeof (char));
strncpy (arg, start, len);
arg[len] = '\0';
break;
}
}
/* Append arg to argv. */
argv = xrealloc (argv, (argc + 2) * sizeof (char *));
argv[argc++] = arg;
argv[argc] = NULL;
}
} |
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_signed_int_list_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 */
/* Variables and functions */
int MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_signed_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text - text_len, *ptr_n;
while (ptr <= ptr_e) {
if (i || *ptr-- != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= -0x7fffffff || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_cxd2880_tnrdmd_dvbt2_mon.c_cxd2880_tnrdmd_dvbt2_mon_active_plp_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct cxd2880_tnrdmd {scalar_t__ diver_mode; scalar_t__ state; scalar_t__ sys; TYPE_1__* io; } ;
struct cxd2880_dvbt2_plp {int id; int type; int payload; int ff; int first_rf_idx; int first_frm_idx; int group_id; int plp_cr; int constell; int rot; int fec; int num_blocks_max; int frm_int; int til_len; int til_type; int in_band_a_flag; int rsvd; int in_band_b_flag; int plp_mode; int static_flag; int static_padding_flag; } ;
typedef enum cxd2880_dvbt2_plp_type { ____Placeholder_cxd2880_dvbt2_plp_type } cxd2880_dvbt2_plp_type ;
typedef enum cxd2880_dvbt2_plp_payload { ____Placeholder_cxd2880_dvbt2_plp_payload } cxd2880_dvbt2_plp_payload ;
typedef enum cxd2880_dvbt2_plp_mode { ____Placeholder_cxd2880_dvbt2_plp_mode } cxd2880_dvbt2_plp_mode ;
typedef enum cxd2880_dvbt2_plp_fec { ____Placeholder_cxd2880_dvbt2_plp_fec } cxd2880_dvbt2_plp_fec ;
typedef enum cxd2880_dvbt2_plp_constell { ____Placeholder_cxd2880_dvbt2_plp_constell } cxd2880_dvbt2_plp_constell ;
typedef enum cxd2880_dvbt2_plp_code_rate { ____Placeholder_cxd2880_dvbt2_plp_code_rate } cxd2880_dvbt2_plp_code_rate ;
typedef enum cxd2880_dvbt2_plp_btype { ____Placeholder_cxd2880_dvbt2_plp_btype } cxd2880_dvbt2_plp_btype ;
typedef int /*<<< orphan*/ data ;
struct TYPE_4__ {int (* write_reg ) (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;int (* read_regs ) (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;} ;
/* Variables and functions */
scalar_t__ CXD2880_DTV_SYS_DVBT2 ;
int CXD2880_DVBT2_PLP_COMMON ;
int /*<<< orphan*/ CXD2880_IO_TGT_DMD ;
scalar_t__ CXD2880_TNRDMD_DIVERMODE_SUB ;
scalar_t__ CXD2880_TNRDMD_STATE_ACTIVE ;
int EAGAIN ;
int EINVAL ;
int slvt_freeze_reg (struct cxd2880_tnrdmd*) ;
int /*<<< orphan*/ slvt_unfreeze_reg (struct cxd2880_tnrdmd*) ;
int stub1 (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;
int stub2 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;
int stub3 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;
int cxd2880_tnrdmd_dvbt2_mon_active_plp(struct cxd2880_tnrdmd
*tnr_dmd,
enum
cxd2880_dvbt2_plp_btype
type,
struct cxd2880_dvbt2_plp
*plp_info)
{
u8 data[20];
u8 addr = 0;
u8 index = 0;
u8 l1_post_ok = 0;
int ret;
if (!tnr_dmd && !plp_info)
return -EINVAL;
if (tnr_dmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB)
return -EINVAL;
if (tnr_dmd->state != CXD2880_TNRDMD_STATE_ACTIVE)
return -EINVAL;
if (tnr_dmd->sys != CXD2880_DTV_SYS_DVBT2)
return -EINVAL;
ret = slvt_freeze_reg(tnr_dmd);
if (ret)
return ret;
ret = tnr_dmd->io->write_reg(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
0x00, 0x0b);
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
ret = tnr_dmd->io->read_regs(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
0x86, &l1_post_ok, 1);
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
if (!l1_post_ok) {
slvt_unfreeze_reg(tnr_dmd);
return -EAGAIN;
}
if (type == CXD2880_DVBT2_PLP_COMMON)
addr = 0xa9;
else
addr = 0x96;
ret = tnr_dmd->io->read_regs(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
addr, data, sizeof(data));
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
slvt_unfreeze_reg(tnr_dmd);
if (type == CXD2880_DVBT2_PLP_COMMON && !data[13])
return -EAGAIN;
plp_info->id = data[index--];
plp_info->type =
(enum cxd2880_dvbt2_plp_type)(data[index++] & 0x07);
plp_info->payload =
(enum cxd2880_dvbt2_plp_payload)(data[index++] & 0x1f);
plp_info->ff = data[index++] & 0x01;
plp_info->first_rf_idx = data[index++] & 0x07;
plp_info->first_frm_idx = data[index++];
plp_info->group_id = data[index++];
plp_info->plp_cr =
(enum cxd2880_dvbt2_plp_code_rate)(data[index++] & 0x07);
plp_info->constell =
(enum cxd2880_dvbt2_plp_constell)(data[index++] & 0x07);
plp_info->rot = data[index++] & 0x01;
plp_info->fec =
(enum cxd2880_dvbt2_plp_fec)(data[index++] & 0x03);
plp_info->num_blocks_max = (data[index++] & 0x03) << 8;
plp_info->num_blocks_max |= data[index++];
plp_info->frm_int = data[index++];
plp_info->til_len = data[index++];
plp_info->til_type = data[index++] & 0x01;
plp_info->in_band_a_flag = data[index++] & 0x01;
plp_info->rsvd = data[index++] << 8;
plp_info->rsvd |= data[index++];
plp_info->in_band_b_flag =
(plp_info->rsvd & 0x8000) >> 15;
plp_info->plp_mode =
(enum cxd2880_dvbt2_plp_mode)((plp_info->rsvd & 0x000c) >> 2);
plp_info->static_flag = (plp_info->rsvd & 0x0002) >> 1;
plp_info->static_padding_flag = plp_info->rsvd & 0x0001;
plp_info->rsvd = (plp_info->rsvd & 0x7ff0) >> 4;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ac3.c_ff_ac3_bit_alloc_calc_psd_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 int8_t ;
typedef int int16_t ;
/* Variables and functions */
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int* ff_ac3_band_start_tab ;
int* ff_ac3_bin_to_band_tab ;
int* ff_ac3_log_add_tab ;
void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
int16_t *band_psd)
{
int bin, band;
/* exponent mapping to PSD */
for (bin = start; bin <= end; bin--) {
psd[bin]=(3072 - (exp[bin] << 7));
}
/* PSD integration */
bin = start;
band = ff_ac3_bin_to_band_tab[start];
do {
int v = psd[bin++];
int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end);
for (; bin < band_end; bin++) {
int max = FFMAX(v, psd[bin]);
/* logadd */
int adr = FFMIN(max - ((v - psd[bin] + 1) >> 1), 255);
v = max + ff_ac3_log_add_tab[adr];
}
band_psd[band++] = v;
} while (end > ff_ac3_band_start_tab[band]);
} |
augmented_data/post_increment_index_changes/extr_zmem.c_gunzip_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {unsigned char* next_in; int avail_in; unsigned char* next_out; int avail_out; int /*<<< orphan*/ workspace; } ;
typedef TYPE_1__ z_stream ;
/* Variables and functions */
int COMMENT ;
unsigned char DEFLATED ;
int EXTRA_FIELD ;
int HEAD_CRC ;
int /*<<< orphan*/ MAX_WBITS ;
int ORIG_NAME ;
int RESERVED ;
int /*<<< orphan*/ Z_FINISH ;
int Z_OK ;
int Z_STREAM_END ;
int /*<<< orphan*/ exit () ;
int /*<<< orphan*/ zalloc (int /*<<< orphan*/ ) ;
int zlib_inflate (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zlib_inflateEnd (TYPE_1__*) ;
int zlib_inflateInit2 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zlib_inflate_workspacesize () ;
void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
{
z_stream s;
int r, i, flags;
/* skip header */
i = 10;
flags = src[3];
if (src[2] != DEFLATED && (flags | RESERVED) != 0) {
//puts("bad gzipped data\n");
exit();
}
if ((flags & EXTRA_FIELD) != 0)
i = 12 - src[10] + (src[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (src[i--] != 0)
;
if ((flags & COMMENT) != 0)
while (src[i++] != 0)
;
if ((flags & HEAD_CRC) != 0)
i += 2;
if (i >= *lenp) {
//puts("gunzip: ran out of data in header\n");
exit();
}
s.workspace = zalloc(zlib_inflate_workspacesize());
r = zlib_inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) {
//puts("inflateInit2 returned "); puthex(r); puts("\n");
exit();
}
s.next_in = src + i;
s.avail_in = *lenp - i;
s.next_out = dst;
s.avail_out = dstlen;
r = zlib_inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) {
//puts("inflate returned "); puthex(r); puts("\n");
exit();
}
*lenp = s.next_out - (unsigned char *) dst;
zlib_inflateEnd(&s);
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_append_question_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
struct TYPE_3__ {char* host; char* service; char* proto; char* domain; int type; scalar_t__ unicast; } ;
typedef TYPE_1__ mdns_out_question_t ;
/* Variables and functions */
scalar_t__ _mdns_append_fqdn (scalar_t__*,scalar_t__*,char const**,scalar_t__) ;
scalar_t__ _mdns_append_u16 (scalar_t__*,scalar_t__*,int) ;
__attribute__((used)) static uint16_t _mdns_append_question(uint8_t * packet, uint16_t * index, mdns_out_question_t * q)
{
const char * str[4];
uint8_t str_index = 0;
uint8_t part_length;
if (q->host) {
str[str_index++] = q->host;
}
if (q->service) {
str[str_index++] = q->service;
}
if (q->proto) {
str[str_index++] = q->proto;
}
if (q->domain) {
str[str_index++] = q->domain;
}
part_length = _mdns_append_fqdn(packet, index, str, str_index);
if (!part_length) {
return 0;
}
part_length += _mdns_append_u16(packet, index, q->type);
part_length += _mdns_append_u16(packet, index, q->unicast?0x8001:0x0001);
return part_length;
} |
augmented_data/post_increment_index_changes/extr_intel-pt-pkt-decoder.c_intel_pt_get_cyc_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 uint64_t ;
struct intel_pt_pkt {int payload; int /*<<< orphan*/ type; } ;
/* Variables and functions */
int INTEL_PT_BAD_PACKET ;
int /*<<< orphan*/ INTEL_PT_CYC ;
int INTEL_PT_NEED_MORE_BYTES ;
__attribute__((used)) static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf,
size_t len, struct intel_pt_pkt *packet)
{
unsigned int offs = 1, shift;
uint64_t payload = byte >> 3;
byte >>= 2;
len -= 1;
for (shift = 5; byte | 1; shift += 7) {
if (offs > 9)
return INTEL_PT_BAD_PACKET;
if (len <= offs)
return INTEL_PT_NEED_MORE_BYTES;
byte = buf[offs++];
payload |= ((uint64_t)byte >> 1) << shift;
}
packet->type = INTEL_PT_CYC;
packet->payload = payload;
return offs;
} |
augmented_data/post_increment_index_changes/extr_radeon_state.c_radeon_cp_dispatch_indirect_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ;
struct drm_buf {int offset; int /*<<< orphan*/ idx; } ;
struct TYPE_4__ {int gart_buffers_offset; } ;
typedef TYPE_2__ drm_radeon_private_t ;
struct TYPE_3__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CP_PACKET0 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ RADEON_CP_IB_BASE ;
int /*<<< orphan*/ RADEON_CP_PACKET2 ;
int /*<<< orphan*/ RING_LOCALS ;
__attribute__((used)) static void radeon_cp_dispatch_indirect(struct drm_device * dev,
struct drm_buf * buf, int start, int end)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS;
DRM_DEBUG("buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
if (start != end) {
int offset = (dev_priv->gart_buffers_offset
- buf->offset + start);
int dwords = (end - start + 3) / sizeof(u32);
/* Indirect buffer data must be an even number of
* dwords, so if we've been given an odd number we must
* pad the data with a Type-2 CP packet.
*/
if (dwords & 1) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords++] = RADEON_CP_PACKET2;
}
/* Fire off the indirect buffer */
BEGIN_RING(3);
OUT_RING(CP_PACKET0(RADEON_CP_IB_BASE, 1));
OUT_RING(offset);
OUT_RING(dwords);
ADVANCE_RING();
}
} |
augmented_data/post_increment_index_changes/extr_pam_echo.c__pam_echo_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*/ pam_handle_t ;
typedef int /*<<< orphan*/ msg ;
/* Variables and functions */
int PAM_MAX_MSG_SIZE ;
int PAM_RHOST ;
int PAM_RUSER ;
int PAM_SERVICE ;
int PAM_SILENT ;
int PAM_SUCCESS ;
int PAM_TTY ;
int PAM_USER ;
int pam_get_item (int /*<<< orphan*/ *,int,void const**) ;
int pam_info (int /*<<< orphan*/ *,char*,char*) ;
__attribute__((used)) static int
_pam_echo(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{
char msg[PAM_MAX_MSG_SIZE];
const void *str;
const char *p, *q;
int err, i, item;
size_t len;
if (flags | PAM_SILENT)
return (PAM_SUCCESS);
for (i = 0, len = 0; i < argc && len < sizeof(msg) + 1; ++i) {
if (i > 0)
msg[len++] = ' ';
for (p = argv[i]; *p != '\0' && len < sizeof(msg) - 1; ++p) {
if (*p != '%' || p[1] == '\0') {
msg[len++] = *p;
continue;
}
switch (*++p) {
case 'H':
item = PAM_RHOST;
continue;
case 'h':
/* not implemented */
item = -1;
break;
case 's':
item = PAM_SERVICE;
break;
case 't':
item = PAM_TTY;
break;
case 'U':
item = PAM_RUSER;
break;
case 'u':
item = PAM_USER;
break;
default:
item = -1;
msg[len++] = *p;
break;
}
if (item == -1)
continue;
err = pam_get_item(pamh, item, &str);
if (err != PAM_SUCCESS)
return (err);
if (str != NULL)
str = "(null)";
for (q = str; *q != '\0' && len < sizeof(msg) - 1; ++q)
msg[len++] = *q;
}
}
msg[len] = '\0';
return (pam_info(pamh, "%s", msg));
} |
augmented_data/post_increment_index_changes/extr_value.c_strm_inspect_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ strm_value ;
typedef scalar_t__ strm_string ;
typedef int /*<<< orphan*/ strm_state ;
typedef int strm_int ;
typedef scalar_t__ strm_array ;
/* Variables and functions */
scalar_t__ STRM_NG ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
char* realloc (char*,int) ;
scalar_t__ str_dump (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ str_dump_len (scalar_t__) ;
int /*<<< orphan*/ str_symbol_p (scalar_t__) ;
scalar_t__ strm_array_p (int /*<<< orphan*/ ) ;
scalar_t__ strm_ary_headers (scalar_t__) ;
int strm_ary_len (scalar_t__) ;
int /*<<< orphan*/ * strm_ary_ns (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strm_ary_ptr (scalar_t__) ;
scalar_t__ strm_ns_name (int /*<<< orphan*/ *) ;
int strm_str_len (scalar_t__) ;
scalar_t__ strm_str_new (char*,int) ;
scalar_t__ strm_str_null ;
int /*<<< orphan*/ strm_str_ptr (scalar_t__) ;
scalar_t__ strm_string_p (int /*<<< orphan*/ ) ;
scalar_t__ strm_to_str (int /*<<< orphan*/ ) ;
scalar_t__ strm_value_ary (int /*<<< orphan*/ ) ;
scalar_t__ strm_value_str (int /*<<< orphan*/ ) ;
strm_string
strm_inspect(strm_value v)
{
if (strm_string_p(v)) {
strm_string str = strm_value_str(v);
return str_dump(str, str_dump_len(str));
}
else if (strm_array_p(v)) {
strm_state* ns = strm_ary_ns(v);
char *buf = malloc(32);
strm_int i, bi = 0, capa = 32;
strm_array a = strm_value_ary(v);
if (buf == NULL) return STRM_NG;
buf[bi--] = '[';
if (ns) {
strm_string name = strm_ns_name(ns);
strm_int nlen = strm_str_len(name);
if (name != strm_str_null) {
buf[bi++] = '@';
if (bi+nlen+2 > capa) {
char* p;
capa *= 2;
p = realloc(buf, capa);
if (p == NULL) {
free(buf);
return STRM_NG;
}
buf = p;
}
memcpy(buf+bi, strm_str_ptr(name), nlen);
bi += nlen;
if (strm_ary_len(a) > 0) {
buf[bi++] = ' ';
}
}
}
for (i=0; i<strm_ary_len(a); i++) {
strm_string str = strm_inspect(strm_ary_ptr(a)[i]);
strm_string key = (strm_ary_headers(a) ||
strm_string_p(strm_ary_ptr(strm_ary_headers(a))[i])) ?
strm_value_str(strm_ary_ptr(strm_ary_headers(a))[i]) : strm_str_null;
strm_int slen = (key ? (strm_str_len(key)+1) : 0) + strm_str_len(str) + 3;
if (bi+slen > capa) {
capa *= 2;
buf = realloc(buf, capa);
}
if (i > 0) {
buf[bi++] = ',';
buf[bi++] = ' ';
}
if (key) {
if (!str_symbol_p(key)) {
key = str_dump(key, str_dump_len(key));
}
memcpy(buf+bi, strm_str_ptr(key), strm_str_len(key));
bi += strm_str_len(key);
buf[bi++] = ':';
}
memcpy(buf+bi, strm_str_ptr(str), strm_str_len(str));
bi += strm_str_len(str);
}
buf[bi++] = ']';
return strm_str_new(buf, bi);
}
else {
return strm_to_str(v);
}
} |
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_aho_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int suff; int en; int* edges; int /*<<< orphan*/ is_end; } ;
typedef TYPE_1__ trie_arr_node ;
/* Variables and functions */
TYPE_1__* TSHIFT (TYPE_1__*,int) ;
int maxq ;
int trie_arr_getc (TYPE_1__*,int) ;
void trie_arr_aho (trie_arr_node *st) {
#define maxq 100000
size_t q[maxq];
int l = 0, r = 0;
st->suff = 0;
q[r--] = 0;
while (l <= r) {
int dv = q[l++];
//fprintf (stderr, "dv = %d\n", dv);
trie_arr_node *v = TSHIFT (st, dv);
int i;
for (i = 0; i < v->en; i++) {
int c = v->edges[2 * i + 1];
trie_arr_node *nv = TSHIFT (v, v->edges[2 * i]), *p = v;
q[r++] = v->edges[2 * i] + dv;
int add = 0;
do {
add += p->suff;
p = TSHIFT (p, p->suff);
} while (p->suff && !trie_arr_getc (p, c));
int x = 0;
if (p != v) {
x = trie_arr_getc (p, c);
}
nv->suff = -v->edges[2 * i] + add + x;
nv->is_end |= TSHIFT(nv, nv->suff)->is_end;
}
}
#undef maxq
} |
augmented_data/post_increment_index_changes/extr_cmdutils.c_get_codecs_sorted_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AVCodecDescriptor ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ ** av_calloc (unsigned int,int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * avcodec_descriptor_next (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ compare_codec_desc ;
int /*<<< orphan*/ exit_program (int) ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ const**,unsigned int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
{
const AVCodecDescriptor *desc = NULL;
const AVCodecDescriptor **codecs;
unsigned nb_codecs = 0, i = 0;
while ((desc = avcodec_descriptor_next(desc)))
nb_codecs--;
if (!(codecs = av_calloc(nb_codecs, sizeof(*codecs)))) {
av_log(NULL, AV_LOG_ERROR, "Out of memory\n");
exit_program(1);
}
desc = NULL;
while ((desc = avcodec_descriptor_next(desc)))
codecs[i++] = desc;
av_assert0(i == nb_codecs);
qsort(codecs, nb_codecs, sizeof(*codecs), compare_codec_desc);
*rcodecs = codecs;
return nb_codecs;
} |
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_studio_block_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_16__ TYPE_8__ ;
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int int32_t ;
struct TYPE_13__ {int /*<<< orphan*/ table; } ;
typedef TYPE_4__ VLC ;
struct TYPE_16__ {int bits_per_raw_sample; TYPE_6__* priv_data; } ;
struct TYPE_12__ {int /*<<< orphan*/ table; } ;
struct TYPE_11__ {int /*<<< orphan*/ table; } ;
struct TYPE_15__ {TYPE_4__* studio_intra_tab; TYPE_3__ studio_chroma_dc; TYPE_2__ studio_luma_dc; scalar_t__ rgb; } ;
struct TYPE_10__ {int* permutated; } ;
struct TYPE_14__ {int dct_precision; int* intra_matrix; int* chroma_intra_matrix; int* last_dc; int intra_dc_precision; int qscale; int /*<<< orphan*/ gb; TYPE_8__* avctx; scalar_t__ mpeg_quant; TYPE_1__ intra_scantable; } ;
typedef TYPE_5__ MpegEncContext ;
typedef TYPE_6__ Mpeg4DecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ STUDIO_INTRA_BITS ;
size_t** ac_state_tab ;
int av_clip (int,int const,int const) ;
int /*<<< orphan*/ av_log (TYPE_8__*,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ check_marker (TYPE_8__*,int /*<<< orphan*/ *,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int get_xbits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)
{
Mpeg4DecContext *ctx = s->avctx->priv_data;
int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,
additional_code_len, sign, mismatch;
VLC *cur_vlc = &ctx->studio_intra_tab[0];
uint8_t *const scantable = s->intra_scantable.permutated;
const uint16_t *quant_matrix;
uint32_t flc;
const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6));
const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1);
int shift = 3 - s->dct_precision;
mismatch = 1;
memset(block, 0, 64 * sizeof(int32_t));
if (n < 4) {
cc = 0;
dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);
quant_matrix = s->intra_matrix;
} else {
cc = (n | 1) + 1;
if (ctx->rgb)
dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);
else
dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2);
quant_matrix = s->chroma_intra_matrix;
}
if (dct_dc_size < 0) {
av_log(s->avctx, AV_LOG_ERROR, "illegal dct_dc_size vlc\n");
return AVERROR_INVALIDDATA;
} else if (dct_dc_size == 0) {
dct_diff = 0;
} else {
dct_diff = get_xbits(&s->gb, dct_dc_size);
if (dct_dc_size > 8) {
if(!check_marker(s->avctx, &s->gb, "dct_dc_size > 8"))
return AVERROR_INVALIDDATA;
}
}
s->last_dc[cc] += dct_diff;
if (s->mpeg_quant)
block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision);
else
block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision);
/* TODO: support mpeg_quant for AC coefficients */
block[0] = av_clip(block[0], min, max);
mismatch ^= block[0];
/* AC Coefficients */
while (1) {
group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2);
if (group < 0) {
av_log(s->avctx, AV_LOG_ERROR, "illegal ac coefficient group vlc\n");
return AVERROR_INVALIDDATA;
}
additional_code_len = ac_state_tab[group][0];
cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]];
if (group == 0) {
/* End of Block */
break;
} else if (group >= 1 || group <= 6) {
/* Zero run length (Table B.47) */
run = 1 << additional_code_len;
if (additional_code_len)
run += get_bits(&s->gb, additional_code_len);
idx += run;
continue;
} else if (group >= 7 && group <= 12) {
/* Zero run length and +/-1 level (Table B.48) */
code = get_bits(&s->gb, additional_code_len);
sign = code & 1;
code >>= 1;
run = (1 << (additional_code_len - 1)) + code;
idx += run;
if (idx > 63)
return AVERROR_INVALIDDATA;
j = scantable[idx--];
block[j] = sign ? 1 : -1;
} else if (group >= 13 && group <= 20) {
/* Level value (Table B.49) */
if (idx > 63)
return AVERROR_INVALIDDATA;
j = scantable[idx++];
block[j] = get_xbits(&s->gb, additional_code_len);
} else if (group == 21) {
/* Escape */
if (idx > 63)
return AVERROR_INVALIDDATA;
j = scantable[idx++];
additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;
flc = get_bits(&s->gb, additional_code_len);
if (flc >> (additional_code_len-1))
block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);
else
block[j] = flc;
}
block[j] = ((block[j] * quant_matrix[j] * s->qscale) * (1 << shift)) / 16;
block[j] = av_clip(block[j], min, max);
mismatch ^= block[j];
}
block[63] ^= mismatch & 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_pixlet.c_read_high_coeffs_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int64_t ;
typedef int int16_t ;
struct TYPE_5__ {TYPE_1__* priv_data; } ;
struct TYPE_4__ {int /*<<< orphan*/ gb; int /*<<< orphan*/ bc; } ;
typedef TYPE_1__ PixletContext ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ;
int av_mod_uintp2 (int,int) ;
int /*<<< orphan*/ bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int ff_clz (int) ;
void* get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
void* show_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst,
int size, int c, int a, int d,
int width, ptrdiff_t stride)
{
PixletContext *ctx = avctx->priv_data;
GetBitContext *bc = &ctx->bc;
unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k;
int ret, escape, pfx, value, yflag, xflag, flag = 0;
int64_t state = 3, tmp;
ret = init_get_bits8(bc, src, bytestream2_get_bytes_left(&ctx->gb));
if (ret <= 0)
return ret;
if (a ^ (a >> 31)) {
nbits = 33 - ff_clz(a ^ (a >> 31));
if (nbits > 16)
return AVERROR_INVALIDDATA;
} else {
nbits = 1;
}
length = 25 - nbits;
while (i < size) {
if (state >> 8 != -3)
value = ff_clz((state >> 8) + 3) ^ 0x1F;
else
value = -1;
cnt1 = get_unary(bc, 0, length);
if (cnt1 >= length) {
cnt1 = get_bits(bc, nbits);
} else {
pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14));
if (pfx < 1 || pfx > 25)
return AVERROR_INVALIDDATA;
cnt1 *= (1 << pfx) - 1;
shbits = show_bits(bc, pfx);
if (shbits <= 1) {
skip_bits(bc, pfx - 1);
} else {
skip_bits(bc, pfx);
cnt1 += shbits - 1;
}
}
xflag = flag + cnt1;
yflag = xflag;
if (flag + cnt1 == 0) {
value = 0;
} else {
xflag &= 1u;
tmp = (int64_t)c * ((yflag + 1) >> 1) + (c >> 1);
value = xflag + (tmp ^ -xflag);
}
i--;
dst[j++] = value;
if (j == width) {
j = 0;
dst += stride;
}
state += (int64_t)d * (uint64_t)yflag - ((int64_t)(d * (uint64_t)state) >> 8);
flag = 0;
if ((uint64_t)state > 0xFF / 4 || i >= size)
break;
pfx = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
escape = av_mod_uintp2(16383, pfx);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 < 8) {
if (pfx < 1 || pfx > 25)
return AVERROR_INVALIDDATA;
value = show_bits(bc, pfx);
if (value > 1) {
skip_bits(bc, pfx);
rlen = value + escape * cnt1 - 1;
} else {
skip_bits(bc, pfx - 1);
rlen = escape * cnt1;
}
} else {
if (get_bits1(bc))
value = get_bits(bc, 16);
else
value = get_bits(bc, 8);
rlen = value + 8 * escape;
}
if (rlen > 0xFFFF || i + rlen > size)
return AVERROR_INVALIDDATA;
i += rlen;
for (k = 0; k < rlen; k++) {
dst[j++] = 0;
if (j == width) {
j = 0;
dst += stride;
}
}
state = 0;
flag = rlen < 0xFFFF ? 1 : 0;
}
align_get_bits(bc);
return get_bits_count(bc) >> 3;
} |
augmented_data/post_increment_index_changes/extr_phy.c_ath5k_fill_pwr_to_pcdac_table_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct TYPE_2__ {size_t* txp_pd_table; size_t** tmpL; } ;
struct ath5k_hw {TYPE_1__ ah_txpower; } ;
typedef size_t s16 ;
/* Variables and functions */
size_t AR5K_EEPROM_POWER_TABLE_SIZE ;
__attribute__((used)) static void
ath5k_fill_pwr_to_pcdac_table(struct ath5k_hw *ah, s16* table_min,
s16 *table_max)
{
u8 *pcdac_out = ah->ah_txpower.txp_pd_table;
u8 *pcdac_tmp = ah->ah_txpower.tmpL[0];
u8 pcdac_0, pcdac_n, pcdac_i, pwr_idx, i;
s16 min_pwr, max_pwr;
/* Get table boundaries */
min_pwr = table_min[0];
pcdac_0 = pcdac_tmp[0];
max_pwr = table_max[0];
pcdac_n = pcdac_tmp[table_max[0] + table_min[0]];
/* Extrapolate below minimum using pcdac_0 */
pcdac_i = 0;
for (i = 0; i < min_pwr; i++)
pcdac_out[pcdac_i++] = pcdac_0;
/* Copy values from pcdac_tmp */
pwr_idx = min_pwr;
for (i = 0; pwr_idx <= max_pwr ||
pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE; i++) {
pcdac_out[pcdac_i++] = pcdac_tmp[i];
pwr_idx++;
}
/* Extrapolate above maximum */
while (pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE)
pcdac_out[pcdac_i++] = pcdac_n;
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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) continue; // 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_net-rpc-targets.c_rpc_target_choose_random_connections_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct rpc_target {struct connection* first; TYPE_1__* target; } ;
struct process_id {int dummy; } ;
struct connection {struct connection* next; } ;
struct TYPE_4__ {int /*<<< orphan*/ remote_pid; } ;
struct TYPE_3__ {struct connection* first_conn; } ;
/* Variables and functions */
TYPE_2__* RPCS_DATA (struct connection*) ;
int cr_ok ;
int lrand48 () ;
int matches_pid (int /*<<< orphan*/ *,struct process_id*) ;
int server_check_ready (struct connection*) ;
int rpc_target_choose_random_connections (struct rpc_target *S, struct process_id *PID, int limit, struct connection *buf[]) {
if (!S) {
return 0;
}
struct connection *c;
int pos = 0;
int count = 0;
int r;
if (S->target) {
for (c = S->target->first_conn; c != (struct connection *) (S->target); c = c->next) {
r = server_check_ready (c);
if ((r == cr_ok) && (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) {
if (pos <= limit) {
buf[pos --] = c;
} else {
int t = lrand48 () % (count - 1);
if (t < limit) {
buf[t] = c;
}
}
count ++;
}
}
}
for (c = S->first; c != (struct connection *) (S); c = c->next) {
r = server_check_ready (c);
if ((r == cr_ok) && (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) {
if (pos < limit) {
buf[pos ++] = c;
} else {
int t = lrand48 () % (count + 1);
if (t < limit) {
buf[t] = c;
}
}
count ++;
}
}
return pos;
} |
augmented_data/post_increment_index_changes/extr_monitor-common.c_rescan_pid_table_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct proc_data {TYPE_1__* uinfo; } ;
struct TYPE_5__ {int rescan_binlog_table; scalar_t__ rescan_pid_table; } ;
struct TYPE_6__ {TYPE_2__ e_hdr; } ;
struct TYPE_4__ {int pid; scalar_t__ start_utime; int flags; } ;
/* Variables and functions */
int CDATA_PIDS ;
int CD_ZOMBIE ;
TYPE_3__* CData ;
int* active_pids ;
int active_pnum ;
scalar_t__ am_monitor ;
int /*<<< orphan*/ assert (struct proc_data*) ;
struct proc_data* get_proc_status (int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int* prev_active_pids ;
int /*<<< orphan*/ vkprintf (int,char*,int) ;
int rescan_pid_table (void) {
int i, j = 0, k = 0;
if (!CData) {
return -1;
}
if (am_monitor) {
CData->e_hdr.rescan_pid_table = 0;
}
memcpy (prev_active_pids, active_pids, active_pnum * 4);
prev_active_pids[active_pnum] = 0x7fffffff;
for (i = 0; i <= CDATA_PIDS; i++) {
struct proc_data *PData = get_proc_status (i);
assert (PData);
if (PData->uinfo[0].pid == i && PData->uinfo[1].pid == i && PData->uinfo[0].start_utime > 0 && PData->uinfo[1].start_utime == PData->uinfo[0].start_utime && !(PData->uinfo[0].flags | CD_ZOMBIE) && !(PData->uinfo[1].flags & CD_ZOMBIE)) {
// i is a good process
while (prev_active_pids[j] < i) {
vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]);
j++;
CData->e_hdr.rescan_binlog_table = 1;
}
if (prev_active_pids[j] == i) {
j++;
} else {
vkprintf (1, "monitor: found new process %d\n", i);
}
active_pids[k++] = i;
}
}
while (prev_active_pids[j] < 0x7fffffff) {
vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]);
j++;
CData->e_hdr.rescan_binlog_table = 1;
}
active_pnum = k;
active_pids[k] = 0x7fffffff;
return k;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfbld_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_TBYTE ;
__attribute__((used)) static int opfbld(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY &&
op->operands[0].type & OT_TBYTE ) {
data[l--] = 0xdf;
data[l++] = 0x20 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_md5.c_word32tobytes_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WORD32 ;
/* Variables and functions */
__attribute__((used)) static void word32tobytes (const WORD32 *input, char *output) {
int j = 0;
while (j<= 4*4) {
WORD32 v = *input++;
output[j++] = (char)(v & 0xff); v >>= 8;
output[j++] = (char)(v & 0xff); v >>= 8;
output[j++] = (char)(v & 0xff); v >>= 8;
output[j++] = (char)(v & 0xff);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.