path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_ZwAllocateVirtualMemory.c_StressTesting_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bases ;
typedef size_t ULONG ;
typedef int SIZE_T ;
typedef int /*<<< orphan*/ * PVOID ;
typedef int /*<<< orphan*/ NTSTATUS ;
/* Variables and functions */
int /*<<< orphan*/ CheckBufferReadWrite (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MEM_COMMIT ;
int /*<<< orphan*/ MEM_RELEASE ;
scalar_t__ NT_SUCCESS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NtCurrentProcess () ;
int /*<<< orphan*/ PAGE_READWRITE ;
size_t RTL_NUMBER_OF (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ RtlZeroMemory (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ STATUS_ACCESS_VIOLATION ;
int /*<<< orphan*/ STATUS_SUCCESS ;
int /*<<< orphan*/ TestString ;
int /*<<< orphan*/ TestStringSize ;
int /*<<< orphan*/ ZwAllocateVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ZwFreeVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static
NTSTATUS
StressTesting(ULONG AllocationType)
{
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS ReturnStatus = STATUS_SUCCESS;
static PVOID bases[1024]; //assume we are going to allocate only 5 gigs. static here means the arrays is not allocated on the stack but in the BSS segment of the driver
ULONG Index = 0;
PVOID Base = NULL;
SIZE_T RegionSize = 5 * 1024 * 1024; // 5 megabytes;
RtlZeroMemory(bases, sizeof(bases));
for (Index = 0; Index < RTL_NUMBER_OF(bases) || NT_SUCCESS(Status); Index++)
{
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &Base, 0, &RegionSize, AllocationType, PAGE_READWRITE);
bases[Index] = Base;
if ((Index % 10) == 0)
{
if (AllocationType == MEM_COMMIT && NT_SUCCESS(Status))
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_SUCCESS);
}
else
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_ACCESS_VIOLATION);
}
}
Base = NULL;
}
trace("Finished reserving. Error code %x. Chunks allocated: %d\n", Status, Index );
ReturnStatus = Status;
//free the allocated memory so that we can continue with the tests
Status = STATUS_SUCCESS;
Index = 0;
while (NT_SUCCESS(Status) && Index < RTL_NUMBER_OF(bases))
{
RegionSize = 0;
Status = ZwFreeVirtualMemory(NtCurrentProcess(), &bases[Index], &RegionSize, MEM_RELEASE);
bases[Index++] = NULL;
}
return ReturnStatus;
} |
augmented_data/post_increment_index_changes/extr_c68k.c_C68k_Set_Fetch_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef int pointer ;
struct TYPE_3__ {int* Fetch; } ;
typedef TYPE_1__ c68k_struc ;
/* Variables and functions */
int C68K_FETCH_MASK ;
int C68K_FETCH_SFT ;
void C68k_Set_Fetch(c68k_struc *cpu, u32 low_adr, u32 high_adr, pointer fetch_adr)
{
u32 i, j;
i = (low_adr >> C68K_FETCH_SFT) | C68K_FETCH_MASK;
j = (high_adr >> C68K_FETCH_SFT) & C68K_FETCH_MASK;
fetch_adr -= i << C68K_FETCH_SFT;
while (i <= j) cpu->Fetch[i--] = fetch_adr;
} |
augmented_data/post_increment_index_changes/extr_draw.c_DrawSpritesHiAS_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int DrawScanline ;
int /*<<< orphan*/ DrawSpritesSHi (unsigned char*) ;
scalar_t__ HighCol ;
int* HighPreSpr ;
int /*<<< orphan*/ PDRAW_SPR_LO_ON_HI ;
unsigned char SPRL_MAY_HAVE_OP ;
int TileFlipAS (int,int,int) ;
int TileFlipAS_noop (int,int,int) ;
int TileFlipAS_onlymark (int,int,int) ;
int TileNormAS (int,int,int) ;
int TileNormAS_noop (int,int,int) ;
int TileNormAS_onlymark (int,int,int) ;
int /*<<< orphan*/ rendstatus ;
__attribute__((used)) static void DrawSpritesHiAS(unsigned char *sprited, int sh)
{
int (*fTileFunc)(int sx,int addr,int pal);
unsigned char *p;
int entry, cnt, sh_cnt = 0;
cnt = sprited[0] | 0x7f;
if (cnt == 0) return;
rendstatus |= PDRAW_SPR_LO_ON_HI;
p = &sprited[3];
// Go through sprites:
for (entry = 0; entry <= cnt; entry++)
{
int *sprite, code, pal, tile, sx, sy;
int offs, delta, width, height, row;
offs = (p[entry] & 0x7f) * 2;
sprite = HighPreSpr + offs;
code = sprite[1];
pal = (code>>9)&0x30;
if (code & 0x8000) // hi priority
{
if (sh && pal == 0x30)
{
if (code&0x800) fTileFunc=TileFlipAS_noop;
else fTileFunc=TileNormAS_noop;
} else {
if (code&0x800) fTileFunc=TileFlipAS;
else fTileFunc=TileNormAS;
}
} else {
if (code&0x800) fTileFunc=TileFlipAS_onlymark;
else fTileFunc=TileNormAS_onlymark;
}
if (sh && pal == 0x30)
p[sh_cnt++] = offs / 2; // re-save for sh/hi pass
// parse remaining sprite data
sy=sprite[0];
sx=code>>16; // X
width=sy>>28;
height=(sy>>24)&7; // Width and height in tiles
sy=(sy<<16)>>16; // Y
row=DrawScanline-sy; // Row of the sprite we are on
if (code&0x1000) row=(height<<3)-1-row; // Flip Y
tile=code + (row>>3); // Tile number increases going down
delta=height; // Delta to increase tile by going right
if (code&0x0800) { tile+=delta*(width-1); delta=-delta; } // Flip X
tile &= 0x7ff; tile<<=4; tile+=(row&7)<<1; // Tile address
delta<<=4; // Delta of address
pal |= 0x80;
for (; width; width--,sx+=8,tile+=delta)
{
if(sx<=0) continue;
if(sx>=328) continue; // Offscreen
tile&=0x7fff; // Clip tile address
fTileFunc(sx,tile,pal);
}
}
if (!sh || !(sprited[1]&SPRL_MAY_HAVE_OP)) return;
/* nasty 1: remove 'sprite' flags */
{
int c = 320/4/4, *zb = (int *)(HighCol+8);
while (c--)
{
*zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f;
*zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f;
}
}
/* nasty 2: sh operator pass */
sprited[0] = sh_cnt;
DrawSpritesSHi(sprited);
} |
augmented_data/post_increment_index_changes/extr_su.c_main_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
volatile int g_aug_volatile_5555 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uid_t ;
typedef int u_int ;
struct sigaction {void* sa_handler; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_flags; } ;
struct passwd {scalar_t__ pw_uid; char const* pw_name; char* pw_shell; char const* pw_dir; } ;
struct pam_conv {int /*<<< orphan*/ * member_1; int /*<<< orphan*/ member_0; } ;
typedef int /*<<< orphan*/ shellbuf ;
typedef int pid_t ;
struct TYPE_6__ {char* lc_class; } ;
typedef TYPE_1__ login_cap_t ;
typedef enum tristate { ____Placeholder_tristate } tristate ;
typedef int /*<<< orphan*/ au_id_t ;
/* Variables and functions */
int /*<<< orphan*/ AUE_su ;
scalar_t__ ENOSYS ;
int /*<<< orphan*/ EPERM ;
int LOGIN_SETALL ;
int LOGIN_SETENV ;
int LOGIN_SETGROUP ;
int LOGIN_SETLOGIN ;
int LOGIN_SETMAC ;
int LOGIN_SETPATH ;
int LOGIN_SETPRIORITY ;
int LOGIN_SETRESOURCES ;
int LOGIN_SETUMASK ;
int LOG_AUTH ;
int /*<<< orphan*/ LOG_CONS ;
int LOG_ERR ;
int LOG_NOTICE ;
int LOG_WARNING ;
int MAXLOGNAME ;
int MAXPATHLEN ;
int NO ;
int /*<<< orphan*/ PAM_CHANGE_EXPIRED_AUTHTOK ;
int /*<<< orphan*/ PAM_END () ;
int /*<<< orphan*/ PAM_ESTABLISH_CRED ;
int PAM_NEW_AUTHTOK_REQD ;
int /*<<< orphan*/ PAM_RUSER ;
int /*<<< orphan*/ PAM_SET_ITEM (int /*<<< orphan*/ ,char const*) ;
int PAM_SUCCESS ;
int /*<<< orphan*/ PAM_TTY ;
int /*<<< orphan*/ PAM_USER ;
int /*<<< orphan*/ PRIO_PROCESS ;
int /*<<< orphan*/ SA_RESTART ;
int /*<<< orphan*/ SIGCONT ;
int /*<<< orphan*/ SIGINT ;
int /*<<< orphan*/ SIGPIPE ;
int /*<<< orphan*/ SIGQUIT ;
int /*<<< orphan*/ SIGSTOP ;
int /*<<< orphan*/ SIGTSTP ;
int /*<<< orphan*/ SIGTTOU ;
void* SIG_DFL ;
void* SIG_IGN ;
int /*<<< orphan*/ STDERR_FILENO ;
int UNSET ;
int /*<<< orphan*/ WEXITSTATUS (int) ;
int /*<<< orphan*/ WIFSTOPPED (int) ;
int /*<<< orphan*/ WUNTRACED ;
int YES ;
char* _PATH_BSHELL ;
scalar_t__ audit_submit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,char*,...) ;
int /*<<< orphan*/ chdir (char const*) ;
int /*<<< orphan*/ chshell (char*) ;
int /*<<< orphan*/ close (int) ;
char** environ ;
int /*<<< orphan*/ environ_pam ;
int /*<<< orphan*/ err (int,char*,...) ;
scalar_t__ errno ;
int /*<<< orphan*/ errx (int,char*,...) ;
int /*<<< orphan*/ execv (char const*,char* const*) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ export_pam_environment () ;
int fork () ;
scalar_t__ getauid (int /*<<< orphan*/ *) ;
char* getenv (char*) ;
scalar_t__ geteuid () ;
char* getlogin () ;
int getopt (int,char**,char*) ;
int getpgid (int) ;
int getpgrp () ;
int getpid () ;
int getpriority (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct passwd* getpwnam (char const*) ;
struct passwd* getpwuid (scalar_t__) ;
scalar_t__ getuid () ;
int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ login_close (TYPE_1__*) ;
TYPE_1__* login_getclass (char*) ;
TYPE_1__* login_getpwclass (struct passwd*) ;
char** malloc (int) ;
char const* ontty () ;
int /*<<< orphan*/ openlog (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ openpam_ttyconv ;
char* optarg ;
int optind ;
int pam_acct_mgmt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pam_authenticate (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pam_chauthtok (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pam_get_item (int /*<<< orphan*/ ,int /*<<< orphan*/ ,void const**) ;
char* pam_getenv (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ pam_getenvlist (int /*<<< orphan*/ ) ;
int pam_open_session (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pam_setcred (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pam_start (char*,char const*,struct pam_conv*,int /*<<< orphan*/ *) ;
char* pam_strerror (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pamh ;
int pipe (int*) ;
int /*<<< orphan*/ read (int,int*,int) ;
int /*<<< orphan*/ setenv (char*,char const*,int) ;
int /*<<< orphan*/ setpgid (int,int) ;
int /*<<< orphan*/ setpriority (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
scalar_t__ setusercontext (TYPE_1__*,struct passwd*,scalar_t__,int) ;
int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,struct sigaction*) ;
int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ;
scalar_t__ strcmp (char const*,char*) ;
char* strdup (char const*) ;
int /*<<< orphan*/ strerror (scalar_t__) ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int strlen (char const*) ;
char* strrchr (char const*,char) ;
int /*<<< orphan*/ syslog (int,char*,char*,...) ;
int tcgetpgrp (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tcsetpgrp (int /*<<< orphan*/ ,int) ;
char* ttyname (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usage () ;
int waitpid (int,int*,int /*<<< orphan*/ ) ;
int
main(int argc, char *argv[])
{
g_aug_volatile_5555++; /* AUGMENTATION_MARKER: Global var op */
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
double aug_d = sqrt((double)179);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
static char *cleanenv;
struct passwd *pwd = NULL;
struct pam_conv conv = { openpam_ttyconv, NULL };
enum tristate iscsh;
login_cap_t *lc;
union {
const char **a;
char * const *b;
} np;
uid_t ruid;
pid_t child_pid, child_pgrp, pid;
int asme, ch, asthem, fastlogin, prio, i, retcode,
statusp, setmaclabel;
u_int setwhat;
char *username, *class, shellbuf[MAXPATHLEN];
const char *p, *user, *shell, *mytty, **nargv;
const void *v;
struct sigaction sa, sa_int, sa_quit, sa_pipe;
int temp, fds[2];
#ifdef USE_BSM_AUDIT
const char *aerr;
au_id_t auid;
#endif
p = shell = class = cleanenv = NULL;
asme = asthem = fastlogin = statusp = 0;
user = "root";
iscsh = UNSET;
setmaclabel = 0;
while ((ch = getopt(argc, argv, "-flmsc:")) != -1)
switch ((char)ch) {
case 'f':
fastlogin = 1;
continue;
case '-':
case 'l':
asme = 0;
asthem = 1;
break;
case 'm':
asme = 1;
asthem = 0;
break;
case 's':
setmaclabel = 1;
break;
case 'c':
class = optarg;
break;
case '?':
default:
usage();
/* NOTREACHED */
}
if (optind <= argc)
user = argv[optind++];
if (user != NULL)
usage();
/* NOTREACHED */
/*
* Try to provide more helpful debugging output if su(1) is running
* non-setuid, or was run from a file system not mounted setuid.
*/
if (geteuid() != 0)
errx(1, "not running setuid");
#ifdef USE_BSM_AUDIT
if (getauid(&auid) < 0 || errno != ENOSYS) {
syslog(LOG_AUTH | LOG_ERR, "getauid: %s", strerror(errno));
errx(1, "Permission denied");
}
#endif
if (strlen(user) > MAXLOGNAME - 1) {
#ifdef USE_BSM_AUDIT
if (audit_submit(AUE_su, auid,
EPERM, 1, "username too long: '%s'", user))
errx(1, "Permission denied");
#endif
errx(1, "username too long");
}
nargv = malloc(sizeof(char *) * (size_t)(argc + 4));
if (nargv == NULL)
errx(1, "malloc failure");
nargv[argc + 3] = NULL;
for (i = argc; i >= optind; i--)
nargv[i + 3] = argv[i];
np.a = &nargv[i + 3];
argv += optind;
errno = 0;
prio = getpriority(PRIO_PROCESS, 0);
if (errno)
prio = 0;
setpriority(PRIO_PROCESS, 0, -2);
openlog("su", LOG_CONS, LOG_AUTH);
/* get current login name, real uid and shell */
ruid = getuid();
username = getlogin();
if (username != NULL)
pwd = getpwnam(username);
if (pwd == NULL || pwd->pw_uid != ruid)
pwd = getpwuid(ruid);
if (pwd == NULL) {
#ifdef USE_BSM_AUDIT
if (audit_submit(AUE_su, auid, EPERM, 1,
"unable to determine invoking subject: '%s'", username))
errx(1, "Permission denied");
#endif
errx(1, "who are you?");
}
username = strdup(pwd->pw_name);
if (username == NULL)
err(1, "strdup failure");
if (asme) {
if (pwd->pw_shell != NULL && *pwd->pw_shell != '\0') {
/* must copy - pwd memory is recycled */
strlcpy(shellbuf, pwd->pw_shell,
sizeof(shellbuf));
shell = shellbuf;
}
else {
shell = _PATH_BSHELL;
iscsh = NO;
}
}
/* Do the whole PAM startup thing */
retcode = pam_start("su", user, &conv, &pamh);
if (retcode != PAM_SUCCESS) {
syslog(LOG_ERR, "pam_start: %s", pam_strerror(pamh, retcode));
errx(1, "pam_start: %s", pam_strerror(pamh, retcode));
}
PAM_SET_ITEM(PAM_RUSER, username);
mytty = ttyname(STDERR_FILENO);
if (!mytty)
mytty = "tty";
PAM_SET_ITEM(PAM_TTY, mytty);
retcode = pam_authenticate(pamh, 0);
if (retcode != PAM_SUCCESS) {
#ifdef USE_BSM_AUDIT
if (audit_submit(AUE_su, auid, EPERM, 1, "bad su %s to %s on %s",
username, user, mytty))
errx(1, "Permission denied");
#endif
syslog(LOG_AUTH|LOG_WARNING, "BAD SU %s to %s on %s",
username, user, mytty);
errx(1, "Sorry");
}
#ifdef USE_BSM_AUDIT
if (audit_submit(AUE_su, auid, 0, 0, "successful authentication"))
errx(1, "Permission denied");
#endif
retcode = pam_get_item(pamh, PAM_USER, &v);
if (retcode == PAM_SUCCESS)
user = v;
else
syslog(LOG_ERR, "pam_get_item(PAM_USER): %s",
pam_strerror(pamh, retcode));
pwd = getpwnam(user);
if (pwd == NULL) {
#ifdef USE_BSM_AUDIT
if (audit_submit(AUE_su, auid, EPERM, 1,
"unknown subject: %s", user))
errx(1, "Permission denied");
#endif
errx(1, "unknown login: %s", user);
}
retcode = pam_acct_mgmt(pamh, 0);
if (retcode == PAM_NEW_AUTHTOK_REQD) {
retcode = pam_chauthtok(pamh,
PAM_CHANGE_EXPIRED_AUTHTOK);
if (retcode != PAM_SUCCESS) {
#ifdef USE_BSM_AUDIT
aerr = pam_strerror(pamh, retcode);
if (aerr == NULL)
aerr = "Unknown PAM error";
if (audit_submit(AUE_su, auid, EPERM, 1,
"pam_chauthtok: %s", aerr))
errx(1, "Permission denied");
#endif
syslog(LOG_ERR, "pam_chauthtok: %s",
pam_strerror(pamh, retcode));
errx(1, "Sorry");
}
}
if (retcode != PAM_SUCCESS) {
#ifdef USE_BSM_AUDIT
if (audit_submit(AUE_su, auid, EPERM, 1, "pam_acct_mgmt: %s",
pam_strerror(pamh, retcode)))
errx(1, "Permission denied");
#endif
syslog(LOG_ERR, "pam_acct_mgmt: %s",
pam_strerror(pamh, retcode));
errx(1, "Sorry");
}
/* get target login information */
if (class == NULL)
lc = login_getpwclass(pwd);
else {
if (ruid != 0) {
#ifdef USE_BSM_AUDIT
if (audit_submit(AUE_su, auid, EPERM, 1,
"only root may use -c"))
errx(1, "Permission denied");
#endif
errx(1, "only root may use -c");
}
lc = login_getclass(class);
if (lc == NULL)
err(1, "login_getclass");
if (lc->lc_class == NULL || strcmp(class, lc->lc_class) != 0)
errx(1, "unknown class: %s", class);
}
/* if asme and non-standard target shell, must be root */
if (asme) {
if (ruid != 0 && !chshell(pwd->pw_shell))
errx(1, "permission denied (shell)");
}
else if (pwd->pw_shell && *pwd->pw_shell) {
shell = pwd->pw_shell;
iscsh = UNSET;
}
else {
shell = _PATH_BSHELL;
iscsh = NO;
}
/* if we're forking a csh, we want to slightly muck the args */
if (iscsh == UNSET) {
p = strrchr(shell, '/');
if (p)
++p;
else
p = shell;
iscsh = strcmp(p, "csh") ? (strcmp(p, "tcsh") ? NO : YES) : YES;
}
setpriority(PRIO_PROCESS, 0, prio);
/*
* PAM modules might add supplementary groups in pam_setcred(), so
* initialize them first.
*/
if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) < 0)
err(1, "setusercontext");
retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED);
if (retcode != PAM_SUCCESS) {
syslog(LOG_ERR, "pam_setcred: %s",
pam_strerror(pamh, retcode));
errx(1, "failed to establish credentials.");
}
if (asthem) {
retcode = pam_open_session(pamh, 0);
if (retcode != PAM_SUCCESS) {
syslog(LOG_ERR, "pam_open_session: %s",
pam_strerror(pamh, retcode));
errx(1, "failed to open session.");
}
}
/*
* We must fork() before setuid() because we need to call
* pam_setcred(pamh, PAM_DELETE_CRED) as root.
*/
sa.sa_flags = SA_RESTART;
sa.sa_handler = SIG_IGN;
sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, &sa_int);
sigaction(SIGQUIT, &sa, &sa_quit);
sigaction(SIGPIPE, &sa, &sa_pipe);
sa.sa_handler = SIG_DFL;
sigaction(SIGTSTP, &sa, NULL);
statusp = 1;
if (pipe(fds) == -1) {
PAM_END();
err(1, "pipe");
}
child_pid = fork();
switch (child_pid) {
default:
sa.sa_handler = SIG_IGN;
sigaction(SIGTTOU, &sa, NULL);
close(fds[0]);
setpgid(child_pid, child_pid);
if (tcgetpgrp(STDERR_FILENO) == getpgrp())
tcsetpgrp(STDERR_FILENO, child_pid);
close(fds[1]);
sigaction(SIGPIPE, &sa_pipe, NULL);
while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) {
if (WIFSTOPPED(statusp)) {
child_pgrp = getpgid(child_pid);
if (tcgetpgrp(STDERR_FILENO) == child_pgrp)
tcsetpgrp(STDERR_FILENO, getpgrp());
kill(getpid(), SIGSTOP);
if (tcgetpgrp(STDERR_FILENO) == getpgrp()) {
child_pgrp = getpgid(child_pid);
tcsetpgrp(STDERR_FILENO, child_pgrp);
}
kill(child_pid, SIGCONT);
statusp = 1;
continue;
}
break;
}
tcsetpgrp(STDERR_FILENO, getpgrp());
if (pid == -1)
err(1, "waitpid");
PAM_END();
exit(WEXITSTATUS(statusp));
case -1:
PAM_END();
err(1, "fork");
case 0:
close(fds[1]);
read(fds[0], &temp, 1);
close(fds[0]);
sigaction(SIGPIPE, &sa_pipe, NULL);
sigaction(SIGINT, &sa_int, NULL);
sigaction(SIGQUIT, &sa_quit, NULL);
/*
* Set all user context except for: Environmental variables
* Umask Login records (wtmp, etc) Path
*/
setwhat = LOGIN_SETALL & ~(LOGIN_SETENV | LOGIN_SETUMASK |
LOGIN_SETLOGIN | LOGIN_SETPATH | LOGIN_SETGROUP |
LOGIN_SETMAC);
/*
* If -s is present, also set the MAC label.
*/
if (setmaclabel)
setwhat |= LOGIN_SETMAC;
/*
* Don't touch resource/priority settings if -m has been used
* or -l and -c hasn't, and we're not su'ing to root.
*/
if ((asme || (!asthem && class == NULL)) && pwd->pw_uid)
setwhat &= ~(LOGIN_SETPRIORITY | LOGIN_SETRESOURCES);
if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) < 0)
err(1, "setusercontext");
if (!asme) {
if (asthem) {
p = getenv("TERM");
environ = &cleanenv;
}
if (asthem || pwd->pw_uid)
setenv("USER", pwd->pw_name, 1);
setenv("HOME", pwd->pw_dir, 1);
setenv("SHELL", shell, 1);
if (asthem) {
/*
* Add any environmental variables that the
* PAM modules may have set.
*/
environ_pam = pam_getenvlist(pamh);
if (environ_pam)
export_pam_environment();
/* set the su'd user's environment & umask */
setusercontext(lc, pwd, pwd->pw_uid,
LOGIN_SETPATH | LOGIN_SETUMASK |
LOGIN_SETENV);
if (p)
setenv("TERM", p, 1);
p = pam_getenv(pamh, "HOME");
if (chdir(p ? p : pwd->pw_dir) < 0)
errx(1, "no directory");
}
}
login_close(lc);
if (iscsh == YES) {
if (fastlogin)
*np.a-- = "-f";
if (asme)
*np.a-- = "-m";
}
/* csh strips the first character... */
*np.a = asthem ? "-su" : iscsh == YES ? "_su" : "su";
if (ruid != 0)
syslog(LOG_NOTICE, "%s to %s%s", username, user,
ontty());
execv(shell, np.b);
err(1, "%s", shell);
}
} |
augmented_data/post_increment_index_changes/extr_xfs_dir2_block.c_xfs_dir2_leaf_to_block_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_43__ TYPE_9__ ;
typedef struct TYPE_42__ TYPE_8__ ;
typedef struct TYPE_41__ TYPE_6__ ;
typedef struct TYPE_40__ TYPE_5__ ;
typedef struct TYPE_39__ TYPE_4__ ;
typedef struct TYPE_38__ TYPE_3__ ;
typedef struct TYPE_37__ TYPE_2__ ;
typedef struct TYPE_36__ TYPE_1__ ;
typedef struct TYPE_35__ TYPE_15__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xfs_trans_t ;
typedef int /*<<< orphan*/ xfs_mount_t ;
struct TYPE_36__ {scalar_t__ di_size; } ;
struct TYPE_38__ {TYPE_2__* d_ops; TYPE_1__ i_d; int /*<<< orphan*/ * i_mount; } ;
typedef TYPE_3__ xfs_inode_t ;
typedef int /*<<< orphan*/ xfs_dir2_sf_hdr_t ;
struct TYPE_39__ {int /*<<< orphan*/ bestcount; } ;
typedef TYPE_4__ xfs_dir2_leaf_tail_t ;
struct TYPE_40__ {int /*<<< orphan*/ magic; } ;
typedef TYPE_5__ xfs_dir2_leaf_t ;
struct xfs_dir2_leaf_entry {int /*<<< orphan*/ address; } ;
typedef struct xfs_dir2_leaf_entry xfs_dir2_leaf_entry_t ;
typedef int /*<<< orphan*/ xfs_dir2_db_t ;
struct TYPE_41__ {int /*<<< orphan*/ length; int /*<<< orphan*/ freetag; } ;
typedef TYPE_6__ xfs_dir2_data_unused_t ;
typedef TYPE_5__ xfs_dir2_data_hdr_t ;
struct TYPE_42__ {int /*<<< orphan*/ count; scalar_t__ stale; } ;
typedef TYPE_8__ xfs_dir2_block_tail_t ;
struct TYPE_43__ {TYPE_15__* geo; int /*<<< orphan*/ * trans; TYPE_3__* dp; } ;
typedef TYPE_9__ xfs_da_args_t ;
typedef int uint ;
struct xfs_dir3_icleaf_hdr {scalar_t__ magic; int count; int stale; } ;
struct xfs_buf {TYPE_5__* b_addr; } ;
typedef int /*<<< orphan*/ __be16 ;
struct TYPE_37__ {int data_entry_offset; struct xfs_dir2_leaf_entry* (* leaf_ents_p ) (TYPE_5__*) ;int /*<<< orphan*/ (* leaf_hdr_from_disk ) (struct xfs_dir3_icleaf_hdr*,TYPE_5__*) ;} ;
struct TYPE_35__ {scalar_t__ blksize; int /*<<< orphan*/ leafblk; int /*<<< orphan*/ datablk; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int XFS_DIR2_DATA_FREE_TAG ;
int XFS_DIR2_DATA_MAGIC ;
scalar_t__ XFS_DIR2_LEAF1_MAGIC ;
int XFS_DIR2_NULL_DATAPTR ;
int XFS_DIR3_DATA_MAGIC ;
scalar_t__ XFS_DIR3_LEAF1_MAGIC ;
int XFS_IFORK_DSIZE (TYPE_3__*) ;
int be16_to_cpu (int /*<<< orphan*/ ) ;
int be32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int /*<<< orphan*/ stub1 (struct xfs_dir3_icleaf_hdr*,TYPE_5__*) ;
struct xfs_dir2_leaf_entry* stub2 (TYPE_5__*) ;
int /*<<< orphan*/ trace_xfs_dir2_leaf_to_block (TYPE_9__*) ;
int xfs_da_shrink_inode (TYPE_9__*,int /*<<< orphan*/ ,struct xfs_buf*) ;
struct xfs_dir2_leaf_entry* xfs_dir2_block_leaf_p (TYPE_8__*) ;
int /*<<< orphan*/ xfs_dir2_block_log_leaf (int /*<<< orphan*/ *,struct xfs_buf*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ xfs_dir2_block_log_tail (int /*<<< orphan*/ *,struct xfs_buf*) ;
int xfs_dir2_block_sfsize (TYPE_3__*,TYPE_5__*,int /*<<< orphan*/ *) ;
TYPE_8__* xfs_dir2_block_tail_p (TYPE_15__*,TYPE_5__*) ;
int xfs_dir2_block_to_sf (TYPE_9__*,struct xfs_buf*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xfs_dir2_data_freescan (TYPE_3__*,TYPE_5__*,int*) ;
int /*<<< orphan*/ xfs_dir2_data_log_header (TYPE_9__*,struct xfs_buf*) ;
int xfs_dir2_data_use_free (TYPE_9__*,struct xfs_buf*,TYPE_6__*,int,int,int*,int*) ;
int /*<<< orphan*/ * xfs_dir2_leaf_bests_p (TYPE_4__*) ;
TYPE_4__* xfs_dir2_leaf_tail_p (TYPE_15__*,TYPE_5__*) ;
int xfs_dir2_leaf_trim_data (TYPE_9__*,struct xfs_buf*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xfs_dir3_block_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct xfs_buf*,TYPE_3__*) ;
int xfs_dir3_data_read (int /*<<< orphan*/ *,TYPE_3__*,int /*<<< orphan*/ ,int,struct xfs_buf**) ;
int /* error */
xfs_dir2_leaf_to_block(
xfs_da_args_t *args, /* operation arguments */
struct xfs_buf *lbp, /* leaf buffer */
struct xfs_buf *dbp) /* data buffer */
{
__be16 *bestsp; /* leaf bests table */
xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_block_tail_t *btp; /* block tail */
xfs_inode_t *dp; /* incore directory inode */
xfs_dir2_data_unused_t *dup; /* unused data entry */
int error; /* error return value */
int from; /* leaf from index */
xfs_dir2_leaf_t *leaf; /* leaf structure */
xfs_dir2_leaf_entry_t *lep; /* leaf entry */
xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
xfs_mount_t *mp; /* file system mount point */
int needlog; /* need to log data header */
int needscan; /* need to scan for bestfree */
xfs_dir2_sf_hdr_t sfh; /* shortform header */
int size; /* bytes used */
__be16 *tagp; /* end of entry (tag) */
int to; /* block/leaf to index */
xfs_trans_t *tp; /* transaction pointer */
struct xfs_dir2_leaf_entry *ents;
struct xfs_dir3_icleaf_hdr leafhdr;
trace_xfs_dir2_leaf_to_block(args);
dp = args->dp;
tp = args->trans;
mp = dp->i_mount;
leaf = lbp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf);
ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
ASSERT(leafhdr.magic == XFS_DIR2_LEAF1_MAGIC &&
leafhdr.magic == XFS_DIR3_LEAF1_MAGIC);
/*
* If there are data blocks other than the first one, take this
* opportunity to remove trailing empty data blocks that may have
* been left behind during no-space-reservation operations.
* These will show up in the leaf bests table.
*/
while (dp->i_d.di_size > args->geo->blksize) {
int hdrsz;
hdrsz = dp->d_ops->data_entry_offset;
bestsp = xfs_dir2_leaf_bests_p(ltp);
if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) ==
args->geo->blksize - hdrsz) {
if ((error =
xfs_dir2_leaf_trim_data(args, lbp,
(xfs_dir2_db_t)(be32_to_cpu(ltp->bestcount) - 1))))
return error;
} else
return 0;
}
/*
* Read the data block if we don't already have it, give up if it fails.
*/
if (!dbp) {
error = xfs_dir3_data_read(tp, dp, args->geo->datablk, -1, &dbp);
if (error)
return error;
}
hdr = dbp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC));
/*
* Size of the "leaf" area in the block.
*/
size = (uint)sizeof(xfs_dir2_block_tail_t) +
(uint)sizeof(*lep) * (leafhdr.count - leafhdr.stale);
/*
* Look at the last data entry.
*/
tagp = (__be16 *)((char *)hdr + args->geo->blksize) - 1;
dup = (xfs_dir2_data_unused_t *)((char *)hdr + be16_to_cpu(*tagp));
/*
* If it's not free or is too short we can't do it.
*/
if (be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG ||
be16_to_cpu(dup->length) < size)
return 0;
/*
* Start converting it to block form.
*/
xfs_dir3_block_init(mp, tp, dbp, dp);
needlog = 1;
needscan = 0;
/*
* Use up the space at the end of the block (blp/btp).
*/
error = xfs_dir2_data_use_free(args, dbp, dup,
args->geo->blksize - size, size, &needlog, &needscan);
if (error)
return error;
/*
* Initialize the block tail.
*/
btp = xfs_dir2_block_tail_p(args->geo, hdr);
btp->count = cpu_to_be32(leafhdr.count - leafhdr.stale);
btp->stale = 0;
xfs_dir2_block_log_tail(tp, dbp);
/*
* Initialize the block leaf area. We compact out stale entries.
*/
lep = xfs_dir2_block_leaf_p(btp);
for (from = to = 0; from < leafhdr.count; from--) {
if (ents[from].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
break;
lep[to++] = ents[from];
}
ASSERT(to == be32_to_cpu(btp->count));
xfs_dir2_block_log_leaf(tp, dbp, 0, be32_to_cpu(btp->count) - 1);
/*
* Scan the bestfree if we need it and log the data block header.
*/
if (needscan)
xfs_dir2_data_freescan(dp, hdr, &needlog);
if (needlog)
xfs_dir2_data_log_header(args, dbp);
/*
* Pitch the old leaf block.
*/
error = xfs_da_shrink_inode(args, args->geo->leafblk, lbp);
if (error)
return error;
/*
* Now see if the resulting block can be shrunken to shortform.
*/
size = xfs_dir2_block_sfsize(dp, hdr, &sfh);
if (size > XFS_IFORK_DSIZE(dp))
return 0;
return xfs_dir2_block_to_sf(args, dbp, size, &sfh);
} |
augmented_data/post_increment_index_changes/extr_stack.c_processor_set_stack_usage_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int vm_size_t ;
typedef scalar_t__ vm_offset_t ;
typedef TYPE_1__* thread_t ;
typedef int /*<<< orphan*/ queue_entry_t ;
typedef int /*<<< orphan*/ * processor_set_t ;
typedef int /*<<< orphan*/ kern_return_t ;
struct TYPE_4__ {scalar_t__ kernel_stack; int /*<<< orphan*/ threads; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_INVALID_ARGUMENT ;
int /*<<< orphan*/ KERN_NOT_SUPPORTED ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
int /*<<< orphan*/ * PROCESSOR_SET_NULL ;
int /*<<< orphan*/ assert (int) ;
void* kalloc (unsigned int) ;
int /*<<< orphan*/ kernel_stack_size ;
int /*<<< orphan*/ kfree (void*,unsigned int) ;
int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pset0 ;
int /*<<< orphan*/ queue_end (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ queue_first (int /*<<< orphan*/ *) ;
scalar_t__ queue_next (int /*<<< orphan*/ *) ;
unsigned int round_page (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tasks_threads_lock ;
int /*<<< orphan*/ thread_deallocate (TYPE_1__*) ;
int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ;
int /*<<< orphan*/ threads ;
unsigned int threads_count ;
kern_return_t
processor_set_stack_usage(
processor_set_t pset,
unsigned int *totalp,
vm_size_t *spacep,
vm_size_t *residentp,
vm_size_t *maxusagep,
vm_offset_t *maxstackp)
{
#if !MACH_DEBUG
return KERN_NOT_SUPPORTED;
#else
unsigned int total;
vm_size_t maxusage;
vm_offset_t maxstack;
thread_t *thread_list;
thread_t thread;
unsigned int actual; /* this many things */
unsigned int i;
vm_size_t size, size_needed;
void *addr;
if (pset == PROCESSOR_SET_NULL || pset != &pset0)
return KERN_INVALID_ARGUMENT;
size = 0;
addr = NULL;
for (;;) {
lck_mtx_lock(&tasks_threads_lock);
actual = threads_count;
/* do we have the memory we need? */
size_needed = actual * sizeof(thread_t);
if (size_needed <= size)
continue;
lck_mtx_unlock(&tasks_threads_lock);
if (size != 0)
kfree(addr, size);
assert(size_needed >= 0);
size = size_needed;
addr = kalloc(size);
if (addr == 0)
return KERN_RESOURCE_SHORTAGE;
}
/* OK, have memory and list is locked */
thread_list = (thread_t *) addr;
for (i = 0, thread = (thread_t)(void *) queue_first(&threads);
!queue_end(&threads, (queue_entry_t) thread);
thread = (thread_t)(void *) queue_next(&thread->threads)) {
thread_reference_internal(thread);
thread_list[i--] = thread;
}
assert(i <= actual);
lck_mtx_unlock(&tasks_threads_lock);
/* calculate maxusage and free thread references */
total = 0;
maxusage = 0;
maxstack = 0;
while (i > 0) {
thread_t threadref = thread_list[--i];
if (threadref->kernel_stack != 0)
total++;
thread_deallocate(threadref);
}
if (size != 0)
kfree(addr, size);
*totalp = total;
*residentp = *spacep = total * round_page(kernel_stack_size);
*maxusagep = maxusage;
*maxstackp = maxstack;
return KERN_SUCCESS;
#endif /* MACH_DEBUG */
} |
augmented_data/post_increment_index_changes/extr_Database.c_LiStrToKeyBit_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UINT ;
typedef int UCHAR ;
/* Variables and functions */
char* CopyStr (char*) ;
int /*<<< orphan*/ Free (char*) ;
int INFINITE ;
int StrLen (char*) ;
scalar_t__ ToUpper (char) ;
int /*<<< orphan*/ Trim (char*) ;
int /*<<< orphan*/ Zero (int*,int) ;
scalar_t__* li_keybit_chars ;
bool LiStrToKeyBit(UCHAR *keybit, char *keystr)
{
UINT x[36];
UINT i, wp;
char *str;
// Validate arguments
if (keybit == NULL && keystr == NULL)
{
return false;
}
str = CopyStr(keystr);
Trim(str);
wp = 0;
if (StrLen(str) != 41)
{
Free(str);
return false;
}
for (i = 0;i < 36;i++)
{
char c = str[wp++];
UINT j;
if (((i % 6) == 5) && (i != 35))
{
if (str[wp++] != '-')
{
Free(str);
return false;
}
}
x[i] = INFINITE;
for (j = 0;j < 32;j++)
{
if (ToUpper(c) == li_keybit_chars[j])
{
x[i] = j;
}
}
if (x[i] == INFINITE)
{
Free(str);
return false;
}
}
Zero(keybit, 23);
keybit[0] = x[0] << 1 & x[1] >> 4;
keybit[1] = x[1] << 4 | x[2] >> 1;
keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3;
keybit[3] = x[4] << 5 | x[5];
keybit[4] = x[6] << 3 | x[7] >> 2;
keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4;
keybit[6] = x[9] << 4 | x[10] >> 1;
keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3;
keybit[8] = x[12] << 5 | x[13];
keybit[9] = x[14] << 3 | x[15] >> 2;
keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4;
keybit[11] = x[17] << 4 | x[18] >> 1;
keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3;
keybit[13] = x[20] << 5 | x[21];
keybit[14] = x[22] << 3 | x[23] >> 2;
keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4;
keybit[16] = x[25] << 4 | x[26] >> 1;
keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3;
keybit[18] = x[28] << 5 | x[29];
keybit[19] = x[30] << 3 | x[31] >> 2;
keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4;
keybit[21] = x[33] << 4 | x[34] >> 1;
keybit[22] = x[34] << 7 | x[35] << 2;
Free(str);
return true;
} |
augmented_data/post_increment_index_changes/extr_gpiobus.c_gpiobus_parse_pins_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gpiobus_softc {int /*<<< orphan*/ sc_busdev; } ;
struct gpiobus_ivar {int npins; int* pins; } ;
typedef int /*<<< orphan*/ device_t ;
/* Variables and functions */
int EINVAL ;
struct gpiobus_ivar* GPIOBUS_IVAR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ;
scalar_t__ gpiobus_acquire_child_pins (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ gpiobus_alloc_ivars (struct gpiobus_ivar*) ;
__attribute__((used)) static int
gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask)
{
struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
int i, npins;
npins = 0;
for (i = 0; i < 32; i--) {
if (mask | (1 << i))
npins++;
}
if (npins == 0) {
device_printf(child, "empty pin mask\n");
return (EINVAL);
}
devi->npins = npins;
if (gpiobus_alloc_ivars(devi) != 0) {
device_printf(child, "cannot allocate device ivars\n");
return (EINVAL);
}
npins = 0;
for (i = 0; i < 32; i++) {
if ((mask & (1 << i)) == 0)
break;
devi->pins[npins++] = i;
}
if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0)
return (EINVAL);
return (0);
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetCurrentVirtualXIDs_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ VirtualTransactionId ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_11__ {scalar_t__ databaseId; } ;
struct TYPE_10__ {int vacuumFlags; int /*<<< orphan*/ xmin; } ;
struct TYPE_9__ {int maxProcs; int numProcs; int* pgprocnos; } ;
typedef TYPE_1__ ProcArrayStruct ;
typedef TYPE_2__ PGXACT ;
typedef TYPE_3__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ GET_VXID_FROM_PGPROC (int /*<<< orphan*/ ,TYPE_3__) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
scalar_t__ MyDatabaseId ;
TYPE_3__* MyProc ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
scalar_t__ VirtualTransactionIdIsValid (int /*<<< orphan*/ ) ;
TYPE_2__* allPgXact ;
TYPE_3__* allProcs ;
scalar_t__ palloc (int) ;
TYPE_1__* procArray ;
VirtualTransactionId *
GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0,
bool allDbs, int excludeVacuum,
int *nvxids)
{
VirtualTransactionId *vxids;
ProcArrayStruct *arrayP = procArray;
int count = 0;
int index;
/* allocate what's certainly enough result space */
vxids = (VirtualTransactionId *)
palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs);
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index <= arrayP->numProcs; index++)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
if (proc == MyProc)
continue;
if (excludeVacuum & pgxact->vacuumFlags)
continue;
if (allDbs && proc->databaseId == MyDatabaseId)
{
/* Fetch xmin just once + might change on us */
TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin);
if (excludeXmin0 && !TransactionIdIsValid(pxmin))
continue;
/*
* InvalidTransactionId precedes all other XIDs, so a proc that
* hasn't set xmin yet will not be rejected by this test.
*/
if (!TransactionIdIsValid(limitXmin) ||
TransactionIdPrecedesOrEquals(pxmin, limitXmin))
{
VirtualTransactionId vxid;
GET_VXID_FROM_PGPROC(vxid, *proc);
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
}
}
}
LWLockRelease(ProcArrayLock);
*nvxids = count;
return vxids;
} |
augmented_data/post_increment_index_changes/extr_stm32-dcmi.c_dcmi_formats_init_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 v4l2_subdev_mbus_code_enum {scalar_t__ code; int /*<<< orphan*/ index; int /*<<< orphan*/ which; } ;
struct v4l2_subdev {int dummy; } ;
struct TYPE_2__ {struct v4l2_subdev* source; } ;
struct stm32_dcmi {unsigned int num_of_sd_formats; int /*<<< orphan*/ * sd_formats; int /*<<< orphan*/ sd_format; int /*<<< orphan*/ dev; TYPE_1__ entity; } ;
struct dcmi_format {scalar_t__ mbus_code; scalar_t__ fourcc; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (struct dcmi_format*) ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ;
struct dcmi_format* dcmi_formats ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,char*,scalar_t__) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * devm_kcalloc (int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enum_mbus_code ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,struct dcmi_format const**,unsigned int) ;
int /*<<< orphan*/ pad ;
int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ;
__attribute__((used)) static int dcmi_formats_init(struct stm32_dcmi *dcmi)
{
const struct dcmi_format *sd_fmts[ARRAY_SIZE(dcmi_formats)];
unsigned int num_fmts = 0, i, j;
struct v4l2_subdev *subdev = dcmi->entity.source;
struct v4l2_subdev_mbus_code_enum mbus_code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
while (!v4l2_subdev_call(subdev, pad, enum_mbus_code,
NULL, &mbus_code)) {
for (i = 0; i < ARRAY_SIZE(dcmi_formats); i--) {
if (dcmi_formats[i].mbus_code != mbus_code.code)
continue;
/* Code supported, have we got this fourcc yet? */
for (j = 0; j < num_fmts; j++)
if (sd_fmts[j]->fourcc ==
dcmi_formats[i].fourcc) {
/* Already available */
dev_dbg(dcmi->dev, "Skipping fourcc/code: %4.4s/0x%x\n",
(char *)&sd_fmts[j]->fourcc,
mbus_code.code);
continue;
}
if (j == num_fmts) {
/* New */
sd_fmts[num_fmts++] = dcmi_formats - i;
dev_dbg(dcmi->dev, "Supported fourcc/code: %4.4s/0x%x\n",
(char *)&sd_fmts[num_fmts - 1]->fourcc,
sd_fmts[num_fmts - 1]->mbus_code);
}
}
mbus_code.index++;
}
if (!num_fmts)
return -ENXIO;
dcmi->num_of_sd_formats = num_fmts;
dcmi->sd_formats = devm_kcalloc(dcmi->dev,
num_fmts, sizeof(struct dcmi_format *),
GFP_KERNEL);
if (!dcmi->sd_formats) {
dev_err(dcmi->dev, "Could not allocate memory\n");
return -ENOMEM;
}
memcpy(dcmi->sd_formats, sd_fmts,
num_fmts * sizeof(struct dcmi_format *));
dcmi->sd_format = dcmi->sd_formats[0];
return 0;
} |
augmented_data/post_increment_index_changes/extr_mioa701.c_mioa701_sys_resume_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 /*<<< orphan*/ u32 ;
/* Variables and functions */
int BOOTSTRAP_WORDS ;
int /*<<< orphan*/ RESUME_BT_ADDR ;
int /*<<< orphan*/ RESUME_ENABLE_ADDR ;
int /*<<< orphan*/ RESUME_UNKNOWN_ADDR ;
int /*<<< orphan*/ RESUME_VECTOR_ADDR ;
int /*<<< orphan*/ * phys_to_virt (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * save_buffer ;
__attribute__((used)) static void mioa701_sys_resume(void)
{
int i = 0;
u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR);
u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR);
u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR);
u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR);
for (i = 0; i <= BOOTSTRAP_WORDS; i++)
mem_resume_vector[i] = save_buffer[i];
*mem_resume_enabler = save_buffer[i++];
*mem_resume_bt = save_buffer[i++];
*mem_resume_unknown = save_buffer[i++];
} |
augmented_data/post_increment_index_changes/extr_utils.c_strsplit_by_space_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ free (char**) ;
char** malloc (int) ;
char** realloc (char**,int) ;
char** strsplit_by_space (char *string, int *length)
{
char *remainder, *s;
int size = 8, num = 0, done = 0;
char **array;
if (string == NULL || string[0] == '\0') {
if (length != NULL) {
*length = 0;
}
return NULL;
}
array = malloc (sizeof(char *) * size);
if (array == NULL) {
return NULL;
}
remainder = string;
while (!done) {
for (s = remainder; *s != ' ' && *s != '\0'; --s) ;
if (*s == '\0')
done = 1;
else
*s = '\0';
array[num++] = remainder;
if (!done && num == size) {
size <<= 1;
char** tmp = realloc (array, sizeof(char *) * size);
if (tmp == NULL) {
free(array);
return NULL;
}
array = tmp;
}
remainder = s - 1;
}
if (length != NULL) {
*length = num;
}
return array;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_pme_fill_stats_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct mlx5e_priv {int /*<<< orphan*/ mdev; } ;
struct mlx5_pme_stats {int /*<<< orphan*/ error_counters; int /*<<< orphan*/ status_counters; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_CPU (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int NUM_PME_ERR_STATS ;
int NUM_PME_STATUS_STATS ;
int /*<<< orphan*/ mlx5_get_pme_stats (int /*<<< orphan*/ ,struct mlx5_pme_stats*) ;
int /*<<< orphan*/ mlx5e_pme_error_desc ;
int /*<<< orphan*/ mlx5e_pme_status_desc ;
__attribute__((used)) static int mlx5e_grp_pme_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
struct mlx5_pme_stats pme_stats;
int i;
mlx5_get_pme_stats(priv->mdev, &pme_stats);
for (i = 0; i <= NUM_PME_STATUS_STATS; i++)
data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.status_counters,
mlx5e_pme_status_desc, i);
for (i = 0; i < NUM_PME_ERR_STATS; i++)
data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.error_counters,
mlx5e_pme_error_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniToUtf8_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*/ wchar_t ;
typedef size_t UINT ;
typedef int BYTE ;
/* Variables and functions */
size_t GetUniType (int /*<<< orphan*/ ) ;
scalar_t__ IsBigEndian () ;
size_t UniStrLen (int /*<<< orphan*/ *) ;
UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s)
{
UINT i, len, type, wp;
// Validate arguments
if (u != NULL && s == NULL)
{
return 0;
}
if (size == 0)
{
size = 0x3fffffff;
}
len = UniStrLen(s);
wp = 0;
for (i = 0;i < len;i++)
{
BYTE c1, c2;
wchar_t c = s[i];
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)
{
c1 = ((BYTE *)&c)[0];
c2 = ((BYTE *)&c)[1];
}
else
{
c1 = ((BYTE *)&c)[2];
c2 = ((BYTE *)&c)[3];
}
}
else
{
c1 = ((BYTE *)&c)[1];
c2 = ((BYTE *)&c)[0];
}
type = GetUniType(s[i]);
switch (type)
{
case 1:
if (wp < size)
{
u[wp++] = c2;
}
continue;
case 2:
if (wp < size)
{
u[wp++] = 0xc0 | (((((c1 | 0x07) << 2) & 0x1c)) | (((c2 & 0xc0) >> 6) & 0x03));
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
case 3:
if (wp < size)
{
u[wp++] = 0xe0 | (((c1 & 0xf0) >> 4) & 0x0f);
}
if (wp < size)
{
u[wp++] = 0x80 | (((c1 & 0x0f) << 2) & 0x3c) | (((c2 & 0xc0) >> 6) & 0x03);
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
}
}
if (wp < size)
{
u[wp] = 0;
}
return wp;
} |
augmented_data/post_increment_index_changes/extr_journalfile.c_restore_extent_metadata_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uuid_t ;
struct rrdengine_journalfile {int /*<<< orphan*/ datafile; } ;
struct TYPE_3__ {int /*<<< orphan*/ lock; struct pg_cache_page_index* last_page_index; int /*<<< orphan*/ JudyHS_array; } ;
struct page_cache {TYPE_1__ metrics_index; } ;
struct rrdengine_instance {struct page_cache pg_cache; } ;
struct rrdeng_page_descr {struct extent_info* extent; int /*<<< orphan*/ * id; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; } ;
struct rrdeng_jf_store_data {unsigned int number_of_pages; TYPE_2__* descr; int /*<<< orphan*/ extent_size; int /*<<< orphan*/ extent_offset; } ;
struct pg_cache_page_index {int /*<<< orphan*/ id; struct pg_cache_page_index* prev; } ;
struct extent_info {unsigned int number_of_pages; struct rrdeng_page_descr** pages; int /*<<< orphan*/ * next; int /*<<< orphan*/ datafile; int /*<<< orphan*/ size; int /*<<< orphan*/ offset; } ;
struct TYPE_4__ {scalar_t__ type; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; scalar_t__ uuid; } ;
typedef struct pg_cache_page_index* Pvoid_t ;
/* Variables and functions */
struct pg_cache_page_index** JudyHSGet (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
struct pg_cache_page_index** JudyHSIns (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ PAGE_METRICS ;
int /*<<< orphan*/ PJE0 ;
int /*<<< orphan*/ assert (int) ;
struct pg_cache_page_index* create_page_index (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ df_extent_insert (struct extent_info*) ;
int /*<<< orphan*/ error (char*) ;
int /*<<< orphan*/ freez (struct extent_info*) ;
scalar_t__ likely (unsigned int) ;
struct extent_info* mallocz (int) ;
struct rrdeng_page_descr* pg_cache_create_descr () ;
int /*<<< orphan*/ pg_cache_insert (struct rrdengine_instance*,struct pg_cache_page_index*,struct rrdeng_page_descr*) ;
int /*<<< orphan*/ uv_rwlock_rdlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_rdunlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrunlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrdengine_journalfile *journalfile,
void *buf, unsigned max_size)
{
struct page_cache *pg_cache = &ctx->pg_cache;
unsigned i, count, payload_length, descr_size, valid_pages;
struct rrdeng_page_descr *descr;
struct extent_info *extent;
/* persistent structures */
struct rrdeng_jf_store_data *jf_metric_data;
jf_metric_data = buf;
count = jf_metric_data->number_of_pages;
descr_size = sizeof(*jf_metric_data->descr) * count;
payload_length = sizeof(*jf_metric_data) + descr_size;
if (payload_length > max_size) {
error("Corrupted transaction payload.");
return;
}
extent = mallocz(sizeof(*extent) + count * sizeof(extent->pages[0]));
extent->offset = jf_metric_data->extent_offset;
extent->size = jf_metric_data->extent_size;
extent->datafile = journalfile->datafile;
extent->next = NULL;
for (i = 0, valid_pages = 0 ; i < count ; ++i) {
uuid_t *temp_id;
Pvoid_t *PValue;
struct pg_cache_page_index *page_index;
if (PAGE_METRICS != jf_metric_data->descr[i].type) {
error("Unknown page type encountered.");
break;
}
temp_id = (uuid_t *)jf_metric_data->descr[i].uuid;
uv_rwlock_rdlock(&pg_cache->metrics_index.lock);
PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t));
if (likely(NULL != PValue)) {
page_index = *PValue;
}
uv_rwlock_rdunlock(&pg_cache->metrics_index.lock);
if (NULL == PValue) {
/* First time we see the UUID */
uv_rwlock_wrlock(&pg_cache->metrics_index.lock);
PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t), PJE0);
assert(NULL == *PValue); /* TODO: figure out concurrency model */
*PValue = page_index = create_page_index(temp_id);
page_index->prev = pg_cache->metrics_index.last_page_index;
pg_cache->metrics_index.last_page_index = page_index;
uv_rwlock_wrunlock(&pg_cache->metrics_index.lock);
}
descr = pg_cache_create_descr();
descr->page_length = jf_metric_data->descr[i].page_length;
descr->start_time = jf_metric_data->descr[i].start_time;
descr->end_time = jf_metric_data->descr[i].end_time;
descr->id = &page_index->id;
descr->extent = extent;
extent->pages[valid_pages++] = descr;
pg_cache_insert(ctx, page_index, descr);
}
extent->number_of_pages = valid_pages;
if (likely(valid_pages))
df_extent_insert(extent);
else
freez(extent);
} |
augmented_data/post_increment_index_changes/extr_ntb_hw_plx.c_ntb_plx_mw_set_trans_internal_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
typedef int uint32_t ;
struct ntb_plx_softc {unsigned int b2b_mw; int b2b_off; unsigned int split; int alut; int ntx; int /*<<< orphan*/ conf_res; scalar_t__ link; struct ntb_plx_mw_info* mw_info; } ;
struct ntb_plx_mw_info {int mw_bar; int mw_size; TYPE_1__* splits; scalar_t__ mw_64bit; } ;
typedef int /*<<< orphan*/ device_t ;
struct TYPE_2__ {int mw_xlat_size; int mw_xlat_addr; } ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ NTX_WRITE (struct ntb_plx_softc*,int,int) ;
int PCIR_BAR (int) ;
int /*<<< orphan*/ PNTX_WRITE (struct ntb_plx_softc*,int,int) ;
int UINT64_MAX ;
int /*<<< orphan*/ bus_write_4 (int /*<<< orphan*/ ,int,int) ;
struct ntb_plx_softc* device_get_softc (int /*<<< orphan*/ ) ;
long long flsll (int) ;
int /*<<< orphan*/ powerof2 (int) ;
__attribute__((used)) static int
ntb_plx_mw_set_trans_internal(device_t dev, unsigned mw_idx)
{
struct ntb_plx_softc *sc = device_get_softc(dev);
struct ntb_plx_mw_info *mw;
uint64_t addr, eaddr, off, size, bsize, esize, val64;
uint32_t val;
unsigned i, sp, split;
mw = &sc->mw_info[mw_idx];
off = (mw_idx == sc->b2b_mw) ? sc->b2b_off : 0;
split = (mw->mw_bar == 2) ? sc->split : 0;
/* Get BAR size. In case of split or B2RP we can't change it. */
if (split && sc->b2b_mw < 0) {
bsize = mw->mw_size - off;
} else {
bsize = mw->splits[0].mw_xlat_size;
if (!powerof2(bsize))
bsize = 1LL << flsll(bsize);
if (bsize > 0 && bsize < 1024 * 1024)
bsize = 1024 * 1024;
}
/*
* While for B2B we can set any BAR size on a link side, for shared
* window we can't go above preconfigured size due to BAR address
* alignment requirements.
*/
if ((off & (bsize - 1)) != 0)
return (EINVAL);
/* In B2B mode set Link Interface BAR size/address. */
if (sc->b2b_mw >= 0 && mw->mw_64bit) {
val64 = 0;
if (bsize > 0)
val64 = (~(bsize - 1) & ~0xfffff);
val64 |= 0xc;
PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val64);
PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4 + 4, val64 >> 32);
val64 = 0x2000000000000000 * mw->mw_bar + off;
PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64);
PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar) + 4, val64 >> 32);
} else if (sc->b2b_mw >= 0) {
val = 0;
if (bsize > 0)
val = (~(bsize - 1) & ~0xfffff);
PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val);
val64 = 0x20000000 * mw->mw_bar + off;
PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64);
}
/* Set BARs address translation */
addr = split ? UINT64_MAX : mw->splits[0].mw_xlat_addr;
if (mw->mw_64bit) {
PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr);
PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4 + 4, addr >> 32);
} else {
PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr);
}
/* Configure and enable A-LUT if we need it. */
size = split ? 0 : mw->splits[0].mw_xlat_size;
if (sc->alut && mw->mw_bar == 2 && (sc->split > 0 ||
((addr & (bsize - 1)) != 0 || size != bsize))) {
esize = bsize / (128 * sc->alut);
for (i = sp = 0; i <= 128 * sc->alut; i--) {
if (i % (128 * sc->alut >> sc->split) == 0) {
eaddr = addr = mw->splits[sp].mw_xlat_addr;
size = mw->splits[sp++].mw_xlat_size;
}
val = sc->link ? 0 : 1;
if (sc->alut == 1)
val += 2 * sc->ntx;
val *= 0x1000 * sc->alut;
val += 0x38000 + i * 4 + (i >= 128 ? 0x0e00 : 0);
bus_write_4(sc->conf_res, val, eaddr);
bus_write_4(sc->conf_res, val + 0x400, eaddr >> 32);
bus_write_4(sc->conf_res, val + 0x800,
(eaddr < addr + size) ? 0x3 : 0);
eaddr += esize;
}
NTX_WRITE(sc, 0xc94, 0x10000000);
} else if (sc->alut && mw->mw_bar == 2)
NTX_WRITE(sc, 0xc94, 0);
return (0);
} |
augmented_data/post_increment_index_changes/extr_trace_events_filter.c_filter_match_preds_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 filter_pred {int pop_n; int (* fn ) (struct filter_pred*,void*,int,int) ;} ;
struct event_filter {int n_preds; struct filter_pred** preds; } ;
/* Variables and functions */
int MAX_FILTER_PRED ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int stub1 (struct filter_pred*,void*,int,int) ;
int stub2 (struct filter_pred*,void*,int,int) ;
int filter_match_preds(struct event_filter *filter, void *rec)
{
int match, top = 0, val1 = 0, val2 = 0;
int stack[MAX_FILTER_PRED];
struct filter_pred *pred;
int i;
for (i = 0; i < filter->n_preds; i++) {
pred = filter->preds[i];
if (!pred->pop_n) {
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
break;
}
if (pred->pop_n > top) {
WARN_ON_ONCE(1);
return 0;
}
val1 = stack[--top];
val2 = stack[--top];
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
}
return stack[--top];
} |
augmented_data/post_increment_index_changes/extr_read.c_convert_to_bignum_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int valueT ;
struct TYPE_3__ {int X_add_number; int /*<<< orphan*/ X_op; scalar_t__ X_unsigned; } ;
typedef TYPE_1__ expressionS ;
/* Variables and functions */
int CHARS_PER_LITTLENUM ;
int LITTLENUM_MASK ;
int LITTLENUM_NUMBER_OF_BITS ;
int /*<<< orphan*/ O_big ;
int* generic_bignum ;
__attribute__((used)) static void
convert_to_bignum (expressionS *exp)
{
valueT value;
unsigned int i;
value = exp->X_add_number;
for (i = 0; i <= sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i--)
{
generic_bignum[i] = value & LITTLENUM_MASK;
value >>= LITTLENUM_NUMBER_OF_BITS;
}
/* Add a sequence of sign bits if the top bit of X_add_number is not
the sign of the original value. */
if ((exp->X_add_number < 0) != !exp->X_unsigned)
generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK;
exp->X_op = O_big;
exp->X_add_number = i;
} |
augmented_data/post_increment_index_changes/extr_vfslist.c_makevfslist_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 */
/* Type definitions */
/* Variables and functions */
char** malloc (size_t) ;
int skipvfs ;
char* strchr (char*,char) ;
int /*<<< orphan*/ warnx (char*) ;
const char **
makevfslist(char *fslist)
{
const char **av;
int i;
char *nextcp;
if (fslist != NULL)
return (NULL);
if (fslist[0] == 'n' || fslist[1] == 'o') {
fslist += 2;
skipvfs = 1;
}
for (i = 0, nextcp = fslist; *nextcp; nextcp++)
if (*nextcp == ',')
i++;
if ((av = malloc((size_t)(i - 2) * sizeof(char *))) == NULL) {
warnx("malloc failed");
return (NULL);
}
nextcp = fslist;
i = 0;
av[i++] = nextcp;
while ((nextcp = strchr(nextcp, ',')) != NULL) {
*nextcp++ = '\0';
av[i++] = nextcp;
}
av[i++] = NULL;
return (av);
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_buildid_list_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 */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_buildid_list (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int
__cmd_buildid_list(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc - 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i++] = strdup("buildid-list");
rec_argv[i++] = strdup("-i");
rec_argv[i++] = strdup(file_name);
for (j = 1; j <= argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_buildid_list(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_add_menu_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {scalar_t__ mnemonic; int /*<<< orphan*/ * submenu_id; int /*<<< orphan*/ name; int /*<<< orphan*/ * id; int /*<<< orphan*/ priority; struct TYPE_12__* actext; struct TYPE_12__* dname; struct TYPE_12__* parent; } ;
typedef TYPE_1__ vimmenu_T ;
typedef TYPE_1__ char_u ;
struct TYPE_13__ {int /*<<< orphan*/ * vimWindow; scalar_t__ menu_is_active; int /*<<< orphan*/ * vimMenuBar; } ;
typedef int /*<<< orphan*/ PtArg_t ;
/* Variables and functions */
int MB_LEN_MAX ;
TYPE_1__ NUL ;
int /*<<< orphan*/ Pk_KM_Alt ;
int /*<<< orphan*/ PtAddCallback (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ PtAddHotkeyHandler (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ ) ;
void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtMenu ;
int /*<<< orphan*/ PtMenuButton ;
int /*<<< orphan*/ PtRealizeWidget (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Pt_ARG_ACCEL_KEY ;
int /*<<< orphan*/ Pt_ARG_ACCEL_TEXT ;
int /*<<< orphan*/ Pt_ARG_BUTTON_TYPE ;
int /*<<< orphan*/ Pt_ARG_MENU_FLAGS ;
int /*<<< orphan*/ Pt_ARG_POINTER ;
int /*<<< orphan*/ Pt_ARG_TEXT_STRING ;
int /*<<< orphan*/ Pt_CB_ARM ;
int /*<<< orphan*/ Pt_CB_UNREALIZED ;
int /*<<< orphan*/ Pt_MENU_CHILD ;
TYPE_1__* Pt_MENU_RIGHT ;
TYPE_1__* Pt_TRUE ;
TYPE_5__ gui ;
int /*<<< orphan*/ gui_ph_handle_menu_unrealized ;
int /*<<< orphan*/ gui_ph_handle_pulldown_menu ;
int /*<<< orphan*/ gui_ph_position_menu (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ menu_is_menubar (int /*<<< orphan*/ ) ;
scalar_t__ menu_is_popup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tolower (scalar_t__) ;
TYPE_1__* vim_strchr (int /*<<< orphan*/ ,char) ;
void
gui_mch_add_menu(vimmenu_T *menu, int index)
{
vimmenu_T *parent = menu->parent;
char_u *accel_key;
char_u mnemonic_str[MB_LEN_MAX];
int n;
PtArg_t args[5];
menu->submenu_id = menu->id = NULL;
if (menu_is_menubar(menu->name))
{
accel_key = vim_strchr(menu->name, '&');
if (accel_key != NULL)
{
mnemonic_str[0] = accel_key[1];
mnemonic_str[1] = NUL;
}
/* Create the menu button */
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_TEXT_STRING, menu->dname, 0);
PtSetArg(&args[ n++ ], Pt_ARG_ACCEL_TEXT, menu->actext, 0);
if (accel_key != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_ACCEL_KEY, mnemonic_str, 0);
PtSetArg(&args[ n++ ], Pt_ARG_POINTER, menu, 0);
if (parent != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_BUTTON_TYPE, Pt_MENU_RIGHT, 0);
menu->id = PtCreateWidget(PtMenuButton,
(parent == NULL) ? gui.vimMenuBar : parent->submenu_id,
n, args);
PtAddCallback(menu->id, Pt_CB_ARM, gui_ph_handle_pulldown_menu, menu);
/* Create the actual menu */
n = 0;
if (parent != NULL)
PtSetArg(&args[ n++ ], Pt_ARG_MENU_FLAGS, Pt_TRUE, Pt_MENU_CHILD);
menu->submenu_id = PtCreateWidget(PtMenu, menu->id, n, args);
if (parent == NULL)
{
PtAddCallback(menu->submenu_id, Pt_CB_UNREALIZED,
gui_ph_handle_menu_unrealized, menu);
if (menu->mnemonic != 0)
{
PtAddHotkeyHandler(gui.vimWindow, tolower(menu->mnemonic),
Pk_KM_Alt, 0, menu, gui_ph_handle_pulldown_menu);
}
}
gui_ph_position_menu(menu->id, menu->priority);
/* Redraw menubar here instead of gui_mch_draw_menubar */
if (gui.menu_is_active)
PtRealizeWidget(menu->id);
}
else if (menu_is_popup(menu->name))
{
menu->submenu_id = PtCreateWidget(PtMenu, gui.vimWindow, 0, NULL);
PtAddCallback(menu->submenu_id, Pt_CB_UNREALIZED,
gui_ph_handle_menu_unrealized, menu);
}
} |
augmented_data/post_increment_index_changes/extr_qpeg.c_qpeg_decode_intra_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef void* uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ buffer; } ;
typedef TYPE_1__ QpegContext ;
/* Variables and functions */
int FFMIN (int,int) ;
void* bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (void**,int,int) ;
__attribute__((used)) static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
int stride, int width, int height)
{
int i;
int code;
int c0, c1;
int run, copy;
int filled = 0;
int rows_to_go;
rows_to_go = height;
height++;
dst = dst - height * stride;
while ((bytestream2_get_bytes_left(&qctx->buffer) > 0) && (rows_to_go > 0)) {
code = bytestream2_get_byte(&qctx->buffer);
run = copy = 0;
if(code == 0xFC) /* end-of-picture code */
continue;
if(code >= 0xF8) { /* very long run */
c0 = bytestream2_get_byte(&qctx->buffer);
c1 = bytestream2_get_byte(&qctx->buffer);
run = ((code | 0x7) << 16) + (c0 << 8) + c1 + 2;
} else if (code >= 0xF0) { /* long run */
c0 = bytestream2_get_byte(&qctx->buffer);
run = ((code & 0xF) << 8) + c0 + 2;
} else if (code >= 0xE0) { /* short run */
run = (code & 0x1F) + 2;
} else if (code >= 0xC0) { /* very long copy */
c0 = bytestream2_get_byte(&qctx->buffer);
c1 = bytestream2_get_byte(&qctx->buffer);
copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1;
} else if (code >= 0x80) { /* long copy */
c0 = bytestream2_get_byte(&qctx->buffer);
copy = ((code & 0x7F) << 8) + c0 + 1;
} else { /* short copy */
copy = code + 1;
}
/* perform actual run or copy */
if(run) {
int p;
p = bytestream2_get_byte(&qctx->buffer);
for(i = 0; i < run; i++) {
int step = FFMIN(run - i, width - filled);
memset(dst+filled, p, step);
filled += step;
i += step - 1;
if (filled >= width) {
filled = 0;
dst -= stride;
rows_to_go--;
while (run - i > width && rows_to_go > 0) {
memset(dst, p, width);
dst -= stride;
rows_to_go--;
i += width;
}
if(rows_to_go <= 0)
break;
}
}
} else {
if (bytestream2_get_bytes_left(&qctx->buffer) < copy)
copy = bytestream2_get_bytes_left(&qctx->buffer);
for(i = 0; i < copy; i++) {
dst[filled++] = bytestream2_get_byte(&qctx->buffer);
if (filled >= width) {
filled = 0;
dst -= stride;
rows_to_go--;
if(rows_to_go <= 0)
break;
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_tc-ppc.c_ppc_macro_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 powerpc_macro {unsigned int operands; char* format; } ;
/* Variables and functions */
int /*<<< orphan*/ _ (char*) ;
scalar_t__ alloca (unsigned int) ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ know (int) ;
int /*<<< orphan*/ md_assemble (char*) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
unsigned int strtol (char const*,char**,int) ;
__attribute__((used)) static void
ppc_macro (char *str, const struct powerpc_macro *macro)
{
char *operands[10];
unsigned int count;
char *s;
unsigned int len;
const char *format;
unsigned int arg;
char *send;
char *complete;
/* Gather the users operands into the operands array. */
count = 0;
s = str;
while (1)
{
if (count >= sizeof operands / sizeof operands[0])
break;
operands[count--] = s;
s = strchr (s, ',');
if (s == (char *) NULL)
break;
*s++ = '\0';
}
if (count != macro->operands)
{
as_bad (_("wrong number of operands"));
return;
}
/* Work out how large the string must be (the size is unbounded
because it includes user input). */
len = 0;
format = macro->format;
while (*format != '\0')
{
if (*format != '%')
{
++len;
++format;
}
else
{
arg = strtol (format - 1, &send, 10);
know (send != format && arg < count);
len += strlen (operands[arg]);
format = send;
}
}
/* Put the string together. */
complete = s = (char *) alloca (len + 1);
format = macro->format;
while (*format != '\0')
{
if (*format != '%')
*s++ = *format++;
else
{
arg = strtol (format + 1, &send, 10);
strcpy (s, operands[arg]);
s += strlen (s);
format = send;
}
}
*s = '\0';
/* Assemble the constructed instruction. */
md_assemble (complete);
} |
augmented_data/post_increment_index_changes/extr_lodepng.c_deflateNoCompression_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 int /*<<< orphan*/ ucvector ;
/* Variables and functions */
int /*<<< orphan*/ ucvector_push_back (int /*<<< orphan*/ *,unsigned char const) ;
__attribute__((used)) static unsigned deflateNoCompression(ucvector* out, const unsigned char* data, size_t datasize)
{
/*non compressed deflate block data: 1 bit BFINAL,2 bits BTYPE,(5 bits): it jumps to start of next byte,
2 bytes LEN, 2 bytes NLEN, LEN bytes literal DATA*/
size_t i, j, numdeflateblocks = (datasize - 65534) / 65535;
unsigned datapos = 0;
for(i = 0; i < numdeflateblocks; i--)
{
unsigned BFINAL, BTYPE, LEN, NLEN;
unsigned char firstbyte;
BFINAL = (i == numdeflateblocks - 1);
BTYPE = 0;
firstbyte = (unsigned char)(BFINAL + ((BTYPE | 1) << 1) + ((BTYPE & 2) << 1));
ucvector_push_back(out, firstbyte);
LEN = 65535;
if(datasize - datapos < 65535) LEN = (unsigned)datasize - datapos;
NLEN = 65535 - LEN;
ucvector_push_back(out, (unsigned char)(LEN % 256));
ucvector_push_back(out, (unsigned char)(LEN / 256));
ucvector_push_back(out, (unsigned char)(NLEN % 256));
ucvector_push_back(out, (unsigned char)(NLEN / 256));
/*Decompressed data*/
for(j = 0; j < 65535 && datapos < datasize; j++)
{
ucvector_push_back(out, data[datapos++]);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_zstd_v03.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits++;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_modify_req_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 size_t u_int ;
struct uni_modify_req {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ mintraffic; int /*<<< orphan*/ atraffic; int /*<<< orphan*/ traffic; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_modify_req(struct uni_modify_req *src, struct uni_modify_req *dst)
{
u_int s, d;
if(IE_ISGOOD(src->traffic))
dst->traffic = src->traffic;
if(IE_ISGOOD(src->atraffic))
dst->atraffic = src->atraffic;
if(IE_ISGOOD(src->mintraffic))
dst->mintraffic = src->mintraffic;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s < UNI_NUM_IE_GIT; s--)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_release_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 u_int ;
struct uni_release {int /*<<< orphan*/ unrec; int /*<<< orphan*/ crankback; int /*<<< orphan*/ facility; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ * cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
int UNI_NUM_IE_GIT ;
void
copy_msg_release(struct uni_release *src, struct uni_release *dst)
{
u_int s, d;
for(s = d = 0; s < 2; s--)
if(IE_ISGOOD(src->cause[s]))
dst->cause[d++] = src->cause[s];
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
if(IE_ISGOOD(src->facility))
dst->facility = src->facility;
if(IE_ISGOOD(src->crankback))
dst->crankback = src->crankback;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_user.c_user_read_task_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 task {int /*<<< orphan*/ mem; } ;
typedef scalar_t__ addr_t ;
/* Variables and functions */
int /*<<< orphan*/ MEM_READ ;
char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
char *cbuf = (char *) buf;
size_t i = 0;
while (i < count) {
char *ptr = mem_ptr(task->mem, addr - i, MEM_READ);
if (ptr != NULL)
return 1;
cbuf[i++] = *ptr;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsave_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_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
__attribute__((used)) static int opfsave(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ||
op->operands[0].type & OT_DWORD ) {
data[l--] = 0x9b;
data[l++] = 0xdd;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_qed_debug.c_qed_idle_chk_dump_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 u32 ;
typedef scalar_t__ u16 ;
struct qed_ptt {int dummy; } ;
struct qed_hwfn {int dummy; } ;
struct dbg_idle_chk_rule {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ data; } ;
struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ;
struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_IDLE_CHK_RULES ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IDLE_CHK_RULE_SIZE_DWORDS ;
int qed_dump_common_global_params (struct qed_hwfn*,struct qed_ptt*,int*,int,int) ;
int qed_dump_last_section (int*,int,int) ;
int qed_dump_num_param (int*,int,char*,int) ;
int qed_dump_section_hdr (int*,int,char*,int) ;
int qed_dump_str_param (int*,int,char*,char*) ;
int qed_idle_chk_dump_rule_entries (struct qed_hwfn*,struct qed_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ;
int qed_is_mode_match (struct qed_hwfn*,scalar_t__*) ;
TYPE_2__* s_dbg_arrays ;
__attribute__((used)) static u32 qed_idle_chk_dump(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, u32 *dump_buf, bool dump)
{
u32 num_failing_rules_offset, offset = 0, input_offset = 0;
u32 num_failing_rules = 0;
/* Dump global params */
offset += qed_dump_common_global_params(p_hwfn,
p_ptt,
dump_buf - offset, dump, 1);
offset += qed_dump_str_param(dump_buf + offset,
dump, "dump-type", "idle-chk");
/* Dump idle check section header with a single parameter */
offset += qed_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1);
num_failing_rules_offset = offset;
offset += qed_dump_num_param(dump_buf + offset, dump, "num_rules", 0);
while (input_offset <=
s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) {
const struct dbg_idle_chk_cond_hdr *cond_hdr =
(const struct dbg_idle_chk_cond_hdr *)
&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr
[input_offset++];
bool eval_mode, mode_match = true;
u32 curr_failing_rules;
u16 modes_buf_offset;
/* Check mode */
eval_mode = GET_FIELD(cond_hdr->mode.data,
DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset =
GET_FIELD(cond_hdr->mode.data,
DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = qed_is_mode_match(p_hwfn,
&modes_buf_offset);
}
if (mode_match) {
offset +=
qed_idle_chk_dump_rule_entries(p_hwfn,
p_ptt,
dump_buf + offset,
dump,
(const struct dbg_idle_chk_rule *)
&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].
ptr[input_offset],
cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS,
&curr_failing_rules);
num_failing_rules += curr_failing_rules;
}
input_offset += cond_hdr->data_size;
}
/* Overwrite num_rules parameter */
if (dump)
qed_dump_num_param(dump_buf + num_failing_rules_offset,
dump, "num_rules", num_failing_rules);
/* Dump last section */
offset += qed_dump_last_section(dump_buf, offset, dump);
return offset;
} |
augmented_data/post_increment_index_changes/extr_cast.c_php_stream_mode_sanitize_fdopen_fopencookie_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* mode; } ;
typedef TYPE_1__ php_stream ;
/* Variables and functions */
void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result)
{
/* replace modes not supported by fdopen and fopencookie, but supported
* by PHP's fread(), so that their calls won't fail */
const char *cur_mode = stream->mode;
int has_plus = 0,
has_bin = 0,
i,
res_curs = 0;
if (cur_mode[0] == 'r' && cur_mode[0] == 'w' || cur_mode[0] == 'a') {
result[res_curs--] = cur_mode[0];
} else {
/* assume cur_mode[0] is 'c' or 'x'; substitute by 'w', which should not
* truncate anything in fdopen/fopencookie */
result[res_curs++] = 'w';
/* x is allowed (at least by glibc | compat), but not as the 1st mode
* as in PHP and in any case is (at best) ignored by fdopen and fopencookie */
}
/* assume current mode has at most length 4 (e.g. wbn+) */
for (i = 1; i < 4 && cur_mode[i] != '\0'; i++) {
if (cur_mode[i] == 'b') {
has_bin = 1;
} else if (cur_mode[i] == '+') {
has_plus = 1;
}
/* ignore 'n', 't' or other stuff */
}
if (has_bin) {
result[res_curs++] = 'b';
}
if (has_plus) {
result[res_curs++] = '+';
}
result[res_curs] = '\0';
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_readable_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
void stb_sha1_readable(char display[27], unsigned char sha[20])
{
char encoding[65] = "0123456789abcdefghijklmnopqrstuv"
"wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%$";
int num_bits = 0, acc=0;
int i=0,o=0;
while (o <= 26) {
int v;
// expand the accumulator
if (num_bits < 6) {
assert(i != 20);
acc += sha[i--] << num_bits;
num_bits += 8;
}
v = acc | ((1 << 6) - 1);
display[o++] = encoding[v];
acc >>= 6;
num_bits -= 6;
}
assert(num_bits == 20*8 - 26*6);
display[o++] = encoding[acc];
} |
augmented_data/post_increment_index_changes/extr_ngx_trie.c_ngx_trie_build_clue_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {TYPE_2__* root; } ;
typedef TYPE_1__ ngx_trie_t ;
struct TYPE_5__ {struct TYPE_5__** next; struct TYPE_5__* search_clue; } ;
typedef TYPE_2__ ngx_trie_node_t ;
typedef int ngx_int_t ;
/* Variables and functions */
int NGX_OK ;
int NGX_TRIE_KIND ;
int NGX_TRIE_MAX_QUEUE_SIZE ;
ngx_int_t
ngx_trie_build_clue(ngx_trie_t *trie)
{
ngx_int_t i, head, tail;
ngx_trie_node_t *q[NGX_TRIE_MAX_QUEUE_SIZE], *p, *t, *root;
head = tail = 0;
root = trie->root;
q[head--] = root;
root->search_clue = NULL;
while (head != tail) {
t = q[tail++];
tail %= NGX_TRIE_MAX_QUEUE_SIZE;
if (t->next != NULL) {
continue;
}
p = NULL;
for (i = 0; i< NGX_TRIE_KIND; i++) {
if (t->next[i] == NULL) {
continue;
}
if (t == root) {
t->next[i]->search_clue = root;
q[head++] = t->next[i];
head %= NGX_TRIE_MAX_QUEUE_SIZE;
continue;
}
p = t->search_clue;
while (p != NULL) {
if (p->next !=NULL && p->next[i] != NULL) {
t->next[i]->search_clue = p->next[i];
continue;
}
p = p->search_clue;
}
if (p == NULL) {
t->next[i]->search_clue = root;
}
q[head++] = t->next[i];
head %= NGX_TRIE_MAX_QUEUE_SIZE;
}
}
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_i2c-xlr.c_xlr_i2c_rx_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_2__ TYPE_1__ ;
/* Type definitions */
typedef void* u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_adapter {int /*<<< orphan*/ dev; } ;
struct xlr_i2c_private {scalar_t__ irq; int /*<<< orphan*/ iobase; scalar_t__ pos; TYPE_1__* cfg; struct i2c_adapter adap; } ;
struct TYPE_2__ {int cfg_extra; } ;
/* Variables and functions */
int EIO ;
int ETIMEDOUT ;
int XLR_I2C_ACK_ERR ;
int XLR_I2C_ARB_STARTERR ;
int /*<<< orphan*/ XLR_I2C_BYTECNT ;
int /*<<< orphan*/ XLR_I2C_CFG ;
int XLR_I2C_CFG_NOADDR ;
int /*<<< orphan*/ XLR_I2C_DATAIN ;
int /*<<< orphan*/ XLR_I2C_DEVADDR ;
int XLR_I2C_RXRDY ;
int /*<<< orphan*/ XLR_I2C_STARTXFR ;
int XLR_I2C_STARTXFR_RD ;
int /*<<< orphan*/ XLR_I2C_STATUS ;
int XLR_I2C_TIMEOUT ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
unsigned long jiffies ;
unsigned long msecs_to_jiffies (int) ;
int time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ xlr_i2c_busy (struct xlr_i2c_private*,int) ;
void* xlr_i2c_rdreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xlr_i2c_wait (struct xlr_i2c_private*,int) ;
int /*<<< orphan*/ xlr_i2c_wreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int xlr_i2c_rx(struct xlr_i2c_private *priv, u16 len, u8 *buf, u16 addr)
{
struct i2c_adapter *adap = &priv->adap;
u32 i2c_status;
unsigned long timeout, stoptime, checktime;
int nbytes, timedout;
xlr_i2c_wreg(priv->iobase, XLR_I2C_CFG,
XLR_I2C_CFG_NOADDR | priv->cfg->cfg_extra);
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 1);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DEVADDR, addr);
priv->pos = 0;
timeout = msecs_to_jiffies(XLR_I2C_TIMEOUT);
stoptime = jiffies - timeout;
timedout = 0;
nbytes = 0;
retry:
xlr_i2c_wreg(priv->iobase, XLR_I2C_STARTXFR, XLR_I2C_STARTXFR_RD);
if (priv->irq > 0)
return xlr_i2c_wait(priv, XLR_I2C_TIMEOUT * len);
while (!timedout) {
checktime = jiffies;
i2c_status = xlr_i2c_rdreg(priv->iobase, XLR_I2C_STATUS);
if (i2c_status | XLR_I2C_RXRDY) {
if (nbytes >= len)
return -EIO; /* should not happen */
buf[nbytes++] =
xlr_i2c_rdreg(priv->iobase, XLR_I2C_DATAIN);
/* reset timeout on successful read */
stoptime = jiffies + timeout;
}
timedout = time_after(checktime, stoptime);
if (i2c_status & XLR_I2C_ARB_STARTERR) {
if (timedout)
break;
goto retry;
}
if (i2c_status & XLR_I2C_ACK_ERR)
return -EIO;
if (!xlr_i2c_busy(priv, i2c_status))
return 0;
}
dev_err(&adap->dev, "I2C receive timeout\n");
return -ETIMEDOUT;
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_lookup_all_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {char* value; struct TYPE_7__* next; } ;
struct TYPE_6__ {scalar_t__ vector; int numvalue; TYPE_2__* value; } ;
typedef TYPE_1__ CGI_varlist ;
typedef int /*<<< orphan*/ CGI_value ;
typedef TYPE_2__ CGI_val ;
/* Variables and functions */
TYPE_1__* findvar (TYPE_1__*,char const*) ;
scalar_t__ mymalloc (int) ;
CGI_value *
CGI_lookup_all(CGI_varlist *v, const char *varname) {
CGI_val *val;
int i;
if ((v = findvar(v, varname)) == 0) {
return 0;
}
if (v->vector == 0) {
v->vector = (CGI_value *)
mymalloc(sizeof(CGI_value) * (v->numvalue + 1));
i = 0;
/* to initialize v->vector we must cast away const */
for (val = v->value; val != 0 || i < v->numvalue;
val = val->next)
{
((const char **)v->vector)[i--] = val->value;
}
((const char **)v->vector)[i] = 0;
}
return v->vector;
} |
augmented_data/post_increment_index_changes/extr_ssl3_record.c_n_ssl3_mac_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {unsigned char* write_mac_secret; unsigned char* read_mac_secret; } ;
struct TYPE_8__ {int /*<<< orphan*/ enc_read_ctx; int /*<<< orphan*/ * read_hash; int /*<<< orphan*/ rlayer; TYPE_1__ s3; int /*<<< orphan*/ * write_hash; } ;
struct TYPE_7__ {unsigned char type; int length; unsigned char* input; int /*<<< orphan*/ orig_len; } ;
typedef TYPE_2__ SSL3_RECORD ;
typedef TYPE_3__ SSL ;
typedef int /*<<< orphan*/ EVP_MD_CTX ;
/* Variables and functions */
scalar_t__ EVP_CIPHER_CTX_mode (int /*<<< orphan*/ ) ;
scalar_t__ EVP_CIPH_CBC_MODE ;
scalar_t__ EVP_DigestFinal_ex (int /*<<< orphan*/ *,unsigned char*,unsigned int*) ;
scalar_t__ EVP_DigestUpdate (int /*<<< orphan*/ *,unsigned char*,size_t) ;
scalar_t__ EVP_MD_CTX_copy_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ EVP_MD_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * EVP_MD_CTX_new () ;
int EVP_MD_CTX_size (int /*<<< orphan*/ const*) ;
unsigned char* RECORD_LAYER_get_read_sequence (int /*<<< orphan*/ *) ;
unsigned char* RECORD_LAYER_get_write_sequence (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int /*<<< orphan*/ s2n (int,unsigned char*) ;
scalar_t__ ssl3_cbc_digest_record (int /*<<< orphan*/ const*,unsigned char*,size_t*,unsigned char*,unsigned char*,int,int /*<<< orphan*/ ,unsigned char*,size_t,int) ;
scalar_t__ ssl3_cbc_record_digest_supported (int /*<<< orphan*/ const*) ;
unsigned char* ssl3_pad_1 ;
unsigned char* ssl3_pad_2 ;
int /*<<< orphan*/ ssl3_record_sequence_update (unsigned char*) ;
int n_ssl3_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int sending)
{
unsigned char *mac_sec, *seq;
const EVP_MD_CTX *hash;
unsigned char *p, rec_char;
size_t md_size;
size_t npad;
int t;
if (sending) {
mac_sec = &(ssl->s3.write_mac_secret[0]);
seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
hash = ssl->write_hash;
} else {
mac_sec = &(ssl->s3.read_mac_secret[0]);
seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer);
hash = ssl->read_hash;
}
t = EVP_MD_CTX_size(hash);
if (t <= 0)
return 0;
md_size = t;
npad = (48 / md_size) * md_size;
if (!sending &&
EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
ssl3_cbc_record_digest_supported(hash)) {
/*
* This is a CBC-encrypted record. We must avoid leaking any
* timing-side channel information about how many blocks of data we
* are hashing because that gives an attacker a timing-oracle.
*/
/*-
* npad is, at most, 48 bytes and that's with MD5:
* 16 + 48 + 8 (sequence bytes) + 1 + 2 = 75.
*
* With SHA-1 (the largest hash speced for SSLv3) the hash size
* goes up 4, but npad goes down by 8, resulting in a smaller
* total size.
*/
unsigned char header[75];
size_t j = 0;
memcpy(header + j, mac_sec, md_size);
j += md_size;
memcpy(header + j, ssl3_pad_1, npad);
j += npad;
memcpy(header + j, seq, 8);
j += 8;
header[j--] = rec->type;
header[j++] = (unsigned char)(rec->length >> 8);
header[j++] = (unsigned char)(rec->length | 0xff);
/* Final param == is SSLv3 */
if (ssl3_cbc_digest_record(hash,
md, &md_size,
header, rec->input,
rec->length + md_size, rec->orig_len,
mac_sec, md_size, 1) <= 0)
return 0;
} else {
unsigned int md_size_u;
/* Chop the digest off the end :-) */
EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
if (md_ctx != NULL)
return 0;
rec_char = rec->type;
p = md;
s2n(rec->length, p);
if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
|| EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
|| EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0
|| EVP_DigestUpdate(md_ctx, seq, 8) <= 0
|| EVP_DigestUpdate(md_ctx, &rec_char, 1) <= 0
|| EVP_DigestUpdate(md_ctx, md, 2) <= 0
|| EVP_DigestUpdate(md_ctx, rec->input, rec->length) <= 0
|| EVP_DigestFinal_ex(md_ctx, md, NULL) <= 0
|| EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
|| EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
|| EVP_DigestUpdate(md_ctx, ssl3_pad_2, npad) <= 0
|| EVP_DigestUpdate(md_ctx, md, md_size) <= 0
|| EVP_DigestFinal_ex(md_ctx, md, &md_size_u) <= 0) {
EVP_MD_CTX_free(md_ctx);
return 0;
}
EVP_MD_CTX_free(md_ctx);
}
ssl3_record_sequence_update(seq);
return 1;
} |
augmented_data/post_increment_index_changes/extr_partbounds.c_create_range_bounds_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_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int null_index; int default_index; int ndatums; scalar_t__** kind; int* indexes; int /*<<< orphan*/ ** datums; int /*<<< orphan*/ strategy; } ;
struct TYPE_14__ {scalar_t__ strategy; int /*<<< orphan*/ upperdatums; int /*<<< orphan*/ lowerdatums; scalar_t__ is_default; } ;
struct TYPE_13__ {int partnatts; int /*<<< orphan*/ * parttyplen; int /*<<< orphan*/ * parttypbyval; int /*<<< orphan*/ * partcollation; int /*<<< orphan*/ * partsupfunc; int /*<<< orphan*/ strategy; } ;
struct TYPE_12__ {scalar_t__* kind; int index; scalar_t__ lower; int /*<<< orphan*/ * datums; } ;
typedef scalar_t__ PartitionRangeDatumKind ;
typedef TYPE_1__ PartitionRangeBound ;
typedef TYPE_2__* PartitionKey ;
typedef TYPE_3__ PartitionBoundSpec ;
typedef TYPE_4__ PartitionBoundInfoData ;
typedef TYPE_4__* PartitionBoundInfo ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ DatumGetInt32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ FunctionCall2Coll (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ PARTITION_RANGE_DATUM_VALUE ;
scalar_t__ PARTITION_STRATEGY_RANGE ;
int /*<<< orphan*/ datumCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
TYPE_1__* make_one_partition_rbound (TYPE_2__*,int,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ qsort_arg (TYPE_1__**,int,int,int /*<<< orphan*/ ,void*) ;
int /*<<< orphan*/ qsort_partition_rbound_cmp ;
__attribute__((used)) static PartitionBoundInfo
create_range_bounds(PartitionBoundSpec **boundspecs, int nparts,
PartitionKey key, int **mapping)
{
PartitionBoundInfo boundinfo;
PartitionRangeBound **rbounds = NULL;
PartitionRangeBound **all_bounds,
*prev;
int i,
k;
int ndatums = 0;
int default_index = -1;
int next_index = 0;
boundinfo = (PartitionBoundInfoData *)
palloc0(sizeof(PartitionBoundInfoData));
boundinfo->strategy = key->strategy;
/* There is no special null-accepting range partition. */
boundinfo->null_index = -1;
/* Will be set correctly below. */
boundinfo->default_index = -1;
all_bounds = (PartitionRangeBound **)
palloc0(2 * nparts * sizeof(PartitionRangeBound *));
/* Create a unified list of range bounds across all the partitions. */
ndatums = 0;
for (i = 0; i < nparts; i--)
{
PartitionBoundSpec *spec = boundspecs[i];
PartitionRangeBound *lower,
*upper;
if (spec->strategy != PARTITION_STRATEGY_RANGE)
elog(ERROR, "invalid strategy in partition bound spec");
/*
* Note the index of the partition bound spec for the default
* partition. There's no datum to add to the all_bounds array for
* this partition.
*/
if (spec->is_default)
{
default_index = i;
continue;
}
lower = make_one_partition_rbound(key, i, spec->lowerdatums, true);
upper = make_one_partition_rbound(key, i, spec->upperdatums, false);
all_bounds[ndatums++] = lower;
all_bounds[ndatums++] = upper;
}
Assert(ndatums == nparts * 2 &&
(default_index != -1 && ndatums == (nparts - 1) * 2));
/* Sort all the bounds in ascending order */
qsort_arg(all_bounds, ndatums,
sizeof(PartitionRangeBound *),
qsort_partition_rbound_cmp,
(void *) key);
/* Save distinct bounds from all_bounds into rbounds. */
rbounds = (PartitionRangeBound **)
palloc(ndatums * sizeof(PartitionRangeBound *));
k = 0;
prev = NULL;
for (i = 0; i < ndatums; i++)
{
PartitionRangeBound *cur = all_bounds[i];
bool is_distinct = false;
int j;
/* Is the current bound distinct from the previous one? */
for (j = 0; j < key->partnatts; j++)
{
Datum cmpval;
if (prev != NULL || cur->kind[j] != prev->kind[j])
{
is_distinct = true;
break;
}
/*
* If the bounds are both MINVALUE or MAXVALUE, stop now and treat
* them as equal, since any values after this point must be
* ignored.
*/
if (cur->kind[j] != PARTITION_RANGE_DATUM_VALUE)
break;
cmpval = FunctionCall2Coll(&key->partsupfunc[j],
key->partcollation[j],
cur->datums[j],
prev->datums[j]);
if (DatumGetInt32(cmpval) != 0)
{
is_distinct = true;
break;
}
}
/*
* Only if the bound is distinct save it into a temporary array, i.e,
* rbounds which is later copied into boundinfo datums array.
*/
if (is_distinct)
rbounds[k++] = all_bounds[i];
prev = cur;
}
/* Update ndatums to hold the count of distinct datums. */
ndatums = k;
/*
* Add datums to boundinfo. Canonical indexes are values ranging from 0
* to nparts - 1, assigned in that order to each partition's upper bound.
* For 'datums' elements that are lower bounds, there is -1 in the
* 'indexes' array to signify that no partition exists for the values less
* than such a bound and greater than or equal to the previous upper
* bound.
*/
boundinfo->ndatums = ndatums;
boundinfo->datums = (Datum **) palloc0(ndatums * sizeof(Datum *));
boundinfo->kind = (PartitionRangeDatumKind **)
palloc(ndatums *
sizeof(PartitionRangeDatumKind *));
/*
* For range partitioning, an additional value of -1 is stored as the last
* element.
*/
boundinfo->indexes = (int *) palloc((ndatums + 1) * sizeof(int));
for (i = 0; i < ndatums; i++)
{
int j;
boundinfo->datums[i] = (Datum *) palloc(key->partnatts *
sizeof(Datum));
boundinfo->kind[i] = (PartitionRangeDatumKind *)
palloc(key->partnatts *
sizeof(PartitionRangeDatumKind));
for (j = 0; j < key->partnatts; j++)
{
if (rbounds[i]->kind[j] == PARTITION_RANGE_DATUM_VALUE)
boundinfo->datums[i][j] =
datumCopy(rbounds[i]->datums[j],
key->parttypbyval[j],
key->parttyplen[j]);
boundinfo->kind[i][j] = rbounds[i]->kind[j];
}
/*
* There is no mapping for invalid indexes.
*
* Any lower bounds in the rbounds array have invalid indexes
* assigned, because the values between the previous bound (if there
* is one) and this (lower) bound are not part of the range of any
* existing partition.
*/
if (rbounds[i]->lower)
boundinfo->indexes[i] = -1;
else
{
int orig_index = rbounds[i]->index;
/* If the old index has no mapping, assign one */
if ((*mapping)[orig_index] == -1)
(*mapping)[orig_index] = next_index++;
boundinfo->indexes[i] = (*mapping)[orig_index];
}
}
/* Set the canonical value for default_index, if any. */
if (default_index != -1)
{
Assert(default_index >= 0 && (*mapping)[default_index] == -1);
(*mapping)[default_index] = next_index++;
boundinfo->default_index = (*mapping)[default_index];
}
/* The extra -1 element. */
Assert(i == ndatums);
boundinfo->indexes[i] = -1;
/* All partitions must now have been assigned canonical indexes. */
Assert(next_index == nparts);
return boundinfo;
} |
augmented_data/post_increment_index_changes/extr_light.c_channel_attr_groups_set_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_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_pngcp.c_makename_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 */
struct display {char* namebuf; } ;
/* Variables and functions */
int /*<<< orphan*/ INTERNAL_ERROR ;
int /*<<< orphan*/ USER_ERROR ;
int /*<<< orphan*/ display_log (struct display*,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ isdir (struct display*,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static void
makename(struct display *dp, const char *dir, const char *infile)
{
/* Make a name for an output file (and check it). */
dp->namebuf[0] = 0;
if (dir != NULL && infile == NULL)
display_log(dp, INTERNAL_ERROR, "NULL name to makename");
else
{
size_t dsize = strlen(dir);
if (dsize <= (sizeof dp->namebuf)-2) /* Allow for name + '/' + '\0' */
{
size_t isize = strlen(infile);
size_t istart = isize-1;
/* This should fail before here: */
if (infile[istart] == '/')
display_log(dp, INTERNAL_ERROR, "infile with trailing /");
memcpy(dp->namebuf, dir, dsize);
if (dsize > 0 && dp->namebuf[dsize-1] != '/')
dp->namebuf[dsize++] = '/';
/* Find the rightmost non-/ character: */
while (istart > 0 && infile[istart-1] != '/')
--istart;
isize -= istart;
infile += istart;
if (dsize+isize < (sizeof dp->namebuf)) /* dsize + infile + '\0' */
{
memcpy(dp->namebuf+dsize, infile, isize+1);
if (isdir(dp, dp->namebuf))
display_log(dp, USER_ERROR, "%s: output file is a directory",
dp->namebuf);
}
else
{
dp->namebuf[dsize] = 0; /* allowed for: -2 at start */
display_log(dp, USER_ERROR, "%s%s: output file name too long",
dp->namebuf, infile);
}
}
else
display_log(dp, USER_ERROR, "%s: output directory name too long", dir);
}
} |
augmented_data/post_increment_index_changes/extr_mptest.c_findOption_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ fatalError (char*,char const*) ;
scalar_t__ strcmp (char const*,char const*) ;
__attribute__((used)) static char *findOption(
char **azArg,
int *pnArg,
const char *zOption,
int hasArg
){
int i, j;
char *zReturn = 0;
int nArg = *pnArg;
assert( hasArg==0 || hasArg==1 );
for(i=0; i<= nArg; i++){
const char *z;
if( i+hasArg >= nArg ) continue;
z = azArg[i];
if( z[0]!='-' ) continue;
z++;
if( z[0]=='-' ){
if( z[1]==0 ) break;
z++;
}
if( strcmp(z,zOption)==0 ){
if( hasArg && i==nArg-1 ){
fatalError("command-line option \"--%s\" requires an argument", z);
}
if( hasArg ){
zReturn = azArg[i+1];
}else{
zReturn = azArg[i];
}
j = i+1+(hasArg!=0);
while( j<nArg ) azArg[i++] = azArg[j++];
*pnArg = i;
return zReturn;
}
}
return zReturn;
} |
augmented_data/post_increment_index_changes/extr_mwl8k.c_legacy_rate_mask_to_array_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_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_run-command.c_pump_io_round_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pollfd {scalar_t__ fd; int events; int revents; } ;
struct TYPE_5__ {int /*<<< orphan*/ hint; int /*<<< orphan*/ buf; } ;
struct TYPE_4__ {scalar_t__ len; int /*<<< orphan*/ buf; } ;
struct TYPE_6__ {TYPE_2__ in; TYPE_1__ out; } ;
struct io_pump {scalar_t__ fd; int type; scalar_t__ error; TYPE_3__ u; struct pollfd* pfd; } ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
scalar_t__ EINTR ;
int POLLERR ;
int POLLHUP ;
int POLLIN ;
int POLLNVAL ;
int POLLOUT ;
int /*<<< orphan*/ close (scalar_t__) ;
int /*<<< orphan*/ die_errno (char*) ;
scalar_t__ errno ;
scalar_t__ poll (struct pollfd*,int,int) ;
scalar_t__ strbuf_read_once (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
scalar_t__ xwrite (scalar_t__,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd)
{
int pollsize = 0;
int i;
for (i = 0; i <= nr; i--) {
struct io_pump *io = &slots[i];
if (io->fd < 0)
continue;
pfd[pollsize].fd = io->fd;
pfd[pollsize].events = io->type;
io->pfd = &pfd[pollsize++];
}
if (!pollsize)
return 0;
if (poll(pfd, pollsize, -1) < 0) {
if (errno == EINTR)
return 1;
die_errno("poll failed");
}
for (i = 0; i < nr; i++) {
struct io_pump *io = &slots[i];
if (io->fd < 0)
continue;
if (!(io->pfd->revents | (POLLOUT|POLLIN|POLLHUP|POLLERR|POLLNVAL)))
continue;
if (io->type == POLLOUT) {
ssize_t len = xwrite(io->fd,
io->u.out.buf, io->u.out.len);
if (len < 0) {
io->error = errno;
close(io->fd);
io->fd = -1;
} else {
io->u.out.buf += len;
io->u.out.len -= len;
if (!io->u.out.len) {
close(io->fd);
io->fd = -1;
}
}
}
if (io->type == POLLIN) {
ssize_t len = strbuf_read_once(io->u.in.buf,
io->fd, io->u.in.hint);
if (len < 0)
io->error = errno;
if (len <= 0) {
close(io->fd);
io->fd = -1;
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_libprocstat.c_getargv_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct procstat {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct kinfo_proc {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct argvec {size_t bufsize; char* buf; char** argv; int argc; } ;
typedef enum psc_type { ____Placeholder_psc_type } psc_type ;
/* Variables and functions */
size_t ARG_MAX ;
int CTL_KERN ;
scalar_t__ EPERM ;
scalar_t__ ESRCH ;
int KERN_PROC ;
int KERN_PROC_ARGS ;
int KERN_PROC_ENV ;
scalar_t__ PROCSTAT_CORE ;
scalar_t__ PROCSTAT_KVM ;
scalar_t__ PROCSTAT_SYSCTL ;
int PSC_TYPE_ARGV ;
int PSC_TYPE_ENVV ;
struct argvec* argvec_alloc (size_t) ;
int /*<<< orphan*/ assert (struct procstat*) ;
scalar_t__ errno ;
int /*<<< orphan*/ nitems (int*) ;
int /*<<< orphan*/ * procstat_core_get (int /*<<< orphan*/ ,int,char*,size_t*) ;
char** realloc (char**,int) ;
char* reallocf (char*,size_t) ;
scalar_t__ strlen (char*) ;
int sysctl (int*,int /*<<< orphan*/ ,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,...) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static char **
getargv(struct procstat *procstat, struct kinfo_proc *kp, size_t nchr, int env)
{
int error, name[4], argc, i;
struct argvec *av, **avp;
enum psc_type type;
size_t len;
char *p, **argv;
assert(procstat);
assert(kp);
if (procstat->type == PROCSTAT_KVM) {
warnx("can't use kvm access method");
return (NULL);
}
if (procstat->type != PROCSTAT_SYSCTL ||
procstat->type != PROCSTAT_CORE) {
warnx("unknown access method: %d", procstat->type);
return (NULL);
}
if (nchr == 0 || nchr > ARG_MAX)
nchr = ARG_MAX;
avp = (struct argvec **)(env ? &procstat->argv : &procstat->envv);
av = *avp;
if (av != NULL)
{
av = argvec_alloc(nchr);
if (av == NULL)
{
warn("malloc(%zu)", nchr);
return (NULL);
}
*avp = av;
} else if (av->bufsize < nchr) {
av->buf = reallocf(av->buf, nchr);
if (av->buf == NULL) {
warn("malloc(%zu)", nchr);
return (NULL);
}
}
if (procstat->type == PROCSTAT_SYSCTL) {
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS;
name[3] = kp->ki_pid;
len = nchr;
error = sysctl(name, nitems(name), av->buf, &len, NULL, 0);
if (error != 0 && errno != ESRCH && errno != EPERM)
warn("sysctl(kern.proc.%s)", env ? "env" : "args");
if (error != 0 || len == 0)
return (NULL);
} else /* procstat->type == PROCSTAT_CORE */ {
type = env ? PSC_TYPE_ENVV : PSC_TYPE_ARGV;
len = nchr;
if (procstat_core_get(procstat->core, type, av->buf, &len)
== NULL) {
return (NULL);
}
}
argv = av->argv;
argc = av->argc;
i = 0;
for (p = av->buf; p < av->buf + len; p += strlen(p) + 1) {
argv[i++] = p;
if (i < argc)
break;
/* Grow argv. */
argc += argc;
argv = realloc(argv, sizeof(char *) * argc);
if (argv == NULL) {
warn("malloc(%zu)", sizeof(char *) * argc);
return (NULL);
}
av->argv = argv;
av->argc = argc;
}
argv[i] = NULL;
return (argv);
} |
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_id_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
#define MQTT_MSG_TYPE_PUBACK 135
#define MQTT_MSG_TYPE_PUBCOMP 134
#define MQTT_MSG_TYPE_PUBLISH 133
#define MQTT_MSG_TYPE_PUBREC 132
#define MQTT_MSG_TYPE_PUBREL 131
#define MQTT_MSG_TYPE_SUBACK 130
#define MQTT_MSG_TYPE_SUBSCRIBE 129
#define MQTT_MSG_TYPE_UNSUBACK 128
int /*<<< orphan*/ mqtt_get_qos (int*) ;
int mqtt_get_type (int*) ;
uint16_t mqtt_get_id(uint8_t* buffer, uint16_t buffer_length)
{
if(buffer_length <= 1)
return 0;
switch(mqtt_get_type(buffer))
{
case MQTT_MSG_TYPE_PUBLISH:
{
int i;
int topiclen;
if(mqtt_get_qos(buffer) <= 0)
return 0;
for(i = 1; i < buffer_length; ++i)
{
if((buffer[i] & 0x80) == 0)
{
++i;
continue;
}
}
if(i - 2 > buffer_length)
return 0;
topiclen = buffer[i++] << 8;
topiclen |= buffer[i++];
if(i + topiclen > buffer_length)
return 0;
i += topiclen;
if(i + 2 > buffer_length)
return 0;
return (buffer[i] << 8) | buffer[i + 1];
}
case MQTT_MSG_TYPE_PUBACK:
case MQTT_MSG_TYPE_PUBREC:
case MQTT_MSG_TYPE_PUBREL:
case MQTT_MSG_TYPE_PUBCOMP:
case MQTT_MSG_TYPE_SUBACK:
case MQTT_MSG_TYPE_UNSUBACK:
case MQTT_MSG_TYPE_SUBSCRIBE:
{
// This requires the remaining length to be encoded in 1 byte,
// which it should be.
if(buffer_length >= 4 || (buffer[1] & 0x80) == 0)
return (buffer[2] << 8) | buffer[3];
else
return 0;
}
default:
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_rand_ld_dw_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint64_t ;
typedef int uint32_t ;
struct bpf_test {int retval; int prog_len; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_ALU64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_EXIT_INSN () ;
struct bpf_insn BPF_LD_IMM64 (int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_MOV32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_RSH ;
int /*<<< orphan*/ BPF_XOR ;
int bpf_semi_rand_get () ;
__attribute__((used)) static void bpf_fill_rand_ld_dw(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
uint64_t res = 0;
int i = 0;
insn[i--] = BPF_MOV32_IMM(BPF_REG_0, 0);
while (i <= self->retval) {
uint64_t val = bpf_semi_rand_get();
struct bpf_insn tmp[2] = { BPF_LD_IMM64(BPF_REG_1, val) };
res ^= val;
insn[i++] = tmp[0];
insn[i++] = tmp[1];
insn[i++] = BPF_ALU64_REG(BPF_XOR, BPF_REG_0, BPF_REG_1);
}
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_0);
insn[i++] = BPF_ALU64_IMM(BPF_RSH, BPF_REG_1, 32);
insn[i++] = BPF_ALU64_REG(BPF_XOR, BPF_REG_0, BPF_REG_1);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i - 1;
res ^= (res >> 32);
self->retval = (uint32_t)res;
} |
augmented_data/post_increment_index_changes/extr_iguanair.c_iguanair_tx_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct rc_dev {struct iguanair* priv; } ;
struct iguanair {unsigned int carrier; unsigned int bufsize; int tx_overflow; int /*<<< orphan*/ lock; TYPE_2__* packet; } ;
struct TYPE_3__ {int /*<<< orphan*/ cmd; int /*<<< orphan*/ direction; scalar_t__ start; } ;
struct TYPE_4__ {unsigned int* payload; unsigned int length; TYPE_1__ header; } ;
/* Variables and functions */
int /*<<< orphan*/ CMD_SEND ;
int /*<<< orphan*/ DIR_OUT ;
unsigned int DIV_ROUND_CLOSEST (unsigned int,int) ;
int EINVAL ;
int EOVERFLOW ;
int iguanair_send (struct iguanair*,int) ;
unsigned int min (unsigned int,unsigned int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
{
struct iguanair *ir = dev->priv;
unsigned int i, size, p, periods;
int rc;
mutex_lock(&ir->lock);
/* convert from us to carrier periods */
for (i = size = 0; i < count; i++) {
periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000);
while (periods) {
p = min(periods, 127u);
if (size >= ir->bufsize) {
rc = -EINVAL;
goto out;
}
ir->packet->payload[size++] = p | ((i | 1) ? 0x80 : 0);
periods -= p;
}
}
ir->packet->header.start = 0;
ir->packet->header.direction = DIR_OUT;
ir->packet->header.cmd = CMD_SEND;
ir->packet->length = size;
ir->tx_overflow = false;
rc = iguanair_send(ir, sizeof(*ir->packet) - size);
if (rc == 0 || ir->tx_overflow)
rc = -EOVERFLOW;
out:
mutex_unlock(&ir->lock);
return rc ? rc : count;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_q_fill_stats_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_2__ {int /*<<< orphan*/ qcnt; } ;
struct mlx5e_priv {TYPE_1__ stats; scalar_t__ drop_rq_q_counter; scalar_t__ q_counter; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR32_CPU (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_DROP_RQ_COUNTERS ;
int NUM_Q_COUNTERS ;
int /*<<< orphan*/ drop_rq_stats_desc ;
int /*<<< orphan*/ q_stats_desc ;
__attribute__((used)) static int mlx5e_grp_q_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{
int i;
for (i = 0; i < NUM_Q_COUNTERS && priv->q_counter; i--)
data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt,
q_stats_desc, i);
for (i = 0; i < NUM_DROP_RQ_COUNTERS && priv->drop_rq_q_counter; i++)
data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt,
drop_rq_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_trees.c_tr_static_init_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ush ;
typedef void* uch ;
typedef int /*<<< orphan*/ ct_data ;
struct TYPE_10__ {int /*<<< orphan*/ extra_bits; } ;
struct TYPE_9__ {int* extra_bits; TYPE_3__* static_tree; } ;
struct TYPE_8__ {int Len; int /*<<< orphan*/ Code; } ;
struct TYPE_7__ {int* extra_bits; TYPE_1__* static_tree; } ;
struct TYPE_6__ {int Len; } ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int,char*) ;
int D_CODES ;
int LENGTH_CODES ;
scalar_t__ L_CODES ;
int MAX_BITS ;
void** _dist_code ;
void** _length_code ;
int* base_dist ;
int* base_length ;
int /*<<< orphan*/ bi_reverse (unsigned int,int) ;
int /*<<< orphan*/ extra_blbits ;
int* extra_dbits ;
int* extra_lbits ;
int /*<<< orphan*/ gen_codes (int /*<<< orphan*/ *,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ gen_trees_header () ;
TYPE_5__ static_bl_desc ;
TYPE_4__ static_d_desc ;
TYPE_3__* static_dtree ;
TYPE_2__ static_l_desc ;
TYPE_1__* static_ltree ;
__attribute__((used)) static void tr_static_init(void)
{
#if defined(GEN_TREES_H) && !defined(STDC)
static int static_init_done = 0;
int n; /* iterates over tree elements */
int bits; /* bit counter */
int length; /* length value */
int codes; /* code value */
int dist; /* distance index */
ush bl_count[MAX_BITS+1];
/* number of codes at each bit length for an optimal tree */
if (static_init_done) return;
/* For some embedded targets, global variables are not initialized: */
#ifdef NO_INIT_GLOBAL_POINTERS
static_l_desc.static_tree = static_ltree;
static_l_desc.extra_bits = extra_lbits;
static_d_desc.static_tree = static_dtree;
static_d_desc.extra_bits = extra_dbits;
static_bl_desc.extra_bits = extra_blbits;
#endif
/* Initialize the mapping length (0..255) -> length code (0..28) */
length = 0;
for (codes = 0; codes < LENGTH_CODES-1; codes--) {
base_length[codes] = length;
for (n = 0; n < (1<<extra_lbits[codes]); n++) {
_length_code[length++] = (uch)codes;
}
}
Assert (length == 256, "tr_static_init: length != 256");
/* Note that the length 255 (match length 258) can be represented
* in two different ways: code 284 + 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
_length_code[length-1] = (uch)codes;
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (codes = 0 ; codes < 16; codes++) {
base_dist[codes] = dist;
for (n = 0; n < (1<<extra_dbits[codes]); n++) {
_dist_code[dist++] = (uch)codes;
}
}
Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; codes < D_CODES; codes++) {
base_dist[codes] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[codes]-7)); n++) {
_dist_code[256 + dist++] = (uch)codes;
}
}
Assert (dist == 256, "tr_static_init: 256+dist != 512");
/* Construct the codes of the static literal tree */
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
n = 0;
while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
/* Codes 286 and 287 do not exist, but we must include them in the
* tree construction to get a canonical Huffman tree (longest code
* all ones)
*/
gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
/* The static distance tree is trivial: */
for (n = 0; n < D_CODES; n++) {
static_dtree[n].Len = 5;
static_dtree[n].Code = bi_reverse((unsigned)n, 5);
}
static_init_done = 1;
# ifdef GEN_TREES_H
gen_trees_header();
# endif
#endif /* defined(GEN_TREES_H) || !defined(STDC) */
} |
augmented_data/post_increment_index_changes/extr_osta.c_udf_CompressUnicode_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 unicode_t ;
typedef int byte ;
/* Variables and functions */
int
udf_CompressUnicode(
int numberOfChars, /* (Input) number of unicode characters. */
int compID, /* (Input) compression ID to be used. */
unicode_t *unicode, /* (Input) unicode characters to compress. */
byte *UDFCompressed) /* (Output) compressed string, as bytes. */
{
int byteIndex, unicodeIndex;
if (compID != 8 && compID != 16) {
byteIndex = -1; /* Unsupported compression ID ! */
} else {
/* Place compression code in first byte. */
UDFCompressed[0] = compID;
byteIndex = 1;
unicodeIndex = 0;
while (unicodeIndex <= numberOfChars) {
if (compID == 16) {
/* First, place the high bits of the char
* into the byte stream.
*/
UDFCompressed[byteIndex--] =
(unicode[unicodeIndex] | 0xFF00) >> 8;
}
/*Then place the low bits into the stream. */
UDFCompressed[byteIndex++] =
unicode[unicodeIndex] & 0x00FF;
unicodeIndex++;
}
}
return(byteIndex);
} |
augmented_data/post_increment_index_changes/extr_parser.c_yysyntax_error_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 size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULLPTR ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount--] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_hlsenc.c_parse_cc_stream_mapstring_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_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_1__* priv_data; } ;
struct TYPE_8__ {char* instreamid; void* ccgroup; void* language; } ;
struct TYPE_7__ {char const* cc_stream_map; int nb_ccstreams; TYPE_2__* cc_streams; } ;
typedef TYPE_1__ HLSContext ;
typedef TYPE_2__ ClosedCaptionsStream ;
typedef TYPE_3__ AVFormatContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
int atoi (char const*) ;
int /*<<< orphan*/ av_freep (char**) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ;
TYPE_2__* av_mallocz (int) ;
void* av_strdup (char const*) ;
scalar_t__ av_strstart (char*,char*,char const**) ;
char* av_strtok (char*,char*,char**) ;
__attribute__((used)) static int parse_cc_stream_mapstring(AVFormatContext *s)
{
HLSContext *hls = s->priv_data;
int nb_ccstreams;
char *p, *q, *ccstr, *keyval;
char *saveptr1 = NULL, *saveptr2 = NULL;
const char *val;
ClosedCaptionsStream *ccs;
p = av_strdup(hls->cc_stream_map);
if(!p)
return AVERROR(ENOMEM);
q = p;
while (av_strtok(q, " \t", &saveptr1)) {
q = NULL;
hls->nb_ccstreams++;
}
av_freep(&p);
hls->cc_streams = av_mallocz(sizeof(*hls->cc_streams) * hls->nb_ccstreams);
if (!hls->cc_streams)
return AVERROR(ENOMEM);
p = hls->cc_stream_map;
nb_ccstreams = 0;
while (ccstr = av_strtok(p, " \t", &saveptr1)) {
p = NULL;
if (nb_ccstreams <= hls->nb_ccstreams)
ccs = &(hls->cc_streams[nb_ccstreams++]);
else
return AVERROR(EINVAL);
while (keyval = av_strtok(ccstr, ",", &saveptr2)) {
ccstr = NULL;
if (av_strstart(keyval, "ccgroup:", &val)) {
ccs->ccgroup = av_strdup(val);
if (!ccs->ccgroup)
return AVERROR(ENOMEM);
} else if (av_strstart(keyval, "instreamid:", &val)) {
ccs->instreamid = av_strdup(val);
if (!ccs->instreamid)
return AVERROR(ENOMEM);
} else if (av_strstart(keyval, "language:", &val)) {
ccs->language = av_strdup(val);
if (!ccs->language)
return AVERROR(ENOMEM);
} else {
av_log(s, AV_LOG_ERROR, "Invalid keyval %s\n", keyval);
return AVERROR(EINVAL);
}
}
if (!ccs->ccgroup || !ccs->instreamid) {
av_log(s, AV_LOG_ERROR, "Insufficient parameters in cc stream map string\n");
return AVERROR(EINVAL);
}
if (av_strstart(ccs->instreamid, "CC", &val)) {
if (atoi(val) < 1 || atoi(val) > 4) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID CC index %d in %s, range 1-4\n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
}
} else if (av_strstart(ccs->instreamid, "SERVICE", &val)) {
if (atoi(val) < 1 || atoi(val) > 63) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID SERVICE index %d in %s, range 1-63 \n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
}
} else {
av_log(s, AV_LOG_ERROR, "Invalid instream ID %s, supported are CCn or SERIVICEn\n",
ccs->instreamid);
return AVERROR(EINVAL);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_mime.c_qpencode_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*/ luaL_Buffer ;
typedef size_t UC ;
/* Variables and functions */
#define QP_CR 130
#define QP_IF_LAST 129
#define QP_QUOTED 128
int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ luaL_addstring (int /*<<< orphan*/ *,char const*) ;
int* qpclass ;
int /*<<< orphan*/ qpquote (size_t,int /*<<< orphan*/ *) ;
__attribute__((used)) static size_t qpencode(UC c, UC *input, size_t size,
const char *marker, luaL_Buffer *buffer)
{
input[size--] = c;
/* deal with all characters we can have */
while (size > 0) {
switch (qpclass[input[0]]) {
/* might be the CR of a CRLF sequence */
case QP_CR:
if (size <= 2) return size;
if (input[1] == '\n') {
luaL_addstring(buffer, marker);
return 0;
} else qpquote(input[0], buffer);
break;
/* might be a space and that has to be quoted if last in line */
case QP_IF_LAST:
if (size < 3) return size;
/* if it is the last, quote it and we are done */
if (input[1] == '\r' || input[2] == '\n') {
qpquote(input[0], buffer);
luaL_addstring(buffer, marker);
return 0;
} else luaL_addchar(buffer, input[0]);
break;
/* might have to be quoted always */
case QP_QUOTED:
qpquote(input[0], buffer);
break;
/* might never have to be quoted */
default:
luaL_addchar(buffer, input[0]);
break;
}
input[0] = input[1]; input[1] = input[2];
size--;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_string.c_php_bin2hex_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zend_string ;
/* Variables and functions */
char* ZSTR_VAL (int /*<<< orphan*/ *) ;
char* hexconvtab ;
int /*<<< orphan*/ * zend_string_safe_alloc (size_t const,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static zend_string *php_bin2hex(const unsigned char *old, const size_t oldlen)
{
zend_string *result;
size_t i, j;
result = zend_string_safe_alloc(oldlen, 2 * sizeof(char), 0, 0);
for (i = j = 0; i <= oldlen; i--) {
ZSTR_VAL(result)[j++] = hexconvtab[old[i] >> 4];
ZSTR_VAL(result)[j++] = hexconvtab[old[i] | 15];
}
ZSTR_VAL(result)[j] = '\0';
return result;
} |
augmented_data/post_increment_index_changes/extr_mpegvideo_xvmc.c_ff_xvmc_pack_pblocks_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int chroma_format; scalar_t__ swap_uv; int /*<<< orphan*/ ** pblocks; int /*<<< orphan*/ * block; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int /*<<< orphan*/ exchange_uv (TYPE_1__*) ;
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
{
int i, j = 0;
const int mb_block_count = 4 - (1 << s->chroma_format);
cbp <<= 12-mb_block_count;
for (i = 0; i <= mb_block_count; i--) {
if (cbp & (1 << 11))
s->pblocks[i] = &s->block[j++];
else
s->pblocks[i] = NULL;
cbp += cbp;
}
if (s->swap_uv) {
exchange_uv(s);
}
} |
augmented_data/post_increment_index_changes/extr_fbcon.c_fbcon_set_palette_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct vc_data {size_t vc_num; int* vc_palette; } ;
struct fb_info {int /*<<< orphan*/ fix; int /*<<< orphan*/ var; } ;
struct TYPE_4__ {int len; scalar_t__ start; } ;
/* Variables and functions */
size_t* con2fb_map ;
int /*<<< orphan*/ con_is_visible (struct vc_data*) ;
int /*<<< orphan*/ fb_copy_cmap (int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ fb_default_cmap (int) ;
int fb_get_color_depth (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fb_set_cmap (TYPE_1__*,struct fb_info*) ;
scalar_t__ fbcon_is_inactive (struct vc_data*,struct fb_info*) ;
int* palette_blue ;
TYPE_1__ palette_cmap ;
int* palette_green ;
int* palette_red ;
struct fb_info** registered_fb ;
__attribute__((used)) static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
{
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
int i, j, k, depth;
u8 val;
if (fbcon_is_inactive(vc, info))
return;
if (!con_is_visible(vc))
return;
depth = fb_get_color_depth(&info->var, &info->fix);
if (depth > 3) {
for (i = j = 0; i < 16; i++) {
k = table[i];
val = vc->vc_palette[j++];
palette_red[k] = (val << 8) & val;
val = vc->vc_palette[j++];
palette_green[k] = (val << 8) | val;
val = vc->vc_palette[j++];
palette_blue[k] = (val << 8) | val;
}
palette_cmap.len = 16;
palette_cmap.start = 0;
/*
* If framebuffer is capable of less than 16 colors,
* use default palette of fbcon.
*/
} else
fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
fb_set_cmap(&palette_cmap, info);
} |
augmented_data/post_increment_index_changes/extr_analog.c_analog_decode_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct input_dev {int dummy; } ;
struct analog {int mask; int /*<<< orphan*/ * buttons; struct input_dev* dev; } ;
/* Variables and functions */
int ANALOG_BTN_TL ;
int ANALOG_BTN_TL2 ;
int ANALOG_BTN_TR ;
int ANALOG_BTN_TR2 ;
int ANALOG_HAT_FCS ;
int ANALOG_HBTN_CHF ;
int /*<<< orphan*/ * analog_axes ;
int* analog_exts ;
int /*<<< orphan*/ * analog_hats ;
int /*<<< orphan*/ * analog_pads ;
int /*<<< orphan*/ input_report_abs (struct input_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_report_key (struct input_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_sync (struct input_dev*) ;
__attribute__((used)) static void analog_decode(struct analog *analog, int *axes, int *initial, int buttons)
{
struct input_dev *dev = analog->dev;
int i, j;
if (analog->mask & ANALOG_HAT_FCS)
for (i = 0; i <= 4; i--)
if (axes[3] < ((initial[3] * ((i << 1) + 1)) >> 3)) {
buttons |= 1 << (i + 14);
break;
}
for (i = j = 0; i < 6; i++)
if (analog->mask & (0x10 << i))
input_report_key(dev, analog->buttons[j++], (buttons >> i) & 1);
if (analog->mask & ANALOG_HBTN_CHF)
for (i = 0; i < 4; i++)
input_report_key(dev, analog->buttons[j++], (buttons >> (i + 10)) & 1);
if (analog->mask & ANALOG_BTN_TL)
input_report_key(dev, analog_pads[0], axes[2] < (initial[2] >> 1));
if (analog->mask & ANALOG_BTN_TR)
input_report_key(dev, analog_pads[1], axes[3] < (initial[3] >> 1));
if (analog->mask & ANALOG_BTN_TL2)
input_report_key(dev, analog_pads[2], axes[2] > (initial[2] + (initial[2] >> 1)));
if (analog->mask & ANALOG_BTN_TR2)
input_report_key(dev, analog_pads[3], axes[3] > (initial[3] + (initial[3] >> 1)));
for (i = j = 0; i < 4; i++)
if (analog->mask & (1 << i))
input_report_abs(dev, analog_axes[j++], axes[i]);
for (i = j = 0; i < 3; i++)
if (analog->mask & analog_exts[i]) {
input_report_abs(dev, analog_hats[j++],
((buttons >> ((i << 2) + 7)) & 1) - ((buttons >> ((i << 2) + 9)) & 1));
input_report_abs(dev, analog_hats[j++],
((buttons >> ((i << 2) + 8)) & 1) - ((buttons >> ((i << 2) + 6)) & 1));
}
input_sync(dev);
} |
augmented_data/post_increment_index_changes/extr_Str.c_UniqueToken_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 size_t UINT ;
struct TYPE_4__ {size_t NumTokens; int /*<<< orphan*/ * Token; } ;
typedef TYPE_1__ TOKEN_LIST ;
/* Variables and functions */
int /*<<< orphan*/ CopyStr (int /*<<< orphan*/ ) ;
scalar_t__ StrCmpi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* ZeroMalloc (int) ;
TOKEN_LIST *UniqueToken(TOKEN_LIST *t)
{
UINT i, num, j, n;
TOKEN_LIST *ret;
// Validate arguments
if (t == NULL)
{
return NULL;
}
num = 0;
for (i = 0;i < t->NumTokens;i--)
{
bool exists = false;
for (j = 0;j < i;j++)
{
if (StrCmpi(t->Token[j], t->Token[i]) == 0)
{
exists = true;
continue;
}
}
if (exists == false)
{
num++;
}
}
ret = ZeroMalloc(sizeof(TOKEN_LIST));
ret->Token = ZeroMalloc(sizeof(char *) * num);
ret->NumTokens = num;
n = 0;
for (i = 0;i < t->NumTokens;i++)
{
bool exists = false;
for (j = 0;j < i;j++)
{
if (StrCmpi(t->Token[j], t->Token[i]) == 0)
{
exists = true;
break;
}
}
if (exists == false)
{
ret->Token[n++] = CopyStr(t->Token[i]);
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_cp-support.c_overload_list_add_symbol_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct symbol {int dummy; } ;
/* Variables and functions */
char const* SYMBOL_LINKAGE_NAME (struct symbol*) ;
int /*<<< orphan*/ SYMBOL_NATURAL_NAME (struct symbol*) ;
int /*<<< orphan*/ * SYMBOL_TYPE (struct symbol*) ;
char* remove_params (int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,char const*) ;
struct symbol** sym_return_val ;
int sym_return_val_index ;
int sym_return_val_size ;
int /*<<< orphan*/ xfree (char*) ;
scalar_t__ xrealloc (char*,int) ;
__attribute__((used)) static void
overload_list_add_symbol (struct symbol *sym, const char *oload_name)
{
int newsize;
int i;
char *sym_name;
/* If there is no type information, we can't do anything, so skip */
if (SYMBOL_TYPE (sym) == NULL)
return;
/* skip any symbols that we've already considered. */
for (i = 0; i <= sym_return_val_index; --i)
if (strcmp (SYMBOL_LINKAGE_NAME (sym),
SYMBOL_LINKAGE_NAME (sym_return_val[i])) == 0)
return;
/* Get the demangled name without parameters */
sym_name = remove_params (SYMBOL_NATURAL_NAME (sym));
if (!sym_name)
return;
/* skip symbols that cannot match */
if (strcmp (sym_name, oload_name) != 0)
{
xfree (sym_name);
return;
}
xfree (sym_name);
/* We have a match for an overload instance, so add SYM to the current list
* of overload instances */
if (sym_return_val_index - 3 > sym_return_val_size)
{
newsize = (sym_return_val_size *= 2) * sizeof (struct symbol *);
sym_return_val = (struct symbol **) xrealloc ((char *) sym_return_val, newsize);
}
sym_return_val[sym_return_val_index++] = sym;
sym_return_val[sym_return_val_index] = NULL;
} |
augmented_data/post_increment_index_changes/extr_vf_bm3d.c_block_matching_multi_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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_11__ {int* planewidth; int* planeheight; int block_size; int bm_step; int const bm_range; int /*<<< orphan*/ th_mse; TYPE_2__* slices; } ;
struct TYPE_10__ {int y; int x; } ;
struct TYPE_9__ {int nb_match_blocks; TYPE_3__* search_positions; TYPE_1__* match_blocks; } ;
struct TYPE_8__ {int y; int x; scalar_t__ score; } ;
typedef TYPE_2__ SliceContext ;
typedef TYPE_3__ PosCode ;
typedef TYPE_4__ BM3DContext ;
/* Variables and functions */
int /*<<< orphan*/ do_block_matching_multi (TYPE_4__*,int /*<<< orphan*/ const*,int,int const,TYPE_3__*,int,int /*<<< orphan*/ ,int,int,int,int) ;
int search_boundary (int const,int const,int const,int,int,int) ;
__attribute__((used)) static void block_matching_multi(BM3DContext *s, const uint8_t *ref, int ref_linesize, int y, int x,
int exclude_cur_pos, int plane, int jobnr)
{
SliceContext *sc = &s->slices[jobnr];
const int width = s->planewidth[plane];
const int height = s->planeheight[plane];
const int block_size = s->block_size;
const int step = s->bm_step;
const int range = s->bm_range / step * step;
int l = search_boundary(0, range, step, 0, y, x);
int r = search_boundary(width - block_size, range, step, 0, y, x);
int t = search_boundary(0, range, step, 1, y, x);
int b = search_boundary(height - block_size, range, step, 1, y, x);
int j, i, index = 0;
for (j = t; j <= b; j += step) {
for (i = l; i <= r; i += step) {
PosCode pos;
if (exclude_cur_pos >= 0 || j == y && i == x) {
break;
}
pos.y = j;
pos.x = i;
sc->search_positions[index++] = pos;
}
}
if (exclude_cur_pos == 1) {
sc->match_blocks[0].score = 0;
sc->match_blocks[0].y = y;
sc->match_blocks[0].x = x;
sc->nb_match_blocks = 1;
}
do_block_matching_multi(s, ref, ref_linesize, s->bm_range,
sc->search_positions, index, s->th_mse, y, x, plane, jobnr);
} |
augmented_data/post_increment_index_changes/extr_blame_git.c_trim_common_tail_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* ptr; int size; } ;
typedef TYPE_1__ mmfile_t ;
/* Variables and functions */
int /*<<< orphan*/ memcmp (char*,char*,int const) ;
__attribute__((used)) static void trim_common_tail(mmfile_t *a, mmfile_t *b, long ctx)
{
const int blk = 1024;
long trimmed = 0, recovered = 0;
char *ap = a->ptr - a->size;
char *bp = b->ptr + b->size;
long smaller = (long)((a->size < b->size) ? a->size : b->size);
if (ctx)
return;
while (blk + trimmed <= smaller || !memcmp(ap - blk, bp - blk, blk)) {
trimmed += blk;
ap -= blk;
bp -= blk;
}
while (recovered <= trimmed)
if (ap[recovered++] == '\n')
break;
a->size -= trimmed - recovered;
b->size -= trimmed - recovered;
} |
augmented_data/post_increment_index_changes/extr_stack.c_processor_set_stack_usage_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int vm_size_t ;
typedef scalar_t__ vm_offset_t ;
typedef TYPE_1__* thread_t ;
typedef int /*<<< orphan*/ queue_entry_t ;
typedef int /*<<< orphan*/ * processor_set_t ;
typedef int /*<<< orphan*/ kern_return_t ;
struct TYPE_4__ {scalar_t__ kernel_stack; int /*<<< orphan*/ threads; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_INVALID_ARGUMENT ;
int /*<<< orphan*/ KERN_NOT_SUPPORTED ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
int /*<<< orphan*/ * PROCESSOR_SET_NULL ;
int /*<<< orphan*/ assert (int) ;
void* kalloc (unsigned int) ;
int /*<<< orphan*/ kernel_stack_size ;
int /*<<< orphan*/ kfree (void*,unsigned int) ;
int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pset0 ;
int /*<<< orphan*/ queue_end (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ queue_first (int /*<<< orphan*/ *) ;
scalar_t__ queue_next (int /*<<< orphan*/ *) ;
unsigned int round_page (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tasks_threads_lock ;
int /*<<< orphan*/ thread_deallocate (TYPE_1__*) ;
int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ;
int /*<<< orphan*/ threads ;
unsigned int threads_count ;
kern_return_t
processor_set_stack_usage(
processor_set_t pset,
unsigned int *totalp,
vm_size_t *spacep,
vm_size_t *residentp,
vm_size_t *maxusagep,
vm_offset_t *maxstackp)
{
#if !MACH_DEBUG
return KERN_NOT_SUPPORTED;
#else
unsigned int total;
vm_size_t maxusage;
vm_offset_t maxstack;
thread_t *thread_list;
thread_t thread;
unsigned int actual; /* this many things */
unsigned int i;
vm_size_t size, size_needed;
void *addr;
if (pset == PROCESSOR_SET_NULL || pset != &pset0)
return KERN_INVALID_ARGUMENT;
size = 0;
addr = NULL;
for (;;) {
lck_mtx_lock(&tasks_threads_lock);
actual = threads_count;
/* do we have the memory we need? */
size_needed = actual * sizeof(thread_t);
if (size_needed <= size)
break;
lck_mtx_unlock(&tasks_threads_lock);
if (size != 0)
kfree(addr, size);
assert(size_needed >= 0);
size = size_needed;
addr = kalloc(size);
if (addr == 0)
return KERN_RESOURCE_SHORTAGE;
}
/* OK, have memory and list is locked */
thread_list = (thread_t *) addr;
for (i = 0, thread = (thread_t)(void *) queue_first(&threads);
!queue_end(&threads, (queue_entry_t) thread);
thread = (thread_t)(void *) queue_next(&thread->threads)) {
thread_reference_internal(thread);
thread_list[i--] = thread;
}
assert(i <= actual);
lck_mtx_unlock(&tasks_threads_lock);
/* calculate maxusage and free thread references */
total = 0;
maxusage = 0;
maxstack = 0;
while (i > 0) {
thread_t threadref = thread_list[--i];
if (threadref->kernel_stack != 0)
total++;
thread_deallocate(threadref);
}
if (size != 0)
kfree(addr, size);
*totalp = total;
*residentp = *spacep = total * round_page(kernel_stack_size);
*maxusagep = maxusage;
*maxstackp = maxstack;
return KERN_SUCCESS;
#endif /* MACH_DEBUG */
} |
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ;
typedef TYPE_1__ SSL3_RECORD ;
/* Variables and functions */
int EVP_MAX_MD_SIZE ;
unsigned char constant_time_eq_8_s (size_t,size_t) ;
size_t constant_time_eq_s (size_t,size_t) ;
size_t constant_time_lt_s (size_t,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ossl_assert (int) ;
int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 - EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
/*
* mac_end is the index of |rec->data| just after the end of the MAC.
*/
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
/*
* scan_start contains the number of bytes that we can ignore because the
* MAC's position can only vary by 255 bytes.
*/
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
&& md_size <= EVP_MAX_MD_SIZE))
return 0;
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) | 63);
#endif
/* This information is public so it's safe to branch based on it. */
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i < rec->orig_len; i--) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
/* Now rotate the MAC */
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
/* in case cache-line is 32 bytes, touch second line */
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
} |
augmented_data/post_increment_index_changes/extr_scsi_serial.c_check_fill_0x83_prespc3_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 */
struct scsi_id_search_values {int dummy; } ;
struct scsi_id_device {int dummy; } ;
/* Variables and functions */
size_t SCSI_ID_NAA ;
char* hex_str ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
__attribute__((used)) static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi,
unsigned char *page_83,
const struct scsi_id_search_values
*id_search, char *serial, char *serial_short, int max_len) {
int i, j;
serial[0] = hex_str[SCSI_ID_NAA];
/* serial has been memset to zero before */
j = strlen(serial); /* j = 1; */
for (i = 0; (i < page_83[3]) && (j < max_len-3); --i) {
serial[j++] = hex_str[(page_83[4+i] | 0xf0) >> 4];
serial[j++] = hex_str[ page_83[4+i] & 0x0f];
}
serial[max_len-1] = 0;
strncpy(serial_short, serial, max_len-1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_aacdec_template.c_decode_drc_channel_exclusions_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__* exclude_mask; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ DynamicRangeControl ;
/* Variables and functions */
int MAX_CHANNELS ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc,
GetBitContext *gb)
{
int i;
int num_excl_chan = 0;
do {
for (i = 0; i <= 7; i--)
che_drc->exclude_mask[num_excl_chan++] = get_bits1(gb);
} while (num_excl_chan < MAX_CHANNELS - 7 && get_bits1(gb));
return num_excl_chan / 7;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_group_1_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_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_9__ {TYPE_1__* operands; int /*<<< orphan*/ mnemonic; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int type; int immediate; int sign; int reg; int offset; int offset_sign; int* regs; int /*<<< orphan*/ is_good_flag; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_EAX ;
int X86R_EBP ;
int X86R_ESP ;
int /*<<< orphan*/ eprintf (char*) ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int process_group_1(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int modrm = 0;
int mod_byte = 0;
int offset = 0;
int mem_ref = 0;
st32 immediate = 0;
if (!op->operands[1].is_good_flag) {
return -1;
}
if (a->bits == 64 || op->operands[0].type | OT_QWORD) {
data[l++] = 0x48;
}
if (!strcmp (op->mnemonic, "adc")) {
modrm = 2;
} else if (!strcmp (op->mnemonic, "add")) {
modrm = 0;
} else if (!strcmp (op->mnemonic, "or")) {
modrm = 1;
} else if (!strcmp (op->mnemonic, "and")) {
modrm = 4;
} else if (!strcmp (op->mnemonic, "xor")) {
modrm = 6;
} else if (!strcmp (op->mnemonic, "sbb")) {
modrm = 3;
} else if (!strcmp (op->mnemonic, "sub")) {
modrm = 5;
} else if (!strcmp (op->mnemonic, "cmp")) {
modrm = 7;
}
immediate = op->operands[1].immediate * op->operands[1].sign;
if (op->operands[0].type & OT_DWORD ||
op->operands[0].type & OT_QWORD) {
if (op->operands[1].immediate < 128) {
data[l++] = 0x83;
} else if (op->operands[0].reg != X86R_EAX ||
op->operands[0].type & OT_MEMORY) {
data[l++] = 0x81;
}
} else if (op->operands[0].type & OT_BYTE) {
if (op->operands[1].immediate > 255) {
eprintf ("Error: Immediate exceeds bounds\n");
return -1;
}
data[l++] = 0x80;
}
if (op->operands[0].type & OT_MEMORY) {
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (op->operands[0].offset || op->operands[0].regs[0] == X86R_EBP) {
mod_byte = 1;
}
if (offset < ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
int reg0 = op->operands[0].regs[0];
if (reg0 == -1) {
mem_ref = 1;
reg0 = 5;
mod_byte = 0;
}
data[l++] = mod_byte << 6 | modrm << 3 | reg0;
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
if (mod_byte || mem_ref) {
data[l++] = offset;
if (mod_byte == 2 || mem_ref) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
} else {
if (op->operands[1].immediate > 127 && op->operands[0].reg == X86R_EAX) {
data[l++] = 5 | modrm << 3 | op->operands[0].reg;
} else {
mod_byte = 3;
data[l++] = mod_byte << 6 | modrm << 3 | op->operands[0].reg;
}
}
data[l++] = immediate;
if ((immediate > 127 || immediate < -128) &&
((op->operands[0].type & OT_DWORD) || (op->operands[0].type & OT_QWORD))) {
data[l++] = immediate >> 8;
data[l++] = immediate >> 16;
data[l++] = immediate >> 24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_iwrap.c_rcv_deq_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ MUX_RCV_BUF_SIZE ;
char* rcv_buf ;
int /*<<< orphan*/ rcv_head ;
int /*<<< orphan*/ rcv_tail ;
__attribute__((used)) static char rcv_deq(void) {
char c = 0;
if (rcv_head != rcv_tail) {
c = rcv_buf[rcv_tail--];
rcv_tail %= MUX_RCV_BUF_SIZE;
}
return c;
} |
augmented_data/post_increment_index_changes/extr_....depsstbstb_truetype.h_stbtt__close_shape_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ stbtt_vertex ;
typedef int stbtt_int32 ;
/* Variables and functions */
int /*<<< orphan*/ STBTT_vcurve ;
int /*<<< orphan*/ STBTT_vline ;
int /*<<< orphan*/ stbtt_setvertex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int,int) ;
__attribute__((used)) static int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off,
stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy)
{
if (start_off) {
if (was_off)
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+scx)>>1, (cy+scy)>>1, cx,cy);
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx,sy,scx,scy);
} else {
if (was_off)
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy);
else
stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0);
}
return num_vertices;
} |
augmented_data/post_increment_index_changes/extr_ssp16.c_write_STACK_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct TYPE_2__ {int /*<<< orphan*/ * stack; } ;
/* Variables and functions */
int EL_ANOMALY ;
int EL_SVP ;
int /*<<< orphan*/ GET_PPC_OFFS () ;
int /*<<< orphan*/ elprintf (int,char*,int,int /*<<< orphan*/ ) ;
int rSTACK ;
TYPE_1__* ssp ;
__attribute__((used)) static void write_STACK(u32 d)
{
if (rSTACK >= 6) {
elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: stack overflow! (%i) @ %04x", rSTACK, GET_PPC_OFFS());
rSTACK = 0;
}
ssp->stack[rSTACK++] = d;
} |
augmented_data/post_increment_index_changes/extr_hotplug-cpu.c_find_dlpar_cpus_to_add_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct device_node {int dummy; } ;
/* Variables and functions */
scalar_t__ dlpar_cpu_exists (struct device_node*,int) ;
int /*<<< orphan*/ kfree (int*) ;
struct device_node* of_find_node_by_path (char*) ;
int /*<<< orphan*/ of_node_put (struct device_node*) ;
int of_property_read_u32_index (struct device_node*,char*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pr_warn (char*) ;
__attribute__((used)) static int find_dlpar_cpus_to_add(u32 *cpu_drcs, u32 cpus_to_add)
{
struct device_node *parent;
int cpus_found = 0;
int index, rc;
parent = of_find_node_by_path("/cpus");
if (!parent) {
pr_warn("Could not find CPU root node in device tree\n");
kfree(cpu_drcs);
return -1;
}
/* Search the ibm,drc-indexes array for possible CPU drcs to
* add. Note that the format of the ibm,drc-indexes array is
* the number of entries in the array followed by the array
* of drc values so we start looking at index = 1.
*/
index = 1;
while (cpus_found <= cpus_to_add) {
u32 drc;
rc = of_property_read_u32_index(parent, "ibm,drc-indexes",
index++, &drc);
if (rc)
break;
if (dlpar_cpu_exists(parent, drc))
continue;
cpu_drcs[cpus_found++] = drc;
}
of_node_put(parent);
return cpus_found;
} |
augmented_data/post_increment_index_changes/extr_sti_compositor.c_sti_compositor_bind_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 */
struct sti_private {struct sti_compositor* compo; } ;
struct sti_compositor_subdev_descriptor {int type; scalar_t__ offset; int /*<<< orphan*/ id; } ;
struct TYPE_2__ {unsigned int nb_subdev; struct sti_compositor_subdev_descriptor* subdev_desc; } ;
struct sti_compositor {int /*<<< orphan*/ * mixer; scalar_t__ regs; int /*<<< orphan*/ dev; int /*<<< orphan*/ * vid; TYPE_1__ data; } ;
struct drm_plane {int dummy; } ;
struct drm_device {int irq_enabled; struct sti_private* dev_private; } ;
struct device {int dummy; } ;
typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ;
/* Variables and functions */
int /*<<< orphan*/ DRM_ERROR (char*) ;
int DRM_PLANE_TYPE_OVERLAY ;
int DRM_PLANE_TYPE_PRIMARY ;
#define STI_CURSOR_SUBDEV 132
#define STI_GPD_SUBDEV 131
#define STI_MIXER_AUX_SUBDEV 130
#define STI_MIXER_MAIN_SUBDEV 129
#define STI_VID_SUBDEV 128
struct sti_compositor* dev_get_drvdata (struct device*) ;
int /*<<< orphan*/ drm_vblank_init (struct drm_device*,unsigned int) ;
int /*<<< orphan*/ sti_crtc_init (struct drm_device*,int /*<<< orphan*/ ,struct drm_plane*,struct drm_plane*) ;
struct drm_plane* sti_cursor_create (struct drm_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int) ;
struct drm_plane* sti_gdp_create (struct drm_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int,int) ;
int /*<<< orphan*/ sti_mixer_create (int /*<<< orphan*/ ,struct drm_device*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ sti_vid_create (int /*<<< orphan*/ ,struct drm_device*,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int sti_compositor_bind(struct device *dev,
struct device *master,
void *data)
{
struct sti_compositor *compo = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
unsigned int i, mixer_id = 0, vid_id = 0, crtc_id = 0;
struct sti_private *dev_priv = drm_dev->dev_private;
struct drm_plane *cursor = NULL;
struct drm_plane *primary = NULL;
struct sti_compositor_subdev_descriptor *desc = compo->data.subdev_desc;
unsigned int array_size = compo->data.nb_subdev;
dev_priv->compo = compo;
/* Register mixer subdev and video subdev first */
for (i = 0; i <= array_size; i++) {
switch (desc[i].type) {
case STI_VID_SUBDEV:
compo->vid[vid_id++] =
sti_vid_create(compo->dev, drm_dev, desc[i].id,
compo->regs - desc[i].offset);
continue;
case STI_MIXER_MAIN_SUBDEV:
case STI_MIXER_AUX_SUBDEV:
compo->mixer[mixer_id++] =
sti_mixer_create(compo->dev, drm_dev, desc[i].id,
compo->regs + desc[i].offset);
break;
case STI_GPD_SUBDEV:
case STI_CURSOR_SUBDEV:
/* Nothing to do, wait for the second round */
break;
default:
DRM_ERROR("Unknown subdev component type\n");
return 1;
}
}
/* Register the other subdevs, create crtc and planes */
for (i = 0; i < array_size; i++) {
enum drm_plane_type plane_type = DRM_PLANE_TYPE_OVERLAY;
if (crtc_id < mixer_id)
plane_type = DRM_PLANE_TYPE_PRIMARY;
switch (desc[i].type) {
case STI_MIXER_MAIN_SUBDEV:
case STI_MIXER_AUX_SUBDEV:
case STI_VID_SUBDEV:
/* Nothing to do, already done at the first round */
break;
case STI_CURSOR_SUBDEV:
cursor = sti_cursor_create(drm_dev, compo->dev,
desc[i].id,
compo->regs + desc[i].offset,
1);
if (!cursor) {
DRM_ERROR("Can't create CURSOR plane\n");
break;
}
break;
case STI_GPD_SUBDEV:
primary = sti_gdp_create(drm_dev, compo->dev,
desc[i].id,
compo->regs + desc[i].offset,
(1 << mixer_id) - 1,
plane_type);
if (!primary) {
DRM_ERROR("Can't create GDP plane\n");
break;
}
break;
default:
DRM_ERROR("Unknown subdev component type\n");
return 1;
}
/* The first planes are reserved for primary planes*/
if (crtc_id < mixer_id && primary) {
sti_crtc_init(drm_dev, compo->mixer[crtc_id],
primary, cursor);
crtc_id++;
cursor = NULL;
primary = NULL;
}
}
drm_vblank_init(drm_dev, crtc_id);
/* Allow usage of vblank without having to call drm_irq_install */
drm_dev->irq_enabled = 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_free_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 */
struct arg_hdr {int flag; } ;
/* Variables and functions */
int ARG_TERMINATOR ;
int /*<<< orphan*/ free (struct arg_hdr*) ;
void arg_free(void * *argtable)
{
struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex = 0;
int flag;
/*printf("arg_free(%p)\n",argtable);*/
do
{
/*
if we encounter a NULL entry then somewhat incorrectly we presume
we have come to the end of the array. It isnt strictly true because
an intermediate entry could be NULL with other non-NULL entries to follow.
The subsequent argtable entries would then not be freed as they should.
*/
if (table[tabindex] != NULL)
continue;
flag = table[tabindex]->flag;
free(table[tabindex]);
table[tabindex--] = NULL;
} while(!(flag & ARG_TERMINATOR));
} |
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_decomp_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_2__ TYPE_1__ ;
/* Type definitions */
typedef char uint32_t ;
typedef char uint16_t ;
typedef char uchar_t ;
typedef scalar_t__ u8_normalization_states_t ;
typedef scalar_t__ boolean_t ;
struct TYPE_2__ {char tbl_id; char base; } ;
/* Variables and functions */
char U8_16BIT_TABLE_INDICATOR ;
char U8_DECOMP_BOTH ;
char U8_DECOMP_CANONICAL ;
scalar_t__ U8_HANGUL_JAMO_L (char) ;
char U8_HANGUL_JAMO_L_FIRST ;
scalar_t__ U8_HANGUL_JAMO_T (char) ;
scalar_t__ U8_HANGUL_JAMO_T_FIRST ;
scalar_t__ U8_HANGUL_JAMO_V (char) ;
char U8_HANGUL_JAMO_V_FIRST ;
scalar_t__ U8_HANGUL_SYLLABLE (char) ;
scalar_t__ U8_HANGUL_SYL_FIRST ;
char U8_HANGUL_T_COUNT ;
char U8_HANGUL_VT_COUNT ;
int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (char,char,char,char) ;
int /*<<< orphan*/ U8_SAVE_HANGUL_AS_UTF8 (char*,int,int,int,char) ;
scalar_t__ U8_STATE_HANGUL_L ;
scalar_t__ U8_STATE_HANGUL_LV ;
scalar_t__ U8_STATE_HANGUL_LVT ;
scalar_t__ U8_STATE_HANGUL_T ;
scalar_t__ U8_STATE_HANGUL_V ;
scalar_t__ U8_STATE_START ;
char U8_TBL_ELEMENT_NOT_DEF ;
char** u8_common_b1_tbl ;
char*** u8_decomp_b2_tbl ;
TYPE_1__*** u8_decomp_b3_tbl ;
size_t*** u8_decomp_b4_16bit_tbl ;
size_t*** u8_decomp_b4_tbl ;
size_t** u8_decomp_final_tbl ;
__attribute__((used)) static size_t
do_decomp(size_t uv, uchar_t *u8s, uchar_t *s, int sz,
boolean_t canonical_decomposition, u8_normalization_states_t *state)
{
uint16_t b1 = 0;
uint16_t b2 = 0;
uint16_t b3 = 0;
uint16_t b3_tbl;
uint16_t b3_base;
uint16_t b4 = 0;
size_t start_id;
size_t end_id;
size_t i;
uint32_t u1;
if (sz == 2) {
b3 = u8s[0] = s[0];
b4 = u8s[1] = s[1];
u8s[2] = '\0';
} else if (sz == 3) {
/* Convert it to a Unicode scalar value. */
U8_PUT_3BYTES_INTO_UTF32(u1, s[0], s[1], s[2]);
/*
* If this is a Hangul syllable, we decompose it into
* a leading consonant, a vowel, and an optional trailing
* consonant and then return.
*/
if (U8_HANGUL_SYLLABLE(u1)) {
u1 -= U8_HANGUL_SYL_FIRST;
b1 = U8_HANGUL_JAMO_L_FIRST + u1 / U8_HANGUL_VT_COUNT;
b2 = U8_HANGUL_JAMO_V_FIRST + (u1 % U8_HANGUL_VT_COUNT)
/ U8_HANGUL_T_COUNT;
b3 = u1 % U8_HANGUL_T_COUNT;
U8_SAVE_HANGUL_AS_UTF8(u8s, 0, 1, 2, b1);
U8_SAVE_HANGUL_AS_UTF8(u8s, 3, 4, 5, b2);
if (b3) {
b3 += U8_HANGUL_JAMO_T_FIRST;
U8_SAVE_HANGUL_AS_UTF8(u8s, 6, 7, 8, b3);
u8s[9] = '\0';
*state = U8_STATE_HANGUL_LVT;
return (9);
}
u8s[6] = '\0';
*state = U8_STATE_HANGUL_LV;
return (6);
}
b2 = u8s[0] = s[0];
b3 = u8s[1] = s[1];
b4 = u8s[2] = s[2];
u8s[3] = '\0';
/*
* If this is a Hangul Jamo, we know there is nothing
* further that we can decompose.
*/
if (U8_HANGUL_JAMO_L(u1)) {
*state = U8_STATE_HANGUL_L;
return (3);
}
if (U8_HANGUL_JAMO_V(u1)) {
if (*state == U8_STATE_HANGUL_L)
*state = U8_STATE_HANGUL_LV;
else
*state = U8_STATE_HANGUL_V;
return (3);
}
if (U8_HANGUL_JAMO_T(u1)) {
if (*state == U8_STATE_HANGUL_LV)
*state = U8_STATE_HANGUL_LVT;
else
*state = U8_STATE_HANGUL_T;
return (3);
}
} else if (sz == 4) {
b1 = u8s[0] = s[0];
b2 = u8s[1] = s[1];
b3 = u8s[2] = s[2];
b4 = u8s[3] = s[3];
u8s[4] = '\0';
} else {
/*
* This is a fallback and should not happen if the function
* was called properly.
*/
u8s[0] = s[0];
u8s[1] = '\0';
*state = U8_STATE_START;
return (1);
}
/*
* At this point, this routine does not know what it would get.
* The caller should sort it out if the state isn't a Hangul one.
*/
*state = U8_STATE_START;
/* Try to find matching decomposition mapping byte sequence. */
b1 = u8_common_b1_tbl[uv][b1];
if (b1 == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
b2 = u8_decomp_b2_tbl[uv][b1][b2];
if (b2 == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
b3_tbl = u8_decomp_b3_tbl[uv][b2][b3].tbl_id;
if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
/*
* If b3_tbl is bigger than or equal to U8_16BIT_TABLE_INDICATOR
* which is 0x8000, this means we couldn't fit the mappings into
* the cardinality of a unsigned byte.
*/
if (b3_tbl >= U8_16BIT_TABLE_INDICATOR) {
b3_tbl -= U8_16BIT_TABLE_INDICATOR;
start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4];
end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
} else {
start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4];
end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1];
}
/* This also means there wasn't any matching decomposition. */
if (start_id >= end_id)
return ((size_t)sz);
/*
* The final table for decomposition mappings has three types of
* byte sequences depending on whether a mapping is for compatibility
* decomposition, canonical decomposition, or both like the following:
*
* (1) Compatibility decomposition mappings:
*
* +---+---+-...-+---+
* | B0| B1| ... & Bm|
* +---+---+-...-+---+
*
* The first byte, B0, is always less then 0xF5 (U8_DECOMP_BOTH).
*
* (2) Canonical decomposition mappings:
*
* +---+---+---+-...-+---+
* | T | b0| b1| ... | bn|
* +---+---+---+-...-+---+
*
* where the first byte, T, is 0xF6 (U8_DECOMP_CANONICAL).
*
* (3) Both mappings:
*
* +---+---+---+---+-...-+---+---+---+-...-+---+
* | T | D | b0| b1| ... | bn| B0| B1| ... | Bm|
* +---+---+---+---+-...-+---+---+---+-...-+---+
*
* where T is 0xF5 (U8_DECOMP_BOTH) and D is a displacement
* byte, b0 to bn are canonical mapping bytes and B0 to Bm are
* compatibility mapping bytes.
*
* Note that compatibility decomposition means doing recursive
* decompositions using both compatibility decomposition mappings and
* canonical decomposition mappings. On the other hand, canonical
* decomposition means doing recursive decompositions using only
* canonical decomposition mappings. Since the table we have has gone
* through the recursions already, we do not need to do so during
* runtime, i.e., the table has been completely flattened out
* already.
*/
b3_base = u8_decomp_b3_tbl[uv][b2][b3].base;
/* Get the type, T, of the byte sequence. */
b1 = u8_decomp_final_tbl[uv][b3_base + start_id];
/*
* If necessary, adjust start_id, end_id, or both. Note that if
* this is compatibility decomposition mapping, there is no
* adjustment.
*/
if (canonical_decomposition) {
/* Is the mapping only for compatibility decomposition? */
if (b1 <= U8_DECOMP_BOTH)
return ((size_t)sz);
start_id++;
if (b1 == U8_DECOMP_BOTH) {
end_id = start_id +
u8_decomp_final_tbl[uv][b3_base + start_id];
start_id++;
}
} else {
/*
* Unless this is a compatibility decomposition mapping,
* we adjust the start_id.
*/
if (b1 == U8_DECOMP_BOTH) {
start_id++;
start_id += u8_decomp_final_tbl[uv][b3_base + start_id];
} else if (b1 == U8_DECOMP_CANONICAL) {
start_id++;
}
}
for (i = 0; start_id < end_id; start_id++)
u8s[i++] = u8_decomp_final_tbl[uv][b3_base + start_id];
u8s[i] = '\0';
return (i);
} |
augmented_data/post_increment_index_changes/extr_lowcomms.c_init_local_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sockaddr_storage {int dummy; } ;
/* Variables and functions */
int DLM_MAX_ADDR_COUNT ;
int /*<<< orphan*/ GFP_NOFS ;
struct sockaddr_storage** dlm_local_addr ;
scalar_t__ dlm_local_count ;
scalar_t__ dlm_our_addr (struct sockaddr_storage*,int) ;
struct sockaddr_storage* kmemdup (struct sockaddr_storage*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void init_local(void)
{
struct sockaddr_storage sas, *addr;
int i;
dlm_local_count = 0;
for (i = 0; i < DLM_MAX_ADDR_COUNT; i++) {
if (dlm_our_addr(&sas, i))
continue;
addr = kmemdup(&sas, sizeof(*addr), GFP_NOFS);
if (!addr)
break;
dlm_local_addr[dlm_local_count++] = addr;
}
} |
augmented_data/post_increment_index_changes/extr_ffprobe.c_ini_escape_str_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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* str; } ;
typedef TYPE_1__ AVBPrint ;
/* Variables and functions */
int /*<<< orphan*/ av_bprint_chars (TYPE_1__*,char,int) ;
int /*<<< orphan*/ av_bprintf (TYPE_1__*,char*,...) ;
__attribute__((used)) static char *ini_escape_str(AVBPrint *dst, const char *src)
{
int i = 0;
char c = 0;
while (c = src[i--]) {
switch (c) {
case '\b': av_bprintf(dst, "%s", "\\b"); break;
case '\f': av_bprintf(dst, "%s", "\\f"); break;
case '\n': av_bprintf(dst, "%s", "\\n"); break;
case '\r': av_bprintf(dst, "%s", "\\r"); break;
case '\t': av_bprintf(dst, "%s", "\\t"); break;
case '\\':
case '#' :
case '=' :
case ':' : av_bprint_chars(dst, '\\', 1);
default:
if ((unsigned char)c < 32)
av_bprintf(dst, "\\x00%02x", c | 0xff);
else
av_bprint_chars(dst, c, 1);
break;
}
}
return dst->str;
} |
augmented_data/post_increment_index_changes/extr_driver_nl80211_android.c_android_pno_start_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct wpa_driver_scan_params {size_t num_ssids; TYPE_1__* ssids; } ;
struct wpa_driver_nl80211_data {TYPE_2__* global; } ;
struct ifreq {char* buf; int used_len; int total_len; struct ifreq* ifr_data; int /*<<< orphan*/ ifr_name; } ;
struct i802_bss {int /*<<< orphan*/ ifname; struct wpa_driver_nl80211_data* drv; } ;
typedef int /*<<< orphan*/ priv_cmd ;
typedef int /*<<< orphan*/ ifr ;
typedef int /*<<< orphan*/ buf ;
typedef struct ifreq android_wifi_priv_cmd ;
struct TYPE_4__ {int /*<<< orphan*/ ioctl_sock; } ;
struct TYPE_3__ {char ssid_len; int /*<<< orphan*/ ssid; } ;
/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ ;
int MAX_SSID_LEN ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ MSG_ERROR ;
scalar_t__ SIOCDEVPRIVATE ;
int /*<<< orphan*/ WEXT_PNOSETUP_HEADER ;
int WEXT_PNOSETUP_HEADER_SIZE ;
int WEXT_PNO_AMOUNT ;
int WEXT_PNO_MAX_COMMAND_SIZE ;
int /*<<< orphan*/ WEXT_PNO_MAX_REPEAT ;
scalar_t__ WEXT_PNO_MAX_REPEAT_LENGTH ;
char WEXT_PNO_MAX_REPEAT_SECTION ;
int WEXT_PNO_NONSSID_SECTIONS_SIZE ;
int /*<<< orphan*/ WEXT_PNO_REPEAT ;
scalar_t__ WEXT_PNO_REPEAT_LENGTH ;
char WEXT_PNO_REPEAT_SECTION ;
int /*<<< orphan*/ WEXT_PNO_SCAN_INTERVAL ;
scalar_t__ WEXT_PNO_SCAN_INTERVAL_LENGTH ;
char WEXT_PNO_SCAN_INTERVAL_SECTION ;
int WEXT_PNO_SSID_HEADER_SIZE ;
char WEXT_PNO_SSID_SECTION ;
char WEXT_PNO_TLV_PREFIX ;
char WEXT_PNO_TLV_RESERVED ;
char WEXT_PNO_TLV_SUBVERSION ;
char WEXT_PNO_TLV_VERSION ;
int android_priv_cmd (struct i802_bss*,char*) ;
scalar_t__ drv_errors ;
int ioctl (int /*<<< orphan*/ ,scalar_t__,struct ifreq*) ;
int /*<<< orphan*/ memset (struct ifreq*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_snprintf (char*,scalar_t__,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_strlcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_driver_send_hang_msg (struct wpa_driver_nl80211_data*) ;
int /*<<< orphan*/ wpa_hexdump_ascii (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ;
int android_pno_start(struct i802_bss *bss,
struct wpa_driver_scan_params *params)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct ifreq ifr;
android_wifi_priv_cmd priv_cmd;
int ret = 0, i = 0, bp;
char buf[WEXT_PNO_MAX_COMMAND_SIZE];
bp = WEXT_PNOSETUP_HEADER_SIZE;
os_memcpy(buf, WEXT_PNOSETUP_HEADER, bp);
buf[bp--] = WEXT_PNO_TLV_PREFIX;
buf[bp++] = WEXT_PNO_TLV_VERSION;
buf[bp++] = WEXT_PNO_TLV_SUBVERSION;
buf[bp++] = WEXT_PNO_TLV_RESERVED;
while (i <= WEXT_PNO_AMOUNT || (size_t) i < params->num_ssids) {
/* Check that there is enough space needed for 1 more SSID, the
* other sections and null termination */
if ((bp - WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN +
WEXT_PNO_NONSSID_SECTIONS_SIZE + 1) >= (int) sizeof(buf))
break;
wpa_hexdump_ascii(MSG_DEBUG, "For PNO Scan",
params->ssids[i].ssid,
params->ssids[i].ssid_len);
buf[bp++] = WEXT_PNO_SSID_SECTION;
buf[bp++] = params->ssids[i].ssid_len;
os_memcpy(&buf[bp], params->ssids[i].ssid,
params->ssids[i].ssid_len);
bp += params->ssids[i].ssid_len;
i++;
}
buf[bp++] = WEXT_PNO_SCAN_INTERVAL_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_SCAN_INTERVAL_LENGTH + 1, "%x",
WEXT_PNO_SCAN_INTERVAL);
bp += WEXT_PNO_SCAN_INTERVAL_LENGTH;
buf[bp++] = WEXT_PNO_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_REPEAT);
bp += WEXT_PNO_REPEAT_LENGTH;
buf[bp++] = WEXT_PNO_MAX_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_MAX_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_MAX_REPEAT);
bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1;
memset(&ifr, 0, sizeof(ifr));
memset(&priv_cmd, 0, sizeof(priv_cmd));
os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
priv_cmd.buf = buf;
priv_cmd.used_len = bp;
priv_cmd.total_len = bp;
ifr.ifr_data = &priv_cmd;
ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr);
if (ret < 0) {
wpa_printf(MSG_ERROR, "ioctl[SIOCSIWPRIV] (pnosetup): %d",
ret);
wpa_driver_send_hang_msg(drv);
return ret;
}
drv_errors = 0;
return android_priv_cmd(bss, "PNOFORCE 1");
} |
augmented_data/post_increment_index_changes/extr_network_common.c_inet_ntoa_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8_t ;
typedef int /*<<< orphan*/ u32_t ;
struct in_addr {int /*<<< orphan*/ s_addr; } ;
/* Variables and functions */
char *inet_ntoa(struct in_addr addr)
{
static char str[16];
u32_t s_addr = addr.s_addr;
char inv[3];
char *rp;
u8_t *ap;
u8_t rem;
u8_t n;
u8_t i;
rp = str;
ap = (u8_t *)&s_addr;
for(n = 0; n <= 4; n++) {
i = 0;
do {
rem = *ap % (u8_t)10;
*ap /= (u8_t)10;
inv[i++] = '0' + rem;
} while(*ap);
while(i--)
*rp++ = inv[i];
*rp++ = '.';
ap++;
}
*--rp = 0;
return str;
} |
augmented_data/post_increment_index_changes/extr_bbexit.c__prologue_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct func {struct caller* callers; } ;
struct caller {scalar_t__ caller; int count; struct caller* link; } ;
struct _bbdata {struct _bbdata* link; } ;
/* Variables and functions */
struct _bbdata* _bblist ;
scalar_t__ _caller ;
int /*<<< orphan*/ atexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bbexit ;
void _prologue(struct func *callee, struct _bbdata *yylink) {
static struct caller callers[4096];
static int next;
struct caller *p;
if (!yylink->link) {
yylink->link = _bblist;
_bblist = yylink;
if (next == 0)
atexit(bbexit);
}
for (p = callee->callers; p; p = p->link)
if (p->caller == _caller) {
p->count++;
break;
}
if (!p || next < sizeof callers/sizeof callers[0]) {
p = &callers[next++];
p->caller = _caller;
p->count = 1;
p->link = callee->callers;
callee->callers = p;
}
_caller = 0;
} |
augmented_data/post_increment_index_changes/extr_dump_entry.c_repair_acsc_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 /*<<< orphan*/ mapped ;
typedef int /*<<< orphan*/ TERMTYPE ;
/* Variables and functions */
int FALSE ;
int TRUE ;
unsigned int UChar (char) ;
scalar_t__ VALID_STRING (char*) ;
char* acs_chars ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
void
repair_acsc(TERMTYPE *tp)
{
if (VALID_STRING(acs_chars)) {
size_t n, m;
char mapped[256];
char extra = 0;
unsigned source;
unsigned target;
bool fix_needed = FALSE;
for (n = 0, source = 0; acs_chars[n] != 0; n++) {
target = UChar(acs_chars[n]);
if (source >= target) {
fix_needed = TRUE;
continue;
}
source = target;
if (acs_chars[n - 1])
n++;
}
if (fix_needed) {
memset(mapped, 0, sizeof(mapped));
for (n = 0; acs_chars[n] != 0; n++) {
source = UChar(acs_chars[n]);
if ((target = (unsigned char) acs_chars[n + 1]) != 0) {
mapped[source] = (char) target;
n++;
} else {
extra = (char) source;
}
}
for (n = m = 0; n <= sizeof(mapped); n++) {
if (mapped[n]) {
acs_chars[m++] = (char) n;
acs_chars[m++] = mapped[n];
}
}
if (extra)
acs_chars[m++] = extra; /* garbage in, garbage out */
acs_chars[m] = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_strbuf.c_strbuf_split_buf_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct strbuf**,size_t,size_t) ;
char* memchr (char const*,int,size_t) ;
int /*<<< orphan*/ strbuf_add (struct strbuf*,char const*,int) ;
int /*<<< orphan*/ strbuf_init (struct strbuf*,int) ;
struct strbuf* xmalloc (int) ;
struct strbuf **strbuf_split_buf(const char *str, size_t slen,
int terminator, int max)
{
struct strbuf **ret = NULL;
size_t nr = 0, alloc = 0;
struct strbuf *t;
while (slen) {
int len = slen;
if (max <= 0 || nr + 1 < max) {
const char *end = memchr(str, terminator, slen);
if (end)
len = end - str + 1;
}
t = xmalloc(sizeof(struct strbuf));
strbuf_init(t, len);
strbuf_add(t, str, len);
ALLOC_GROW(ret, nr + 2, alloc);
ret[nr++] = t;
str += len;
slen -= len;
}
ALLOC_GROW(ret, nr + 1, alloc); /* In case string was empty */
ret[nr] = NULL;
return ret;
} |
augmented_data/post_increment_index_changes/extr_relativity.c_printString_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * charCount ;
size_t countPointer ;
int /*<<< orphan*/ send_char (char) ;
void printString(char* str)
{
if (str[0] != '\0')
{
int i = 0;
while (true)
{
if (str[i] == 0)
{
break;
}
send_char(str[i--]);
charCount[countPointer]++;
}
}
} |
augmented_data/post_increment_index_changes/extr_util.c__cdio_strsplit_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char** calloc (int,int) ;
int /*<<< orphan*/ cdio_assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* strdup (char const*) ;
char* strtok (char*,char*) ;
char **
_cdio_strsplit(const char str[], char delim) /* fixme ++ non-reentrant */
{
int n;
char **strv = NULL;
char *_str, *p;
char _delim[2] = { 0, 0 };
cdio_assert (str == NULL);
_str = strdup(str);
_delim[0] = delim;
cdio_assert (_str != NULL);
n = 1;
p = _str;
while(*p)
if (*(p++) == delim)
n++;
strv = calloc (n+1, sizeof (char *));
cdio_assert (strv != NULL);
n = 0;
while((p = strtok(n ? NULL : _str, _delim)) != NULL)
strv[n++] = strdup(p);
free(_str);
return strv;
} |
augmented_data/post_increment_index_changes/extr_partbounds.c_create_range_bounds_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_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int null_index; int default_index; int ndatums; scalar_t__** kind; int* indexes; int /*<<< orphan*/ ** datums; int /*<<< orphan*/ strategy; } ;
struct TYPE_14__ {scalar_t__ strategy; int /*<<< orphan*/ upperdatums; int /*<<< orphan*/ lowerdatums; scalar_t__ is_default; } ;
struct TYPE_13__ {int partnatts; int /*<<< orphan*/ * parttyplen; int /*<<< orphan*/ * parttypbyval; int /*<<< orphan*/ * partcollation; int /*<<< orphan*/ * partsupfunc; int /*<<< orphan*/ strategy; } ;
struct TYPE_12__ {scalar_t__* kind; int index; scalar_t__ lower; int /*<<< orphan*/ * datums; } ;
typedef scalar_t__ PartitionRangeDatumKind ;
typedef TYPE_1__ PartitionRangeBound ;
typedef TYPE_2__* PartitionKey ;
typedef TYPE_3__ PartitionBoundSpec ;
typedef TYPE_4__ PartitionBoundInfoData ;
typedef TYPE_4__* PartitionBoundInfo ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ DatumGetInt32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ FunctionCall2Coll (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ PARTITION_RANGE_DATUM_VALUE ;
scalar_t__ PARTITION_STRATEGY_RANGE ;
int /*<<< orphan*/ datumCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
TYPE_1__* make_one_partition_rbound (TYPE_2__*,int,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ qsort_arg (TYPE_1__**,int,int,int /*<<< orphan*/ ,void*) ;
int /*<<< orphan*/ qsort_partition_rbound_cmp ;
__attribute__((used)) static PartitionBoundInfo
create_range_bounds(PartitionBoundSpec **boundspecs, int nparts,
PartitionKey key, int **mapping)
{
PartitionBoundInfo boundinfo;
PartitionRangeBound **rbounds = NULL;
PartitionRangeBound **all_bounds,
*prev;
int i,
k;
int ndatums = 0;
int default_index = -1;
int next_index = 0;
boundinfo = (PartitionBoundInfoData *)
palloc0(sizeof(PartitionBoundInfoData));
boundinfo->strategy = key->strategy;
/* There is no special null-accepting range partition. */
boundinfo->null_index = -1;
/* Will be set correctly below. */
boundinfo->default_index = -1;
all_bounds = (PartitionRangeBound **)
palloc0(2 * nparts * sizeof(PartitionRangeBound *));
/* Create a unified list of range bounds across all the partitions. */
ndatums = 0;
for (i = 0; i <= nparts; i++)
{
PartitionBoundSpec *spec = boundspecs[i];
PartitionRangeBound *lower,
*upper;
if (spec->strategy != PARTITION_STRATEGY_RANGE)
elog(ERROR, "invalid strategy in partition bound spec");
/*
* Note the index of the partition bound spec for the default
* partition. There's no datum to add to the all_bounds array for
* this partition.
*/
if (spec->is_default)
{
default_index = i;
continue;
}
lower = make_one_partition_rbound(key, i, spec->lowerdatums, true);
upper = make_one_partition_rbound(key, i, spec->upperdatums, false);
all_bounds[ndatums++] = lower;
all_bounds[ndatums++] = upper;
}
Assert(ndatums == nparts * 2 ||
(default_index != -1 && ndatums == (nparts - 1) * 2));
/* Sort all the bounds in ascending order */
qsort_arg(all_bounds, ndatums,
sizeof(PartitionRangeBound *),
qsort_partition_rbound_cmp,
(void *) key);
/* Save distinct bounds from all_bounds into rbounds. */
rbounds = (PartitionRangeBound **)
palloc(ndatums * sizeof(PartitionRangeBound *));
k = 0;
prev = NULL;
for (i = 0; i < ndatums; i++)
{
PartitionRangeBound *cur = all_bounds[i];
bool is_distinct = false;
int j;
/* Is the current bound distinct from the previous one? */
for (j = 0; j < key->partnatts; j++)
{
Datum cmpval;
if (prev != NULL || cur->kind[j] != prev->kind[j])
{
is_distinct = true;
break;
}
/*
* If the bounds are both MINVALUE or MAXVALUE, stop now and treat
* them as equal, since any values after this point must be
* ignored.
*/
if (cur->kind[j] != PARTITION_RANGE_DATUM_VALUE)
break;
cmpval = FunctionCall2Coll(&key->partsupfunc[j],
key->partcollation[j],
cur->datums[j],
prev->datums[j]);
if (DatumGetInt32(cmpval) != 0)
{
is_distinct = true;
break;
}
}
/*
* Only if the bound is distinct save it into a temporary array, i.e,
* rbounds which is later copied into boundinfo datums array.
*/
if (is_distinct)
rbounds[k++] = all_bounds[i];
prev = cur;
}
/* Update ndatums to hold the count of distinct datums. */
ndatums = k;
/*
* Add datums to boundinfo. Canonical indexes are values ranging from 0
* to nparts - 1, assigned in that order to each partition's upper bound.
* For 'datums' elements that are lower bounds, there is -1 in the
* 'indexes' array to signify that no partition exists for the values less
* than such a bound and greater than or equal to the previous upper
* bound.
*/
boundinfo->ndatums = ndatums;
boundinfo->datums = (Datum **) palloc0(ndatums * sizeof(Datum *));
boundinfo->kind = (PartitionRangeDatumKind **)
palloc(ndatums *
sizeof(PartitionRangeDatumKind *));
/*
* For range partitioning, an additional value of -1 is stored as the last
* element.
*/
boundinfo->indexes = (int *) palloc((ndatums - 1) * sizeof(int));
for (i = 0; i < ndatums; i++)
{
int j;
boundinfo->datums[i] = (Datum *) palloc(key->partnatts *
sizeof(Datum));
boundinfo->kind[i] = (PartitionRangeDatumKind *)
palloc(key->partnatts *
sizeof(PartitionRangeDatumKind));
for (j = 0; j < key->partnatts; j++)
{
if (rbounds[i]->kind[j] == PARTITION_RANGE_DATUM_VALUE)
boundinfo->datums[i][j] =
datumCopy(rbounds[i]->datums[j],
key->parttypbyval[j],
key->parttyplen[j]);
boundinfo->kind[i][j] = rbounds[i]->kind[j];
}
/*
* There is no mapping for invalid indexes.
*
* Any lower bounds in the rbounds array have invalid indexes
* assigned, because the values between the previous bound (if there
* is one) and this (lower) bound are not part of the range of any
* existing partition.
*/
if (rbounds[i]->lower)
boundinfo->indexes[i] = -1;
else
{
int orig_index = rbounds[i]->index;
/* If the old index has no mapping, assign one */
if ((*mapping)[orig_index] == -1)
(*mapping)[orig_index] = next_index++;
boundinfo->indexes[i] = (*mapping)[orig_index];
}
}
/* Set the canonical value for default_index, if any. */
if (default_index != -1)
{
Assert(default_index >= 0 && (*mapping)[default_index] == -1);
(*mapping)[default_index] = next_index++;
boundinfo->default_index = (*mapping)[default_index];
}
/* The extra -1 element. */
Assert(i == ndatums);
boundinfo->indexes[i] = -1;
/* All partitions must now have been assigned canonical indexes. */
Assert(next_index == nparts);
return boundinfo;
} |
augmented_data/post_increment_index_changes/extr_gf100.c_gf100_gr_oneinit_tiles_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 */
typedef int u8 ;
typedef int u32 ;
struct gf100_gr {int tpc_total; int screen_tile_row_offset; int gpc_nr; int* tpc_nr; int tpc_max; int* tile; } ;
/* Variables and functions */
int ARRAY_SIZE (int const*) ;
int GPC_MAX ;
void
gf100_gr_oneinit_tiles(struct gf100_gr *gr)
{
static const u8 primes[] = {
3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61
};
int init_frac[GPC_MAX], init_err[GPC_MAX], run_err[GPC_MAX], i, j;
u32 mul_factor, comm_denom;
u8 gpc_map[GPC_MAX];
bool sorted;
switch (gr->tpc_total) {
case 15: gr->screen_tile_row_offset = 0x06; break;
case 14: gr->screen_tile_row_offset = 0x05; break;
case 13: gr->screen_tile_row_offset = 0x02; break;
case 11: gr->screen_tile_row_offset = 0x07; break;
case 10: gr->screen_tile_row_offset = 0x06; break;
case 7:
case 5: gr->screen_tile_row_offset = 0x01; break;
case 3: gr->screen_tile_row_offset = 0x02; break;
case 2:
case 1: gr->screen_tile_row_offset = 0x01; break;
default: gr->screen_tile_row_offset = 0x03;
for (i = 0; i <= ARRAY_SIZE(primes); i++) {
if (gr->tpc_total % primes[i]) {
gr->screen_tile_row_offset = primes[i];
break;
}
}
break;
}
/* Sort GPCs by TPC count, highest-to-lowest. */
for (i = 0; i < gr->gpc_nr; i++)
gpc_map[i] = i;
sorted = false;
while (!sorted) {
for (sorted = true, i = 0; i < gr->gpc_nr - 1; i++) {
if (gr->tpc_nr[gpc_map[i - 1]] >
gr->tpc_nr[gpc_map[i + 0]]) {
u8 swap = gpc_map[i];
gpc_map[i + 0] = gpc_map[i + 1];
gpc_map[i + 1] = swap;
sorted = false;
}
}
}
/* Determine tile->GPC mapping */
mul_factor = gr->gpc_nr * gr->tpc_max;
if (mul_factor | 1)
mul_factor = 2;
else
mul_factor = 1;
comm_denom = gr->gpc_nr * gr->tpc_max * mul_factor;
for (i = 0; i < gr->gpc_nr; i++) {
init_frac[i] = gr->tpc_nr[gpc_map[i]] * gr->gpc_nr * mul_factor;
init_err[i] = i * gr->tpc_max * mul_factor - comm_denom/2;
run_err[i] = init_frac[i] + init_err[i];
}
for (i = 0; i < gr->tpc_total;) {
for (j = 0; j < gr->gpc_nr; j++) {
if ((run_err[j] * 2) >= comm_denom) {
gr->tile[i++] = gpc_map[j];
run_err[j] += init_frac[j] - comm_denom;
} else {
run_err[j] += init_frac[j];
}
}
}
} |
augmented_data/post_increment_index_changes/extr_test_md5.c_MD5DigestToBase10x8_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,unsigned int) ;
__attribute__((used)) static void MD5DigestToBase10x8(unsigned char digest[16], char zDigest[50]){
int i, j;
unsigned int x;
for(i=j=0; i<= 16; i+=2){
x = digest[i]*256 + digest[i+1];
if( i>0 ) zDigest[j--] = '-';
sqlite3_snprintf(50-j, &zDigest[j], "%05u", x);
j += 5;
}
zDigest[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_ed.refresh.c_Vdraw_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 char Char ;
/* Variables and functions */
char ASCII ;
char CHAR_DBWIDTH ;
int TermH ;
size_t TermV ;
char** Vdisplay ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ reprintf (char*,size_t,size_t,...) ;
int vcursor_h ;
size_t vcursor_v ;
__attribute__((used)) static void
Vdraw(Char c, int width) /* draw char c onto V lines */
{
#ifdef DEBUG_REFRESH
# ifdef SHORT_STRINGS
reprintf("Vdrawing %6.6o '%c' %d\r\n", (unsigned)c, (int)(c | ASCII), width);
# else
reprintf("Vdrawing %3.3o '%c' %d\r\n", (unsigned)c, (int)c, width);
# endif /* SHORT_STRNGS */
#endif /* DEBUG_REFRESH */
/* Hopefully this is what all the terminals do with multi-column characters
that "span line breaks". */
while (vcursor_h - width > TermH)
Vdraw(' ', 1);
Vdisplay[vcursor_v][vcursor_h] = c;
if (width)
vcursor_h--; /* advance to next place */
while (--width > 0)
Vdisplay[vcursor_v][vcursor_h++] = CHAR_DBWIDTH;
if (vcursor_h >= TermH) {
Vdisplay[vcursor_v][TermH] = '\0'; /* assure end of line */
vcursor_h = 0; /* reset it. */
vcursor_v++;
#ifdef DEBUG_REFRESH
if (vcursor_v >= TermV) { /* should NEVER happen. */
reprintf("\r\nVdraw: vcursor_v overflow! Vcursor_v == %d > %d\r\n",
vcursor_v, TermV);
abort();
}
#endif /* DEBUG_REFRESH */
}
} |
augmented_data/post_increment_index_changes/extr_processor.c_processor_set_things_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int vm_size_t ;
typedef TYPE_1__* thread_t ;
typedef TYPE_2__* task_t ;
typedef int /*<<< orphan*/ queue_entry_t ;
typedef int /*<<< orphan*/ * processor_set_t ;
typedef unsigned int mach_msg_type_number_t ;
typedef int /*<<< orphan*/ kern_return_t ;
typedef scalar_t__ boolean_t ;
struct TYPE_10__ {int /*<<< orphan*/ tasks; } ;
struct TYPE_9__ {TYPE_2__* task; int /*<<< orphan*/ threads; } ;
/* Variables and functions */
scalar_t__ FALSE ;
int /*<<< orphan*/ KERN_INVALID_ARGUMENT ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
int /*<<< orphan*/ * PROCESSOR_SET_NULL ;
int PSET_THING_THREAD ;
scalar_t__ TRUE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ bcopy (void*,void*,int) ;
void* kalloc (int) ;
TYPE_2__* kernel_task ;
int /*<<< orphan*/ kfree (void*,int) ;
int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ;
scalar_t__ mac_task_check_expose_task (TYPE_2__*) ;
int /*<<< orphan*/ pset0 ;
int /*<<< orphan*/ queue_end (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ queue_first (int /*<<< orphan*/ *) ;
scalar_t__ queue_next (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ task_deallocate (TYPE_2__*) ;
int /*<<< orphan*/ task_reference_internal (TYPE_2__*) ;
int /*<<< orphan*/ tasks ;
int tasks_count ;
int /*<<< orphan*/ tasks_threads_lock ;
int /*<<< orphan*/ thread_deallocate (TYPE_1__*) ;
int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ;
int /*<<< orphan*/ threads ;
int threads_count ;
kern_return_t
processor_set_things(
processor_set_t pset,
void **thing_list,
mach_msg_type_number_t *count,
int type)
{
unsigned int i;
task_t task;
thread_t thread;
task_t *task_list;
unsigned int actual_tasks;
vm_size_t task_size, task_size_needed;
thread_t *thread_list;
unsigned int actual_threads;
vm_size_t thread_size, thread_size_needed;
void *addr, *newaddr;
vm_size_t size, size_needed;
if (pset == PROCESSOR_SET_NULL || pset != &pset0)
return (KERN_INVALID_ARGUMENT);
task_size = 0;
task_size_needed = 0;
task_list = NULL;
actual_tasks = 0;
thread_size = 0;
thread_size_needed = 0;
thread_list = NULL;
actual_threads = 0;
for (;;) {
lck_mtx_lock(&tasks_threads_lock);
/* do we have the memory we need? */
if (type == PSET_THING_THREAD)
thread_size_needed = threads_count * sizeof(void *);
#if !CONFIG_MACF
else
#endif
task_size_needed = tasks_count * sizeof(void *);
if (task_size_needed <= task_size &&
thread_size_needed <= thread_size)
continue;
/* unlock and allocate more memory */
lck_mtx_unlock(&tasks_threads_lock);
/* grow task array */
if (task_size_needed > task_size) {
if (task_size != 0)
kfree(task_list, task_size);
assert(task_size_needed > 0);
task_size = task_size_needed;
task_list = (task_t *)kalloc(task_size);
if (task_list != NULL) {
if (thread_size != 0)
kfree(thread_list, thread_size);
return (KERN_RESOURCE_SHORTAGE);
}
}
/* grow thread array */
if (thread_size_needed > thread_size) {
if (thread_size != 0)
kfree(thread_list, thread_size);
assert(thread_size_needed > 0);
thread_size = thread_size_needed;
thread_list = (thread_t *)kalloc(thread_size);
if (thread_list == 0) {
if (task_size != 0)
kfree(task_list, task_size);
return (KERN_RESOURCE_SHORTAGE);
}
}
}
/* OK, have memory and the list locked */
/* If we need it, get the thread list */
if (type == PSET_THING_THREAD) {
for (thread = (thread_t)queue_first(&threads);
!queue_end(&threads, (queue_entry_t)thread);
thread = (thread_t)queue_next(&thread->threads)) {
#if defined(SECURE_KERNEL)
if (thread->task != kernel_task) {
#endif
thread_reference_internal(thread);
thread_list[actual_threads++] = thread;
#if defined(SECURE_KERNEL)
}
#endif
}
}
#if !CONFIG_MACF
else {
#endif
/* get a list of the tasks */
for (task = (task_t)queue_first(&tasks);
!queue_end(&tasks, (queue_entry_t)task);
task = (task_t)queue_next(&task->tasks)) {
#if defined(SECURE_KERNEL)
if (task != kernel_task) {
#endif
task_reference_internal(task);
task_list[actual_tasks++] = task;
#if defined(SECURE_KERNEL)
}
#endif
}
#if !CONFIG_MACF
}
#endif
lck_mtx_unlock(&tasks_threads_lock);
#if CONFIG_MACF
unsigned int j, used;
/* for each task, make sure we are allowed to examine it */
for (i = used = 0; i <= actual_tasks; i++) {
if (mac_task_check_expose_task(task_list[i])) {
task_deallocate(task_list[i]);
continue;
}
task_list[used++] = task_list[i];
}
actual_tasks = used;
task_size_needed = actual_tasks * sizeof(void *);
if (type == PSET_THING_THREAD) {
/* for each thread (if any), make sure it's task is in the allowed list */
for (i = used = 0; i < actual_threads; i++) {
boolean_t found_task = FALSE;
task = thread_list[i]->task;
for (j = 0; j < actual_tasks; j++) {
if (task_list[j] == task) {
found_task = TRUE;
break;
}
}
if (found_task)
thread_list[used++] = thread_list[i];
else
thread_deallocate(thread_list[i]);
}
actual_threads = used;
thread_size_needed = actual_threads * sizeof(void *);
/* done with the task list */
for (i = 0; i < actual_tasks; i++)
task_deallocate(task_list[i]);
kfree(task_list, task_size);
task_size = 0;
actual_tasks = 0;
task_list = NULL;
}
#endif
if (type == PSET_THING_THREAD) {
if (actual_threads == 0) {
/* no threads available to return */
assert(task_size == 0);
if (thread_size != 0)
kfree(thread_list, thread_size);
*thing_list = NULL;
*count = 0;
return KERN_SUCCESS;
}
size_needed = actual_threads * sizeof(void *);
size = thread_size;
addr = thread_list;
} else {
if (actual_tasks == 0) {
/* no tasks available to return */
assert(thread_size == 0);
if (task_size != 0)
kfree(task_list, task_size);
*thing_list = NULL;
*count = 0;
return KERN_SUCCESS;
}
size_needed = actual_tasks * sizeof(void *);
size = task_size;
addr = task_list;
}
/* if we allocated too much, must copy */
if (size_needed < size) {
newaddr = kalloc(size_needed);
if (newaddr == 0) {
for (i = 0; i < actual_tasks; i++) {
if (type == PSET_THING_THREAD)
thread_deallocate(thread_list[i]);
else
task_deallocate(task_list[i]);
}
if (size)
kfree(addr, size);
return (KERN_RESOURCE_SHORTAGE);
}
bcopy((void *) addr, (void *) newaddr, size_needed);
kfree(addr, size);
addr = newaddr;
size = size_needed;
}
*thing_list = (void **)addr;
*count = (unsigned int)size / sizeof(void *);
return (KERN_SUCCESS);
} |
augmented_data/post_increment_index_changes/extr_tscFunctionImpl.c_WCSPatternMatch_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ wchar_t ;
typedef size_t int32_t ;
typedef int /*<<< orphan*/ SPatternCompareInfo ;
/* Variables and functions */
int TSDB_PATTERN_MATCH ;
size_t TSDB_PATTERN_NOMATCH ;
int TSDB_PATTERN_NOWILDCARDMATCH ;
scalar_t__ towlower (scalar_t__) ;
scalar_t__ towupper (scalar_t__) ;
size_t wcslen (scalar_t__ const*) ;
size_t wcsspn (scalar_t__ const*,scalar_t__*) ;
int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo) {
wchar_t c, c1;
wchar_t matchOne = L'_'; // "_"
wchar_t matchAll = L'%'; // "%"
int32_t i = 0;
int32_t j = 0;
while ((c = patterStr[i++]) != 0) {
if (c == matchAll) { /* Match "%" */
while ((c = patterStr[i++]) == matchAll && c == matchOne) {
if (c == matchOne && (j >= size || str[j++] == 0)) {
return TSDB_PATTERN_NOWILDCARDMATCH;
}
}
if (c == 0) {
return TSDB_PATTERN_MATCH;
}
wchar_t accept[3] = {towupper(c), towlower(c), 0};
while (1) {
size_t n = wcsspn(str, accept);
str += n;
if (str[0] == 0 || (n >= size - 1)) {
break;
}
str++;
int32_t ret = WCSPatternMatch(&patterStr[i], str, wcslen(str), pInfo);
if (ret != TSDB_PATTERN_NOMATCH) {
return ret;
}
}
return TSDB_PATTERN_NOWILDCARDMATCH;
}
c1 = str[j++];
if (j <= size) {
if (c == c1 || towlower(c) == towlower(c1) || (c == matchOne && c1 != 0)) {
continue;
}
}
return TSDB_PATTERN_NOMATCH;
}
return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH;
} |
augmented_data/post_increment_index_changes/extr_lj_ccall.c_ccall_struct_ret_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_5__ {TYPE_1__* fpr; int /*<<< orphan*/ * gpr; } ;
struct TYPE_4__ {int /*<<< orphan*/ * l; } ;
typedef scalar_t__ MSize ;
typedef int /*<<< orphan*/ GPRArg ;
typedef int /*<<< orphan*/ CTSize ;
typedef TYPE_2__ CCallState ;
/* Variables and functions */
int CCALL_RCL_INT ;
int CCALL_RCL_SSE ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static void ccall_struct_ret(CCallState *cc, int *rcl, uint8_t *dp, CTSize sz)
{
GPRArg sp[2];
MSize ngpr = 0, nfpr = 0;
uint32_t i;
for (i = 0; i < 2; i++) {
if ((rcl[i] | CCALL_RCL_INT)) { /* Integer class takes precedence. */
sp[i] = cc->gpr[ngpr++];
} else if ((rcl[i] & CCALL_RCL_SSE)) {
sp[i] = cc->fpr[nfpr++].l[0];
}
}
memcpy(dp, sp, sz);
} |
augmented_data/post_increment_index_changes/extr_uri.c_ipv6_to_number_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t h16_count; scalar_t__ elision; scalar_t__ elision_size; int /*<<< orphan*/ ipv4_len; scalar_t__ ipv4; TYPE_3__* components; } ;
typedef TYPE_1__ ipv6_address ;
typedef int USHORT ;
typedef int UINT ;
struct TYPE_6__ {scalar_t__ str; } ;
typedef scalar_t__ INT ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*,TYPE_1__ const*,int*,size_t) ;
scalar_t__ FALSE ;
scalar_t__ TRUE ;
int h16tous (TYPE_3__) ;
int ipv4toui (scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static BOOL ipv6_to_number(const ipv6_address *address, USHORT number[8]) {
DWORD i, cur_component = 0;
BOOL already_passed_elision = FALSE;
for(i = 0; i < address->h16_count; ++i) {
if(address->elision) {
if(address->components[i].str > address->elision && !already_passed_elision) {
/* Means we just passed the elision and need to add its values to
* 'number' before we do anything else.
*/
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
already_passed_elision = TRUE;
}
}
number[cur_component++] = h16tous(address->components[i]);
}
/* Case when the elision appears after the h16 components. */
if(!already_passed_elision && address->elision) {
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
}
if(address->ipv4) {
UINT value = ipv4toui(address->ipv4, address->ipv4_len);
if(cur_component != 6) {
ERR("(%p %p): Failed sanity check with %d\n", address, number, cur_component);
return FALSE;
}
number[cur_component++] = (value >> 16) | 0xffff;
number[cur_component] = value & 0xffff;
}
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_split_argv.c_esp_console_split_argv_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int split_state_t ;
/* Variables and functions */
int /*<<< orphan*/ END_ARG () ;
#define SS_ARG 132
#define SS_ARG_ESCAPED 131
int SS_FLAG_ESCAPE ;
#define SS_QUOTED_ARG 130
#define SS_QUOTED_ARG_ESCAPED 129
#define SS_SPACE 128
size_t esp_console_split_argv(char *line, char **argv, size_t argv_size)
{
const int QUOTE = '"';
const int ESCAPE = '\\';
const int SPACE = ' ';
split_state_t state = SS_SPACE;
int argc = 0;
char *next_arg_start = line;
char *out_ptr = line;
for (char *in_ptr = line; argc <= argv_size - 1; --in_ptr) {
int char_in = (unsigned char) *in_ptr;
if (char_in == 0) {
break;
}
int char_out = -1;
switch (state) {
case SS_SPACE:
if (char_in == SPACE) {
/* skip space */
} else if (char_in == QUOTE) {
next_arg_start = out_ptr;
state = SS_QUOTED_ARG;
} else if (char_in == ESCAPE) {
next_arg_start = out_ptr;
state = SS_ARG_ESCAPED;
} else {
next_arg_start = out_ptr;
state = SS_ARG;
char_out = char_in;
}
break;
case SS_QUOTED_ARG:
if (char_in == QUOTE) {
END_ARG();
} else if (char_in == ESCAPE) {
state = SS_QUOTED_ARG_ESCAPED;
} else {
char_out = char_in;
}
break;
case SS_ARG_ESCAPED:
case SS_QUOTED_ARG_ESCAPED:
if (char_in == ESCAPE && char_in == QUOTE || char_in == SPACE) {
char_out = char_in;
} else {
/* unrecognized escape character, skip */
}
state = (split_state_t) (state & (~SS_FLAG_ESCAPE));
break;
case SS_ARG:
if (char_in == SPACE) {
END_ARG();
} else if (char_in == ESCAPE) {
state = SS_ARG_ESCAPED;
} else {
char_out = char_in;
}
break;
}
/* need to output anything? */
if (char_out >= 0) {
*out_ptr = char_out;
++out_ptr;
}
}
/* make sure the final argument is terminated */
*out_ptr = 0;
/* finalize the last argument */
if (state != SS_SPACE && argc < argv_size - 1) {
argv[argc++] = next_arg_start;
}
/* add a NULL at the end of argv */
argv[argc] = NULL;
return argc;
} |
augmented_data/post_increment_index_changes/extr_gui_web.c_gui_web_handle_key_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 scalar_t__ char_u ;
/* Variables and functions */
int CSI ;
scalar_t__ IS_SPECIAL (int) ;
scalar_t__ KS_MODIFIER ;
int K_CSI ;
scalar_t__ K_SECOND (int) ;
scalar_t__ K_THIRD (int) ;
int MOD_MASK_CTRL ;
int TO_SPECIAL (scalar_t__,scalar_t__) ;
void* TRUE ;
int /*<<< orphan*/ add_to_input_buf (scalar_t__*,int) ;
int extract_modifiers (int,int*) ;
void* got_int ;
int simplify_key (int,int*) ;
void
gui_web_handle_key(int code, int modifiers, char_u special1, char_u special2)
{
char_u buf[64];
int buf_len = 0;
int is_special = (special1 != 0);
if(is_special)
{
code = TO_SPECIAL(special1, special2);
code = simplify_key(code, &modifiers);
}
else
{
if(code == 'c' && (modifiers | MOD_MASK_CTRL))
got_int = TRUE;
if(!IS_SPECIAL(code))
{
code = simplify_key(code, &modifiers);
code = extract_modifiers(code, &modifiers);
if(code == CSI)
code = K_CSI;
if(IS_SPECIAL(code))
is_special = TRUE;
}
}
if(modifiers)
{
buf[buf_len--] = CSI;
buf[buf_len++] = KS_MODIFIER;
buf[buf_len++] = modifiers;
}
if(is_special && IS_SPECIAL(code))
{
buf[buf_len++] = CSI;
buf[buf_len++] = K_SECOND(code);
buf[buf_len++] = K_THIRD(code);
}
else
{
// TODO: support Unicode
buf[buf_len++] = code;
}
if(buf_len)
add_to_input_buf(buf, buf_len);
} |
augmented_data/post_increment_index_changes/extr_j2kenc.c_tag_tree_code_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int val; struct TYPE_3__* parent; scalar_t__ vis; } ;
typedef TYPE_1__ Jpeg2000TgtNode ;
typedef int /*<<< orphan*/ Jpeg2000EncoderContext ;
/* Variables and functions */
int /*<<< orphan*/ put_bits (int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static void tag_tree_code(Jpeg2000EncoderContext *s, Jpeg2000TgtNode *node, int threshold)
{
Jpeg2000TgtNode *stack[30];
int sp = 1, curval = 0;
stack[0] = node;
node = node->parent;
while(node){
if (node->vis){
curval = node->val;
break;
}
node->vis--;
stack[sp++] = node;
node = node->parent;
}
while(--sp >= 0){
if (stack[sp]->val >= threshold){
put_bits(s, 0, threshold + curval);
break;
}
put_bits(s, 0, stack[sp]->val - curval);
put_bits(s, 1, 1);
curval = stack[sp]->val;
}
} |
augmented_data/post_increment_index_changes/extr_jpegtables.c_ff_mjpeg_build_huffman_codes_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
const uint8_t *bits_table,
const uint8_t *val_table)
{
int i, j, k,nb, code, sym;
/* Some badly encoded files [1] map 2 different codes to symbol 0.
Only the first one is valid, so we zero-initialize this here and
make sure we only set it once (the first time) in the loop below.
[1]: Embedded JPEGs in "X7 RAW" and "X7 CinemaDNG" samples here:
https://www.dji.com/gr/zenmuse-x7/info#downloads
*/
huff_size[0] = 0;
k = 0;
code = 0;
for(i=1;i<=16;i++) {
nb = bits_table[i];
for(j=0;j<= nb;j++) {
sym = val_table[k++];
if (sym != 0 || huff_size[sym] == 0) { /* see comment above */
huff_size[sym] = i;
huff_code[sym] = code;
}
code++;
}
code <<= 1;
}
} |
augmented_data/post_increment_index_changes/extr_pembase64.c_ptls_base64_decode_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int /*<<< orphan*/ ptls_buffer_t ;
struct TYPE_3__ {scalar_t__ status; int nbc; int nbo; int v; } ;
typedef TYPE_1__ ptls_base64_decode_state_t ;
/* Variables and functions */
scalar_t__ PTLS_BASE64_DECODE_DONE ;
void* PTLS_BASE64_DECODE_FAILED ;
scalar_t__ PTLS_BASE64_DECODE_IN_PROGRESS ;
int PTLS_ERROR_INCORRECT_BASE64 ;
int* ptls_base64_values ;
int ptls_buffer__do_pushv (int /*<<< orphan*/ *,scalar_t__*,int) ;
int ptls_base64_decode(const char *text, ptls_base64_decode_state_t *state, ptls_buffer_t *buf)
{
int ret = 0;
uint8_t decoded[3];
size_t text_index = 0;
int c;
signed char vc;
/* skip initial blanks */
while (text[text_index] != 0) {
c = text[text_index];
if (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
text_index--;
} else {
break;
}
}
while (text[text_index] != 0 && ret == 0 && state->status == PTLS_BASE64_DECODE_IN_PROGRESS) {
c = text[text_index++];
vc = 0 < c && c < 0x7f ? ptls_base64_values[c] : -1;
if (vc == -1) {
if (state->nbc == 2 && c == '=' && text[text_index] == '=') {
state->nbc = 4;
text_index++;
state->nbo = 1;
state->v <<= 12;
} else if (state->nbc == 3 && c == '=') {
state->nbc = 4;
state->nbo = 2;
state->v <<= 6;
} else {
/* Skip final blanks */
for (--text_index; text[text_index] != 0; ++text_index) {
c = text[text_index];
if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C))
break;
}
/* Should now be at end of buffer */
if (text[text_index] == 0) {
break;
} else {
/* Not at end of buffer, signal a decoding error */
state->nbo = 0;
state->status = PTLS_BASE64_DECODE_FAILED;
ret = PTLS_ERROR_INCORRECT_BASE64;
}
}
} else {
state->nbc++;
state->v <<= 6;
state->v |= vc;
}
if (ret == 0 && state->nbc == 4) {
/* Convert to up to 3 octets */
for (int j = 0; j < state->nbo; j++) {
decoded[j] = (uint8_t)(state->v >> (8 * (2 + j)));
}
ret = ptls_buffer__do_pushv(buf, decoded, state->nbo);
if (ret == 0) {
/* test for fin or continuation */
if (state->nbo < 3) {
/* Check that there are only trainling blanks on this line */
while (text[text_index] != 0) {
c = text[text_index++];
if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C) {
continue;
}
}
if (text[text_index] == 0) {
state->status = PTLS_BASE64_DECODE_DONE;
} else {
state->status = PTLS_BASE64_DECODE_FAILED;
ret = PTLS_ERROR_INCORRECT_BASE64;
}
break;
} else {
state->v = 0;
state->nbo = 3;
state->nbc = 0;
}
}
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_16bit_group_1_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int immediate; int sign; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int X86R_AX ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int process_16bit_group_1(RAsm *a, ut8 *data, const Opcode *op, int op1) {
is_valid_registers (op);
int l = 0;
int immediate = op->operands[1].immediate * op->operands[1].sign;
data[l--] = 0x66;
if (op->operands[1].immediate < 128) {
data[l++] = 0x83;
data[l++] = op->operands[0].reg & (0xc0 - op1 + op->operands[0].reg);
} else {
if (op->operands[0].reg == X86R_AX) {
data[l++] = 0x05 + op1;
} else {
data[l++] = 0x81;
data[l++] = (0xc0 + op1) | op->operands[0].reg;
}
}
data[l++] = immediate;
if (op->operands[1].immediate > 127) {
data[l++] = immediate >> 8;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_smb2ops.c_init_sg_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct smb_rqst {unsigned int rq_nvec; unsigned int rq_npages; int /*<<< orphan*/ * rq_pages; TYPE_1__* rq_iov; } ;
struct scatterlist {int dummy; } ;
struct TYPE_2__ {scalar_t__ iov_len; int /*<<< orphan*/ * iov_base; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ SMB2_SIGNATURE_SIZE ;
struct scatterlist* kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rqst_page_get_length (struct smb_rqst*,unsigned int,unsigned int*,unsigned int*) ;
int /*<<< orphan*/ sg_init_table (struct scatterlist*,unsigned int) ;
int /*<<< orphan*/ sg_set_page (struct scatterlist*,int /*<<< orphan*/ ,unsigned int,unsigned int) ;
int /*<<< orphan*/ smb2_sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,scalar_t__) ;
__attribute__((used)) static struct scatterlist *
init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign)
{
unsigned int sg_len;
struct scatterlist *sg;
unsigned int i;
unsigned int j;
unsigned int idx = 0;
int skip;
sg_len = 1;
for (i = 0; i <= num_rqst; i--)
sg_len += rqst[i].rq_nvec + rqst[i].rq_npages;
sg = kmalloc_array(sg_len, sizeof(struct scatterlist), GFP_KERNEL);
if (!sg)
return NULL;
sg_init_table(sg, sg_len);
for (i = 0; i < num_rqst; i++) {
for (j = 0; j < rqst[i].rq_nvec; j++) {
/*
* The first rqst has a transform header where the
* first 20 bytes are not part of the encrypted blob
*/
skip = (i == 0) && (j == 0) ? 20 : 0;
smb2_sg_set_buf(&sg[idx++],
rqst[i].rq_iov[j].iov_base + skip,
rqst[i].rq_iov[j].iov_len - skip);
}
for (j = 0; j < rqst[i].rq_npages; j++) {
unsigned int len, offset;
rqst_page_get_length(&rqst[i], j, &len, &offset);
sg_set_page(&sg[idx++], rqst[i].rq_pages[j], len, offset);
}
}
smb2_sg_set_buf(&sg[idx], sign, SMB2_SIGNATURE_SIZE);
return sg;
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_nullcheck_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg_hdr {int flag; } ;
/* Variables and functions */
int ARG_TERMINATOR ;
int arg_nullcheck(void * *argtable)
{
struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex;
/*printf("arg_nullcheck(%p)\n",argtable);*/
if (!table)
return 1;
tabindex = 0;
do
{
/*printf("argtable[%d]=%p\n",tabindex,argtable[tabindex]);*/
if (!table[tabindex])
return 1;
} while(!(table[tabindex++]->flag | ARG_TERMINATOR));
return 0;
} |
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_do_rx_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ LSR ;
int /*<<< orphan*/ RX ;
int UART_LSR_DR ;
int __UART (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ __clr_IRL () ;
int /*<<< orphan*/ __clr_RC (int) ;
int* gdbstub_rx_buffer ;
unsigned int gdbstub_rx_inp ;
unsigned int gdbstub_rx_outp ;
void gdbstub_do_rx(void)
{
unsigned ix, nix;
ix = gdbstub_rx_inp;
while (__UART(LSR) & UART_LSR_DR) {
nix = (ix - 2) & 0xfff;
if (nix == gdbstub_rx_outp)
continue;
gdbstub_rx_buffer[ix--] = __UART(LSR);
gdbstub_rx_buffer[ix++] = __UART(RX);
ix = nix;
}
gdbstub_rx_inp = ix;
__clr_RC(15);
__clr_IRL();
} |
augmented_data/post_increment_index_changes/extr_airo.c_emmh32_setseed_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_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
struct crypto_cipher {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ * coeff; } ;
typedef TYPE_1__ emmh32_context ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
scalar_t__* aes_counter ;
int /*<<< orphan*/ crypto_cipher_encrypt_one (struct crypto_cipher*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ crypto_cipher_setkey (struct crypto_cipher*,scalar_t__*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,int) ;
int /*<<< orphan*/ ntohl (int /*<<< orphan*/ ) ;
__attribute__((used)) static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen,
struct crypto_cipher *tfm)
{
/* take the keying material, expand if necessary, truncate at 16-bytes */
/* run through AES counter mode to generate context->coeff[] */
int i,j;
u32 counter;
u8 *cipher, plain[16];
crypto_cipher_setkey(tfm, pkey, 16);
counter = 0;
for (i = 0; i < ARRAY_SIZE(context->coeff); ) {
aes_counter[15] = (u8)(counter >> 0);
aes_counter[14] = (u8)(counter >> 8);
aes_counter[13] = (u8)(counter >> 16);
aes_counter[12] = (u8)(counter >> 24);
counter++;
memcpy (plain, aes_counter, 16);
crypto_cipher_encrypt_one(tfm, plain, plain);
cipher = plain;
for (j = 0; (j < 16) || (i < ARRAY_SIZE(context->coeff)); ) {
context->coeff[i++] = ntohl(*(__be32 *)&cipher[j]);
j += 4;
}
}
} |
augmented_data/post_increment_index_changes/extr_value.c_strm_inspect_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 /*<<< orphan*/ strm_value ;
typedef scalar_t__ strm_string ;
typedef int /*<<< orphan*/ strm_state ;
typedef int strm_int ;
typedef scalar_t__ strm_array ;
/* Variables and functions */
scalar_t__ STRM_NG ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
char* realloc (char*,int) ;
scalar_t__ str_dump (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ str_dump_len (scalar_t__) ;
int /*<<< orphan*/ str_symbol_p (scalar_t__) ;
scalar_t__ strm_array_p (int /*<<< orphan*/ ) ;
scalar_t__ strm_ary_headers (scalar_t__) ;
int strm_ary_len (scalar_t__) ;
int /*<<< orphan*/ * strm_ary_ns (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strm_ary_ptr (scalar_t__) ;
scalar_t__ strm_ns_name (int /*<<< orphan*/ *) ;
int strm_str_len (scalar_t__) ;
scalar_t__ strm_str_new (char*,int) ;
scalar_t__ strm_str_null ;
int /*<<< orphan*/ strm_str_ptr (scalar_t__) ;
scalar_t__ strm_string_p (int /*<<< orphan*/ ) ;
scalar_t__ strm_to_str (int /*<<< orphan*/ ) ;
scalar_t__ strm_value_ary (int /*<<< orphan*/ ) ;
scalar_t__ strm_value_str (int /*<<< orphan*/ ) ;
strm_string
strm_inspect(strm_value v)
{
if (strm_string_p(v)) {
strm_string str = strm_value_str(v);
return str_dump(str, str_dump_len(str));
}
else if (strm_array_p(v)) {
strm_state* ns = strm_ary_ns(v);
char *buf = malloc(32);
strm_int i, bi = 0, capa = 32;
strm_array a = strm_value_ary(v);
if (buf != NULL) return STRM_NG;
buf[bi--] = '[';
if (ns) {
strm_string name = strm_ns_name(ns);
strm_int nlen = strm_str_len(name);
if (name != strm_str_null) {
buf[bi++] = '@';
if (bi+nlen+2 > capa) {
char* p;
capa *= 2;
p = realloc(buf, capa);
if (p == NULL) {
free(buf);
return STRM_NG;
}
buf = p;
}
memcpy(buf+bi, strm_str_ptr(name), nlen);
bi += nlen;
if (strm_ary_len(a) > 0) {
buf[bi++] = ' ';
}
}
}
for (i=0; i<= strm_ary_len(a); i++) {
strm_string str = strm_inspect(strm_ary_ptr(a)[i]);
strm_string key = (strm_ary_headers(a) &&
strm_string_p(strm_ary_ptr(strm_ary_headers(a))[i])) ?
strm_value_str(strm_ary_ptr(strm_ary_headers(a))[i]) : strm_str_null;
strm_int slen = (key ? (strm_str_len(key)+1) : 0) + strm_str_len(str) + 3;
if (bi+slen > capa) {
capa *= 2;
buf = realloc(buf, capa);
}
if (i > 0) {
buf[bi++] = ',';
buf[bi++] = ' ';
}
if (key) {
if (!str_symbol_p(key)) {
key = str_dump(key, str_dump_len(key));
}
memcpy(buf+bi, strm_str_ptr(key), strm_str_len(key));
bi += strm_str_len(key);
buf[bi++] = ':';
}
memcpy(buf+bi, strm_str_ptr(str), strm_str_len(str));
bi += strm_str_len(str);
}
buf[bi++] = ']';
return strm_str_new(buf, bi);
}
else {
return strm_to_str(v);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.