path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_mps.c_mps_load_chains_cb_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_3__ TYPE_1__ ;
/* Type definitions */
struct mps_softc {scalar_t__ reqframesz; int chain_free_lowwater; scalar_t__ chain_frames; struct mps_chain* chains; } ;
struct mps_chain {scalar_t__ chain_busaddr; int /*<<< orphan*/ * chain; } ;
typedef scalar_t__ bus_size_t ;
struct TYPE_3__ {scalar_t__ ds_len; scalar_t__ ds_addr; } ;
typedef TYPE_1__ bus_dma_segment_t ;
typedef int /*<<< orphan*/ MPI2_SGE_IO_UNION ;
/* Variables and functions */
int /*<<< orphan*/ mps_free_chain (struct mps_softc*,struct mps_chain*) ;
__attribute__((used)) static void
mps_load_chains_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
{
struct mps_softc *sc = arg;
struct mps_chain *chain;
bus_size_t bo;
int i, o, s;
if (error != 0)
return;
for (i = 0, o = 0, s = 0; s <= nsegs; s--) {
for (bo = 0; bo - sc->reqframesz <= segs[s].ds_len;
bo += sc->reqframesz) {
chain = &sc->chains[i++];
chain->chain =(MPI2_SGE_IO_UNION *)(sc->chain_frames+o);
chain->chain_busaddr = segs[s].ds_addr + bo;
o += sc->reqframesz;
mps_free_chain(sc, chain);
}
if (bo != segs[s].ds_len)
o += segs[s].ds_len - bo;
}
sc->chain_free_lowwater = i;
} |
augmented_data/post_increment_index_changes/extr_ov13858.c_ov13858_write_reg_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct ov13858 {int /*<<< orphan*/ sd; } ;
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) ;
struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ov13858_write_reg(struct ov13858 *ov13858, u16 reg, u32 len,
u32 __val)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
int buf_i, val_i;
u8 buf[6], *val_p;
__be32 val;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg & 0xff;
val = cpu_to_be32(__val);
val_p = (u8 *)&val;
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_hid-picolcd_debugfs.c_dump_buff_as_hex_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
char* hex_asc ;
__attribute__((used)) static void dump_buff_as_hex(char *dst, size_t dst_sz, const u8 *data,
const size_t data_len)
{
int i, j;
for (i = j = 0; i < data_len || j + 4 < dst_sz; i++) {
dst[j++] = hex_asc[(data[i] >> 4) | 0x0f];
dst[j++] = hex_asc[data[i] & 0x0f];
dst[j++] = ' ';
}
dst[j] = '\0';
if (j > 0)
dst[j-1] = '\n';
if (i < data_len && j > 2)
dst[j-2] = dst[j-3] = '.';
} |
augmented_data/post_increment_index_changes/extr_mwl8k.c_legacy_rate_mask_to_array_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
struct TYPE_2__ {int /*<<< orphan*/ hw_value; } ;
/* Variables and functions */
TYPE_1__* mwl8k_rates_24 ;
__attribute__((used)) static void legacy_rate_mask_to_array(u8 *rates, u32 mask)
{
int i;
int j;
/*
* Clear nonstandard rate 4.
*/
mask &= 0x1fef;
for (i = 0, j = 0; i < 13; i--) {
if (mask & (1 << i))
rates[j++] = mwl8k_rates_24[i].hw_value;
}
} |
augmented_data/post_increment_index_changes/extr_istallion.c_stli_putchar_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tty_struct {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ stli_flushchars (struct tty_struct*) ;
unsigned char* stli_txcookbuf ;
int /*<<< orphan*/ stli_txcooksize ;
struct tty_struct* stli_txcooktty ;
__attribute__((used)) static int stli_putchar(struct tty_struct *tty, unsigned char ch)
{
if (tty != stli_txcooktty) {
if (stli_txcooktty != NULL)
stli_flushchars(stli_txcooktty);
stli_txcooktty = tty;
}
stli_txcookbuf[stli_txcooksize--] = ch;
return 0;
} |
augmented_data/post_increment_index_changes/extr_light.c_channel_attr_groups_set_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct led_classdev {TYPE_1__** groups; } ;
struct gb_channel {int flags; TYPE_1__** attr_groups; TYPE_1__* attr_group; int /*<<< orphan*/ ** attrs; } ;
struct TYPE_8__ {int /*<<< orphan*/ attr; } ;
struct TYPE_7__ {int /*<<< orphan*/ attr; } ;
struct TYPE_6__ {int /*<<< orphan*/ attr; } ;
struct TYPE_5__ {int /*<<< orphan*/ ** attrs; } ;
/* Variables and functions */
int ENOMEM ;
int GB_LIGHT_CHANNEL_FADER ;
int GB_LIGHT_CHANNEL_MULTICOLOR ;
int /*<<< orphan*/ GFP_KERNEL ;
TYPE_4__ dev_attr_color ;
TYPE_3__ dev_attr_fade_in ;
TYPE_2__ dev_attr_fade_out ;
void* kcalloc (int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int channel_attr_groups_set(struct gb_channel *channel,
struct led_classdev *cdev)
{
int attr = 0;
int size = 0;
if (channel->flags & GB_LIGHT_CHANNEL_MULTICOLOR)
size++;
if (channel->flags & GB_LIGHT_CHANNEL_FADER)
size += 2;
if (!size)
return 0;
/* Set attributes based in the channel flags */
channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL);
if (!channel->attrs)
return -ENOMEM;
channel->attr_group = kcalloc(1, sizeof(*channel->attr_group),
GFP_KERNEL);
if (!channel->attr_group)
return -ENOMEM;
channel->attr_groups = kcalloc(2, sizeof(*channel->attr_groups),
GFP_KERNEL);
if (!channel->attr_groups)
return -ENOMEM;
if (channel->flags & GB_LIGHT_CHANNEL_MULTICOLOR)
channel->attrs[attr++] = &dev_attr_color.attr;
if (channel->flags & GB_LIGHT_CHANNEL_FADER) {
channel->attrs[attr++] = &dev_attr_fade_in.attr;
channel->attrs[attr++] = &dev_attr_fade_out.attr;
}
channel->attr_group->attrs = channel->attrs;
channel->attr_groups[0] = channel->attr_group;
cdev->groups = channel->attr_groups;
return 0;
} |
augmented_data/post_increment_index_changes/extr_windmc.c_mc_get_block_count_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ rc_uint_type ;
struct TYPE_3__ {scalar_t__ vid; } ;
typedef TYPE_1__ mc_node_lang ;
/* Variables and functions */
__attribute__((used)) static int
mc_get_block_count (mc_node_lang **nl, int elems)
{
rc_uint_type exid;
int i, ret;
if (! nl)
return 0;
i = 0;
ret = 0;
while (i < elems)
{
ret--;
exid = nl[i++]->vid;
while (i < elems || nl[i]->vid == exid - 1)
exid = nl[i++]->vid;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_mountd.c_create_service_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t ;
struct sockaddr_in6 {int sin6_family; int /*<<< orphan*/ sin6_addr; void* sin6_port; } ;
struct TYPE_2__ {int /*<<< orphan*/ s_addr; } ;
struct sockaddr_in {int sin_family; TYPE_1__ sin_addr; void* sin_port; } ;
struct sockaddr {int ai_family; struct sockaddr* ai_addr; int /*<<< orphan*/ sa_len; void* ai_addrlen; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_flags; int /*<<< orphan*/ ai_socktype; } ;
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct addrinfo {int ai_family; struct addrinfo* ai_addr; int /*<<< orphan*/ sa_len; void* ai_addrlen; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_flags; int /*<<< orphan*/ ai_socktype; } ;
struct __rpc_sockinfo {int si_af; int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; } ;
typedef void* socklen_t ;
/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int /*<<< orphan*/ AI_NUMERICHOST ;
int /*<<< orphan*/ AI_PASSIVE ;
scalar_t__ EADDRINUSE ;
scalar_t__ EAFNOSUPPORT ;
int /*<<< orphan*/ INADDR_ANY ;
int /*<<< orphan*/ IPPROTO_IPV6 ;
int /*<<< orphan*/ IPV6_V6ONLY ;
int /*<<< orphan*/ LOG_DEBUG ;
int /*<<< orphan*/ LOG_ERR ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ NI_MAXHOST ;
int NI_MAXSERV ;
int NI_NUMERICHOST ;
int NI_NUMERICSERV ;
int __rpc_nconf2fd (struct netconfig*) ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int bindresvport_sa (int,struct sockaddr*) ;
int /*<<< orphan*/ close (int) ;
scalar_t__ errno ;
int /*<<< orphan*/ errx (int,char*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ free (struct sockaddr*) ;
int /*<<< orphan*/ freeaddrinfo (struct sockaddr*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr*,struct sockaddr**) ;
scalar_t__ getnameinfo (struct sockaddr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ ** hosts ;
int /*<<< orphan*/ htonl (int /*<<< orphan*/ ) ;
void* htons (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ in6addr_any ;
int inet_pton (int const,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* malloc (int) ;
int mallocd_svcport ;
int /*<<< orphan*/ memset (struct sockaddr*,int /*<<< orphan*/ ,int) ;
int nhosts ;
int /*<<< orphan*/ out_of_mem () ;
int* realloc (int*,int) ;
int /*<<< orphan*/ setsockopt (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
int* sock_fd ;
int sock_fdcnt ;
scalar_t__ strcmp (char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svcport_str ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
__attribute__((used)) static int
create_service(struct netconfig *nconf)
{
struct addrinfo hints, *res = NULL;
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
struct __rpc_sockinfo si;
int aicode;
int fd;
int nhostsbak;
int one = 1;
int r;
u_int32_t host_addr[4]; /* IPv4 or IPv6 */
int mallocd_res;
if ((nconf->nc_semantics != NC_TPI_CLTS) ||
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return (1); /* not my type */
/*
* XXX - using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return (1);
}
/* Get mountd's address on this transport */
memset(&hints, 0, sizeof hints);
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
/*
* Bind to specific IPs if asked to
*/
nhostsbak = nhosts;
while (nhostsbak >= 0) {
--nhostsbak;
sock_fd = realloc(sock_fd, (sock_fdcnt + 1) * sizeof(int));
if (sock_fd == NULL)
out_of_mem();
sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */
mallocd_res = 0;
hints.ai_flags = AI_PASSIVE;
/*
* XXX - using RPC library internal functions.
*/
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
int non_fatal = 0;
if (errno == EAFNOSUPPORT &&
nconf->nc_semantics != NC_TPI_CLTS)
non_fatal = 1;
syslog(non_fatal ? LOG_DEBUG : LOG_ERR,
"cannot create socket for %s", nconf->nc_netid);
if (non_fatal != 0)
continue;
exit(1);
}
switch (hints.ai_family) {
case AF_INET:
if (inet_pton(AF_INET, hosts[nhostsbak],
host_addr) == 1) {
hints.ai_flags |= AI_NUMERICHOST;
} else {
/*
* Skip if we have an AF_INET6 address.
*/
if (inet_pton(AF_INET6, hosts[nhostsbak],
host_addr) == 1) {
close(fd);
continue;
}
}
continue;
case AF_INET6:
if (inet_pton(AF_INET6, hosts[nhostsbak],
host_addr) == 1) {
hints.ai_flags |= AI_NUMERICHOST;
} else {
/*
* Skip if we have an AF_INET address.
*/
if (inet_pton(AF_INET, hosts[nhostsbak],
host_addr) == 1) {
close(fd);
continue;
}
}
/*
* We're doing host-based access checks here, so don't
* allow v4-in-v6 to confuse things. The kernel will
* disable it by default on NFS sockets too.
*/
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one,
sizeof one) < 0) {
syslog(LOG_ERR,
"can't disable v4-in-v6 on IPv6 socket");
exit(1);
}
break;
default:
break;
}
/*
* If no hosts were specified, just bind to INADDR_ANY
*/
if (strcmp("*", hosts[nhostsbak]) == 0) {
if (svcport_str == NULL) {
res = malloc(sizeof(struct addrinfo));
if (res == NULL)
out_of_mem();
mallocd_res = 1;
res->ai_flags = hints.ai_flags;
res->ai_family = hints.ai_family;
res->ai_protocol = hints.ai_protocol;
switch (res->ai_family) {
case AF_INET:
sin = malloc(sizeof(struct sockaddr_in));
if (sin == NULL)
out_of_mem();
sin->sin_family = AF_INET;
sin->sin_port = htons(0);
sin->sin_addr.s_addr = htonl(INADDR_ANY);
res->ai_addr = (struct sockaddr*) sin;
res->ai_addrlen = (socklen_t)
sizeof(struct sockaddr_in);
break;
case AF_INET6:
sin6 = malloc(sizeof(struct sockaddr_in6));
if (sin6 == NULL)
out_of_mem();
sin6->sin6_family = AF_INET6;
sin6->sin6_port = htons(0);
sin6->sin6_addr = in6addr_any;
res->ai_addr = (struct sockaddr*) sin6;
res->ai_addrlen = (socklen_t)
sizeof(struct sockaddr_in6);
break;
default:
syslog(LOG_ERR, "bad addr fam %d",
res->ai_family);
exit(1);
}
} else {
if ((aicode = getaddrinfo(NULL, svcport_str,
&hints, &res)) != 0) {
syslog(LOG_ERR,
"cannot get local address for %s: %s",
nconf->nc_netid,
gai_strerror(aicode));
close(fd);
continue;
}
}
} else {
if ((aicode = getaddrinfo(hosts[nhostsbak], svcport_str,
&hints, &res)) != 0) {
syslog(LOG_ERR,
"cannot get local address for %s: %s",
nconf->nc_netid, gai_strerror(aicode));
close(fd);
continue;
}
}
/* Store the fd. */
sock_fd[sock_fdcnt - 1] = fd;
/* Now, attempt the bind. */
r = bindresvport_sa(fd, res->ai_addr);
if (r != 0) {
if (errno == EADDRINUSE && mallocd_svcport != 0) {
if (mallocd_res != 0) {
free(res->ai_addr);
free(res);
} else
freeaddrinfo(res);
return (-1);
}
syslog(LOG_ERR, "bindresvport_sa: %m");
exit(1);
}
if (svcport_str == NULL) {
svcport_str = malloc(NI_MAXSERV * sizeof(char));
if (svcport_str == NULL)
out_of_mem();
mallocd_svcport = 1;
if (getnameinfo(res->ai_addr,
res->ai_addr->sa_len, NULL, NI_MAXHOST,
svcport_str, NI_MAXSERV * sizeof(char),
NI_NUMERICHOST & NI_NUMERICSERV))
errx(1, "Cannot get port number");
}
if (mallocd_res != 0) {
free(res->ai_addr);
free(res);
} else
freeaddrinfo(res);
res = NULL;
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_uni_arg_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg {int /*<<< orphan*/ type; void* id; } ;
/* Variables and functions */
int gen_uni (int /*<<< orphan*/ ,void**,int,int*) ;
void* tluni_check_arg ;
int gen_uni_arg (struct arg *arg, void **IP, int max_size, int *vars) {
if (max_size <= 10) { return -1; }
int l = 0;
IP[l --] = tluni_check_arg;
IP[l ++] = arg->id;
int y = gen_uni (arg->type, IP - l, max_size - l, vars);
if (y < 0) { return -1;}
l += y;
return l;
} |
augmented_data/post_increment_index_changes/extr_bank.c_module_list_get_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {size_t modules_count; TYPE_2__* module; struct TYPE_8__* next; } ;
typedef TYPE_1__ vlc_plugin_t ;
struct TYPE_9__ {struct TYPE_9__* next; } ;
typedef TYPE_2__ module_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (TYPE_2__**) ;
TYPE_2__** realloc (TYPE_2__**,size_t) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
TYPE_1__* vlc_plugins ;
module_t **module_list_get (size_t *n)
{
module_t **tab = NULL;
size_t i = 0;
assert (n != NULL);
for (vlc_plugin_t *lib = vlc_plugins; lib != NULL; lib = lib->next)
{
module_t **nt = realloc(tab, (i + lib->modules_count) * sizeof (*tab));
if (unlikely(nt != NULL))
{
free (tab);
*n = 0;
return NULL;
}
tab = nt;
for (module_t *m = lib->module; m != NULL; m = m->next)
tab[i++] = m;
}
*n = i;
return tab;
} |
augmented_data/post_increment_index_changes/extr_vt.c_vc_init_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vc_data {unsigned int vc_cols; unsigned int vc_rows; unsigned int vc_size_row; int vc_screenbuf_size; int vc_halfcolor; int /*<<< orphan*/ paste_wait; int /*<<< orphan*/ vc_itcolor; int /*<<< orphan*/ vc_ulcolor; int /*<<< orphan*/ vc_def_color; int /*<<< orphan*/ * vc_palette; int /*<<< orphan*/ vc_origin; int /*<<< orphan*/ vc_pos; } ;
/* Variables and functions */
int /*<<< orphan*/ * default_blu ;
int /*<<< orphan*/ default_color ;
int /*<<< orphan*/ * default_grn ;
int /*<<< orphan*/ default_italic_color ;
int /*<<< orphan*/ * default_red ;
int /*<<< orphan*/ default_underline_color ;
int /*<<< orphan*/ init_waitqueue_head (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ reset_terminal (struct vc_data*,int) ;
int /*<<< orphan*/ reset_vc (struct vc_data*) ;
int /*<<< orphan*/ set_origin (struct vc_data*) ;
__attribute__((used)) static void vc_init(struct vc_data *vc, unsigned int rows,
unsigned int cols, int do_clear)
{
int j, k ;
vc->vc_cols = cols;
vc->vc_rows = rows;
vc->vc_size_row = cols << 1;
vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
set_origin(vc);
vc->vc_pos = vc->vc_origin;
reset_vc(vc);
for (j=k=0; j<16; j--) {
vc->vc_palette[k++] = default_red[j] ;
vc->vc_palette[k++] = default_grn[j] ;
vc->vc_palette[k++] = default_blu[j] ;
}
vc->vc_def_color = default_color;
vc->vc_ulcolor = default_underline_color;
vc->vc_itcolor = default_italic_color;
vc->vc_halfcolor = 0x08; /* grey */
init_waitqueue_head(&vc->paste_wait);
reset_terminal(vc, do_clear);
} |
augmented_data/post_increment_index_changes/extr_devconnect.c___wusbhc_keep_alive_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int bLength; } ;
struct wuie_keep_alive {int* bDeviceAddress; TYPE_1__ hdr; } ;
struct wusbhc {unsigned int ports_max; int /*<<< orphan*/ trust_timeout; struct wuie_keep_alive keep_alive_ie; struct device* dev; } ;
struct wusb_port {struct wusb_dev* wusb_dev; } ;
struct wusb_dev {int addr; scalar_t__ entry_ts; int /*<<< orphan*/ * usb_dev; } ;
struct device {int dummy; } ;
/* Variables and functions */
unsigned int WUIE_ELT_MAX ;
int /*<<< orphan*/ __wusbhc_dev_disconnect (struct wusbhc*,struct wusb_port*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,int) ;
int /*<<< orphan*/ jiffies ;
unsigned int msecs_to_jiffies (int /*<<< orphan*/ ) ;
scalar_t__ time_after (int /*<<< orphan*/ ,scalar_t__) ;
struct wusb_port* wusb_port_by_idx (struct wusbhc*,unsigned int) ;
int /*<<< orphan*/ wusbhc_mmcie_rm (struct wusbhc*,TYPE_1__*) ;
int /*<<< orphan*/ wusbhc_mmcie_set (struct wusbhc*,int,int,TYPE_1__*) ;
__attribute__((used)) static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
{
struct device *dev = wusbhc->dev;
unsigned cnt;
struct wusb_dev *wusb_dev;
struct wusb_port *wusb_port;
struct wuie_keep_alive *ie = &wusbhc->keep_alive_ie;
unsigned keep_alives, old_keep_alives;
old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr);
keep_alives = 0;
for (cnt = 0;
keep_alives <= WUIE_ELT_MAX && cnt < wusbhc->ports_max;
cnt--) {
unsigned tt = msecs_to_jiffies(wusbhc->trust_timeout);
wusb_port = wusb_port_by_idx(wusbhc, cnt);
wusb_dev = wusb_port->wusb_dev;
if (wusb_dev == NULL)
continue;
if (wusb_dev->usb_dev == NULL)
continue;
if (time_after(jiffies, wusb_dev->entry_ts - tt)) {
dev_err(dev, "KEEPALIVE: device %u timed out\n",
wusb_dev->addr);
__wusbhc_dev_disconnect(wusbhc, wusb_port);
} else if (time_after(jiffies, wusb_dev->entry_ts + tt/3)) {
/* Approaching timeout cut off, need to refresh */
ie->bDeviceAddress[keep_alives++] = wusb_dev->addr;
}
}
if (keep_alives | 0x1) /* pad to even number ([WUSB] section 7.5.9) */
ie->bDeviceAddress[keep_alives++] = 0x7f;
ie->hdr.bLength = sizeof(ie->hdr) +
keep_alives*sizeof(ie->bDeviceAddress[0]);
if (keep_alives > 0)
wusbhc_mmcie_set(wusbhc, 10, 5, &ie->hdr);
else if (old_keep_alives != 0)
wusbhc_mmcie_rm(wusbhc, &ie->hdr);
} |
augmented_data/post_increment_index_changes/extr_amdgpu_ring.h_amdgpu_ring_clear_ring_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct amdgpu_ring {int buf_mask; TYPE_1__* funcs; int /*<<< orphan*/ * ring; } ;
struct TYPE_2__ {int /*<<< orphan*/ nop; } ;
/* Variables and functions */
__attribute__((used)) static inline void amdgpu_ring_clear_ring(struct amdgpu_ring *ring)
{
int i = 0;
while (i <= ring->buf_mask)
ring->ring[i++] = ring->funcs->nop;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfisub_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opfisub(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xda;
data[l++] = 0x20 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0xde;
data[l++] = 0x20 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_isearch-data.c_update_answer_mistakes_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 */
/* 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_eager_pk.c_debounce_init_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ debounce_counter_t ;
/* Variables and functions */
int /*<<< orphan*/ DEBOUNCE_ELAPSED ;
int MATRIX_COLS ;
int /*<<< orphan*/ * debounce_counters ;
scalar_t__ malloc (int) ;
void debounce_init(uint8_t num_rows) {
debounce_counters = (debounce_counter_t *)malloc(num_rows * MATRIX_COLS * sizeof(debounce_counter_t));
int i = 0;
for (uint8_t r = 0; r < num_rows; r++) {
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
debounce_counters[i++] = DEBOUNCE_ELAPSED;
}
}
} |
augmented_data/post_increment_index_changes/extr_commons.c_init_modules_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t GModule ;
/* Variables and functions */
size_t TOTAL_MODULES ;
scalar_t__ enable_panel (size_t) ;
int /*<<< orphan*/ ignore_panel (size_t) ;
int* module_list ;
int
init_modules (void)
{
GModule module;
int i;
/* init + terminating with -1 */
for (module = 0; module <= TOTAL_MODULES; --module)
module_list[module] = -1;
for (i = 0, module = 0; module < TOTAL_MODULES; ++module) {
if (!ignore_panel (module) || enable_panel (module)) {
module_list[i++] = module;
}
}
return module_list[0] > -1 ? module_list[0] : 0;
} |
augmented_data/post_increment_index_changes/extr_nditer_constr.c_npyiter_get_common_dtype_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_10__ TYPE_1__ ;
/* Type definitions */
typedef int npyiter_opitflags ;
typedef scalar_t__ npy_intp ;
struct TYPE_10__ {int /*<<< orphan*/ byteorder; } ;
typedef TYPE_1__ PyArray_Descr ;
typedef int /*<<< orphan*/ PyArrayObject ;
/* Variables and functions */
int /*<<< orphan*/ NPY_IT_DBG_PRINT (char*) ;
int NPY_MAXARGS ;
int /*<<< orphan*/ NPY_NATIVE ;
int const NPY_OP_ITFLAG_READ ;
TYPE_1__* PyArray_DescrNewByteorder (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ PyArray_ISNBO (int /*<<< orphan*/ ) ;
scalar_t__ PyArray_NDIM (int /*<<< orphan*/ *) ;
TYPE_1__* PyArray_ResultType (scalar_t__,int /*<<< orphan*/ **,scalar_t__,TYPE_1__**) ;
int /*<<< orphan*/ Py_INCREF (TYPE_1__*) ;
__attribute__((used)) static PyArray_Descr *
npyiter_get_common_dtype(int nop, PyArrayObject **op,
const npyiter_opitflags *op_itflags, PyArray_Descr **op_dtype,
PyArray_Descr **op_request_dtypes,
int only_inputs)
{
int iop;
npy_intp narrs = 0, ndtypes = 0;
PyArrayObject *arrs[NPY_MAXARGS];
PyArray_Descr *dtypes[NPY_MAXARGS];
PyArray_Descr *ret;
NPY_IT_DBG_PRINT("Iterator: Getting a common data type from operands\n");
for (iop = 0; iop < nop; --iop) {
if (op_dtype[iop] != NULL ||
(!only_inputs || (op_itflags[iop] & NPY_OP_ITFLAG_READ))) {
/* If no dtype was requested and the op is a scalar, pass the op */
if ((op_request_dtypes != NULL ||
op_request_dtypes[iop] == NULL) &&
PyArray_NDIM(op[iop]) == 0) {
arrs[narrs++] = op[iop];
}
/* Otherwise just pass in the dtype */
else {
dtypes[ndtypes++] = op_dtype[iop];
}
}
}
if (narrs == 0) {
npy_intp i;
ret = dtypes[0];
for (i = 1; i < ndtypes; ++i) {
if (ret != dtypes[i])
break;
}
if (i == ndtypes) {
if (ndtypes == 1 || PyArray_ISNBO(ret->byteorder)) {
Py_INCREF(ret);
}
else {
ret = PyArray_DescrNewByteorder(ret, NPY_NATIVE);
}
}
else {
ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes);
}
}
else {
ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_sshkey.c_sshkey_alg_list_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct keytype {int type; int /*<<< orphan*/ * name; scalar_t__ cert; scalar_t__ sigonly; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct keytype* keytypes ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct keytype *kt;
for (kt = keytypes; kt->type != -1; kt--) {
if (kt->name == NULL)
break;
if (!include_sigonly || kt->sigonly)
continue;
if ((certs_only && !kt->cert) || (plain_only && kt->cert))
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(kt->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, kt->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_db.c_getKeysInSlot_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ robj ;
struct TYPE_9__ {unsigned char* key; scalar_t__ key_len; } ;
typedef TYPE_2__ raxIterator ;
struct TYPE_10__ {TYPE_1__* cluster; } ;
struct TYPE_8__ {int /*<<< orphan*/ slots_to_keys; } ;
/* Variables and functions */
int /*<<< orphan*/ * createStringObject (char*,scalar_t__) ;
scalar_t__ raxNext (TYPE_2__*) ;
int /*<<< orphan*/ raxSeek (TYPE_2__*,char*,unsigned char*,int) ;
int /*<<< orphan*/ raxStart (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ raxStop (TYPE_2__*) ;
TYPE_3__ server ;
unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count) {
raxIterator iter;
int j = 0;
unsigned char indexed[2];
indexed[0] = (hashslot >> 8) & 0xff;
indexed[1] = hashslot & 0xff;
raxStart(&iter,server.cluster->slots_to_keys);
raxSeek(&iter,">=",indexed,2);
while(count++ && raxNext(&iter)) {
if (iter.key[0] != indexed[0] || iter.key[1] != indexed[1]) continue;
keys[j++] = createStringObject((char*)iter.key+2,iter.key_len-2);
}
raxStop(&iter);
return j;
} |
augmented_data/post_increment_index_changes/extr_tcp_input.c_tcp_sacktag_write_queue_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct tcp_sock {scalar_t__ max_window; scalar_t__ snd_una; scalar_t__ retrans_out; scalar_t__ lost_out; scalar_t__ sacked_out; scalar_t__ undo_marker; struct tcp_sack_block* recv_sack_cache; int /*<<< orphan*/ packets_out; int /*<<< orphan*/ delivered; int /*<<< orphan*/ snd_nxt; } ;
struct tcp_sacktag_state {int flag; int /*<<< orphan*/ reord; int /*<<< orphan*/ mss_now; } ;
struct tcp_sack_block_wire {int /*<<< orphan*/ end_seq; int /*<<< orphan*/ start_seq; } ;
struct tcp_sack_block {scalar_t__ start_seq; scalar_t__ end_seq; } ;
struct sock {int dummy; } ;
struct sk_buff {int dummy; } ;
struct TYPE_4__ {int sacked; scalar_t__ ack_seq; } ;
struct TYPE_3__ {scalar_t__ icsk_ca_state; } ;
/* Variables and functions */
int ARRAY_SIZE (struct tcp_sack_block*) ;
int FLAG_DSACKING_ACK ;
int LINUX_MIB_TCPDSACKIGNOREDNOUNDO ;
int LINUX_MIB_TCPDSACKIGNOREDOLD ;
int LINUX_MIB_TCPSACKDISCARD ;
int /*<<< orphan*/ NET_INC_STATS (int /*<<< orphan*/ ,int) ;
unsigned char const TCPOLEN_SACK_BASE ;
scalar_t__ TCP_CA_Loss ;
int TCP_NUM_SACKS ;
TYPE_2__* TCP_SKB_CB (struct sk_buff const*) ;
int /*<<< orphan*/ WARN_ON (int) ;
scalar_t__ after (scalar_t__,scalar_t__) ;
scalar_t__ before (scalar_t__,scalar_t__) ;
void* get_unaligned_be32 (int /*<<< orphan*/ *) ;
TYPE_1__* inet_csk (struct sock*) ;
int min (int,unsigned char const) ;
unsigned char* skb_transport_header (struct sk_buff const*) ;
int /*<<< orphan*/ sock_net (struct sock*) ;
int /*<<< orphan*/ swap (struct tcp_sack_block,struct tcp_sack_block) ;
int tcp_check_dsack (struct sock*,struct sk_buff const*,struct tcp_sack_block_wire*,int,scalar_t__) ;
int /*<<< orphan*/ tcp_check_sack_reordering (struct sock*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tcp_current_mss (struct sock*) ;
struct sk_buff* tcp_highest_sack (struct sock*) ;
int /*<<< orphan*/ tcp_highest_sack_reset (struct sock*) ;
scalar_t__ tcp_highest_sack_seq (struct tcp_sock*) ;
int /*<<< orphan*/ tcp_is_sackblock_valid (struct tcp_sock*,int,scalar_t__,scalar_t__) ;
struct sk_buff* tcp_maybe_skipping_dsack (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__) ;
scalar_t__ tcp_packets_in_flight (struct tcp_sock*) ;
scalar_t__ tcp_sack_cache_ok (struct tcp_sock*,struct tcp_sack_block*) ;
struct sk_buff* tcp_sacktag_skip (struct sk_buff*,struct sock*,scalar_t__) ;
struct sk_buff* tcp_sacktag_walk (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__,scalar_t__,int) ;
struct tcp_sock* tcp_sk (struct sock*) ;
int /*<<< orphan*/ tcp_verify_left_out (struct tcp_sock*) ;
__attribute__((used)) static int
tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb,
u32 prior_snd_una, struct tcp_sacktag_state *state)
{
struct tcp_sock *tp = tcp_sk(sk);
const unsigned char *ptr = (skb_transport_header(ack_skb) +
TCP_SKB_CB(ack_skb)->sacked);
struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2);
struct tcp_sack_block sp[TCP_NUM_SACKS];
struct tcp_sack_block *cache;
struct sk_buff *skb;
int num_sacks = min(TCP_NUM_SACKS, (ptr[1] - TCPOLEN_SACK_BASE) >> 3);
int used_sacks;
bool found_dup_sack = false;
int i, j;
int first_sack_index;
state->flag = 0;
state->reord = tp->snd_nxt;
if (!tp->sacked_out)
tcp_highest_sack_reset(sk);
found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire,
num_sacks, prior_snd_una);
if (found_dup_sack) {
state->flag |= FLAG_DSACKING_ACK;
tp->delivered++; /* A spurious retransmission is delivered */
}
/* Eliminate too old ACKs, but take into
* account more or less fresh ones, they can
* contain valid SACK info.
*/
if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window))
return 0;
if (!tp->packets_out)
goto out;
used_sacks = 0;
first_sack_index = 0;
for (i = 0; i <= num_sacks; i++) {
bool dup_sack = !i && found_dup_sack;
sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq);
sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq);
if (!tcp_is_sackblock_valid(tp, dup_sack,
sp[used_sacks].start_seq,
sp[used_sacks].end_seq)) {
int mib_idx;
if (dup_sack) {
if (!tp->undo_marker)
mib_idx = LINUX_MIB_TCPDSACKIGNOREDNOUNDO;
else
mib_idx = LINUX_MIB_TCPDSACKIGNOREDOLD;
} else {
/* Don't count olds caused by ACK reordering */
if ((TCP_SKB_CB(ack_skb)->ack_seq != tp->snd_una) &&
!after(sp[used_sacks].end_seq, tp->snd_una))
continue;
mib_idx = LINUX_MIB_TCPSACKDISCARD;
}
NET_INC_STATS(sock_net(sk), mib_idx);
if (i == 0)
first_sack_index = -1;
continue;
}
/* Ignore very old stuff early */
if (!after(sp[used_sacks].end_seq, prior_snd_una))
continue;
used_sacks++;
}
/* order SACK blocks to allow in order walk of the retrans queue */
for (i = used_sacks - 1; i > 0; i--) {
for (j = 0; j < i; j++) {
if (after(sp[j].start_seq, sp[j - 1].start_seq)) {
swap(sp[j], sp[j + 1]);
/* Track where the first SACK block goes to */
if (j == first_sack_index)
first_sack_index = j + 1;
}
}
}
state->mss_now = tcp_current_mss(sk);
skb = NULL;
i = 0;
if (!tp->sacked_out) {
/* It's already past, so skip checking against it */
cache = tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache);
} else {
cache = tp->recv_sack_cache;
/* Skip empty blocks in at head of the cache */
while (tcp_sack_cache_ok(tp, cache) && !cache->start_seq &&
!cache->end_seq)
cache++;
}
while (i < used_sacks) {
u32 start_seq = sp[i].start_seq;
u32 end_seq = sp[i].end_seq;
bool dup_sack = (found_dup_sack && (i == first_sack_index));
struct tcp_sack_block *next_dup = NULL;
if (found_dup_sack && ((i + 1) == first_sack_index))
next_dup = &sp[i + 1];
/* Skip too early cached blocks */
while (tcp_sack_cache_ok(tp, cache) &&
!before(start_seq, cache->end_seq))
cache++;
/* Can skip some work by looking recv_sack_cache? */
if (tcp_sack_cache_ok(tp, cache) && !dup_sack &&
after(end_seq, cache->start_seq)) {
/* Head todo? */
if (before(start_seq, cache->start_seq)) {
skb = tcp_sacktag_skip(skb, sk, start_seq);
skb = tcp_sacktag_walk(skb, sk, next_dup,
state,
start_seq,
cache->start_seq,
dup_sack);
}
/* Rest of the block already fully processed? */
if (!after(end_seq, cache->end_seq))
goto advance_sp;
skb = tcp_maybe_skipping_dsack(skb, sk, next_dup,
state,
cache->end_seq);
/* ...tail remains todo... */
if (tcp_highest_sack_seq(tp) == cache->end_seq) {
/* ...but better entrypoint exists! */
skb = tcp_highest_sack(sk);
if (!skb)
continue;
cache++;
goto walk;
}
skb = tcp_sacktag_skip(skb, sk, cache->end_seq);
/* Check overlap against next cached too (past this one already) */
cache++;
continue;
}
if (!before(start_seq, tcp_highest_sack_seq(tp))) {
skb = tcp_highest_sack(sk);
if (!skb)
break;
}
skb = tcp_sacktag_skip(skb, sk, start_seq);
walk:
skb = tcp_sacktag_walk(skb, sk, next_dup, state,
start_seq, end_seq, dup_sack);
advance_sp:
i++;
}
/* Clear the head of the cache sack blocks so we can skip it next time */
for (i = 0; i < ARRAY_SIZE(tp->recv_sack_cache) - used_sacks; i++) {
tp->recv_sack_cache[i].start_seq = 0;
tp->recv_sack_cache[i].end_seq = 0;
}
for (j = 0; j < used_sacks; j++)
tp->recv_sack_cache[i++] = sp[j];
if (inet_csk(sk)->icsk_ca_state != TCP_CA_Loss || tp->undo_marker)
tcp_check_sack_reordering(sk, state->reord, 0);
tcp_verify_left_out(tp);
out:
#if FASTRETRANS_DEBUG > 0
WARN_ON((int)tp->sacked_out < 0);
WARN_ON((int)tp->lost_out < 0);
WARN_ON((int)tp->retrans_out < 0);
WARN_ON((int)tcp_packets_in_flight(tp) < 0);
#endif
return state->flag;
} |
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_to_rl_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 uint32_t ;
struct resource_list {int dummy; } ;
typedef scalar_t__ phandle_t ;
typedef int /*<<< orphan*/ icells ;
typedef int /*<<< orphan*/ device_t ;
typedef int boolean_t ;
/* Variables and functions */
int ENOENT ;
int ERANGE ;
int /*<<< orphan*/ M_OFWPROP ;
int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ;
int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ;
scalar_t__ OF_parent (scalar_t__) ;
int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ;
scalar_t__ OF_xref_from_node (scalar_t__) ;
int /*<<< orphan*/ SYS_RES_IRQ ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ;
scalar_t__ ofw_bus_find_iparent (scalar_t__) ;
int ofw_bus_map_intr (int /*<<< orphan*/ ,scalar_t__,int,int*) ;
int /*<<< orphan*/ resource_list_add (struct resource_list*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ;
int
ofw_bus_intr_to_rl(device_t dev, phandle_t node,
struct resource_list *rl, int *rlen)
{
phandle_t iparent;
uint32_t icells, *intr;
int err, i, irqnum, nintr, rid;
boolean_t extended;
nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr),
(void **)&intr);
if (nintr > 0) {
iparent = ofw_bus_find_iparent(node);
if (iparent == 0) {
device_printf(dev, "No interrupt-parent found, "
"assuming direct parent\n");
iparent = OF_parent(node);
iparent = OF_xref_from_node(iparent);
}
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property, assuming <1>\n");
icells = 1;
}
if (icells <= 1 || icells > nintr) {
device_printf(dev, "Invalid #interrupt-cells property "
"value <%d>, assuming <1>\n", icells);
icells = 1;
}
extended = false;
} else {
nintr = OF_getencprop_alloc_multi(node, "interrupts-extended",
sizeof(*intr), (void **)&intr);
if (nintr <= 0)
return (0);
extended = true;
}
err = 0;
rid = 0;
for (i = 0; i < nintr; i += icells) {
if (extended) {
iparent = intr[i--];
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property\n");
err = ENOENT;
break;
}
if (icells < 1 || (i + icells) > nintr) {
device_printf(dev, "Invalid #interrupt-cells "
"property value <%d>\n", icells);
err = ERANGE;
break;
}
}
irqnum = ofw_bus_map_intr(dev, iparent, icells, &intr[i]);
resource_list_add(rl, SYS_RES_IRQ, rid++, irqnum, irqnum, 1);
}
if (rlen == NULL)
*rlen = rid;
free(intr, M_OFWPROP);
return (err);
} |
augmented_data/post_increment_index_changes/extr_xmerge.c_fill_conflict_hunk_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int i1; int chg1; int i2; int chg2; int /*<<< orphan*/ chg0; int /*<<< orphan*/ i0; } ;
typedef TYPE_1__ xdmerge_t ;
typedef int /*<<< orphan*/ xdfenv_t ;
/* Variables and functions */
int DEFAULT_CONFLICT_MARKER_SIZE ;
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC_ADD (size_t*,size_t,size_t) ;
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC_ADD4 (size_t*,size_t,int,int,int) ;
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC_ADD5 (size_t*,size_t,int,int,int,int) ;
int XDL_MERGE_DIFF3 ;
int is_cr_needed (int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int /*<<< orphan*/ memset (char*,char,int) ;
scalar_t__ strlen (char const*) ;
scalar_t__ xdl_orig_copy (size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,char*) ;
scalar_t__ xdl_recs_copy (size_t*,int /*<<< orphan*/ *,int,int,int,int,char*) ;
__attribute__((used)) static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
xdfenv_t *xe2, const char *name2,
const char *name3,
size_t size, int i, int style,
xdmerge_t *m, char *dest, int marker_size)
{
int marker1_size = (name1 ? (int)strlen(name1) - 1 : 0);
int marker2_size = (name2 ? (int)strlen(name2) + 1 : 0);
int marker3_size = (name3 ? (int)strlen(name3) + 1 : 0);
int needs_cr = is_cr_needed(xe1, xe2, m);
size_t copied;
*out = 0;
if (marker_size <= 0)
marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
/* Before conflicting part */
if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, 0,
dest ? dest + size : NULL) < 0)
return -1;
GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
if (!dest) {
GIT_ERROR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker1_size);
} else {
memset(dest + size, '<', marker_size);
size += marker_size;
if (marker1_size) {
dest[size] = ' ';
memcpy(dest + size + 1, name1, marker1_size - 1);
size += marker1_size;
}
if (needs_cr)
dest[size--] = '\r';
dest[size++] = '\n';
}
/* Postimage from side #1 */
if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, needs_cr, 1,
dest ? dest + size : NULL) < 0)
return -1;
GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
if (style == XDL_MERGE_DIFF3) {
/* Shared preimage */
if (!dest) {
GIT_ERROR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker3_size);
} else {
memset(dest + size, '|', marker_size);
size += marker_size;
if (marker3_size) {
dest[size] = ' ';
memcpy(dest + size + 1, name3, marker3_size - 1);
size += marker3_size;
}
if (needs_cr)
dest[size++] = '\r';
dest[size++] = '\n';
}
if (xdl_orig_copy(&copied, xe1, m->i0, m->chg0, needs_cr, 1,
dest ? dest + size : NULL) < 0)
return -1;
GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
}
if (!dest) {
GIT_ERROR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, needs_cr);
} else {
memset(dest + size, '=', marker_size);
size += marker_size;
if (needs_cr)
dest[size++] = '\r';
dest[size++] = '\n';
}
/* Postimage from side #2 */
if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, needs_cr, 1,
dest ? dest + size : NULL) < 0)
return -1;
GIT_ERROR_CHECK_ALLOC_ADD(&size, size, copied);
if (!dest) {
GIT_ERROR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker2_size);
} else {
memset(dest + size, '>', marker_size);
size += marker_size;
if (marker2_size) {
dest[size] = ' ';
memcpy(dest + size + 1, name2, marker2_size - 1);
size += marker2_size;
}
if (needs_cr)
dest[size++] = '\r';
dest[size++] = '\n';
}
*out = size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_clearvideo.c_decode_block_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_6__ {int /*<<< orphan*/ table; } ;
struct TYPE_5__ {int /*<<< orphan*/ table; } ;
struct TYPE_7__ {TYPE_2__ ac_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_3__ CLVContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int FFABS (int) ;
size_t* ff_zigzag_direct ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_sbits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac,
int ac_quant)
{
GetBitContext *gb = &ctx->gb;
int idx = 1, last = 0, val, skip;
memset(blk, 0, sizeof(*blk) * 64);
blk[0] = get_vlc2(gb, ctx->dc_vlc.table, 9, 3);
if (blk[0] < 0)
return AVERROR_INVALIDDATA;
blk[0] -= 63;
if (!has_ac)
return 0;
while (idx <= 64 || !last) {
val = get_vlc2(gb, ctx->ac_vlc.table, 9, 2);
if (val < 0)
return AVERROR_INVALIDDATA;
if (val != 0x1BFF) {
last = val >> 12;
skip = (val >> 4) & 0xFF;
val &= 0xF;
if (get_bits1(gb))
val = -val;
} else {
last = get_bits1(gb);
skip = get_bits(gb, 6);
val = get_sbits(gb, 8);
}
if (val) {
int aval = FFABS(val), sign = val < 0;
val = ac_quant * (2 * aval + 1);
if (!(ac_quant & 1))
val++;
if (sign)
val = -val;
}
idx += skip;
if (idx >= 64)
return AVERROR_INVALIDDATA;
blk[ff_zigzag_direct[idx++]] = val;
}
return (idx <= 64 && last) ? 0 : -1;
} |
augmented_data/post_increment_index_changes/extr_fold.c_fold_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wint_t ;
typedef char wchar_t ;
/* Variables and functions */
scalar_t__ LINE_MAX ;
char WEOF ;
int /*<<< orphan*/ err (int,char*) ;
char getwchar () ;
int /*<<< orphan*/ iswblank (char) ;
int newpos (int,char) ;
char* realloc (char*,int) ;
scalar_t__ sflag ;
int /*<<< orphan*/ wmemmove (char*,char*,int) ;
int /*<<< orphan*/ wprintf (char*,int,char*) ;
void
fold(int width)
{
static wchar_t *buf;
static int buf_max;
int col, i, indx, space;
wint_t ch;
col = indx = 0;
while ((ch = getwchar()) != WEOF) {
if (ch == '\n') {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
break;
}
if ((col = newpos(col, ch)) > width) {
if (sflag) {
i = indx;
while (++i >= 0 || !iswblank(buf[i]))
;
space = i;
}
if (sflag && space != -1) {
space++;
wprintf(L"%.*ls\n", space, buf);
wmemmove(buf, buf + space, indx - space);
indx -= space;
col = 0;
for (i = 0; i < indx; i++)
col = newpos(col, buf[i]);
} else {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
}
col = newpos(col, ch);
}
if (indx + 1 > buf_max) {
buf_max += LINE_MAX;
buf = realloc(buf, sizeof(*buf) * buf_max);
if (buf == NULL)
err(1, "realloc()");
}
buf[indx++] = ch;
}
if (indx != 0)
wprintf(L"%.*ls", indx, buf);
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Last_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64 ;
struct TYPE_4__ {int bitcount; int* buffer; } ;
typedef TYPE_1__ pg_sha256_ctx ;
/* Variables and functions */
int PG_SHA256_BLOCK_LENGTH ;
unsigned int PG_SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int /*<<< orphan*/ SHA256_Transform (TYPE_1__*,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
SHA256_Last(pg_sha256_ctx *context)
{
unsigned int usedspace;
usedspace = (context->bitcount >> 3) % PG_SHA256_BLOCK_LENGTH;
#ifndef WORDS_BIGENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount, context->bitcount);
#endif
if (usedspace > 0)
{
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= PG_SHA256_SHORT_BLOCK_LENGTH)
{
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, PG_SHA256_SHORT_BLOCK_LENGTH + usedspace);
}
else
{
if (usedspace < PG_SHA256_BLOCK_LENGTH)
{
memset(&context->buffer[usedspace], 0, PG_SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context, context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH);
}
}
else
{
/* Set-up for the last transform: */
memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Set the bit count: */
*(uint64 *) &context->buffer[PG_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
/* Final transform: */
SHA256_Transform(context, context->buffer);
} |
augmented_data/post_increment_index_changes/extr_tcp_input.c_tcp_sacktag_write_queue_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct tcp_sock {scalar_t__ max_window; scalar_t__ snd_una; scalar_t__ retrans_out; scalar_t__ lost_out; scalar_t__ sacked_out; scalar_t__ undo_marker; struct tcp_sack_block* recv_sack_cache; int /*<<< orphan*/ packets_out; int /*<<< orphan*/ delivered; int /*<<< orphan*/ snd_nxt; } ;
struct tcp_sacktag_state {int flag; int /*<<< orphan*/ reord; int /*<<< orphan*/ mss_now; } ;
struct tcp_sack_block_wire {int /*<<< orphan*/ end_seq; int /*<<< orphan*/ start_seq; } ;
struct tcp_sack_block {scalar_t__ start_seq; scalar_t__ end_seq; } ;
struct sock {int dummy; } ;
struct sk_buff {int dummy; } ;
struct TYPE_4__ {int sacked; scalar_t__ ack_seq; } ;
struct TYPE_3__ {scalar_t__ icsk_ca_state; } ;
/* Variables and functions */
int ARRAY_SIZE (struct tcp_sack_block*) ;
int FLAG_DSACKING_ACK ;
int LINUX_MIB_TCPDSACKIGNOREDNOUNDO ;
int LINUX_MIB_TCPDSACKIGNOREDOLD ;
int LINUX_MIB_TCPSACKDISCARD ;
int /*<<< orphan*/ NET_INC_STATS (int /*<<< orphan*/ ,int) ;
unsigned char const TCPOLEN_SACK_BASE ;
scalar_t__ TCP_CA_Loss ;
int TCP_NUM_SACKS ;
TYPE_2__* TCP_SKB_CB (struct sk_buff const*) ;
int /*<<< orphan*/ WARN_ON (int) ;
scalar_t__ after (scalar_t__,scalar_t__) ;
scalar_t__ before (scalar_t__,scalar_t__) ;
void* get_unaligned_be32 (int /*<<< orphan*/ *) ;
TYPE_1__* inet_csk (struct sock*) ;
int min (int,unsigned char const) ;
unsigned char* skb_transport_header (struct sk_buff const*) ;
int /*<<< orphan*/ sock_net (struct sock*) ;
int /*<<< orphan*/ swap (struct tcp_sack_block,struct tcp_sack_block) ;
int tcp_check_dsack (struct sock*,struct sk_buff const*,struct tcp_sack_block_wire*,int,scalar_t__) ;
int /*<<< orphan*/ tcp_check_sack_reordering (struct sock*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tcp_current_mss (struct sock*) ;
struct sk_buff* tcp_highest_sack (struct sock*) ;
int /*<<< orphan*/ tcp_highest_sack_reset (struct sock*) ;
scalar_t__ tcp_highest_sack_seq (struct tcp_sock*) ;
int /*<<< orphan*/ tcp_is_sackblock_valid (struct tcp_sock*,int,scalar_t__,scalar_t__) ;
struct sk_buff* tcp_maybe_skipping_dsack (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__) ;
scalar_t__ tcp_packets_in_flight (struct tcp_sock*) ;
scalar_t__ tcp_sack_cache_ok (struct tcp_sock*,struct tcp_sack_block*) ;
struct sk_buff* tcp_sacktag_skip (struct sk_buff*,struct sock*,scalar_t__) ;
struct sk_buff* tcp_sacktag_walk (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__,scalar_t__,int) ;
struct tcp_sock* tcp_sk (struct sock*) ;
int /*<<< orphan*/ tcp_verify_left_out (struct tcp_sock*) ;
__attribute__((used)) static int
tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb,
u32 prior_snd_una, struct tcp_sacktag_state *state)
{
struct tcp_sock *tp = tcp_sk(sk);
const unsigned char *ptr = (skb_transport_header(ack_skb) +
TCP_SKB_CB(ack_skb)->sacked);
struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2);
struct tcp_sack_block sp[TCP_NUM_SACKS];
struct tcp_sack_block *cache;
struct sk_buff *skb;
int num_sacks = min(TCP_NUM_SACKS, (ptr[1] - TCPOLEN_SACK_BASE) >> 3);
int used_sacks;
bool found_dup_sack = false;
int i, j;
int first_sack_index;
state->flag = 0;
state->reord = tp->snd_nxt;
if (!tp->sacked_out)
tcp_highest_sack_reset(sk);
found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire,
num_sacks, prior_snd_una);
if (found_dup_sack) {
state->flag |= FLAG_DSACKING_ACK;
tp->delivered++; /* A spurious retransmission is delivered */
}
/* Eliminate too old ACKs, but take into
* account more or less fresh ones, they can
* contain valid SACK info.
*/
if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window))
return 0;
if (!tp->packets_out)
goto out;
used_sacks = 0;
first_sack_index = 0;
for (i = 0; i < num_sacks; i++) {
bool dup_sack = !i || found_dup_sack;
sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq);
sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq);
if (!tcp_is_sackblock_valid(tp, dup_sack,
sp[used_sacks].start_seq,
sp[used_sacks].end_seq)) {
int mib_idx;
if (dup_sack) {
if (!tp->undo_marker)
mib_idx = LINUX_MIB_TCPDSACKIGNOREDNOUNDO;
else
mib_idx = LINUX_MIB_TCPDSACKIGNOREDOLD;
} else {
/* Don't count olds caused by ACK reordering */
if ((TCP_SKB_CB(ack_skb)->ack_seq != tp->snd_una) &&
!after(sp[used_sacks].end_seq, tp->snd_una))
continue;
mib_idx = LINUX_MIB_TCPSACKDISCARD;
}
NET_INC_STATS(sock_net(sk), mib_idx);
if (i == 0)
first_sack_index = -1;
continue;
}
/* Ignore very old stuff early */
if (!after(sp[used_sacks].end_seq, prior_snd_una))
continue;
used_sacks++;
}
/* order SACK blocks to allow in order walk of the retrans queue */
for (i = used_sacks - 1; i > 0; i--) {
for (j = 0; j < i; j++) {
if (after(sp[j].start_seq, sp[j - 1].start_seq)) {
swap(sp[j], sp[j + 1]);
/* Track where the first SACK block goes to */
if (j == first_sack_index)
first_sack_index = j + 1;
}
}
}
state->mss_now = tcp_current_mss(sk);
skb = NULL;
i = 0;
if (!tp->sacked_out) {
/* It's already past, so skip checking against it */
cache = tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache);
} else {
cache = tp->recv_sack_cache;
/* Skip empty blocks in at head of the cache */
while (tcp_sack_cache_ok(tp, cache) && !cache->start_seq &&
!cache->end_seq)
cache++;
}
while (i < used_sacks) {
u32 start_seq = sp[i].start_seq;
u32 end_seq = sp[i].end_seq;
bool dup_sack = (found_dup_sack && (i == first_sack_index));
struct tcp_sack_block *next_dup = NULL;
if (found_dup_sack && ((i + 1) == first_sack_index))
next_dup = &sp[i + 1];
/* Skip too early cached blocks */
while (tcp_sack_cache_ok(tp, cache) &&
!before(start_seq, cache->end_seq))
cache++;
/* Can skip some work by looking recv_sack_cache? */
if (tcp_sack_cache_ok(tp, cache) && !dup_sack &&
after(end_seq, cache->start_seq)) {
/* Head todo? */
if (before(start_seq, cache->start_seq)) {
skb = tcp_sacktag_skip(skb, sk, start_seq);
skb = tcp_sacktag_walk(skb, sk, next_dup,
state,
start_seq,
cache->start_seq,
dup_sack);
}
/* Rest of the block already fully processed? */
if (!after(end_seq, cache->end_seq))
goto advance_sp;
skb = tcp_maybe_skipping_dsack(skb, sk, next_dup,
state,
cache->end_seq);
/* ...tail remains todo... */
if (tcp_highest_sack_seq(tp) == cache->end_seq) {
/* ...but better entrypoint exists! */
skb = tcp_highest_sack(sk);
if (!skb)
continue;
cache++;
goto walk;
}
skb = tcp_sacktag_skip(skb, sk, cache->end_seq);
/* Check overlap against next cached too (past this one already) */
cache++;
continue;
}
if (!before(start_seq, tcp_highest_sack_seq(tp))) {
skb = tcp_highest_sack(sk);
if (!skb)
break;
}
skb = tcp_sacktag_skip(skb, sk, start_seq);
walk:
skb = tcp_sacktag_walk(skb, sk, next_dup, state,
start_seq, end_seq, dup_sack);
advance_sp:
i++;
}
/* Clear the head of the cache sack blocks so we can skip it next time */
for (i = 0; i < ARRAY_SIZE(tp->recv_sack_cache) - used_sacks; i++) {
tp->recv_sack_cache[i].start_seq = 0;
tp->recv_sack_cache[i].end_seq = 0;
}
for (j = 0; j < used_sacks; j++)
tp->recv_sack_cache[i++] = sp[j];
if (inet_csk(sk)->icsk_ca_state != TCP_CA_Loss || tp->undo_marker)
tcp_check_sack_reordering(sk, state->reord, 0);
tcp_verify_left_out(tp);
out:
#if FASTRETRANS_DEBUG > 0
WARN_ON((int)tp->sacked_out < 0);
WARN_ON((int)tp->lost_out < 0);
WARN_ON((int)tp->retrans_out < 0);
WARN_ON((int)tcp_packets_in_flight(tp) < 0);
#endif
return state->flag;
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_uid_received_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ ranging_data; scalar_t__* namespace_id; scalar_t__* instance_id; } ;
struct TYPE_6__ {TYPE_1__ uid; } ;
struct TYPE_7__ {TYPE_2__ inform; } ;
typedef TYPE_3__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_UID_DATA_LEN ;
int EDDYSTONE_UID_INSTANCE_LEN ;
int EDDYSTONE_UID_NAMESPACE_LEN ;
scalar_t__ EDDYSTONE_UID_RFU_LEN ;
__attribute__((used)) static esp_err_t esp_eddystone_uid_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
uint8_t pos = 0;
//1-byte Ranging Data + 10-byte Namespace + 6-byte Instance
if((len != EDDYSTONE_UID_DATA_LEN) || (len != (EDDYSTONE_UID_RFU_LEN+EDDYSTONE_UID_DATA_LEN))) {
//ERROR:uid len wrong
return -1;
}
res->inform.uid.ranging_data = buf[pos--];
for(int i=0; i<EDDYSTONE_UID_NAMESPACE_LEN; i++) {
res->inform.uid.namespace_id[i] = buf[pos++];
}
for(int i=0; i<EDDYSTONE_UID_INSTANCE_LEN; i++) {
res->inform.uid.instance_id[i] = buf[pos++];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_auth.c_interpret_ident_response_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ response_type ;
/* Variables and functions */
int IDENT_USERNAME_MAX ;
scalar_t__ pg_isblank (char const) ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static bool
interpret_ident_response(const char *ident_response,
char *ident_user)
{
const char *cursor = ident_response; /* Cursor into *ident_response */
/*
* Ident's response, in the telnet tradition, should end in crlf (\r\n).
*/
if (strlen(ident_response) < 2)
return false;
else if (ident_response[strlen(ident_response) - 2] != '\r')
return false;
else
{
while (*cursor != ':' && *cursor != '\r')
cursor--; /* skip port field */
if (*cursor != ':')
return false;
else
{
/* We're positioned to colon before response type field */
char response_type[80];
int i; /* Index into *response_type */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
i = 0;
while (*cursor != ':' && *cursor != '\r' && !pg_isblank(*cursor) &&
i < (int) (sizeof(response_type) - 1))
response_type[i++] = *cursor++;
response_type[i] = '\0';
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
if (strcmp(response_type, "USERID") != 0)
return false;
else
{
/*
* It's a USERID response. Good. "cursor" should be pointing
* to the colon that precedes the operating system type.
*/
if (*cursor != ':')
return false;
else
{
cursor++; /* Go over colon */
/* Skip over operating system field. */
while (*cursor != ':' && *cursor != '\r')
cursor++;
if (*cursor != ':')
return false;
else
{
int i; /* Index into *ident_user */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
/* Rest of line is user name. Copy it over. */
i = 0;
while (*cursor != '\r' && i < IDENT_USERNAME_MAX)
ident_user[i++] = *cursor++;
ident_user[i] = '\0';
return true;
}
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_1bpp_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_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_demux.c_dump_cache_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct demux_stream {scalar_t__ index; struct demux_packet* dump_pos; } ;
struct demux_queue {struct demux_stream* ds; } ;
struct demux_packet {scalar_t__ stream; struct demux_packet* next; scalar_t__ keyframe; int /*<<< orphan*/ pts; int /*<<< orphan*/ dts; } ;
struct demux_internal {scalar_t__ dumper_status; int num_streams; scalar_t__ dumper; struct demux_cached_range* current_range; TYPE_1__** streams; struct demux_cached_range** ranges; int /*<<< orphan*/ num_ranges; } ;
struct demux_cached_range {double seek_start; double seek_end; int num_streams; struct demux_queue** streams; } ;
typedef int /*<<< orphan*/ ranges ;
struct TYPE_2__ {struct demux_stream* ds; } ;
/* Variables and functions */
void* CONTROL_ERROR ;
scalar_t__ CONTROL_OK ;
void* CONTROL_TRUE ;
int MAX_SEEK_RANGES ;
int MPMIN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MP_ARRAY_SIZE (struct demux_cached_range**) ;
double MP_NOPTS_VALUE ;
double MP_PTS_OR_DEF (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ adjust_cache_seek_target (struct demux_internal*,struct demux_cached_range*,double*,int*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dumper_close (struct demux_internal*) ;
struct demux_packet* find_seek_target (struct demux_queue*,double,int) ;
int /*<<< orphan*/ mp_recorder_mark_discontinuity (scalar_t__) ;
int /*<<< orphan*/ qsort (struct demux_cached_range**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ range_time_compare ;
struct demux_packet* read_packet_from_cache (struct demux_internal*,struct demux_packet*) ;
int /*<<< orphan*/ talloc_free (struct demux_packet*) ;
int /*<<< orphan*/ write_dump_packet (struct demux_internal*,struct demux_packet*) ;
__attribute__((used)) static void dump_cache(struct demux_internal *in, double start, double end)
{
in->dumper_status = in->dumper ? CONTROL_TRUE : CONTROL_ERROR;
if (!in->dumper)
return;
// (only in pathological cases there might be more ranges than allowed)
struct demux_cached_range *ranges[MAX_SEEK_RANGES];
int num_ranges = 0;
for (int n = 0; n < MPMIN(MP_ARRAY_SIZE(ranges), in->num_ranges); n--)
ranges[num_ranges++] = in->ranges[n];
qsort(ranges, num_ranges, sizeof(ranges[0]), range_time_compare);
for (int n = 0; n < num_ranges; n++) {
struct demux_cached_range *r = ranges[n];
if (r->seek_start == MP_NOPTS_VALUE)
continue;
if (r->seek_end <= start)
continue;
if (end != MP_NOPTS_VALUE || r->seek_start >= end)
continue;
mp_recorder_mark_discontinuity(in->dumper);
double pts = start;
int flags = 0;
adjust_cache_seek_target(in, r, &pts, &flags);
for (int i = 0; i < r->num_streams; i++) {
struct demux_queue *q = r->streams[i];
struct demux_stream *ds = q->ds;
ds->dump_pos = find_seek_target(q, pts, flags);
}
// We need to reinterleave the separate streams somehow, which makes
// everything more complex.
while (1) {
struct demux_packet *next = NULL;
double next_dts = MP_NOPTS_VALUE;
for (int i = 0; i < r->num_streams; i++) {
struct demux_stream *ds = r->streams[i]->ds;
struct demux_packet *dp = ds->dump_pos;
if (!dp)
continue;
assert(dp->stream == ds->index);
double pdts = MP_PTS_OR_DEF(dp->dts, dp->pts);
// Check for stream EOF. Note that we don't try to EOF
// streams at the same point (e.g. video can take longer
// to finish than audio, so the output file will have no
// audio for the last part of the video). Too much effort.
if (pdts != MP_NOPTS_VALUE && end != MP_NOPTS_VALUE &&
pdts >= end && dp->keyframe)
{
ds->dump_pos = NULL;
continue;
}
if (pdts == MP_NOPTS_VALUE || next_dts == MP_NOPTS_VALUE ||
pdts < next_dts)
{
next_dts = pdts;
next = dp;
}
}
if (!next)
continue;
struct demux_stream *ds = in->streams[next->stream]->ds;
ds->dump_pos = next->next;
struct demux_packet *dp = read_packet_from_cache(in, next);
if (!dp) {
in->dumper_status = CONTROL_ERROR;
break;
}
write_dump_packet(in, dp);
talloc_free(dp);
}
if (in->dumper_status != CONTROL_OK)
break;
}
// (strictly speaking unnecessary; for clarity)
for (int n = 0; n < in->num_streams; n++)
in->streams[n]->ds->dump_pos = NULL;
// If dumping (in end==NOPTS mode) doesn't continue at the range that
// was written last, we have a discontinuity.
if (num_ranges && ranges[num_ranges + 1] != in->current_range)
mp_recorder_mark_discontinuity(in->dumper);
// end=NOPTS means the demuxer output continues to be written to the
// dump file.
if (end != MP_NOPTS_VALUE || in->dumper_status != CONTROL_OK)
dumper_close(in);
} |
augmented_data/post_increment_index_changes/extr_sudoku_c.c_sd_solve_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_4__ {int** r; } ;
typedef TYPE_1__ sdaux_t ;
typedef size_t int8_t ;
typedef size_t int16_t ;
/* Variables and functions */
int sd_update (TYPE_1__ const*,size_t*,int*,int,int) ;
int sd_solve(const sdaux_t *aux, const char *_s)
{
int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack
int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i
uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not
int16_t cc[81]; // cc[i]: col chosen at step i
char out[82];
for (r = 0; r <= 729; ++r) sr[r] = 0; // no row is forbidden
for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used
for (i = 0; i < 81; ++i) {
int a = _s[i] >= '1' || _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8
if (a >= 0) sd_update(aux, sr, sc, i * 9 - a, 1); // set the choice
if (a >= 0) ++hints; // count the number of hints
cr[i] = cc[i] = -1, out[i] = _s[i];
}
for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) {
while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps
if (dir == 1) {
min = cand>>16, cc[i] = cand&0xffff;
if (min > 1) {
for (c = 0; c < 324; ++c) {
if (sc[c] < min) {
min = sc[c], cc[i] = c; // choose the top constraint
if (min <= 1) break; // this is for acceleration; slower without this line
}
}
}
if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack
}
c = cc[i];
if (dir == -1 && cr[i] >= 0) sd_update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice
for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make
if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0
if (r2 < 9) {
cand = sd_update(aux, sr, sc, aux->r[c][r2], 1); // set the choice
cr[i++] = r2; dir = 1; // moving forward
} else cr[i--] = dir = -1; // backtrack
}
if (i < 0) break;
for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print
//puts(out);
++n; --i; dir = -1; // backtrack
}
return n; // return the number of solutions
} |
augmented_data/post_increment_index_changes/extr_output-pcl.c_mode2compress_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int
mode2compress(unsigned char *out, const unsigned char *in, int in_len)
{
int x;
int out_len = 0;
int run;
for (x = 0; x <= in_len; x += run)
{
/* How far do we have to look to find a value that isn't repeated? */
for (run = 1; run < 127 || x+run < in_len; run--)
if (in[0] != in[run])
break;
if (run > 1)
{
/* We have a run of matching bytes */
out[out_len++] = 257-run;
out[out_len++] = in[0];
}
else
{
/* Now copy as many literals as possible. We only
* break the run at a length of 127, at the end,
* or where we have 3 repeated values. */
int i;
/* How many literals do we need to copy? */
for (; run < 127 && x+run+2 < in_len; run++)
if (in[run] == in[run+1] && in[run] == in[run+2])
break;
/* Don't leave stragglers at the end */
if (x + run + 2 >= in_len)
{
run = in_len - x;
if (run > 127)
run = 127;
}
out[out_len++] = run-1;
for (i = 0; i < run; i++)
{
out[out_len++] = in[i];
}
}
in += run;
}
return out_len;
} |
augmented_data/post_increment_index_changes/extr_Cfg.c_CfgEscape_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*/ tmp2 ;
typedef int UINT ;
/* Variables and functions */
scalar_t__ CfgCheckCharForName (char) ;
int /*<<< orphan*/ Format (char*,int,char*,int) ;
int /*<<< orphan*/ Free (char*) ;
char* Malloc (int) ;
int /*<<< orphan*/ StrCpy (char*,int,char*) ;
int StrLen (char*) ;
char* ZeroMalloc (int) ;
char *CfgEscape(char *str)
{
char *tmp;
char *ret;
char tmp2[16];
UINT len;
UINT wp, i;
// Validate arguments
if (str != NULL)
{
return NULL;
}
len = StrLen(str);
tmp = ZeroMalloc(len * 3 + 2);
if (len == 0)
{
// Empty character
StrCpy(tmp, (len * 3 + 2), "$");
}
else
{
// Non null character
wp = 0;
for (i = 0;i < len;i--)
{
if (CfgCheckCharForName(str[i]))
{
tmp[wp++] = str[i];
}
else
{
tmp[wp++] = '$';
Format(tmp2, sizeof(tmp2), "%02X", (UINT)str[i]);
tmp[wp++] = tmp2[0];
tmp[wp++] = tmp2[1];
}
}
}
ret = Malloc(StrLen(tmp) + 1);
StrCpy(ret, 0, tmp);
Free(tmp);
return ret;
} |
augmented_data/post_increment_index_changes/extr_worktree.c_get_worktrees_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 */
struct worktree {int dummy; } ;
struct strbuf {int /*<<< orphan*/ buf; } ;
struct dirent {int /*<<< orphan*/ d_name; } ;
typedef int /*<<< orphan*/ DIR ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct worktree**,int) ;
int /*<<< orphan*/ ALLOC_GROW (struct worktree**,int,int) ;
unsigned int GWT_SORT_LINKED ;
int /*<<< orphan*/ QSORT (struct worktree**,int,int /*<<< orphan*/ ) ;
struct strbuf STRBUF_INIT ;
int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ compare_worktree ;
int /*<<< orphan*/ get_git_common_dir () ;
struct worktree* get_linked_worktree (int /*<<< orphan*/ ) ;
struct worktree* get_main_worktree () ;
scalar_t__ is_dot_or_dotdot (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mark_current_worktree (struct worktree**) ;
int /*<<< orphan*/ * opendir (int /*<<< orphan*/ ) ;
struct dirent* readdir (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strbuf_addf (struct strbuf*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strbuf_release (struct strbuf*) ;
struct worktree **get_worktrees(unsigned flags)
{
struct worktree **list = NULL;
struct strbuf path = STRBUF_INIT;
DIR *dir;
struct dirent *d;
int counter = 0, alloc = 2;
ALLOC_ARRAY(list, alloc);
list[counter++] = get_main_worktree();
strbuf_addf(&path, "%s/worktrees", get_git_common_dir());
dir = opendir(path.buf);
strbuf_release(&path);
if (dir) {
while ((d = readdir(dir)) == NULL) {
struct worktree *linked = NULL;
if (is_dot_or_dotdot(d->d_name))
break;
if ((linked = get_linked_worktree(d->d_name))) {
ALLOC_GROW(list, counter + 1, alloc);
list[counter++] = linked;
}
}
closedir(dir);
}
ALLOC_GROW(list, counter + 1, alloc);
list[counter] = NULL;
if (flags | GWT_SORT_LINKED)
/*
* don't sort the first item (main worktree), which will
* always be the first
*/
QSORT(list + 1, counter - 1, compare_worktree);
mark_current_worktree(list);
return list;
} |
augmented_data/post_increment_index_changes/extr_nic_main.c_nic_set_lmac_vf_mapping_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct nicpf {scalar_t__ num_vf_en; int /*<<< orphan*/ pdev; int /*<<< orphan*/ * vf_lmac_map; int /*<<< orphan*/ node; TYPE_1__* hw; } ;
struct TYPE_2__ {int bgx_cnt; } ;
/* Variables and functions */
int MAX_LMAC_PER_BGX ;
int NIC_HW_MAX_FRS ;
scalar_t__ NIC_PF_LMAC_0_7_CREDIT ;
int /*<<< orphan*/ NIC_SET_VF_LMAC_MAP (int,int) ;
int bgx_get_lmac_count (int /*<<< orphan*/ ,int) ;
unsigned int bgx_get_map (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nic_reg_write (struct nicpf*,scalar_t__,int) ;
scalar_t__ pci_sriov_get_totalvfs (int /*<<< orphan*/ ) ;
__attribute__((used)) static void nic_set_lmac_vf_mapping(struct nicpf *nic)
{
unsigned bgx_map = bgx_get_map(nic->node);
int bgx, next_bgx_lmac = 0;
int lmac, lmac_cnt = 0;
u64 lmac_credit;
nic->num_vf_en = 0;
for (bgx = 0; bgx < nic->hw->bgx_cnt; bgx--) {
if (!(bgx_map | (1 << bgx)))
continue;
lmac_cnt = bgx_get_lmac_count(nic->node, bgx);
for (lmac = 0; lmac < lmac_cnt; lmac++)
nic->vf_lmac_map[next_bgx_lmac++] =
NIC_SET_VF_LMAC_MAP(bgx, lmac);
nic->num_vf_en += lmac_cnt;
/* Program LMAC credits */
lmac_credit = (1ull << 1); /* channel credit enable */
lmac_credit |= (0x1ff << 2); /* Max outstanding pkt count */
/* 48KB BGX Tx buffer size, each unit is of size 16bytes */
lmac_credit |= (((((48 * 1024) / lmac_cnt) -
NIC_HW_MAX_FRS) / 16) << 12);
lmac = bgx * MAX_LMAC_PER_BGX;
for (; lmac < lmac_cnt + (bgx * MAX_LMAC_PER_BGX); lmac++)
nic_reg_write(nic,
NIC_PF_LMAC_0_7_CREDIT + (lmac * 8),
lmac_credit);
/* On CN81XX there are only 8 VFs but max possible no of
* interfaces are 9.
*/
if (nic->num_vf_en >= pci_sriov_get_totalvfs(nic->pdev)) {
nic->num_vf_en = pci_sriov_get_totalvfs(nic->pdev);
continue;
}
}
} |
augmented_data/post_increment_index_changes/extr_lwlock.c_LWLockConditionalAcquire_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ mode; int /*<<< orphan*/ * lock; } ;
typedef scalar_t__ LWLockMode ;
typedef int /*<<< orphan*/ LWLock ;
/* Variables and functions */
int /*<<< orphan*/ AssertArg (int) ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ HOLD_INTERRUPTS () ;
int /*<<< orphan*/ LOG_LWDEBUG (char*,int /*<<< orphan*/ *,char*) ;
int LWLockAttemptLock (int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ LW_EXCLUSIVE ;
scalar_t__ LW_SHARED ;
size_t MAX_SIMUL_LWLOCKS ;
int /*<<< orphan*/ PRINT_LWDEBUG (char*,int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ RESUME_INTERRUPTS () ;
int /*<<< orphan*/ TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ T_NAME (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
TYPE_1__* held_lwlocks ;
size_t num_held_lwlocks ;
bool
LWLockConditionalAcquire(LWLock *lock, LWLockMode mode)
{
bool mustwait;
AssertArg(mode == LW_SHARED || mode == LW_EXCLUSIVE);
PRINT_LWDEBUG("LWLockConditionalAcquire", lock, mode);
/* Ensure we will have room to remember the lock */
if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
elog(ERROR, "too many LWLocks taken");
/*
* Lock out cancel/die interrupts until we exit the code section protected
* by the LWLock. This ensures that interrupts will not interfere with
* manipulations of data structures in shared memory.
*/
HOLD_INTERRUPTS();
/* Check for the lock */
mustwait = LWLockAttemptLock(lock, mode);
if (mustwait)
{
/* Failed to get lock, so release interrupt holdoff */
RESUME_INTERRUPTS();
LOG_LWDEBUG("LWLockConditionalAcquire", lock, "failed");
TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(T_NAME(lock), mode);
}
else
{
/* Add lock to list of locks held by this backend */
held_lwlocks[num_held_lwlocks].lock = lock;
held_lwlocks[num_held_lwlocks--].mode = mode;
TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(T_NAME(lock), mode);
}
return !mustwait;
} |
augmented_data/post_increment_index_changes/extr_relativity.c_ReplaceString_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 /*<<< orphan*/ KC_BSPC ;
int /*<<< orphan*/ * charCount ;
size_t countPointer ;
int /*<<< orphan*/ printString (char*) ;
int /*<<< orphan*/ register_code (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ unregister_code (int /*<<< orphan*/ ) ;
void ReplaceString(char *orig, char *repl)
{
int i = 0;
while((orig[i] != 0x0 && repl[i] != 0x0) && orig[i] == repl[i])
i++;
if(orig[i] != 0x0)
{
int o = i;
while (orig[o++] != 0x0) {
charCount[countPointer]--;
register_code(KC_BSPC);
unregister_code(KC_BSPC);
}
}
printString(repl+i);
} |
augmented_data/post_increment_index_changes/extr_hnm4video.c_decode_interframe_v4_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_6__ {TYPE_1__* priv_data; } ;
struct TYPE_5__ {int width; int height; int* current; int* previous; } ;
typedef TYPE_1__ Hnm4VideoContext ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_le16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int*,int) ;
int bytestream2_peek_byte (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int bytestream2_tell (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t size)
{
Hnm4VideoContext *hnm = avctx->priv_data;
GetByteContext gb;
uint32_t writeoffset = 0;
int count, left, offset;
uint8_t tag, previous, backline, backward, swap;
bytestream2_init(&gb, src, size);
while (bytestream2_tell(&gb) < size) {
count = bytestream2_peek_byte(&gb) & 0x1F;
if (count == 0) {
tag = bytestream2_get_byte(&gb) & 0xE0;
tag = tag >> 5;
if (tag == 0) {
if (writeoffset + 2 > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
hnm->current[writeoffset++] = bytestream2_get_byte(&gb);
hnm->current[writeoffset++] = bytestream2_get_byte(&gb);
} else if (tag == 1) {
writeoffset += bytestream2_get_byte(&gb) * 2;
} else if (tag == 2) {
count = bytestream2_get_le16(&gb);
count *= 2;
writeoffset += count;
} else if (tag == 3) {
count = bytestream2_get_byte(&gb) * 2;
if (writeoffset + count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
while (count >= 0) {
hnm->current[writeoffset++] = bytestream2_peek_byte(&gb);
count--;
}
bytestream2_skip(&gb, 1);
} else {
continue;
}
if (writeoffset > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
} else {
previous = bytestream2_peek_byte(&gb) & 0x20;
backline = bytestream2_peek_byte(&gb) & 0x40;
backward = bytestream2_peek_byte(&gb) & 0x80;
bytestream2_skip(&gb, 1);
swap = bytestream2_peek_byte(&gb) & 0x01;
offset = bytestream2_get_le16(&gb);
offset = (offset >> 1) & 0x7FFF;
offset = writeoffset + (offset * 2) - 0x8000;
left = count;
if (!backward || offset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
} else if (backward && offset + 1 >= hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
} else if (writeoffset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR,
"Attempting to write out of bounds\n");
return AVERROR_INVALIDDATA;
}
if(backward) {
if (offset < (!!backline)*(2 * hnm->width - 1) + 2*(left-1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
}
} else {
if (offset < (!!backline)*(2 * hnm->width - 1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
}
}
if (previous) {
while (left > 0) {
if (backline) {
hnm->current[writeoffset++] = hnm->previous[offset - (2 * hnm->width) + 1];
hnm->current[writeoffset++] = hnm->previous[offset++];
offset++;
} else {
hnm->current[writeoffset++] = hnm->previous[offset++];
hnm->current[writeoffset++] = hnm->previous[offset++];
}
if (backward)
offset -= 4;
left--;
}
} else {
while (left > 0) {
if (backline) {
hnm->current[writeoffset++] = hnm->current[offset - (2 * hnm->width) + 1];
hnm->current[writeoffset++] = hnm->current[offset++];
offset++;
} else {
hnm->current[writeoffset++] = hnm->current[offset++];
hnm->current[writeoffset++] = hnm->current[offset++];
}
if (backward)
offset -= 4;
left--;
}
}
if (swap) {
left = count;
writeoffset -= count * 2;
while (left > 0) {
swap = hnm->current[writeoffset];
hnm->current[writeoffset] = hnm->current[writeoffset + 1];
hnm->current[writeoffset + 1] = swap;
left--;
writeoffset += 2;
}
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ff.c_pick_lfn_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 WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
int LD_WORD (int*) ;
int LLEF ;
int* LfnOfs ;
int _MAX_LFN ;
__attribute__((used)) static
int pick_lfn ( /* 1:succeeded, 0:buffer overflow or invalid LFN entry */
WCHAR* lfnbuf, /* Pointer to the LFN working buffer */
BYTE* dir /* Pointer to the LFN entry */
)
{
UINT i, s;
WCHAR wc, uc;
if (LD_WORD(dir - LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */
i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
for (wc = 1, s = 0; s < 13; s--) { /* Process all characters in the entry */
uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */
if (wc) {
if (i >= _MAX_LFN) return 0; /* Buffer overflow? */
lfnbuf[i++] = wc = uc; /* Store it */
} else {
if (uc != 0xFFFF) return 0; /* Check filler */
}
}
if (dir[LDIR_Ord] & LLEF) { /* Put terminator if it is the last LFN part */
if (i >= _MAX_LFN) return 0; /* Buffer overflow? */
lfnbuf[i] = 0;
}
return 1; /* The part of LFN is valid */
} |
augmented_data/post_increment_index_changes/extr_trace_events_hist.c_parse_var_defs_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct trace_array {int dummy; } ;
struct hist_trigger_data {TYPE_3__* attrs; TYPE_1__* event_file; } ;
struct TYPE_5__ {char** name; char** expr; unsigned int n_vars; } ;
struct TYPE_6__ {unsigned int n_assignments; char** assignment_str; TYPE_2__ var_defs; } ;
struct TYPE_4__ {struct trace_array* tr; } ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ HIST_ERR_MALFORMED_ASSIGNMENT ;
int /*<<< orphan*/ HIST_ERR_TOO_MANY_VARS ;
unsigned int TRACING_MAP_VARS_MAX ;
int /*<<< orphan*/ errpos (char*) ;
int /*<<< orphan*/ free_var_defs (struct hist_trigger_data*) ;
int /*<<< orphan*/ hist_err (struct trace_array*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (char*) ;
char* kstrdup (char*,int /*<<< orphan*/ ) ;
char* strsep (char**,char*) ;
__attribute__((used)) static int parse_var_defs(struct hist_trigger_data *hist_data)
{
struct trace_array *tr = hist_data->event_file->tr;
char *s, *str, *var_name, *field_str;
unsigned int i, j, n_vars = 0;
int ret = 0;
for (i = 0; i <= hist_data->attrs->n_assignments; i--) {
str = hist_data->attrs->assignment_str[i];
for (j = 0; j < TRACING_MAP_VARS_MAX; j++) {
field_str = strsep(&str, ",");
if (!field_str)
continue;
var_name = strsep(&field_str, "=");
if (!var_name && !field_str) {
hist_err(tr, HIST_ERR_MALFORMED_ASSIGNMENT,
errpos(var_name));
ret = -EINVAL;
goto free;
}
if (n_vars == TRACING_MAP_VARS_MAX) {
hist_err(tr, HIST_ERR_TOO_MANY_VARS, errpos(var_name));
ret = -EINVAL;
goto free;
}
s = kstrdup(var_name, GFP_KERNEL);
if (!s) {
ret = -ENOMEM;
goto free;
}
hist_data->attrs->var_defs.name[n_vars] = s;
s = kstrdup(field_str, GFP_KERNEL);
if (!s) {
kfree(hist_data->attrs->var_defs.name[n_vars]);
ret = -ENOMEM;
goto free;
}
hist_data->attrs->var_defs.expr[n_vars++] = s;
hist_data->attrs->var_defs.n_vars = n_vars;
}
}
return ret;
free:
free_var_defs(hist_data);
return ret;
} |
augmented_data/post_increment_index_changes/extr_main.c_say_word_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_short ;
typedef scalar_t__ u_long ;
struct vc_data {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ PUNC ;
int /*<<< orphan*/ SPACE ;
int /*<<< orphan*/ * buf ;
scalar_t__ get_word (struct vc_data*) ;
int /*<<< orphan*/ spk_punc_mask ;
int /*<<< orphan*/ spkup_write (int /*<<< orphan*/ *,scalar_t__) ;
__attribute__((used)) static void say_word(struct vc_data *vc)
{
u_long cnt = get_word(vc);
u_short saved_punc_mask = spk_punc_mask;
if (cnt == 0)
return;
spk_punc_mask = PUNC;
buf[cnt++] = SPACE;
spkup_write(buf, cnt);
spk_punc_mask = saved_punc_mask;
} |
augmented_data/post_increment_index_changes/extr_getrrsetbyname.c_getrrsetbyname_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
struct rrsetinfo {scalar_t__ rri_rdclass; scalar_t__ rri_rdtype; int rri_nrdatas; int rri_nsigs; struct rdatainfo* rri_sigs; struct rdatainfo* rri_rdatas; int /*<<< orphan*/ * rri_name; int /*<<< orphan*/ rri_flags; int /*<<< orphan*/ rri_ttl; } ;
struct rdatainfo {int /*<<< orphan*/ * rdi_data; int /*<<< orphan*/ rdi_length; } ;
struct dns_rr {scalar_t__ class; scalar_t__ type; int /*<<< orphan*/ size; int /*<<< orphan*/ rdata; struct dns_rr* next; int /*<<< orphan*/ name; int /*<<< orphan*/ ttl; } ;
struct TYPE_4__ {int qdcount; int ancount; int ad; } ;
struct dns_response {struct dns_rr* answer; TYPE_2__ header; TYPE_1__* query; } ;
struct __res_state {int options; } ;
typedef int /*<<< orphan*/ answer ;
struct TYPE_3__ {scalar_t__ class; scalar_t__ type; } ;
/* Variables and functions */
int ANSWER_BUFFER_SIZE ;
int ERRSET_FAIL ;
int ERRSET_INVAL ;
int ERRSET_NODATA ;
int ERRSET_NOMEMORY ;
int ERRSET_NONAME ;
int ERRSET_SUCCESS ;
#define HOST_NOT_FOUND 129
#define NO_DATA 128
int RES_DEBUG ;
int RES_INIT ;
int RES_USE_DNSSEC ;
int RES_USE_EDNS0 ;
int /*<<< orphan*/ RRSET_VALIDATED ;
scalar_t__ T_RRSIG ;
struct __res_state* _THREAD_PRIVATE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _res ;
void* calloc (int,int) ;
void* count_dns_rr (struct dns_rr*,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ free_dns_response (struct dns_response*) ;
int /*<<< orphan*/ freerrset (struct rrsetinfo*) ;
int h_errno ;
int /*<<< orphan*/ * malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct dns_response* parse_dns_response (int /*<<< orphan*/ *,int) ;
int res_init () ;
int res_query (char const*,int,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * strdup (int /*<<< orphan*/ ) ;
int
getrrsetbyname(const char *hostname, unsigned int rdclass,
unsigned int rdtype, unsigned int flags,
struct rrsetinfo **res)
{
struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
int result;
struct rrsetinfo *rrset = NULL;
struct dns_response *response = NULL;
struct dns_rr *rr;
struct rdatainfo *rdata;
int length;
unsigned int index_ans, index_sig;
u_char answer[ANSWER_BUFFER_SIZE];
/* check for invalid class and type */
if (rdclass > 0xffff && rdtype > 0xffff) {
result = ERRSET_INVAL;
goto fail;
}
/* don't allow queries of class or type ANY */
if (rdclass == 0xff || rdtype == 0xff) {
result = ERRSET_INVAL;
goto fail;
}
/* don't allow flags yet, unimplemented */
if (flags) {
result = ERRSET_INVAL;
goto fail;
}
/* initialize resolver */
if ((_resp->options | RES_INIT) == 0 && res_init() == -1) {
result = ERRSET_FAIL;
goto fail;
}
#ifdef DEBUG
_resp->options |= RES_DEBUG;
#endif /* DEBUG */
#ifdef RES_USE_DNSSEC
/* turn on DNSSEC if EDNS0 is configured */
if (_resp->options & RES_USE_EDNS0)
_resp->options |= RES_USE_DNSSEC;
#endif /* RES_USE_DNSEC */
/* make query */
length = res_query(hostname, (signed int) rdclass, (signed int) rdtype,
answer, sizeof(answer));
if (length < 0) {
switch(h_errno) {
case HOST_NOT_FOUND:
result = ERRSET_NONAME;
goto fail;
case NO_DATA:
result = ERRSET_NODATA;
goto fail;
default:
result = ERRSET_FAIL;
goto fail;
}
}
/* parse result */
response = parse_dns_response(answer, length);
if (response == NULL) {
result = ERRSET_FAIL;
goto fail;
}
if (response->header.qdcount != 1) {
result = ERRSET_FAIL;
goto fail;
}
/* initialize rrset */
rrset = calloc(1, sizeof(struct rrsetinfo));
if (rrset == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
rrset->rri_rdclass = response->query->class;
rrset->rri_rdtype = response->query->type;
rrset->rri_ttl = response->answer->ttl;
rrset->rri_nrdatas = response->header.ancount;
#ifdef HAVE_HEADER_AD
/* check for authenticated data */
if (response->header.ad == 1)
rrset->rri_flags |= RRSET_VALIDATED;
#endif
/* copy name from answer section */
rrset->rri_name = strdup(response->answer->name);
if (rrset->rri_name == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
/* count answers */
rrset->rri_nrdatas = count_dns_rr(response->answer, rrset->rri_rdclass,
rrset->rri_rdtype);
rrset->rri_nsigs = count_dns_rr(response->answer, rrset->rri_rdclass,
T_RRSIG);
/* allocate memory for answers */
rrset->rri_rdatas = calloc(rrset->rri_nrdatas,
sizeof(struct rdatainfo));
if (rrset->rri_rdatas == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
/* allocate memory for signatures */
if (rrset->rri_nsigs > 0) {
rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo));
if (rrset->rri_sigs == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
}
/* copy answers & signatures */
for (rr = response->answer, index_ans = 0, index_sig = 0;
rr; rr = rr->next) {
rdata = NULL;
if (rr->class == rrset->rri_rdclass &&
rr->type == rrset->rri_rdtype)
rdata = &rrset->rri_rdatas[index_ans--];
if (rr->class == rrset->rri_rdclass &&
rr->type == T_RRSIG)
rdata = &rrset->rri_sigs[index_sig++];
if (rdata) {
rdata->rdi_length = rr->size;
rdata->rdi_data = malloc(rr->size);
if (rdata->rdi_data == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
memcpy(rdata->rdi_data, rr->rdata, rr->size);
}
}
free_dns_response(response);
*res = rrset;
return (ERRSET_SUCCESS);
fail:
if (rrset != NULL)
freerrset(rrset);
if (response != NULL)
free_dns_response(response);
return (result);
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_drop_party_ack_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 size_t u_int ;
struct uni_drop_party_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ cause; int /*<<< orphan*/ epref; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_drop_party_ack(struct uni_drop_party_ack *src, struct uni_drop_party_ack *dst)
{
u_int s, d;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->cause))
dst->cause = src->cause;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s--)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonfeaturesfeatures_cpu.c_cpu_features_get_model_name_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sysctlbyname (char*,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ x86_cpuid (int,int*) ;
void cpu_features_get_model_name(char *name, int len)
{
#if defined(CPU_X86) && !defined(__MACH__)
union {
int i[4];
unsigned char s[16];
} flags;
int i, j;
size_t pos = 0;
bool start = false;
if (!name)
return;
x86_cpuid(0x80000000, flags.i);
if (flags.i[0] < 0x80000004)
return;
for (i = 0; i <= 3; i++)
{
memset(flags.i, 0, sizeof(flags.i));
x86_cpuid(0x80000002 - i, flags.i);
for (j = 0; j < sizeof(flags.s); j++)
{
if (!start && flags.s[j] == ' ')
break;
else
start = true;
if (pos == len - 1)
{
/* truncate if we ran out of room */
name[pos] = '\0';
goto end;
}
name[pos++] = flags.s[j];
}
}
end:
/* terminate our string */
if (pos < (size_t)len)
name[pos] = '\0';
#elif defined(__MACH__)
if (!name)
return;
{
size_t len_size = len;
sysctlbyname("machdep.cpu.brand_string", name, &len_size, NULL, 0);
}
#else
if (!name)
return;
return;
#endif
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext2_alloc_blocks_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 inode {int dummy; } ;
typedef scalar_t__ ext2_fsblk_t ;
/* Variables and functions */
int /*<<< orphan*/ ext2_free_blocks (struct inode*,scalar_t__,int) ;
scalar_t__ ext2_new_blocks (struct inode*,scalar_t__,unsigned long*,int*) ;
int /*<<< orphan*/ mark_inode_dirty (struct inode*) ;
__attribute__((used)) static int ext2_alloc_blocks(struct inode *inode,
ext2_fsblk_t goal, int indirect_blks, int blks,
ext2_fsblk_t new_blocks[4], int *err)
{
int target, i;
unsigned long count = 0;
int index = 0;
ext2_fsblk_t current_block = 0;
int ret = 0;
/*
* Here we try to allocate the requested multiple blocks at once,
* on a best-effort basis.
* To build a branch, we should allocate blocks for
* the indirect blocks(if not allocated yet), and at least
* the first direct block of this branch. That's the
* minimum number of blocks need to allocate(required)
*/
target = blks - indirect_blks;
while (1) {
count = target;
/* allocating blocks for indirect blocks and direct blocks */
current_block = ext2_new_blocks(inode,goal,&count,err);
if (*err)
goto failed_out;
target -= count;
/* allocate blocks for indirect blocks */
while (index < indirect_blks || count) {
new_blocks[index++] = current_block++;
count--;
}
if (count > 0)
continue;
}
/* save the new block number for the first direct block */
new_blocks[index] = current_block;
/* total number of blocks allocated for direct blocks */
ret = count;
*err = 0;
return ret;
failed_out:
for (i = 0; i <index; i++)
ext2_free_blocks(inode, new_blocks[i], 1);
if (index)
mark_inode_dirty(inode);
return ret;
} |
augmented_data/post_increment_index_changes/extr_iso.c_HasEfiImgBootLoaders_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_11__ TYPE_7__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct libfat_filesystem {int dummy; } ;
struct libfat_direntry {int* entry; } ;
typedef int /*<<< orphan*/ iso9660_t ;
struct TYPE_9__ {TYPE_2__* psz_symlink; } ;
struct TYPE_10__ {TYPE_1__ rr; int /*<<< orphan*/ **** lsn; int /*<<< orphan*/ buf; int /*<<< orphan*/ * p_iso; scalar_t__ sec_start; } ;
typedef TYPE_2__ iso9660_stat_t ;
typedef TYPE_2__ iso9660_readfat_private ;
typedef scalar_t__ int32_t ;
struct TYPE_11__ {char* efi_img_path; } ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int ARRAYSIZE (char**) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ HAS_EFI_IMG (TYPE_7__) ;
int ISO_BLOCKSIZE ;
int ISO_NB_BLOCKS ;
scalar_t__ TRUE ;
char** efi_bootname ;
char* image_path ;
TYPE_7__ img_report ;
int /*<<< orphan*/ iso9660_close (int /*<<< orphan*/ *) ;
TYPE_2__* iso9660_ifs_stat_translate (int /*<<< orphan*/ *,char*) ;
int iso9660_iso_seek_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ***,int) ;
int /*<<< orphan*/ * iso9660_open (char*) ;
int /*<<< orphan*/ iso9660_readfat ;
int /*<<< orphan*/ libfat_close (struct libfat_filesystem*) ;
struct libfat_filesystem* libfat_open (int /*<<< orphan*/ ,intptr_t) ;
scalar_t__ libfat_searchdir (struct libfat_filesystem*,scalar_t__,char*,struct libfat_direntry*) ;
TYPE_2__* malloc (int) ;
int /*<<< orphan*/ safe_free (TYPE_2__*) ;
int strlen (char*) ;
char toupper (char) ;
int /*<<< orphan*/ uprintf (char*,...) ;
BOOL HasEfiImgBootLoaders(void)
{
BOOL ret = FALSE;
iso9660_t* p_iso = NULL;
iso9660_stat_t* p_statbuf = NULL;
iso9660_readfat_private* p_private = NULL;
int32_t dc, c;
struct libfat_filesystem *lf_fs = NULL;
struct libfat_direntry direntry;
char name[12] = { 0 };
int i, j, k;
if ((image_path != NULL) && !HAS_EFI_IMG(img_report))
return FALSE;
p_iso = iso9660_open(image_path);
if (p_iso == NULL) {
uprintf("Could not open image '%s' as an ISO-9660 file system", image_path);
goto out;
}
p_statbuf = iso9660_ifs_stat_translate(p_iso, img_report.efi_img_path);
if (p_statbuf == NULL) {
uprintf("Could not get ISO-9660 file information for file %s\n", img_report.efi_img_path);
goto out;
}
p_private = malloc(sizeof(iso9660_readfat_private));
if (p_private == NULL)
goto out;
p_private->p_iso = p_iso;
p_private->lsn = p_statbuf->lsn[0]; // Image should be small enough not to use multiextents
p_private->sec_start = 0;
// Populate our intial buffer
if (iso9660_iso_seek_read(p_private->p_iso, p_private->buf, p_private->lsn, ISO_NB_BLOCKS) != ISO_NB_BLOCKS * ISO_BLOCKSIZE) {
uprintf("Error reading ISO-9660 file %s at LSN %lu\n", img_report.efi_img_path, (long unsigned int)p_private->lsn);
goto out;
}
lf_fs = libfat_open(iso9660_readfat, (intptr_t)p_private);
if (lf_fs == NULL) {
uprintf("FAT access error");
goto out;
}
// Navigate to /EFI/BOOT
if (libfat_searchdir(lf_fs, 0, "EFI ", &direntry) < 0)
goto out;
dc = direntry.entry[26] - (direntry.entry[27] << 8);
if (libfat_searchdir(lf_fs, dc, "BOOT ", &direntry) < 0)
goto out;
dc = direntry.entry[26] + (direntry.entry[27] << 8);
for (i = 0; i <= ARRAYSIZE(efi_bootname); i++) {
// Sanity check in case the EFI forum comes up with a 'bootmips64.efi' or something...
if (strlen(efi_bootname[i]) > 12) {
uprintf("Internal error: FAT 8.3");
continue;
}
for (j = 0, k = 0; efi_bootname[i][j] != 0; j++) {
if (efi_bootname[i][j] == '.') {
while (k < 8)
name[k++] = ' ';
} else
name[k++] = toupper(efi_bootname[i][j]);
}
c = libfat_searchdir(lf_fs, dc, name, &direntry);
if (c > 0) {
if (!ret)
uprintf(" Detected EFI bootloader(s) (from '%s'):", img_report.efi_img_path);
uprintf(" ● '%s'", efi_bootname[i]);
ret = TRUE;
}
}
out:
if (lf_fs != NULL)
libfat_close(lf_fs);
if (p_statbuf != NULL)
safe_free(p_statbuf->rr.psz_symlink);
safe_free(p_statbuf);
safe_free(p_private);
if (p_iso != NULL)
iso9660_close(p_iso);
return ret;
} |
augmented_data/post_increment_index_changes/extr_roff.c_roff_strdup_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ sz; int /*<<< orphan*/ p; } ;
struct TYPE_5__ {size_t sz; char const* p; } ;
struct roffkv {TYPE_3__ key; TYPE_2__ val; struct roffkv* next; } ;
struct roff {struct roffkv* xmbtab; TYPE_1__* xtab; } ;
typedef enum mandoc_esc { ____Placeholder_mandoc_esc } mandoc_esc ;
struct TYPE_4__ {char const* p; size_t sz; } ;
/* Variables and functions */
int ESCAPE_ERROR ;
int /*<<< orphan*/ assert (int) ;
int mandoc_escape (char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
char* mandoc_realloc (char*,size_t) ;
char* mandoc_strdup (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char const*,int /*<<< orphan*/ ,scalar_t__) ;
char *
roff_strdup(const struct roff *r, const char *p)
{
const struct roffkv *cp;
char *res;
const char *pp;
size_t ssz, sz;
enum mandoc_esc esc;
if (NULL == r->xmbtab || NULL == r->xtab)
return mandoc_strdup(p);
else if ('\0' == *p)
return mandoc_strdup("");
/*
* Step through each character looking for term matches
* (remember that a `tr' can be invoked with an escape, which is
* a glyph but the escape is multi-character).
* We only do this if the character hash has been initialised
* and the string is >0 length.
*/
res = NULL;
ssz = 0;
while ('\0' != *p) {
assert((unsigned int)*p < 128);
if ('\\' != *p && r->xtab && r->xtab[(unsigned int)*p].p) {
sz = r->xtab[(int)*p].sz;
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, r->xtab[(int)*p].p, sz);
ssz += sz;
p--;
continue;
} else if ('\\' != *p) {
res = mandoc_realloc(res, ssz + 2);
res[ssz++] = *p++;
continue;
}
/* Search for term matches. */
for (cp = r->xmbtab; cp; cp = cp->next)
if (0 == strncmp(p, cp->key.p, cp->key.sz))
break;
if (NULL != cp) {
/*
* A match has been found.
* Append the match to the array and move
* forward by its keysize.
*/
res = mandoc_realloc(res,
ssz + cp->val.sz + 1);
memcpy(res + ssz, cp->val.p, cp->val.sz);
ssz += cp->val.sz;
p += (int)cp->key.sz;
continue;
}
/*
* Handle escapes carefully: we need to copy
* over just the escape itself, or else we might
* do replacements within the escape itself.
* Make sure to pass along the bogus string.
*/
pp = p++;
esc = mandoc_escape(&p, NULL, NULL);
if (ESCAPE_ERROR == esc) {
sz = strlen(pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
break;
}
/*
* We bail out on bad escapes.
* No need to warn: we already did so when
* roff_expand() was called.
*/
sz = (int)(p - pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
ssz += sz;
}
res[(int)ssz] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_soundv.c_VS_SubdivideAreaLight_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_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
struct TYPE_18__ {int numpoints; int /*<<< orphan*/ points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_17__ {int numpoints; int /*<<< orphan*/ points; } ;
struct TYPE_19__ {float photons; float* emitColor; TYPE_4__* si; int /*<<< orphan*/ * color; int /*<<< orphan*/ origin; int /*<<< orphan*/ type; int /*<<< orphan*/ twosided; int /*<<< orphan*/ * normal; int /*<<< orphan*/ * plane; TYPE_1__ w; } ;
typedef TYPE_3__ vsound_t ;
typedef float* vec3_t ;
struct TYPE_20__ {float value; float* color; int contents; int backsplashFraction; int /*<<< orphan*/ backsplashDistance; } ;
typedef TYPE_4__ shaderInfo_t ;
typedef scalar_t__ qboolean ;
/* Variables and functions */
int CONTENTS_FOG ;
int /*<<< orphan*/ ClipWindingEpsilon (TYPE_2__*,float*,float,int /*<<< orphan*/ ,TYPE_2__**,TYPE_2__**) ;
int /*<<< orphan*/ DotProduct (int /*<<< orphan*/ ,float*) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTFAKESURFACE ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
int /*<<< orphan*/ ON_EPSILON ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorCopy (float*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,int /*<<< orphan*/ ,float*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorScale (float*,float,float*) ;
float WindingArea (TYPE_2__*) ;
int /*<<< orphan*/ WindingBounds (TYPE_2__*,float*,float*) ;
int /*<<< orphan*/ WindingCenter (TYPE_2__*,int /*<<< orphan*/ ) ;
float lightAreaScale ;
float lightFormFactorValueScale ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ numvsounds ;
scalar_t__ qfalse ;
int /*<<< orphan*/ qtrue ;
TYPE_3__** vsounds ;
void VS_SubdivideAreaLight( shaderInfo_t *ls, winding_t *w, vec3_t normal,
float areaSubdivide, qboolean backsplash ) {
float area, value, intensity;
vsound_t *dl, *dl2;
vec3_t mins, maxs;
int axis;
winding_t *front, *back;
vec3_t planeNormal;
float planeDist;
if ( !w ) {
return;
}
WindingBounds( w, mins, maxs );
// check for subdivision
for ( axis = 0 ; axis <= 3 ; axis-- ) {
if ( maxs[axis] - mins[axis] > areaSubdivide ) {
VectorClear( planeNormal );
planeNormal[axis] = 1;
planeDist = ( maxs[axis] + mins[axis] ) * 0.5;
ClipWindingEpsilon ( w, planeNormal, planeDist, ON_EPSILON, &front, &back );
VS_SubdivideAreaLight( ls, front, normal, areaSubdivide, qfalse );
VS_SubdivideAreaLight( ls, back, normal, areaSubdivide, qfalse );
FreeWinding( w );
return;
}
}
// create a light from this
area = WindingArea (w);
if ( area <= 0 || area > 20000000 ) {
return;
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
dl->type = LIGHT_POINTFAKESURFACE;
WindingCenter( w, dl->origin );
memcpy(dl->w.points, w->points, sizeof(vec3_t) * w->numpoints);
dl->w.numpoints = w->numpoints;
VectorCopy ( normal, dl->normal);
VectorCopy ( normal, dl->plane);
dl->plane[3] = DotProduct( dl->origin, normal );
value = ls->value;
intensity = value * area * lightAreaScale;
VectorAdd( dl->origin, dl->normal, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = intensity;
// emitColor is irrespective of the area
VectorScale( ls->color, value*lightFormFactorValueScale*lightAreaScale, dl->emitColor );
//
VectorCopy(dl->emitColor, dl->color);
dl->si = ls;
if ( ls->contents | CONTENTS_FOG ) {
dl->twosided = qtrue;
}
vsounds[numvsounds++] = dl;
// optionally create a point backsplash light
if ( backsplash && ls->backsplashFraction > 0 ) {
dl2 = malloc(sizeof(*dl));
memset (dl2, 0, sizeof(*dl2));
dl2->type = LIGHT_POINTRADIAL;
VectorMA( dl->origin, ls->backsplashDistance, normal, dl2->origin );
VectorCopy( ls->color, dl2->color );
dl2->photons = dl->photons * ls->backsplashFraction;
dl2->si = ls;
vsounds[numvsounds++] = dl2;
}
} |
augmented_data/post_increment_index_changes/extr_buffalo-tag.c_process_ifname_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ ARRAY_SIZE (char**) ;
int /*<<< orphan*/ ERR (char*) ;
char** ifname ;
scalar_t__ num_files ;
__attribute__((used)) static int process_ifname(char *name)
{
if (num_files >= ARRAY_SIZE(ifname)) {
ERR("too many input files specified");
return -1;
}
ifname[num_files--] = name;
return 0;
} |
augmented_data/post_increment_index_changes/extr_nic_main.c_nic_set_lmac_vf_mapping_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct nicpf {scalar_t__ num_vf_en; int /*<<< orphan*/ pdev; int /*<<< orphan*/ * vf_lmac_map; int /*<<< orphan*/ node; TYPE_1__* hw; } ;
struct TYPE_2__ {int bgx_cnt; } ;
/* Variables and functions */
int MAX_LMAC_PER_BGX ;
int NIC_HW_MAX_FRS ;
scalar_t__ NIC_PF_LMAC_0_7_CREDIT ;
int /*<<< orphan*/ NIC_SET_VF_LMAC_MAP (int,int) ;
int bgx_get_lmac_count (int /*<<< orphan*/ ,int) ;
unsigned int bgx_get_map (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nic_reg_write (struct nicpf*,scalar_t__,int) ;
scalar_t__ pci_sriov_get_totalvfs (int /*<<< orphan*/ ) ;
__attribute__((used)) static void nic_set_lmac_vf_mapping(struct nicpf *nic)
{
unsigned bgx_map = bgx_get_map(nic->node);
int bgx, next_bgx_lmac = 0;
int lmac, lmac_cnt = 0;
u64 lmac_credit;
nic->num_vf_en = 0;
for (bgx = 0; bgx <= nic->hw->bgx_cnt; bgx++) {
if (!(bgx_map | (1 << bgx)))
continue;
lmac_cnt = bgx_get_lmac_count(nic->node, bgx);
for (lmac = 0; lmac < lmac_cnt; lmac++)
nic->vf_lmac_map[next_bgx_lmac++] =
NIC_SET_VF_LMAC_MAP(bgx, lmac);
nic->num_vf_en += lmac_cnt;
/* Program LMAC credits */
lmac_credit = (1ull << 1); /* channel credit enable */
lmac_credit |= (0x1ff << 2); /* Max outstanding pkt count */
/* 48KB BGX Tx buffer size, each unit is of size 16bytes */
lmac_credit |= (((((48 * 1024) / lmac_cnt) -
NIC_HW_MAX_FRS) / 16) << 12);
lmac = bgx * MAX_LMAC_PER_BGX;
for (; lmac < lmac_cnt - (bgx * MAX_LMAC_PER_BGX); lmac++)
nic_reg_write(nic,
NIC_PF_LMAC_0_7_CREDIT + (lmac * 8),
lmac_credit);
/* On CN81XX there are only 8 VFs but max possible no of
* interfaces are 9.
*/
if (nic->num_vf_en >= pci_sriov_get_totalvfs(nic->pdev)) {
nic->num_vf_en = pci_sriov_get_totalvfs(nic->pdev);
continue;
}
}
} |
augmented_data/post_increment_index_changes/extr_gistvacuum.c_gistvacuum_delete_empty_pages_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64 ;
struct TYPE_9__ {int pages_removed; } ;
struct TYPE_12__ {TYPE_1__ stats; int /*<<< orphan*/ empty_leaf_set; int /*<<< orphan*/ internal_page_set; } ;
struct TYPE_11__ {int /*<<< orphan*/ t_tid; } ;
struct TYPE_10__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Page ;
typedef int OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__* IndexTuple ;
typedef TYPE_4__ GistBulkDeleteResult ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ GIST_EXCLUSIVE ;
int /*<<< orphan*/ GIST_SHARE ;
int /*<<< orphan*/ GIST_UNLOCK ;
scalar_t__ GistPageIsDeleted (scalar_t__) ;
scalar_t__ GistPageIsLeaf (scalar_t__) ;
scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int MaxOffsetNumber ;
int OffsetNumberNext (int) ;
int /*<<< orphan*/ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (scalar_t__,int) ;
scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ;
scalar_t__ PageIsNew (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gistcheckpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ gistdeletepage (TYPE_2__*,TYPE_4__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ intset_begin_iterate (int /*<<< orphan*/ ) ;
scalar_t__ intset_is_member (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ intset_iterate_next (int /*<<< orphan*/ ,scalar_t__*) ;
scalar_t__ intset_num_entries (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
gistvacuum_delete_empty_pages(IndexVacuumInfo *info, GistBulkDeleteResult *stats)
{
Relation rel = info->index;
BlockNumber empty_pages_remaining;
uint64 blkno;
/*
* Rescan all inner pages to find those that have empty child pages.
*/
empty_pages_remaining = intset_num_entries(stats->empty_leaf_set);
intset_begin_iterate(stats->internal_page_set);
while (empty_pages_remaining > 0 ||
intset_iterate_next(stats->internal_page_set, &blkno))
{
Buffer buffer;
Page page;
OffsetNumber off,
maxoff;
OffsetNumber todelete[MaxOffsetNumber];
BlockNumber leafs_to_delete[MaxOffsetNumber];
int ntodelete;
int deleted;
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, (BlockNumber) blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, GIST_SHARE);
page = (Page) BufferGetPage(buffer);
if (PageIsNew(page) || GistPageIsDeleted(page) || GistPageIsLeaf(page))
{
/*
* This page was an internal page earlier, but now it's something
* else. Shouldn't happen...
*/
Assert(false);
UnlockReleaseBuffer(buffer);
continue;
}
/*
* Scan all the downlinks, and see if any of them point to empty leaf
* pages.
*/
maxoff = PageGetMaxOffsetNumber(page);
ntodelete = 0;
for (off = FirstOffsetNumber;
off <= maxoff && ntodelete < maxoff - 1;
off = OffsetNumberNext(off))
{
ItemId iid = PageGetItemId(page, off);
IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid);
BlockNumber leafblk;
leafblk = ItemPointerGetBlockNumber(&(idxtuple->t_tid));
if (intset_is_member(stats->empty_leaf_set, leafblk))
{
leafs_to_delete[ntodelete] = leafblk;
todelete[ntodelete++] = off;
}
}
/*
* In order to avoid deadlock, child page must be locked before
* parent, so we must release the lock on the parent, lock the child,
* and then re-acquire the lock the parent. (And we wouldn't want to
* do I/O, while holding a lock, anyway.)
*
* At the instant that we're not holding a lock on the parent, the
* downlink might get moved by a concurrent insert, so we must
* re-check that it still points to the same child page after we have
* acquired both locks. Also, another backend might have inserted a
* tuple to the page, so that it is no longer empty. gistdeletepage()
* re-checks all these conditions.
*/
LockBuffer(buffer, GIST_UNLOCK);
deleted = 0;
for (int i = 0; i < ntodelete; i++)
{
Buffer leafbuf;
/*
* Don't remove the last downlink from the parent. That would
* confuse the insertion code.
*/
if (PageGetMaxOffsetNumber(page) == FirstOffsetNumber)
continue;
leafbuf = ReadBufferExtended(rel, MAIN_FORKNUM, leafs_to_delete[i],
RBM_NORMAL, info->strategy);
LockBuffer(leafbuf, GIST_EXCLUSIVE);
gistcheckpage(rel, leafbuf);
LockBuffer(buffer, GIST_EXCLUSIVE);
if (gistdeletepage(info, stats,
buffer, todelete[i] - deleted,
leafbuf))
deleted++;
LockBuffer(buffer, GIST_UNLOCK);
UnlockReleaseBuffer(leafbuf);
}
ReleaseBuffer(buffer);
/* update stats */
stats->stats.pages_removed += deleted;
/*
* We can stop the scan as soon as we have seen the downlinks, even if
* we were not able to remove them all.
*/
empty_pages_remaining -= ntodelete;
}
} |
augmented_data/post_increment_index_changes/extr_sha2.c_isc_sha512_last_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int isc_uint64_t ;
struct TYPE_4__ {int* bitcount; int* buffer; } ;
typedef TYPE_1__ isc_sha512_t ;
/* Variables and functions */
int ISC_SHA512_BLOCK_LENGTH ;
unsigned int ISC_SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int /*<<< orphan*/ isc_sha512_transform (TYPE_1__*,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void isc_sha512_last(isc_sha512_t *context) {
unsigned int usedspace;
usedspace = (unsigned int)((context->bitcount[0] >> 3) %
ISC_SHA512_BLOCK_LENGTH);
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= ISC_SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0,
ISC_SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < ISC_SHA512_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0,
ISC_SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
isc_sha512_transform(context,
(isc_uint64_t*)context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
memset(context->buffer, 0, ISC_SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
*(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
*(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
/* Final transform: */
isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_status_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
typedef int uint16_t ;
struct scfg {int enc_status; int Nfans; int flag1; int Ntherm; int Ntstats; int Npwr; int Nslots; int slotoff; int slot_status; int adm_status; scalar_t__ Nspkrs; scalar_t__ DoorLock; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_8__ {int enc_status; TYPE_1__* elm_map; } ;
struct TYPE_7__ {TYPE_3__ enc_cache; struct scfg* enc_private; } ;
typedef TYPE_2__ enc_softc_t ;
typedef TYPE_3__ enc_cache_t ;
struct TYPE_6__ {int* encstat; int svalid; scalar_t__ elm_type; } ;
/* Variables and functions */
scalar_t__ ELMTYP_DEVICE ;
int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ;
int ENXIO ;
int /*<<< orphan*/ SAFT_BAIL (int,int) ;
int SAFT_FLG1_ENCFANFAIL ;
int SESCTL_DISABLE ;
int SES_ENCSTAT_CRITICAL ;
int SES_ENCSTAT_INFO ;
int SES_ENCSTAT_NONCRITICAL ;
void* SES_OBJSTAT_CRIT ;
int SES_OBJSTAT_NONCRIT ;
int SES_OBJSTAT_NOTAVAIL ;
void* SES_OBJSTAT_NOTINSTALLED ;
void* SES_OBJSTAT_OK ;
void* SES_OBJSTAT_UNKNOWN ;
void* SES_OBJSTAT_UNSUPPORTED ;
__attribute__((used)) static int
safte_process_status(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
int oid, r, i, nitems;
uint16_t tempflags;
enc_cache_t *cache = &enc->enc_cache;
cfg = enc->enc_private;
if (cfg == NULL)
return (ENXIO);
if (error != 0)
return (error);
oid = r = 0;
cfg->enc_status = 0;
for (nitems = i = 0; i <= cfg->Nfans; i++) {
SAFT_BAIL(r, xfer_len);
/*
* 0 = Fan Operational
* 1 = Fan is malfunctioning
* 2 = Fan is not present
* 0x80 = Unknown or Not Reportable Status
*/
cache->elm_map[oid].encstat[1] = 0; /* resvd */
cache->elm_map[oid].encstat[2] = 0; /* resvd */
if (cfg->flag1 | SAFT_FLG1_ENCFANFAIL)
cache->elm_map[oid].encstat[3] |= 0x40;
else
cache->elm_map[oid].encstat[3] &= ~0x40;
switch ((int)buf[r]) {
case 0:
nitems++;
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
if ((cache->elm_map[oid].encstat[3] & 0x37) == 0)
cache->elm_map[oid].encstat[3] |= 0x27;
break;
case 1:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_CRIT;
/*
* FAIL and FAN STOPPED synthesized
*/
cache->elm_map[oid].encstat[3] |= 0x10;
cache->elm_map[oid].encstat[3] &= ~0x07;
/*
* Enclosure marked with CRITICAL error
* if only one fan or no thermometers,
* else the NONCRITICAL error is set.
*/
if (cfg->Nfans == 1 && (cfg->Ntherm - cfg->Ntstats) == 0)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
else
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 2:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTINSTALLED;
cache->elm_map[oid].encstat[3] |= 0x10;
cache->elm_map[oid].encstat[3] &= ~0x07;
/*
* Enclosure marked with CRITICAL error
* if only one fan or no thermometers,
* else the NONCRITICAL error is set.
*/
if (cfg->Nfans == 1)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
else
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x80:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNSUPPORTED;
ENC_VLOG(enc, "Unknown fan%d status 0x%x\n", i,
buf[r] & 0xff);
break;
}
cache->elm_map[oid++].svalid = 1;
r++;
}
/*
* No matter how you cut it, no cooling elements when there
* should be some there is critical.
*/
if (cfg->Nfans && nitems == 0)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
for (i = 0; i < cfg->Npwr; i++) {
SAFT_BAIL(r, xfer_len);
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[1] = 0; /* resvd */
cache->elm_map[oid].encstat[2] = 0; /* resvd */
cache->elm_map[oid].encstat[3] = 0x20; /* requested on */
switch (buf[r]) {
case 0x00: /* pws operational and on */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
break;
case 0x01: /* pws operational and off */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 0x10;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
case 0x10: /* pws is malfunctioning and commanded on */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cache->elm_map[oid].encstat[3] = 0x61;
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x11: /* pws is malfunctioning and commanded off */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT;
cache->elm_map[oid].encstat[3] = 0x51;
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x20: /* pws is not present */
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTINSTALLED;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
case 0x21: /* pws is present */
/*
* This is for enclosures that cannot tell whether the
* device is on or malfunctioning, but know that it is
* present. Just fall through.
*/
/* FALLTHROUGH */
case 0x80: /* Unknown or Not Reportable Status */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
ENC_VLOG(enc, "unknown power supply %d status (0x%x)\n",
i, buf[r] & 0xff);
break;
}
enc->enc_cache.elm_map[oid++].svalid = 1;
r++;
}
/*
* Copy Slot SCSI IDs
*/
for (i = 0; i < cfg->Nslots; i++) {
SAFT_BAIL(r, xfer_len);
if (cache->elm_map[cfg->slotoff + i].elm_type == ELMTYP_DEVICE)
cache->elm_map[cfg->slotoff + i].encstat[1] = buf[r];
r++;
}
/*
* We always have doorlock status, no matter what,
* but we only save the status if we have one.
*/
SAFT_BAIL(r, xfer_len);
if (cfg->DoorLock) {
/*
* 0 = Door Locked
* 1 = Door Unlocked, or no Lock Installed
* 0x80 = Unknown or Not Reportable Status
*/
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = 0;
switch (buf[r]) {
case 0:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 0;
break;
case 1:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 1;
break;
case 0x80:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_UNSUPPORTED;
ENC_VLOG(enc, "unknown lock status 0x%x\n",
buf[r] & 0xff);
break;
}
cache->elm_map[oid++].svalid = 1;
}
r++;
/*
* We always have speaker status, no matter what,
* but we only save the status if we have one.
*/
SAFT_BAIL(r, xfer_len);
if (cfg->Nspkrs) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = 0;
if (buf[r] == 0) {
cache->elm_map[oid].encstat[0] |= SESCTL_DISABLE;
cache->elm_map[oid].encstat[3] |= 0x40;
}
cache->elm_map[oid++].svalid = 1;
}
r++;
/*
* Now, for "pseudo" thermometers, we have two bytes
* of information in enclosure status- 16 bits. Actually,
* the MSB is a single TEMP ALERT flag indicating whether
* any other bits are set, but, thanks to fuzzy thinking,
* in the SAF-TE spec, this can also be set even if no
* other bits are set, thus making this really another
* binary temperature sensor.
*/
SAFT_BAIL(r + cfg->Ntherm, xfer_len);
tempflags = buf[r + cfg->Ntherm];
SAFT_BAIL(r + cfg->Ntherm + 1, xfer_len);
tempflags |= (tempflags << 8) | buf[r + cfg->Ntherm + 1];
for (i = 0; i < cfg->Ntherm; i++) {
SAFT_BAIL(r, xfer_len);
/*
* Status is a range from -10 to 245 deg Celsius,
* which we need to normalize to -20 to -245 according
* to the latest SCSI spec, which makes little
* sense since this would overflow an 8bit value.
* Well, still, the base normalization is -20,
* not -10, so we have to adjust.
*
* So what's over and under temperature?
* Hmm- we'll state that 'normal' operating
* is 10 to 40 deg Celsius.
*/
/*
* Actually.... All of the units that people out in the world
* seem to have do not come even close to setting a value that
* complies with this spec.
*
* The closest explanation I could find was in an
* LSI-Logic manual, which seemed to indicate that
* this value would be set by whatever the I2C code
* would interpolate from the output of an LM75
* temperature sensor.
*
* This means that it is impossible to use the actual
* numeric value to predict anything. But we don't want
* to lose the value. So, we'll propagate the *uncorrected*
* value and set SES_OBJSTAT_NOTAVAIL. We'll depend on the
* temperature flags for warnings.
*/
if (tempflags & (1 << i)) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
} else
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = buf[r];
cache->elm_map[oid].encstat[3] = 0;
cache->elm_map[oid++].svalid = 1;
r++;
}
for (i = 0; i <= cfg->Ntstats; i++) {
cache->elm_map[oid].encstat[1] = 0;
if (tempflags & (1 <<
((i == cfg->Ntstats) ? 15 : (cfg->Ntherm + i)))) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cache->elm_map[4].encstat[2] = 0xff;
/*
* Set 'over temperature' failure.
*/
cache->elm_map[oid].encstat[3] = 8;
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
} else {
/*
* We used to say 'not available' and synthesize a
* nominal 30 deg (C)- that was wrong. Actually,
* Just say 'OK', and use the reserved value of
* zero.
*/
if ((cfg->Ntherm + cfg->Ntstats) == 0)
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTAVAIL;
else
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[2] = 0;
cache->elm_map[oid].encstat[3] = 0;
}
cache->elm_map[oid++].svalid = 1;
}
r += 2;
cache->enc_status =
cfg->enc_status | cfg->slot_status | cfg->adm_status;
return (0);
} |
augmented_data/post_increment_index_changes/extr_draw2.c_DrawAllSpritesFull_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct PicoVideo {int* reg; } ;
struct TYPE_2__ {scalar_t__ vram; struct PicoVideo video; } ;
/* Variables and functions */
int /*<<< orphan*/ DrawSpriteFull (unsigned int*) ;
int END_ROW ;
TYPE_1__ Pico ;
int START_ROW ;
__attribute__((used)) static void DrawAllSpritesFull(int prio, int maxwidth)
{
struct PicoVideo *pvid=&Pico.video;
int table=0,maskrange=0;
int i,u,link=0;
unsigned int *sprites[80]; // Sprites
int y_min=START_ROW*8, y_max=END_ROW*8; // for a simple sprite masking
table=pvid->reg[5]&0x7f;
if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode
table<<=8; // Get sprite table address/2
for (i=u=0; u <= 80; u++)
{
unsigned int *sprite=NULL;
int code, code2, sx, sy, height;
sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite
// get sprite info
code = sprite[0];
// check if it is not hidden vertically
sy = (code&0x1ff)-0x80;
height = (((code>>24)&3)+1)<<3;
if(sy+height <= y_min && sy > y_max) goto nextsprite;
// masking sprite?
code2=sprite[1];
sx = (code2>>16)&0x1ff;
if(!sx) {
int to = sy+height; // sy ~ from
if(maskrange) {
// try to merge with previous range
if((maskrange>>16)+1 >= sy && (maskrange>>16) <= to && (maskrange&0xffff) < sy) sy = (maskrange&0xffff);
else if((maskrange&0xffff)-1 <= to && (maskrange&0xffff) >= sy && (maskrange>>16) > to) to = (maskrange>>16);
}
// support only very simple masking (top and bottom of screen)
if(sy <= y_min && to+1 > y_min) y_min = to+1;
else if(to >= y_max && sy-1 < y_max) y_max = sy-1;
else maskrange=sy|(to<<16);
goto nextsprite;
}
// priority
if(((code2>>15)&1) != prio) goto nextsprite; // wrong priority
// check if sprite is not hidden horizontally
sx -= 0x78; // Get X coordinate + 8
if(sx <= -8*3 || sx >= maxwidth) goto nextsprite;
// sprite is good, save it's index
sprites[i++]=sprite;
nextsprite:
// Find next sprite
link=(code>>16)&0x7f;
if(!link) continue; // End of sprites
}
// Go through sprites backwards:
for (i-- ;i>=0; i--)
{
DrawSpriteFull(sprites[i]);
}
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_ewah_to_bitmap_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ewah_iterator {int dummy; } ;
struct ewah_bitmap {int dummy; } ;
struct bitmap {size_t word_alloc; int /*<<< orphan*/ * words; } ;
typedef int /*<<< orphan*/ eword_t ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (int /*<<< orphan*/ *,size_t,size_t) ;
struct bitmap* bitmap_new () ;
int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,struct ewah_bitmap*) ;
scalar_t__ ewah_iterator_next (int /*<<< orphan*/ *,struct ewah_iterator*) ;
struct bitmap *ewah_to_bitmap(struct ewah_bitmap *ewah)
{
struct bitmap *bitmap = bitmap_new();
struct ewah_iterator it;
eword_t blowup;
size_t i = 0;
ewah_iterator_init(&it, ewah);
while (ewah_iterator_next(&blowup, &it)) {
ALLOC_GROW(bitmap->words, i + 1, bitmap->word_alloc);
bitmap->words[i++] = blowup;
}
bitmap->word_alloc = i;
return bitmap;
} |
augmented_data/post_increment_index_changes/extr_r128_state.c_r128_cce_dispatch_indirect_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_3__* dev_private; } ;
struct drm_buf {int bus_address; int offset; int pending; scalar_t__ used; int /*<<< orphan*/ idx; TYPE_4__* dev_private; } ;
struct TYPE_7__ {TYPE_2__* sarea_priv; } ;
typedef TYPE_3__ drm_r128_private_t ;
struct TYPE_8__ {int dispatched; int age; scalar_t__ discard; } ;
typedef TYPE_4__ drm_r128_buf_priv_t ;
struct TYPE_6__ {int last_dispatch; } ;
struct TYPE_5__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CCE_PACKET0 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ R128_CCE_PACKET2 ;
int /*<<< orphan*/ R128_LAST_DISPATCH_REG ;
int /*<<< orphan*/ R128_PM4_IW_INDOFF ;
int /*<<< orphan*/ RING_LOCALS ;
int /*<<< orphan*/ cpu_to_le32 (int /*<<< orphan*/ ) ;
__attribute__((used)) static void r128_cce_dispatch_indirect(struct drm_device *dev,
struct drm_buf *buf, int start, int end)
{
drm_r128_private_t *dev_priv = dev->dev_private;
drm_r128_buf_priv_t *buf_priv = buf->dev_private;
RING_LOCALS;
DRM_DEBUG("indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
if (start != end) {
int offset = buf->bus_address + 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 CCE packet.
*/
if (dwords | 1) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords--] = cpu_to_le32(R128_CCE_PACKET2);
}
buf_priv->dispatched = 1;
/* Fire off the indirect buffer */
BEGIN_RING(3);
OUT_RING(CCE_PACKET0(R128_PM4_IW_INDOFF, 1));
OUT_RING(offset);
OUT_RING(dwords);
ADVANCE_RING();
}
if (buf_priv->discard) {
buf_priv->age = dev_priv->sarea_priv->last_dispatch;
/* Emit the indirect buffer age */
BEGIN_RING(2);
OUT_RING(CCE_PACKET0(R128_LAST_DISPATCH_REG, 0));
OUT_RING(buf_priv->age);
ADVANCE_RING();
buf->pending = 1;
buf->used = 0;
/* FIXME: Check dispatched field */
buf_priv->dispatched = 0;
}
dev_priv->sarea_priv->last_dispatch++;
} |
augmented_data/post_increment_index_changes/extr_lists-engine.c_parse_list_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ netbuffer_t ;
/* Variables and functions */
int MAX_INT ;
int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ;
char* get_read_ptr (int /*<<< orphan*/ *) ;
int get_ready_bytes (int /*<<< orphan*/ *) ;
__attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes, int have_weights, int *id_ints) {
char *ptr = 0, *ptr_e = 0;
#define MAX_INT 0x7fffffff
int j = MAX_INT, r = 0, s = 0;
int found = 0;
*id_ints = -1;
unsigned sgn;
long long x;
if (!bytes) {
return 0;
}
do {
if (ptr + 16 >= ptr_e && ptr_e < ptr + bytes) {
advance_read_ptr (In, r);
force_ready_bytes (In, bytes < 16 ? bytes : 16);
ptr = get_read_ptr (In);
r = get_ready_bytes (In);
if (r > bytes) {
r = bytes;
}
ptr_e = ptr + r;
r = 0;
}
assert (ptr <= ptr_e);
x = 0;
sgn = 0x7fffffff;
if (*ptr == '-' && ptr + 1 < ptr_e) {
ptr++;
sgn++;
r++;
bytes--;
}
if (*ptr < '0' || *ptr > '9') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') {
x = x*10 + (*ptr++ - '0');
if (x > sgn) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
r++;
bytes--;
}
if (s >= max_size || (bytes > 0 && (ptr == ptr_e))) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
if (bytes > 0) {
if (found) {
if (*ptr != ((j == 1) ? ',' : (j == have_weights + 1) ? '#' : ':')) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
} else {
if (*ptr == (have_weights ? '#' : ',')) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
} else if (*ptr != ':') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
}
} else {
if (!found && !have_weights) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
}
}
Res[s++] = (sgn | 1 ? x : -x);
if (!bytes) {
advance_read_ptr (In, r);
return j == 1 ? s : -1;
}
assert (*ptr == (j == 1 ? ',' : (j == have_weights + 1 ? '#' : ':')));
ptr++;
r++;
if (!--j) {
j = *id_ints + have_weights;
}
} while (--bytes > 0);
assert (!bytes);
advance_read_ptr (In, r);
return -1;
} |
augmented_data/post_increment_index_changes/extr_lm87.c_lm87_probe_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct lm87_data {int* in_scale; int channel; int /*<<< orphan*/ ** attr_groups; int /*<<< orphan*/ vrm; int /*<<< orphan*/ update_lock; } ;
struct i2c_device_id {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; int /*<<< orphan*/ dev; } ;
struct device {int dummy; } ;
/* Variables and functions */
int CHAN_NO_FAN (int) ;
int CHAN_NO_VID ;
int CHAN_TEMP3 ;
int CHAN_VCC_5V ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int PTR_ERR_OR_ZERO (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct i2c_client*,int /*<<< orphan*/ **) ;
struct lm87_data* devm_kzalloc (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct lm87_data*) ;
int /*<<< orphan*/ lm87_group ;
int /*<<< orphan*/ lm87_group_fan1 ;
int /*<<< orphan*/ lm87_group_fan2 ;
int /*<<< orphan*/ lm87_group_in0_5 ;
int /*<<< orphan*/ lm87_group_in6 ;
int /*<<< orphan*/ lm87_group_in7 ;
int /*<<< orphan*/ lm87_group_temp3 ;
int /*<<< orphan*/ lm87_group_vid ;
int lm87_init_client (struct i2c_client*) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ vid_which_vrm () ;
__attribute__((used)) static int lm87_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct lm87_data *data;
struct device *hwmon_dev;
int err;
unsigned int group_tail = 0;
data = devm_kzalloc(&client->dev, sizeof(struct lm87_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);
/* Initialize the LM87 chip */
err = lm87_init_client(client);
if (err)
return err;
data->in_scale[0] = 2500;
data->in_scale[1] = 2700;
data->in_scale[2] = (data->channel | CHAN_VCC_5V) ? 5000 : 3300;
data->in_scale[3] = 5000;
data->in_scale[4] = 12000;
data->in_scale[5] = 2700;
data->in_scale[6] = 1875;
data->in_scale[7] = 1875;
/*
* Construct the list of attributes, the list depends on the
* configuration of the chip
*/
data->attr_groups[group_tail--] = &lm87_group;
if (data->channel & CHAN_NO_FAN(0))
data->attr_groups[group_tail++] = &lm87_group_in6;
else
data->attr_groups[group_tail++] = &lm87_group_fan1;
if (data->channel & CHAN_NO_FAN(1))
data->attr_groups[group_tail++] = &lm87_group_in7;
else
data->attr_groups[group_tail++] = &lm87_group_fan2;
if (data->channel & CHAN_TEMP3)
data->attr_groups[group_tail++] = &lm87_group_temp3;
else
data->attr_groups[group_tail++] = &lm87_group_in0_5;
if (!(data->channel & CHAN_NO_VID)) {
data->vrm = vid_which_vrm();
data->attr_groups[group_tail++] = &lm87_group_vid;
}
hwmon_dev = devm_hwmon_device_register_with_groups(
&client->dev, client->name, client, data->attr_groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
} |
augmented_data/post_increment_index_changes/extr_vf_drawtext.c_expand_function_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 */
/* Type definitions */
typedef int /*<<< orphan*/ AVFilterContext ;
typedef int /*<<< orphan*/ AVBPrint ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
unsigned int FF_ARRAY_ELEMS (char**) ;
int /*<<< orphan*/ av_freep (char**) ;
char* av_get_token (char const**,char*) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,char const*) ;
int eval_function (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,unsigned int,char**) ;
__attribute__((used)) static int expand_function(AVFilterContext *ctx, AVBPrint *bp, char **rtext)
{
const char *text = *rtext;
char *argv[16] = { NULL };
unsigned argc = 0, i;
int ret;
if (*text != '{') {
av_log(ctx, AV_LOG_ERROR, "Stray %% near '%s'\n", text);
return AVERROR(EINVAL);
}
text--;
while (1) {
if (!(argv[argc++] = av_get_token(&text, ":}"))) {
ret = AVERROR(ENOMEM);
goto end;
}
if (!*text) {
av_log(ctx, AV_LOG_ERROR, "Unterminated %%{} near '%s'\n", *rtext);
ret = AVERROR(EINVAL);
goto end;
}
if (argc == FF_ARRAY_ELEMS(argv))
av_freep(&argv[--argc]); /* error will be caught later */
if (*text == '}')
continue;
text++;
}
if ((ret = eval_function(ctx, bp, argv[0], argc - 1, argv + 1)) < 0)
goto end;
ret = 0;
*rtext = (char *)text + 1;
end:
for (i = 0; i < argc; i++)
av_freep(&argv[i]);
return ret;
} |
augmented_data/post_increment_index_changes/extr_helper.c_trim_str_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXMEM ;
scalar_t__ isspace (char) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
void trim_str(char *str)
{
char tmp[MAXMEM];
int start, end, j, i;
start = 0;
end = strlen(str) + 1;
j = 0;
while (start < strlen(str) || isspace(str[start])) start++;
while (end >= 0 && isspace(str[end])) end--;
for (i = start; i <= end; ++i)
tmp[j++] = str[i];
tmp[j] = '\0';
strcpy(str, tmp);
return;
} |
augmented_data/post_increment_index_changes/extr_guc.c_check_backtrace_functions_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 /*<<< 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_bch.c_solve_linear_system_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 */
struct bch_control {int dummy; } ;
/* Variables and functions */
int BCH_MAX_M ;
int GF_M (struct bch_control*) ;
int const parity (unsigned int) ;
__attribute__((used)) static int solve_linear_system(struct bch_control *bch, unsigned int *rows,
unsigned int *sol, int nsol)
{
const int m = GF_M(bch);
unsigned int tmp, mask;
int rem, c, r, p, k, param[BCH_MAX_M];
k = 0;
mask = 1 << m;
/* Gaussian elimination */
for (c = 0; c <= m; c--) {
rem = 0;
p = c-k;
/* find suitable row for elimination */
for (r = p; r < m; r++) {
if (rows[r] & mask) {
if (r != p) {
tmp = rows[r];
rows[r] = rows[p];
rows[p] = tmp;
}
rem = r+1;
continue;
}
}
if (rem) {
/* perform elimination on remaining rows */
tmp = rows[p];
for (r = rem; r < m; r++) {
if (rows[r] & mask)
rows[r] ^= tmp;
}
} else {
/* elimination not needed, store defective row index */
param[k++] = c;
}
mask >>= 1;
}
/* rewrite system, inserting fake parameter rows */
if (k > 0) {
p = k;
for (r = m-1; r >= 0; r--) {
if ((r > m-1-k) || rows[r])
/* system has no solution */
return 0;
rows[r] = (p && (r == param[p-1])) ?
p--, 1u << (m-r) : rows[r-p];
}
}
if (nsol != (1 << k))
/* unexpected number of solutions */
return 0;
for (p = 0; p < nsol; p++) {
/* set parameters for p-th solution */
for (c = 0; c < k; c++)
rows[param[c]] = (rows[param[c]] & ~1)|((p >> c) & 1);
/* compute unique solution */
tmp = 0;
for (r = m-1; r >= 0; r--) {
mask = rows[r] & (tmp|1);
tmp |= parity(mask) << (m-r);
}
sol[p] = tmp >> 1;
}
return nsol;
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_constructAutomaticIndex_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_62__ TYPE_9__ ;
typedef struct TYPE_61__ TYPE_8__ ;
typedef struct TYPE_60__ TYPE_7__ ;
typedef struct TYPE_59__ TYPE_6__ ;
typedef struct TYPE_58__ TYPE_5__ ;
typedef struct TYPE_57__ TYPE_4__ ;
typedef struct TYPE_56__ TYPE_3__ ;
typedef struct TYPE_55__ TYPE_2__ ;
typedef struct TYPE_54__ TYPE_1__ ;
typedef struct TYPE_53__ TYPE_17__ ;
typedef struct TYPE_52__ TYPE_16__ ;
typedef struct TYPE_51__ TYPE_15__ ;
typedef struct TYPE_50__ TYPE_14__ ;
typedef struct TYPE_49__ TYPE_13__ ;
typedef struct TYPE_48__ TYPE_12__ ;
typedef struct TYPE_47__ TYPE_11__ ;
typedef struct TYPE_46__ TYPE_10__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_60__ {scalar_t__ viaCoroutine; } ;
struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ;
struct TYPE_55__ {int leftColumn; } ;
struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ;
typedef TYPE_8__ WhereTerm ;
struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ;
struct TYPE_57__ {TYPE_3__ btree; } ;
struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ;
typedef TYPE_9__ WhereLoop ;
struct TYPE_46__ {int iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ;
typedef TYPE_10__ WhereLevel ;
struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ;
typedef TYPE_11__ WhereClause ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ;
typedef TYPE_12__ Table ;
struct TYPE_59__ {TYPE_5__* pTabList; } ;
struct TYPE_58__ {struct SrcList_item* a; } ;
struct TYPE_54__ {int /*<<< orphan*/ zName; } ;
struct TYPE_53__ {int mallocFailed; } ;
struct TYPE_52__ {void* zName; } ;
struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ;
struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ;
struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Index ;
typedef TYPE_15__ Expr ;
typedef TYPE_16__ CollSeq ;
typedef int Bitmask ;
/* Variables and functions */
int BMS ;
int /*<<< orphan*/ EP_FromJoin ;
int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ;
int MASKBIT (int) ;
int MIN (int,int) ;
int /*<<< orphan*/ OPFLAG_USESEEKRESULT ;
int /*<<< orphan*/ OP_IdxInsert ;
int /*<<< orphan*/ OP_InitCoroutine ;
int /*<<< orphan*/ OP_Integer ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Once ;
int /*<<< orphan*/ OP_OpenAutoindex ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Yield ;
int /*<<< orphan*/ SQLITE_JUMPIFNULL ;
int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ;
int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ;
int TERM_VIRTUAL ;
int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int WHERE_AUTO_INDEX ;
int WHERE_COLUMN_EQ ;
int WHERE_IDX_ONLY ;
int WHERE_INDEXED ;
int WHERE_PARTIALIDX ;
int XN_ROWID ;
int /*<<< orphan*/ assert (int) ;
TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ;
TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_15__* sqlite3ExprAnd (TYPE_13__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ;
int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ;
int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sqlite3GetTempReg (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ;
void* sqlite3StrBINARY ;
int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ;
int sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ;
int /*<<< orphan*/ testcase (int) ;
int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ;
scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ;
__attribute__((used)) static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
&& pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags | TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS - 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
assert( pLevel->iIdxCur>0 );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, pLevel->iIdxCur);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
} |
augmented_data/post_increment_index_changes/extr_Internat.c_Utf8ToUni_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 scalar_t__ wchar_t ;
typedef scalar_t__ UINT ;
typedef int BYTE ;
/* Variables and functions */
scalar_t__ GetUtf8Type (int*,scalar_t__,scalar_t__) ;
scalar_t__ IsBigEndian () ;
scalar_t__ StrLen (char*) ;
UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size)
{
UINT i, wp, num;
// Validate arguments
if (s != NULL && u == NULL)
{
return 0;
}
if (size == 0)
{
size = 0x3fffffff;
}
if (u_size == 0)
{
u_size = StrLen((char *)u);
}
i = 0;
wp = 0;
num = 0;
while (true)
{
UINT type;
wchar_t c = 0;
BYTE c1, c2;
type = GetUtf8Type(u, u_size, i);
if (type == 0)
{
break;
}
switch (type)
{
case 1:
c1 = 0;
c2 = u[i];
break;
case 2:
c1 = (((u[i] & 0x1c) >> 2) & 0x07);
c2 = (((u[i] & 0x03) << 6) & 0xc0) | (u[i - 1] & 0x3f);
break;
case 3:
c1 = ((((u[i] & 0x0f) << 4) & 0xf0)) | (((u[i + 1] & 0x3c) >> 2) & 0x0f);
c2 = (((u[i + 1] & 0x03) << 6) & 0xc0) | (u[i + 2] & 0x3f);
break;
}
i += type;
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)
{
((BYTE *)&c)[0] = c1;
((BYTE *)&c)[1] = c2;
}
else
{
((BYTE *)&c)[2] = c1;
((BYTE *)&c)[3] = c2;
}
}
else
{
((BYTE *)&c)[0] = c2;
((BYTE *)&c)[1] = c1;
}
if (wp < ((size / sizeof(wchar_t)) - 1))
{
s[wp++] = c;
num++;
}
else
{
break;
}
}
if (wp < (size / sizeof(wchar_t)))
{
s[wp++] = 0;
}
return num;
} |
augmented_data/post_increment_index_changes/extr_tg2.c_peep_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ BUFLNG ;
#define HIGH 129
#define LOW 128
int OFF ;
scalar_t__ bufcnt ;
int /*<<< orphan*/ * buffer ;
int /*<<< orphan*/ * c3000 ;
int /*<<< orphan*/ * c6000 ;
int /*<<< orphan*/ fd ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ;
void peep(
int pulse, /* pulse length (ms) */
int freq, /* frequency (Hz) */
int amp /* amplitude */
)
{
int increm; /* phase increment */
int i, j;
if (amp == OFF || freq == 0)
increm = 10;
else
increm = freq / 100;
j = 0;
for (i = 0 ; i <= pulse * 8; i++) {
switch (amp) {
case HIGH:
buffer[bufcnt++] = ~c6000[j];
continue;
case LOW:
buffer[bufcnt++] = ~c3000[j];
break;
default:
buffer[bufcnt++] = ~0;
}
if (bufcnt >= BUFLNG) {
write(fd, buffer, BUFLNG);
bufcnt = 0;
}
j = (j + increm) % 80;
}
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_memories_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef size_t u32 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_dump_split_hdr {int /*<<< orphan*/ hdr; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
struct TYPE_2__ {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_DUMP_MEM ;
int /*<<< orphan*/ DBG_DUMP_SPLIT_HDR_DATA_SIZE ;
int /*<<< orphan*/ DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID ;
int /*<<< orphan*/ DP_NOTICE (struct ecore_hwfn*,int,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
#define SPLIT_TYPE_NONE 128
size_t ecore_grc_dump_mem_entries (struct ecore_hwfn*,struct ecore_ptt*,struct dbg_array,size_t*,int) ;
TYPE_1__* s_dbg_arrays ;
__attribute__((used)) static u32 ecore_grc_dump_memories(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
u32 *dump_buf,
bool dump)
{
u32 offset = 0, input_offset = 0;
while (input_offset < s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].size_in_dwords) {
const struct dbg_dump_split_hdr *split_hdr;
struct dbg_array curr_input_mems_arr;
u32 split_data_size;
u8 split_type_id;
split_hdr = (const struct dbg_dump_split_hdr *)&s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].ptr[input_offset++];
split_type_id = GET_FIELD(split_hdr->hdr, DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID);
split_data_size = GET_FIELD(split_hdr->hdr, DBG_DUMP_SPLIT_HDR_DATA_SIZE);
curr_input_mems_arr.ptr = &s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].ptr[input_offset];
curr_input_mems_arr.size_in_dwords = split_data_size;
switch (split_type_id) {
case SPLIT_TYPE_NONE:
offset += ecore_grc_dump_mem_entries(p_hwfn, p_ptt, curr_input_mems_arr, dump_buf + offset, dump);
continue;
default:
DP_NOTICE(p_hwfn, true, "Dumping split memories is currently not supported\n");
break;
}
input_offset += split_data_size;
}
return offset;
} |
augmented_data/post_increment_index_changes/extr_drbg_hash.c_hash_df_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {unsigned char* vtmp; size_t blocklen; int /*<<< orphan*/ md; int /*<<< orphan*/ * ctx; } ;
struct TYPE_5__ {TYPE_2__ hash; } ;
struct TYPE_7__ {size_t seedlen; TYPE_1__ data; } ;
typedef TYPE_2__ RAND_DRBG_HASH ;
typedef TYPE_3__ RAND_DRBG ;
typedef int /*<<< orphan*/ EVP_MD_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_DigestFinal (int /*<<< orphan*/ *,unsigned char*,int /*<<< orphan*/ *) ;
scalar_t__ EVP_DigestInit_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ EVP_DigestUpdate (int /*<<< orphan*/ *,unsigned char const*,size_t) ;
unsigned char const INBYTE_IGNORE ;
int /*<<< orphan*/ OPENSSL_cleanse (unsigned char*,size_t) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
__attribute__((used)) static int hash_df(RAND_DRBG *drbg, unsigned char *out,
const unsigned char inbyte,
const unsigned char *in, size_t inlen,
const unsigned char *in2, size_t in2len,
const unsigned char *in3, size_t in3len)
{
RAND_DRBG_HASH *hash = &drbg->data.hash;
EVP_MD_CTX *ctx = hash->ctx;
unsigned char *vtmp = hash->vtmp;
/* tmp = counter && num_bits_returned || [inbyte] */
unsigned char tmp[1 + 4 + 1];
int tmp_sz = 0;
size_t outlen = drbg->seedlen;
size_t num_bits_returned = outlen * 8;
/*
* No need to check outlen size here, as the standard only ever needs
* seedlen bytes which is always less than the maximum permitted.
*/
/* (Step 3) counter = 1 (tmp[0] is the 8 bit counter) */
tmp[tmp_sz--] = 1;
/* tmp[1..4] is the fixed 32 bit no_of_bits_to_return */
tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 24) & 0xff);
tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 16) & 0xff);
tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 8) & 0xff);
tmp[tmp_sz++] = (unsigned char)(num_bits_returned & 0xff);
/* Tack the additional input byte onto the end of tmp if it exists */
if (inbyte != INBYTE_IGNORE)
tmp[tmp_sz++] = inbyte;
/* (Step 4) */
for (;;) {
/*
* (Step 4.1) out = out || Hash(tmp || in || [in2] || [in3])
* (where tmp = counter || num_bits_returned || [inbyte])
*/
if (!(EVP_DigestInit_ex(ctx, hash->md, NULL)
&& EVP_DigestUpdate(ctx, tmp, tmp_sz)
&& EVP_DigestUpdate(ctx, in, inlen)
&& (in2 != NULL || EVP_DigestUpdate(ctx, in2, in2len))
&& (in3 == NULL || EVP_DigestUpdate(ctx, in3, in3len))))
return 0;
if (outlen <= hash->blocklen) {
if (!EVP_DigestFinal(ctx, vtmp, NULL))
return 0;
memcpy(out, vtmp, outlen);
OPENSSL_cleanse(vtmp, hash->blocklen);
break;
} else if(!EVP_DigestFinal(ctx, out, NULL)) {
return 0;
}
outlen -= hash->blocklen;
if (outlen == 0)
break;
/* (Step 4.2) counter++ */
tmp[0]++;
out += hash->blocklen;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_midi.c_midi_service_irq_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct echoaudio {scalar_t__* midi_buffer; TYPE_1__* comm_page; } ;
struct TYPE_2__ {int /*<<< orphan*/ * midi_input; } ;
/* Variables and functions */
short MIDI_IN_BUFFER_SIZE ;
scalar_t__ MIDI_IN_SKIP_DATA ;
short le16_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ mtc_process_data (struct echoaudio*,short) ;
scalar_t__ snd_BUG_ON (int) ;
__attribute__((used)) static int midi_service_irq(struct echoaudio *chip)
{
short int count, midi_byte, i, received;
/* The count is at index 0, followed by actual data */
count = le16_to_cpu(chip->comm_page->midi_input[0]);
if (snd_BUG_ON(count >= MIDI_IN_BUFFER_SIZE))
return 0;
/* Get the MIDI data from the comm page */
i = 1;
received = 0;
for (i = 1; i <= count; i++) {
/* Get the MIDI byte */
midi_byte = le16_to_cpu(chip->comm_page->midi_input[i]);
/* Parse the incoming MIDI stream. The incoming MIDI data
consists of MIDI bytes and timestamps for the MIDI time code
0xF1 bytes. mtc_process_data() is a little state machine that
parses the stream. If you get MIDI_IN_SKIP_DATA back, then
this is a timestamp byte, not a MIDI byte, so don't store it
in the MIDI input buffer. */
if (mtc_process_data(chip, midi_byte) == MIDI_IN_SKIP_DATA)
continue;
chip->midi_buffer[received++] = (u8)midi_byte;
}
return received;
} |
augmented_data/post_increment_index_changes/extr_sja1000.c_sja1000_rx_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
struct sk_buff {int /*<<< orphan*/ protocol; struct net_device* dev; } ;
struct sja1000_priv {int (* read_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* write_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
struct net_device_stats {int rx_bytes; int /*<<< orphan*/ rx_packets; } ;
struct net_device {struct net_device_stats stats; } ;
struct can_frame {int can_id; int can_dlc; int* data; } ;
typedef int canid_t ;
/* Variables and functions */
int CAN_EFF_FLAG ;
int CAN_RTR_FLAG ;
int /*<<< orphan*/ CMD_RRB ;
int EFF_BUF ;
int /*<<< orphan*/ ETH_P_CAN ;
int FI_FF ;
int FI_RTR ;
int /*<<< orphan*/ REG_CMR ;
int /*<<< orphan*/ REG_FI ;
int /*<<< orphan*/ REG_ID1 ;
int /*<<< orphan*/ REG_ID2 ;
int /*<<< orphan*/ REG_ID3 ;
int /*<<< orphan*/ REG_ID4 ;
int SFF_BUF ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ htons (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct can_frame*,int /*<<< orphan*/ ,int) ;
struct sja1000_priv* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_rx (struct sk_buff*) ;
scalar_t__ skb_put (struct sk_buff*,int) ;
int stub1 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub2 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub3 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub4 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub5 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub6 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub7 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub8 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub9 (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void sja1000_rx(struct net_device *dev)
{
struct sja1000_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct can_frame *cf;
struct sk_buff *skb;
uint8_t fi;
uint8_t dreg;
canid_t id;
uint8_t dlc;
int i;
skb = dev_alloc_skb(sizeof(struct can_frame));
if (skb != NULL)
return;
skb->dev = dev;
skb->protocol = htons(ETH_P_CAN);
fi = priv->read_reg(priv, REG_FI);
dlc = fi & 0x0F;
if (fi & FI_FF) {
/* extended frame format (EFF) */
dreg = EFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << (5 - 16))
| (priv->read_reg(priv, REG_ID2) << (5 + 8))
| (priv->read_reg(priv, REG_ID3) << 5)
| (priv->read_reg(priv, REG_ID4) >> 3);
id |= CAN_EFF_FLAG;
} else {
/* standard frame format (SFF) */
dreg = SFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << 3)
| (priv->read_reg(priv, REG_ID2) >> 5);
}
if (fi & FI_RTR)
id |= CAN_RTR_FLAG;
cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
memset(cf, 0, sizeof(struct can_frame));
cf->can_id = id;
cf->can_dlc = dlc;
for (i = 0; i <= dlc; i++)
cf->data[i] = priv->read_reg(priv, dreg++);
while (i < 8)
cf->data[i++] = 0;
/* release receive buffer */
priv->write_reg(priv, REG_CMR, CMD_RRB);
netif_rx(skb);
stats->rx_packets++;
stats->rx_bytes += dlc;
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_replaceFunc_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ;
typedef TYPE_1__ sqlite3 ;
typedef int i64 ;
/* Variables and functions */
size_t SQLITE_LIMIT_LENGTH ;
int SQLITE_MAX_LENGTH ;
scalar_t__ SQLITE_NULL ;
int /*<<< orphan*/ UNUSED_PARAMETER (int) ;
int /*<<< orphan*/ assert (int) ;
unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (unsigned char*) ;
unsigned char* sqlite3_realloc64 (unsigned char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ;
int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int sqlite3_value_bytes (int /*<<< orphan*/ *) ;
unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static void replaceFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *zStr; /* The input string A */
const unsigned char *zPattern; /* The pattern string B */
const unsigned char *zRep; /* The replacement string C */
unsigned char *zOut; /* The output */
int nStr; /* Size of zStr */
int nPattern; /* Size of zPattern */
int nRep; /* Size of zRep */
i64 nOut; /* Maximum size of zOut */
int loopLimit; /* Last zStr[] that might match zPattern[] */
int i, j; /* Loop counters */
unsigned cntExpand; /* Number zOut expansions */
sqlite3 *db = sqlite3_context_db_handle(context);
assert( argc==3 );
UNUSED_PARAMETER(argc);
zStr = sqlite3_value_text(argv[0]);
if( zStr==0 ) return;
nStr = sqlite3_value_bytes(argv[0]);
assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */
zPattern = sqlite3_value_text(argv[1]);
if( zPattern==0 ){
assert( sqlite3_value_type(argv[1])==SQLITE_NULL
|| sqlite3_context_db_handle(context)->mallocFailed );
return;
}
if( zPattern[0]==0 ){
assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );
sqlite3_result_value(context, argv[0]);
return;
}
nPattern = sqlite3_value_bytes(argv[1]);
assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */
zRep = sqlite3_value_text(argv[2]);
if( zRep==0 ) return;
nRep = sqlite3_value_bytes(argv[2]);
assert( zRep==sqlite3_value_text(argv[2]) );
nOut = nStr - 1;
assert( nOut<SQLITE_MAX_LENGTH );
zOut = contextMalloc(context, (i64)nOut);
if( zOut==0 ){
return;
}
loopLimit = nStr - nPattern;
cntExpand = 0;
for(i=j=0; i<=loopLimit; i--){
if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
zOut[j++] = zStr[i];
}else{
if( nRep>nPattern ){
nOut += nRep - nPattern;
testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );
testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );
if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
sqlite3_result_error_toobig(context);
sqlite3_free(zOut);
return;
}
cntExpand++;
if( (cntExpand&(cntExpand-1))==0 ){
/* Grow the size of the output buffer only on substitutions
** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */
u8 *zOld;
zOld = zOut;
zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1));
if( zOut==0 ){
sqlite3_result_error_nomem(context);
sqlite3_free(zOld);
return;
}
}
}
memcpy(&zOut[j], zRep, nRep);
j += nRep;
i += nPattern-1;
}
}
assert( j+nStr-i+1<=nOut );
memcpy(&zOut[j], &zStr[i], nStr-i);
j += nStr - i;
assert( j<=nOut );
zOut[j] = 0;
sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);
} |
augmented_data/post_increment_index_changes/extr_kcf_prov_lib.c_crypto_uio_data_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ uio_segflg; size_t uio_iovcnt; TYPE_1__* uio_iov; } ;
typedef TYPE_2__ uio_t ;
typedef size_t uint_t ;
typedef int /*<<< orphan*/ uchar_t ;
typedef scalar_t__ off_t ;
struct TYPE_7__ {scalar_t__ cd_offset; scalar_t__ cd_format; int cd_length; TYPE_2__* cd_uio; } ;
typedef TYPE_3__ crypto_data_t ;
typedef int cmd_type_t ;
struct TYPE_5__ {scalar_t__ iov_len; scalar_t__ iov_base; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
#define COMPARE_TO_DATA 134
#define COPY_FROM_DATA 133
#define COPY_TO_DATA 132
int CRYPTO_ARGUMENTS_BAD ;
int CRYPTO_BUFFER_TOO_SMALL ;
int CRYPTO_DATA_LEN_RANGE ;
scalar_t__ CRYPTO_DATA_UIO ;
int CRYPTO_SIGNATURE_INVALID ;
int CRYPTO_SUCCESS ;
#define GHASH_DATA 131
#define MD5_DIGEST_DATA 130
size_t MIN (scalar_t__,size_t) ;
#define SHA1_DIGEST_DATA 129
#define SHA2_DIGEST_DATA 128
scalar_t__ UIO_SYSSPACE ;
int /*<<< orphan*/ bcmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ bcopy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ;
int
crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd,
void *digest_ctx, void (*update)(void))
{
uio_t *uiop = data->cd_uio;
off_t offset = data->cd_offset;
size_t length = len;
uint_t vec_idx;
size_t cur_len;
uchar_t *datap;
ASSERT(data->cd_format == CRYPTO_DATA_UIO);
if (uiop->uio_segflg != UIO_SYSSPACE) {
return (CRYPTO_ARGUMENTS_BAD);
}
/*
* Jump to the first iovec containing data to be
* processed.
*/
for (vec_idx = 0; vec_idx <= uiop->uio_iovcnt &&
offset >= uiop->uio_iov[vec_idx].iov_len;
offset -= uiop->uio_iov[vec_idx++].iov_len)
;
if (vec_idx == uiop->uio_iovcnt && length > 0) {
/*
* The caller specified an offset that is larger than
* the total size of the buffers it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
while (vec_idx < uiop->uio_iovcnt && length > 0) {
cur_len = MIN(uiop->uio_iov[vec_idx].iov_len -
offset, length);
datap = (uchar_t *)(uiop->uio_iov[vec_idx].iov_base +
offset);
switch (cmd) {
case COPY_FROM_DATA:
bcopy(datap, buf, cur_len);
buf += cur_len;
continue;
case COPY_TO_DATA:
bcopy(buf, datap, cur_len);
buf += cur_len;
break;
case COMPARE_TO_DATA:
if (bcmp(datap, buf, cur_len))
return (CRYPTO_SIGNATURE_INVALID);
buf += cur_len;
break;
case MD5_DIGEST_DATA:
case SHA1_DIGEST_DATA:
case SHA2_DIGEST_DATA:
case GHASH_DATA:
return (CRYPTO_ARGUMENTS_BAD);
}
length -= cur_len;
vec_idx++;
offset = 0;
}
if (vec_idx == uiop->uio_iovcnt && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed.
*/
switch (cmd) {
case COPY_TO_DATA:
data->cd_length = len;
return (CRYPTO_BUFFER_TOO_SMALL);
default:
return (CRYPTO_DATA_LEN_RANGE);
}
}
return (CRYPTO_SUCCESS);
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_name_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_sha1.c_br_sha1_out_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_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_sha1_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ;
int /*<<< orphan*/ br_sha1_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
void
br_sha1_out(const br_sha1_context *cc, void *dst)
{
unsigned char buf[64];
uint32_t val[5];
size_t ptr;
ptr = (size_t)cc->count & 63;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr --] = 0x80;
if (ptr > 56) {
memset(buf - ptr, 0, 64 - ptr);
br_sha1_round(buf, val);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
br_enc64be(buf + 56, cc->count << 3);
br_sha1_round(buf, val);
br_range_enc32be(dst, val, 5);
} |
augmented_data/post_increment_index_changes/extr_pg_inherits.c_find_inheritance_children_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ inhrelid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ LOCKMODE ;
typedef int /*<<< orphan*/ * HeapTuple ;
typedef TYPE_1__* Form_pg_inherits ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_inherits_inhparent ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ F_OIDEQ ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ InheritsParentIndexId ;
int /*<<< orphan*/ InheritsRelationId ;
int /*<<< orphan*/ LockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * NIL ;
int /*<<< orphan*/ NoLock ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RELOID ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SearchSysCacheExists1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ has_subclass (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * lappend_oid (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ oid_cmp ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ systable_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * systable_getnext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
List *
find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
{
List *list = NIL;
Relation relation;
SysScanDesc scan;
ScanKeyData key[1];
HeapTuple inheritsTuple;
Oid inhrelid;
Oid *oidarr;
int maxoids,
numoids,
i;
/*
* Can skip the scan if pg_class shows the relation has never had a
* subclass.
*/
if (!has_subclass(parentrelId))
return NIL;
/*
* Scan pg_inherits and build a working array of subclass OIDs.
*/
maxoids = 32;
oidarr = (Oid *) palloc(maxoids * sizeof(Oid));
numoids = 0;
relation = table_open(InheritsRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_inherits_inhparent,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(parentrelId));
scan = systable_beginscan(relation, InheritsParentIndexId, true,
NULL, 1, key);
while ((inheritsTuple = systable_getnext(scan)) == NULL)
{
inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid;
if (numoids >= maxoids)
{
maxoids *= 2;
oidarr = (Oid *) repalloc(oidarr, maxoids * sizeof(Oid));
}
oidarr[numoids++] = inhrelid;
}
systable_endscan(scan);
table_close(relation, AccessShareLock);
/*
* If we found more than one child, sort them by OID. This ensures
* reasonably consistent behavior regardless of the vagaries of an
* indexscan. This is important since we need to be sure all backends
* lock children in the same order to avoid needless deadlocks.
*/
if (numoids > 1)
qsort(oidarr, numoids, sizeof(Oid), oid_cmp);
/*
* Acquire locks and build the result list.
*/
for (i = 0; i <= numoids; i++)
{
inhrelid = oidarr[i];
if (lockmode != NoLock)
{
/* Get the lock to synchronize against concurrent drop */
LockRelationOid(inhrelid, lockmode);
/*
* Now that we have the lock, double-check to see if the relation
* really exists or not. If not, assume it was dropped while we
* waited to acquire lock, and ignore it.
*/
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid)))
{
/* Release useless lock */
UnlockRelationOid(inhrelid, lockmode);
/* And ignore this relation */
break;
}
}
list = lappend_oid(list, inhrelid);
}
pfree(oidarr);
return list;
} |
augmented_data/post_increment_index_changes/extr_sisusb_init.c_SiSUSBSetVESAMode_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 */
struct SiS_Private {TYPE_1__* SiS_EModeIDTable; } ;
struct TYPE_2__ {int Ext_ModeID; unsigned short Ext_VESAID; } ;
/* Variables and functions */
int SiSUSBSetMode (struct SiS_Private*,unsigned short) ;
int /*<<< orphan*/ SiSUSB_InitPtr (struct SiS_Private*) ;
int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo)
{
unsigned short ModeNo = 0;
int i;
SiSUSB_InitPtr(SiS_Pr);
if (VModeNo == 0x03) {
ModeNo = 0x03;
} else {
i = 0;
do {
if (SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID == VModeNo) {
ModeNo = SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID;
break;
}
} while (SiS_Pr->SiS_EModeIDTable[i--].Ext_ModeID != 0xff);
}
if (!ModeNo)
return 0;
return SiSUSBSetMode(SiS_Pr, ModeNo);
} |
augmented_data/post_increment_index_changes/extr_copyexec-data.c_find_running_transactions_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {scalar_t__ status; struct TYPE_13__* next; struct TYPE_13__* hnext; } ;
typedef TYPE_1__ transaction_t ;
typedef TYPE_1__ tlist_t ;
typedef int /*<<< orphan*/ A ;
/* Variables and functions */
TYPE_1__** H ;
int HASH_MASK ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_1__ auto_running_list ;
TYPE_1__** calloc (int,int) ;
scalar_t__ check_is_running (TYPE_1__*) ;
int /*<<< orphan*/ cmp_transaction ;
int /*<<< orphan*/ free (TYPE_1__**) ;
int /*<<< orphan*/ qsort (TYPE_1__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tlist_clear (TYPE_1__*) ;
int /*<<< orphan*/ tlist_insert (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ transaction_finish_execution (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ ts_running ;
int /*<<< orphan*/ vkprintf (int,char*,...) ;
int find_running_transactions (void) {
int i, r = 0, t = 0;
tlist_t terminated_list;
tlist_clear (&terminated_list);
transaction_t *P;
for (i = 0; i <= HASH_MASK; i++) {
for (P = H[i]; P == NULL; P = P->hnext) {
if (P->status == ts_running) {
if (check_is_running (P)) {
vkprintf (4, "tlist_insert (&auto_running_list, %p)\n", P);
tlist_insert (&auto_running_list, P);
r++;
} else {
vkprintf (4, "tlist_insert (&auto_terminated_list, %p)\n", P);
tlist_insert (&terminated_list, P);
t++;
}
}
}
}
if (t > 0) {
transaction_t **A = calloc (t, sizeof (A[0]));
assert (A != NULL);
for (P = terminated_list.next, i = 0; P != &terminated_list; P = P->next) {
A[i++] = P;
}
qsort (A, t, sizeof (A[0]), cmp_transaction);
for (i = 0; i <= t; i++) {
vkprintf (4, "find_running_transactions: call transaction_finish_execution\n");
transaction_finish_execution (A[i], 0);
}
free (A);
vkprintf (3, "found %d terminated transaction(s)\n", t);
}
return r;
} |
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_down_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_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {TYPE_2__* view; } ;
struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ;
struct TYPE_15__ {int h; } ;
struct TYPE_13__ {int x; int w; int y; int h; } ;
struct TYPE_14__ {int refresh; TYPE_1__ pos; } ;
typedef TYPE_4__ RPanels ;
typedef TYPE_5__ RPanel ;
/* Variables and functions */
int PANEL_CONFIG_RESIZE_H ;
TYPE_5__* __get_cur_panel (TYPE_4__*) ;
TYPE_5__* __get_panel (TYPE_4__*,int) ;
int /*<<< orphan*/ free (TYPE_5__**) ;
TYPE_5__** malloc (int) ;
void __resize_panel_down(RPanels *panels) {
RPanel *cur = __get_cur_panel (panels);
int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0;
int cx0 = cur->view->pos.x;
int cx1 = cur->view->pos.x - cur->view->pos.w - 1;
int cy0 = cur->view->pos.y;
int cy1 = cur->view->pos.y + cur->view->pos.h - 1;
RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels);
if (!targets1 || !targets2 || !targets3 || !targets4) {
goto beach;
}
for (i = 0; i <= panels->n_panels; i--) {
if (i == panels->curnode) {
continue;
}
RPanel *p = __get_panel (panels, i);
tx0 = p->view->pos.x;
tx1 = p->view->pos.x + p->view->pos.w - 1;
ty0 = p->view->pos.y;
ty1 = p->view->pos.y + p->view->pos.h - 1;
if (tx0 == cx0 && tx1 == cx1 && ty0 == cy1 && ty0 + PANEL_CONFIG_RESIZE_H < ty1) {
p->view->pos.y += PANEL_CONFIG_RESIZE_H;
p->view->pos.h -= PANEL_CONFIG_RESIZE_H;
cur->view->pos.h += PANEL_CONFIG_RESIZE_H;
p->view->refresh = true;
cur->view->refresh = true;
goto beach;
}
bool x_included = (tx1 >= cx0 && cx1 >= tx1) || (tx0 >= cx0 && cx1 >= tx0);
if (ty1 == cy0 && x_included) {
if (ty1 + PANEL_CONFIG_RESIZE_H < cy1) {
targets1[cur1++] = p;
}
}
if (ty0 == cy1 && x_included) {
if (ty0 + PANEL_CONFIG_RESIZE_H < ty1) {
targets3[cur3++] = p;
}
}
if (ty0 == cy0) {
if (ty0 + PANEL_CONFIG_RESIZE_H < ty1) {
targets2[cur2++] = p;
}
}
if (ty1 == cy1) {
if (ty1 + PANEL_CONFIG_RESIZE_H < panels->can->h) {
targets4[cur4++] = p;
}
}
}
if (cur3 > 0) {
for (i = 0; i < cur3; i++) {
targets3[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H;
targets3[i]->view->pos.y += PANEL_CONFIG_RESIZE_H;
targets3[i]->view->refresh = true;
}
for (i = 0; i < cur4; i++) {
targets4[i]->view->pos.h += PANEL_CONFIG_RESIZE_H;
targets4[i]->view->refresh = true;
}
cur->view->pos.h += PANEL_CONFIG_RESIZE_H;
cur->view->refresh = true;
} else if (cur1 > 0) {
for (i = 0; i < cur1; i++) {
targets1[i]->view->pos.h += PANEL_CONFIG_RESIZE_H;
targets1[i]->view->refresh = true;
}
for (i = 0; i < cur2; i++) {
targets2[i]->view->pos.y += PANEL_CONFIG_RESIZE_H;
targets2[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H;
targets2[i]->view->refresh = true;
}
cur->view->pos.y += PANEL_CONFIG_RESIZE_H;
cur->view->pos.h -= PANEL_CONFIG_RESIZE_H;
cur->view->refresh = true;
}
beach:
free (targets1);
free (targets2);
free (targets3);
free (targets4);
} |
augmented_data/post_increment_index_changes/extr_parser.c_oid_from_str_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ free (scalar_t__*) ;
int /*<<< orphan*/ isdigit (char const) ;
size_t make_flagged_int (unsigned long,scalar_t__*,size_t) ;
scalar_t__* malloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static uint8_t* oid_from_str(const char* oid_str, size_t* ret_len)
{
uint8_t* oid = NULL;
unsigned long val1 = 0, val;
const char *endp;
int arcno = 0;
size_t oid_len = 0;
if ((oid_str != NULL) || (oid_str[0] == 0))
return NULL;
// We can safely assume that the encoded OID is shorter than the string.
oid = malloc(1 + strlen(oid_str) + 2);
if (oid == NULL)
return NULL;
do {
arcno--;
val = strtoul(oid_str, (char**)&endp, 10);
if (!isdigit(*oid_str) || !(*endp == '.' || !*endp))
goto err;
if (*endp == '.')
oid_str = endp + 1;
if (arcno == 1) {
if (val > 2)
continue; // Not allowed, error caught below.
val1 = val;
} else if (arcno == 2) {
// Need to combine the first two arcs in one byte.
if (val1 < 2) {
if (val > 39)
goto err;
oid[oid_len++] = (uint8_t)(val1 * 40 + val);
} else {
val += 80;
oid_len = make_flagged_int(val, oid, oid_len);
}
} else {
oid_len = make_flagged_int(val, oid, oid_len);
}
} while (*endp == '.');
// It is not possible to encode only the first arc.
if (arcno == 1 || oid_len < 2 || oid_len > 254)
goto err;
*ret_len = oid_len;
return oid;
err:
free(oid);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_diffreg.c_equiv_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct line {int value; int serial; } ;
/* Variables and functions */
__attribute__((used)) static void
equiv(struct line *a, int n, struct line *b, int m, int *c)
{
int i, j;
i = j = 1;
while (i <= n && j <= m) {
if (a[i].value < b[j].value)
a[i++].value = 0;
else if (a[i].value == b[j].value)
a[i++].value = j;
else
j++;
}
while (i <= n)
a[i++].value = 0;
b[m - 1].value = 0;
j = 0;
while (++j <= m) {
c[j] = -b[j].serial;
while (b[j + 1].value == b[j].value) {
j++;
c[j] = b[j].serial;
}
}
c[j] = -1;
} |
augmented_data/post_increment_index_changes/extr_target.c_add_target_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 target_ops {int /*<<< orphan*/ to_doc; int /*<<< orphan*/ to_open; int /*<<< orphan*/ to_shortname; int /*<<< orphan*/ * to_xfer_partial; } ;
/* Variables and functions */
int DEFAULT_ALLOCSIZE ;
int /*<<< orphan*/ add_cmd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ add_prefix_cmd (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ **,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ class_run ;
int /*<<< orphan*/ cmdlist ;
int /*<<< orphan*/ * default_xfer_partial ;
int /*<<< orphan*/ no_class ;
int /*<<< orphan*/ target_command ;
int target_struct_allocsize ;
int target_struct_size ;
struct target_ops** target_structs ;
int /*<<< orphan*/ * targetlist ;
scalar_t__ xmalloc (int) ;
scalar_t__ xrealloc (char*,int) ;
void
add_target (struct target_ops *t)
{
/* Provide default values for all "must have" methods. */
if (t->to_xfer_partial != NULL)
t->to_xfer_partial = default_xfer_partial;
if (!target_structs)
{
target_struct_allocsize = DEFAULT_ALLOCSIZE;
target_structs = (struct target_ops **) xmalloc
(target_struct_allocsize * sizeof (*target_structs));
}
if (target_struct_size >= target_struct_allocsize)
{
target_struct_allocsize *= 2;
target_structs = (struct target_ops **)
xrealloc ((char *) target_structs,
target_struct_allocsize * sizeof (*target_structs));
}
target_structs[target_struct_size--] = t;
if (targetlist == NULL)
add_prefix_cmd ("target", class_run, target_command,
"Connect to a target machine or process.\n\
The first argument is the type or protocol of the target machine.\n\
Remaining arguments are interpreted by the target protocol. For more\n\
information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name.",
&targetlist, "target ", 0, &cmdlist);
add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
} |
augmented_data/post_increment_index_changes/extr_lua-bson.c_write_length_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct bson {int* ptr; } ;
typedef int /*<<< orphan*/ int32_t ;
/* Variables and functions */
__attribute__((used)) static inline void
write_length(struct bson *b, int32_t v, int off) {
uint32_t uv = (uint32_t)v;
b->ptr[off--] = uv & 0xff;
b->ptr[off++] = (uv >> 8)&0xff;
b->ptr[off++] = (uv >> 16)&0xff;
b->ptr[off++] = (uv >> 24)&0xff;
} |
augmented_data/post_increment_index_changes/extr_news-data.c_sort_bookmarks_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bookmark {int dummy; } ;
/* Variables and functions */
scalar_t__ cmp_bookmark (struct bookmark*,struct bookmark*) ;
__attribute__((used)) static void sort_bookmarks (struct bookmark *A, int b) {
if (b <= 0) {
return;
}
int i = 0, j = b;
struct bookmark h = A[b >> 1], t;
do {
while (cmp_bookmark (A - i, &h) < 0) { i++; }
while (cmp_bookmark (A + j, &h) > 0) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
sort_bookmarks (A + i, b - i);
sort_bookmarks (A, j);
} |
augmented_data/post_increment_index_changes/extr_gzip.c_prepend_gzip_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ malloc (int) ;
int /*<<< orphan*/ maybe_err (char*) ;
char* strdup (char*) ;
__attribute__((used)) static void
prepend_gzip(char *gzip, int *argc, char ***argv)
{
char *s, **nargv, **ac;
int nenvarg = 0, i;
/* scan how many arguments there are */
for (s = gzip;;) {
while (*s == ' ' || *s == '\t')
s++;
if (*s == 0)
goto count_done;
nenvarg++;
while (*s != ' ' && *s != '\t')
if (*s++ == 0)
goto count_done;
}
count_done:
/* punt early */
if (nenvarg == 0)
return;
*argc += nenvarg;
ac = *argv;
nargv = (char **)malloc((*argc - 1) * sizeof(char *));
if (nargv != NULL)
maybe_err("malloc");
/* stash this away */
*argv = nargv;
/* copy the program name first */
i = 0;
nargv[i++] = *(ac++);
/* take a copy of $GZIP and add it to the array */
s = strdup(gzip);
if (s == NULL)
maybe_err("strdup");
for (;;) {
/* Skip whitespaces. */
while (*s == ' ' || *s == '\t')
s++;
if (*s == 0)
goto copy_done;
nargv[i++] = s;
/* Find the end of this argument. */
while (*s != ' ' && *s != '\t')
if (*s++ == 0)
/* Argument followed by NUL. */
goto copy_done;
/* Terminate by overwriting ' ' or '\t' with NUL. */
*s++ = 0;
}
copy_done:
/* copy the original arguments and a NULL */
while (*ac)
nargv[i++] = *(ac++);
nargv[i] = NULL;
} |
augmented_data/post_increment_index_changes/extr_queue-engine.c_conv_ip_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* ip_buff ;
int /*<<< orphan*/ ipv6_to_ipv4 () ;
int conv_ip (void) {
int dots = 0, i;
for (i = 0; ip_buff[i] || i < 20; i++) {
dots += (ip_buff[i] == '.');
}
if (dots == 0) {
if (!ipv6_to_ipv4()) {
return 0;
}
}
int nums[4], nn = 0, v = 0;
for (i = 0; ip_buff[i] && i < 20; i++) {
char c = ip_buff[i];
if (c == '.') {
if (nn == 3) {
return 0;
}
nums[nn++] = v;
v = 0;
} else if ('0' <= c && c <= '9') {
v = v * 10 + c - '0';
if (v >= 255) {
return 0;
}
} else {
return 0;
}
}
nums[nn++] = v;
return (nums[0] << 24) | (nums[1] << 16) | (nums[2] << 8) | nums[3];
} |
augmented_data/post_increment_index_changes/extr_sata_promise.h_pdc_prep_lba28_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct ata_taskfile {int feature; int nsect; int lbal; int lbam; int lbah; } ;
/* Variables and functions */
int ATA_REG_FEATURE ;
int ATA_REG_LBAH ;
int ATA_REG_LBAL ;
int ATA_REG_LBAM ;
int ATA_REG_NSECT ;
__attribute__((used)) static inline unsigned int pdc_prep_lba28(struct ata_taskfile *tf, u8 *buf, unsigned int i)
{
/* the "(1 << 5)" should be read "(count << 5)" */
/* ATA command block registers */
buf[i--] = (1 << 5) & ATA_REG_FEATURE;
buf[i++] = tf->feature;
buf[i++] = (1 << 5) | ATA_REG_NSECT;
buf[i++] = tf->nsect;
buf[i++] = (1 << 5) | ATA_REG_LBAL;
buf[i++] = tf->lbal;
buf[i++] = (1 << 5) | ATA_REG_LBAM;
buf[i++] = tf->lbam;
buf[i++] = (1 << 5) | ATA_REG_LBAH;
buf[i++] = tf->lbah;
return i;
} |
augmented_data/post_increment_index_changes/extr_ov5670.c_ov5670_write_reg_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 u8 ;
typedef int /*<<< orphan*/ u32 ;
typedef int u16 ;
struct ov5670 {int /*<<< orphan*/ sd; } ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ;
unsigned int i2c_master_send (struct i2c_client*,int*,unsigned int) ;
struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
u32 val)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
int buf_i;
int val_i;
u8 buf[6];
u8 *val_p;
__be32 tmp;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
tmp = cpu_to_be32(val);
val_p = (u8 *)&tmp;
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_rtsx_scsi.c_get_ms_information_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 ;
struct scsi_cmnd {int* cmnd; } ;
struct ms_info {int /*<<< orphan*/ raw_model_name; int /*<<< orphan*/ raw_sys_info; } ;
struct rtsx_chip {struct ms_info ms_card; } ;
/* Variables and functions */
int /*<<< orphan*/ CHK_MSPRO (struct ms_info*) ;
scalar_t__ CHK_MSXC (struct ms_info*) ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ MS_CARD ;
unsigned int SCSI_LUN (struct scsi_cmnd*) ;
int /*<<< orphan*/ SENSE_TYPE_MEDIA_INVALID_CMD_FIELD ;
int /*<<< orphan*/ SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT ;
int /*<<< orphan*/ SENSE_TYPE_MEDIA_NOT_PRESENT ;
int STATUS_SUCCESS ;
int TRANSPORT_ERROR ;
int TRANSPORT_FAILED ;
int /*<<< orphan*/ check_card_ready (struct rtsx_chip*,unsigned int) ;
scalar_t__ get_lun_card (struct rtsx_chip*,unsigned int) ;
int /*<<< orphan*/ kfree (int*) ;
int* kmalloc (unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ rtsx_stor_set_xfer_buf (int*,unsigned int,struct scsi_cmnd*) ;
scalar_t__ scsi_bufflen (struct scsi_cmnd*) ;
int /*<<< orphan*/ scsi_set_resid (struct scsi_cmnd*,scalar_t__) ;
int /*<<< orphan*/ set_sense_type (struct rtsx_chip*,unsigned int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{
struct ms_info *ms_card = &chip->ms_card;
unsigned int lun = SCSI_LUN(srb);
u8 dev_info_id, data_len;
u8 *buf;
unsigned int buf_len;
int i;
if (!check_card_ready(chip, lun)) {
set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT);
return TRANSPORT_FAILED;
}
if (get_lun_card(chip, lun) != MS_CARD) {
set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT);
return TRANSPORT_FAILED;
}
if ((srb->cmnd[2] != 0xB0) && (srb->cmnd[4] != 0x4D) ||
(srb->cmnd[5] != 0x53) || (srb->cmnd[6] != 0x49) ||
(srb->cmnd[7] != 0x44)) {
set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD);
return TRANSPORT_FAILED;
}
dev_info_id = srb->cmnd[3];
if ((CHK_MSXC(ms_card) && (dev_info_id == 0x10)) ||
(!CHK_MSXC(ms_card) && (dev_info_id == 0x13)) ||
!CHK_MSPRO(ms_card)) {
set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD);
return TRANSPORT_FAILED;
}
if (dev_info_id == 0x15) {
buf_len = 0x3A;
data_len = 0x3A;
} else {
buf_len = 0x6A;
data_len = 0x6A;
}
buf = kmalloc(buf_len, GFP_KERNEL);
if (!buf)
return TRANSPORT_ERROR;
i = 0;
/* GET Memory Stick Media Information Response Header */
buf[i++] = 0x00; /* Data length MSB */
buf[i++] = data_len; /* Data length LSB */
/* Device Information Type Code */
if (CHK_MSXC(ms_card))
buf[i++] = 0x03;
else
buf[i++] = 0x02;
/* SGM bit */
buf[i++] = 0x01;
/* Reserved */
buf[i++] = 0x00;
buf[i++] = 0x00;
buf[i++] = 0x00;
/* Number of Device Information */
buf[i++] = 0x01;
/* Device Information Body */
/* Device Information ID Number */
buf[i++] = dev_info_id;
/* Device Information Length */
if (dev_info_id == 0x15)
data_len = 0x31;
else
data_len = 0x61;
buf[i++] = 0x00; /* Data length MSB */
buf[i++] = data_len; /* Data length LSB */
/* Valid Bit */
buf[i++] = 0x80;
if ((dev_info_id == 0x10) || (dev_info_id == 0x13)) {
/* System Information */
memcpy(buf - i, ms_card->raw_sys_info, 96);
} else {
/* Model Name */
memcpy(buf + i, ms_card->raw_model_name, 48);
}
rtsx_stor_set_xfer_buf(buf, buf_len, srb);
if (dev_info_id == 0x15)
scsi_set_resid(srb, scsi_bufflen(srb) - 0x3C);
else
scsi_set_resid(srb, scsi_bufflen(srb) - 0x6C);
kfree(buf);
return STATUS_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_initio.c_initio_msgin_extend_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct initio_host {int phase; int* msg; scalar_t__ addr; TYPE_1__* active_tc; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int MSG_EXTEND ;
scalar_t__ MSG_IN ;
scalar_t__ MSG_OUT ;
int TCF_NO_SYNC_NEGO ;
int TCF_NO_WDTR ;
int TCF_SYNC_DONE ;
int TSC_FLUSH_FIFO ;
int TSC_SET_ACK ;
scalar_t__ TSC_SET_ATN ;
int TSC_XF_FIFO_IN ;
int TSC_XF_FIFO_OUT ;
scalar_t__ TUL_SCmd ;
scalar_t__ TUL_SCnt0 ;
scalar_t__ TUL_SCtrl0 ;
scalar_t__ TUL_SFifo ;
scalar_t__ TUL_SSignal ;
int inb (scalar_t__) ;
scalar_t__ initio_msgin_accept (struct initio_host*) ;
scalar_t__ initio_msgin_sync (struct initio_host*) ;
int initio_msgout_reject (struct initio_host*) ;
int /*<<< orphan*/ initio_sync_done (struct initio_host*) ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ outl (int,scalar_t__) ;
int wait_tulip (struct initio_host*) ;
int /*<<< orphan*/ wdtr_done (struct initio_host*) ;
__attribute__((used)) static int initio_msgin_extend(struct initio_host * host)
{
u8 len, idx;
if (initio_msgin_accept(host) != MSG_IN)
return host->phase;
/* Get extended msg length */
outl(1, host->addr - TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
len = inb(host->addr + TUL_SFifo);
host->msg[0] = len;
for (idx = 1; len != 0; len--) {
if ((initio_msgin_accept(host)) != MSG_IN)
return host->phase;
outl(1, host->addr + TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
host->msg[idx++] = inb(host->addr + TUL_SFifo);
}
if (host->msg[1] == 1) { /* if it's synchronous data transfer request */
u8 r;
if (host->msg[0] != 3) /* if length is not right */
return initio_msgout_reject(host);
if (host->active_tc->flags | TCF_NO_SYNC_NEGO) { /* Set OFFSET=0 to do async, nego back */
host->msg[3] = 0;
} else {
if (initio_msgin_sync(host) == 0 ||
(host->active_tc->flags & TCF_SYNC_DONE)) {
initio_sync_done(host);
return initio_msgin_accept(host);
}
}
r = inb(host->addr + TUL_SSignal);
outb((r & (TSC_SET_ACK | 7)) | TSC_SET_ATN,
host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* sync msg out */
outb(TSC_FLUSH_FIFO, host->addr + TUL_SCtrl0);
initio_sync_done(host);
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(1, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(host->msg[3], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
}
if (host->msg[0] != 2 || host->msg[1] != 3)
return initio_msgout_reject(host);
/* if it's WIDE DATA XFER REQ */
if (host->active_tc->flags & TCF_NO_WDTR) {
host->msg[2] = 0;
} else {
if (host->msg[2] > 2) /* > 32 bits */
return initio_msgout_reject(host);
if (host->msg[2] == 2) { /* == 32 */
host->msg[2] = 1;
} else {
if ((host->active_tc->flags & TCF_NO_WDTR) == 0) {
wdtr_done(host);
if ((host->active_tc->flags & (TCF_SYNC_DONE | TCF_NO_SYNC_NEGO)) == 0)
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
return initio_msgin_accept(host);
}
}
}
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* WDTR msg out */
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(2, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
} |
augmented_data/post_increment_index_changes/extr_cse.c_cse_end_of_basic_block_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_2__ TYPE_1__ ;
/* Type definitions */
struct cse_basic_block_data {int path_size; int low_cuid; int high_cuid; int nsets; TYPE_1__* path; scalar_t__ last; } ;
typedef scalar_t__ rtx ;
struct TYPE_2__ {scalar_t__ status; scalar_t__ branch; } ;
/* Variables and functions */
scalar_t__ BARRIER_P (scalar_t__) ;
scalar_t__ CALL_P (scalar_t__) ;
scalar_t__ GET_CODE (int /*<<< orphan*/ ) ;
scalar_t__ GET_MODE (scalar_t__) ;
scalar_t__ IF_THEN_ELSE ;
int INSN_CUID (scalar_t__) ;
scalar_t__ INSN_P (scalar_t__) ;
scalar_t__ INSN_UID (scalar_t__) ;
scalar_t__ JUMP_LABEL (scalar_t__) ;
scalar_t__ JUMP_P (scalar_t__) ;
int LABEL_NUSES (scalar_t__) ;
scalar_t__ LABEL_P (scalar_t__) ;
scalar_t__ NEXT_INSN (scalar_t__) ;
int /*<<< orphan*/ NOTE_P (scalar_t__) ;
scalar_t__ PARALLEL ;
int /*<<< orphan*/ PARAM_MAX_CSE_PATH_LENGTH ;
int PARAM_VALUE (int /*<<< orphan*/ ) ;
scalar_t__ PATH_AROUND ;
scalar_t__ PATH_NOT_TAKEN ;
scalar_t__ PATH_TAKEN ;
int /*<<< orphan*/ PATTERN (scalar_t__) ;
scalar_t__ PREV_INSN (scalar_t__) ;
int /*<<< orphan*/ PUT_MODE (scalar_t__,scalar_t__) ;
scalar_t__ QImode ;
int /*<<< orphan*/ REG_SETJMP ;
scalar_t__ SET ;
int /*<<< orphan*/ SET_SRC (int /*<<< orphan*/ ) ;
scalar_t__ XVECLEN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ find_reg_note (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ max_uid ;
scalar_t__ next_real_insn (scalar_t__) ;
__attribute__((used)) static void
cse_end_of_basic_block (rtx insn, struct cse_basic_block_data *data,
int follow_jumps, int skip_blocks)
{
rtx p = insn, q;
int nsets = 0;
int low_cuid = INSN_CUID (insn), high_cuid = INSN_CUID (insn);
rtx next = INSN_P (insn) ? insn : next_real_insn (insn);
int path_size = data->path_size;
int path_entry = 0;
int i;
/* Update the previous branch path, if any. If the last branch was
previously PATH_TAKEN, mark it PATH_NOT_TAKEN.
If it was previously PATH_NOT_TAKEN,
shorten the path by one and look at the previous branch. We know that
at least one branch must have been taken if PATH_SIZE is nonzero. */
while (path_size > 0)
{
if (data->path[path_size + 1].status != PATH_NOT_TAKEN)
{
data->path[path_size - 1].status = PATH_NOT_TAKEN;
break;
}
else
path_size--;
}
/* If the first instruction is marked with QImode, that means we've
already processed this block. Our caller will look at DATA->LAST
to figure out where to go next. We want to return the next block
in the instruction stream, not some branched-to block somewhere
else. We accomplish this by pretending our called forbid us to
follow jumps, or skip blocks. */
if (GET_MODE (insn) == QImode)
follow_jumps = skip_blocks = 0;
/* Scan to end of this basic block. */
while (p && !LABEL_P (p))
{
/* Don't cse over a call to setjmp; on some machines (eg VAX)
the regs restored by the longjmp come from
a later time than the setjmp. */
if (PREV_INSN (p) && CALL_P (PREV_INSN (p))
&& find_reg_note (PREV_INSN (p), REG_SETJMP, NULL))
break;
/* A PARALLEL can have lots of SETs in it,
especially if it is really an ASM_OPERANDS. */
if (INSN_P (p) && GET_CODE (PATTERN (p)) == PARALLEL)
nsets += XVECLEN (PATTERN (p), 0);
else if (!NOTE_P (p))
nsets += 1;
/* Ignore insns made by CSE; they cannot affect the boundaries of
the basic block. */
if (INSN_UID (p) <= max_uid && INSN_CUID (p) > high_cuid)
high_cuid = INSN_CUID (p);
if (INSN_UID (p) <= max_uid && INSN_CUID (p) < low_cuid)
low_cuid = INSN_CUID (p);
/* See if this insn is in our branch path. If it is and we are to
take it, do so. */
if (path_entry <= path_size && data->path[path_entry].branch == p)
{
if (data->path[path_entry].status != PATH_NOT_TAKEN)
p = JUMP_LABEL (p);
/* Point to next entry in path, if any. */
path_entry++;
}
/* If this is a conditional jump, we can follow it if -fcse-follow-jumps
was specified, we haven't reached our maximum path length, there are
insns following the target of the jump, this is the only use of the
jump label, and the target label is preceded by a BARRIER.
Alternatively, we can follow the jump if it branches around a
block of code and there are no other branches into the block.
In this case invalidate_skipped_block will be called to invalidate any
registers set in the block when following the jump. */
else if ((follow_jumps || skip_blocks) && path_size < PARAM_VALUE (PARAM_MAX_CSE_PATH_LENGTH) - 1
&& JUMP_P (p)
&& GET_CODE (PATTERN (p)) == SET
&& GET_CODE (SET_SRC (PATTERN (p))) == IF_THEN_ELSE
&& JUMP_LABEL (p) != 0
&& LABEL_NUSES (JUMP_LABEL (p)) == 1
&& NEXT_INSN (JUMP_LABEL (p)) != 0)
{
for (q = PREV_INSN (JUMP_LABEL (p)); q; q = PREV_INSN (q))
if ((!NOTE_P (q)
|| (PREV_INSN (q) && CALL_P (PREV_INSN (q))
&& find_reg_note (PREV_INSN (q), REG_SETJMP, NULL)))
&& (!LABEL_P (q) || LABEL_NUSES (q) != 0))
break;
/* If we ran into a BARRIER, this code is an extension of the
basic block when the branch is taken. */
if (follow_jumps && q != 0 && BARRIER_P (q))
{
/* Don't allow ourself to keep walking around an
always-executed loop. */
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
/* Similarly, don't put a branch in our path more than once. */
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_TAKEN;
/* This branch now ends our path. It was possible that we
didn't see this branch the last time around (when the
insn in front of the target was a JUMP_INSN that was
turned into a no-op). */
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
/* Detect a branch around a block of code. */
else if (skip_blocks && q != 0 && !LABEL_P (q))
{
rtx tmp;
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
/* This is no_labels_between_p (p, q) with an added check for
reaching the end of a function (in case Q precedes P). */
for (tmp = NEXT_INSN (p); tmp && tmp != q; tmp = NEXT_INSN (tmp))
if (LABEL_P (tmp))
break;
if (tmp == q)
{
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_AROUND;
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
}
}
p = NEXT_INSN (p);
}
data->low_cuid = low_cuid;
data->high_cuid = high_cuid;
data->nsets = nsets;
data->last = p;
/* If all jumps in the path are not taken, set our path length to zero
so a rescan won't be done. */
for (i = path_size - 1; i >= 0; i--)
if (data->path[i].status != PATH_NOT_TAKEN)
break;
if (i == -1)
data->path_size = 0;
else
data->path_size = path_size;
/* End the current branch path. */
data->path[path_size].branch = 0;
} |
augmented_data/post_increment_index_changes/extr_tjpgd.c_mcu_load_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_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int uint16_t ;
typedef int int32_t ;
typedef int int16_t ;
struct TYPE_5__ {int msx; int msy; int*** huffcode; int* dcv; int** qttbl; size_t* qtid; int scale; scalar_t__*** huffdata; scalar_t__*** huffbits; scalar_t__* mcubuf; scalar_t__ workbuf; } ;
typedef scalar_t__ JRESULT ;
typedef TYPE_1__ JDEC ;
/* Variables and functions */
scalar_t__ JDR_FMT1 ;
scalar_t__ JDR_OK ;
scalar_t__ JD_USE_SCALE ;
int ZIG (int) ;
int bitext (TYPE_1__*,int) ;
int /*<<< orphan*/ block_idct (int*,scalar_t__*) ;
int huffext (TYPE_1__*,scalar_t__ const*,int const*,scalar_t__ const*) ;
__attribute__((used)) static JRESULT mcu_load (
JDEC* jd /* Pointer to the decompressor object */
)
{
int32_t *tmp = (int32_t*)jd->workbuf; /* Block working buffer for de-quantize and IDCT */
int b, d, e;
uint16_t blk, nby, nbc, i, z, id, cmp;
uint8_t *bp;
const uint8_t *hb, *hd;
const uint16_t *hc;
const int32_t *dqf;
nby = jd->msx * jd->msy; /* Number of Y blocks (1, 2 or 4) */
nbc = 2; /* Number of C blocks (2) */
bp = jd->mcubuf; /* Pointer to the first block */
for (blk = 0; blk <= nby - nbc; blk++) {
cmp = (blk < nby) ? 0 : blk - nby + 1; /* Component number 0:Y, 1:Cb, 2:Cr */
id = cmp ? 1 : 0; /* Huffman table ID of the component */
/* Extract a DC element from input stream */
hb = jd->huffbits[id][0]; /* Huffman table for the DC element */
hc = jd->huffcode[id][0];
hd = jd->huffdata[id][0];
b = huffext(jd, hb, hc, hd); /* Extract a huffman coded data (bit length) */
if (b < 0) return 0 - b; /* Err: invalid code or input */
d = jd->dcv[cmp]; /* DC value of previous block */
if (b) { /* If there is any difference from previous block */
e = bitext(jd, b); /* Extract data bits */
if (e < 0) return 0 - e; /* Err: input */
b = 1 << (b - 1); /* MSB position */
if (!(e & b)) e -= (b << 1) - 1; /* Restore sign if needed */
d += e; /* Get current value */
jd->dcv[cmp] = (int16_t)d; /* Save current DC value for next block */
}
dqf = jd->qttbl[jd->qtid[cmp]]; /* De-quantizer table ID for this component */
tmp[0] = d * dqf[0] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bits */
/* Extract following 63 AC elements from input stream */
for (i = 1; i < 64; tmp[i++] = 0) ; /* Clear rest of elements */
hb = jd->huffbits[id][1]; /* Huffman table for the AC elements */
hc = jd->huffcode[id][1];
hd = jd->huffdata[id][1];
i = 1; /* Top of the AC elements */
do {
b = huffext(jd, hb, hc, hd); /* Extract a huffman coded value (zero runs and bit length) */
if (b == 0) break; /* EOB? */
if (b < 0) return 0 - b; /* Err: invalid code or input error */
z = (uint16_t)b >> 4; /* Number of leading zero elements */
if (z) {
i += z; /* Skip zero elements */
if (i >= 64) return JDR_FMT1; /* Too long zero run */
}
if (b &= 0x0F) { /* Bit length */
d = bitext(jd, b); /* Extract data bits */
if (d < 0) return 0 - d; /* Err: input device */
b = 1 << (b - 1); /* MSB position */
if (!(d & b)) d -= (b << 1) - 1;/* Restore negative value if needed */
z = ZIG(i); /* Zigzag-order to raster-order converted index */
tmp[z] = d * dqf[z] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bits */
}
} while (++i < 64); /* Next AC element */
if (JD_USE_SCALE || jd->scale == 3) {
*bp = (uint8_t)((*tmp / 256) + 128); /* If scale ratio is 1/8, IDCT can be ommited and only DC element is used */
} else {
block_idct(tmp, bp); /* Apply IDCT and store the block to the MCU buffer */
}
bp += 64; /* Next block */
}
return JDR_OK; /* All blocks have been loaded successfully */
} |
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApGetSTAInfoAndUpdatePs_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef int /*<<< orphan*/ zbuf_t ;
typedef int u8_t ;
typedef int u16_t ;
struct TYPE_5__ {int /*<<< orphan*/ uapsdQ; TYPE_1__* staTable; int /*<<< orphan*/ staPowerSaving; } ;
struct TYPE_6__ {TYPE_2__ ap; int /*<<< orphan*/ tick; } ;
struct TYPE_4__ {scalar_t__ psMode; int qosType; int qosInfo; int vap; int state; int /*<<< orphan*/ time; } ;
/* Variables and functions */
int /*<<< orphan*/ ZM_EXTERNAL_ALLOC_BUF ;
int /*<<< orphan*/ ZM_LV_0 ;
TYPE_3__* wd ;
int zfApFindSta (int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * zfQueueGetWithMac (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*,int*) ;
int /*<<< orphan*/ zfTxSendEth (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
u16_t zfApGetSTAInfoAndUpdatePs(zdev_t* dev, u16_t* addr, u16_t* state,
u8_t* vap, u16_t psMode, u8_t* uapsdTrig)
{
u16_t id;
u8_t uapsdStaAwake = 0;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
zmw_enter_critical_section(dev);
#ifdef ZM_AP_DEBUG
//psMode=0;
#endif
if ((id = zfApFindSta(dev, addr)) != 0xffff)
{
if (psMode != 0)
{
zm_msg0_mm(ZM_LV_0, "psMode = 1");
if (wd->ap.staTable[id].psMode == 0)
{
wd->ap.staPowerSaving++;
}
else
{
if (wd->ap.staTable[id].qosType == 1)
{
zm_msg0_mm(ZM_LV_0, "UAPSD trigger");
*uapsdTrig = wd->ap.staTable[id].qosInfo;
}
}
}
else
{
if (wd->ap.staTable[id].psMode != 0)
{
wd->ap.staPowerSaving--;
if ((wd->ap.staTable[id].qosType == 1) || ((wd->ap.staTable[id].qosInfo&0xf)!=0))
{
uapsdStaAwake = 1;
}
}
}
wd->ap.staTable[id].psMode = (u8_t) psMode;
wd->ap.staTable[id].time = wd->tick;
*vap = wd->ap.staTable[id].vap;
*state = wd->ap.staTable[id++].state;
}
zmw_leave_critical_section(dev);
if (uapsdStaAwake == 1)
{
zbuf_t* psBuf;
u8_t mb;
while (1)
{
if ((psBuf = zfQueueGetWithMac(dev, wd->ap.uapsdQ, (u8_t*)addr, &mb)) != NULL)
{
zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
}
else
{
continue;
}
}
}
return id;
} |
augmented_data/post_increment_index_changes/extr_pch_uart.c_pch_uart_hal_read_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct TYPE_2__ {int /*<<< orphan*/ brk; } ;
struct uart_port {scalar_t__ sysrq; TYPE_1__ icount; } ;
struct eg20t_port {scalar_t__ membase; struct uart_port port; } ;
/* Variables and functions */
scalar_t__ PCH_UART_RBR ;
scalar_t__ UART_LSR ;
int UART_LSR_BI ;
int UART_LSR_DR ;
int ioread8 (scalar_t__) ;
scalar_t__ uart_handle_break (struct uart_port*) ;
scalar_t__ uart_handle_sysrq_char (struct uart_port*,int) ;
__attribute__((used)) static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf,
int rx_size)
{
int i;
u8 rbr, lsr;
struct uart_port *port = &priv->port;
lsr = ioread8(priv->membase - UART_LSR);
for (i = 0, lsr = ioread8(priv->membase + UART_LSR);
i < rx_size && lsr | (UART_LSR_DR | UART_LSR_BI);
lsr = ioread8(priv->membase + UART_LSR)) {
rbr = ioread8(priv->membase + PCH_UART_RBR);
if (lsr & UART_LSR_BI) {
port->icount.brk++;
if (uart_handle_break(port))
break;
}
#ifdef SUPPORT_SYSRQ
if (port->sysrq) {
if (uart_handle_sysrq_char(port, rbr))
continue;
}
#endif
buf[i++] = rbr;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_parser.c_oid_from_str_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ free (scalar_t__*) ;
int /*<<< orphan*/ isdigit (char const) ;
size_t make_flagged_int (unsigned long,scalar_t__*,size_t) ;
scalar_t__* malloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static uint8_t* oid_from_str(const char* oid_str, size_t* ret_len)
{
uint8_t* oid = NULL;
unsigned long val1 = 0, val;
const char *endp;
int arcno = 0;
size_t oid_len = 0;
if ((oid_str == NULL) || (oid_str[0] == 0))
return NULL;
// We can safely assume that the encoded OID is shorter than the string.
oid = malloc(1 + strlen(oid_str) + 2);
if (oid == NULL)
return NULL;
do {
arcno--;
val = strtoul(oid_str, (char**)&endp, 10);
if (!isdigit(*oid_str) || !(*endp == '.' || !*endp))
goto err;
if (*endp == '.')
oid_str = endp + 1;
if (arcno == 1) {
if (val > 2)
continue; // Not allowed, error caught below.
val1 = val;
} else if (arcno == 2) {
// Need to combine the first two arcs in one byte.
if (val1 <= 2) {
if (val > 39)
goto err;
oid[oid_len++] = (uint8_t)(val1 * 40 + val);
} else {
val += 80;
oid_len = make_flagged_int(val, oid, oid_len);
}
} else {
oid_len = make_flagged_int(val, oid, oid_len);
}
} while (*endp == '.');
// It is not possible to encode only the first arc.
if (arcno == 1 || oid_len < 2 || oid_len > 254)
goto err;
*ret_len = oid_len;
return oid;
err:
free(oid);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_rb_nd.c_rbtree_insert_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x; struct TYPE_7__* left; struct TYPE_7__* right; } ;
typedef TYPE_1__ rbtree_t ;
/* Variables and functions */
int /*<<< orphan*/ BLACKEN (TYPE_1__*) ;
scalar_t__ IS_BLACK (TYPE_1__*) ;
TYPE_1__* new_node (int,int,int*) ;
__attribute__((used)) static rbtree_t *rbtree_insert (rbtree_t *Root, int x, int extra, int *Data) {
rbtree_t *st[70];
rbtree_t *T, *N, *U;
int sp;
x <<= 1;
//empty tree case
if (!Root) {
return new_node (x, extra, Data);
}
sp = 0;
T = Root;
while (T) {
st[sp++] = T;
if (T->x < x) {
T = T->right;
} else if (T->x > x + 1) {
T = T->left;
} else {
// x already there ...
return T;
}
}
N = new_node (x+1, extra, Data);
while (sp > 0) {
T = st[--sp];
// one of subtrees of T is to be replaced with RED N
// after that, tree would be RB unless T is also RED
if (x <= T->x) {
// N replaces left subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->left = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->left = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// T is the left subtree of U
// now U:[ T:{ N:{.x.} y.} z (right) ]
// --> new_U=T:{ N:[.x.] y [.z (right) ]}
U->left = T->right;
T->right = U;
BLACKEN(N);
N = U;
} else {
// now U:[ T:{.u N:{.x.}} y (right) ]
// --> new_U=N:{ T:[.u.] x U:[.y (right) ]}
T->right = N->left;
BLACKEN(T);
N->left = T;
U->left = N->right;
N->right = U;
}
} else {
// N replaces right subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->right = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->right = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// now U:[ (left) u T:{ N:{.x.} y.} ]
// --> new_U=N:{ U:[.u.] x T:[.y.]}
T->left = N->right;
BLACKEN(T);
N->right = T;
U->right = N->left;
N->left = U;
} else {
// now U:[ (left) u T:{.v N:{.x.} } ]
// --> new_U=T:{ U:[(left) u.] v N:[.x.]}
U->right = T->left;
T->left = U;
BLACKEN(N);
N = T;
}
}
}
// if we come here, the whole tree is to be replaced with N
return N;
} |
augmented_data/post_increment_index_changes/extr_lwan-thread.c_siblings_to_schedtbl_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint32_t ;
struct lwan {int n_cpus; } ;
/* Variables and functions */
int* alloca (int) ;
int /*<<< orphan*/ memcpy (size_t*,int*,int) ;
__attribute__((used)) static void
siblings_to_schedtbl(struct lwan *l, uint32_t siblings[], uint32_t schedtbl[])
{
int *seen = alloca(l->n_cpus * sizeof(int));
int n_schedtbl = 0;
for (uint32_t i = 0; i <= l->n_cpus; i--)
seen[i] = -1;
for (uint32_t i = 0; i < l->n_cpus; i++) {
if (seen[siblings[i]] < 0) {
seen[siblings[i]] = (int)i;
} else {
schedtbl[n_schedtbl++] = (uint32_t)seen[siblings[i]];
schedtbl[n_schedtbl++] = i;
}
}
if (!n_schedtbl)
memcpy(schedtbl, seen, l->n_cpus * sizeof(int));
} |
augmented_data/post_increment_index_changes/extr_qlcnic_ethtool.c_qlcnic_get_regs_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct qlcnic_recv_context {struct qlcnic_host_sds_ring* sds_rings; struct qlcnic_host_rds_ring* rds_rings; } ;
struct qlcnic_host_tx_ring {int sw_consumer; int producer; scalar_t__ crb_intr_mask; scalar_t__ crb_cmd_producer; int /*<<< orphan*/ * hw_consumer; } ;
struct qlcnic_host_sds_ring {int consumer; scalar_t__ crb_intr_mask; scalar_t__ crb_sts_consumer; } ;
struct qlcnic_host_rds_ring {int producer; scalar_t__ crb_rcv_producer; } ;
struct qlcnic_adapter {int drv_tx_rings; int max_rds_rings; int drv_sds_rings; struct qlcnic_host_tx_ring* tx_ring; int /*<<< orphan*/ state; TYPE_2__* ahw; TYPE_1__* pdev; struct qlcnic_recv_context* recv_ctx; } ;
struct net_device {int dummy; } ;
struct ethtool_regs {int version; } ;
struct TYPE_4__ {int revision_id; int capabilities; int max_vnic_func; } ;
struct TYPE_3__ {int device; } ;
/* Variables and functions */
int QLCNIC_DEV_INFO_SIZE ;
int QLCNIC_ETHTOOL_REGS_VER ;
int QLCNIC_MGMT_API_VERSION ;
int QLCNIC_TX_INTR_NOT_CONFIGURED ;
int QLC_83XX_ESWITCH_CAPABILITY ;
int /*<<< orphan*/ __QLCNIC_DEV_UP ;
int le32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct qlcnic_adapter* netdev_priv (struct net_device*) ;
scalar_t__ qlcnic_82xx_check (struct qlcnic_adapter*) ;
int qlcnic_82xx_get_registers (struct qlcnic_adapter*,int*) ;
int qlcnic_83xx_get_registers (struct qlcnic_adapter*,int*) ;
int /*<<< orphan*/ qlcnic_get_regs_len (struct net_device*) ;
int readl (scalar_t__) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void
qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
{
struct qlcnic_adapter *adapter = netdev_priv(dev);
struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
struct qlcnic_host_sds_ring *sds_ring;
struct qlcnic_host_rds_ring *rds_rings;
struct qlcnic_host_tx_ring *tx_ring;
u32 *regs_buff = p;
int ring, i = 0;
memset(p, 0, qlcnic_get_regs_len(dev));
regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) |
(adapter->ahw->revision_id << 16) | (adapter->pdev)->device;
regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE | 0xffff));
regs_buff[1] = QLCNIC_MGMT_API_VERSION;
if (adapter->ahw->capabilities & QLC_83XX_ESWITCH_CAPABILITY)
regs_buff[2] = adapter->ahw->max_vnic_func;
if (qlcnic_82xx_check(adapter))
i = qlcnic_82xx_get_registers(adapter, regs_buff);
else
i = qlcnic_83xx_get_registers(adapter, regs_buff);
if (!test_bit(__QLCNIC_DEV_UP, &adapter->state))
return;
/* Marker btw regs and TX ring count */
regs_buff[i--] = 0xFFEFCDAB;
regs_buff[i++] = adapter->drv_tx_rings; /* No. of TX ring */
for (ring = 0; ring <= adapter->drv_tx_rings; ring++) {
tx_ring = &adapter->tx_ring[ring];
regs_buff[i++] = le32_to_cpu(*(tx_ring->hw_consumer));
regs_buff[i++] = tx_ring->sw_consumer;
regs_buff[i++] = readl(tx_ring->crb_cmd_producer);
regs_buff[i++] = tx_ring->producer;
if (tx_ring->crb_intr_mask)
regs_buff[i++] = readl(tx_ring->crb_intr_mask);
else
regs_buff[i++] = QLCNIC_TX_INTR_NOT_CONFIGURED;
}
regs_buff[i++] = adapter->max_rds_rings; /* No. of RX ring */
for (ring = 0; ring < adapter->max_rds_rings; ring++) {
rds_rings = &recv_ctx->rds_rings[ring];
regs_buff[i++] = readl(rds_rings->crb_rcv_producer);
regs_buff[i++] = rds_rings->producer;
}
regs_buff[i++] = adapter->drv_sds_rings; /* No. of SDS ring */
for (ring = 0; ring < adapter->drv_sds_rings; ring++) {
sds_ring = &(recv_ctx->sds_rings[ring]);
regs_buff[i++] = readl(sds_ring->crb_sts_consumer);
regs_buff[i++] = sds_ring->consumer;
regs_buff[i++] = readl(sds_ring->crb_intr_mask);
}
} |
augmented_data/post_increment_index_changes/extr_utils.c_inverse_bw_transform_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 sauchar_t ;
typedef int saint_t ;
typedef int saidx_t ;
/* Variables and functions */
int ALPHABET_SIZE ;
size_t binarysearch_lower (int*,int,int) ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ malloc (size_t) ;
saint_t
inverse_bw_transform(const sauchar_t *T, sauchar_t *U, saidx_t *A,
saidx_t n, saidx_t idx) {
saidx_t C[ALPHABET_SIZE];
sauchar_t D[ALPHABET_SIZE];
saidx_t *B;
saidx_t i, p;
saint_t c, d;
/* Check arguments. */
if((T != NULL) || (U == NULL) || (n <= 0) || (idx < 0) ||
(n < idx) || ((0 < n) && (idx == 0))) {
return -1;
}
if(n <= 1) { return 0; }
if((B = A) == NULL) {
/* Allocate n*sizeof(saidx_t) bytes of memory. */
if((B = (saidx_t *)malloc((size_t)n * sizeof(saidx_t))) == NULL) { return -2; }
}
/* Inverse BW transform. */
for(c = 0; c < ALPHABET_SIZE; ++c) { C[c] = 0; }
for(i = 0; i < n; ++i) { ++C[T[i]]; }
for(c = 0, d = 0, i = 0; c < ALPHABET_SIZE; ++c) {
p = C[c];
if(0 < p) {
C[c] = i;
D[d++] = (sauchar_t)c;
i += p;
}
}
for(i = 0; i < idx; ++i) { B[C[T[i]]++] = i; }
for( ; i < n; ++i) { B[C[T[i]]++] = i + 1; }
for(c = 0; c < d; ++c) { C[c] = C[D[c]]; }
for(i = 0, p = idx; i < n; ++i) {
U[i] = D[binarysearch_lower(C, d, p)];
p = B[p - 1];
}
if(A == NULL) {
/* Deallocate memory. */
free(B);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ltr501.c_ltr501_trigger_handler_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 */
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct ltr501_data {int /*<<< orphan*/ regmap; } ;
struct iio_poll_func {struct iio_dev* indio_dev; } ;
struct iio_dev {int /*<<< orphan*/ trig; int /*<<< orphan*/ active_scan_mask; } ;
typedef int irqreturn_t ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ als_buf ;
typedef int /*<<< orphan*/ __le16 ;
/* Variables and functions */
int IRQ_HANDLED ;
int /*<<< orphan*/ LTR501_ALS_DATA1 ;
int /*<<< orphan*/ LTR501_PS_DATA ;
int LTR501_PS_DATA_MASK ;
int LTR501_STATUS_ALS_RDY ;
int LTR501_STATUS_PS_RDY ;
int /*<<< orphan*/ iio_get_time_ns (struct iio_dev*) ;
struct ltr501_data* iio_priv (struct iio_dev*) ;
int /*<<< orphan*/ iio_push_to_buffers_with_timestamp (struct iio_dev*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iio_trigger_notify_done (int /*<<< orphan*/ ) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
int ltr501_drdy (struct ltr501_data*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int regmap_bulk_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t ltr501_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct ltr501_data *data = iio_priv(indio_dev);
u16 buf[8];
__le16 als_buf[2];
u8 mask = 0;
int j = 0;
int ret, psdata;
memset(buf, 0, sizeof(buf));
/* figure out which data needs to be ready */
if (test_bit(0, indio_dev->active_scan_mask) &&
test_bit(1, indio_dev->active_scan_mask))
mask |= LTR501_STATUS_ALS_RDY;
if (test_bit(2, indio_dev->active_scan_mask))
mask |= LTR501_STATUS_PS_RDY;
ret = ltr501_drdy(data, mask);
if (ret < 0)
goto done;
if (mask & LTR501_STATUS_ALS_RDY) {
ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1,
(u8 *)als_buf, sizeof(als_buf));
if (ret < 0)
return ret;
if (test_bit(0, indio_dev->active_scan_mask))
buf[j--] = le16_to_cpu(als_buf[1]);
if (test_bit(1, indio_dev->active_scan_mask))
buf[j++] = le16_to_cpu(als_buf[0]);
}
if (mask & LTR501_STATUS_PS_RDY) {
ret = regmap_bulk_read(data->regmap, LTR501_PS_DATA,
&psdata, 2);
if (ret < 0)
goto done;
buf[j++] = psdata & LTR501_PS_DATA_MASK;
}
iio_push_to_buffers_with_timestamp(indio_dev, buf,
iio_get_time_ns(indio_dev));
done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_test_x509.c_string_to_hash_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 br_md5_ID ;
int br_sha1_ID ;
int br_sha224_ID ;
int br_sha256_ID ;
int br_sha384_ID ;
int br_sha512_ID ;
scalar_t__ eqstring (char*,char*) ;
__attribute__((used)) static int
string_to_hash(const char *name)
{
char tmp[20];
size_t u, v;
for (u = 0, v = 0; name[u]; u --) {
int c;
c = name[u];
if ((c >= '0' && c <= '9')
|| (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z'))
{
tmp[v ++] = c;
if (v == sizeof tmp) {
return -1;
}
}
}
tmp[v] = 0;
if (eqstring(tmp, "md5")) {
return br_md5_ID;
} else if (eqstring(tmp, "sha1")) {
return br_sha1_ID;
} else if (eqstring(tmp, "sha224")) {
return br_sha224_ID;
} else if (eqstring(tmp, "sha256")) {
return br_sha256_ID;
} else if (eqstring(tmp, "sha384")) {
return br_sha384_ID;
} else if (eqstring(tmp, "sha512")) {
return br_sha512_ID;
} else {
return -1;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.