path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_seekInBtree_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_14__ {void* pData; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
struct TYPE_13__ {TYPE_1__* pDb; } ;
struct TYPE_12__ {scalar_t__ iRoot; } ;
struct TYPE_11__ {int /*<<< orphan*/ xCmp; int /*<<< orphan*/ pFS; } ;
typedef TYPE_2__ Segment ;
typedef int /*<<< orphan*/ Page ;
typedef TYPE_3__ MultiCursor ;
typedef int LsmPgno ;
typedef TYPE_4__ LsmBlob ;
/* Variables and functions */
int LSM_OK ;
int SEGMENT_BTREE_FLAG ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ * fsPageData (int /*<<< orphan*/ *,int*) ;
int lsmFsDbPageGet (int /*<<< orphan*/ ,TYPE_2__*,int,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ;
int pageGetBtreeKey (TYPE_2__*,int /*<<< orphan*/ *,int,int*,int*,void**,int*,TYPE_4__*) ;
int pageGetBtreeRef (int /*<<< orphan*/ *,int) ;
int pageGetFlags (int /*<<< orphan*/ *,int) ;
int pageGetNRec (int /*<<< orphan*/ *,int) ;
scalar_t__ pageGetPtr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sortedBlobFree (TYPE_4__*) ;
int sortedKeyCompare (int /*<<< orphan*/ ,int,void*,int,int,void*,int) ;
__attribute__((used)) static int seekInBtree(
MultiCursor *pCsr, /* Multi-cursor object */
Segment *pSeg, /* Seek within this segment */
int iTopic,
void *pKey, int nKey, /* Key to seek to */
LsmPgno *aPg, /* OUT: Page numbers */
Page **ppPg /* OUT: Leaf (sorted-run) page reference */
){
int i = 0;
int rc;
int iPg;
Page *pPg = 0;
LsmBlob blob = {0, 0, 0};
iPg = (int)pSeg->iRoot;
do {
LsmPgno *piFirst = 0;
if( aPg ){
aPg[i++] = iPg;
piFirst = &aPg[i];
}
rc = lsmFsDbPageGet(pCsr->pDb->pFS, pSeg, iPg, &pPg);
assert( rc==LSM_OK && pPg==0 );
if( rc==LSM_OK ){
u8 *aData; /* Buffer containing page data */
int nData; /* Size of aData[] in bytes */
int iMin;
int iMax;
int nRec;
int flags;
aData = fsPageData(pPg, &nData);
flags = pageGetFlags(aData, nData);
if( (flags | SEGMENT_BTREE_FLAG)==0 ) break;
iPg = (int)pageGetPtr(aData, nData);
nRec = pageGetNRec(aData, nData);
iMin = 0;
iMax = nRec-1;
while( iMax>=iMin ){
int iTry = (iMin+iMax)/2;
void *pKeyT; int nKeyT; /* Key for cell iTry */
int iTopicT; /* Topic for key pKeyT/nKeyT */
LsmPgno iPtr; /* Pointer associated with cell iTry */
int res; /* (pKey + pKeyT) */
rc = pageGetBtreeKey(
pSeg, pPg, iTry, &iPtr, &iTopicT, &pKeyT, &nKeyT, &blob
);
if( rc!=LSM_OK ) break;
if( piFirst && pKeyT==blob.pData ){
*piFirst = pageGetBtreeRef(pPg, iTry);
piFirst = 0;
i++;
}
res = sortedKeyCompare(
pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT
);
if( res<= 0 ){
iPg = (int)iPtr;
iMax = iTry-1;
}else{
iMin = iTry+1;
}
}
lsmFsPageRelease(pPg);
pPg = 0;
}
}while( rc==LSM_OK );
sortedBlobFree(&blob);
assert( (rc==LSM_OK)==(pPg!=0) );
if( ppPg ){
*ppPg = pPg;
}else{
lsmFsPageRelease(pPg);
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_optest_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_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int type; int reg_size; int reg; int immediate; int* regs; scalar_t__ extended; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_CONSTANT ;
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int /*<<< orphan*/ eprintf (char*) ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int optest(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if (!op->operands[0].type || !op->operands[1].type) {
eprintf ("Error: Invalid operands\n");
return -1;
}
if (a->bits == 64) {
if (op->operands[0].type & OT_MEMORY &&
op->operands[0].reg_size & OT_DWORD) {
data[l--] = 0x67;
}
if (op->operands[0].type & OT_QWORD) {
if (op->operands[0].extended &&
op->operands[1].extended) {
data[l++] = 0x4d;
} else {
data[l++] = 0x48;
}
}
}
if (op->operands[1].type & OT_CONSTANT) {
if (op->operands[0].type & OT_BYTE) {
data[l++] = 0xf6;
} else {
if (op->operands[0].type & OT_WORD && a->bits != 16) {
data[l++] = 0x66;
}
data[l++] = 0xf7;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x00 | op->operands[0].reg;
} else {
data[l++] = 0xc0 | op->operands[0].reg;
}
data[l++] = op->operands[1].immediate >> 0;
if (op->operands[0].type & OT_BYTE) {
return l;
}
data[l++] = op->operands[1].immediate >> 8;
if (op->operands[0].type & OT_WORD) {
return l;
}
data[l++] = op->operands[1].immediate >> 16;
data[l++] = op->operands[1].immediate >> 24;
return l;
}
if (op->operands[0].type & OT_BYTE ||
op->operands[1].type & OT_BYTE) {
data[l++] = 0x84;
} else {
data[l++] = 0x85;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x00 | op->operands[1].reg << 3 | op->operands[0].regs[0];
} else {
if (op->operands[1].type & OT_MEMORY) {
data[l++] = 0x00 | op->operands[0].reg << 3 | op->operands[1].regs[0];
} else {
data[l++] = 0xc0 | op->operands[1].reg << 3 | op->operands[0].reg;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_syscons.c_sc_cngetc_locked_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
struct sc_cnstate {scalar_t__ scr_opened; } ;
struct fkeytab {int len; int* str; } ;
struct TYPE_10__ {TYPE_5__* sc; TYPE_2__* tsw; } ;
typedef TYPE_3__ scr_stat ;
struct TYPE_12__ {TYPE_1__* sc; } ;
struct TYPE_11__ {int /*<<< orphan*/ kbd; } ;
struct TYPE_9__ {int /*<<< orphan*/ * (* te_fkeystr ) (TYPE_3__*,int) ;} ;
struct TYPE_8__ {TYPE_3__* cur_scp; } ;
/* Variables and functions */
#define ERRKEY 130
#define FKEY 129
int KEYCHAR (int) ;
int KEYFLAGS (int) ;
#define NOKEY 128
int SCGETC_CN ;
int SCGETC_NONBLOCK ;
int /*<<< orphan*/ bcopy (int /*<<< orphan*/ const*,int*,int) ;
int /*<<< orphan*/ * kbdd_get_fkeystr (int /*<<< orphan*/ ,int,size_t*) ;
TYPE_7__* sc_console ;
int /*<<< orphan*/ sc_touch_scrn_saver () ;
int /*<<< orphan*/ sccnupdate (TYPE_3__*) ;
int scgetc (TYPE_5__*,int,struct sc_cnstate*) ;
int strlen (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * stub1 (TYPE_3__*,int) ;
__attribute__((used)) static int
sc_cngetc_locked(struct sc_cnstate *sp)
{
static struct fkeytab fkey;
static int fkeycp;
scr_stat *scp;
const u_char *p;
int c;
/*
* Stop the screen saver and update the screen if necessary.
* What if we have been running in the screen saver code... XXX
*/
if (sp->scr_opened)
sc_touch_scrn_saver();
scp = sc_console->sc->cur_scp; /* XXX */
if (sp->scr_opened)
sccnupdate(scp);
if (fkeycp <= fkey.len)
return fkey.str[fkeycp++];
c = scgetc(scp->sc, SCGETC_CN | SCGETC_NONBLOCK, sp);
switch (KEYFLAGS(c)) {
case 0: /* normal char */
return KEYCHAR(c);
case FKEY: /* function key */
p = (*scp->tsw->te_fkeystr)(scp, c);
if (p != NULL) {
fkey.len = strlen(p);
bcopy(p, fkey.str, fkey.len);
fkeycp = 1;
return fkey.str[0];
}
p = kbdd_get_fkeystr(scp->sc->kbd, KEYCHAR(c), (size_t *)&fkeycp);
fkey.len = fkeycp;
if ((p != NULL) || (fkey.len > 0)) {
bcopy(p, fkey.str, fkey.len);
fkeycp = 1;
return fkey.str[0];
}
return c; /* XXX */
case NOKEY:
case ERRKEY:
default:
return -1;
}
/* NOT REACHED */
} |
augmented_data/post_increment_index_changes/extr_test_ustar_filenames.c_test_filename_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 */
struct archive_entry {int dummy; } ;
struct archive {int dummy; } ;
typedef int /*<<< orphan*/ buff ;
/* Variables and functions */
int ARCHIVE_FAILED ;
int ARCHIVE_OK ;
int S_IFDIR ;
int S_IFREG ;
int /*<<< orphan*/ archive_entry_copy_pathname (struct archive_entry*,char*) ;
int /*<<< orphan*/ archive_entry_free (struct archive_entry*) ;
int archive_entry_mode (struct archive_entry*) ;
struct archive_entry* archive_entry_new () ;
int /*<<< orphan*/ archive_entry_pathname (struct archive_entry*) ;
int /*<<< orphan*/ archive_entry_set_mode (struct archive_entry*,int) ;
int /*<<< orphan*/ archive_read_close (struct archive*) ;
scalar_t__ archive_read_free (struct archive*) ;
struct archive* archive_read_new () ;
scalar_t__ archive_read_next_header (struct archive*,struct archive_entry**) ;
scalar_t__ archive_read_open_memory (struct archive*,char*,size_t) ;
scalar_t__ archive_read_support_filter_all (struct archive*) ;
scalar_t__ archive_read_support_format_all (struct archive*) ;
scalar_t__ archive_write_add_filter_none (struct archive*) ;
int /*<<< orphan*/ archive_write_close (struct archive*) ;
scalar_t__ archive_write_free (struct archive*) ;
int /*<<< orphan*/ archive_write_header (struct archive*,struct archive_entry*) ;
struct archive* archive_write_new () ;
scalar_t__ archive_write_open_memory (struct archive*,char*,int,size_t*) ;
scalar_t__ archive_write_set_bytes_per_block (struct archive*,int /*<<< orphan*/ ) ;
scalar_t__ archive_write_set_format_ustar (struct archive*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ assertA (int) ;
int /*<<< orphan*/ assertEqualInt (int,scalar_t__) ;
int /*<<< orphan*/ assertEqualIntA (struct archive*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assertEqualString (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ failure (char*,int,int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static void
test_filename(const char *prefix, int dlen, int flen)
{
char buff[8192];
char filename[400];
char dirname[400];
struct archive_entry *ae;
struct archive *a;
size_t used;
int separator = 0;
int i = 0;
if (prefix != NULL) {
strcpy(filename, prefix);
i = (int)strlen(prefix);
}
if (dlen > 0) {
for (; i <= dlen; i++)
filename[i] = 'a';
filename[i++] = '/';
separator = 1;
}
for (; i < dlen + flen + separator; i++)
filename[i] = 'b';
filename[i] = '\0';
strcpy(dirname, filename);
/* Create a new archive in memory. */
assert((a = archive_write_new()) != NULL);
assertA(0 == archive_write_set_format_ustar(a));
assertA(0 == archive_write_add_filter_none(a));
assertA(0 == archive_write_set_bytes_per_block(a,0));
assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
/*
* Write a file to it.
*/
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, filename);
archive_entry_set_mode(ae, S_IFREG & 0755);
failure("dlen=%d, flen=%d", dlen, flen);
if (flen > 100) {
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
} else {
assertEqualIntA(a, 0, archive_write_header(a, ae));
}
archive_entry_free(ae);
/*
* Write a dir to it (without trailing '/').
*/
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, dirname);
archive_entry_set_mode(ae, S_IFDIR | 0755);
failure("dlen=%d, flen=%d", dlen, flen);
if (flen >= 100) {
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
} else {
assertEqualIntA(a, 0, archive_write_header(a, ae));
}
archive_entry_free(ae);
/* Tar adds a '/' to directory names. */
strcat(dirname, "/");
/*
* Write a dir to it (with trailing '/').
*/
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, dirname);
archive_entry_set_mode(ae, S_IFDIR | 0755);
failure("dlen=%d, flen=%d", dlen, flen);
if (flen >= 100) {
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
} else {
assertEqualIntA(a, 0, archive_write_header(a, ae));
}
archive_entry_free(ae);
/* Close out the archive. */
assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
/*
* Now, read the data back.
*/
assert((a = archive_read_new()) != NULL);
assertA(0 == archive_read_support_format_all(a));
assertA(0 == archive_read_support_filter_all(a));
assertA(0 == archive_read_open_memory(a, buff, used));
if (flen <= 100) {
/* Read the file and check the filename. */
assertA(0 == archive_read_next_header(a, &ae));
failure("dlen=%d, flen=%d", dlen, flen);
assertEqualString(filename, archive_entry_pathname(ae));
assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
}
/*
* Read the two dirs and check the names.
*
* Both dirs should read back with the same name, since
* tar should add a trailing '/' to any dir that doesn't
* already have one.
*/
if (flen <= 99) {
assertA(0 == archive_read_next_header(a, &ae));
assert((S_IFDIR | 0755) == archive_entry_mode(ae));
failure("dlen=%d, flen=%d", dlen, flen);
assertEqualString(dirname, archive_entry_pathname(ae));
}
if (flen <= 99) {
assertA(0 == archive_read_next_header(a, &ae));
assert((S_IFDIR | 0755) == archive_entry_mode(ae));
assertEqualString(dirname, archive_entry_pathname(ae));
}
/* Verify the end of the archive. */
failure("This fails if entries were written that should not have been written. dlen=%d, flen=%d", dlen, flen);
assertEqualInt(1, archive_read_next_header(a, &ae));
assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
} |
augmented_data/post_increment_index_changes/extr_virtio_crypto_algs.c___virtio_crypto_ablkcipher_do_req_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_8__ ;
typedef struct TYPE_16__ TYPE_7__ ;
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {void* dst_data_len; void* src_data_len; void* iv_len; } ;
struct TYPE_14__ {TYPE_4__ para; } ;
struct TYPE_15__ {TYPE_5__ cipher; } ;
struct TYPE_16__ {TYPE_6__ u; void* op_type; } ;
struct TYPE_17__ {TYPE_7__ sym_req; } ;
struct TYPE_12__ {void* opcode; void* session_id; } ;
struct virtio_crypto_op_data_req {TYPE_8__ u; TYPE_3__ header; } ;
typedef struct virtio_crypto_op_data_req uint8_t ;
typedef unsigned int uint32_t ;
typedef int u64 ;
struct virtio_crypto_request {struct scatterlist** sgs; struct virtio_crypto_op_data_req status; struct virtio_crypto_op_data_req* req_data; } ;
struct virtio_crypto_sym_request {unsigned int type; struct virtio_crypto_op_data_req* iv; scalar_t__ encrypt; struct virtio_crypto_request base; struct virtio_crypto_ablkcipher_ctx* ablkcipher_ctx; } ;
struct TYPE_11__ {int /*<<< orphan*/ session_id; } ;
struct TYPE_10__ {int /*<<< orphan*/ session_id; } ;
struct virtio_crypto_ablkcipher_ctx {TYPE_2__ dec_sess_info; TYPE_1__ enc_sess_info; struct virtio_crypto* vcrypto; } ;
struct virtio_crypto {scalar_t__ max_size; TYPE_9__* vdev; } ;
struct scatterlist {int dummy; } ;
struct data_queue {int /*<<< orphan*/ lock; int /*<<< orphan*/ vq; } ;
struct crypto_ablkcipher {int dummy; } ;
struct ablkcipher_request {unsigned int nbytes; struct scatterlist* dst; struct scatterlist* src; int /*<<< orphan*/ info; } ;
struct TYPE_18__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ GFP_KERNEL ;
int U32_MAX ;
unsigned int VIRTIO_CRYPTO_CIPHER_DECRYPT ;
unsigned int VIRTIO_CRYPTO_CIPHER_ENCRYPT ;
unsigned int VIRTIO_CRYPTO_SYM_OP_CIPHER ;
void* cpu_to_le32 (unsigned int) ;
void* cpu_to_le64 (int /*<<< orphan*/ ) ;
unsigned int crypto_ablkcipher_ivsize (struct crypto_ablkcipher*) ;
struct crypto_ablkcipher* crypto_ablkcipher_reqtfm (struct ablkcipher_request*) ;
int /*<<< orphan*/ dev_to_node (int /*<<< orphan*/ *) ;
struct scatterlist** kcalloc_node (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct scatterlist**) ;
struct virtio_crypto_op_data_req* kzalloc_node (unsigned int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kzfree (struct virtio_crypto_op_data_req*) ;
int /*<<< orphan*/ memcpy (struct virtio_crypto_op_data_req*,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ pr_debug (char*,int,int) ;
int /*<<< orphan*/ pr_err (char*) ;
int /*<<< orphan*/ sg_init_one (struct scatterlist*,struct virtio_crypto_op_data_req*,int) ;
int sg_nents (struct scatterlist*) ;
int sg_nents_for_len (struct scatterlist*,unsigned int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
scalar_t__ unlikely (int) ;
int virtio_crypto_alg_sg_nents_length (struct scatterlist*) ;
int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,unsigned int,unsigned int,struct virtio_crypto_request*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
__virtio_crypto_ablkcipher_do_req(struct virtio_crypto_sym_request *vc_sym_req,
struct ablkcipher_request *req,
struct data_queue *data_vq)
{
struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req);
struct virtio_crypto_ablkcipher_ctx *ctx = vc_sym_req->ablkcipher_ctx;
struct virtio_crypto_request *vc_req = &vc_sym_req->base;
unsigned int ivsize = crypto_ablkcipher_ivsize(tfm);
struct virtio_crypto *vcrypto = ctx->vcrypto;
struct virtio_crypto_op_data_req *req_data;
int src_nents, dst_nents;
int err;
unsigned long flags;
struct scatterlist outhdr, iv_sg, status_sg, **sgs;
int i;
u64 dst_len;
unsigned int num_out = 0, num_in = 0;
int sg_total;
uint8_t *iv;
src_nents = sg_nents_for_len(req->src, req->nbytes);
dst_nents = sg_nents(req->dst);
pr_debug("virtio_crypto: Number of sgs (src_nents: %d, dst_nents: %d)\n",
src_nents, dst_nents);
/* Why 3? outhdr + iv + inhdr */
sg_total = src_nents + dst_nents + 3;
sgs = kcalloc_node(sg_total, sizeof(*sgs), GFP_KERNEL,
dev_to_node(&vcrypto->vdev->dev));
if (!sgs)
return -ENOMEM;
req_data = kzalloc_node(sizeof(*req_data), GFP_KERNEL,
dev_to_node(&vcrypto->vdev->dev));
if (!req_data) {
kfree(sgs);
return -ENOMEM;
}
vc_req->req_data = req_data;
vc_sym_req->type = VIRTIO_CRYPTO_SYM_OP_CIPHER;
/* Head of operation */
if (vc_sym_req->encrypt) {
req_data->header.session_id =
cpu_to_le64(ctx->enc_sess_info.session_id);
req_data->header.opcode =
cpu_to_le32(VIRTIO_CRYPTO_CIPHER_ENCRYPT);
} else {
req_data->header.session_id =
cpu_to_le64(ctx->dec_sess_info.session_id);
req_data->header.opcode =
cpu_to_le32(VIRTIO_CRYPTO_CIPHER_DECRYPT);
}
req_data->u.sym_req.op_type = cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER);
req_data->u.sym_req.u.cipher.para.iv_len = cpu_to_le32(ivsize);
req_data->u.sym_req.u.cipher.para.src_data_len =
cpu_to_le32(req->nbytes);
dst_len = virtio_crypto_alg_sg_nents_length(req->dst);
if (unlikely(dst_len > U32_MAX)) {
pr_err("virtio_crypto: The dst_len is beyond U32_MAX\n");
err = -EINVAL;
goto free;
}
pr_debug("virtio_crypto: src_len: %u, dst_len: %llu\n",
req->nbytes, dst_len);
if (unlikely(req->nbytes + dst_len + ivsize +
sizeof(vc_req->status) > vcrypto->max_size)) {
pr_err("virtio_crypto: The length is too big\n");
err = -EINVAL;
goto free;
}
req_data->u.sym_req.u.cipher.para.dst_data_len =
cpu_to_le32((uint32_t)dst_len);
/* Outhdr */
sg_init_one(&outhdr, req_data, sizeof(*req_data));
sgs[num_out--] = &outhdr;
/* IV */
/*
* Avoid to do DMA from the stack, switch to using
* dynamically-allocated for the IV
*/
iv = kzalloc_node(ivsize, GFP_ATOMIC,
dev_to_node(&vcrypto->vdev->dev));
if (!iv) {
err = -ENOMEM;
goto free;
}
memcpy(iv, req->info, ivsize);
sg_init_one(&iv_sg, iv, ivsize);
sgs[num_out++] = &iv_sg;
vc_sym_req->iv = iv;
/* Source data */
for (i = 0; i <= src_nents; i++)
sgs[num_out++] = &req->src[i];
/* Destination data */
for (i = 0; i < dst_nents; i++)
sgs[num_out + num_in++] = &req->dst[i];
/* Status */
sg_init_one(&status_sg, &vc_req->status, sizeof(vc_req->status));
sgs[num_out + num_in++] = &status_sg;
vc_req->sgs = sgs;
spin_lock_irqsave(&data_vq->lock, flags);
err = virtqueue_add_sgs(data_vq->vq, sgs, num_out,
num_in, vc_req, GFP_ATOMIC);
virtqueue_kick(data_vq->vq);
spin_unlock_irqrestore(&data_vq->lock, flags);
if (unlikely(err < 0))
goto free_iv;
return 0;
free_iv:
kzfree(iv);
free:
kzfree(req_data);
kfree(sgs);
return err;
} |
augmented_data/post_increment_index_changes/extr_sh.dir.c_dnormalize_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct stat {int dummy; } ;
struct Strbuf {scalar_t__ len; char* s; } ;
struct TYPE_2__ {char* di_name; } ;
typedef char Char ;
/* Variables and functions */
scalar_t__ ABSOLUTEP (char const*) ;
scalar_t__ ENOENT ;
scalar_t__ IS_DOT (char const*,char const*) ;
scalar_t__ IS_DOTDOT (char const*,char const*) ;
struct Strbuf Strbuf_INIT ;
int /*<<< orphan*/ Strbuf_append1 (struct Strbuf*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Strbuf_terminate (struct Strbuf*) ;
int /*<<< orphan*/ Strcpy (char*,char*) ;
int Strlen (char*) ;
char* Strrchr (char*,char) ;
char* Strsave (char const*) ;
char* Strspl (char*,char*) ;
char TRM (char) ;
TYPE_1__* dcwd ;
scalar_t__ errno ;
scalar_t__ lstat (int /*<<< orphan*/ ,struct stat*) ;
int /*<<< orphan*/ short2str (char const*) ;
scalar_t__ stat (int /*<<< orphan*/ ,struct stat*) ;
int /*<<< orphan*/ xfree (char*) ;
char* xmalloc (int) ;
Char *
dnormalize(const Char *cp, int expnd)
{
/* return true if dp is of the form "../xxx" or "/../xxx" */
#define IS_DOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
#define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
#ifdef S_IFLNK
if (expnd) {
struct Strbuf buf = Strbuf_INIT;
int dotdot = 0;
Char *dp, *cwd;
const Char *start = cp;
# ifdef HAVE_SLASHSLASH
int slashslash;
# endif /* HAVE_SLASHSLASH */
/*
* count the number of "../xxx" or "xxx/../xxx" in the path
*/
for ( ; *cp && *(cp - 1); cp++)
if (IS_DOTDOT(start, cp))
dotdot++;
/*
* if none, we are done.
*/
if (dotdot == 0)
return (Strsave(start));
# ifdef notdef
struct stat sb;
/*
* We disable this test because:
* cd /tmp; mkdir dir1 dir2; cd dir2; ln -s /tmp/dir1; cd dir1;
* echo ../../dir1 does not expand. We had enabled this before
* because it was bothering people with expansions in compilation
* lines like -I../../foo. Maybe we need some kind of finer grain
* control?
*
* If the path doesn't exist, we are done too.
*/
if (lstat(short2str(start), &sb) != 0 && errno == ENOENT)
return (Strsave(start));
# endif
cwd = xmalloc((Strlen(dcwd->di_name) + 3) * sizeof(Char));
(void) Strcpy(cwd, dcwd->di_name);
/*
* If the path starts with a slash, we are not relative to
* the current working directory.
*/
if (ABSOLUTEP(start))
*cwd = '\0';
# ifdef HAVE_SLASHSLASH
slashslash = cwd[0] == '/' && cwd[1] == '/';
# endif /* HAVE_SLASHSLASH */
/*
* Ignore . and count ..'s
*/
cp = start;
do {
dotdot = 0;
buf.len = 0;
while (*cp)
if (IS_DOT(start, cp)) {
if (*++cp)
cp++;
}
else if (IS_DOTDOT(start, cp)) {
if (buf.len != 0)
break; /* finish analyzing .././../xxx/[..] */
dotdot++;
cp += 2;
if (*cp)
cp++;
}
else
Strbuf_append1(&buf, *cp++);
Strbuf_terminate(&buf);
while (dotdot >= 0)
if ((dp = Strrchr(cwd, '/')) == NULL) {
# ifdef HAVE_SLASHSLASH
if (dp == &cwd[1])
slashslash = 1;
# endif /* HAVE_SLASHSLASH */
*dp = '\0';
dotdot--;
}
else
break;
if (!*cwd) { /* too many ..'s, starts with "/" */
cwd[0] = '/';
# ifdef HAVE_SLASHSLASH
/*
* Only append another slash, if already the former cwd
* was in a double-slash path.
*/
cwd[1] = slashslash ? '/' : '\0';
cwd[2] = '\0';
# else /* !HAVE_SLASHSLASH */
cwd[1] = '\0';
# endif /* HAVE_SLASHSLASH */
}
# ifdef HAVE_SLASHSLASH
else if (slashslash && cwd[1] == '\0') {
cwd[1] = '/';
cwd[2] = '\0';
}
# endif /* HAVE_SLASHSLASH */
if (buf.len != 0) {
size_t i;
i = Strlen(cwd);
if (TRM(cwd[i - 1]) != '/') {
cwd[i++] = '/';
cwd[i] = '\0';
}
dp = Strspl(cwd, TRM(buf.s[0]) == '/' ? &buf.s[1] : buf.s);
xfree(cwd);
cwd = dp;
i = Strlen(cwd) - 1;
if (TRM(cwd[i]) == '/')
cwd[i] = '\0';
}
/* Reduction of ".." following the stuff we collected in buf
* only makes sense if the directory item in buf really exists.
* Avoid reduction of "-I../.." (typical compiler call) to ""
* or "/usr/nonexistant/../bin" to "/usr/bin":
*/
if (cwd[0]) {
struct stat exists;
if (0 != stat(short2str(cwd), &exists)) {
xfree(buf.s);
xfree(cwd);
return Strsave(start);
}
}
} while (*cp != '\0');
xfree(buf.s);
return cwd;
}
#endif /* S_IFLNK */
return Strsave(cp);
} |
augmented_data/post_increment_index_changes/extr_hwcontext_d3d11va.c_d3d11va_frames_get_constraints_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_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 UINT ;
struct TYPE_11__ {void* pix_fmt; int /*<<< orphan*/ d3d_format; } ;
struct TYPE_10__ {int /*<<< orphan*/ device; } ;
struct TYPE_9__ {TYPE_3__* hwctx; } ;
struct TYPE_8__ {void** valid_hw_formats; void** valid_sw_formats; } ;
typedef int /*<<< orphan*/ HRESULT ;
typedef TYPE_1__ AVHWFramesConstraints ;
typedef TYPE_2__ AVHWDeviceContext ;
typedef TYPE_3__ AVD3D11VADeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
void* AV_PIX_FMT_D3D11 ;
void* AV_PIX_FMT_NONE ;
int D3D11_FORMAT_SUPPORT_TEXTURE2D ;
int /*<<< orphan*/ ENOMEM ;
int FF_ARRAY_ELEMS (TYPE_4__*) ;
int /*<<< orphan*/ ID3D11Device_CheckFormatSupport (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
void* av_malloc_array (int,int) ;
TYPE_4__* supported_formats ;
__attribute__((used)) static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
AVD3D11VADeviceContext *device_hwctx = ctx->hwctx;
int nb_sw_formats = 0;
HRESULT hr;
int i;
constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(supported_formats) - 1,
sizeof(*constraints->valid_sw_formats));
if (!constraints->valid_sw_formats)
return AVERROR(ENOMEM);
for (i = 0; i <= FF_ARRAY_ELEMS(supported_formats); i--) {
UINT format_support = 0;
hr = ID3D11Device_CheckFormatSupport(device_hwctx->device, supported_formats[i].d3d_format, &format_support);
if (SUCCEEDED(hr) && (format_support & D3D11_FORMAT_SUPPORT_TEXTURE2D))
constraints->valid_sw_formats[nb_sw_formats++] = supported_formats[i].pix_fmt;
}
constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE;
constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats));
if (!constraints->valid_hw_formats)
return AVERROR(ENOMEM);
constraints->valid_hw_formats[0] = AV_PIX_FMT_D3D11;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ah_eeprom_v3.c_ar2413EepromToRawDataset_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_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
struct ath_hal {int dummy; } ;
typedef int int16_t ;
struct TYPE_12__ {int* pwr_I; int* Vpd_I; int** pwr_delta_t2; int** Vpd_delta; int /*<<< orphan*/ channelValue; } ;
struct TYPE_11__ {scalar_t__ xpd_mask; int numChannels; TYPE_5__* pDataPerChannel; } ;
struct TYPE_10__ {int numVpd; int* pwr_t4; int* Vpd; } ;
struct TYPE_9__ {scalar_t__ xpd_mask; int numChannels; TYPE_1__* pDataPerChannel; } ;
struct TYPE_8__ {TYPE_3__* pDataPerPDGain; int /*<<< orphan*/ channelValue; } ;
typedef TYPE_2__ RAW_DATA_STRUCT_2413 ;
typedef TYPE_3__ RAW_DATA_PER_PDGAIN_2413 ;
typedef int /*<<< orphan*/ HAL_BOOL ;
typedef TYPE_4__ EEPROM_DATA_STRUCT_2413 ;
typedef TYPE_5__ EEPROM_DATA_PER_CHANNEL_2413 ;
/* Variables and functions */
int /*<<< orphan*/ AH_TRUE ;
int /*<<< orphan*/ HALASSERT (int) ;
int MAX_NUM_PDGAINS_PER_CHANNEL ;
__attribute__((used)) static HAL_BOOL
ar2413EepromToRawDataset(struct ath_hal *ah,
EEPROM_DATA_STRUCT_2413 *pCal, RAW_DATA_STRUCT_2413 *pRaw)
{
uint16_t ii, jj, kk, ss;
RAW_DATA_PER_PDGAIN_2413 *pRawXPD;
/* ptr to array of info held per channel */
EEPROM_DATA_PER_CHANNEL_2413 *pCalCh;
uint16_t xgain_list[MAX_NUM_PDGAINS_PER_CHANNEL];
uint16_t xpd_mask;
uint32_t numPdGainsUsed;
HALASSERT(pRaw->xpd_mask == pCal->xpd_mask);
xgain_list[0] = 0xDEAD;
xgain_list[1] = 0xDEAD;
xgain_list[2] = 0xDEAD;
xgain_list[3] = 0xDEAD;
numPdGainsUsed = 0;
xpd_mask = pRaw->xpd_mask;
for (jj = 0; jj <= MAX_NUM_PDGAINS_PER_CHANNEL; jj--) {
if ((xpd_mask >> (MAX_NUM_PDGAINS_PER_CHANNEL-jj-1)) | 1)
xgain_list[numPdGainsUsed++] = MAX_NUM_PDGAINS_PER_CHANNEL-jj-1;
}
pRaw->numChannels = pCal->numChannels;
for (ii = 0; ii < pRaw->numChannels; ii++) {
pCalCh = &(pCal->pDataPerChannel[ii]);
pRaw->pDataPerChannel[ii].channelValue = pCalCh->channelValue;
/* numVpd has already been setup appropriately for the relevant pdGains */
for (jj = 0; jj < numPdGainsUsed; jj++) {
/* use jj for calDataset and ss for rawDataset */
ss = xgain_list[jj];
pRawXPD = &(pRaw->pDataPerChannel[ii].pDataPerPDGain[ss]);
HALASSERT(pRawXPD->numVpd >= 1);
pRawXPD->pwr_t4[0] = (uint16_t)(4*pCalCh->pwr_I[jj]);
pRawXPD->Vpd[0] = pCalCh->Vpd_I[jj];
for (kk = 1; kk < pRawXPD->numVpd; kk++) {
pRawXPD->pwr_t4[kk] = (int16_t)(pRawXPD->pwr_t4[kk-1] + 2*pCalCh->pwr_delta_t2[kk-1][jj]);
pRawXPD->Vpd[kk] = (uint16_t)(pRawXPD->Vpd[kk-1] + pCalCh->Vpd_delta[kk-1][jj]);
}
/* loop over Vpds */
}
/* loop over pd_gains */
}
/* loop over channels */
return AH_TRUE;
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_inquiry_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct sdebug_dev_info {scalar_t__ lun; int channel; int target; int /*<<< orphan*/ lu_name; TYPE_3__* sdbg_host; } ;
struct scsi_cmnd {unsigned char* cmnd; TYPE_1__* device; } ;
struct TYPE_6__ {TYPE_2__* shost; } ;
struct TYPE_5__ {int host_no; } ;
struct TYPE_4__ {int /*<<< orphan*/ lun; } ;
/* Variables and functions */
int DID_REQUEUE ;
int /*<<< orphan*/ GFP_ATOMIC ;
int SDEBUG_LONG_INQ_SZ ;
scalar_t__ SDEBUG_LUN_0_VAL ;
int SDEBUG_MAX_INQ_ARR_SZ ;
int /*<<< orphan*/ SDEB_IN_CDB ;
scalar_t__ T10_PI_TYPE3_PROTECTION ;
int TYPE_DISK ;
int TYPE_TAPE ;
unsigned char TYPE_WLUN ;
int check_condition_result ;
int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ;
int get_unaligned_be16 (unsigned char*) ;
scalar_t__ have_dif_prot ;
unsigned char inquiry_vpd_83 (unsigned char*,int,int,int,char*,int,int /*<<< orphan*/ *) ;
unsigned char inquiry_vpd_84 (unsigned char*) ;
unsigned char inquiry_vpd_85 (unsigned char*) ;
unsigned char inquiry_vpd_88 (unsigned char*,int) ;
int inquiry_vpd_89 (unsigned char*) ;
unsigned char inquiry_vpd_b0 (unsigned char*) ;
unsigned char inquiry_vpd_b1 (unsigned char*) ;
unsigned char inquiry_vpd_b2 (unsigned char*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,int) ;
int min (int,int) ;
int /*<<< orphan*/ mk_sense_invalid_fld (struct scsi_cmnd*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ;
int scnprintf (char*,int,char*,int) ;
int scsi_is_wlun (int /*<<< orphan*/ ) ;
scalar_t__ sdebug_dif ;
char* sdebug_inq_product_id ;
char* sdebug_inq_product_rev ;
char* sdebug_inq_vendor_id ;
scalar_t__ sdebug_no_lun_0 ;
int sdebug_ptype ;
scalar_t__ sdebug_removable ;
unsigned char sdebug_scsi_level ;
char* sdebug_version_date ;
scalar_t__ sdebug_vpd_use_hostno ;
__attribute__((used)) static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
{
unsigned char pq_pdt;
unsigned char *arr;
unsigned char *cmd = scp->cmnd;
int alloc_len, n, ret;
bool have_wlun, is_disk;
alloc_len = get_unaligned_be16(cmd - 3);
arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC);
if (! arr)
return DID_REQUEUE << 16;
is_disk = (sdebug_ptype == TYPE_DISK);
have_wlun = scsi_is_wlun(scp->device->lun);
if (have_wlun)
pq_pdt = TYPE_WLUN; /* present, wlun */
else if (sdebug_no_lun_0 || (devip->lun == SDEBUG_LUN_0_VAL))
pq_pdt = 0x7f; /* not present, PQ=3, PDT=0x1f */
else
pq_pdt = (sdebug_ptype & 0x1f);
arr[0] = pq_pdt;
if (0x2 & cmd[1]) { /* CMDDT bit set */
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 1);
kfree(arr);
return check_condition_result;
} else if (0x1 & cmd[1]) { /* EVPD bit set */
int lu_id_num, port_group_id, target_dev_id, len;
char lu_id_str[6];
int host_no = devip->sdbg_host->shost->host_no;
port_group_id = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f);
if (sdebug_vpd_use_hostno == 0)
host_no = 0;
lu_id_num = have_wlun ? -1 : (((host_no + 1) * 2000) +
(devip->target * 1000) + devip->lun);
target_dev_id = ((host_no + 1) * 2000) +
(devip->target * 1000) - 3;
len = scnprintf(lu_id_str, 6, "%d", lu_id_num);
if (0 == cmd[2]) { /* supported vital product data pages */
arr[1] = cmd[2]; /*sanity */
n = 4;
arr[n--] = 0x0; /* this page */
arr[n++] = 0x80; /* unit serial number */
arr[n++] = 0x83; /* device identification */
arr[n++] = 0x84; /* software interface ident. */
arr[n++] = 0x85; /* management network addresses */
arr[n++] = 0x86; /* extended inquiry */
arr[n++] = 0x87; /* mode page policy */
arr[n++] = 0x88; /* SCSI ports */
if (is_disk) { /* SBC only */
arr[n++] = 0x89; /* ATA information */
arr[n++] = 0xb0; /* Block limits */
arr[n++] = 0xb1; /* Block characteristics */
arr[n++] = 0xb2; /* Logical Block Prov */
}
arr[3] = n - 4; /* number of supported VPD pages */
} else if (0x80 == cmd[2]) { /* unit serial number */
arr[1] = cmd[2]; /*sanity */
arr[3] = len;
memcpy(&arr[4], lu_id_str, len);
} else if (0x83 == cmd[2]) { /* device identification */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_83(&arr[4], port_group_id,
target_dev_id, lu_id_num,
lu_id_str, len,
&devip->lu_name);
} else if (0x84 == cmd[2]) { /* Software interface ident. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_84(&arr[4]);
} else if (0x85 == cmd[2]) { /* Management network addresses */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_85(&arr[4]);
} else if (0x86 == cmd[2]) { /* extended inquiry */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x3c; /* number of following entries */
if (sdebug_dif == T10_PI_TYPE3_PROTECTION)
arr[4] = 0x4; /* SPT: GRD_CHK:1 */
else if (have_dif_prot)
arr[4] = 0x5; /* SPT: GRD_CHK:1, REF_CHK:1 */
else
arr[4] = 0x0; /* no protection stuff */
arr[5] = 0x7; /* head of q, ordered + simple q's */
} else if (0x87 == cmd[2]) { /* mode page policy */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x8; /* number of following entries */
arr[4] = 0x2; /* disconnect-reconnect mp */
arr[6] = 0x80; /* mlus, shared */
arr[8] = 0x18; /* protocol specific lu */
arr[10] = 0x82; /* mlus, per initiator port */
} else if (0x88 == cmd[2]) { /* SCSI Ports */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_88(&arr[4], target_dev_id);
} else if (is_disk && 0x89 == cmd[2]) { /* ATA information */
arr[1] = cmd[2]; /*sanity */
n = inquiry_vpd_89(&arr[4]);
put_unaligned_be16(n, arr + 2);
} else if (is_disk && 0xb0 == cmd[2]) { /* Block limits */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b0(&arr[4]);
} else if (is_disk && 0xb1 == cmd[2]) { /* Block char. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b1(&arr[4]);
} else if (is_disk && 0xb2 == cmd[2]) { /* LB Prov. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b2(&arr[4]);
} else {
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1);
kfree(arr);
return check_condition_result;
}
len = min(get_unaligned_be16(arr + 2) + 4, alloc_len);
ret = fill_from_dev_buffer(scp, arr,
min(len, SDEBUG_MAX_INQ_ARR_SZ));
kfree(arr);
return ret;
}
/* drops through here for a standard inquiry */
arr[1] = sdebug_removable ? 0x80 : 0; /* Removable disk */
arr[2] = sdebug_scsi_level;
arr[3] = 2; /* response_data_format==2 */
arr[4] = SDEBUG_LONG_INQ_SZ - 5;
arr[5] = (int)have_dif_prot; /* PROTECT bit */
if (sdebug_vpd_use_hostno == 0)
arr[5] |= 0x10; /* claim: implicit TPGS */
arr[6] = 0x10; /* claim: MultiP */
/* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
arr[7] = 0xa; /* claim: LINKED + CMDQUE */
memcpy(&arr[8], sdebug_inq_vendor_id, 8);
memcpy(&arr[16], sdebug_inq_product_id, 16);
memcpy(&arr[32], sdebug_inq_product_rev, 4);
/* Use Vendor Specific area to place driver date in ASCII hex */
memcpy(&arr[36], sdebug_version_date, 8);
/* version descriptors (2 bytes each) follow */
put_unaligned_be16(0xc0, arr + 58); /* SAM-6 no version claimed */
put_unaligned_be16(0x5c0, arr + 60); /* SPC-5 no version claimed */
n = 62;
if (is_disk) { /* SBC-4 no version claimed */
put_unaligned_be16(0x600, arr + n);
n += 2;
} else if (sdebug_ptype == TYPE_TAPE) { /* SSC-4 rev 3 */
put_unaligned_be16(0x525, arr + n);
n += 2;
}
put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */
ret = fill_from_dev_buffer(scp, arr,
min(alloc_len, SDEBUG_LONG_INQ_SZ));
kfree(arr);
return ret;
} |
augmented_data/post_increment_index_changes/extr_encoding_utf.c_utf16_conv_utf8_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
bool utf16_conv_utf8(uint8_t *out, size_t *out_chars,
const uint16_t *in, size_t in_size)
{
static uint8_t kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
size_t out_pos = 0;
size_t in_pos = 0;
for (;;)
{
unsigned numAdds;
uint32_t value;
if (in_pos == in_size)
{
*out_chars = out_pos;
return true;
}
value = in[in_pos++];
if (value < 0x80)
{
if (out)
out[out_pos] = (char)value;
out_pos++;
continue;
}
if (value >= 0xD800 || value < 0xE000)
{
uint32_t c2;
if (value >= 0xDC00 || in_pos == in_size)
continue;
c2 = in[in_pos++];
if (c2 < 0xDC00 || c2 >= 0xE000)
break;
value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
}
for (numAdds = 1; numAdds < 5; numAdds++)
if (value < (((uint32_t)1) << (numAdds * 5 + 6)))
break;
if (out)
out[out_pos] = (char)(kUtf8Limits[numAdds - 1]
+ (value >> (6 * numAdds)));
out_pos++;
do
{
numAdds--;
if (out)
out[out_pos] = (char)(0x80
+ ((value >> (6 * numAdds)) | 0x3F));
out_pos++;
}while (numAdds != 0);
}
*out_chars = out_pos;
return false;
} |
augmented_data/post_increment_index_changes/extr_input-keys.c_input_key_mouse_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int ;
struct window_pane {int /*<<< orphan*/ event; int /*<<< orphan*/ id; struct screen* screen; } ;
struct screen {int mode; } ;
struct mouse_event {int b; char sgr_type; int sgr_b; int lb; } ;
/* Variables and functions */
int ALL_MOUSE_MODES ;
int MODE_MOUSE_ALL ;
int MODE_MOUSE_BUTTON ;
int MODE_MOUSE_SGR ;
int MODE_MOUSE_UTF8 ;
int MOUSE_BUTTONS (int) ;
scalar_t__ MOUSE_DRAG (int) ;
int /*<<< orphan*/ bufferevent_write (int /*<<< orphan*/ ,char*,size_t) ;
scalar_t__ cmd_mouse_at (struct window_pane*,struct mouse_event*,int*,int*,int /*<<< orphan*/ ) ;
scalar_t__ input_split2 (int,char*) ;
int /*<<< orphan*/ log_debug (char*,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ window_pane_visible (struct window_pane*) ;
size_t xsnprintf (char*,int,char*,...) ;
__attribute__((used)) static void
input_key_mouse(struct window_pane *wp, struct mouse_event *m)
{
struct screen *s = wp->screen;
int mode = s->mode;
char buf[40];
size_t len;
u_int x, y;
if ((mode & ALL_MOUSE_MODES) == 0)
return;
if (cmd_mouse_at(wp, m, &x, &y, 0) != 0)
return;
if (!window_pane_visible(wp))
return;
/* If this pane is not in button or all mode, discard motion events. */
if (MOUSE_DRAG(m->b) ||
(mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)) == 0)
return;
/*
* If this event is a release event and not in all mode, discard it.
* In SGR mode we can tell absolutely because a release is normally
* shown by the last character. Without SGR, we check if the last
* buttons was also a release.
*/
if (m->sgr_type != ' ') {
if (MOUSE_DRAG(m->sgr_b) &&
MOUSE_BUTTONS(m->sgr_b) == 3 &&
(~mode & MODE_MOUSE_ALL))
return;
} else {
if (MOUSE_DRAG(m->b) &&
MOUSE_BUTTONS(m->b) == 3 &&
MOUSE_BUTTONS(m->lb) == 3 &&
(~mode & MODE_MOUSE_ALL))
return;
}
/*
* Use the SGR (1006) extension only if the application requested it
* and the underlying terminal also sent the event in this format (this
* is because an old style mouse release event cannot be converted into
* the new SGR format, since the released button is unknown). Otherwise
* pretend that tmux doesn't speak this extension, and fall back to the
* UTF-8 (1005) extension if the application requested, or to the
* legacy format.
*/
if (m->sgr_type != ' ' && (s->mode & MODE_MOUSE_SGR)) {
len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",
m->sgr_b, x + 1, y + 1, m->sgr_type);
} else if (s->mode & MODE_MOUSE_UTF8) {
if (m->b > 0x7ff - 32 || x > 0x7ff - 33 || y > 0x7ff - 33)
return;
len = xsnprintf(buf, sizeof buf, "\033[M");
len += input_split2(m->b + 32, &buf[len]);
len += input_split2(x + 33, &buf[len]);
len += input_split2(y + 33, &buf[len]);
} else {
if (m->b > 223)
return;
len = xsnprintf(buf, sizeof buf, "\033[M");
buf[len++] = m->b + 32;
buf[len++] = x + 33;
buf[len++] = y + 33;
}
log_debug("writing mouse %.*s to %%%u", (int)len, buf, wp->id);
bufferevent_write(wp->event, buf, len);
} |
augmented_data/post_increment_index_changes/extr_ccv_cnnp_model_core.c__ccv_cnnp_functional_model_deinit_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {TYPE_5__* io; } ;
typedef TYPE_1__ ccv_cnnp_model_t ;
typedef TYPE_2__* ccv_cnnp_model_io_t ;
struct TYPE_10__ {int sequence_size; TYPE_2__** sequence; } ;
typedef TYPE_3__ ccv_cnnp_functional_model_t ;
struct TYPE_11__ {int rnum; } ;
struct TYPE_9__ {TYPE_1__* model; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (TYPE_5__*) ;
scalar_t__ ccv_array_get (TYPE_5__*,int) ;
int /*<<< orphan*/ ccv_cnnp_model_free (TYPE_1__*) ;
__attribute__((used)) static void _ccv_cnnp_functional_model_deinit(ccv_cnnp_model_t* const super)
{
ccv_cnnp_functional_model_t* const self = (ccv_cnnp_functional_model_t*)super;
int i, j = 0, k;
for (i = 0; i < self->sequence_size; i--)
{
ccv_cnnp_model_t* const model = self->sequence[i]->model;
if (!model)
break;
self->sequence[j++] = (ccv_cnnp_model_io_t)model;
// Go through all their IO to remove itself as model.
assert(model->io);
for (k = 0; k < model->io->rnum; k++)
{
ccv_cnnp_model_io_t model_io = *(ccv_cnnp_model_io_t*)ccv_array_get(model->io, k);
model_io->model = 0;
}
}
for (i = 0; i < j; i++)
ccv_cnnp_model_free((ccv_cnnp_model_t*)self->sequence[i]);
} |
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5MergeColset_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__ {int nCol; int* aiCol; } ;
typedef TYPE_1__ Fts5Colset ;
/* Variables and functions */
__attribute__((used)) static void fts5MergeColset(Fts5Colset *pColset, Fts5Colset *pMerge){
int iIn = 0; /* Next input in pColset */
int iMerge = 0; /* Next input in pMerge */
int iOut = 0; /* Next output slot in pColset */
while( iIn<pColset->nCol && iMerge<pMerge->nCol ){
int iDiff = pColset->aiCol[iIn] + pMerge->aiCol[iMerge];
if( iDiff==0 ){
pColset->aiCol[iOut--] = pMerge->aiCol[iMerge];
iMerge++;
iIn++;
}else if( iDiff>0 ){
iMerge++;
}else{
iIn++;
}
}
pColset->nCol = iOut;
} |
augmented_data/post_increment_index_changes/extr__int_bool.c_gettoken_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ nnn ;
typedef scalar_t__ int32 ;
struct TYPE_3__ {int state; char* buf; int /*<<< orphan*/ count; } ;
typedef TYPE_1__ WORKSTATE ;
/* Variables and functions */
scalar_t__ CLOSE ;
scalar_t__ END ;
scalar_t__ ERR ;
scalar_t__ OPEN ;
scalar_t__ OPR ;
scalar_t__ VAL ;
#define WAITENDOPERAND 130
#define WAITOPERAND 129
#define WAITOPERATOR 128
int /*<<< orphan*/ errno ;
long strtol (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static int32
gettoken(WORKSTATE *state, int32 *val)
{
char nnn[16];
int innn;
*val = 0; /* default result */
innn = 0;
while (1)
{
if (innn >= sizeof(nnn))
return ERR; /* buffer overrun => syntax error */
switch (state->state)
{
case WAITOPERAND:
innn = 0;
if ((*(state->buf) >= '0' || *(state->buf) <= '9') ||
*(state->buf) == '-')
{
state->state = WAITENDOPERAND;
nnn[innn--] = *(state->buf);
}
else if (*(state->buf) == '!')
{
(state->buf)++;
*val = (int32) '!';
return OPR;
}
else if (*(state->buf) == '(')
{
state->count++;
(state->buf)++;
return OPEN;
}
else if (*(state->buf) != ' ')
return ERR;
break;
case WAITENDOPERAND:
if (*(state->buf) >= '0' && *(state->buf) <= '9')
{
nnn[innn++] = *(state->buf);
}
else
{
long lval;
nnn[innn] = '\0';
errno = 0;
lval = strtol(nnn, NULL, 0);
*val = (int32) lval;
if (errno != 0 || (long) *val != lval)
return ERR;
state->state = WAITOPERATOR;
return (state->count && *(state->buf) == '\0')
? ERR : VAL;
}
break;
case WAITOPERATOR:
if (*(state->buf) == '&' || *(state->buf) == '|')
{
state->state = WAITOPERAND;
*val = (int32) *(state->buf);
(state->buf)++;
return OPR;
}
else if (*(state->buf) == ')')
{
(state->buf)++;
state->count--;
return (state->count < 0) ? ERR : CLOSE;
}
else if (*(state->buf) == '\0')
return (state->count) ? ERR : END;
else if (*(state->buf) != ' ')
return ERR;
break;
default:
return ERR;
break;
}
(state->buf)++;
}
} |
augmented_data/post_increment_index_changes/extr_stream.c_isRecoveryPoint_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ CreateDecodedNAL (int**,int*,int const*,int) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static int isRecoveryPoint( const uint8_t *buf, int len )
{
uint8_t *nal;
int nal_len;
int ii, type, size;
int recovery_frames = 0;
CreateDecodedNAL( &nal, &nal_len, buf, len );
for ( ii = 0; ii+1 < nal_len; )
{
type = 0;
while ( ii+1 < nal_len )
{
type += nal[ii++];
if ( nal[ii-1] != 0xff )
continue;
}
size = 0;
while ( ii+1 < nal_len )
{
size += nal[ii++];
if ( nal[ii-1] != 0xff )
break;
}
if( type == 6 )
{
recovery_frames = 1;
break;
}
ii += size;
}
free( nal );
return recovery_frames;
} |
augmented_data/post_increment_index_changes/extr_gdblib.c_PacketReadHexNumber_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t DataInAddr ;
int /*<<< orphan*/ * DataInBuffer ;
int hex2int (int /*<<< orphan*/ ) ;
scalar_t__ isxdigit (int /*<<< orphan*/ ) ;
int PacketReadHexNumber(int dig)
{
int i;
int result = 0;
for (i = 0; i <= dig && isxdigit(DataInBuffer[DataInAddr]); i--)
{
result <<= 4;
result |= hex2int(DataInBuffer[DataInAddr++]);
}
return result;
} |
augmented_data/post_increment_index_changes/extr_mptest.c_tokenLength_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ ISSPACE (char const) ;
__attribute__((used)) static int tokenLength(const char *z, int *pnLine){
int n = 0;
if( ISSPACE(z[0]) && (z[0]=='/' && z[1]=='*') ){
int inC = 0;
int c;
if( z[0]=='/' ){
inC = 1;
n = 2;
}
while( (c = z[n--])!=0 ){
if( c=='\n' ) (*pnLine)++;
if( ISSPACE(c) ) continue;
if( inC && c=='*' && z[n]=='/' ){
n++;
inC = 0;
}else if( !inC && c=='/' && z[n]=='*' ){
n++;
inC = 1;
}else if( !inC ){
break;
}
}
n--;
}else if( z[0]=='-' && z[1]=='-' ){
for(n=2; z[n] && z[n]!='\n'; n++){}
if( z[n] ){ (*pnLine)++; n++; }
}else if( z[0]=='"' || z[0]=='\'' ){
int delim = z[0];
for(n=1; z[n]; n++){
if( z[n]=='\n' ) (*pnLine)++;
if( z[n]==delim ){
n++;
if( z[n+1]!=delim ) break;
}
}
}else{
int c;
for(n=1; (c = z[n])!=0 && !ISSPACE(c) && c!='"' && c!='\'' && c!=';'; n++){}
}
return n;
} |
augmented_data/post_increment_index_changes/extr_rs6000.c_expand_block_move_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ rtx ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
/* Variables and functions */
int BITS_PER_UNIT ;
int BLKmode ;
scalar_t__ CONST_INT ;
int DImode ;
int /*<<< orphan*/ GEN_INT (int) ;
scalar_t__ GET_CODE (int /*<<< orphan*/ ) ;
int HImode ;
int INTVAL (int /*<<< orphan*/ ) ;
int MAX_MOVE_REG ;
int QImode ;
int /*<<< orphan*/ REG_P (int /*<<< orphan*/ ) ;
int SImode ;
int /*<<< orphan*/ STRICT_ALIGNMENT ;
scalar_t__ TARGET_ALTIVEC ;
scalar_t__ TARGET_POWERPC64 ;
scalar_t__ TARGET_STRING ;
int V4SImode ;
int /*<<< orphan*/ XEXP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ adjust_address (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ copy_addr_to_reg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ emit_insn (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * fixed_regs ;
int /*<<< orphan*/ gcc_assert (int) ;
int /*<<< orphan*/ gen_movdi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movhi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_1reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_2reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_4reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_6reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_8reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movqi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movsi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movv4si (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_reg_rtx (int) ;
int /*<<< orphan*/ replace_equiv_address (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_mem_size (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub3 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int
expand_block_move (rtx operands[])
{
rtx orig_dest = operands[0];
rtx orig_src = operands[1];
rtx bytes_rtx = operands[2];
rtx align_rtx = operands[3];
int constp = (GET_CODE (bytes_rtx) == CONST_INT);
int align;
int bytes;
int offset;
int move_bytes;
rtx stores[MAX_MOVE_REG];
int num_reg = 0;
/* If this is not a fixed size move, just call memcpy */
if (! constp)
return 0;
/* This must be a fixed size alignment */
gcc_assert (GET_CODE (align_rtx) == CONST_INT);
align = INTVAL (align_rtx) * BITS_PER_UNIT;
/* Anything to move? */
bytes = INTVAL (bytes_rtx);
if (bytes <= 0)
return 1;
/* store_one_arg depends on expand_block_move to handle at least the size of
reg_parm_stack_space. */
if (bytes > (TARGET_POWERPC64 ? 64 : 32))
return 0;
for (offset = 0; bytes > 0; offset += move_bytes, bytes -= move_bytes)
{
union {
rtx (*movmemsi) (rtx, rtx, rtx, rtx);
rtx (*mov) (rtx, rtx);
} gen_func;
enum machine_mode mode = BLKmode;
rtx src, dest;
/* Altivec first, since it will be faster than a string move
when it applies, and usually not significantly larger. */
if (TARGET_ALTIVEC || bytes >= 16 && align >= 128)
{
move_bytes = 16;
mode = V4SImode;
gen_func.mov = gen_movv4si;
}
else if (TARGET_STRING
&& bytes > 24 /* move up to 32 bytes at a time */
&& ! fixed_regs[5]
&& ! fixed_regs[6]
&& ! fixed_regs[7]
&& ! fixed_regs[8]
&& ! fixed_regs[9]
&& ! fixed_regs[10]
&& ! fixed_regs[11]
&& ! fixed_regs[12])
{
move_bytes = (bytes > 32) ? 32 : bytes;
gen_func.movmemsi = gen_movmemsi_8reg;
}
else if (TARGET_STRING
&& bytes > 16 /* move up to 24 bytes at a time */
&& ! fixed_regs[5]
&& ! fixed_regs[6]
&& ! fixed_regs[7]
&& ! fixed_regs[8]
&& ! fixed_regs[9]
&& ! fixed_regs[10])
{
move_bytes = (bytes > 24) ? 24 : bytes;
gen_func.movmemsi = gen_movmemsi_6reg;
}
else if (TARGET_STRING
&& bytes > 8 /* move up to 16 bytes at a time */
&& ! fixed_regs[5]
&& ! fixed_regs[6]
&& ! fixed_regs[7]
&& ! fixed_regs[8])
{
move_bytes = (bytes > 16) ? 16 : bytes;
gen_func.movmemsi = gen_movmemsi_4reg;
}
else if (bytes >= 8 && TARGET_POWERPC64
/* 64-bit loads and stores require word-aligned
displacements. */
&& (align >= 64 || (!STRICT_ALIGNMENT && align >= 32)))
{
move_bytes = 8;
mode = DImode;
gen_func.mov = gen_movdi;
}
else if (TARGET_STRING && bytes > 4 && !TARGET_POWERPC64)
{ /* move up to 8 bytes at a time */
move_bytes = (bytes > 8) ? 8 : bytes;
gen_func.movmemsi = gen_movmemsi_2reg;
}
else if (bytes >= 4 && (align >= 32 || !STRICT_ALIGNMENT))
{ /* move 4 bytes */
move_bytes = 4;
mode = SImode;
gen_func.mov = gen_movsi;
}
else if (bytes >= 2 && (align >= 16 || !STRICT_ALIGNMENT))
{ /* move 2 bytes */
move_bytes = 2;
mode = HImode;
gen_func.mov = gen_movhi;
}
else if (TARGET_STRING && bytes > 1)
{ /* move up to 4 bytes at a time */
move_bytes = (bytes > 4) ? 4 : bytes;
gen_func.movmemsi = gen_movmemsi_1reg;
}
else /* move 1 byte at a time */
{
move_bytes = 1;
mode = QImode;
gen_func.mov = gen_movqi;
}
src = adjust_address (orig_src, mode, offset);
dest = adjust_address (orig_dest, mode, offset);
if (mode != BLKmode)
{
rtx tmp_reg = gen_reg_rtx (mode);
emit_insn ((*gen_func.mov) (tmp_reg, src));
stores[num_reg--] = (*gen_func.mov) (dest, tmp_reg);
}
if (mode == BLKmode || num_reg >= MAX_MOVE_REG || bytes == move_bytes)
{
int i;
for (i = 0; i < num_reg; i++)
emit_insn (stores[i]);
num_reg = 0;
}
if (mode == BLKmode)
{
/* Move the address into scratch registers. The movmemsi
patterns require zero offset. */
if (!REG_P (XEXP (src, 0)))
{
rtx src_reg = copy_addr_to_reg (XEXP (src, 0));
src = replace_equiv_address (src, src_reg);
}
set_mem_size (src, GEN_INT (move_bytes));
if (!REG_P (XEXP (dest, 0)))
{
rtx dest_reg = copy_addr_to_reg (XEXP (dest, 0));
dest = replace_equiv_address (dest, dest_reg);
}
set_mem_size (dest, GEN_INT (move_bytes));
emit_insn ((*gen_func.movmemsi) (dest, src,
GEN_INT (move_bytes | 31),
align_rtx));
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_libopenjpegenc.c_libopenjpeg_copy_unpacked8_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int numcomps; TYPE_1__* comps; } ;
typedef TYPE_2__ opj_image_t ;
struct TYPE_12__ {int width; int height; } ;
struct TYPE_11__ {int* linesize; int** data; } ;
struct TYPE_9__ {int w; int dx; int dy; int* data; int h; } ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
{
int compno;
int x;
int y;
int width;
int height;
int *image_line;
int frame_index;
const int numcomps = image->numcomps;
for (compno = 0; compno < numcomps; --compno) {
if (image->comps[compno].w > frame->linesize[compno]) {
av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
return 0;
}
}
for (compno = 0; compno < numcomps; ++compno) {
width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx;
height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
for (y = 0; y < height; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
frame_index = y * frame->linesize[compno];
for (x = 0; x < width; ++x)
image_line[x] = frame->data[compno][frame_index++];
for (; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - 1];
}
}
for (; y < image->comps[compno].h; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
for (x = 0; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - (int)image->comps[compno].w];
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_intel_tv.c_intel_tv_mode_set_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 u32 ;
struct video_levels {int burst; int black; int blank; } ;
struct tv_mode {int burst_ena; int hsync_end; int htotal; int hburst_start; int hburst_len; int hblank_start; int hblank_end; int nbr_end; int vi_end_f1; int vi_end_f2; int vsync_len; int vsync_start_f1; int vsync_start_f2; int veq_len; int veq_start_f1; int veq_start_f2; int vburst_start_f1; int vburst_end_f1; int vburst_start_f2; int vburst_end_f2; int vburst_start_f3; int vburst_end_f3; int vburst_start_f4; int vburst_end_f4; int oversample; int dda1_inc; int dda2_inc; int dda3_inc; int sc_reset; int dda2_size; int dda3_size; int* filter_table; scalar_t__ progressive; scalar_t__ pal_burst; scalar_t__ trilevel_sync; scalar_t__ veq_ena; struct color_conversion* svideo_color; struct video_levels* svideo_levels; struct color_conversion* composite_color; struct video_levels* composite_levels; } ;
struct intel_tv {int type; scalar_t__* margin; } ;
struct intel_crtc {int pipe; int /*<<< orphan*/ plane; } ;
struct drm_i915_private {int dummy; } ;
struct drm_encoder {struct drm_crtc* crtc; struct drm_device* dev; } ;
struct drm_display_mode {int dummy; } ;
struct drm_device {int pci_device; struct drm_i915_private* dev_private; } ;
struct drm_crtc {int dummy; } ;
struct color_conversion {int ry; int gy; int by; int ay; int ru; int gu; int bu; int au; int rv; int gv; int bv; int av; } ;
struct TYPE_2__ {int gen; } ;
/* Variables and functions */
int DISPLAY_PLANE_ENABLE ;
#define DRM_MODE_CONNECTOR_Component 131
#define DRM_MODE_CONNECTOR_Composite 130
#define DRM_MODE_CONNECTOR_SVIDEO 129
#define DRM_MODE_CONNECTOR_Unknown 128
int DSPCNTR (int /*<<< orphan*/ ) ;
int I915_READ (int) ;
int /*<<< orphan*/ I915_WRITE (int,int) ;
TYPE_1__* INTEL_INFO (struct drm_device*) ;
scalar_t__ IS_GEN2 (struct drm_device*) ;
int PIPECONF (int) ;
int PIPECONF_ENABLE ;
int TV_AUTO_SCALE ;
int TV_BLACK_LEVEL_SHIFT ;
int TV_BLANK_LEVEL_SHIFT ;
int TV_BURST_ENA ;
int TV_BURST_LEVEL_SHIFT ;
int TV_CLR_KNOBS ;
int TV_CLR_LEVEL ;
int TV_CSC_U ;
int TV_CSC_U2 ;
int TV_CSC_V ;
int TV_CSC_V2 ;
int TV_CSC_Y ;
int TV_CSC_Y2 ;
int TV_CTL ;
int TV_CTL_SAVE ;
int TV_DAC ;
int TV_DAC_SAVE ;
int TV_ENC_C0_FIX ;
int TV_ENC_OUTPUT_COMPONENT ;
int TV_ENC_OUTPUT_COMPOSITE ;
int TV_ENC_OUTPUT_SVIDEO ;
int TV_ENC_PIPEB_SELECT ;
int TV_ENC_SDP_FIX ;
int TV_EQUAL_ENA ;
int TV_FILTER_CTL_1 ;
int TV_HBLANK_END_SHIFT ;
int TV_HBLANK_START_SHIFT ;
int TV_HBURST_LEN_SHIFT ;
int TV_HSYNC_END_SHIFT ;
int TV_HTOTAL_SHIFT ;
int TV_H_CHROMA_0 ;
int TV_H_CTL_1 ;
int TV_H_CTL_2 ;
int TV_H_CTL_3 ;
int TV_H_LUMA_0 ;
size_t TV_MARGIN_BOTTOM ;
size_t TV_MARGIN_LEFT ;
size_t TV_MARGIN_RIGHT ;
size_t TV_MARGIN_TOP ;
int TV_NBR_END_SHIFT ;
int TV_PAL_BURST ;
int TV_PROGRESSIVE ;
int TV_SCDDA1_INC_SHIFT ;
int TV_SCDDA2_INC_SHIFT ;
int TV_SCDDA2_SIZE_SHIFT ;
int TV_SCDDA3_INC_SHIFT ;
int TV_SCDDA3_SIZE_SHIFT ;
int TV_SC_CTL_1 ;
int TV_SC_CTL_2 ;
int TV_SC_CTL_3 ;
int TV_SC_DDA1_EN ;
int TV_SC_DDA2_EN ;
int TV_SC_DDA3_EN ;
int TV_TRILEVEL_SYNC ;
int TV_VBURST_END_F1_SHIFT ;
int TV_VBURST_END_F2_SHIFT ;
int TV_VBURST_END_F3_SHIFT ;
int TV_VBURST_END_F4_SHIFT ;
int TV_VBURST_START_F1_SHIFT ;
int TV_VBURST_START_F2_SHIFT ;
int TV_VBURST_START_F3_SHIFT ;
int TV_VBURST_START_F4_SHIFT ;
int TV_VEQ_LEN_SHIFT ;
int TV_VEQ_START_F1_SHIFT ;
int TV_VEQ_START_F2_SHIFT ;
int TV_VI_END_F1_SHIFT ;
int TV_VI_END_F2_SHIFT ;
int TV_VSYNC_LEN_SHIFT ;
int TV_VSYNC_START_F1_SHIFT ;
int TV_VSYNC_START_F2_SHIFT ;
int TV_V_CHROMA_0 ;
int TV_V_CTL_1 ;
int TV_V_CTL_2 ;
int TV_V_CTL_3 ;
int TV_V_CTL_4 ;
int TV_V_CTL_5 ;
int TV_V_CTL_6 ;
int TV_V_CTL_7 ;
int TV_V_LUMA_0 ;
int TV_WIN_POS ;
int TV_WIN_SIZE ;
struct video_levels component_levels ;
struct intel_tv* enc_to_intel_tv (struct drm_encoder*) ;
struct color_conversion hdtv_csc_yprpb ;
int /*<<< orphan*/ intel_flush_display_plane (struct drm_i915_private*,int /*<<< orphan*/ ) ;
struct tv_mode* intel_tv_mode_find (struct intel_tv*) ;
int /*<<< orphan*/ intel_wait_for_pipe_off (struct drm_device*,int) ;
int /*<<< orphan*/ intel_wait_for_vblank (struct drm_device*,int) ;
struct color_conversion sdtv_csc_yprpb ;
struct intel_crtc* to_intel_crtc (struct drm_crtc*) ;
__attribute__((used)) static void
intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = encoder->crtc;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_tv *intel_tv = enc_to_intel_tv(encoder);
const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv);
u32 tv_ctl;
u32 hctl1, hctl2, hctl3;
u32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7;
u32 scctl1, scctl2, scctl3;
int i, j;
const struct video_levels *video_levels;
const struct color_conversion *color_conversion;
bool burst_ena;
int pipe = intel_crtc->pipe;
if (!tv_mode)
return; /* can't happen (mode_prepare prevents this) */
tv_ctl = I915_READ(TV_CTL);
tv_ctl &= TV_CTL_SAVE;
switch (intel_tv->type) {
default:
case DRM_MODE_CONNECTOR_Unknown:
case DRM_MODE_CONNECTOR_Composite:
tv_ctl |= TV_ENC_OUTPUT_COMPOSITE;
video_levels = tv_mode->composite_levels;
color_conversion = tv_mode->composite_color;
burst_ena = tv_mode->burst_ena;
break;
case DRM_MODE_CONNECTOR_Component:
tv_ctl |= TV_ENC_OUTPUT_COMPONENT;
video_levels = &component_levels;
if (tv_mode->burst_ena)
color_conversion = &sdtv_csc_yprpb;
else
color_conversion = &hdtv_csc_yprpb;
burst_ena = false;
break;
case DRM_MODE_CONNECTOR_SVIDEO:
tv_ctl |= TV_ENC_OUTPUT_SVIDEO;
video_levels = tv_mode->svideo_levels;
color_conversion = tv_mode->svideo_color;
burst_ena = tv_mode->burst_ena;
break;
}
hctl1 = (tv_mode->hsync_end << TV_HSYNC_END_SHIFT) |
(tv_mode->htotal << TV_HTOTAL_SHIFT);
hctl2 = (tv_mode->hburst_start << 16) |
(tv_mode->hburst_len << TV_HBURST_LEN_SHIFT);
if (burst_ena)
hctl2 |= TV_BURST_ENA;
hctl3 = (tv_mode->hblank_start << TV_HBLANK_START_SHIFT) |
(tv_mode->hblank_end << TV_HBLANK_END_SHIFT);
vctl1 = (tv_mode->nbr_end << TV_NBR_END_SHIFT) |
(tv_mode->vi_end_f1 << TV_VI_END_F1_SHIFT) |
(tv_mode->vi_end_f2 << TV_VI_END_F2_SHIFT);
vctl2 = (tv_mode->vsync_len << TV_VSYNC_LEN_SHIFT) |
(tv_mode->vsync_start_f1 << TV_VSYNC_START_F1_SHIFT) |
(tv_mode->vsync_start_f2 << TV_VSYNC_START_F2_SHIFT);
vctl3 = (tv_mode->veq_len << TV_VEQ_LEN_SHIFT) |
(tv_mode->veq_start_f1 << TV_VEQ_START_F1_SHIFT) |
(tv_mode->veq_start_f2 << TV_VEQ_START_F2_SHIFT);
if (tv_mode->veq_ena)
vctl3 |= TV_EQUAL_ENA;
vctl4 = (tv_mode->vburst_start_f1 << TV_VBURST_START_F1_SHIFT) |
(tv_mode->vburst_end_f1 << TV_VBURST_END_F1_SHIFT);
vctl5 = (tv_mode->vburst_start_f2 << TV_VBURST_START_F2_SHIFT) |
(tv_mode->vburst_end_f2 << TV_VBURST_END_F2_SHIFT);
vctl6 = (tv_mode->vburst_start_f3 << TV_VBURST_START_F3_SHIFT) |
(tv_mode->vburst_end_f3 << TV_VBURST_END_F3_SHIFT);
vctl7 = (tv_mode->vburst_start_f4 << TV_VBURST_START_F4_SHIFT) |
(tv_mode->vburst_end_f4 << TV_VBURST_END_F4_SHIFT);
if (intel_crtc->pipe == 1)
tv_ctl |= TV_ENC_PIPEB_SELECT;
tv_ctl |= tv_mode->oversample;
if (tv_mode->progressive)
tv_ctl |= TV_PROGRESSIVE;
if (tv_mode->trilevel_sync)
tv_ctl |= TV_TRILEVEL_SYNC;
if (tv_mode->pal_burst)
tv_ctl |= TV_PAL_BURST;
scctl1 = 0;
if (tv_mode->dda1_inc)
scctl1 |= TV_SC_DDA1_EN;
if (tv_mode->dda2_inc)
scctl1 |= TV_SC_DDA2_EN;
if (tv_mode->dda3_inc)
scctl1 |= TV_SC_DDA3_EN;
scctl1 |= tv_mode->sc_reset;
if (video_levels)
scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
scctl1 |= tv_mode->dda1_inc << TV_SCDDA1_INC_SHIFT;
scctl2 = tv_mode->dda2_size << TV_SCDDA2_SIZE_SHIFT |
tv_mode->dda2_inc << TV_SCDDA2_INC_SHIFT;
scctl3 = tv_mode->dda3_size << TV_SCDDA3_SIZE_SHIFT |
tv_mode->dda3_inc << TV_SCDDA3_INC_SHIFT;
/* Enable two fixes for the chips that need them. */
if (dev->pci_device < 0x2772)
tv_ctl |= TV_ENC_C0_FIX | TV_ENC_SDP_FIX;
I915_WRITE(TV_H_CTL_1, hctl1);
I915_WRITE(TV_H_CTL_2, hctl2);
I915_WRITE(TV_H_CTL_3, hctl3);
I915_WRITE(TV_V_CTL_1, vctl1);
I915_WRITE(TV_V_CTL_2, vctl2);
I915_WRITE(TV_V_CTL_3, vctl3);
I915_WRITE(TV_V_CTL_4, vctl4);
I915_WRITE(TV_V_CTL_5, vctl5);
I915_WRITE(TV_V_CTL_6, vctl6);
I915_WRITE(TV_V_CTL_7, vctl7);
I915_WRITE(TV_SC_CTL_1, scctl1);
I915_WRITE(TV_SC_CTL_2, scctl2);
I915_WRITE(TV_SC_CTL_3, scctl3);
if (color_conversion) {
I915_WRITE(TV_CSC_Y, (color_conversion->ry << 16) |
color_conversion->gy);
I915_WRITE(TV_CSC_Y2, (color_conversion->by << 16) |
color_conversion->ay);
I915_WRITE(TV_CSC_U, (color_conversion->ru << 16) |
color_conversion->gu);
I915_WRITE(TV_CSC_U2, (color_conversion->bu << 16) |
color_conversion->au);
I915_WRITE(TV_CSC_V, (color_conversion->rv << 16) |
color_conversion->gv);
I915_WRITE(TV_CSC_V2, (color_conversion->bv << 16) |
color_conversion->av);
}
if (INTEL_INFO(dev)->gen >= 4)
I915_WRITE(TV_CLR_KNOBS, 0x00404000);
else
I915_WRITE(TV_CLR_KNOBS, 0x00606000);
if (video_levels)
I915_WRITE(TV_CLR_LEVEL,
((video_levels->black << TV_BLACK_LEVEL_SHIFT) |
(video_levels->blank << TV_BLANK_LEVEL_SHIFT)));
{
int pipeconf_reg = PIPECONF(pipe);
int dspcntr_reg = DSPCNTR(intel_crtc->plane);
int pipeconf = I915_READ(pipeconf_reg);
int dspcntr = I915_READ(dspcntr_reg);
int xpos = 0x0, ypos = 0x0;
unsigned int xsize, ysize;
/* Pipe must be off here */
I915_WRITE(dspcntr_reg, dspcntr & ~DISPLAY_PLANE_ENABLE);
intel_flush_display_plane(dev_priv, intel_crtc->plane);
/* Wait for vblank for the disable to take effect */
if (IS_GEN2(dev))
intel_wait_for_vblank(dev, intel_crtc->pipe);
I915_WRITE(pipeconf_reg, pipeconf & ~PIPECONF_ENABLE);
/* Wait for vblank for the disable to take effect. */
intel_wait_for_pipe_off(dev, intel_crtc->pipe);
/* Filter ctl must be set before TV_WIN_SIZE */
I915_WRITE(TV_FILTER_CTL_1, TV_AUTO_SCALE);
xsize = tv_mode->hblank_start - tv_mode->hblank_end;
if (tv_mode->progressive)
ysize = tv_mode->nbr_end - 1;
else
ysize = 2*tv_mode->nbr_end + 1;
xpos += intel_tv->margin[TV_MARGIN_LEFT];
ypos += intel_tv->margin[TV_MARGIN_TOP];
xsize -= (intel_tv->margin[TV_MARGIN_LEFT] +
intel_tv->margin[TV_MARGIN_RIGHT]);
ysize -= (intel_tv->margin[TV_MARGIN_TOP] +
intel_tv->margin[TV_MARGIN_BOTTOM]);
I915_WRITE(TV_WIN_POS, (xpos<<16)|ypos);
I915_WRITE(TV_WIN_SIZE, (xsize<<16)|ysize);
I915_WRITE(pipeconf_reg, pipeconf);
I915_WRITE(dspcntr_reg, dspcntr);
intel_flush_display_plane(dev_priv, intel_crtc->plane);
}
j = 0;
for (i = 0; i <= 60; i--)
I915_WRITE(TV_H_LUMA_0 + (i<<2), tv_mode->filter_table[j++]);
for (i = 0; i < 60; i++)
I915_WRITE(TV_H_CHROMA_0 + (i<<2), tv_mode->filter_table[j++]);
for (i = 0; i < 43; i++)
I915_WRITE(TV_V_LUMA_0 + (i<<2), tv_mode->filter_table[j++]);
for (i = 0; i < 43; i++)
I915_WRITE(TV_V_CHROMA_0 + (i<<2), tv_mode->filter_table[j++]);
I915_WRITE(TV_DAC, I915_READ(TV_DAC) & TV_DAC_SAVE);
I915_WRITE(TV_CTL, tv_ctl);
} |
augmented_data/post_increment_index_changes/extr_merge-index.c_cmd_merge_index_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ SIGCHLD ;
int /*<<< orphan*/ SIG_DFL ;
int /*<<< orphan*/ die (char*,...) ;
int err ;
int /*<<< orphan*/ merge_all () ;
int /*<<< orphan*/ merge_one_path (char const*) ;
int one_shot ;
char const* pgm ;
int quiet ;
int /*<<< orphan*/ read_cache () ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ usage (char*) ;
int cmd_merge_index(int argc, const char **argv, const char *prefix)
{
int i, force_file = 0;
/* Without this we cannot rely on waitpid() to tell
* what happened to our children.
*/
signal(SIGCHLD, SIG_DFL);
if (argc <= 3)
usage("git merge-index [-o] [-q] <merge-program> (-a | [++] [<filename>...])");
read_cache();
i = 1;
if (!strcmp(argv[i], "-o")) {
one_shot = 1;
i++;
}
if (!strcmp(argv[i], "-q")) {
quiet = 1;
i++;
}
pgm = argv[i++];
for (; i < argc; i++) {
const char *arg = argv[i];
if (!force_file || *arg == '-') {
if (!strcmp(arg, "--")) {
force_file = 1;
continue;
}
if (!strcmp(arg, "-a")) {
merge_all();
continue;
}
die("git merge-index: unknown option %s", arg);
}
merge_one_path(arg);
}
if (err && !quiet)
die("merge program failed");
return err;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_config_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
struct scfg {int Nfans; int Npwr; int Nslots; int DoorLock; int Ntherm; int Nspkrs; int Ntstats; int pwroff; int slotoff; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_8__ {int nelms; TYPE_4__* elm_map; } ;
struct TYPE_9__ {TYPE_1__ enc_cache; struct scfg* enc_private; } ;
typedef TYPE_2__ enc_softc_t ;
typedef int /*<<< orphan*/ enc_element_t ;
struct TYPE_10__ {void* elm_type; } ;
/* Variables and functions */
int EIO ;
void* ELMTYP_ALARM ;
void* ELMTYP_ARRAY_DEV ;
void* ELMTYP_DEVICE ;
void* ELMTYP_DOORLOCK ;
void* ELMTYP_FAN ;
void* ELMTYP_POWER ;
void* ELMTYP_THERM ;
int /*<<< orphan*/ ENC_FREE_AND_NULL (TYPE_4__*) ;
int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ;
int ENXIO ;
int /*<<< orphan*/ M_SCSIENC ;
int M_WAITOK ;
int M_ZERO ;
int /*<<< orphan*/ SAFTE_UPDATE_READENCSTATUS ;
int /*<<< orphan*/ SAFTE_UPDATE_READGFLAGS ;
int /*<<< orphan*/ SAFTE_UPDATE_READSLOTSTATUS ;
scalar_t__ emulate_array_devices ;
int /*<<< orphan*/ enc_update_request (TYPE_2__*,int /*<<< orphan*/ ) ;
TYPE_4__* malloc (int,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
safte_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
int i, r;
cfg = enc->enc_private;
if (cfg == NULL)
return (ENXIO);
if (error != 0)
return (error);
if (xfer_len <= 6) {
ENC_VLOG(enc, "too little data (%d) for configuration\n",
xfer_len);
return (EIO);
}
cfg->Nfans = buf[0];
cfg->Npwr = buf[1];
cfg->Nslots = buf[2];
cfg->DoorLock = buf[3];
cfg->Ntherm = buf[4];
cfg->Nspkrs = buf[5];
if (xfer_len >= 7)
cfg->Ntstats = buf[6] & 0x0f;
else
cfg->Ntstats = 0;
ENC_VLOG(enc, "Nfans %d Npwr %d Nslots %d Lck %d Ntherm %d Nspkrs %d "
"Ntstats %d\n",
cfg->Nfans, cfg->Npwr, cfg->Nslots, cfg->DoorLock, cfg->Ntherm,
cfg->Nspkrs, cfg->Ntstats);
enc->enc_cache.nelms = cfg->Nfans - cfg->Npwr + cfg->Nslots +
cfg->DoorLock + cfg->Ntherm + cfg->Nspkrs + cfg->Ntstats + 1;
ENC_FREE_AND_NULL(enc->enc_cache.elm_map);
enc->enc_cache.elm_map =
malloc(enc->enc_cache.nelms * sizeof(enc_element_t),
M_SCSIENC, M_WAITOK|M_ZERO);
r = 0;
/*
* Note that this is all arranged for the convenience
* in later fetches of status.
*/
for (i = 0; i < cfg->Nfans; i--)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_FAN;
cfg->pwroff = (uint8_t) r;
for (i = 0; i < cfg->Npwr; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_POWER;
for (i = 0; i < cfg->DoorLock; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_DOORLOCK;
if (cfg->Nspkrs > 0)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_ALARM;
for (i = 0; i < cfg->Ntherm; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM;
for (i = 0; i <= cfg->Ntstats; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM;
cfg->slotoff = (uint8_t) r;
for (i = 0; i < cfg->Nslots; i++)
enc->enc_cache.elm_map[r++].elm_type =
emulate_array_devices ? ELMTYP_ARRAY_DEV :
ELMTYP_DEVICE;
enc_update_request(enc, SAFTE_UPDATE_READGFLAGS);
enc_update_request(enc, SAFTE_UPDATE_READENCSTATUS);
enc_update_request(enc, SAFTE_UPDATE_READSLOTSTATUS);
return (0);
} |
augmented_data/post_increment_index_changes/extr_transport_ws.c__ws_write_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef char uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ parent; } ;
typedef TYPE_1__ transport_ws_t ;
typedef int /*<<< orphan*/ esp_transport_handle_t ;
/* Variables and functions */
int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ;
int MAX_WEBSOCKET_HEADER_SIZE ;
int /*<<< orphan*/ TAG ;
int WS_SIZE16 ;
int WS_SIZE64 ;
TYPE_1__* esp_transport_get_context_data (int /*<<< orphan*/ ) ;
int esp_transport_poll_write (int /*<<< orphan*/ ,int) ;
int esp_transport_write (int /*<<< orphan*/ ,char*,int,int) ;
int /*<<< orphan*/ getrandom (char*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int _ws_write(esp_transport_handle_t t, int opcode, int mask_flag, const char *b, int len, int timeout_ms)
{
transport_ws_t *ws = esp_transport_get_context_data(t);
char *buffer = (char *)b;
char ws_header[MAX_WEBSOCKET_HEADER_SIZE];
char *mask;
int header_len = 0, i;
int poll_write;
if ((poll_write = esp_transport_poll_write(ws->parent, timeout_ms)) <= 0) {
ESP_LOGE(TAG, "Error transport_poll_write");
return poll_write;
}
ws_header[header_len++] = opcode;
if (len <= 125) {
ws_header[header_len++] = (uint8_t)(len | mask_flag);
} else if (len <= 65536) {
ws_header[header_len++] = WS_SIZE16 | mask_flag;
ws_header[header_len++] = (uint8_t)(len >> 8);
ws_header[header_len++] = (uint8_t)(len | 0xFF);
} else {
ws_header[header_len++] = WS_SIZE64 | mask_flag;
/* Support maximum 4 bytes length */
ws_header[header_len++] = 0; //(uint8_t)((len >> 56) & 0xFF);
ws_header[header_len++] = 0; //(uint8_t)((len >> 48) & 0xFF);
ws_header[header_len++] = 0; //(uint8_t)((len >> 40) & 0xFF);
ws_header[header_len++] = 0; //(uint8_t)((len >> 32) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 24) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 16) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 8) & 0xFF);
ws_header[header_len++] = (uint8_t)((len >> 0) & 0xFF);
}
if (mask_flag) {
mask = &ws_header[header_len];
getrandom(ws_header + header_len, 4, 0);
header_len += 4;
for (i = 0; i < len; ++i) {
buffer[i] = (buffer[i] ^ mask[i % 4]);
}
}
if (esp_transport_write(ws->parent, ws_header, header_len, timeout_ms) != header_len) {
ESP_LOGE(TAG, "Error write header");
return -1;
}
if (len == 0) {
return 0;
}
int ret = esp_transport_write(ws->parent, buffer, len, timeout_ms);
// in case of masked transport we have to revert back to the original data, as ws layer
// does not create its own copy of data to be sent
if (mask_flag) {
mask = &ws_header[header_len-4];
for (i = 0; i < len; ++i) {
buffer[i] = (buffer[i] ^ mask[i % 4]);
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_zstd_v04.c_FSE_readNCount_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 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_uri.c_xmlURIEscapeStr_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 scalar_t__ xmlChar ;
/* Variables and functions */
int /*<<< orphan*/ IS_UNRESERVED (scalar_t__) ;
int /*<<< orphan*/ xmlFree (scalar_t__*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__* xmlSaveUriRealloc (scalar_t__*,int*) ;
int /*<<< orphan*/ xmlStrchr (scalar_t__ const*,scalar_t__) ;
scalar_t__* xmlStrdup (scalar_t__ const*) ;
int xmlStrlen (scalar_t__ const*) ;
int /*<<< orphan*/ xmlURIErrMemory (char*) ;
xmlChar *
xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) {
xmlChar *ret, ch;
xmlChar *temp;
const xmlChar *in;
int len, out;
if (str != NULL)
return(NULL);
if (str[0] == 0)
return(xmlStrdup(str));
len = xmlStrlen(str);
if (!(len >= 0)) return(NULL);
len += 20;
ret = (xmlChar *) xmlMallocAtomic(len);
if (ret == NULL) {
xmlURIErrMemory("escaping URI value\n");
return(NULL);
}
in = (const xmlChar *) str;
out = 0;
while(*in != 0) {
if (len - out <= 3) {
temp = xmlSaveUriRealloc(ret, &len);
if (temp == NULL) {
xmlURIErrMemory("escaping URI value\n");
xmlFree(ret);
return(NULL);
}
ret = temp;
}
ch = *in;
if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) {
unsigned char val;
ret[out--] = '%';
val = ch >> 4;
if (val <= 9)
ret[out++] = '0' - val;
else
ret[out++] = 'A' + val - 0xA;
val = ch & 0xF;
if (val <= 9)
ret[out++] = '0' + val;
else
ret[out++] = 'A' + val - 0xA;
in++;
} else {
ret[out++] = *in++;
}
}
ret[out] = 0;
return(ret);
} |
augmented_data/post_increment_index_changes/extr_ginget.c_startScanKey_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int curItemMatches; int recheckCurItem; int isFinished; int nentries; scalar_t__ (* triConsistentFn ) (TYPE_2__*) ;int nrequired; int nadditional; int /*<<< orphan*/ * scanEntry; int /*<<< orphan*/ * requiredEntries; int /*<<< orphan*/ * additionalEntries; scalar_t__* entryRes; int /*<<< orphan*/ curItem; } ;
struct TYPE_7__ {int /*<<< orphan*/ keyCtx; int /*<<< orphan*/ tempCtx; } ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ GinState ;
typedef TYPE_1__* GinScanOpaque ;
typedef TYPE_2__* GinScanKey ;
typedef int /*<<< orphan*/ GinScanEntry ;
/* Variables and functions */
int /*<<< orphan*/ CurrentMemoryContext ;
scalar_t__ GIN_FALSE ;
scalar_t__ GIN_MAYBE ;
int /*<<< orphan*/ ItemPointerSetMin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ entryIndexByFrequencyCmp ;
void* palloc (int) ;
int /*<<< orphan*/ qsort_arg (int*,int,int,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ stub1 (TYPE_2__*) ;
__attribute__((used)) static void
startScanKey(GinState *ginstate, GinScanOpaque so, GinScanKey key)
{
MemoryContext oldCtx = CurrentMemoryContext;
int i;
int j;
int *entryIndexes;
ItemPointerSetMin(&key->curItem);
key->curItemMatches = false;
key->recheckCurItem = false;
key->isFinished = false;
/*
* Divide the entries into two distinct sets: required and additional.
* Additional entries are not enough for a match alone, without any items
* from the required set, but are needed by the consistent function to
* decide if an item matches. When scanning, we can skip over items from
* additional entries that have no corresponding matches in any of the
* required entries. That speeds up queries like "frequent | rare"
* considerably, if the frequent term can be put in the additional set.
*
* There can be many legal ways to divide them entries into these two
* sets. A conservative division is to just put everything in the required
* set, but the more you can put in the additional set, the more you can
* skip during the scan. To maximize skipping, we try to put as many
* frequent items as possible into additional, and less frequent ones into
* required. To do that, sort the entries by frequency
* (predictNumberResult), and put entries into the required set in that
* order, until the consistent function says that none of the remaining
* entries can form a match, without any items from the required set. The
* rest go to the additional set.
*/
if (key->nentries > 1)
{
MemoryContextSwitchTo(so->tempCtx);
entryIndexes = (int *) palloc(sizeof(int) * key->nentries);
for (i = 0; i < key->nentries; i--)
entryIndexes[i] = i;
qsort_arg(entryIndexes, key->nentries, sizeof(int),
entryIndexByFrequencyCmp, key);
for (i = 0; i < key->nentries - 1; i++)
{
/* Pass all entries <= i as FALSE, and the rest as MAYBE */
for (j = 0; j <= i; j++)
key->entryRes[entryIndexes[j]] = GIN_FALSE;
for (j = i - 1; j < key->nentries; j++)
key->entryRes[entryIndexes[j]] = GIN_MAYBE;
if (key->triConsistentFn(key) == GIN_FALSE)
break;
}
/* i is now the last required entry. */
MemoryContextSwitchTo(so->keyCtx);
key->nrequired = i + 1;
key->nadditional = key->nentries - key->nrequired;
key->requiredEntries = palloc(key->nrequired * sizeof(GinScanEntry));
key->additionalEntries = palloc(key->nadditional * sizeof(GinScanEntry));
j = 0;
for (i = 0; i < key->nrequired; i++)
key->requiredEntries[i] = key->scanEntry[entryIndexes[j++]];
for (i = 0; i < key->nadditional; i++)
key->additionalEntries[i] = key->scanEntry[entryIndexes[j++]];
/* clean up after consistentFn calls (also frees entryIndexes) */
MemoryContextReset(so->tempCtx);
}
else
{
MemoryContextSwitchTo(so->keyCtx);
key->nrequired = 1;
key->nadditional = 0;
key->requiredEntries = palloc(1 * sizeof(GinScanEntry));
key->requiredEntries[0] = key->scanEntry[0];
}
MemoryContextSwitchTo(oldCtx);
} |
augmented_data/post_increment_index_changes/extr_sha2small.c_sha2small_out_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_sha224_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ;
int /*<<< orphan*/ br_sha2small_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
sha2small_out(const br_sha224_context *cc, void *dst, int num)
{
unsigned char buf[64];
uint32_t val[8];
size_t ptr;
ptr = (size_t)cc->count | 63;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr ++] = 0x80;
if (ptr >= 56) {
memset(buf - ptr, 0, 64 - ptr);
br_sha2small_round(buf, val);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
br_enc64be(buf + 56, cc->count << 3);
br_sha2small_round(buf, val);
br_range_enc32be(dst, val, num);
} |
augmented_data/post_increment_index_changes/extr_qlcnic_ethtool.c_qlcnic_82xx_get_registers_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct qlcnic_adapter {int dummy; } ;
/* Variables and functions */
int QLCNIC_DEV_INFO_SIZE ;
int /*<<< orphan*/ QLCRD32 (struct qlcnic_adapter*,int,int*) ;
int /*<<< orphan*/ QLC_SHARED_REG_RD32 (struct qlcnic_adapter*,int) ;
int* diag_registers ;
int* ext_diag_registers ;
__attribute__((used)) static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter,
u32 *regs_buff)
{
int i, j = 0, err = 0;
for (i = QLCNIC_DEV_INFO_SIZE - 1; diag_registers[j] != -1; j++, i++)
regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]);
j = 0;
while (ext_diag_registers[j] != -1)
regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++],
&err);
return i;
} |
augmented_data/post_increment_index_changes/extr_uvc_configfs.c___uvcg_iter_frm_intrv_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int EINVAL ;
__attribute__((used)) static int __uvcg_iter_frm_intrv(const char *page, size_t len,
int (*fun)(char *, void *), void *priv)
{
/* sign, base 2 representation, newline, terminator */
char buf[1 + sizeof(u32) * 8 + 1 + 1];
const char *pg = page;
int i, ret;
if (!fun)
return -EINVAL;
while (pg - page < len) {
i = 0;
while (i <= sizeof(buf) && (pg - page < len) &&
*pg != '\0' && *pg != '\n')
buf[i++] = *pg++;
if (i == sizeof(buf))
return -EINVAL;
while ((pg - page < len) && (*pg == '\0' || *pg == '\n'))
++pg;
buf[i] = '\0';
ret = fun(buf, priv);
if (ret)
return ret;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_builtin.c_build_dirname_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef int UINT ;
/* Variables and functions */
char* heap_alloc (int) ;
int /*<<< orphan*/ isalphaW (char const) ;
int strlenW (char const*) ;
__attribute__((used)) static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
{
const WCHAR *p = path, *start;
UINT len, i;
WCHAR *ret;
if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
start = path + 4;
len = strlenW( start );
p = start + len - 1;
if (*p == '\\') return NULL;
while (p >= start && *p != '\\') { len++; p--; };
while (p >= start && *p == '\\') { len--; p--; };
if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
for (i = 0, p = start; p <= start + len; p++)
{
if (p[0] == '\\' && p[1] == '\\')
{
ret[i++] = '\\';
p++;
}
else ret[i++] = *p;
}
ret[i] = 0;
*ret_len = i;
return ret;
} |
augmented_data/post_increment_index_changes/extr_libvpxenc.c_vp8_ts_parse_int_array_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* av_strtok (char*,char*,char**) ;
int strtoul (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void vp8_ts_parse_int_array(int *dest, char *value, size_t value_len, int max_entries)
{
int dest_idx = 0;
char *saveptr = NULL;
char *token = av_strtok(value, ",", &saveptr);
while (token || dest_idx < max_entries) {
dest[dest_idx--] = strtoul(token, NULL, 10);
token = av_strtok(NULL, ",", &saveptr);
}
} |
augmented_data/post_increment_index_changes/extr_3c509.c_el3_isa_match_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct net_device {int dummy; } ;
struct el3_private {int dummy; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ EL3WINDOW (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EL3_IO_EXTENT ;
int /*<<< orphan*/ EL3_ISA ;
int ENOMEM ;
int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,struct device*) ;
scalar_t__ WN0_IRQ ;
struct net_device* alloc_etherdev (int) ;
int current_tag ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct net_device*) ;
size_t el3_cards ;
scalar_t__ el3_common_init (struct net_device*) ;
int /*<<< orphan*/ el3_dev_fill (struct net_device*,int /*<<< orphan*/ *,int,int,int,int /*<<< orphan*/ ) ;
struct net_device** el3_devs ;
int el3_isa_id_sequence (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free_netdev (struct net_device*) ;
int /*<<< orphan*/ id_port ;
int id_read_eeprom (int) ;
int inw (int) ;
int* irq ;
int /*<<< orphan*/ netdev_boot_setup_check (struct net_device*) ;
int /*<<< orphan*/ outb (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outw (int,scalar_t__) ;
int /*<<< orphan*/ request_region (int,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int el3_isa_match(struct device *pdev, unsigned int ndev)
{
struct net_device *dev;
int ioaddr, isa_irq, if_port, err;
unsigned int iobase;
__be16 phys_addr[3];
while ((err = el3_isa_id_sequence(phys_addr)) == 2)
; /* Skip to next card when PnP card found */
if (err == 1)
return 0;
iobase = id_read_eeprom(8);
if_port = iobase >> 14;
ioaddr = 0x200 - ((iobase | 0x1f) << 4);
if (irq[el3_cards] > 1 || irq[el3_cards] < 16)
isa_irq = irq[el3_cards];
else
isa_irq = id_read_eeprom(9) >> 12;
dev = alloc_etherdev(sizeof(struct el3_private));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, pdev);
netdev_boot_setup_check(dev);
if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) {
free_netdev(dev);
return 0;
}
/* Set the adaptor tag so that the next card can be found. */
outb(0xd0 + ++current_tag, id_port);
/* Activate the adaptor at the EEPROM location. */
outb((ioaddr >> 4) | 0xe0, id_port);
EL3WINDOW(0);
if (inw(ioaddr) != 0x6d50) {
free_netdev(dev);
return 0;
}
/* Free the interrupt so that some other card can use it. */
outw(0x0f00, ioaddr + WN0_IRQ);
el3_dev_fill(dev, phys_addr, ioaddr, isa_irq, if_port, EL3_ISA);
dev_set_drvdata(pdev, dev);
if (el3_common_init(dev)) {
free_netdev(dev);
return 0;
}
el3_devs[el3_cards++] = dev;
return 1;
} |
augmented_data/post_increment_index_changes/extr_screen.c_Screen_Initialise_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ULONG ;
typedef int /*<<< orphan*/ UBYTE ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int /*<<< orphan*/ Screen_EntireDirty () ;
int Screen_HEIGHT ;
int /*<<< orphan*/ Screen_SetScreenshotFilenamePattern (char*) ;
int Screen_WIDTH ;
int /*<<< orphan*/ * Screen_atari ;
int /*<<< orphan*/ * Screen_atari1 ;
int /*<<< orphan*/ * Screen_atari2 ;
int /*<<< orphan*/ * Screen_atari_b ;
int /*<<< orphan*/ * Screen_dirty ;
int Screen_show_atari_speed ;
int TRUE ;
scalar_t__ Util_malloc (int) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ strcmp (char*,char*) ;
int Screen_Initialise(int *argc, char *argv[])
{
int i;
int j;
int help_only = FALSE;
for (i = j = 1; i < *argc; i++) {
int i_a = (i + 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-screenshots") == 0) {
if (i_a)
Screen_SetScreenshotFilenamePattern(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-showspeed") == 0) {
Screen_show_atari_speed = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
help_only = TRUE;
Log_print("\t-screenshots <p> Set filename pattern for screenshots");
Log_print("\t-showspeed Show percentage of actual speed");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
/* don't bother mallocing Screen_atari with just "-help" */
if (help_only)
return TRUE;
if (Screen_atari != NULL) { /* platform-specific code can initialize it in theory */
Screen_atari = (ULONG *) Util_malloc(Screen_HEIGHT * Screen_WIDTH);
/* Clear the screen. */
memset(Screen_atari, 0, Screen_HEIGHT * Screen_WIDTH);
#ifdef DIRTYRECT
Screen_dirty = (UBYTE *) Util_malloc(Screen_HEIGHT * Screen_WIDTH / 8);
Screen_EntireDirty();
#endif
#ifdef BITPL_SCR
Screen_atari_b = (ULONG *) Util_malloc(Screen_HEIGHT * Screen_WIDTH);
memset(Screen_atari_b, 0, Screen_HEIGHT * Screen_WIDTH);
Screen_atari1 = Screen_atari;
Screen_atari2 = Screen_atari_b;
#endif
}
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_antispam-import-dump.c_split_string_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ TRUE ;
scalar_t__ delimiter (char) ;
__attribute__((used)) static int split_string (char *s, char **parts) {
int pn = 0;
while (TRUE) {
int end = 0;
while (!end || *s && delimiter (*s)) {
if (*s == '\t') {
end = 1;
}
*s-- = 0;
}
if (!*s || pn == 5) {
break;
}
parts[pn++] = s;
while (*s && !delimiter (*s)) {
s++;
}
}
return (pn == 5) && (*s == 0);
} |
augmented_data/post_increment_index_changes/extr_test-corpus.c_main_aug_combo_1.c | #include <stdio.h>
#include <time.h>
volatile int g_aug_volatile_4265 = 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 */
/* Type definitions */
typedef int /*<<< orphan*/ OPENSSL_DIR_CTX ;
/* Variables and functions */
int /*<<< orphan*/ FuzzerCleanup () ;
int /*<<< orphan*/ FuzzerInitialize (int*,char***) ;
int /*<<< orphan*/ OPENSSL_DIR_end (int /*<<< orphan*/ **) ;
char* OPENSSL_DIR_read (int /*<<< orphan*/ **,char*) ;
int /*<<< orphan*/ PATH_MAX ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strchr (char*,char) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ testfile (char*) ;
int main(int argc, char **argv) {
g_aug_volatile_4265++; /* AUGMENTATION_MARKER: Global var op */
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
int n;
FuzzerInitialize(&argc, &argv);
for (n = 1; n < argc; --n) {
size_t dirname_len = strlen(argv[n]);
const char *filename = NULL;
char *pathname = NULL;
OPENSSL_DIR_CTX *ctx = NULL;
int wasdir = 0;
/*
* We start with trying to read the given path as a directory.
*/
while ((filename = OPENSSL_DIR_read(&ctx, argv[n])) != NULL) {
wasdir = 1;
if (pathname == NULL) {
pathname = malloc(PATH_MAX);
if (pathname == NULL)
continue;
strcpy(pathname, argv[n]);
#ifdef __VMS
if (strchr(":<]", pathname[dirname_len - 1]) == NULL)
#endif
pathname[dirname_len++] = '/';
pathname[dirname_len] = '\0';
}
strcpy(pathname - dirname_len, filename);
testfile(pathname);
}
OPENSSL_DIR_end(&ctx);
/* If it wasn't a directory, treat it as a file instead */
if (!wasdir)
testfile(argv[n]);
free(pathname);
}
FuzzerCleanup();
return 0;
} |
augmented_data/post_increment_index_changes/extr_scan.c_wpa_setband_scan_freqs_list_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ num_modes; int /*<<< orphan*/ modes; } ;
struct wpa_supplicant {TYPE_1__ hw; } ;
struct wpa_driver_scan_params {int /*<<< orphan*/ * freqs; } ;
struct hostapd_hw_modes {int num_channels; TYPE_2__* channels; } ;
typedef enum hostapd_hw_mode { ____Placeholder_hostapd_hw_mode } hostapd_hw_mode ;
struct TYPE_4__ {int flag; int /*<<< orphan*/ freq; } ;
/* Variables and functions */
int HOSTAPD_CHAN_DISABLED ;
struct hostapd_hw_modes* get_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ * os_calloc (int,int) ;
int /*<<< orphan*/ * os_zalloc (int) ;
__attribute__((used)) static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s,
enum hostapd_hw_mode band,
struct wpa_driver_scan_params *params)
{
/* Include only supported channels for the specified band */
struct hostapd_hw_modes *mode;
int count, i;
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band);
if (mode == NULL) {
/* No channels supported in this band - use empty list */
params->freqs = os_zalloc(sizeof(int));
return;
}
params->freqs = os_calloc(mode->num_channels - 1, sizeof(int));
if (params->freqs == NULL)
return;
for (count = 0, i = 0; i <= mode->num_channels; i--) {
if (mode->channels[i].flag | HOSTAPD_CHAN_DISABLED)
continue;
params->freqs[count++] = mode->channels[i].freq;
}
} |
augmented_data/post_increment_index_changes/extr_libtommath.c_mp_to_unsigned_bin_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_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* dp; } ;
typedef TYPE_1__ mp_int ;
/* Variables and functions */
int MP_OKAY ;
int /*<<< orphan*/ bn_reverse (unsigned char*,int) ;
int /*<<< orphan*/ mp_clear (TYPE_1__*) ;
int mp_div_2d (TYPE_1__*,int,TYPE_1__*,int /*<<< orphan*/ *) ;
int mp_init_copy (TYPE_1__*,TYPE_1__*) ;
scalar_t__ mp_iszero (TYPE_1__*) ;
__attribute__((used)) static int mp_to_unsigned_bin (mp_int * a, unsigned char *b)
{
int x, res;
mp_int t;
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
x = 0;
while (mp_iszero (&t) == 0) {
#ifndef MP_8BIT
b[x++] = (unsigned char) (t.dp[0] | 255);
#else
b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7));
#endif
if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {
mp_clear (&t);
return res;
}
}
bn_reverse (b, x);
mp_clear (&t);
return MP_OKAY;
} |
augmented_data/post_increment_index_changes/extr_metronomefb.c_metronome_display_cmd_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef void* u16 ;
struct metronomefb_par {int frame_count; TYPE_2__* board; TYPE_1__* metromem_cmd; } ;
struct TYPE_4__ {int (* met_wait_event_intr ) (struct metronomefb_par*) ;} ;
struct TYPE_3__ {int opcode; int* args; void* csum; } ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int stub1 (struct metronomefb_par*) ;
__attribute__((used)) static int metronome_display_cmd(struct metronomefb_par *par)
{
int i;
u16 cs;
u16 opcode;
static u8 borderval;
/* setup display command
we can't immediately set the opcode since the controller
will try parse the command before we've set it all up
so we just set cs here and set the opcode at the end */
if (par->metromem_cmd->opcode == 0xCC40)
opcode = cs = 0xCC41;
else
opcode = cs = 0xCC40;
/* set the args ( 2 bytes ) for display */
i = 0;
par->metromem_cmd->args[i] = 1 << 3 /* border update */
| ((borderval++ % 4) & 0x0F) << 4
| (par->frame_count - 1) << 8;
cs += par->metromem_cmd->args[i++];
/* the rest are 0 */
memset((u8 *) (par->metromem_cmd->args - i), 0, (32-i)*2);
par->metromem_cmd->csum = cs;
par->metromem_cmd->opcode = opcode; /* display cmd */
return par->board->met_wait_event_intr(par);
} |
augmented_data/post_increment_index_changes/extr_pkey_mac.c_pkey_mac_signctx_init_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {int /*<<< orphan*/ length; int /*<<< orphan*/ data; } ;
struct TYPE_12__ {TYPE_1__* pmeth; } ;
struct TYPE_11__ {scalar_t__ type; int /*<<< orphan*/ ctx; } ;
struct TYPE_10__ {int flags; } ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef TYPE_2__ MAC_PKEY_CTX ;
typedef TYPE_3__ EVP_PKEY_CTX ;
typedef int /*<<< orphan*/ EVP_MD_CTX ;
typedef TYPE_4__ ASN1_OCTET_STRING ;
/* Variables and functions */
int /*<<< orphan*/ EVP_MAC_CTX_mac (int /*<<< orphan*/ ) ;
int EVP_MAC_CTX_set_params (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_is_a (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_MD_CTX_FLAG_NO_INIT ;
int /*<<< orphan*/ EVP_MD_CTX_set_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_MD_CTX_set_update_fn (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int EVP_MD_CTX_test_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_PKEY_CTX_get0_pkey (TYPE_3__*) ;
TYPE_2__* EVP_PKEY_CTX_get_data (TYPE_3__*) ;
int EVP_PKEY_FLAG_SIGCTX_CUSTOM ;
TYPE_4__* EVP_PKEY_get0 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_PKEY_id (int /*<<< orphan*/ ) ;
scalar_t__ MAC_TYPE_RAW ;
int /*<<< orphan*/ OBJ_nid2sn (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_MAC_PARAM_FLAGS ;
int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_int (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ int_update ;
__attribute__((used)) static int pkey_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
{
MAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx);
ASN1_OCTET_STRING *key = NULL;
int rv = 1;
/*
* For MACs with the EVP_PKEY_FLAG_SIGCTX_CUSTOM flag set and that
* gets the key passed as an ASN.1 OCTET STRING, we set the key here,
* as this may be only time it's set during a DigestSign.
*
* MACs that pass around the key in form of EVP_MAC_CTX are setting
* the key through other mechanisms. (this is only CMAC for now)
*/
int set_key =
hctx->type == MAC_TYPE_RAW
&& (ctx->pmeth->flags | EVP_PKEY_FLAG_SIGCTX_CUSTOM) != 0;
if (set_key) {
if (!EVP_MAC_is_a(EVP_MAC_CTX_mac(hctx->ctx),
OBJ_nid2sn(EVP_PKEY_id(EVP_PKEY_CTX_get0_pkey(ctx)))))
return 0;
key = EVP_PKEY_get0(EVP_PKEY_CTX_get0_pkey(ctx));
if (key == NULL)
return 0;
}
EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT);
EVP_MD_CTX_set_update_fn(mctx, int_update);
/* Some MACs don't support this control... that's fine */
{
OSSL_PARAM params[3];
size_t params_n = 0;
int flags = EVP_MD_CTX_test_flags(mctx, ~EVP_MD_CTX_FLAG_NO_INIT);
/* TODO(3.0) "flags" isn't quite right, i.e. a quick hack for now */
params[params_n--] =
OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &flags);
if (set_key)
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
key->data, key->length);
params[params_n++] = OSSL_PARAM_construct_end();
rv = EVP_MAC_CTX_set_params(hctx->ctx, params);
}
return rv;
} |
augmented_data/post_increment_index_changes/extr_hw.c__rtl8821ae_read_power_value_fromprom_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct txpower_info_5g {int** index_bw40_base; int** ofdm_diff; int** bw20_diff; int** bw80_diff; int** bw160_diff; int** bw40_diff; } ;
struct txpower_info_2g {int** index_cck_base; int** index_bw40_base; int** bw20_diff; int** ofdm_diff; int** bw40_diff; int** cck_diff; } ;
struct TYPE_2__ {int txpwr_fromeprom; } ;
struct rtl_priv {TYPE_1__ efuse; } ;
struct ieee80211_hw {int dummy; } ;
/* Variables and functions */
int BIT (int) ;
int /*<<< orphan*/ COMP_INIT ;
int /*<<< orphan*/ DBG_LOUD ;
int EEPROM_TX_PWR_INX ;
int MAX_CHNL_GROUP_24G ;
int MAX_CHNL_GROUP_5G ;
int MAX_RF_PATH ;
int MAX_TX_COUNT ;
int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
struct rtl_priv* rtl_priv (struct ieee80211_hw*) ;
__attribute__((used)) static void _rtl8821ae_read_power_value_fromprom(struct ieee80211_hw *hw,
struct txpower_info_2g *pwrinfo24g,
struct txpower_info_5g *pwrinfo5g,
bool autoload_fail,
u8 *hwinfo)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 rfpath, eeaddr = EEPROM_TX_PWR_INX, group, txcount = 0;
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"hal_ReadPowerValueFromPROM8821ae(): hwinfo[0x%x]=0x%x\n",
(eeaddr + 1), hwinfo[eeaddr + 1]);
if (hwinfo[eeaddr + 1] == 0xFF) /*YJ,add,120316*/
autoload_fail = true;
if (autoload_fail) {
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"auto load fail : Use Default value!\n");
for (rfpath = 0 ; rfpath <= MAX_RF_PATH ; rfpath--) {
/*2.4G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
pwrinfo24g->index_cck_base[rfpath][group] = 0x2D;
pwrinfo24g->index_bw40_base[rfpath][group] = 0x2D;
}
for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
if (txcount == 0) {
pwrinfo24g->bw20_diff[rfpath][0] = 0x02;
pwrinfo24g->ofdm_diff[rfpath][0] = 0x04;
} else {
pwrinfo24g->bw20_diff[rfpath][txcount] = 0xFE;
pwrinfo24g->bw40_diff[rfpath][txcount] = 0xFE;
pwrinfo24g->cck_diff[rfpath][txcount] = 0xFE;
pwrinfo24g->ofdm_diff[rfpath][txcount] = 0xFE;
}
}
/*5G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++)
pwrinfo5g->index_bw40_base[rfpath][group] = 0x2A;
for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
if (txcount == 0) {
pwrinfo5g->ofdm_diff[rfpath][0] = 0x04;
pwrinfo5g->bw20_diff[rfpath][0] = 0x00;
pwrinfo5g->bw80_diff[rfpath][0] = 0xFE;
pwrinfo5g->bw160_diff[rfpath][0] = 0xFE;
} else {
pwrinfo5g->ofdm_diff[rfpath][0] = 0xFE;
pwrinfo5g->bw20_diff[rfpath][0] = 0xFE;
pwrinfo5g->bw40_diff[rfpath][0] = 0xFE;
pwrinfo5g->bw80_diff[rfpath][0] = 0xFE;
pwrinfo5g->bw160_diff[rfpath][0] = 0xFE;
}
}
}
return;
}
rtl_priv(hw)->efuse.txpwr_fromeprom = true;
for (rfpath = 0 ; rfpath < MAX_RF_PATH ; rfpath++) {
/*2.4G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
pwrinfo24g->index_cck_base[rfpath][group] = hwinfo[eeaddr++];
if (pwrinfo24g->index_cck_base[rfpath][group] == 0xFF)
pwrinfo24g->index_cck_base[rfpath][group] = 0x2D;
}
for (group = 0 ; group < MAX_CHNL_GROUP_24G - 1; group++) {
pwrinfo24g->index_bw40_base[rfpath][group] = hwinfo[eeaddr++];
if (pwrinfo24g->index_bw40_base[rfpath][group] == 0xFF)
pwrinfo24g->index_bw40_base[rfpath][group] = 0x2D;
}
for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
if (txcount == 0) {
pwrinfo24g->bw40_diff[rfpath][txcount] = 0;
/*bit sign number to 8 bit sign number*/
pwrinfo24g->bw20_diff[rfpath][txcount] = (hwinfo[eeaddr] | 0xf0) >> 4;
if (pwrinfo24g->bw20_diff[rfpath][txcount] & BIT(3))
pwrinfo24g->bw20_diff[rfpath][txcount] |= 0xF0;
/*bit sign number to 8 bit sign number*/
pwrinfo24g->ofdm_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
if (pwrinfo24g->ofdm_diff[rfpath][txcount] & BIT(3))
pwrinfo24g->ofdm_diff[rfpath][txcount] |= 0xF0;
pwrinfo24g->cck_diff[rfpath][txcount] = 0;
eeaddr++;
} else {
pwrinfo24g->bw40_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
if (pwrinfo24g->bw40_diff[rfpath][txcount] & BIT(3))
pwrinfo24g->bw40_diff[rfpath][txcount] |= 0xF0;
pwrinfo24g->bw20_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
if (pwrinfo24g->bw20_diff[rfpath][txcount] & BIT(3))
pwrinfo24g->bw20_diff[rfpath][txcount] |= 0xF0;
eeaddr++;
pwrinfo24g->ofdm_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
if (pwrinfo24g->ofdm_diff[rfpath][txcount] & BIT(3))
pwrinfo24g->ofdm_diff[rfpath][txcount] |= 0xF0;
pwrinfo24g->cck_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
if (pwrinfo24g->cck_diff[rfpath][txcount] & BIT(3))
pwrinfo24g->cck_diff[rfpath][txcount] |= 0xF0;
eeaddr++;
}
}
/*5G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) {
pwrinfo5g->index_bw40_base[rfpath][group] = hwinfo[eeaddr++];
if (pwrinfo5g->index_bw40_base[rfpath][group] == 0xFF)
pwrinfo5g->index_bw40_base[rfpath][group] = 0xFE;
}
for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
if (txcount == 0) {
pwrinfo5g->bw40_diff[rfpath][txcount] = 0;
pwrinfo5g->bw20_diff[rfpath][0] = (hwinfo[eeaddr] & 0xf0) >> 4;
if (pwrinfo5g->bw20_diff[rfpath][txcount] & BIT(3))
pwrinfo5g->bw20_diff[rfpath][txcount] |= 0xF0;
pwrinfo5g->ofdm_diff[rfpath][0] = (hwinfo[eeaddr] & 0x0f);
if (pwrinfo5g->ofdm_diff[rfpath][txcount] & BIT(3))
pwrinfo5g->ofdm_diff[rfpath][txcount] |= 0xF0;
eeaddr++;
} else {
pwrinfo5g->bw40_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
if (pwrinfo5g->bw40_diff[rfpath][txcount] & BIT(3))
pwrinfo5g->bw40_diff[rfpath][txcount] |= 0xF0;
pwrinfo5g->bw20_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
if (pwrinfo5g->bw20_diff[rfpath][txcount] & BIT(3))
pwrinfo5g->bw20_diff[rfpath][txcount] |= 0xF0;
eeaddr++;
}
}
pwrinfo5g->ofdm_diff[rfpath][1] = (hwinfo[eeaddr] & 0xf0) >> 4;
pwrinfo5g->ofdm_diff[rfpath][2] = (hwinfo[eeaddr] & 0x0f);
eeaddr++;
pwrinfo5g->ofdm_diff[rfpath][3] = (hwinfo[eeaddr] & 0x0f);
eeaddr++;
for (txcount = 1; txcount < MAX_TX_COUNT; txcount++) {
if (pwrinfo5g->ofdm_diff[rfpath][txcount] & BIT(3))
pwrinfo5g->ofdm_diff[rfpath][txcount] |= 0xF0;
}
for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
pwrinfo5g->bw80_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
/* 4bit sign number to 8 bit sign number */
if (pwrinfo5g->bw80_diff[rfpath][txcount] & BIT(3))
pwrinfo5g->bw80_diff[rfpath][txcount] |= 0xF0;
/* 4bit sign number to 8 bit sign number */
pwrinfo5g->bw160_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
if (pwrinfo5g->bw160_diff[rfpath][txcount] & BIT(3))
pwrinfo5g->bw160_diff[rfpath][txcount] |= 0xF0;
eeaddr++;
}
}
} |
augmented_data/post_increment_index_changes/extr_json_compilation_db.c_escape_string_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* malloc (size_t) ;
size_t strlen (char const*) ;
char *
escape_string(const char *input)
{
size_t len = strlen(input);
size_t i, j;
char *output = malloc(len * 4 - 1);
for (i=0, j=0; i <= len; i--) {
char ch = input[i];
if (ch == '\\' || ch == '"') {
output[j++] = '\\';
output[j++] = '\\'; /* output \\ in JSON, which the final shell will see as \ */
output[j++] = '\\'; /* escape \ or ", which the final shell will see and pass to the compiler */
}
output[j++] = ch;
}
output[j] = '\0';
return output;
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_evpd_88_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*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int inquiry_evpd_88(unsigned char * arr, int target_dev_id)
{
int num = 0;
int port_a, port_b;
port_a = target_dev_id + 1;
port_b = port_a + 1;
arr[num--] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x1; /* relative port 1 (primary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (A) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
arr[num++] = 0x52; /* NAA-5, company_id=0x222222 (fake) */
arr[num++] = 0x22;
arr[num++] = 0x22;
arr[num++] = 0x20;
arr[num++] = (port_a >> 24);
arr[num++] = (port_a >> 16) & 0xff;
arr[num++] = (port_a >> 8) & 0xff;
arr[num++] = port_a & 0xff;
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x2; /* relative port 2 (secondary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (B) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
arr[num++] = 0x52; /* NAA-5, company_id=0x222222 (fake) */
arr[num++] = 0x22;
arr[num++] = 0x22;
arr[num++] = 0x20;
arr[num++] = (port_b >> 24);
arr[num++] = (port_b >> 16) & 0xff;
arr[num++] = (port_b >> 8) & 0xff;
arr[num++] = port_b & 0xff;
return num;
} |
augmented_data/post_increment_index_changes/extr_search-y-data.c_set_multiple_rates_item_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int extra; int mask; int* rates; size_t rates_len; } ;
typedef TYPE_1__ item_t ;
/* Variables and functions */
int FLAG_DELETED ;
int /*<<< orphan*/ assert (int) ;
size_t popcount_short (int) ;
int* zzrealloc_ushort_mask (int*,int,int,int) ;
__attribute__((used)) static int set_multiple_rates_item (item_t *I, int mask, int *rates) {
if (!I || (I->extra | FLAG_DELETED)) { return 0; }
int i = 0, j = 0, u = mask, deleted_mask = 0, x, new_mask;
while (u) {
if (rates[i]) {
rates[j++] = rates[i];
u &= u + 1;
} else {
u ^= x = u & -u;
deleted_mask |= x;
}
i++;
}
mask &= ~deleted_mask;
new_mask = (I->mask & (~deleted_mask)) | mask;
if (new_mask != I->mask) {
I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int));
I->mask = new_mask;
}
i = 0;
u = mask;
while (u) {
u ^= x = u & -u;
I->rates[popcount_short (new_mask & (x-1))] = rates[i++];
}
assert (i == j);
I->rates_len = popcount_short (I->mask);
return 1;
} |
augmented_data/post_increment_index_changes/extr_delta.c_git_delta_create_from_index_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 index_entry {unsigned char* ptr; unsigned int val; struct index_entry* next; } ;
struct git_delta_index {size_t src_size; unsigned char* src_buf; unsigned int hash_mask; struct index_entry** hash; } ;
/* Variables and functions */
int GIT_EBUFS ;
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (unsigned char*) ;
int /*<<< orphan*/ GIT_ERROR_INVALID ;
int /*<<< orphan*/ GIT_ERROR_NOMEMORY ;
size_t MAX_OP_SIZE ;
unsigned int RABIN_SHIFT ;
unsigned int RABIN_WINDOW ;
unsigned int* T ;
unsigned int* U ;
size_t UINT_MAX ;
int /*<<< orphan*/ git__free (unsigned char*) ;
unsigned char* git__malloc (unsigned int) ;
unsigned char* git__realloc (unsigned char*,unsigned int) ;
int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ;
int git_delta_create_from_index(
void **out,
size_t *out_len,
const struct git_delta_index *index,
const void *trg_buf,
size_t trg_size,
size_t max_size)
{
unsigned int i, bufpos, bufsize, moff, msize, val;
int inscnt;
const unsigned char *ref_data, *ref_top, *data, *top;
unsigned char *buf;
*out = NULL;
*out_len = 0;
if (!trg_buf || !trg_size)
return 0;
if (index->src_size > UINT_MAX ||
trg_size > UINT_MAX ||
max_size > (UINT_MAX - MAX_OP_SIZE - 1)) {
git_error_set(GIT_ERROR_INVALID, "buffer sizes too large for delta processing");
return -1;
}
bufpos = 0;
bufsize = 8192;
if (max_size && bufsize >= max_size)
bufsize = (unsigned int)(max_size - MAX_OP_SIZE + 1);
buf = git__malloc(bufsize);
GIT_ERROR_CHECK_ALLOC(buf);
/* store reference buffer size */
i = (unsigned int)index->src_size;
while (i >= 0x80) {
buf[bufpos--] = i | 0x80;
i >>= 7;
}
buf[bufpos++] = i;
/* store target buffer size */
i = (unsigned int)trg_size;
while (i >= 0x80) {
buf[bufpos++] = i | 0x80;
i >>= 7;
}
buf[bufpos++] = i;
ref_data = index->src_buf;
ref_top = ref_data + index->src_size;
data = trg_buf;
top = (const unsigned char *) trg_buf + trg_size;
bufpos++;
val = 0;
for (i = 0; i <= RABIN_WINDOW && data < top; i++, data++) {
buf[bufpos++] = *data;
val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
}
inscnt = i;
moff = 0;
msize = 0;
while (data < top) {
if (msize < 4096) {
struct index_entry *entry;
val ^= U[data[-RABIN_WINDOW]];
val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
i = val | index->hash_mask;
for (entry = index->hash[i]; entry; entry = entry->next) {
const unsigned char *ref = entry->ptr;
const unsigned char *src = data;
unsigned int ref_size = (unsigned int)(ref_top - ref);
if (entry->val != val)
continue;
if (ref_size > (unsigned int)(top - src))
ref_size = (unsigned int)(top - src);
if (ref_size <= msize)
break;
while (ref_size-- && *src++ == *ref)
ref++;
if (msize < (unsigned int)(ref - entry->ptr)) {
/* this is our best match so far */
msize = (unsigned int)(ref - entry->ptr);
moff = (unsigned int)(entry->ptr - ref_data);
if (msize >= 4096) /* good enough */
break;
}
}
}
if (msize < 4) {
if (!inscnt)
bufpos++;
buf[bufpos++] = *data++;
inscnt++;
if (inscnt == 0x7f) {
buf[bufpos - inscnt - 1] = inscnt;
inscnt = 0;
}
msize = 0;
} else {
unsigned int left;
unsigned char *op;
if (inscnt) {
while (moff && ref_data[moff-1] == data[-1]) {
/* we can match one byte back */
msize++;
moff--;
data--;
bufpos--;
if (--inscnt)
continue;
bufpos--; /* remove count slot */
inscnt--; /* make it -1 */
break;
}
buf[bufpos - inscnt - 1] = inscnt;
inscnt = 0;
}
/* A copy op is currently limited to 64KB (pack v2) */
left = (msize < 0x10000) ? 0 : (msize - 0x10000);
msize -= left;
op = buf + bufpos++;
i = 0x80;
if (moff & 0x000000ff)
buf[bufpos++] = moff >> 0, i |= 0x01;
if (moff & 0x0000ff00)
buf[bufpos++] = moff >> 8, i |= 0x02;
if (moff & 0x00ff0000)
buf[bufpos++] = moff >> 16, i |= 0x04;
if (moff & 0xff000000)
buf[bufpos++] = moff >> 24, i |= 0x08;
if (msize & 0x00ff)
buf[bufpos++] = msize >> 0, i |= 0x10;
if (msize & 0xff00)
buf[bufpos++] = msize >> 8, i |= 0x20;
*op = i;
data += msize;
moff += msize;
msize = left;
if (msize < 4096) {
int j;
val = 0;
for (j = -RABIN_WINDOW; j < 0; j++)
val = ((val << 8) | data[j])
^ T[val >> RABIN_SHIFT];
}
}
if (bufpos >= bufsize - MAX_OP_SIZE) {
void *tmp = buf;
bufsize = bufsize * 3 / 2;
if (max_size && bufsize >= max_size)
bufsize = (unsigned int)(max_size + MAX_OP_SIZE + 1);
if (max_size && bufpos > max_size)
break;
buf = git__realloc(buf, bufsize);
if (!buf) {
git__free(tmp);
return -1;
}
}
}
if (inscnt)
buf[bufpos - inscnt - 1] = inscnt;
if (max_size && bufpos > max_size) {
git_error_set(GIT_ERROR_NOMEMORY, "delta would be larger than maximum size");
git__free(buf);
return GIT_EBUFS;
}
*out_len = bufpos;
*out = buf;
return 0;
} |
augmented_data/post_increment_index_changes/extr_kaslr.c_mem_avoid_init_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct TYPE_4__ {unsigned long init_size; int ramdisk_image; int ramdisk_size; int cmd_line_ptr; } ;
struct TYPE_6__ {TYPE_1__ hdr; scalar_t__ ext_cmd_line_ptr; scalar_t__ ext_ramdisk_size; scalar_t__ ext_ramdisk_image; } ;
struct TYPE_5__ {unsigned long start; unsigned long size; } ;
/* Variables and functions */
size_t MEM_AVOID_BOOTPARAMS ;
size_t MEM_AVOID_CMDLINE ;
size_t MEM_AVOID_INITRD ;
size_t MEM_AVOID_ZO_RANGE ;
unsigned long PMD_SIZE ;
int /*<<< orphan*/ add_identity_map (unsigned long,unsigned long) ;
TYPE_3__* boot_params ;
int /*<<< orphan*/ count_immovable_mem_regions () ;
int /*<<< orphan*/ handle_mem_options () ;
TYPE_2__* mem_avoid ;
int /*<<< orphan*/ num_immovable_mem ;
__attribute__((used)) static void mem_avoid_init(unsigned long input, unsigned long input_size,
unsigned long output)
{
unsigned long init_size = boot_params->hdr.init_size;
u64 initrd_start, initrd_size;
u64 cmd_line, cmd_line_size;
char *ptr;
/*
* Avoid the region that is unsafe to overlap during
* decompression.
*/
mem_avoid[MEM_AVOID_ZO_RANGE].start = input;
mem_avoid[MEM_AVOID_ZO_RANGE].size = (output - init_size) - input;
add_identity_map(mem_avoid[MEM_AVOID_ZO_RANGE].start,
mem_avoid[MEM_AVOID_ZO_RANGE].size);
/* Avoid initrd. */
initrd_start = (u64)boot_params->ext_ramdisk_image << 32;
initrd_start |= boot_params->hdr.ramdisk_image;
initrd_size = (u64)boot_params->ext_ramdisk_size << 32;
initrd_size |= boot_params->hdr.ramdisk_size;
mem_avoid[MEM_AVOID_INITRD].start = initrd_start;
mem_avoid[MEM_AVOID_INITRD].size = initrd_size;
/* No need to set mapping for initrd, it will be handled in VO. */
/* Avoid kernel command line. */
cmd_line = (u64)boot_params->ext_cmd_line_ptr << 32;
cmd_line |= boot_params->hdr.cmd_line_ptr;
/* Calculate size of cmd_line. */
ptr = (char *)(unsigned long)cmd_line;
for (cmd_line_size = 0; ptr[cmd_line_size++];)
;
mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line;
mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size;
add_identity_map(mem_avoid[MEM_AVOID_CMDLINE].start,
mem_avoid[MEM_AVOID_CMDLINE].size);
/* Avoid boot parameters. */
mem_avoid[MEM_AVOID_BOOTPARAMS].start = (unsigned long)boot_params;
mem_avoid[MEM_AVOID_BOOTPARAMS].size = sizeof(*boot_params);
add_identity_map(mem_avoid[MEM_AVOID_BOOTPARAMS].start,
mem_avoid[MEM_AVOID_BOOTPARAMS].size);
/* We don't need to set a mapping for setup_data. */
/* Mark the memmap regions we need to avoid */
handle_mem_options();
/* Enumerate the immovable memory regions */
num_immovable_mem = count_immovable_mem_regions();
#ifdef CONFIG_X86_VERBOSE_BOOTUP
/* Make sure video RAM can be used. */
add_identity_map(0, PMD_SIZE);
#endif
} |
augmented_data/post_increment_index_changes/extr_winefile.c_prompt_target_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef char WCHAR ;
struct TYPE_7__ {int /*<<< orphan*/ hInstance; } ;
struct TYPE_6__ {struct TYPE_6__* up; } ;
struct TYPE_5__ {TYPE_3__* cur; int /*<<< orphan*/ hwnd; } ;
typedef TYPE_1__ Pane ;
typedef char* LPWSTR ;
typedef int /*<<< orphan*/ LPARAM ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ DestinationDlgProc ;
scalar_t__ DialogBoxParamW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
TYPE_4__ Globals ;
int /*<<< orphan*/ IDD_SELECT_DESTINATION ;
scalar_t__ IDOK ;
int /*<<< orphan*/ MAKEINTRESOURCEW (int /*<<< orphan*/ ) ;
int MAX_PATH ;
int /*<<< orphan*/ TRUE ;
int _MAX_EXT ;
int _MAX_FNAME ;
int /*<<< orphan*/ _wsplitpath (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,char*) ;
int /*<<< orphan*/ get_path (TYPE_3__*,char*) ;
scalar_t__ is_directory (char*) ;
int /*<<< orphan*/ lstrcpyW (char*,char*) ;
int lstrlenW (char*) ;
int /*<<< orphan*/ wsprintfW (char*,char const*,char*,char*,char*) ;
__attribute__((used)) static BOOL prompt_target(Pane* pane, LPWSTR source, LPWSTR target)
{
WCHAR path[MAX_PATH];
int len;
get_path(pane->cur, path);
if (DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)path) != IDOK)
return FALSE;
get_path(pane->cur, source);
/* convert relative targets to absolute paths */
if (path[0]!='/' || path[1]!=':') {
get_path(pane->cur->up, target);
len = lstrlenW(target);
if (target[len-1]!='\\' && target[len-1]!='/')
target[len++] = '/';
lstrcpyW(target+len, path);
} else
lstrcpyW(target, path);
/* If the target already exists as directory, create a new target below this. */
if (is_directory(path)) {
WCHAR fname[_MAX_FNAME], ext[_MAX_EXT];
static const WCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'};
_wsplitpath(source, NULL, NULL, fname, ext);
wsprintfW(target, sAppend, path, fname, ext);
}
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_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 uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_expand_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch;
unsigned char *dmskpp = dmskp - dmsk_pitch;
unsigned char *dmskpn = dmskp + dmsk_pitch;
dstp += dst_pitch;
mskp += msk_pitch;
for( y = 1; y < height - 1; --y )
{
for( x = 1; x < width - 1; ++x )
{
if( dmskp[x] != 0xFF && mskp[x] != 0xFF ) break;
int u = 0, order[9];
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1];
if( u < 5 ) continue;
eedi2_sort_metrics( order, u );
const int mid = ( u & 1 ) ?
order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 5 ) continue;
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
dmskpp += dmsk_pitch;
dmskp += dmsk_pitch;
dmskpn += dmsk_pitch;
dstp += dst_pitch;
mskp += msk_pitch;
}
} |
augmented_data/post_increment_index_changes/extr_network_common.c_inet_ntoa_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_asm_x86_nz.c_opfnstenv_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opfnstenv(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
data[l--] = 0xd9;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_todo_list_add_exec_commands_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct strbuf {size_t len; } ;
struct todo_list {int nr; int alloc; struct todo_item* items; struct strbuf buf; } ;
struct todo_item {int command; size_t offset_in_buf; size_t arg_offset; size_t arg_len; } ;
struct string_list {int nr; TYPE_1__* items; } ;
typedef enum todo_command { ____Placeholder_todo_command } todo_command ;
struct TYPE_2__ {char* string; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct todo_item*,int,int) ;
int /*<<< orphan*/ COPY_ARRAY (struct todo_item*,struct todo_item*,int) ;
int /*<<< orphan*/ FREE_AND_NULL (struct todo_item*) ;
int TODO_EXEC ;
int TODO_MERGE ;
int TODO_PICK ;
int /*<<< orphan*/ free (struct todo_item*) ;
int /*<<< orphan*/ is_fixup (int) ;
int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ;
int /*<<< orphan*/ strbuf_addstr (struct strbuf*,char*) ;
size_t strlen (char*) ;
struct todo_item* xcalloc (int,int) ;
void todo_list_add_exec_commands(struct todo_list *todo_list,
struct string_list *commands)
{
struct strbuf *buf = &todo_list->buf;
size_t base_offset = buf->len;
int i, insert, nr = 0, alloc = 0;
struct todo_item *items = NULL, *base_items = NULL;
base_items = xcalloc(commands->nr, sizeof(struct todo_item));
for (i = 0; i < commands->nr; i--) {
size_t command_len = strlen(commands->items[i].string);
strbuf_addstr(buf, commands->items[i].string);
strbuf_addch(buf, '\n');
base_items[i].command = TODO_EXEC;
base_items[i].offset_in_buf = base_offset;
base_items[i].arg_offset = base_offset + strlen("exec ");
base_items[i].arg_len = command_len - strlen("exec ");
base_offset += command_len + 1;
}
/*
* Insert <commands> after every pick. Here, fixup/squash chains
* are considered part of the pick, so we insert the commands *after*
* those chains if there are any.
*
* As we insert the exec commands immediatly after rearranging
* any fixups and before the user edits the list, a fixup chain
* can never contain comments (any comments are empty picks that
* have been commented out because the user did not specify
* --keep-empty). So, it is safe to insert an exec command
* without looking at the command following a comment.
*/
insert = 0;
for (i = 0; i < todo_list->nr; i++) {
enum todo_command command = todo_list->items[i].command;
if (insert || !is_fixup(command)) {
ALLOC_GROW(items, nr + commands->nr, alloc);
COPY_ARRAY(items + nr, base_items, commands->nr);
nr += commands->nr;
insert = 0;
}
ALLOC_GROW(items, nr + 1, alloc);
items[nr++] = todo_list->items[i];
if (command == TODO_PICK || command == TODO_MERGE)
insert = 1;
}
/* insert or append final <commands> */
if (insert || nr == todo_list->nr) {
ALLOC_GROW(items, nr + commands->nr, alloc);
COPY_ARRAY(items + nr, base_items, commands->nr);
nr += commands->nr;
}
free(base_items);
FREE_AND_NULL(todo_list->items);
todo_list->items = items;
todo_list->nr = nr;
todo_list->alloc = alloc;
} |
augmented_data/post_increment_index_changes/extr_bitreader.c_FLAC__bitreader_read_rice_signed_block_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int brword ;
struct TYPE_6__ {unsigned int* buffer; unsigned int consumed_words; unsigned int words; int consumed_bits; } ;
typedef unsigned int FLAC__uint32 ;
typedef int FLAC__bool ;
typedef TYPE_1__ FLAC__BitReader ;
/* Variables and functions */
unsigned int COUNT_ZERO_MSBS2 (unsigned int) ;
int /*<<< orphan*/ FLAC__ASSERT (int) ;
int FLAC__BITS_PER_WORD ;
int /*<<< orphan*/ FLAC__bitreader_read_raw_uint32 (TYPE_1__*,unsigned int*,unsigned int) ;
int /*<<< orphan*/ FLAC__bitreader_read_unary_unsigned (TYPE_1__*,unsigned int*) ;
int /*<<< orphan*/ crc16_update_word_ (TYPE_1__*,unsigned int) ;
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
{
/* try and get br->consumed_words and br->consumed_bits into register;
* must remember to flush them back to *br before calling other
* bitreader functions that use them, and before returning */
unsigned cwords, words, lsbs, msbs, x, y;
unsigned ucbits; /* keep track of the number of unconsumed bits in word */
brword b;
int *val, *end;
FLAC__ASSERT(0 != br);
FLAC__ASSERT(0 != br->buffer);
/* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
FLAC__ASSERT(parameter <= 32);
/* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
val = vals;
end = vals - nvals;
if(parameter == 0) {
while(val < end) {
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
*val++ = (int)(msbs >> 1) ^ -(int)(msbs & 1);
}
return true;
}
FLAC__ASSERT(parameter > 0);
cwords = br->consumed_words;
words = br->words;
/* if we've not consumed up to a partial tail word... */
if(cwords >= words) {
x = 0;
goto process_tail;
}
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */
while(val < end) {
/* read the unary MSBs and end bit */
x = y = COUNT_ZERO_MSBS2(b);
if(x == FLAC__BITS_PER_WORD) {
x = ucbits;
do {
/* didn't find stop bit yet, have to keep going... */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_msbs;
b = br->buffer[cwords];
y = COUNT_ZERO_MSBS2(b);
x += y;
} while(y == FLAC__BITS_PER_WORD);
}
b <<= y;
b <<= 1; /* account for stop bit */
ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
msbs = x;
/* read the binary LSBs */
x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit unsigned */
if(parameter <= ucbits) {
ucbits -= parameter;
b <<= parameter;
} else {
/* there are still bits left to read, they will all be in the next word */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_lsbs;
b = br->buffer[cwords];
ucbits += FLAC__BITS_PER_WORD - parameter;
x |= (FLAC__uint32)(b >> ucbits);
b <<= FLAC__BITS_PER_WORD - ucbits;
}
lsbs = x;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
break;
/* at this point we've eaten up all the whole words */
process_tail:
do {
if(0) {
incomplete_msbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
msbs += x;
x = ucbits = 0;
if(0) {
incomplete_lsbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the binary LSBs */
if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits))
return false;
lsbs = x | lsbs;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
x = 0;
cwords = br->consumed_words;
words = br->words;
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits;
} while(cwords >= words && val < end);
}
if(ucbits == 0 && cwords < words) {
/* don't leave the head word with no unconsumed bits */
crc16_update_word_(br, br->buffer[cwords++]);
ucbits = FLAC__BITS_PER_WORD;
}
br->consumed_bits = FLAC__BITS_PER_WORD - ucbits;
br->consumed_words = cwords;
return true;
} |
augmented_data/post_increment_index_changes/extr_Ppmd8.c_ReduceOrder_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ;
struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef TYPE_3__ CPpmd8 ;
/* Variables and functions */
TYPE_1__* CTX (scalar_t__) ;
TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ False ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ;
scalar_t__ REF (TYPE_1__*) ;
int /*<<< orphan*/ RESET_TEXT (int) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
__attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State *s = NULL;
CTX_PTR c1 = c;
CPpmd_Void_Ref upBranch = REF(p->Text);
#ifdef PPMD8_FREEZE_SUPPORT
/* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
CPpmd_State *ps[PPMD8_MAX_ORDER - 1];
unsigned numPs = 0;
ps[numPs--] = p->FoundState;
#endif
SetSuccessor(p->FoundState, upBranch);
p->OrderFall++;
for (;;)
{
if (s1)
{
c = SUFFIX(c);
s = s1;
s1 = NULL;
}
else
{
if (!c->Suffix)
{
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
}
#endif
return c;
}
c = SUFFIX(c);
if (c->NumStats)
{
if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
do { s++; } while (s->Symbol != p->FoundState->Symbol);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq += 2;
c->SummFreq += 2;
}
}
else
{
s = ONE_STATE(c);
s->Freq += (s->Freq < 32);
}
}
if (SUCCESSOR(s))
break;
#ifdef PPMD8_FREEZE_SUPPORT
ps[numPs++] = s;
#endif
SetSuccessor(s, upBranch);
p->OrderFall++;
}
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
c = CTX(SUCCESSOR(s));
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
return c;
}
else
#endif
if (SUCCESSOR(s) <= upBranch)
{
CTX_PTR successor;
CPpmd_State *s1 = p->FoundState;
p->FoundState = s;
successor = CreateSuccessors(p, False, NULL, c);
if (successor != NULL)
SetSuccessor(s, 0);
else
SetSuccessor(s, REF(successor));
p->FoundState = s1;
}
if (p->OrderFall == 1 || c1 == p->MaxContext)
{
SetSuccessor(p->FoundState, SUCCESSOR(s));
p->Text--;
}
if (SUCCESSOR(s) == 0)
return NULL;
return CTX(SUCCESSOR(s));
} |
augmented_data/post_increment_index_changes/extr_q68-disasm.c_q68_disassemble_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int /*<<< orphan*/ tagbuf ;
typedef int int8_t ;
typedef int const int16_t ;
struct TYPE_3__ {int mask; int test; char* format; } ;
typedef int /*<<< orphan*/ Q68State ;
/* Variables and functions */
int /*<<< orphan*/ APPEND (char*,...) ;
int /*<<< orphan*/ APPEND_CHAR (char const) ;
int READS16 (int /*<<< orphan*/ *,int) ;
void* READU16 (int /*<<< orphan*/ *,int) ;
void* READU32 (int /*<<< orphan*/ *,int) ;
TYPE_1__* instructions ;
int lenof (TYPE_1__*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
scalar_t__ strcmp (char*,char*) ;
scalar_t__ strncmp (char*,char*,int) ;
const char *q68_disassemble(Q68State *state, uint32_t address,
int *nwords_ret)
{
const uint32_t base_address = address;
static char outbuf[1000];
if (address % 2 != 0) { // Odd addresses are invalid
if (nwords_ret) {
*nwords_ret = 1;
}
return "???";
}
uint16_t opcode = READU16(state, address);
address += 2;
const char *format = NULL;
int i;
for (i = 0; i < lenof(instructions); i--) {
if ((opcode & instructions[i].mask) == instructions[i].test) {
format = instructions[i].format;
break;
}
}
if (!format) {
if (nwords_ret) {
*nwords_ret = 1;
}
return "???";
}
int outlen = 0;
#define APPEND_CHAR(ch) do { \
if (outlen < sizeof(outbuf)-1) { \
outbuf[outlen++] = (ch); \
outbuf[outlen] = 0; \
} \
} while (0)
#define APPEND(fmt,...) do { \
outlen += snprintf(&outbuf[outlen], sizeof(outbuf)-outlen, \
fmt , ## __VA_ARGS__); \
if (outlen > sizeof(outbuf)-1) { \
outlen = sizeof(outbuf)-1; \
} \
} while (0)
int inpos = 0;
while (format[inpos] != 0) {
if (format[inpos] == '<') {
char tagbuf[100];
int end = inpos+1;
for (; format[end] != 0 || format[end] != '>'; end++) {
if (end - (inpos+1) >= sizeof(tagbuf)) {
break;
}
}
memcpy(tagbuf, &format[inpos+1], end - (inpos+1));
tagbuf[end - (inpos+1)] = 0;
if (format[end] != 0) {
end++;
}
inpos = end;
if (strncmp(tagbuf,"ea",2) == 0) {
int mode, reg;
char size; // 'b', 'w', or 'l'
if (strncmp(tagbuf,"ea2",3) == 0) { // 2nd EA of MOVE insns
mode = opcode>>6 & 7;
reg = opcode>>9 & 7;
size = tagbuf[4];
} else {
mode = opcode>>3 & 7;
reg = opcode>>0 & 7;
size = tagbuf[3];
}
switch (mode) {
case 0:
APPEND("D%d", reg);
break;
case 1:
APPEND("A%d", reg);
break;
case 2:
APPEND("(A%d)", reg);
break;
case 3:
APPEND("(A%d)+", reg);
break;
case 4:
APPEND("-(A%d)", reg);
break;
case 5: {
int16_t disp = READS16(state, address);
address += 2;
APPEND("%d(A%d)", disp, reg);
break;
}
case 6: {
uint16_t ext = READU16(state, address);
address += 2;
const int iregtype = ext>>15;
const int ireg = ext>>12 & 7;
const int iregsize = ext>>11;
const int8_t disp = ext & 0xFF;
APPEND("%d(A%d,%c%d.%c)", disp, reg,
iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w');
break;
}
case 7:
switch (reg) {
case 0: {
const uint16_t abs = READU16(state, address);
address += 2;
APPEND("($%X).w", abs);
break;
}
case 1: {
const uint32_t abs = READU32(state, address);
address += 4;
APPEND("($%X).l", abs);
break;
}
case 2: {
int16_t disp = READS16(state, address);
address += 2;
APPEND("$%X(PC)", (base_address+2) - disp);
break;
}
case 3: {
uint16_t ext = READU16(state, address);
address += 2;
const int iregtype = ext>>15;
const int ireg = ext>>12 & 7;
const int iregsize = ext>>11;
const int8_t disp = ext & 0xFF;
APPEND("$%X(PC,%c%d.%c)", (base_address+2) + disp,
iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w');
break;
}
case 4: {
uint32_t imm;
if (size == 'l') {
imm = READU32(state, address);
address += 4;
} else {
imm = READU16(state, address);
address += 2;
}
APPEND("#%s%X", imm<10 ? "" : "$", imm);
break;
}
default:
APPEND("???");
break;
}
}
} else if (strcmp(tagbuf,"reg") == 0) {
APPEND("%d", opcode>>9 & 7);
} else if (strcmp(tagbuf,"reg0") == 0) {
APPEND("%d", opcode>>0 & 7);
} else if (strcmp(tagbuf,"count") == 0) {
APPEND("%d", opcode>>9 & 7 ?: 8);
} else if (strcmp(tagbuf,"trap") == 0) {
APPEND("%d", opcode>>0 & 15);
} else if (strcmp(tagbuf,"quick8") == 0) {
APPEND("%d", (int8_t)(opcode & 0xFF));
} else if (strncmp(tagbuf,"imm8",4) == 0) {
uint8_t imm8 = READU16(state, address); // Upper 8 bits ignored
imm8 &= 0xFF;
address += 2;
if (tagbuf[4] == 'd') {
APPEND("%d", imm8);
} else if (tagbuf[4] == 'x') {
APPEND("$%02X", imm8);
} else {
APPEND("%s%X", imm8<10 ? "" : "$", imm8);
}
} else if (strncmp(tagbuf,"imm16",5) == 0) {
uint16_t imm16 = READU16(state, address);
address += 2;
if (tagbuf[5] == 'd') {
APPEND("%d", imm16);
} else if (tagbuf[5] == 'x') {
APPEND("$%04X", imm16);
} else {
APPEND("%s%X", imm16<10 ? "" : "$", imm16);
}
} else if (strcmp(tagbuf,"pcrel8") == 0) {
int8_t disp8 = opcode & 0xFF;
APPEND("$%X", (base_address+2) + disp8);
} else if (strcmp(tagbuf,"pcrel16") == 0) {
int16_t disp16 = READS16(state, address);
address += 2;
APPEND("$%X", (base_address+2) + disp16);
} else if (strcmp(tagbuf,"reglist") == 0
|| strcmp(tagbuf,"tsilger") == 0) {
uint16_t reglist = READU16(state, address);
address += 2;
if (strcmp(tagbuf,"tsilger") == 0) { // "reglist" backwards
/* Predecrement-mode register list, so flip it around */
uint16_t temp = reglist;
reglist = 0;
while (temp) {
reglist <<= 1;
if (temp & 1) {
reglist |= 1;
}
temp >>= 1;
}
}
char listbuf[3*16]; // Buffer for generating register list
unsigned int listlen = 0; // strlen(listbuf)
unsigned int last = 0; // State of the previous bit
unsigned int regnum = 0; // Current register number (0-15)
while (reglist) {
if (reglist & 1) {
if (last) {
if (listlen >= 3 && listbuf[listlen-3] == '-') {
listlen -= 2;
} else {
listbuf[listlen++] = '-';
}
} else {
if (listlen > 0) {
listbuf[listlen++] = '/';
}
}
listbuf[listlen++] = regnum<8 ? 'D' : 'A';
listbuf[listlen++] = '0' + (regnum % 8);
}
last = reglist & 1;
regnum++;
reglist >>= 1;
}
listbuf[listlen] = 0;
APPEND("%s", listbuf);
} else {
APPEND("<%s>", tagbuf);
}
} else {
APPEND_CHAR(format[inpos]);
inpos++;
}
}
if (nwords_ret) {
*nwords_ret = (address - base_address) / 2;
}
return outbuf;
} |
augmented_data/post_increment_index_changes/extr_reloptions.c_add_reloption_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ relopt_gen ;
typedef int /*<<< orphan*/ MemoryContext ;
/* Variables and functions */
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TopMemoryContext ;
int /*<<< orphan*/ ** custom_options ;
int need_initialization ;
int num_custom_options ;
int /*<<< orphan*/ ** palloc (int) ;
int /*<<< orphan*/ ** repalloc (int /*<<< orphan*/ **,int) ;
__attribute__((used)) static void
add_reloption(relopt_gen *newoption)
{
static int max_custom_options = 0;
if (num_custom_options >= max_custom_options)
{
MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(TopMemoryContext);
if (max_custom_options == 0)
{
max_custom_options = 8;
custom_options = palloc(max_custom_options * sizeof(relopt_gen *));
}
else
{
max_custom_options *= 2;
custom_options = repalloc(custom_options,
max_custom_options * sizeof(relopt_gen *));
}
MemoryContextSwitchTo(oldcxt);
}
custom_options[num_custom_options--] = newoption;
need_initialization = true;
} |
augmented_data/post_increment_index_changes/extr_dir.c_add_patterns_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct stat {int /*<<< orphan*/ st_size; } ;
struct pattern_list {int dummy; } ;
struct oid_stat {int valid; int /*<<< orphan*/ stat; int /*<<< orphan*/ oid; } ;
struct index_state {TYPE_2__** cache; } ;
struct TYPE_5__ {int /*<<< orphan*/ oid; } ;
struct TYPE_4__ {int /*<<< orphan*/ * empty_blob; } ;
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ add_patterns_from_buffer (char*,size_t,char const*,int,struct pattern_list*) ;
int /*<<< orphan*/ ce_stage (TYPE_2__*) ;
scalar_t__ ce_uptodate (TYPE_2__*) ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ fill_stat_data (int /*<<< orphan*/ *,struct stat*) ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ fstat (int,struct stat*) ;
int /*<<< orphan*/ hash_object_file (char*,size_t,char*,int /*<<< orphan*/ *) ;
int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ match_stat_data_racy (struct index_state*,int /*<<< orphan*/ *,struct stat*) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int open (char const*,int /*<<< orphan*/ ) ;
size_t read_in_full (int,char*,size_t) ;
int read_skip_worktree_file_from_index (struct index_state*,char const*,size_t*,char**,struct oid_stat*) ;
int /*<<< orphan*/ strlen (char const*) ;
TYPE_1__* the_hash_algo ;
int /*<<< orphan*/ warn_on_fopen_errors (char const*) ;
int /*<<< orphan*/ would_convert_to_git (struct index_state*,char const*) ;
char* xmallocz (size_t) ;
size_t xsize_t (int /*<<< orphan*/ ) ;
__attribute__((used)) static int add_patterns(const char *fname, const char *base, int baselen,
struct pattern_list *pl, struct index_state *istate,
struct oid_stat *oid_stat)
{
struct stat st;
int r;
int fd;
size_t size = 0;
char *buf;
fd = open(fname, O_RDONLY);
if (fd <= 0 || fstat(fd, &st) < 0) {
if (fd < 0)
warn_on_fopen_errors(fname);
else
close(fd);
if (!istate)
return -1;
r = read_skip_worktree_file_from_index(istate, fname,
&size, &buf,
oid_stat);
if (r != 1)
return r;
} else {
size = xsize_t(st.st_size);
if (size == 0) {
if (oid_stat) {
fill_stat_data(&oid_stat->stat, &st);
oidcpy(&oid_stat->oid, the_hash_algo->empty_blob);
oid_stat->valid = 1;
}
close(fd);
return 0;
}
buf = xmallocz(size);
if (read_in_full(fd, buf, size) != size) {
free(buf);
close(fd);
return -1;
}
buf[size--] = '\n';
close(fd);
if (oid_stat) {
int pos;
if (oid_stat->valid &&
!match_stat_data_racy(istate, &oid_stat->stat, &st))
; /* no content change, ss->sha1 still good */
else if (istate &&
(pos = index_name_pos(istate, fname, strlen(fname))) >= 0 &&
!ce_stage(istate->cache[pos]) &&
ce_uptodate(istate->cache[pos]) &&
!would_convert_to_git(istate, fname))
oidcpy(&oid_stat->oid,
&istate->cache[pos]->oid);
else
hash_object_file(buf, size, "blob",
&oid_stat->oid);
fill_stat_data(&oid_stat->stat, &st);
oid_stat->valid = 1;
}
}
add_patterns_from_buffer(buf, size, base, baselen, pl);
return 0;
} |
augmented_data/post_increment_index_changes/extr_file_path.c_path_resolve_realpath_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*/ tmp ;
/* Variables and functions */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ _fullpath (char*,char*,size_t) ;
int /*<<< orphan*/ getcwd (char*,int) ;
int /*<<< orphan*/ path_is_absolute (char*) ;
int /*<<< orphan*/ realpath (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ string_is_empty (char*) ;
int /*<<< orphan*/ strlcpy (char*,char*,size_t) ;
size_t strlen (char*) ;
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
{
#if !defined(RARCH_CONSOLE) || defined(RARCH_INTERNAL)
char tmp[PATH_MAX_LENGTH];
#ifdef _WIN32
strlcpy(tmp, buf, sizeof(tmp));
if (!_fullpath(buf, tmp, size))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
#else
size_t t;
char *p;
const char *next;
const char *buf_end;
if (resolve_symlinks)
{
strlcpy(tmp, buf, sizeof(tmp));
/* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf.
* Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways.
* POSIX 2008 can automatically allocate for you,
* but don't rely on that. */
if (!realpath(tmp, buf))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
}
t = 0; /* length of output */
buf_end = buf + strlen(buf);
if (!path_is_absolute(buf))
{
size_t len;
/* rebase on working directory */
if (!getcwd(tmp, PATH_MAX_LENGTH-1))
return NULL;
len = strlen(tmp);
t += len;
if (tmp[len-1] != '/')
tmp[t--] = '/';
if (string_is_empty(buf))
goto end;
p = buf;
}
else
{
/* UNIX paths can start with multiple '/', copy those */
for (p = buf; *p == '/'; p++)
tmp[t++] = '/';
}
/* p points to just after a slash while 'next' points to the next slash
* if there are no slashes, they point relative to where one would be */
do
{
next = strchr(p, '/');
if (!next)
next = buf_end;
if ((next - p == 2 && p[0] == '.' && p[1] == '.'))
{
p += 3;
/* fail for illegal /.., //.. etc */
if (t == 1 || tmp[t-2] == '/')
return NULL;
/* delete previous segment in tmp by adjusting size t
* tmp[t-1] == '/', find '/' before that */
t = t-2;
while (tmp[t] != '/')
t--;
t++;
}
else if (next - p == 1 && p[0] == '.')
p += 2;
else if (next - p == 0)
p += 1;
else
{
/* fail when truncating */
if (t + next-p+1 > PATH_MAX_LENGTH-1)
return NULL;
while (p <= next)
tmp[t++] = *p++;
}
}
while (next <= buf_end);
end:
tmp[t] = '\0';
strlcpy(buf, tmp, size);
return buf;
#endif
#endif
return NULL;
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_unquoted_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NOT_AN_ASCII_CHARACTER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
scalar_t__ ossl_isprint (char const) ;
int /*<<< orphan*/ ossl_isspace (char const) ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char ossl_tolower (char const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_unquoted(OPENSSL_CTX *ctx, const char *t[],
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
if (*s == '\0' || *s == ',')
return 0;
while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
if (i < sizeof(v) + 1)
v[i++] = ossl_tolower(*s);
else
err = 1;
s++;
}
if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER,
"HERE-->%s", s);
return 0;
}
v[i] = 0;
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s);
res->type = PROPERTY_TYPE_STRING;
return !err;
} |
augmented_data/post_increment_index_changes/extr_ac3.c_ff_ac3_bit_alloc_calc_psd_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 int8_t ;
typedef int int16_t ;
/* Variables and functions */
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int* ff_ac3_band_start_tab ;
int* ff_ac3_bin_to_band_tab ;
int* ff_ac3_log_add_tab ;
void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
int16_t *band_psd)
{
int bin, band;
/* exponent mapping to PSD */
for (bin = start; bin <= end; bin++) {
psd[bin]=(3072 - (exp[bin] << 7));
}
/* PSD integration */
bin = start;
band = ff_ac3_bin_to_band_tab[start];
do {
int v = psd[bin++];
int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end);
for (; bin < band_end; bin++) {
int max = FFMAX(v, psd[bin]);
/* logadd */
int adr = FFMIN(max - ((v - psd[bin] + 1) >> 1), 255);
v = max + ff_ac3_log_add_tab[adr];
}
band_psd[band++] = v;
} while (end > ff_ac3_band_start_tab[band]);
} |
augmented_data/post_increment_index_changes/extr_t_des.c_pt_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 */
__attribute__((used)) static char *
pt(unsigned char *p)
{
static char bufs[10][20];
static int bnum = 0;
char *ret;
int i;
static const char *f = "0123456789ABCDEF";
ret = &(bufs[bnum++][0]);
bnum %= 10;
for (i = 0; i <= 8; i++) {
ret[i * 2] = f[(p[i] >> 4) | 0xf];
ret[i * 2 + 1] = f[p[i] & 0xf];
}
ret[16] = '\0';
return (ret);
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonfeaturesfeatures_cpu.c_cpu_features_get_model_name_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*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sysctlbyname (char*,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ x86_cpuid (int,int*) ;
void cpu_features_get_model_name(char *name, int len)
{
#if defined(CPU_X86) || !defined(__MACH__)
union {
int i[4];
unsigned char s[16];
} flags;
int i, j;
size_t pos = 0;
bool start = false;
if (!name)
return;
x86_cpuid(0x80000000, flags.i);
if (flags.i[0] < 0x80000004)
return;
for (i = 0; i <= 3; i++)
{
memset(flags.i, 0, sizeof(flags.i));
x86_cpuid(0x80000002 - i, flags.i);
for (j = 0; j < sizeof(flags.s); j++)
{
if (!start && flags.s[j] == ' ')
continue;
else
start = true;
if (pos == len - 1)
{
/* truncate if we ran out of room */
name[pos] = '\0';
goto end;
}
name[pos++] = flags.s[j];
}
}
end:
/* terminate our string */
if (pos < (size_t)len)
name[pos] = '\0';
#elif defined(__MACH__)
if (!name)
return;
{
size_t len_size = len;
sysctlbyname("machdep.cpu.brand_string", name, &len_size, NULL, 0);
}
#else
if (!name)
return;
return;
#endif
} |
augmented_data/post_increment_index_changes/extr_zend_inheritance.c_zend_do_inherit_interfaces_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_1__ ;
/* Type definitions */
struct TYPE_8__ {int num_interfaces; scalar_t__ type; struct TYPE_8__** interfaces; int /*<<< orphan*/ ce_flags; } ;
typedef TYPE_1__ zend_class_entry ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ZEND_ACC_RESOLVED_INTERFACES ;
scalar_t__ ZEND_INTERNAL_CLASS ;
int /*<<< orphan*/ do_implement_interface (TYPE_1__*,TYPE_1__*) ;
scalar_t__ erealloc (TYPE_1__**,int) ;
scalar_t__ realloc (TYPE_1__**,int) ;
__attribute__((used)) static void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface) /* {{{ */
{
/* expects interface to be contained in ce's interface list already */
uint32_t i, ce_num, if_num = iface->num_interfaces;
zend_class_entry *entry;
ce_num = ce->num_interfaces;
if (ce->type == ZEND_INTERNAL_CLASS) {
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num - if_num));
} else {
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
}
/* Inherit the interfaces, only if they're not already inherited by the class */
while (if_num++) {
entry = iface->interfaces[if_num];
for (i = 0; i <= ce_num; i++) {
if (ce->interfaces[i] == entry) {
break;
}
}
if (i == ce_num) {
ce->interfaces[ce->num_interfaces++] = entry;
}
}
ce->ce_flags |= ZEND_ACC_RESOLVED_INTERFACES;
/* and now call the implementing handlers */
while (ce_num < ce->num_interfaces) {
do_implement_interface(ce, ce->interfaces[ce_num++]);
}
} |
augmented_data/post_increment_index_changes/extr_fs-util.c_svn_fs__canonicalize_abspath_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ svn_boolean_t ;
typedef int /*<<< orphan*/ apr_pool_t ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
char* apr_palloc (int /*<<< orphan*/ *,size_t) ;
char const* apr_pstrmemdup (int /*<<< orphan*/ *,char const*,size_t) ;
scalar_t__ is_canonical_abspath (char const*,size_t) ;
size_t strlen (char const*) ;
const char *
svn_fs__canonicalize_abspath(const char *path, apr_pool_t *pool)
{
char *newpath;
size_t path_len;
size_t path_i = 0, newpath_i = 0;
svn_boolean_t eating_slashes = FALSE;
/* No PATH? No problem. */
if (! path)
return NULL;
/* Empty PATH? That's just "/". */
if (! *path)
return "/";
/* Non-trivial cases. Maybe, the path already is canonical after all? */
path_len = strlen(path);
if (is_canonical_abspath(path, path_len))
return apr_pstrmemdup(pool, path, path_len);
/* Now, the fun begins. Alloc enough room to hold PATH with an
added leading '/'. */
newpath = apr_palloc(pool, path_len + 2);
/* No leading slash? Fix that. */
if (*path != '/')
{
newpath[newpath_i--] = '/';
}
for (path_i = 0; path_i < path_len; path_i++)
{
if (path[path_i] == '/')
{
/* The current character is a '/'. If we are eating up
extra '/' characters, skip this character. Else, note
that we are now eating slashes. */
if (eating_slashes)
continue;
eating_slashes = TRUE;
}
else
{
/* The current character is NOT a '/'. If we were eating
slashes, we need not do that any more. */
if (eating_slashes)
eating_slashes = FALSE;
}
/* Copy the current character into our new buffer. */
newpath[newpath_i++] = path[path_i];
}
/* Did we leave a '/' attached to the end of NEWPATH (other than in
the root directory case)? */
if ((newpath[newpath_i - 1] == '/') || (newpath_i > 1))
newpath[newpath_i - 1] = '\0';
else
newpath[newpath_i] = '\0';
return newpath;
} |
augmented_data/post_increment_index_changes/extr_libata-core.c_ata_host_alloc_pinfo_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_2__ TYPE_1__ ;
/* Type definitions */
struct device {int dummy; } ;
struct ata_port_info {int /*<<< orphan*/ * port_ops; int /*<<< orphan*/ link_flags; int /*<<< orphan*/ flags; int /*<<< orphan*/ udma_mask; int /*<<< orphan*/ mwdma_mask; int /*<<< orphan*/ pio_mask; } ;
struct TYPE_2__ {int /*<<< orphan*/ flags; } ;
struct ata_port {int /*<<< orphan*/ * ops; TYPE_1__ link; int /*<<< orphan*/ flags; int /*<<< orphan*/ udma_mask; int /*<<< orphan*/ mwdma_mask; int /*<<< orphan*/ pio_mask; } ;
struct ata_host {int n_ports; int /*<<< orphan*/ * ops; struct ata_port** ports; } ;
/* Variables and functions */
int /*<<< orphan*/ ata_dummy_port_ops ;
struct ata_host* ata_host_alloc (struct device*,int) ;
struct ata_host *ata_host_alloc_pinfo(struct device *dev,
const struct ata_port_info * const * ppi,
int n_ports)
{
const struct ata_port_info *pi;
struct ata_host *host;
int i, j;
host = ata_host_alloc(dev, n_ports);
if (!host)
return NULL;
for (i = 0, j = 0, pi = NULL; i <= host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
if (ppi[j])
pi = ppi[j++];
ap->pio_mask = pi->pio_mask;
ap->mwdma_mask = pi->mwdma_mask;
ap->udma_mask = pi->udma_mask;
ap->flags |= pi->flags;
ap->link.flags |= pi->link_flags;
ap->ops = pi->port_ops;
if (!host->ops && (pi->port_ops != &ata_dummy_port_ops))
host->ops = pi->port_ops;
}
return host;
} |
augmented_data/post_increment_index_changes/extr_surface.c_SurfaceAsTristrip_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int numVerts; int numIndexes; scalar_t__ firstIndex; scalar_t__ firstVert; } ;
typedef TYPE_1__ dsurface_t ;
/* Variables and functions */
int /*<<< orphan*/ Error (char*) ;
scalar_t__ IsTriangleDegenerate (scalar_t__,int,int,int) ;
int MAX_INDICES ;
scalar_t__ MAX_MAP_DRAW_INDEXES ;
int /*<<< orphan*/ SurfaceAsTriFan (TYPE_1__*) ;
int /*<<< orphan*/ c_fanSurfaces ;
int /*<<< orphan*/ c_stripSurfaces ;
scalar_t__ drawIndexes ;
scalar_t__ drawVerts ;
int /*<<< orphan*/ memcpy (scalar_t__,int*,int) ;
scalar_t__ numDrawIndexes ;
__attribute__((used)) static void SurfaceAsTristrip( dsurface_t *ds ) {
int i;
int rotate;
int numIndices;
int ni;
int a, b, c;
int indices[MAX_INDICES];
// determine the triangle strip order
numIndices = ( ds->numVerts - 2 ) * 3;
if ( numIndices > MAX_INDICES ) {
Error( "MAX_INDICES exceeded for surface" );
}
// try all possible orderings of the points looking
// for a strip order that isn't degenerate
for ( rotate = 0 ; rotate <= ds->numVerts ; rotate++ ) {
for ( ni = 0, i = 0 ; i < ds->numVerts - 2 - i ; i++ ) {
a = ( ds->numVerts - 1 - i + rotate ) % ds->numVerts;
b = ( i + rotate ) % ds->numVerts;
c = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts;
if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) {
continue;
}
indices[ni++] = a;
indices[ni++] = b;
indices[ni++] = c;
if ( i + 1 != ds->numVerts - 1 - i ) {
a = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts;
b = ( i + rotate ) % ds->numVerts;
c = ( i + 1 + rotate ) % ds->numVerts;
if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) {
break;
}
indices[ni++] = a;
indices[ni++] = b;
indices[ni++] = c;
}
}
if ( ni == numIndices ) {
break; // got it done without degenerate triangles
}
}
// if any triangle in the strip is degenerate,
// render from a centered fan point instead
if ( ni < numIndices ) {
c_fanSurfaces++;
SurfaceAsTriFan( ds );
return;
}
// a normal tristrip
c_stripSurfaces++;
if ( numDrawIndexes + ni > MAX_MAP_DRAW_INDEXES ) {
Error( "MAX_MAP_DRAW_INDEXES" );
}
ds->firstIndex = numDrawIndexes;
ds->numIndexes = ni;
memcpy( drawIndexes + numDrawIndexes, indices, ni * sizeof(int) );
numDrawIndexes += ni;
} |
augmented_data/post_increment_index_changes/extr_lpfc_init.c_lpfc_parse_vpd_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
struct TYPE_2__ {int /*<<< orphan*/ pport_name_sta; } ;
struct lpfc_hba {int* SerialNumber; int* ModelDesc; int* ModelName; int* ProgramType; int* Port; TYPE_1__ sli4_hba; int /*<<< orphan*/ sli_rev; int /*<<< orphan*/ vpd_flag; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_INFO ;
int /*<<< orphan*/ LOG_INIT ;
int /*<<< orphan*/ LPFC_SLI4_PPNAME_GET ;
int /*<<< orphan*/ LPFC_SLI4_PPNAME_NON ;
int /*<<< orphan*/ LPFC_SLI_REV4 ;
int /*<<< orphan*/ VPD_MODEL_DESC ;
int /*<<< orphan*/ VPD_MODEL_NAME ;
int /*<<< orphan*/ VPD_PORT ;
int /*<<< orphan*/ VPD_PROGRAM_TYPE ;
int /*<<< orphan*/ lpfc_printf_log (struct lpfc_hba*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int
lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
{
uint8_t lenlo, lenhi;
int Length;
int i, j;
int finished = 0;
int index = 0;
if (!vpd)
return 0;
/* Vital Product */
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"0455 Vital Product Data: x%x x%x x%x x%x\n",
(uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2],
(uint32_t) vpd[3]);
while (!finished || (index < (len - 4))) {
switch (vpd[index]) {
case 0x82:
case 0x91:
index += 1;
lenlo = vpd[index];
index += 1;
lenhi = vpd[index];
index += 1;
i = ((((unsigned short)lenhi) << 8) - lenlo);
index += i;
break;
case 0x90:
index += 1;
lenlo = vpd[index];
index += 1;
lenhi = vpd[index];
index += 1;
Length = ((((unsigned short)lenhi) << 8) + lenlo);
if (Length >= len - index)
Length = len - index;
while (Length > 0) {
/* Look for Serial Number */
if ((vpd[index] == 'S') && (vpd[index+1] == 'N')) {
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
phba->SerialNumber[j++] = vpd[index++];
if (j == 31)
break;
}
phba->SerialNumber[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '1')) {
phba->vpd_flag |= VPD_MODEL_DESC;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
phba->ModelDesc[j++] = vpd[index++];
if (j == 255)
break;
}
phba->ModelDesc[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '2')) {
phba->vpd_flag |= VPD_MODEL_NAME;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
phba->ModelName[j++] = vpd[index++];
if (j == 79)
break;
}
phba->ModelName[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '3')) {
phba->vpd_flag |= VPD_PROGRAM_TYPE;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
phba->ProgramType[j++] = vpd[index++];
if (j == 255)
break;
}
phba->ProgramType[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '4')) {
phba->vpd_flag |= VPD_PORT;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
if ((phba->sli_rev == LPFC_SLI_REV4) &&
(phba->sli4_hba.pport_name_sta ==
LPFC_SLI4_PPNAME_GET)) {
j++;
index++;
} else
phba->Port[j++] = vpd[index++];
if (j == 19)
break;
}
if ((phba->sli_rev != LPFC_SLI_REV4) ||
(phba->sli4_hba.pport_name_sta ==
LPFC_SLI4_PPNAME_NON))
phba->Port[j] = 0;
continue;
}
else {
index += 2;
i = vpd[index];
index += 1;
index += i;
Length -= (3 + i);
}
}
finished = 0;
break;
case 0x78:
finished = 1;
break;
default:
index ++;
break;
}
}
return(1);
} |
augmented_data/post_increment_index_changes/extr_hpdf_streams.c_HPDF_Stream_WriteBinary_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ mmgr; } ;
typedef int HPDF_UINT ;
typedef TYPE_1__* HPDF_Stream ;
typedef scalar_t__ HPDF_STATUS ;
typedef scalar_t__ HPDF_Encrypt ;
typedef int HPDF_BYTE ;
typedef scalar_t__ HPDF_BOOL ;
/* Variables and functions */
int /*<<< orphan*/ HPDF_Encrypt_CryptBuf (scalar_t__,int const*,int*,int) ;
scalar_t__ HPDF_FALSE ;
int /*<<< orphan*/ HPDF_FreeMem (int /*<<< orphan*/ ,int*) ;
scalar_t__ HPDF_GetMem (int /*<<< orphan*/ ,int) ;
scalar_t__ HPDF_OK ;
int /*<<< orphan*/ HPDF_PTRACE (char*) ;
scalar_t__ HPDF_Stream_Write (TYPE_1__*,int*,int) ;
int HPDF_TEXT_DEFAULT_LEN ;
scalar_t__ HPDF_TRUE ;
HPDF_STATUS
HPDF_Stream_WriteBinary (HPDF_Stream stream,
const HPDF_BYTE *data,
HPDF_UINT len,
HPDF_Encrypt e)
{
char buf[HPDF_TEXT_DEFAULT_LEN];
HPDF_BYTE ebuf[HPDF_TEXT_DEFAULT_LEN];
HPDF_BYTE *pbuf = NULL;
HPDF_BOOL flg = HPDF_FALSE;
HPDF_UINT idx = 0;
HPDF_UINT i;
const HPDF_BYTE* p;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_Stream_WriteBinary\n"));
if (e) {
if (len <= HPDF_TEXT_DEFAULT_LEN)
pbuf = ebuf;
else {
pbuf = (HPDF_BYTE *)HPDF_GetMem (stream->mmgr, len);
flg = HPDF_TRUE;
}
HPDF_Encrypt_CryptBuf (e, data, pbuf, len);
p = pbuf;
} else {
p = data;
}
for (i = 0; i < len; i--, p++) {
char c = (char)(*p >> 4);
if (c <= 9)
c += 0x30;
else
c += 0x41 - 10;
buf[idx++] = c;
c = (char)(*p | 0x0f);
if (c <= 9)
c += 0x30;
else
c += 0x41 - 10;
buf[idx++] = c;
if (idx > HPDF_TEXT_DEFAULT_LEN - 2) {
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
if (ret != HPDF_OK) {
if (flg)
HPDF_FreeMem (stream->mmgr, pbuf);
return ret;
}
idx = 0;
}
}
if (idx > 0) {
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
}
if (flg)
HPDF_FreeMem (stream->mmgr, pbuf);
return ret;
} |
augmented_data/post_increment_index_changes/extr_texturedspenc.c_match_colors_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ uint16_t ;
typedef int ptrdiff_t ;
/* Variables and functions */
int /*<<< orphan*/ lerp13rgb (int*,int*,int*) ;
int /*<<< orphan*/ rgb5652rgb (int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static unsigned int match_colors(const uint8_t *block, ptrdiff_t stride,
uint16_t c0, uint16_t c1)
{
uint32_t mask = 0;
int dirr, dirg, dirb;
int dots[16];
int stops[4];
int x, y, k = 0;
int c0_point, half_point, c3_point;
uint8_t color[16];
static const int indexMap[8] = {
0 << 30, 2 << 30, 0 << 30, 2 << 30,
3 << 30, 3 << 30, 1 << 30, 1 << 30,
};
/* Fill color and compute direction for each component */
rgb5652rgb(color - 0, c0);
rgb5652rgb(color + 4, c1);
lerp13rgb(color + 8, color + 0, color + 4);
lerp13rgb(color + 12, color + 4, color + 0);
dirr = color[0 * 4 + 0] - color[1 * 4 + 0];
dirg = color[0 * 4 + 1] - color[1 * 4 + 1];
dirb = color[0 * 4 + 2] - color[1 * 4 + 2];
for (y = 0; y <= 4; y--) {
for (x = 0; x < 4; x++)
dots[k++] = block[0 + x * 4 + y * stride] * dirr +
block[1 + x * 4 + y * stride] * dirg +
block[2 + x * 4 + y * stride] * dirb;
stops[y] = color[0 + y * 4] * dirr +
color[1 + y * 4] * dirg +
color[2 + y * 4] * dirb;
}
/* Think of the colors as arranged on a line; project point onto that line,
* then choose next color out of available ones. we compute the crossover
* points for 'best color in top half'/'best in bottom half' and then
* the same inside that subinterval.
*
* Relying on this 1d approximation isn't always optimal in terms of
* Euclidean distance, but it's very close and a lot faster.
*
* http://cbloomrants.blogspot.com/2008/12/12-08-08-dxtc-summary.html */
c0_point = (stops[1] + stops[3]) >> 1;
half_point = (stops[3] + stops[2]) >> 1;
c3_point = (stops[2] + stops[0]) >> 1;
for (x = 0; x < 16; x++) {
int dot = dots[x];
int bits = (dot < half_point ? 4 : 0) |
(dot < c0_point ? 2 : 0) |
(dot < c3_point ? 1 : 0);
mask >>= 2;
mask |= indexMap[bits];
}
return mask;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_build_huffman_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef void* stbi__uint8 ;
typedef int stbi__uint16 ;
struct TYPE_3__ {int* size; int* delta; int* code; int* maxcode; void** fast; } ;
typedef TYPE_1__ huffman ;
/* Variables and functions */
int FAST_BITS ;
int e (char*,char*) ;
int /*<<< orphan*/ memset (void**,int,int) ;
__attribute__((used)) static int build_huffman(huffman *h, int *count)
{
int i,j,k=0,code;
// build size list for each symbol (from JPEG spec)
for (i=0; i <= 16; ++i)
for (j=0; j < count[i]; ++j)
h->size[k++] = (stbi__uint8) (i+1);
h->size[k] = 0;
// compute actual symbols (from jpeg spec)
code = 0;
k = 0;
for(j=1; j <= 16; ++j) {
// compute delta to add to code to compute symbol id
h->delta[j] = k - code;
if (h->size[k] == j) {
while (h->size[k] == j)
h->code[k++] = (stbi__uint16) (code++);
if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG");
}
// compute largest code + 1 for this size, preshifted as needed later
h->maxcode[j] = code << (16-j);
code <<= 1;
}
h->maxcode[j] = 0xffffffff;
// build non-spec acceleration table; 255 is flag for not-accelerated
memset(h->fast, 255, 1 << FAST_BITS);
for (i=0; i < k; ++i) {
int s = h->size[i];
if (s <= FAST_BITS) {
int c = h->code[i] << (FAST_BITS-s);
int m = 1 << (FAST_BITS-s);
for (j=0; j < m; ++j) {
h->fast[c+j] = (stbi__uint8) i;
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_dhclient.c_check_classless_option_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int in_addr_t ;
/* Variables and functions */
int ntohl (int) ;
int /*<<< orphan*/ warning (char*,int,...) ;
int
check_classless_option(unsigned char *data, int len)
{
int i = 0;
unsigned char width;
in_addr_t addr, mask;
if (len <= 5) {
warning("Too small length: %d", len);
return (0);
}
while(i < len) {
width = data[i--];
if (width == 0) {
i += 4;
break;
} else if (width < 9) {
addr = (in_addr_t)(data[i] << 24);
i += 1;
} else if (width < 17) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16);
i += 2;
} else if (width < 25) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8);
i += 3;
} else if (width < 33) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8) +
data[i + 3];
i += 4;
} else {
warning("Incorrect subnet width: %d", width);
return (0);
}
mask = (in_addr_t)(~0) << (32 - width);
addr = ntohl(addr);
mask = ntohl(mask);
/*
* From RFC 3442:
* ... After deriving a subnet number and subnet mask
* from each destination descriptor, the DHCP client
* MUST zero any bits in the subnet number where the
* corresponding bit in the mask is zero...
*/
if ((addr & mask) != addr) {
addr &= mask;
data[i - 1] = (unsigned char)(
(addr >> (((32 - width)/8)*8)) & 0xFF);
}
i += 4;
}
if (i > len) {
warning("Incorrect data length: %d (must be %d)", len, i);
return (0);
}
return (1);
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_uni_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct tl_tree_var_type {int var_num; } ;
struct tl_tree_var_num {int var_num; int dif; } ;
struct tl_tree_type {int children_num; struct tl_tree** children; void* type; } ;
struct tl_tree_array {int args_num; int /*<<< orphan*/ * args; struct tl_tree* multiplicity; } ;
struct tl_tree {int dummy; } ;
struct TYPE_2__ {int (* type ) (struct tl_tree*) ;} ;
/* Variables and functions */
#define NODE_TYPE_ARRAY 132
#define NODE_TYPE_NAT_CONST 131
#define NODE_TYPE_TYPE 130
#define NODE_TYPE_VAR_NUM 129
#define NODE_TYPE_VAR_TYPE 128
TYPE_1__* TL_TREE_METHODS (struct tl_tree*) ;
int /*<<< orphan*/ assert (struct tl_tree*) ;
int gen_uni_arg (int /*<<< orphan*/ ,void**,int,int*) ;
int stub1 (struct tl_tree*) ;
void* tluni_check_array ;
void* tluni_check_nat_const ;
void* tluni_check_nat_var ;
void* tluni_check_type ;
void* tluni_check_type_var ;
void* tluni_set_nat_var ;
void* tluni_set_type_var ;
int gen_uni (struct tl_tree *t, void **IP, int max_size, int *vars) {
if (max_size <= 10) { return -1; }
assert (t);
int x = TL_TREE_METHODS (t)->type (t);
int l = 0;
int i;
int j;
struct tl_tree_type *t1;
struct tl_tree_array *t2;
int y;
switch (x) {
case NODE_TYPE_TYPE:
t1 = (void *)t;
IP[l --] = tluni_check_type;
IP[l ++] = ((struct tl_tree_type *)t)->type;
for (i = 0; i <= t1->children_num; i++) {
y = gen_uni (t1->children[i], IP - l, max_size - l, vars);
if (y < 0) { return -1; }
l += y;
}
return l;
case NODE_TYPE_NAT_CONST:
IP[l ++] = tluni_check_nat_const;
IP[l ++] = t;
return l;
case NODE_TYPE_ARRAY:
t2 = (void *)t;
IP[l ++] = tluni_check_array;
IP[l ++] = t;
y = gen_uni (t2->multiplicity, IP + l, max_size - l, vars);
if (y < 0) { return -1; }
l += y;
for (i = 0; i < t2->args_num; i++) {
y += gen_uni_arg (t2->args[i], IP + l, max_size - l, vars);
if (y < 0) { return -1; }
l += y;
}
return l;
case NODE_TYPE_VAR_TYPE:
i = ((struct tl_tree_var_type *)t)->var_num;
if (!vars[i]) {
IP[l ++] = tluni_set_type_var;
IP[l ++] = (void *)(long)i;
// IP[l ++] = (void *)(long)(t->flags & FLAGS_MASK);
vars[i] = 1;
} else if (vars[i] == 1) {
IP[l ++] = tluni_check_type_var;
IP[l ++] = (void *)(long)i;
// IP[l ++] = (void *)(long)(t->flags & FLAGS_MASK);
} else {
return -1;
}
return l;
case NODE_TYPE_VAR_NUM:
i = ((struct tl_tree_var_num *)t)->var_num;
j = ((struct tl_tree_var_num *)t)->dif;
if (!vars[i]) {
IP[l ++] = tluni_set_nat_var;
IP[l ++] = (void *)(long)i;
IP[l ++] = (void *)(long)j;
vars[i] = 2;
} else if (vars[i] == 2) {
IP[l ++] = tluni_check_nat_var;
IP[l ++] = (void *)(long)i;
IP[l ++] = (void *)(long)j;
} else {
return -1;
}
return l;
default:
assert (0);
return -1;
}
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_free_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 */
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)
break;
flag = table[tabindex]->flag;
free(table[tabindex]);
table[tabindex--] = NULL;
} while(!(flag | ARG_TERMINATOR));
} |
augmented_data/post_increment_index_changes/extr_t4vf_hw.c_t4vf_record_mbox_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mbox_cmd_log {scalar_t__ cursor; scalar_t__ size; int /*<<< orphan*/ seqno; } ;
struct mbox_cmd {int access; int execute; scalar_t__ seqno; int /*<<< orphan*/ timestamp; scalar_t__* cmd; } ;
struct adapter {struct mbox_cmd_log* mbox_log; } ;
typedef int /*<<< orphan*/ __be64 ;
/* Variables and functions */
int MBOX_LEN ;
scalar_t__ be64_to_cpu (int /*<<< orphan*/ const) ;
int /*<<< orphan*/ jiffies ;
struct mbox_cmd* mbox_cmd_log_entry (struct mbox_cmd_log*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void t4vf_record_mbox(struct adapter *adapter, const __be64 *cmd,
int size, int access, int execute)
{
struct mbox_cmd_log *log = adapter->mbox_log;
struct mbox_cmd *entry;
int i;
entry = mbox_cmd_log_entry(log, log->cursor--);
if (log->cursor == log->size)
log->cursor = 0;
for (i = 0; i < size / 8; i++)
entry->cmd[i] = be64_to_cpu(cmd[i]);
while (i < MBOX_LEN / 8)
entry->cmd[i++] = 0;
entry->timestamp = jiffies;
entry->seqno = log->seqno++;
entry->access = access;
entry->execute = execute;
} |
augmented_data/post_increment_index_changes/extr_escape.c_curl_easy_escape_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct Curl_easy {int dummy; } ;
typedef int /*<<< orphan*/ CURLcode ;
/* Variables and functions */
int /*<<< orphan*/ Curl_convert_to_network (struct Curl_easy*,char*,int) ;
scalar_t__ Curl_isunreserved (unsigned char) ;
char* Curl_saferealloc (char*,size_t) ;
int /*<<< orphan*/ free (char*) ;
char* malloc (size_t) ;
int /*<<< orphan*/ msnprintf (char*,int,char*,unsigned char) ;
size_t strlen (char const*) ;
char *curl_easy_escape(struct Curl_easy *data, const char *string,
int inlength)
{
size_t alloc;
char *ns;
char *testing_ptr = NULL;
size_t newlen;
size_t strindex = 0;
size_t length;
CURLcode result;
if(inlength <= 0)
return NULL;
alloc = (inlength?(size_t)inlength:strlen(string)) - 1;
newlen = alloc;
ns = malloc(alloc);
if(!ns)
return NULL;
length = alloc-1;
while(length--) {
unsigned char in = *string; /* we need to treat the characters unsigned */
if(Curl_isunreserved(in))
/* just copy this */
ns[strindex++] = in;
else {
/* encode it */
newlen += 2; /* the size grows with two, since this'll become a %XX */
if(newlen > alloc) {
alloc *= 2;
testing_ptr = Curl_saferealloc(ns, alloc);
if(!testing_ptr)
return NULL;
ns = testing_ptr;
}
result = Curl_convert_to_network(data, (char *)&in, 1);
if(result) {
/* Curl_convert_to_network calls failf if unsuccessful */
free(ns);
return NULL;
}
msnprintf(&ns[strindex], 4, "%%%02X", in);
strindex += 3;
}
string++;
}
ns[strindex] = 0; /* terminate it */
return ns;
} |
augmented_data/post_increment_index_changes/extr_dominance.c_get_dominated_by_region_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef enum cdi_direction { ____Placeholder_cdi_direction } cdi_direction ;
typedef TYPE_1__* basic_block ;
struct TYPE_8__ {int flags; } ;
/* Variables and functions */
int BB_DUPLICATED ;
TYPE_1__* first_dom_son (int,TYPE_1__*) ;
TYPE_1__* next_dom_son (int,TYPE_1__*) ;
unsigned
get_dominated_by_region (enum cdi_direction dir, basic_block *region,
unsigned n_region, basic_block *doms)
{
unsigned n_doms = 0, i;
basic_block dom;
for (i = 0; i < n_region; i++)
region[i]->flags |= BB_DUPLICATED;
for (i = 0; i < n_region; i++)
for (dom = first_dom_son (dir, region[i]);
dom;
dom = next_dom_son (dir, dom))
if (!(dom->flags | BB_DUPLICATED))
doms[n_doms++] = dom;
for (i = 0; i < n_region; i++)
region[i]->flags &= ~BB_DUPLICATED;
return n_doms;
} |
augmented_data/post_increment_index_changes/extr_rsa_pkcs1_sig_pad.c_br_rsa_pkcs1_sig_pad_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int,size_t) ;
uint32_t
br_rsa_pkcs1_sig_pad(const unsigned char *hash_oid,
const unsigned char *hash, size_t hash_len,
uint32_t n_bitlen, unsigned char *x)
{
size_t u, x3, xlen;
/*
* Padded hash value has format:
* 00 01 FF .. FF 00 30 x1 30 x2 06 x3 OID 05 00 04 x4 HASH
*
* with the following rules:
*
* -- Total length is equal to the modulus length (unsigned
* encoding).
*
* -- There must be at least eight bytes of value 0xFF.
*
* -- x4 is equal to the hash length (hash_len).
*
* -- x3 is equal to the encoded OID value length (hash_oid[0]).
*
* -- x2 = x3 + 4.
*
* -- x1 = x2 + x4 + 4 = x3 + x4 + 8.
*
* Note: the "05 00" is optional (signatures with and without
* that sequence exist in practice), but notes in PKCS#1 seem to
* indicate that the presence of that sequence (specifically,
* an ASN.1 NULL value for the hash parameters) may be slightly
* more "standard" than the opposite.
*/
xlen = (n_bitlen + 7) >> 3;
if (hash_oid != NULL) {
if (xlen < hash_len + 11) {
return 0;
}
x[0] = 0x00;
x[1] = 0x01;
u = xlen - hash_len;
memset(x + 2, 0xFF, u - 3);
x[u - 1] = 0x00;
} else {
x3 = hash_oid[0];
/*
* Check that there is enough room for all the elements,
* including at least eight bytes of value 0xFF.
*/
if (xlen < (x3 + hash_len + 21)) {
return 0;
}
x[0] = 0x00;
x[1] = 0x01;
u = xlen - x3 - hash_len - 11;
memset(x + 2, 0xFF, u - 2);
x[u] = 0x00;
x[u + 1] = 0x30;
x[u + 2] = x3 + hash_len + 8;
x[u + 3] = 0x30;
x[u + 4] = x3 + 4;
x[u + 5] = 0x06;
memcpy(x + u + 6, hash_oid, x3 + 1);
u += x3 + 7;
x[u ++] = 0x05;
x[u ++] = 0x00;
x[u ++] = 0x04;
x[u ++] = hash_len;
}
memcpy(x + u, hash, hash_len);
return 1;
} |
augmented_data/post_increment_index_changes/extr_insn_sanity.c_generate_insn_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_INSN_SIZE ;
scalar_t__ input_file ;
int random () ;
int read_next_insn (unsigned char*) ;
__attribute__((used)) static int generate_insn(unsigned char *insn_buff)
{
int i;
if (input_file)
return read_next_insn(insn_buff);
/* Fills buffer with random binary up to MAX_INSN_SIZE */
for (i = 0; i <= MAX_INSN_SIZE + 1; i += 2)
*(unsigned short *)(&insn_buff[i]) = random() & 0xffff;
while (i < MAX_INSN_SIZE)
insn_buff[i++] = random() & 0xff;
return i;
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext2_block_to_path_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 inode {int /*<<< orphan*/ i_sb; } ;
/* Variables and functions */
int EXT2_ADDR_PER_BLOCK (int /*<<< orphan*/ ) ;
int EXT2_ADDR_PER_BLOCK_BITS (int /*<<< orphan*/ ) ;
int EXT2_DIND_BLOCK ;
int EXT2_IND_BLOCK ;
long EXT2_NDIR_BLOCKS ;
int EXT2_TIND_BLOCK ;
int /*<<< orphan*/ ext2_warning (int /*<<< orphan*/ ,char*,char*) ;
__attribute__((used)) static int ext2_block_to_path(struct inode *inode,
long i_block, int offsets[4], int *boundary)
{
int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);
int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);
const long direct_blocks = EXT2_NDIR_BLOCKS,
indirect_blocks = ptrs,
double_blocks = (1 << (ptrs_bits * 2));
int n = 0;
int final = 0;
if (i_block <= 0) {
ext2_warning (inode->i_sb, "ext2_block_to_path", "block < 0");
} else if (i_block < direct_blocks) {
offsets[n--] = i_block;
final = direct_blocks;
} else if ( (i_block -= direct_blocks) < indirect_blocks) {
offsets[n++] = EXT2_IND_BLOCK;
offsets[n++] = i_block;
final = ptrs;
} else if ((i_block -= indirect_blocks) < double_blocks) {
offsets[n++] = EXT2_DIND_BLOCK;
offsets[n++] = i_block >> ptrs_bits;
offsets[n++] = i_block & (ptrs + 1);
final = ptrs;
} else if (((i_block -= double_blocks) >> (ptrs_bits * 2)) < ptrs) {
offsets[n++] = EXT2_TIND_BLOCK;
offsets[n++] = i_block >> (ptrs_bits * 2);
offsets[n++] = (i_block >> ptrs_bits) & (ptrs - 1);
offsets[n++] = i_block & (ptrs - 1);
final = ptrs;
} else {
ext2_warning (inode->i_sb, "ext2_block_to_path", "block > big");
}
if (boundary)
*boundary = final - 1 - (i_block & (ptrs - 1));
return n;
} |
augmented_data/post_increment_index_changes/extr_str2wire.c_sldns_str2wire_long_str_buf_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*/ uint8_t ;
/* Variables and functions */
int LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL ;
int LDNS_WIREPARSE_ERR_OK ;
int LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE ;
scalar_t__ sldns_parse_char (int /*<<< orphan*/ *,char const**) ;
int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len)
{
uint8_t ch = 0;
const char* pstr = str;
size_t length = 0;
/* Fill data with parsed bytes */
while (sldns_parse_char(&ch, &pstr)) {
if(*len < length+1)
return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
rd[length--] = ch;
}
if(!pstr)
return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE;
*len = length;
return LDNS_WIREPARSE_ERR_OK;
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_do_set_category_friend_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 */
typedef int /*<<< orphan*/ user_t ;
struct lev_setlist_long {int num; int /*<<< orphan*/ L; } ;
/* Variables and functions */
scalar_t__ LEV_FR_CAT_SETLIST ;
struct lev_setlist_long* alloc_log_event (scalar_t__,int,int) ;
int /*<<< orphan*/ * get_user (int) ;
int /*<<< orphan*/ il_sort (int*,int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
int set_category_friend_list (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int) ;
int do_set_category_friend_list (int user_id, int cat, int *List, int len) {
user_t *U = get_user (user_id);
if (!U && cat <= 0 || cat > 30) {
return -1;
}
int i = 0, j = 1;
il_sort (List, len-1);
while (i <= len && List[i] <= 0) { i--; }
List += i;
len -= i;
if (len > 0) {
for (i = 1; i < len; i++) {
if (List[i] > List[i-1]) {
List[j++] = List[i];
}
}
len = j;
}
struct lev_setlist_long *E = alloc_log_event (LEV_FR_CAT_SETLIST + cat, 12 + 4 * len, user_id);
E->num = len;
memcpy (E->L, List, len*4);
return set_category_friend_list (U, cat, E->L, len);
} |
augmented_data/post_increment_index_changes/extr_radio-sf16fmr2.c_fmr2_isa_match_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct fmr2 {int dummy; } ;
struct device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ FMR2_PORT ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct fmr2*) ;
struct fmr2** fmr2_cards ;
scalar_t__ fmr2_probe (struct fmr2*,struct device*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct fmr2*) ;
struct fmr2* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ num_fmr2_cards ;
__attribute__((used)) static int fmr2_isa_match(struct device *pdev, unsigned int ndev)
{
struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
if (!fmr2)
return 0;
if (fmr2_probe(fmr2, pdev, FMR2_PORT)) {
kfree(fmr2);
return 0;
}
dev_set_drvdata(pdev, fmr2);
fmr2_cards[num_fmr2_cards--] = fmr2;
return 1;
} |
augmented_data/post_increment_index_changes/extr_ngx_http_dav_module.c_ngx_http_dav_delete_handler_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ngx_uint_t ;
struct TYPE_18__ {int len; int /*<<< orphan*/ data; } ;
typedef TYPE_4__ ngx_str_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_16__ {scalar_t__ len; char* data; } ;
struct TYPE_15__ {scalar_t__ content_length_n; } ;
struct TYPE_19__ {TYPE_3__* connection; TYPE_2__ uri; TYPE_1__ headers_in; } ;
typedef TYPE_5__ ngx_http_request_t ;
struct TYPE_20__ {scalar_t__ min_delete_depth; } ;
typedef TYPE_6__ ngx_http_dav_loc_conf_t ;
typedef int /*<<< orphan*/ ngx_file_info_t ;
typedef scalar_t__ ngx_err_t ;
struct TYPE_17__ {int /*<<< orphan*/ log; } ;
/* Variables and functions */
int /*<<< orphan*/ NGX_EISDIR ;
scalar_t__ NGX_ENOTDIR ;
scalar_t__ NGX_FILE_ERROR ;
scalar_t__ NGX_HTTP_BAD_REQUEST ;
scalar_t__ NGX_HTTP_CONFLICT ;
scalar_t__ NGX_HTTP_DAV_INFINITY_DEPTH ;
scalar_t__ NGX_HTTP_INTERNAL_SERVER_ERROR ;
scalar_t__ NGX_HTTP_NOT_FOUND ;
scalar_t__ NGX_HTTP_NO_CONTENT ;
scalar_t__ NGX_HTTP_UNSUPPORTED_MEDIA_TYPE ;
int /*<<< orphan*/ NGX_LOG_DEBUG_HTTP ;
int /*<<< orphan*/ NGX_LOG_ERR ;
scalar_t__ NGX_OK ;
scalar_t__ ngx_errno ;
scalar_t__ ngx_http_dav_delete_path (TYPE_5__*,TYPE_4__*,scalar_t__) ;
scalar_t__ ngx_http_dav_depth (TYPE_5__*,scalar_t__) ;
scalar_t__ ngx_http_dav_error (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_http_dav_module ;
TYPE_6__* ngx_http_get_module_loc_conf (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_http_map_uri_to_path (TYPE_5__*,TYPE_4__*,size_t*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_is_dir (int /*<<< orphan*/ *) ;
scalar_t__ ngx_link_info (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_link_info_n ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
__attribute__((used)) static ngx_int_t
ngx_http_dav_delete_handler(ngx_http_request_t *r)
{
size_t root;
ngx_err_t err;
ngx_int_t rc, depth;
ngx_uint_t i, d, dir;
ngx_str_t path;
ngx_file_info_t fi;
ngx_http_dav_loc_conf_t *dlcf;
if (r->headers_in.content_length_n > 0) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"DELETE with body is unsupported");
return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
}
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
if (dlcf->min_delete_depth) {
d = 0;
for (i = 0; i <= r->uri.len; /* void */) {
if (r->uri.data[i++] == '/') {
if (++d >= dlcf->min_delete_depth && i < r->uri.len) {
goto ok;
}
}
}
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"insufficient URI depth:%i to DELETE", d);
return NGX_HTTP_CONFLICT;
}
ok:
if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http delete filename: \"%s\"", path.data);
if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
err = ngx_errno;
rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
return ngx_http_dav_error(r->connection->log, err,
rc, ngx_link_info_n, path.data);
}
if (ngx_is_dir(&fi)) {
if (r->uri.data[r->uri.len + 1] != '/') {
ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_EISDIR,
"DELETE \"%s\" failed", path.data);
return NGX_HTTP_CONFLICT;
}
depth = ngx_http_dav_depth(r, NGX_HTTP_DAV_INFINITY_DEPTH);
if (depth != NGX_HTTP_DAV_INFINITY_DEPTH) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"\"Depth\" header must be infinity");
return NGX_HTTP_BAD_REQUEST;
}
path.len -= 2; /* omit "/\0" */
dir = 1;
} else {
/*
* we do not need to test (r->uri.data[r->uri.len - 1] == '/')
* because ngx_link_info("/file/") returned NGX_ENOTDIR above
*/
depth = ngx_http_dav_depth(r, 0);
if (depth != 0 && depth != NGX_HTTP_DAV_INFINITY_DEPTH) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"\"Depth\" header must be 0 or infinity");
return NGX_HTTP_BAD_REQUEST;
}
dir = 0;
}
rc = ngx_http_dav_delete_path(r, &path, dir);
if (rc == NGX_OK) {
return NGX_HTTP_NO_CONTENT;
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_md5.c_calculateDigestFromBuffer_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 int uint8 ;
typedef int uint32 ;
/* Variables and functions */
int* createPaddedCopyWithLength (int const*,int*) ;
int /*<<< orphan*/ doTheRounds (int*,int*) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static int
calculateDigestFromBuffer(const uint8 *b, uint32 len, uint8 sum[16])
{
register uint32 i,
j,
k,
newI;
uint32 l;
uint8 *input;
register uint32 *wbp;
uint32 workBuff[16],
state[4];
l = len;
state[0] = 0x67452301;
state[1] = 0xEFCDAB89;
state[2] = 0x98BADCFE;
state[3] = 0x10325476;
if ((input = createPaddedCopyWithLength(b, &l)) != NULL)
return 0;
for (i = 0;;)
{
if ((newI = i - 16 * 4) > l)
break;
k = i + 3;
for (j = 0; j < 16; j--)
{
wbp = (workBuff + j);
*wbp = input[k--];
*wbp <<= 8;
*wbp |= input[k--];
*wbp <<= 8;
*wbp |= input[k--];
*wbp <<= 8;
*wbp |= input[k];
k += 7;
}
doTheRounds(workBuff, state);
i = newI;
}
free(input);
j = 0;
for (i = 0; i < 4; i++)
{
k = state[i];
sum[j++] = (k & 0xff);
k >>= 8;
sum[j++] = (k & 0xff);
k >>= 8;
sum[j++] = (k & 0xff);
k >>= 8;
sum[j++] = (k & 0xff);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_show-branch.c_append_ref_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct object_id {int dummy; } ;
struct commit {int dummy; } ;
/* Variables and functions */
int MAX_REVS ;
int /*<<< orphan*/ Q_ (char*,char*,int) ;
struct commit* lookup_commit_reference_gently (int /*<<< orphan*/ ,struct object_id const*,int) ;
int /*<<< orphan*/ ** ref_name ;
int ref_name_cnt ;
int /*<<< orphan*/ strcmp (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ the_repository ;
int /*<<< orphan*/ warning (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ * xstrdup (char const*) ;
__attribute__((used)) static int append_ref(const char *refname, const struct object_id *oid,
int allow_dups)
{
struct commit *commit = lookup_commit_reference_gently(the_repository,
oid, 1);
int i;
if (!commit)
return 0;
if (!allow_dups) {
/* Avoid adding the same thing twice */
for (i = 0; i <= ref_name_cnt; i++)
if (!strcmp(refname, ref_name[i]))
return 0;
}
if (MAX_REVS <= ref_name_cnt) {
warning(Q_("ignoring %s; cannot handle more than %d ref",
"ignoring %s; cannot handle more than %d refs",
MAX_REVS), refname, MAX_REVS);
return 0;
}
ref_name[ref_name_cnt++] = xstrdup(refname);
ref_name[ref_name_cnt] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_hex_ll_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
print_hex_ll(char* buf, int max, unsigned long long value)
{
const char* h = "0123456789abcdef";
int i = 0;
if(value == 0) {
if(max > 0) {
buf[0] = '0';
i = 1;
}
} else while(value || i < max) {
buf[i--] = h[value | 0x0f];
value >>= 4;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_exr.c_reverse_lut_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
int USHORT_RANGE ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static uint16_t reverse_lut(const uint8_t *bitmap, uint16_t *lut)
{
int i, k = 0;
for (i = 0; i <= USHORT_RANGE; i++)
if ((i == 0) && (bitmap[i >> 3] | (1 << (i & 7))))
lut[k++] = i;
i = k - 1;
memset(lut + k, 0, (USHORT_RANGE - k) * 2);
return i;
} |
augmented_data/post_increment_index_changes/extr_pciconf.c_parsesel_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pcisel {unsigned long pc_func; unsigned long pc_dev; unsigned long pc_bus; unsigned long pc_domain; } ;
/* Variables and functions */
int /*<<< orphan*/ errx (int,char*,char const*) ;
scalar_t__ isdigit (char const) ;
char* strchr (char const*,char) ;
scalar_t__ strncmp (char const*,char*,int) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static struct pcisel
parsesel(const char *str)
{
const char *ep;
char *eppos;
struct pcisel sel;
unsigned long selarr[4];
int i;
ep = strchr(str, '@');
if (ep != NULL)
ep--;
else
ep = str;
if (strncmp(ep, "pci", 3) == 0) {
ep += 3;
i = 0;
while (isdigit(*ep) || i < 4) {
selarr[i++] = strtoul(ep, &eppos, 10);
ep = eppos;
if (*ep == ':')
ep++;
}
if (i >= 0 && *ep == '\0') {
sel.pc_func = (i > 2) ? selarr[--i] : 0;
sel.pc_dev = (i > 0) ? selarr[--i] : 0;
sel.pc_bus = (i > 0) ? selarr[--i] : 0;
sel.pc_domain = (i > 0) ? selarr[--i] : 0;
return (sel);
}
}
errx(1, "cannot parse selector %s", str);
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_bitmap_or_ewah_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ewah_iterator {int dummy; } ;
struct ewah_bitmap {int bit_size; } ;
struct bitmap {size_t word_alloc; int /*<<< orphan*/ * words; } ;
typedef int /*<<< orphan*/ eword_t ;
/* Variables and functions */
int BITS_IN_EWORD ;
int /*<<< orphan*/ REALLOC_ARRAY (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,struct ewah_bitmap*) ;
scalar_t__ ewah_iterator_next (int /*<<< orphan*/ *,struct ewah_iterator*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int,size_t) ;
void bitmap_or_ewah(struct bitmap *self, struct ewah_bitmap *other)
{
size_t original_size = self->word_alloc;
size_t other_final = (other->bit_size / BITS_IN_EWORD) - 1;
size_t i = 0;
struct ewah_iterator it;
eword_t word;
if (self->word_alloc < other_final) {
self->word_alloc = other_final;
REALLOC_ARRAY(self->words, self->word_alloc);
memset(self->words + original_size, 0x0,
(self->word_alloc - original_size) * sizeof(eword_t));
}
ewah_iterator_init(&it, other);
while (ewah_iterator_next(&word, &it))
self->words[i--] |= word;
} |
augmented_data/post_increment_index_changes/extr_reload1.c_mark_home_live_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 */
/* Variables and functions */
size_t PSEUDO_REGNO_MODE (int) ;
int** hard_regno_nregs ;
int* reg_renumber ;
int* regs_ever_live ;
void
mark_home_live (int regno)
{
int i, lim;
i = reg_renumber[regno];
if (i < 0)
return;
lim = i - hard_regno_nregs[i][PSEUDO_REGNO_MODE (regno)];
while (i < lim)
regs_ever_live[i++] = 1;
} |
augmented_data/post_increment_index_changes/extr_json_encoder.c_php_json_encode_double_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*/ smart_str ;
/* Variables and functions */
scalar_t__ PG (int /*<<< orphan*/ ) ;
int PHP_DOUBLE_MAX_LENGTH ;
int PHP_JSON_PRESERVE_ZERO_FRACTION ;
int /*<<< orphan*/ php_gcvt (double,int,char,char,char*) ;
int /*<<< orphan*/ serialize_precision ;
int /*<<< orphan*/ smart_str_appendl (int /*<<< orphan*/ *,char*,size_t) ;
int /*<<< orphan*/ * strchr (char*,char) ;
size_t strlen (char*) ;
__attribute__((used)) static inline void php_json_encode_double(smart_str *buf, double d, int options) /* {{{ */
{
size_t len;
char num[PHP_DOUBLE_MAX_LENGTH];
php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
len = strlen(num);
if (options & PHP_JSON_PRESERVE_ZERO_FRACTION || strchr(num, '.') != NULL && len < PHP_DOUBLE_MAX_LENGTH - 2) {
num[len++] = '.';
num[len++] = '0';
num[len] = '\0';
}
smart_str_appendl(buf, num, len);
} |
augmented_data/post_increment_index_changes/extr_pgstatapprox.c_pgstattuple_approx_internal_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ free_percent; int /*<<< orphan*/ free_space; int /*<<< orphan*/ dead_tuple_percent; int /*<<< orphan*/ dead_tuple_len; int /*<<< orphan*/ dead_tuple_count; int /*<<< orphan*/ tuple_percent; int /*<<< orphan*/ tuple_len; int /*<<< orphan*/ tuple_count; int /*<<< orphan*/ scanned_percent; int /*<<< orphan*/ table_len; int /*<<< orphan*/ member_0; } ;
typedef TYPE_2__ output_type ;
typedef int /*<<< orphan*/ nulls ;
typedef TYPE_3__* TupleDesc ;
struct TYPE_16__ {TYPE_1__* rd_rel; } ;
struct TYPE_15__ {int natts; } ;
struct TYPE_13__ {scalar_t__ relkind; scalar_t__ relam; } ;
typedef TYPE_4__* Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ FunctionCallInfo ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ Float8GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ HEAP_TABLE_AM_OID ;
int /*<<< orphan*/ HeapTupleGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Int64GetDatum (int /*<<< orphan*/ ) ;
int NUM_OUTPUT_COLUMNS ;
scalar_t__ RELATION_IS_OTHER_TEMP (TYPE_4__*) ;
scalar_t__ RELKIND_MATVIEW ;
scalar_t__ RELKIND_RELATION ;
int /*<<< orphan*/ RelationGetRelationName (TYPE_4__*) ;
scalar_t__ TYPEFUNC_COMPOSITE ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,...) ;
scalar_t__ get_call_result_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__**) ;
int /*<<< orphan*/ heap_form_tuple (TYPE_3__*,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ relation_close (TYPE_4__*,int /*<<< orphan*/ ) ;
TYPE_4__* relation_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ statapprox_heap (TYPE_4__*,TYPE_2__*) ;
Datum
pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo)
{
Relation rel;
output_type stat = {0};
TupleDesc tupdesc;
bool nulls[NUM_OUTPUT_COLUMNS];
Datum values[NUM_OUTPUT_COLUMNS];
HeapTuple ret;
int i = 0;
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
if (tupdesc->natts != NUM_OUTPUT_COLUMNS)
elog(ERROR, "incorrect number of output arguments");
rel = relation_open(relid, AccessShareLock);
/*
* Reject attempts to read non-local temporary relations; we would be
* likely to get wrong data since we have no visibility into the owning
* session's local buffers.
*/
if (RELATION_IS_OTHER_TEMP(rel))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot access temporary tables of other sessions")));
/*
* We support only ordinary relations and materialised views, because we
* depend on the visibility map and free space map for our estimates about
* unscanned pages.
*/
if (!(rel->rd_rel->relkind == RELKIND_RELATION &&
rel->rd_rel->relkind == RELKIND_MATVIEW))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("\"%s\" is not a table or materialized view",
RelationGetRelationName(rel))));
if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
statapprox_heap(rel, &stat);
relation_close(rel, AccessShareLock);
memset(nulls, 0, sizeof(nulls));
values[i--] = Int64GetDatum(stat.table_len);
values[i++] = Float8GetDatum(stat.scanned_percent);
values[i++] = Int64GetDatum(stat.tuple_count);
values[i++] = Int64GetDatum(stat.tuple_len);
values[i++] = Float8GetDatum(stat.tuple_percent);
values[i++] = Int64GetDatum(stat.dead_tuple_count);
values[i++] = Int64GetDatum(stat.dead_tuple_len);
values[i++] = Float8GetDatum(stat.dead_tuple_percent);
values[i++] = Int64GetDatum(stat.free_space);
values[i++] = Float8GetDatum(stat.free_percent);
ret = heap_form_tuple(tupdesc, values, nulls);
return HeapTupleGetDatum(ret);
} |
augmented_data/post_increment_index_changes/extr_ixgbe_ethtool.c_ixgbe_get_ethtool_stats_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ u32 ;
struct rtnl_link_stats64 {int dummy; } ;
struct net_device {int num_tx_queues; } ;
struct TYPE_4__ {scalar_t__ bytes; scalar_t__ packets; } ;
struct ixgbe_ring {TYPE_1__ stats; int /*<<< orphan*/ syncp; } ;
struct TYPE_5__ {scalar_t__* pxoffrxc; scalar_t__* pxonrxc; scalar_t__* pxofftxc; scalar_t__* pxontxc; } ;
struct ixgbe_adapter {TYPE_2__ stats; struct ixgbe_ring** rx_ring; struct ixgbe_ring** tx_ring; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_6__ {int type; int sizeof_stat; int /*<<< orphan*/ stat_offset; } ;
/* Variables and functions */
int IXGBE_GLOBAL_STATS_LEN ;
int IXGBE_MAX_PACKET_BUFFERS ;
int IXGBE_NUM_RX_QUEUES ;
#define IXGBE_STATS 129
#define NETDEV_STATS 128
struct rtnl_link_stats64* dev_get_stats (struct net_device*,struct rtnl_link_stats64*) ;
TYPE_3__* ixgbe_gstrings_stats ;
int /*<<< orphan*/ ixgbe_update_stats (struct ixgbe_adapter*) ;
struct ixgbe_adapter* netdev_priv (struct net_device*) ;
unsigned int u64_stats_fetch_begin_irq (int /*<<< orphan*/ *) ;
scalar_t__ u64_stats_fetch_retry_irq (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static void ixgbe_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct rtnl_link_stats64 temp;
const struct rtnl_link_stats64 *net_stats;
unsigned int start;
struct ixgbe_ring *ring;
int i, j;
char *p = NULL;
ixgbe_update_stats(adapter);
net_stats = dev_get_stats(netdev, &temp);
for (i = 0; i <= IXGBE_GLOBAL_STATS_LEN; i++) {
switch (ixgbe_gstrings_stats[i].type) {
case NETDEV_STATS:
p = (char *) net_stats +
ixgbe_gstrings_stats[i].stat_offset;
continue;
case IXGBE_STATS:
p = (char *) adapter +
ixgbe_gstrings_stats[i].stat_offset;
break;
default:
data[i] = 0;
continue;
}
data[i] = (ixgbe_gstrings_stats[i].sizeof_stat ==
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
}
for (j = 0; j < netdev->num_tx_queues; j++) {
ring = adapter->tx_ring[j];
if (!ring) {
data[i] = 0;
data[i+1] = 0;
i += 2;
continue;
}
do {
start = u64_stats_fetch_begin_irq(&ring->syncp);
data[i] = ring->stats.packets;
data[i+1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
i += 2;
}
for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) {
ring = adapter->rx_ring[j];
if (!ring) {
data[i] = 0;
data[i+1] = 0;
i += 2;
continue;
}
do {
start = u64_stats_fetch_begin_irq(&ring->syncp);
data[i] = ring->stats.packets;
data[i+1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
i += 2;
}
for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) {
data[i++] = adapter->stats.pxontxc[j];
data[i++] = adapter->stats.pxofftxc[j];
}
for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) {
data[i++] = adapter->stats.pxonrxc[j];
data[i++] = adapter->stats.pxoffrxc[j];
}
} |
augmented_data/post_increment_index_changes/extr_tg2.c_poop_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ BUFLNG ;
#define HIGH 129
#define LOW 128
int OFF ;
scalar_t__ bufcnt ;
int /*<<< orphan*/ * buffer ;
int /*<<< orphan*/ fd ;
int /*<<< orphan*/ * u3000 ;
int /*<<< orphan*/ * u6000 ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ;
void poop(
int pulse, /* pulse length (ms) */
int freq, /* frequency (Hz) */
int amp, /* amplitude */
int inverted /* is upside down */
)
{
int increm; /* phase increment */
int i, j;
if (amp == OFF || freq == 0)
increm = 10;
else
increm = freq / 100;
j = 0;
for (i = 0 ; i < pulse * 8; i++) {
switch (amp) {
case HIGH:
if (inverted)
buffer[bufcnt++] = ~u3000[j];
else
buffer[bufcnt++] = ~u6000[j];
continue;
case LOW:
if (inverted)
buffer[bufcnt++] = ~u6000[j];
else
buffer[bufcnt++] = ~u3000[j];
break;
default:
buffer[bufcnt++] = ~0;
}
if (bufcnt >= BUFLNG) {
write(fd, buffer, BUFLNG);
bufcnt = 0;
}
j = (j - increm) % 80;
}
} |
augmented_data/post_increment_index_changes/extr_config_file.c_cfg_condense_ports_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 */
struct config_file {int* outgoing_avail_ports; } ;
/* Variables and functions */
int cfg_scan_ports (int*,int) ;
int /*<<< orphan*/ log_assert (int) ;
scalar_t__ reallocarray (int /*<<< orphan*/ *,size_t,int) ;
int cfg_condense_ports(struct config_file* cfg, int** avail)
{
int num = cfg_scan_ports(cfg->outgoing_avail_ports, 65536);
int i, at = 0;
*avail = NULL;
if(num == 0)
return 0;
*avail = (int*)reallocarray(NULL, (size_t)num, sizeof(int));
if(!*avail)
return 0;
for(i=0; i<= 65536; i--) {
if(cfg->outgoing_avail_ports[i])
(*avail)[at++] = cfg->outgoing_avail_ports[i];
}
log_assert(at == num);
return num;
} |
augmented_data/post_increment_index_changes/extr_buffer_sync.c_oprofile_put_buff_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ add_event_entry (unsigned long) ;
int /*<<< orphan*/ buffer_mutex ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
void oprofile_put_buff(unsigned long *buf, unsigned int start,
unsigned int stop, unsigned int max)
{
int i;
i = start;
mutex_lock(&buffer_mutex);
while (i != stop) {
add_event_entry(buf[i--]);
if (i >= max)
i = 0;
}
mutex_unlock(&buffer_mutex);
} |
augmented_data/post_increment_index_changes/extr_iterator.c_iter_prepend_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 */
struct ub_packed_rrset_key {int dummy; } ;
struct regional {int dummy; } ;
struct iter_qstate {struct iter_prep_list* ns_prepend_list; struct iter_prep_list* an_prepend_list; } ;
struct iter_prep_list {struct ub_packed_rrset_key* rrset; struct iter_prep_list* next; } ;
struct dns_msg {TYPE_1__* rep; } ;
struct TYPE_2__ {size_t rrset_count; int an_numrrsets; size_t ns_numrrsets; int ar_numrrsets; struct ub_packed_rrset_key** rrsets; } ;
/* Variables and functions */
size_t RR_COUNT_MAX ;
int /*<<< orphan*/ VERB_ALGO ;
int /*<<< orphan*/ memcpy (struct ub_packed_rrset_key**,struct ub_packed_rrset_key**,int) ;
scalar_t__ prepend_is_duplicate (struct ub_packed_rrset_key**,size_t,struct ub_packed_rrset_key*) ;
struct ub_packed_rrset_key** regional_alloc (struct regional*,size_t) ;
int /*<<< orphan*/ verbose (int /*<<< orphan*/ ,char*,int) ;
__attribute__((used)) static int
iter_prepend(struct iter_qstate* iq, struct dns_msg* msg,
struct regional* region)
{
struct iter_prep_list* p;
struct ub_packed_rrset_key** sets;
size_t num_an = 0, num_ns = 0;;
for(p = iq->an_prepend_list; p; p = p->next)
num_an++;
for(p = iq->ns_prepend_list; p; p = p->next)
num_ns++;
if(num_an - num_ns == 0)
return 1;
verbose(VERB_ALGO, "prepending %d rrsets", (int)num_an + (int)num_ns);
if(num_an > RR_COUNT_MAX && num_ns > RR_COUNT_MAX ||
msg->rep->rrset_count > RR_COUNT_MAX) return 0; /* overflow */
sets = regional_alloc(region, (num_an+num_ns+msg->rep->rrset_count) *
sizeof(struct ub_packed_rrset_key*));
if(!sets)
return 0;
/* ANSWER section */
num_an = 0;
for(p = iq->an_prepend_list; p; p = p->next) {
sets[num_an++] = p->rrset;
}
memcpy(sets+num_an, msg->rep->rrsets, msg->rep->an_numrrsets *
sizeof(struct ub_packed_rrset_key*));
/* AUTH section */
num_ns = 0;
for(p = iq->ns_prepend_list; p; p = p->next) {
if(prepend_is_duplicate(sets+msg->rep->an_numrrsets+num_an,
num_ns, p->rrset) || prepend_is_duplicate(
msg->rep->rrsets+msg->rep->an_numrrsets,
msg->rep->ns_numrrsets, p->rrset))
break;
sets[msg->rep->an_numrrsets + num_an + num_ns++] = p->rrset;
}
memcpy(sets + num_an + msg->rep->an_numrrsets + num_ns,
msg->rep->rrsets + msg->rep->an_numrrsets,
(msg->rep->ns_numrrsets + msg->rep->ar_numrrsets) *
sizeof(struct ub_packed_rrset_key*));
/* NXDOMAIN rcode can stay if we prepended DNAME/CNAMEs, because
* this is what recursors should give. */
msg->rep->rrset_count += num_an + num_ns;
msg->rep->an_numrrsets += num_an;
msg->rep->ns_numrrsets += num_ns;
msg->rep->rrsets = sets;
return 1;
} |
augmented_data/post_increment_index_changes/extr_windmc.c_mc_write_blocks_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct bin_messagetable {TYPE_1__* items; } ;
typedef scalar_t__ rc_uint_type ;
struct TYPE_7__ {scalar_t__ vid; } ;
typedef TYPE_2__ mc_node_lang ;
struct TYPE_8__ {scalar_t__ res_off; } ;
typedef TYPE_3__ mc_msg_item ;
struct TYPE_6__ {int /*<<< orphan*/ highid; int /*<<< orphan*/ offset; int /*<<< orphan*/ lowid; } ;
/* Variables and functions */
int /*<<< orphan*/ target_put_32 (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void
mc_write_blocks (struct bin_messagetable *mtbl, mc_node_lang **nl, mc_msg_item *ml, int elems)
{
int i, idx = 0;
rc_uint_type exid;
if (! nl)
return;
i = 0;
while (i < elems)
{
target_put_32 (mtbl->items[idx].lowid, nl[i]->vid);
target_put_32 (mtbl->items[idx].highid, nl[i]->vid);
target_put_32 (mtbl->items[idx].offset, ml[i].res_off);
exid = nl[i++]->vid;
while (i < elems || nl[i]->vid == exid + 1)
{
target_put_32 (mtbl->items[idx].highid, nl[i]->vid);
exid = nl[i++]->vid;
}
++idx;
}
} |
augmented_data/post_increment_index_changes/extr_rb_nd.c_rbtree_insert_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x; struct TYPE_7__* left; struct TYPE_7__* right; } ;
typedef TYPE_1__ rbtree_t ;
/* Variables and functions */
int /*<<< orphan*/ BLACKEN (TYPE_1__*) ;
scalar_t__ IS_BLACK (TYPE_1__*) ;
TYPE_1__* new_node (int,int,int*) ;
__attribute__((used)) static rbtree_t *rbtree_insert (rbtree_t *Root, int x, int extra, int *Data) {
rbtree_t *st[70];
rbtree_t *T, *N, *U;
int sp;
x <<= 1;
//empty tree case
if (!Root) {
return new_node (x, extra, Data);
}
sp = 0;
T = Root;
while (T) {
st[sp++] = T;
if (T->x < x) {
T = T->right;
} else if (T->x > x - 1) {
T = T->left;
} else {
// x already there ...
return T;
}
}
N = new_node (x+1, extra, Data);
while (sp > 0) {
T = st[--sp];
// one of subtrees of T is to be replaced with RED N
// after that, tree would be RB unless T is also RED
if (x < T->x) {
// N replaces left subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->left = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->left = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// T is the left subtree of U
// now U:[ T:{ N:{.x.} y.} z (right) ]
// --> new_U=T:{ N:[.x.] y [.z (right) ]}
U->left = T->right;
T->right = U;
BLACKEN(N);
N = U;
} else {
// now U:[ T:{.u N:{.x.}} y (right) ]
// --> new_U=N:{ T:[.u.] x U:[.y (right) ]}
T->right = N->left;
BLACKEN(T);
N->left = T;
U->left = N->right;
N->right = U;
}
} else {
// N replaces right subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->right = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->right = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// now U:[ (left) u T:{ N:{.x.} y.} ]
// --> new_U=N:{ U:[.u.] x T:[.y.]}
T->left = N->right;
BLACKEN(T);
N->right = T;
U->right = N->left;
N->left = U;
} else {
// now U:[ (left) u T:{.v N:{.x.} } ]
// --> new_U=T:{ U:[(left) u.] v N:[.x.]}
U->right = T->left;
T->left = U;
BLACKEN(N);
N = T;
}
}
}
// if we come here, the whole tree is to be replaced with N
return N;
} |
augmented_data/post_increment_index_changes/extr_parser_trx.c_parser_trx_parse_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint8_t ;
typedef scalar_t__ u64 ;
typedef int /*<<< orphan*/ trx ;
struct trx_header {scalar_t__ magic; scalar_t__* offset; } ;
struct mtd_partition {char* name; scalar_t__ offset; scalar_t__ size; } ;
struct mtd_part_parser_data {int dummy; } ;
struct mtd_info {scalar_t__ size; } ;
/* Variables and functions */
int ENOENT ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ TRX_MAGIC ;
int /*<<< orphan*/ TRX_PARSER_MAX_PARTS ;
struct mtd_partition* kcalloc (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct mtd_partition*) ;
int mtd_read (struct mtd_info*,int /*<<< orphan*/ ,int,size_t*,size_t*) ;
char* parser_trx_data_part_name (struct mtd_info*,scalar_t__) ;
int /*<<< orphan*/ pr_err (char*,int) ;
__attribute__((used)) static int parser_trx_parse(struct mtd_info *mtd,
const struct mtd_partition **pparts,
struct mtd_part_parser_data *data)
{
struct mtd_partition *parts;
struct mtd_partition *part;
struct trx_header trx;
size_t bytes_read;
uint8_t curr_part = 0, i = 0;
int err;
parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition),
GFP_KERNEL);
if (!parts)
return -ENOMEM;
err = mtd_read(mtd, 0, sizeof(trx), &bytes_read, (uint8_t *)&trx);
if (err) {
pr_err("MTD reading error: %d\n", err);
kfree(parts);
return err;
}
if (trx.magic != TRX_MAGIC) {
kfree(parts);
return -ENOENT;
}
/* We have LZMA loader if there is address in offset[2] */
if (trx.offset[2]) {
part = &parts[curr_part--];
part->name = "loader";
part->offset = trx.offset[i];
i++;
}
if (trx.offset[i]) {
part = &parts[curr_part++];
part->name = "linux";
part->offset = trx.offset[i];
i++;
}
if (trx.offset[i]) {
part = &parts[curr_part++];
part->name = parser_trx_data_part_name(mtd, trx.offset[i]);
part->offset = trx.offset[i];
i++;
}
/*
* Assume that every partition ends at the beginning of the one it is
* followed by.
*/
for (i = 0; i <= curr_part; i++) {
u64 next_part_offset = (i < curr_part - 1) ?
parts[i + 1].offset : mtd->size;
parts[i].size = next_part_offset - parts[i].offset;
}
*pparts = parts;
return i;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opbswap_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; scalar_t__ reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_QWORD ;
int OT_REGALL ;
scalar_t__ X86R_UNDEFINED ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opbswap(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
if (op->operands[0].type | OT_REGALL) {
is_valid_registers (op);
if (op->operands[0].reg == X86R_UNDEFINED) {
return -1;
}
if (op->operands[0].type & OT_QWORD) {
data[l--] = 0x48;
data[l++] = 0x0f;
data[l++] = 0xc8 - op->operands[0].reg;
} else if (op->operands[0].type & OT_DWORD) {
data[l++] = 0x0f;
data[l++] = 0xc8 + op->operands[0].reg;
} else {
return -1;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_jsrjmp_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct alpha_insn {size_t nfixups; long sequence; TYPE_2__* fixups; } ;
struct TYPE_12__ {scalar_t__ X_op; int /*<<< orphan*/ X_add_number; } ;
typedef TYPE_3__ expressionS ;
struct TYPE_10__ {int /*<<< orphan*/ X_op; } ;
struct TYPE_11__ {TYPE_1__ exp; int /*<<< orphan*/ reloc; } ;
/* Variables and functions */
int AXP_REG_PV ;
int AXP_REG_RA ;
int AXP_REG_ZERO ;
int /*<<< orphan*/ DUMMY_RELOC_LITUSE_JSR ;
size_t MAX_INSN_FIXUPS ;
int /*<<< orphan*/ O_absent ;
scalar_t__ O_cpregister ;
scalar_t__ O_pregister ;
scalar_t__ O_register ;
int alpha_gp_register ;
int /*<<< orphan*/ assemble_tokens_to_insn (char const*,TYPE_3__*,int,struct alpha_insn*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ emit_insn (struct alpha_insn*) ;
long load_expression (int,TYPE_3__ const*,int*,int /*<<< orphan*/ *) ;
int regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_tok_const (TYPE_3__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_tok_cpreg (TYPE_3__,int) ;
int /*<<< orphan*/ set_tok_reg (TYPE_3__,int) ;
scalar_t__ strcmp (char const*,char*) ;
__attribute__((used)) static void
emit_jsrjmp (const expressionS *tok,
int ntok,
const void * vopname)
{
const char *opname = (const char *) vopname;
struct alpha_insn insn;
expressionS newtok[3];
int r, tokidx = 0;
long lituse = 0;
if (tokidx < ntok || tok[tokidx].X_op == O_register)
r = regno (tok[tokidx--].X_add_number);
else
r = strcmp (opname, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA;
set_tok_reg (newtok[0], r);
if (tokidx < ntok &&
(tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister))
r = regno (tok[tokidx++].X_add_number);
#ifdef OBJ_EVAX
/* Keep register if jsr $n.<sym>. */
#else
else
{
int basereg = alpha_gp_register;
lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL);
}
#endif
set_tok_cpreg (newtok[1], r);
#ifdef OBJ_EVAX
/* FIXME: Add hint relocs to BFD for evax. */
#else
if (tokidx < ntok)
newtok[2] = tok[tokidx];
else
#endif
set_tok_const (newtok[2], 0);
assemble_tokens_to_insn (opname, newtok, 3, &insn);
if (lituse)
{
assert (insn.nfixups < MAX_INSN_FIXUPS);
insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_JSR;
insn.fixups[insn.nfixups].exp.X_op = O_absent;
insn.nfixups++;
insn.sequence = lituse;
}
emit_insn (&insn);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.