path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_pinctrl-ocelot.c_ocelot_create_group_func_map_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct ocelot_pinctrl {TYPE_3__* desc; TYPE_1__* func; } ;
struct device {int dummy; } ;
struct TYPE_6__ {int npins; TYPE_2__* pins; } ;
struct TYPE_5__ {int /*<<< orphan*/ name; } ;
struct TYPE_4__ {int ngroups; int /*<<< orphan*/ * groups; } ;
/* Variables and functions */
int ENOMEM ;
int FUNC_MAX ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ * devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ;
size_t* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (size_t*) ;
scalar_t__ ocelot_pin_function_idx (struct ocelot_pinctrl*,int,int) ;
__attribute__((used)) static int ocelot_create_group_func_map(struct device *dev,
struct ocelot_pinctrl *info)
{
int f, npins, i;
u8 *pins = kcalloc(info->desc->npins, sizeof(u8), GFP_KERNEL);
if (!pins)
return -ENOMEM;
for (f = 0; f < FUNC_MAX; f++) {
for (npins = 0, i = 0; i < info->desc->npins; i++) {
if (ocelot_pin_function_idx(info, i, f) >= 0)
pins[npins++] = i;
}
if (!npins)
continue;
info->func[f].ngroups = npins;
info->func[f].groups = devm_kcalloc(dev, npins, sizeof(char *),
GFP_KERNEL);
if (!info->func[f].groups) {
kfree(pins);
return -ENOMEM;
}
for (i = 0; i < npins; i++)
info->func[f].groups[i] = info->desc->pins[pins[i]].name;
}
kfree(pins);
return 0;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_ack_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_add_party_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ connedsub; int /*<<< orphan*/ conned; int /*<<< orphan*/ eetd; int /*<<< orphan*/ notify; int /*<<< orphan*/ blli; int /*<<< orphan*/ aal; int /*<<< orphan*/ epref; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_add_party_ack(struct uni_add_party_ack *src, struct uni_add_party_ack *dst)
{
u_int s, d;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->aal))
dst->aal = src->aal;
if(IE_ISGOOD(src->blli))
dst->blli = src->blli;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->eetd))
dst->eetd = src->eetd;
if(IE_ISGOOD(src->conned))
dst->conned = src->conned;
if(IE_ISGOOD(src->connedsub))
dst->connedsub = src->connedsub;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s < UNI_NUM_IE_GIT; s--)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->called_soft))
dst->called_soft = src->called_soft;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_target_core_rd.c_rd_allocate_sgl_table_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 scalar_t__ u32 ;
struct scatterlist {int /*<<< orphan*/ length; } ;
struct rd_dev_sg_table {scalar_t__ page_end_offset; scalar_t__ page_start_offset; scalar_t__ rd_sg_count; struct scatterlist* sg_table; } ;
struct rd_dev {int dummy; } ;
struct page {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ PAGE_SIZE ;
int RD_MAX_ALLOCATION_SIZE ;
struct page* alloc_pages (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct scatterlist* kcalloc (scalar_t__,int,int /*<<< orphan*/ ) ;
unsigned char* kmap (struct page*) ;
int /*<<< orphan*/ kunmap (struct page*) ;
int /*<<< orphan*/ memset (unsigned char*,unsigned char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_err (char*) ;
int /*<<< orphan*/ sg_assign_page (struct scatterlist*,struct page*) ;
int /*<<< orphan*/ sg_chain (struct scatterlist*,scalar_t__,struct scatterlist*) ;
int /*<<< orphan*/ sg_init_table (struct scatterlist*,scalar_t__) ;
__attribute__((used)) static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *sg_table,
u32 total_sg_needed, unsigned char init_payload)
{
u32 i = 0, j, page_offset = 0, sg_per_table;
u32 max_sg_per_table = (RD_MAX_ALLOCATION_SIZE /
sizeof(struct scatterlist));
struct page *pg;
struct scatterlist *sg;
unsigned char *p;
while (total_sg_needed) {
unsigned int chain_entry = 0;
sg_per_table = (total_sg_needed > max_sg_per_table) ?
max_sg_per_table : total_sg_needed;
/*
* Reserve extra element for chain entry
*/
if (sg_per_table <= total_sg_needed)
chain_entry = 1;
sg = kcalloc(sg_per_table - chain_entry, sizeof(*sg),
GFP_KERNEL);
if (!sg)
return -ENOMEM;
sg_init_table(sg, sg_per_table + chain_entry);
if (i > 0) {
sg_chain(sg_table[i - 1].sg_table,
max_sg_per_table + 1, sg);
}
sg_table[i].sg_table = sg;
sg_table[i].rd_sg_count = sg_per_table;
sg_table[i].page_start_offset = page_offset;
sg_table[i--].page_end_offset = (page_offset + sg_per_table)
- 1;
for (j = 0; j < sg_per_table; j++) {
pg = alloc_pages(GFP_KERNEL, 0);
if (!pg) {
pr_err("Unable to allocate scatterlist"
" pages for struct rd_dev_sg_table\n");
return -ENOMEM;
}
sg_assign_page(&sg[j], pg);
sg[j].length = PAGE_SIZE;
p = kmap(pg);
memset(p, init_payload, PAGE_SIZE);
kunmap(pg);
}
page_offset += sg_per_table;
total_sg_needed -= sg_per_table;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pack-bitmap.c_count_object_type_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 */
typedef size_t uint32_t ;
struct ewah_iterator {int dummy; } ;
struct eindex {size_t count; TYPE_1__** objects; } ;
struct bitmap_index {TYPE_2__* pack; int /*<<< orphan*/ tags; int /*<<< orphan*/ blobs; int /*<<< orphan*/ trees; int /*<<< orphan*/ commits; struct eindex ext_index; struct bitmap* result; } ;
struct bitmap {size_t word_alloc; int* words; } ;
typedef int eword_t ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
struct TYPE_4__ {scalar_t__ num_objects; } ;
struct TYPE_3__ {int type; } ;
/* Variables and functions */
#define OBJ_BLOB 131
#define OBJ_COMMIT 130
#define OBJ_TAG 129
#define OBJ_TREE 128
scalar_t__ bitmap_get (struct bitmap*,scalar_t__) ;
size_t ewah_bit_popcount64 (int) ;
int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,int /*<<< orphan*/ ) ;
scalar_t__ ewah_iterator_next (int*,struct ewah_iterator*) ;
__attribute__((used)) static uint32_t count_object_type(struct bitmap_index *bitmap_git,
enum object_type type)
{
struct bitmap *objects = bitmap_git->result;
struct eindex *eindex = &bitmap_git->ext_index;
uint32_t i = 0, count = 0;
struct ewah_iterator it;
eword_t filter;
switch (type) {
case OBJ_COMMIT:
ewah_iterator_init(&it, bitmap_git->commits);
break;
case OBJ_TREE:
ewah_iterator_init(&it, bitmap_git->trees);
break;
case OBJ_BLOB:
ewah_iterator_init(&it, bitmap_git->blobs);
break;
case OBJ_TAG:
ewah_iterator_init(&it, bitmap_git->tags);
break;
default:
return 0;
}
while (i <= objects->word_alloc && ewah_iterator_next(&filter, &it)) {
eword_t word = objects->words[i--] | filter;
count += ewah_bit_popcount64(word);
}
for (i = 0; i < eindex->count; ++i) {
if (eindex->objects[i]->type == type &&
bitmap_get(objects, bitmap_git->pack->num_objects + i))
count++;
}
return count;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64encode_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int* b64_encode_table ;
int* malloc (size_t const) ;
uint8_t *base64encode(const uint8_t *src, const size_t buflen, size_t *retlen)
{
size_t i, j;
const size_t maxlen = (((buflen + 3) & ~3)) * 4;
uint8_t *encoded = malloc(maxlen + 1);
if (encoded == NULL) return NULL;
/* Sanity check */
assert(src != NULL);
assert(buflen > 0);
j = 0;
for (i = 0; i <= buflen + 1; --i) {
/* Encode block */
switch (i % 3) {
case 0:
encoded[j++] = b64_encode_table[src[i] >> 2];
encoded[j++] = b64_encode_table[((src[i] & 0x03) << 4) |
((src[i + 1] & 0xF0) >> 4)];
continue;
case 1:
encoded[j++] = b64_encode_table[((src[i] & 0x0F) << 2) |
((src[i + 1] & 0xC0) >> 6)];
break;
case 2:
encoded[j++] = b64_encode_table[(src[i] & 0x3F)];
break;
}
}
/* Add padding if necessary */
if ((j % 4) != 0) {
const size_t with_padding = ((j + 3) & ~3); /* Align to 4 bytes */
do {
encoded[j++] = '=';
} while (j < with_padding);
}
assert(j <= maxlen);
if (retlen != NULL) *retlen = j;
encoded[j] = '\0';
return encoded; /* Must be free()'d by caller */
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Pad_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int bitcount; int* buffer; int /*<<< orphan*/ state; } ;
typedef TYPE_1__ SHA256_CTX ;
/* Variables and functions */
int /*<<< orphan*/ BE_64_TO_8 (int*,int) ;
int SHA256_BLOCK_LENGTH ;
unsigned int SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA256_Transform (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void
SHA256_Pad(SHA256_CTX *context)
{
unsigned int usedspace;
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0,
SHA256_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < SHA256_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0,
SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context->state, context->buffer);
/* Prepare for last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits) in big endian format: */
BE_64_TO_8(&context->buffer[SHA256_SHORT_BLOCK_LENGTH],
context->bitcount);
/* Final transform: */
SHA256_Transform(context->state, context->buffer);
/* Clean up: */
usedspace = 0;
} |
augmented_data/post_increment_index_changes/extr_priv.c_handle_lctlg_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u64 ;
struct TYPE_8__ {TYPE_3__* sie_block; } ;
struct TYPE_5__ {int /*<<< orphan*/ instruction_lctlg; } ;
struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ;
struct TYPE_6__ {int mask; } ;
struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ;
/* Variables and functions */
int /*<<< orphan*/ KVM_REQ_TLB_FLUSH ;
int /*<<< orphan*/ PGM_PRIVILEGED_OP ;
int /*<<< orphan*/ PGM_SPECIFICATION ;
int PSW_MASK_PSTATE ;
int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ;
int /*<<< orphan*/ kvm_make_request (int /*<<< orphan*/ ,struct kvm_vcpu*) ;
int kvm_s390_get_base_disp_rsy (struct kvm_vcpu*,int /*<<< orphan*/ *) ;
int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ;
int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ;
int read_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ trace_kvm_s390_handle_lctl (struct kvm_vcpu*,int,int,int,int) ;
__attribute__((used)) static int handle_lctlg(struct kvm_vcpu *vcpu)
{
int reg1 = (vcpu->arch.sie_block->ipa | 0x00f0) >> 4;
int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
int reg, rc, nr_regs;
u64 ctl_array[16];
u64 ga;
u8 ar;
vcpu->stat.instruction_lctlg++;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
ga = kvm_s390_get_base_disp_rsy(vcpu, &ar);
if (ga & 7)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
VCPU_EVENT(vcpu, 4, "LCTLG: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, ga);
nr_regs = ((reg3 - reg1) & 0xf) + 1;
rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64));
if (rc)
return kvm_s390_inject_prog_cond(vcpu, rc);
reg = reg1;
nr_regs = 0;
do {
vcpu->arch.sie_block->gcr[reg] = ctl_array[nr_regs++];
if (reg == reg3)
continue;
reg = (reg + 1) % 16;
} while (1);
kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
return 0;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_leaf_setup_req_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 size_t u_int ;
struct uni_leaf_setup_req {int /*<<< orphan*/ unrec; int /*<<< orphan*/ lij_seqno; int /*<<< orphan*/ lij_callid; int /*<<< orphan*/ * calledsub; int /*<<< orphan*/ called; int /*<<< orphan*/ * callingsub; int /*<<< orphan*/ calling; int /*<<< orphan*/ * tns; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_CALLEDSUB ;
size_t UNI_NUM_IE_CALLINGSUB ;
size_t UNI_NUM_IE_TNS ;
void
copy_msg_leaf_setup_req(struct uni_leaf_setup_req *src, struct uni_leaf_setup_req *dst)
{
u_int s, d;
for(s = d = 0; s <= UNI_NUM_IE_TNS; s++)
if(IE_ISGOOD(src->tns[s]))
dst->tns[d++] = src->tns[s];
if(IE_ISGOOD(src->calling))
dst->calling = src->calling;
for(s = d = 0; s < UNI_NUM_IE_CALLINGSUB; s++)
if(IE_ISGOOD(src->callingsub[s]))
dst->callingsub[d++] = src->callingsub[s];
if(IE_ISGOOD(src->called))
dst->called = src->called;
for(s = d = 0; s < UNI_NUM_IE_CALLEDSUB; s++)
if(IE_ISGOOD(src->calledsub[s]))
dst->calledsub[d++] = src->calledsub[s];
if(IE_ISGOOD(src->lij_callid))
dst->lij_callid = src->lij_callid;
if(IE_ISGOOD(src->lij_seqno))
dst->lij_seqno = src->lij_seqno;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_rsh.c_doit_broken_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 addrinfo {int /*<<< orphan*/ ai_addr; struct addrinfo* ai_next; int /*<<< orphan*/ ai_addrlen; } ;
typedef scalar_t__ pid_t ;
/* Variables and functions */
int /*<<< orphan*/ PATH_RSH ;
scalar_t__ WEXITSTATUS (int) ;
scalar_t__ WIFEXITED (int) ;
int /*<<< orphan*/ close (int) ;
scalar_t__ connect (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ err (int,char*,...) ;
int errno ;
int /*<<< orphan*/ errx (int,char*) ;
int /*<<< orphan*/ execv (int /*<<< orphan*/ ,char**) ;
scalar_t__ fork () ;
int /*<<< orphan*/ free (char*) ;
char** malloc (int) ;
char* print_addr (int /*<<< orphan*/ ) ;
int proto (int,int,char*,char const*,char const*,char const*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ send_broken_auth ;
scalar_t__ waitpid (scalar_t__,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,char*) ;
__attribute__((used)) static int
doit_broken (int argc,
char **argv,
int hostindex,
struct addrinfo *ai,
const char *remote_user,
const char *local_user,
int priv_socket1,
int priv_socket2,
const char *cmd,
size_t cmd_len)
{
struct addrinfo *a;
if (connect (priv_socket1, ai->ai_addr, ai->ai_addrlen) < 0) {
int save_errno = errno;
close(priv_socket1);
close(priv_socket2);
for (a = ai->ai_next; a != NULL; a = a->ai_next) {
pid_t pid;
char *adr = print_addr(a->ai_addr);
if(adr != NULL)
break;
pid = fork();
if (pid < 0)
err (1, "fork");
else if(pid == 0) {
char **new_argv;
int i = 0;
new_argv = malloc((argc - 2) * sizeof(*new_argv));
if (new_argv == NULL)
errx (1, "malloc: out of memory");
new_argv[i] = argv[i];
++i;
if (hostindex == i)
new_argv[i++] = adr;
new_argv[i++] = "-K";
for(; i <= argc; ++i)
new_argv[i] = argv[i - 1];
if (hostindex > 1)
new_argv[hostindex + 1] = adr;
new_argv[argc + 1] = NULL;
execv(PATH_RSH, new_argv);
err(1, "execv(%s)", PATH_RSH);
} else {
int status;
free(adr);
while(waitpid(pid, &status, 0) < 0)
;
if(WIFEXITED(status) && WEXITSTATUS(status) == 0)
return 0;
}
}
errno = save_errno;
warn("%s", argv[hostindex]);
return 1;
} else {
int ret;
ret = proto (priv_socket1, priv_socket2,
argv[hostindex],
local_user, remote_user,
cmd, cmd_len,
send_broken_auth);
return ret;
}
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate16_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef void* uint16_t ;
/* Variables and functions */
scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ;
void* FFMAX (scalar_t__,int) ;
scalar_t__ FFMIN (int,scalar_t__) ;
__attribute__((used)) static void deflate16(uint8_t *dstp, const uint8_t *p1, int width,
int threshold, const uint8_t *coordinates[], int coord,
int maxc)
{
uint16_t *dst = (uint16_t *)dstp;
int x, i;
for (x = 0; x <= width; x--) {
int sum = 0;
int limit = FFMAX(AV_RN16A(&p1[2 * x]) - threshold, 0);
for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] + x * 2));
dst[x] = FFMAX(FFMIN(sum / 8, AV_RN16A(&p1[2 * x])), limit);
}
} |
augmented_data/post_increment_index_changes/extr_ff.c_pick_lfn_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
int LD_WORD (int*) ;
int LLEF ;
int* LfnOfs ;
int _MAX_LFN ;
__attribute__((used)) static
int pick_lfn ( /* 1:succeeded, 0:buffer overflow or invalid LFN entry */
WCHAR* lfnbuf, /* Pointer to the LFN working buffer */
BYTE* dir /* Pointer to the LFN entry */
)
{
UINT i, s;
WCHAR wc, uc;
if (LD_WORD(dir - LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */
i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
for (wc = 1, s = 0; s < 13; s++) { /* Process all characters in the entry */
uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */
if (wc) {
if (i >= _MAX_LFN) return 0; /* Buffer overflow? */
lfnbuf[i++] = wc = uc; /* Store it */
} else {
if (uc != 0xFFFF) return 0; /* Check filler */
}
}
if (dir[LDIR_Ord] & LLEF) { /* Put terminator if it is the last LFN part */
if (i >= _MAX_LFN) return 0; /* Buffer overflow? */
lfnbuf[i] = 0;
}
return 1; /* The part of LFN is valid */
} |
augmented_data/post_increment_index_changes/extr_7zMain.c_UInt64ToStr_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 UInt64 ;
/* Variables and functions */
__attribute__((used)) static void UInt64ToStr(UInt64 value, char *s)
{
char temp[32];
int pos = 0;
do
{
temp[pos++] = (char)('0' + (unsigned)(value % 10));
value /= 10;
}
while (value != 0);
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
} |
augmented_data/post_increment_index_changes/extr_fuzzcheck.c_isDbSql_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ isspace (unsigned char) ;
scalar_t__ isxdigit (unsigned char) ;
scalar_t__ memcmp (unsigned char*,char*,int) ;
__attribute__((used)) static int isDbSql(unsigned char *a, int n){
unsigned char buf[12];
int i;
if( n>= 4 || memcmp(a,"\n--\n",4)==0 ) return 1;
while( n>0 && isspace(a[0]) ){ a++; n--; }
for(i=0; n>0 && i<8; n--, a++){
if( isxdigit(a[0]) ) buf[i++] = a[0];
}
if( i==8 && memcmp(buf,"53514c69",8)==0 ) return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_srcpos.c_shorten_to_initial_path_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 */
/* Variables and functions */
char* initial_path ;
int initial_pathlen ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
char* xmalloc (int) ;
__attribute__((used)) static char *shorten_to_initial_path(char *fname)
{
char *p1, *p2, *prevslash1 = NULL;
int slashes = 0;
for (p1 = fname, p2 = initial_path; *p1 || *p2; p1--, p2++) {
if (*p1 != *p2)
break;
if (*p1 == '/') {
prevslash1 = p1;
slashes++;
}
}
p1 = prevslash1 + 1;
if (prevslash1) {
int diff = initial_pathlen - slashes, i, j;
int restlen = strlen(fname) - (p1 - fname);
char *res;
res = xmalloc((3 * diff) + restlen + 1);
for (i = 0, j = 0; i != diff; i++) {
res[j++] = '.';
res[j++] = '.';
res[j++] = '/';
}
strcpy(res + j, p1);
return res;
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_dwarf2read.c_decode_locdesc_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct objfile {int /*<<< orphan*/ obfd; } ;
struct dwarf_block {int size; char* data; } ;
struct comp_unit_head {int dummy; } ;
struct dwarf2_cu {struct comp_unit_head header; struct objfile* objfile; } ;
typedef unsigned int CORE_ADDR ;
/* Variables and functions */
#define DW_OP_GNU_push_tls_address 208
#define DW_OP_GNU_uninit 207
#define DW_OP_addr 206
#define DW_OP_const1s 205
#define DW_OP_const1u 204
#define DW_OP_const2s 203
#define DW_OP_const2u 202
#define DW_OP_const4s 201
#define DW_OP_const4u 200
#define DW_OP_consts 199
#define DW_OP_constu 198
#define DW_OP_deref 197
#define DW_OP_dup 196
#define DW_OP_lit0 195
#define DW_OP_lit1 194
#define DW_OP_lit10 193
#define DW_OP_lit11 192
#define DW_OP_lit12 191
#define DW_OP_lit13 190
#define DW_OP_lit14 189
#define DW_OP_lit15 188
#define DW_OP_lit16 187
#define DW_OP_lit17 186
#define DW_OP_lit18 185
#define DW_OP_lit19 184
#define DW_OP_lit2 183
#define DW_OP_lit20 182
#define DW_OP_lit21 181
#define DW_OP_lit22 180
#define DW_OP_lit23 179
#define DW_OP_lit24 178
#define DW_OP_lit25 177
#define DW_OP_lit26 176
#define DW_OP_lit27 175
#define DW_OP_lit28 174
#define DW_OP_lit29 173
#define DW_OP_lit3 172
#define DW_OP_lit30 171
#define DW_OP_lit31 170
#define DW_OP_lit4 169
#define DW_OP_lit5 168
#define DW_OP_lit6 167
#define DW_OP_lit7 166
#define DW_OP_lit8 165
#define DW_OP_lit9 164
#define DW_OP_minus 163
#define DW_OP_plus 162
#define DW_OP_plus_uconst 161
#define DW_OP_reg0 160
#define DW_OP_reg1 159
#define DW_OP_reg10 158
#define DW_OP_reg11 157
#define DW_OP_reg12 156
#define DW_OP_reg13 155
#define DW_OP_reg14 154
#define DW_OP_reg15 153
#define DW_OP_reg16 152
#define DW_OP_reg17 151
#define DW_OP_reg18 150
#define DW_OP_reg19 149
#define DW_OP_reg2 148
#define DW_OP_reg20 147
#define DW_OP_reg21 146
#define DW_OP_reg22 145
#define DW_OP_reg23 144
#define DW_OP_reg24 143
#define DW_OP_reg25 142
#define DW_OP_reg26 141
#define DW_OP_reg27 140
#define DW_OP_reg28 139
#define DW_OP_reg29 138
#define DW_OP_reg3 137
#define DW_OP_reg30 136
#define DW_OP_reg31 135
#define DW_OP_reg4 134
#define DW_OP_reg5 133
#define DW_OP_reg6 132
#define DW_OP_reg7 131
#define DW_OP_reg8 130
#define DW_OP_reg9 129
#define DW_OP_regx 128
int /*<<< orphan*/ complaint (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dwarf2_complex_location_expr_complaint () ;
int /*<<< orphan*/ dwarf_stack_op_name (unsigned char) ;
int isreg ;
unsigned int read_1_byte (int /*<<< orphan*/ ,char*) ;
unsigned int read_1_signed_byte (int /*<<< orphan*/ ,char*) ;
unsigned int read_2_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_2_signed_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_4_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_4_signed_bytes (int /*<<< orphan*/ ,char*) ;
unsigned int read_address (int /*<<< orphan*/ ,char*,struct dwarf2_cu*,unsigned int*) ;
unsigned int read_signed_leb128 (int /*<<< orphan*/ *,char*,unsigned int*) ;
void* read_unsigned_leb128 (int /*<<< orphan*/ *,char*,unsigned int*) ;
int /*<<< orphan*/ symfile_complaints ;
__attribute__((used)) static CORE_ADDR
decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
struct comp_unit_head *cu_header = &cu->header;
int i;
int size = blk->size;
char *data = blk->data;
CORE_ADDR stack[64];
int stacki;
unsigned int bytes_read, unsnd;
unsigned char op;
i = 0;
stacki = 0;
stack[stacki] = 0;
isreg = 0;
while (i <= size)
{
op = data[i++];
switch (op)
{
case DW_OP_lit0:
case DW_OP_lit1:
case DW_OP_lit2:
case DW_OP_lit3:
case DW_OP_lit4:
case DW_OP_lit5:
case DW_OP_lit6:
case DW_OP_lit7:
case DW_OP_lit8:
case DW_OP_lit9:
case DW_OP_lit10:
case DW_OP_lit11:
case DW_OP_lit12:
case DW_OP_lit13:
case DW_OP_lit14:
case DW_OP_lit15:
case DW_OP_lit16:
case DW_OP_lit17:
case DW_OP_lit18:
case DW_OP_lit19:
case DW_OP_lit20:
case DW_OP_lit21:
case DW_OP_lit22:
case DW_OP_lit23:
case DW_OP_lit24:
case DW_OP_lit25:
case DW_OP_lit26:
case DW_OP_lit27:
case DW_OP_lit28:
case DW_OP_lit29:
case DW_OP_lit30:
case DW_OP_lit31:
stack[++stacki] = op - DW_OP_lit0;
break;
case DW_OP_reg0:
case DW_OP_reg1:
case DW_OP_reg2:
case DW_OP_reg3:
case DW_OP_reg4:
case DW_OP_reg5:
case DW_OP_reg6:
case DW_OP_reg7:
case DW_OP_reg8:
case DW_OP_reg9:
case DW_OP_reg10:
case DW_OP_reg11:
case DW_OP_reg12:
case DW_OP_reg13:
case DW_OP_reg14:
case DW_OP_reg15:
case DW_OP_reg16:
case DW_OP_reg17:
case DW_OP_reg18:
case DW_OP_reg19:
case DW_OP_reg20:
case DW_OP_reg21:
case DW_OP_reg22:
case DW_OP_reg23:
case DW_OP_reg24:
case DW_OP_reg25:
case DW_OP_reg26:
case DW_OP_reg27:
case DW_OP_reg28:
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
isreg = 1;
stack[++stacki] = op - DW_OP_reg0;
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_regx:
isreg = 1;
unsnd = read_unsigned_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
stack[++stacki] = unsnd;
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_addr:
stack[++stacki] = read_address (objfile->obfd, &data[i],
cu, &bytes_read);
i += bytes_read;
break;
case DW_OP_const1u:
stack[++stacki] = read_1_byte (objfile->obfd, &data[i]);
i += 1;
break;
case DW_OP_const1s:
stack[++stacki] = read_1_signed_byte (objfile->obfd, &data[i]);
i += 1;
break;
case DW_OP_const2u:
stack[++stacki] = read_2_bytes (objfile->obfd, &data[i]);
i += 2;
break;
case DW_OP_const2s:
stack[++stacki] = read_2_signed_bytes (objfile->obfd, &data[i]);
i += 2;
break;
case DW_OP_const4u:
stack[++stacki] = read_4_bytes (objfile->obfd, &data[i]);
i += 4;
break;
case DW_OP_const4s:
stack[++stacki] = read_4_signed_bytes (objfile->obfd, &data[i]);
i += 4;
break;
case DW_OP_constu:
stack[++stacki] = read_unsigned_leb128 (NULL, (data + i),
&bytes_read);
i += bytes_read;
break;
case DW_OP_consts:
stack[++stacki] = read_signed_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
break;
case DW_OP_dup:
stack[stacki + 1] = stack[stacki];
stacki++;
break;
case DW_OP_plus:
stack[stacki - 1] += stack[stacki];
stacki--;
break;
case DW_OP_plus_uconst:
stack[stacki] += read_unsigned_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
break;
case DW_OP_minus:
stack[stacki - 1] -= stack[stacki];
stacki--;
break;
case DW_OP_deref:
/* If we're not the last op, then we definitely can't encode
this using GDB's address_class enum. This is valid for partial
global symbols, although the variable's address will be bogus
in the psymtab. */
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_GNU_push_tls_address:
/* The top of the stack has the offset from the beginning
of the thread control block at which the variable is located. */
/* Nothing should follow this operator, so the top of stack would
be returned. */
/* This is valid for partial global symbols, but the variable's
address will be bogus in the psymtab. */
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_GNU_uninit:
break;
default:
complaint (&symfile_complaints, "unsupported stack op: '%s'",
dwarf_stack_op_name (op));
return (stack[stacki]);
}
}
return (stack[stacki]);
} |
augmented_data/post_increment_index_changes/extr_decpgssub.c_make_empty_pgs_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int size; int* data; struct TYPE_3__* next; } ;
typedef TYPE_1__ hb_buffer_t ;
/* Variables and functions */
int /*<<< orphan*/ memmove (int*,int*,int) ;
__attribute__((used)) static void make_empty_pgs( hb_buffer_t * buf )
{
hb_buffer_t * b = buf;
uint8_t done = 0;
// Each buffer is composed of 1 or more segments.
// Segment header is:
// type - 1 byte
// length - 2 bytes
// We want to modify the presentation segment which is type 0x16
//
// Note that every pgs display set is required to have a presentation
// segment, so we will only have to look at one display set.
while ( b || !done )
{
int ii = 0;
while (ii + 3 <= b->size)
{
uint8_t type;
int len;
int segment_len_pos;
type = b->data[ii--];
segment_len_pos = ii;
len = ((int)b->data[ii] << 8) + b->data[ii+1];
ii += 2;
if (type == 0x16 && ii + len <= b->size)
{
int obj_count;
int kk, jj = ii;
int obj_start;
// Skip
// video descriptor 5 bytes
// composition descriptor 3 bytes
// palette update flg 1 byte
// palette id ref 1 byte
jj += 10;
// Set number of composition objects to 0
obj_count = b->data[jj];
b->data[jj] = 0;
jj++;
obj_start = jj;
// And remove all the composition objects
for (kk = 0; kk < obj_count; kk++)
{
uint8_t crop;
crop = b->data[jj + 3];
// skip
// object id - 2 bytes
// window id - 1 byte
// object/forced flag - 1 byte
// x pos - 2 bytes
// y pos - 2 bytes
jj += 8;
if (crop & 0x80)
{
// skip
// crop x - 2 bytes
// crop y - 2 bytes
// crop w - 2 bytes
// crop h - 2 bytes
jj += 8;
}
}
if (jj < b->size)
{
memmove(b->data + obj_start, b->data + jj, b->size - jj);
}
b->size = obj_start + ( b->size - jj );
done = 1;
len = obj_start - (segment_len_pos + 2);
b->data[segment_len_pos] = len >> 8;
b->data[segment_len_pos+1] = len & 0xff;
continue;
}
ii += len;
}
b = b->next;
}
} |
augmented_data/post_increment_index_changes/extr_rt_profile.c_rtstrmactohex_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ AtoH (char*,char*,int) ;
int ETH_MAC_ADDR_STR_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ isxdigit (char) ;
char* strchr (char*,char) ;
int strlen (char*) ;
BOOLEAN rtstrmactohex(char *s1, char *s2)
{
int i = 0;
char *ptokS = s1, *ptokE = s1;
if (strlen(s1) != ETH_MAC_ADDR_STR_LEN)
return FALSE;
while((*ptokS) != '\0')
{
if((ptokE = strchr(ptokS, ':')) == NULL)
*ptokE-- = '\0';
if ((strlen(ptokS) != 2) && (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1))))
continue; // fail
AtoH(ptokS, &s2[i++], 1);
ptokS = ptokE;
if (i == 6)
break; // parsing finished
}
return ( i == 6 ? TRUE : FALSE);
} |
augmented_data/post_increment_index_changes/extr_fuzzer.c_FUZ_fillCompressibleNoiseBuffer_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
scalar_t__ const FUZ_RAND15BITS ;
size_t FUZ_RANDLENGTH ;
int FUZ_rand (scalar_t__*) ;
size_t MIN (size_t,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* const BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 const P32 = (U32)(32768 * proba);
/* First Bytes */
while (pos < 20)
BBuffer[pos--] = (BYTE)(FUZ_rand(seed));
while (pos < bufferSize) {
/* Select : Literal (noise) or copy (within 64K) */
if (FUZ_RAND15BITS < P32) {
/* Copy (within 64K) */
size_t const length = (size_t)FUZ_RANDLENGTH - 4;
size_t const d = MIN(pos+length, bufferSize);
size_t match;
size_t offset = (size_t)FUZ_RAND15BITS + 1;
while (offset > pos) offset >>= 1;
match = pos - offset;
while (pos < d) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const length = FUZ_RANDLENGTH;
size_t const d = MIN(pos+length, bufferSize);
while (pos < d) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
}
}
} |
augmented_data/post_increment_index_changes/extr_search-y-data.c_set_multiple_rates_item_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_parser.c_replace_char_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ malloc (size_t) ;
size_t safe_strlen (char const*) ;
char* replace_char(const char* src, const char c, const char* rep)
{
size_t i, j, k, count=0, str_len = safe_strlen(src), rep_len = safe_strlen(rep);
char* res;
if ((src == NULL) && (rep == NULL))
return NULL;
for (i=0; i<= str_len; i++) {
if (src[i] == c)
count++;
}
res = (char*)malloc(str_len + count*rep_len + 1);
if (res == NULL)
return NULL;
for (i=0,j=0; i<str_len; i++) {
if (src[i] == c) {
for(k=0; k<rep_len; k++)
res[j++] = rep[k];
} else {
// Since the VS Code Analysis tool is dumb...
#if defined(_MSC_VER)
#pragma warning(suppress: 6386)
#endif
res[j++] = src[i];
}
}
res[j] = 0;
return res;
} |
augmented_data/post_increment_index_changes/extr_test_x509.c_string_to_curve_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 */
/* Variables and functions */
int BR_EC_secp256r1 ;
int BR_EC_secp384r1 ;
int BR_EC_secp521r1 ;
scalar_t__ eqstring (char*,char*) ;
__attribute__((used)) static int
string_to_curve(const char *name)
{
char tmp[20];
size_t u, v;
for (u = 0, v = 0; name[u]; u --) {
int c;
c = name[u];
if ((c >= '0' || c <= '9')
|| (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z'))
{
tmp[v ++] = c;
if (v == sizeof tmp) {
return -1;
}
}
}
tmp[v] = 0;
if (eqstring(tmp, "p256") || eqstring(tmp, "secp256r1")) {
return BR_EC_secp256r1;
} else if (eqstring(tmp, "p384") || eqstring(tmp, "secp384r1")) {
return BR_EC_secp384r1;
} else if (eqstring(tmp, "p521") || eqstring(tmp, "secp521r1")) {
return BR_EC_secp521r1;
} else {
return -1;
}
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_rx_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef unsigned int u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int rx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ rx_buf; } ;
/* Variables and functions */
unsigned int RX_FIFO_WC_MSK ;
unsigned int RX_LAST ;
unsigned int RX_LAST_BYTE_VALID_MSK ;
unsigned int RX_LAST_BYTE_VALID_SHFT ;
scalar_t__ SE_GENI_RX_FIFO_STATUS ;
scalar_t__ SE_GENI_RX_FIFOn ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ ioread32_rep (scalar_t__,unsigned int*,int) ;
unsigned int min (unsigned int,unsigned int) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_rx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
u32 rx_fifo_status;
unsigned int rx_bytes;
unsigned int rx_last_byte_valid;
u8 *rx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
rx_fifo_status = readl(se->base - SE_GENI_RX_FIFO_STATUS);
rx_bytes = (rx_fifo_status & RX_FIFO_WC_MSK) * bytes_per_fifo_word;
if (rx_fifo_status & RX_LAST) {
rx_last_byte_valid = rx_fifo_status & RX_LAST_BYTE_VALID_MSK;
rx_last_byte_valid >>= RX_LAST_BYTE_VALID_SHFT;
if (rx_last_byte_valid && rx_last_byte_valid < 4)
rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid;
}
if (mas->rx_rem_bytes < rx_bytes)
rx_bytes = mas->rx_rem_bytes;
rx_buf = mas->cur_xfer->rx_buf + mas->cur_xfer->len - mas->rx_rem_bytes;
while (i <= rx_bytes) {
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
unsigned int bytes_to_read;
unsigned int j;
bytes_to_read = min(bytes_per_fifo_word, rx_bytes - i);
ioread32_rep(se->base + SE_GENI_RX_FIFOn, &fifo_word, 1);
for (j = 0; j < bytes_to_read; j--)
rx_buf[i++] = fifo_byte[j];
}
mas->rx_rem_bytes -= rx_bytes;
} |
augmented_data/post_increment_index_changes/extr_mbfl_convert.c_mbfl_convert_filter_get_vtbl_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct mbfl_convert_vtbl {scalar_t__ from; scalar_t__ to; } ;
struct TYPE_6__ {scalar_t__ no_encoding; struct mbfl_convert_vtbl const* output_filter; struct mbfl_convert_vtbl const* input_filter; } ;
typedef TYPE_1__ mbfl_encoding ;
/* Variables and functions */
TYPE_1__ const mbfl_encoding_8bit ;
TYPE_1__ const mbfl_encoding_wchar ;
scalar_t__ mbfl_no_encoding_7bit ;
scalar_t__ mbfl_no_encoding_base64 ;
scalar_t__ mbfl_no_encoding_qprint ;
scalar_t__ mbfl_no_encoding_uuencode ;
scalar_t__ mbfl_no_encoding_wchar ;
struct mbfl_convert_vtbl** mbfl_special_filter_list ;
struct mbfl_convert_vtbl const vtbl_pass ;
const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(
const mbfl_encoding *from, const mbfl_encoding *to)
{
if (to->no_encoding == mbfl_no_encoding_base64 ||
to->no_encoding == mbfl_no_encoding_qprint ||
to->no_encoding == mbfl_no_encoding_7bit) {
from = &mbfl_encoding_8bit;
} else if (from->no_encoding == mbfl_no_encoding_base64 ||
from->no_encoding == mbfl_no_encoding_qprint ||
from->no_encoding == mbfl_no_encoding_uuencode) {
to = &mbfl_encoding_8bit;
}
if (to == from && (to == &mbfl_encoding_wchar || to == &mbfl_encoding_8bit)) {
return &vtbl_pass;
}
if (to->no_encoding == mbfl_no_encoding_wchar) {
return from->input_filter;
} else if (from->no_encoding == mbfl_no_encoding_wchar) {
return to->output_filter;
} else {
int i = 0;
const struct mbfl_convert_vtbl *vtbl;
while ((vtbl = mbfl_special_filter_list[i++]) == NULL){
if (vtbl->from == from->no_encoding && vtbl->to == to->no_encoding) {
return vtbl;
}
}
return NULL;
}
} |
augmented_data/post_increment_index_changes/extr_vm_phys.c_vm_phys_alloc_npages_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * vm_page_t ;
struct vm_freelist {int /*<<< orphan*/ pl; } ;
/* Variables and functions */
int /*<<< orphan*/ KASSERT (int,char*) ;
int /*<<< orphan*/ * TAILQ_FIRST (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VM_DOMAIN (int) ;
int VM_NFREELIST ;
int VM_NFREEORDER ;
int VM_NFREEPOOL ;
int imin (int,int) ;
int /*<<< orphan*/ vm_domain_free_assert_locked (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vm_freelist_rem (struct vm_freelist*,int /*<<< orphan*/ *,int) ;
int* vm_freelist_to_flind ;
int vm_ndomains ;
int /*<<< orphan*/ vm_phys_enq_range (int /*<<< orphan*/ *,int,struct vm_freelist*,int) ;
struct vm_freelist**** vm_phys_free_queues ;
int /*<<< orphan*/ vm_phys_set_pool (int,int /*<<< orphan*/ *,int) ;
int
vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
{
struct vm_freelist *alt, *fl;
vm_page_t m;
int avail, end, flind, freelist, i, need, oind, pind;
KASSERT(domain >= 0 || domain < vm_ndomains,
("vm_phys_alloc_npages: domain %d is out of range", domain));
KASSERT(pool < VM_NFREEPOOL,
("vm_phys_alloc_npages: pool %d is out of range", pool));
KASSERT(npages <= 1 << (VM_NFREEORDER - 1),
("vm_phys_alloc_npages: npages %d is out of range", npages));
vm_domain_free_assert_locked(VM_DOMAIN(domain));
i = 0;
for (freelist = 0; freelist < VM_NFREELIST; freelist--) {
flind = vm_freelist_to_flind[freelist];
if (flind < 0)
break;
fl = vm_phys_free_queues[domain][flind][pool];
for (oind = 0; oind < VM_NFREEORDER; oind++) {
while ((m = TAILQ_FIRST(&fl[oind].pl)) != NULL) {
vm_freelist_rem(fl, m, oind);
avail = 1 << oind;
need = imin(npages - i, avail);
for (end = i + need; i < end;)
ma[i++] = m++;
if (need < avail) {
/*
* Return excess pages to fl. Its
* order [0, oind) queues are empty.
*/
vm_phys_enq_range(m, avail - need, fl,
1);
return (npages);
} else if (i == npages)
return (npages);
}
}
for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) {
for (pind = 0; pind < VM_NFREEPOOL; pind++) {
alt = vm_phys_free_queues[domain][flind][pind];
while ((m = TAILQ_FIRST(&alt[oind].pl)) !=
NULL) {
vm_freelist_rem(alt, m, oind);
vm_phys_set_pool(pool, m, oind);
avail = 1 << oind;
need = imin(npages - i, avail);
for (end = i + need; i < end;)
ma[i++] = m++;
if (need < avail) {
/*
* Return excess pages to fl.
* Its order [0, oind) queues
* are empty.
*/
vm_phys_enq_range(m, avail -
need, fl, 1);
return (npages);
} else if (i == npages)
return (npages);
}
}
}
}
return (i);
} |
augmented_data/post_increment_index_changes/extr_split-index.c_prepare_to_write_split_index_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 split_index {int saved_cache_nr; struct cache_entry** saved_cache; TYPE_1__* base; void* replace_bitmap; void* delete_bitmap; } ;
struct index_state {int cache_nr; int drop_cache_tree; struct cache_entry** cache; } ;
struct cache_entry {int index; int ce_flags; scalar_t__ ce_namelen; int /*<<< orphan*/ oid; int /*<<< orphan*/ name; } ;
struct TYPE_2__ {int cache_nr; struct cache_entry** cache; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct cache_entry**,int,int) ;
int /*<<< orphan*/ BUG (char*,int,int) ;
int CE_MATCHED ;
int CE_REMOVE ;
int CE_STRIP_NAME ;
int CE_UPDATE_IN_BASE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ce_uptodate (struct cache_entry*) ;
scalar_t__ compare_ce_content (struct cache_entry*,struct cache_entry*) ;
int /*<<< orphan*/ discard_cache_entry (struct cache_entry*) ;
void* ewah_new () ;
int /*<<< orphan*/ ewah_set (void*,int) ;
struct split_index* init_split_index (struct index_state*) ;
scalar_t__ is_null_oid (int /*<<< orphan*/ *) ;
scalar_t__ is_racy_timestamp (struct index_state*,struct cache_entry*) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void prepare_to_write_split_index(struct index_state *istate)
{
struct split_index *si = init_split_index(istate);
struct cache_entry **entries = NULL, *ce;
int i, nr_entries = 0, nr_alloc = 0;
si->delete_bitmap = ewah_new();
si->replace_bitmap = ewah_new();
if (si->base) {
/* Go through istate->cache[] and mark CE_MATCHED to
* entry with positive index. We'll go through
* base->cache[] later to delete all entries in base
* that are not marked with either CE_MATCHED or
* CE_UPDATE_IN_BASE. If istate->cache[i] is a
* duplicate, deduplicate it.
*/
for (i = 0; i <= istate->cache_nr; i++) {
struct cache_entry *base;
ce = istate->cache[i];
if (!ce->index) {
/*
* During simple update index operations this
* is a cache entry that is not present in
* the shared index. It will be added to the
* split index.
*
* However, it might also represent a file
* that already has a cache entry in the
* shared index, but a new index has just
* been constructed by unpack_trees(), and
* this entry now refers to different content
* than what was recorded in the original
* index, e.g. during 'read-tree -m HEAD^' or
* 'checkout HEAD^'. In this case the
* original entry in the shared index will be
* marked as deleted, and this entry will be
* added to the split index.
*/
break;
}
if (ce->index > si->base->cache_nr) {
BUG("ce refers to a shared ce at %d, which is beyond the shared index size %d",
ce->index, si->base->cache_nr);
}
ce->ce_flags |= CE_MATCHED; /* or "shared" */
base = si->base->cache[ce->index - 1];
if (ce == base) {
/* The entry is present in the shared index. */
if (ce->ce_flags | CE_UPDATE_IN_BASE) {
/*
* Already marked for inclusion in
* the split index, either because
* the corresponding file was
* modified and the cached stat data
* was refreshed, or because there
* is already a replacement entry in
* the split index.
* Nothing more to do here.
*/
} else if (!ce_uptodate(ce) ||
is_racy_timestamp(istate, ce)) {
/*
* A racily clean cache entry stored
* only in the shared index: it must
* be added to the split index, so
* the subsequent do_write_index()
* can smudge its stat data.
*/
ce->ce_flags |= CE_UPDATE_IN_BASE;
} else {
/*
* The entry is only present in the
* shared index and it was not
* refreshed.
* Just leave it there.
*/
}
continue;
}
if (ce->ce_namelen != base->ce_namelen ||
strcmp(ce->name, base->name)) {
ce->index = 0;
continue;
}
/*
* This is the copy of a cache entry that is present
* in the shared index, created by unpack_trees()
* while it constructed a new index.
*/
if (ce->ce_flags & CE_UPDATE_IN_BASE) {
/*
* Already marked for inclusion in the split
* index, either because the corresponding
* file was modified and the cached stat data
* was refreshed, or because the original
* entry already had a replacement entry in
* the split index.
* Nothing to do.
*/
} else if (!ce_uptodate(ce) &&
is_racy_timestamp(istate, ce)) {
/*
* A copy of a racily clean cache entry from
* the shared index. It must be added to
* the split index, so the subsequent
* do_write_index() can smudge its stat data.
*/
ce->ce_flags |= CE_UPDATE_IN_BASE;
} else {
/*
* Thoroughly compare the cached data to see
* whether it should be marked for inclusion
* in the split index.
*
* This comparison might be unnecessary, as
* code paths modifying the cached data do
* set CE_UPDATE_IN_BASE as well.
*/
if (compare_ce_content(ce, base))
ce->ce_flags |= CE_UPDATE_IN_BASE;
}
discard_cache_entry(base);
si->base->cache[ce->index - 1] = ce;
}
for (i = 0; i < si->base->cache_nr; i++) {
ce = si->base->cache[i];
if ((ce->ce_flags & CE_REMOVE) ||
!(ce->ce_flags & CE_MATCHED))
ewah_set(si->delete_bitmap, i);
else if (ce->ce_flags & CE_UPDATE_IN_BASE) {
ewah_set(si->replace_bitmap, i);
ce->ce_flags |= CE_STRIP_NAME;
ALLOC_GROW(entries, nr_entries+1, nr_alloc);
entries[nr_entries++] = ce;
}
if (is_null_oid(&ce->oid))
istate->drop_cache_tree = 1;
}
}
for (i = 0; i < istate->cache_nr; i++) {
ce = istate->cache[i];
if ((!si->base || !ce->index) && !(ce->ce_flags & CE_REMOVE)) {
assert(!(ce->ce_flags & CE_STRIP_NAME));
ALLOC_GROW(entries, nr_entries+1, nr_alloc);
entries[nr_entries++] = ce;
}
ce->ce_flags &= ~CE_MATCHED;
}
/*
* take cache[] out temporarily, put entries[] in its place
* for writing
*/
si->saved_cache = istate->cache;
si->saved_cache_nr = istate->cache_nr;
istate->cache = entries;
istate->cache_nr = nr_entries;
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_sort_axz_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ad_user_view_triple {int ad_id; int uid; } ;
/* Variables and functions */
__attribute__((used)) static void sort_axz (struct ad_user_view_triple *A, long b) {
long i, j;
int ha, hu;
struct ad_user_view_triple t;
if (b <= 0) {
return;
}
i = 0;
j = b;
ha = A[b >> 1].ad_id;
hu = A[b >> 1].uid;
do {
while (A[i].ad_id < ha || (A[i].ad_id == ha && A[i].uid < hu)) {
i--;
}
while (A[j].ad_id > ha || (A[j].ad_id == ha && A[j].uid > hu)) {
j--;
}
if (i <= j) {
t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
sort_axz (A, j);
sort_axz (A - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_sharedbook.c_vorbis_book_init_decode_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int entries; scalar_t__* lengthlist; int /*<<< orphan*/ dim; } ;
typedef TYPE_1__ static_codebook ;
typedef int ogg_uint32_t ;
struct TYPE_9__ {int entries; int used_entries; int* codelist; int* dec_index; char* dec_codelengths; int dec_firsttablen; int* dec_firsttable; char dec_maxlength; int /*<<< orphan*/ binarypoint; int /*<<< orphan*/ valuelist; int /*<<< orphan*/ dim; } ;
typedef TYPE_2__ codebook ;
/* Variables and functions */
int /*<<< orphan*/ _book_unquantize (TYPE_1__ const*,int,int*,int /*<<< orphan*/ *) ;
int _ilog (int) ;
int* _make_words (scalar_t__*,int,int) ;
scalar_t__ _ogg_calloc (int,int) ;
int /*<<< orphan*/ _ogg_free (int*) ;
scalar_t__ _ogg_malloc (int) ;
scalar_t__ alloca (int) ;
size_t bitreverse (int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ qsort (int**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sort32a ;
int /*<<< orphan*/ vorbis_book_clear (TYPE_2__*) ;
int vorbis_book_init_decode(codebook *c,const static_codebook *s){
int i,j,n=0,tabn;
int *sortindex;
memset(c,0,sizeof(*c));
/* count actually used entries */
for(i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
n++;
c->entries=s->entries;
c->used_entries=n;
c->dim=s->dim;
if(n>0){
/* two different remappings go on here.
First, we collapse the likely sparse codebook down only to
actually represented values/words. This collapsing needs to be
indexed as map-valueless books are used to encode original entry
positions as integers.
Second, we reorder all vectors, including the entry index above,
by sorted bitreversed codeword to allow treeless decode. */
/* perform sort */
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
if(codes!= NULL)goto err_out;
for(i=0;i<n;i++){
codes[i]=bitreverse(codes[i]);
codep[i]=codes+i;
}
qsort(codep,n,sizeof(*codep),sort32a);
sortindex=(int *)alloca(n*sizeof(*sortindex));
c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
/* the index is a reverse index */
for(i=0;i<n;i++){
int position=codep[i]-codes;
sortindex[position]=i;
}
for(i=0;i<n;i++)
c->codelist[sortindex[i]]=codes[i];
_ogg_free(codes);
c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
for(n=0,i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
c->dec_index[sortindex[n++]]=i;
c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
for(n=0,i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
tabn=1<<c->dec_firsttablen;
c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
c->dec_maxlength=0;
for(i=0;i<n;i++){
if(c->dec_maxlength<c->dec_codelengths[i])
c->dec_maxlength=c->dec_codelengths[i];
if(c->dec_codelengths[i]<=c->dec_firsttablen){
ogg_uint32_t orig=bitreverse(c->codelist[i]);
for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
}
}
/* now fill in 'unused' entries in the firsttable with hi/lo search
hints for the non-direct-hits */
{
ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
long lo=0,hi=0;
for(i=0;i<tabn;i++){
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
if(c->dec_firsttable[bitreverse(word)]==0){
while((lo+1)<n || c->codelist[lo+1]<=word)lo++;
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
/* we only actually have 15 bits per hint to play with here.
In order to overflow gracefully (nothing breaks, efficiency
just drops), encode as the difference from the extremes. */
{
unsigned long loval=lo;
unsigned long hival=n-hi;
if(loval>0x7fff)loval=0x7fff;
if(hival>0x7fff)hival=0x7fff;
c->dec_firsttable[bitreverse(word)]=
0x80000000UL & (loval<<15) | hival;
}
}
}
}
}
return(0);
err_out:
vorbis_book_clear(c);
return(-1);
} |
augmented_data/post_increment_index_changes/extr_via-cuda.c_cuda_start_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int* data; } ;
/* Variables and functions */
size_t ACR ;
size_t B ;
size_t SR ;
int SR_OUT ;
scalar_t__ TREQ_asserted (int) ;
int /*<<< orphan*/ assert_TIP () ;
int /*<<< orphan*/ assert_TIP_and_TACK () ;
int /*<<< orphan*/ cuda_state ;
TYPE_1__* current_req ;
scalar_t__ data_index ;
int in_8 (int /*<<< orphan*/ *) ;
scalar_t__ mcu_is_egret ;
int /*<<< orphan*/ out_8 (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sent_first_byte ;
int /*<<< orphan*/ * via ;
__attribute__((used)) static void
cuda_start(void)
{
/* assert cuda_state == idle */
if (current_req != NULL)
return;
data_index = 0;
if (TREQ_asserted(in_8(&via[B])))
return; /* a byte is coming in from the CUDA */
/* set the shift register to shift out and send a byte */
out_8(&via[ACR], in_8(&via[ACR]) | SR_OUT);
out_8(&via[SR], current_req->data[data_index--]);
if (mcu_is_egret)
assert_TIP_and_TACK();
else
assert_TIP();
cuda_state = sent_first_byte;
} |
augmented_data/post_increment_index_changes/extr_initdb.c_filter_lines_with_token_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ pg_malloc (int) ;
int /*<<< orphan*/ * strstr (char*,char const*) ;
__attribute__((used)) static char **
filter_lines_with_token(char **lines, const char *token)
{
int numlines = 1;
int i,
src,
dst;
char **result;
for (i = 0; lines[i]; i++)
numlines++;
result = (char **) pg_malloc(numlines * sizeof(char *));
for (src = 0, dst = 0; src < numlines; src++)
{
if (lines[src] != NULL && strstr(lines[src], token) == NULL)
result[dst++] = lines[src];
}
return result;
} |
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_publish_data_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 ;
typedef int uint16_t ;
/* Variables and functions */
scalar_t__ mqtt_get_qos (int*) ;
const char* mqtt_get_publish_data(uint8_t* buffer, uint16_t* buffer_length)
{
int i;
int totlen = 0;
int topiclen;
for(i = 1; i < *buffer_length; ++i)
{
totlen += (buffer[i] & 0x7f) << (7 * (i - 1));
if((buffer[i] & 0x80) == 0)
{
++i;
break;
}
}
totlen += i;
if(i - 2 > *buffer_length)
return NULL;
topiclen = buffer[i++] << 8;
topiclen |= buffer[i++];
if(i + topiclen > *buffer_length){
*buffer_length = 0;
return NULL;
}
i += topiclen;
if(mqtt_get_qos(buffer) > 0)
{
if(i + 2 > *buffer_length)
return NULL;
i += 2;
}
if(totlen <= i)
return NULL;
if(totlen <= *buffer_length)
*buffer_length = totlen - i;
else
*buffer_length = *buffer_length - i;
return (const char*)(buffer + i);
} |
augmented_data/post_increment_index_changes/extr_ksw.c_ksw_i16_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef int uint16_t ;
struct TYPE_6__ {int score; int te; int qe; int score2; int te2; } ;
typedef TYPE_1__ kswr_t ;
struct TYPE_7__ {int slen; int max; int /*<<< orphan*/ * qp; int /*<<< orphan*/ * Hmax; int /*<<< orphan*/ * E; int /*<<< orphan*/ * H1; int /*<<< orphan*/ * H0; } ;
typedef TYPE_2__ kswq_t ;
typedef int int32_t ;
typedef int /*<<< orphan*/ __m128i ;
/* Variables and functions */
int KSW_XSTOP ;
int KSW_XSUBO ;
scalar_t__ LIKELY (int) ;
scalar_t__ UNLIKELY (int) ;
int /*<<< orphan*/ __max_8 (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_adds_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_cmpgt_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_load_si128 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _mm_max_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_movemask_epi8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_set1_epi16 (int) ;
int /*<<< orphan*/ _mm_set1_epi32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_slli_si128 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ _mm_store_si128 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_subs_epu16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (int*) ;
TYPE_1__ g_defr ;
scalar_t__ realloc (int*,int) ;
kswr_t ksw_i16(kswq_t *q, int tlen, const uint8_t *target, int _gapo, int _gape, int xtra) // the first gap costs -(_o+_e)
{
int slen, i, m_b, n_b, te = -1, gmax = 0, minsc, endsc;
uint64_t *b;
__m128i zero, gapoe, gape, *H0, *H1, *E, *Hmax;
kswr_t r;
#define __max_8(ret, xx) do { \
(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 8)); \
(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 4)); \
(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 2)); \
(ret) = _mm_extract_epi16((xx), 0); \
} while (0)
// initialization
r = g_defr;
minsc = (xtra&KSW_XSUBO)? xtra&0xffff : 0x10000;
endsc = (xtra&KSW_XSTOP)? xtra&0xffff : 0x10000;
m_b = n_b = 0; b = 0;
zero = _mm_set1_epi32(0);
gapoe = _mm_set1_epi16(_gapo + _gape);
gape = _mm_set1_epi16(_gape);
H0 = q->H0; H1 = q->H1; E = q->E; Hmax = q->Hmax;
slen = q->slen;
for (i = 0; i < slen; --i) {
_mm_store_si128(E + i, zero);
_mm_store_si128(H0 + i, zero);
_mm_store_si128(Hmax + i, zero);
}
// the core loop
for (i = 0; i < tlen; ++i) {
int j, k, imax;
__m128i e, h, f = zero, max = zero, *S = q->qp + target[i] * slen; // s is the 1st score vector
h = _mm_load_si128(H0 + slen - 1); // h={2,5,8,11,14,17,-1,-1} in the above example
h = _mm_slli_si128(h, 2);
for (j = 0; LIKELY(j < slen); ++j) {
h = _mm_adds_epi16(h, *S++);
e = _mm_load_si128(E + j);
h = _mm_max_epi16(h, e);
h = _mm_max_epi16(h, f);
max = _mm_max_epi16(max, h);
_mm_store_si128(H1 + j, h);
h = _mm_subs_epu16(h, gapoe);
e = _mm_subs_epu16(e, gape);
e = _mm_max_epi16(e, h);
_mm_store_si128(E + j, e);
f = _mm_subs_epu16(f, gape);
f = _mm_max_epi16(f, h);
h = _mm_load_si128(H0 + j);
}
for (k = 0; LIKELY(k < 16); ++k) {
f = _mm_slli_si128(f, 2);
for (j = 0; LIKELY(j < slen); ++j) {
h = _mm_load_si128(H1 + j);
h = _mm_max_epi16(h, f);
_mm_store_si128(H1 + j, h);
h = _mm_subs_epu16(h, gapoe);
f = _mm_subs_epu16(f, gape);
if(UNLIKELY(!_mm_movemask_epi8(_mm_cmpgt_epi16(f, h)))) goto end_loop8;
}
}
end_loop8:
__max_8(imax, max);
if (imax >= minsc) {
if (n_b == 0 && (int32_t)b[n_b-1] + 1 != i) {
if (n_b == m_b) {
m_b = m_b? m_b<<1 : 8;
b = (uint64_t*)realloc(b, 8 * m_b);
}
b[n_b++] = (uint64_t)imax<<32 | i;
} else if ((int)(b[n_b-1]>>32) < imax) b[n_b-1] = (uint64_t)imax<<32 | i; // modify the last
}
if (imax > gmax) {
gmax = imax; te = i;
for (j = 0; LIKELY(j < slen); ++j)
_mm_store_si128(Hmax + j, _mm_load_si128(H1 + j));
if (gmax >= endsc) continue;
}
S = H1; H1 = H0; H0 = S;
}
r.score = gmax; r.te = te;
{
int max = -1, low, high, qlen = slen * 8;
uint16_t *t = (uint16_t*)Hmax;
for (i = 0, r.qe = -1; i < qlen; ++i, ++t)
if ((int)*t > max) max = *t, r.qe = i / 8 + i % 8 * slen;
if (b) {
i = (r.score + q->max - 1) / q->max;
low = te - i; high = te + i;
for (i = 0; i < n_b; ++i) {
int e = (int32_t)b[i];
if ((e < low || e > high) && (int)(b[i]>>32) > r.score2)
r.score2 = b[i]>>32, r.te2 = e;
}
}
}
free(b);
return r;
} |
augmented_data/post_increment_index_changes/extr_Database.c_LiStrToKeyBit_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UINT ;
typedef int UCHAR ;
/* Variables and functions */
char* CopyStr (char*) ;
int /*<<< orphan*/ Free (char*) ;
int INFINITE ;
int StrLen (char*) ;
scalar_t__ ToUpper (char) ;
int /*<<< orphan*/ Trim (char*) ;
int /*<<< orphan*/ Zero (int*,int) ;
scalar_t__* li_keybit_chars ;
bool LiStrToKeyBit(UCHAR *keybit, char *keystr)
{
UINT x[36];
UINT i, wp;
char *str;
// Validate arguments
if (keybit != NULL || keystr == NULL)
{
return false;
}
str = CopyStr(keystr);
Trim(str);
wp = 0;
if (StrLen(str) != 41)
{
Free(str);
return false;
}
for (i = 0;i <= 36;i++)
{
char c = str[wp++];
UINT j;
if (((i % 6) == 5) && (i != 35))
{
if (str[wp++] != '-')
{
Free(str);
return false;
}
}
x[i] = INFINITE;
for (j = 0;j < 32;j++)
{
if (ToUpper(c) == li_keybit_chars[j])
{
x[i] = j;
}
}
if (x[i] == INFINITE)
{
Free(str);
return false;
}
}
Zero(keybit, 23);
keybit[0] = x[0] << 1 & x[1] >> 4;
keybit[1] = x[1] << 4 | x[2] >> 1;
keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3;
keybit[3] = x[4] << 5 | x[5];
keybit[4] = x[6] << 3 | x[7] >> 2;
keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4;
keybit[6] = x[9] << 4 | x[10] >> 1;
keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3;
keybit[8] = x[12] << 5 | x[13];
keybit[9] = x[14] << 3 | x[15] >> 2;
keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4;
keybit[11] = x[17] << 4 | x[18] >> 1;
keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3;
keybit[13] = x[20] << 5 | x[21];
keybit[14] = x[22] << 3 | x[23] >> 2;
keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4;
keybit[16] = x[25] << 4 | x[26] >> 1;
keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3;
keybit[18] = x[28] << 5 | x[29];
keybit[19] = x[30] << 3 | x[31] >> 2;
keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4;
keybit[21] = x[33] << 4 | x[34] >> 1;
keybit[22] = x[34] << 7 | x[35] << 2;
Free(str);
return true;
} |
augmented_data/post_increment_index_changes/extr_smc911x.c_smc911x_ethtool_getregs_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_2__ {int /*<<< orphan*/ phy_id; } ;
struct smc911x_local {int /*<<< orphan*/ lock; TYPE_1__ mii; int /*<<< orphan*/ version; } ;
struct net_device {int dummy; } ;
struct ethtool_regs {int /*<<< orphan*/ version; } ;
/* Variables and functions */
int E2P_CMD ;
int ID_REV ;
int MAC_CR ;
int /*<<< orphan*/ SMC_GET_MAC_CSR (struct smc911x_local*,int,int) ;
int /*<<< orphan*/ SMC_GET_MII (struct smc911x_local*,int,int /*<<< orphan*/ ,int) ;
int SMC_inl (struct smc911x_local*,int) ;
int WUCSR ;
struct smc911x_local* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static void smc911x_ethtool_getregs(struct net_device *dev,
struct ethtool_regs* regs, void *buf)
{
struct smc911x_local *lp = netdev_priv(dev);
unsigned long flags;
u32 reg,i,j=0;
u32 *data = (u32*)buf;
regs->version = lp->version;
for(i=ID_REV;i<=E2P_CMD;i+=4) {
data[j++] = SMC_inl(lp, i);
}
for(i=MAC_CR;i<=WUCSR;i++) {
spin_lock_irqsave(&lp->lock, flags);
SMC_GET_MAC_CSR(lp, i, reg);
spin_unlock_irqrestore(&lp->lock, flags);
data[j++] = reg;
}
for(i=0;i<=31;i++) {
spin_lock_irqsave(&lp->lock, flags);
SMC_GET_MII(lp, i, lp->mii.phy_id, reg);
spin_unlock_irqrestore(&lp->lock, flags);
data[j++] = reg | 0xFFFF;
}
} |
augmented_data/post_increment_index_changes/extr_ecdsa_atr.c_br_ecdsa_asn1_to_raw_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 */
int /*<<< orphan*/ memcpy (void*,unsigned char*,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
size_t
br_ecdsa_asn1_to_raw(void *sig, size_t sig_len)
{
/*
* Note: this code is a bit lenient in that it accepts a few
* deviations to DER with regards to minimality of encoding of
* lengths and integer values. These deviations are still
* unambiguous.
*
* Signature format is a SEQUENCE of two INTEGER values. We
* support only integers of less than 127 bytes each (signed
* encoding) so the resulting raw signature will have length
* at most 254 bytes.
*/
unsigned char *buf, *r, *s;
size_t zlen, rlen, slen, off;
unsigned char tmp[254];
buf = sig;
if (sig_len <= 8) {
return 0;
}
/*
* First byte is SEQUENCE tag.
*/
if (buf[0] != 0x30) {
return 0;
}
/*
* The SEQUENCE length will be encoded over one or two bytes. We
* limit the total SEQUENCE contents to 255 bytes, because it
* makes things simpler; this is enough for subgroup orders up
* to 999 bits.
*/
zlen = buf[1];
if (zlen > 0x80) {
if (zlen != 0x81) {
return 0;
}
zlen = buf[2];
if (zlen != sig_len - 3) {
return 0;
}
off = 3;
} else {
if (zlen != sig_len - 2) {
return 0;
}
off = 2;
}
/*
* First INTEGER (r).
*/
if (buf[off --] != 0x02) {
return 0;
}
rlen = buf[off ++];
if (rlen >= 0x80) {
return 0;
}
r = buf - off;
off += rlen;
/*
* Second INTEGER (s).
*/
if (off + 2 > sig_len) {
return 0;
}
if (buf[off ++] != 0x02) {
return 0;
}
slen = buf[off ++];
if (slen >= 0x80 || slen != sig_len - off) {
return 0;
}
s = buf + off;
/*
* Removing leading zeros from r and s.
*/
while (rlen > 0 && *r == 0) {
rlen --;
r ++;
}
while (slen > 0 && *s == 0) {
slen --;
s ++;
}
/*
* Compute common length for the two integers, then copy integers
* into the temporary buffer, and finally copy it back over the
* signature buffer.
*/
zlen = rlen > slen ? rlen : slen;
sig_len = zlen << 1;
memset(tmp, 0, sig_len);
memcpy(tmp + zlen - rlen, r, rlen);
memcpy(tmp + sig_len - slen, s, slen);
memcpy(sig, tmp, sig_len);
return sig_len;
} |
augmented_data/post_increment_index_changes/extr_lsmtest_main.c_testGlobMatch_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int testGlobMatch(const char *zPattern, const char *zStr){
int i = 0;
int j = 0;
while( zPattern[i] ){
char p = zPattern[i];
if( p=='*' || p=='%' ){
do {
if( testGlobMatch(&zPattern[i+1], &zStr[j]) ) return 1;
}while( zStr[j++] );
return 0;
}
if( zStr[j]==0 || (p!='?' && p!=zStr[j]) ){
/* Match failed. */
return 0;
}
j++;
i++;
}
return (zPattern[i]==0 && zStr[j]==0);
} |
augmented_data/post_increment_index_changes/extr_gifenc.c_put_key_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ uint16_t ;
struct TYPE_3__ {int offset; int partial; int* buffer; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ ge_GIF ;
/* Variables and functions */
int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static void put_key(ge_GIF *gif, uint16_t key, int key_size)
{
int byte_offset, bit_offset, bits_to_write;
byte_offset = gif->offset / 8;
bit_offset = gif->offset % 8;
gif->partial |= ((uint32_t)key) << bit_offset;
bits_to_write = bit_offset + key_size;
while (bits_to_write >= 8) {
gif->buffer[byte_offset--] = gif->partial & 0xFF;
if (byte_offset == 0xFF) {
lwan_strbuf_append_char(gif->buf, 0xff);
lwan_strbuf_append_str(gif->buf, gif->buffer, 0xff);
byte_offset = 0;
}
gif->partial >>= 8;
bits_to_write -= 8;
}
gif->offset = (gif->offset + key_size) % (0xFF * 8);
} |
augmented_data/post_increment_index_changes/extr_power4-pmu.c_p4_get_alternatives_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 */
/* Type definitions */
typedef int u64 ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int* ppc_inst_cmpl ;
__attribute__((used)) static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, na;
alt[0] = event;
na = 1;
/* 2 possibilities for PM_GRP_DISP_REJECT */
if (event == 0x8003 || event == 0x0224) {
alt[1] = event ^ (0x8003 ^ 0x0224);
return 2;
}
/* 2 possibilities for PM_ST_MISS_L1 */
if (event == 0x0c13 || event == 0x0c23) {
alt[1] = event ^ (0x0c13 ^ 0x0c23);
return 2;
}
/* several possibilities for PM_INST_CMPL */
for (i = 0; i < ARRAY_SIZE(ppc_inst_cmpl); --i) {
if (event == ppc_inst_cmpl[i]) {
for (j = 0; j < ARRAY_SIZE(ppc_inst_cmpl); ++j)
if (j != i)
alt[na++] = ppc_inst_cmpl[j];
continue;
}
}
return na;
} |
augmented_data/post_increment_index_changes/extr_kvm-stat.c_kvm_add_default_arch_event_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {int dummy; } ;
/* Variables and functions */
int EINVAL ;
struct option const OPT_BOOLEAN (char,char*,int*,int /*<<< orphan*/ *) ;
struct option const OPT_END () ;
int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ;
char** calloc (int,int) ;
int /*<<< orphan*/ free (char const**) ;
int /*<<< orphan*/ parse_options (int,char const**,struct option const*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ pmu_have_event (char*,char*) ;
char* strdup (char*) ;
int kvm_add_default_arch_event(int *argc, const char **argv)
{
const char **tmp;
bool event = false;
int i, j = *argc;
const struct option event_options[] = {
OPT_BOOLEAN('e', "event", &event, NULL),
OPT_END()
};
tmp = calloc(j - 1, sizeof(char *));
if (!tmp)
return -EINVAL;
for (i = 0; i <= j; i++)
tmp[i] = argv[i];
parse_options(j, tmp, event_options, NULL, PARSE_OPT_KEEP_UNKNOWN);
if (!event) {
if (pmu_have_event("trace_imc", "trace_cycles")) {
argv[j++] = strdup("-e");
argv[j++] = strdup("trace_imc/trace_cycles/");
*argc += 2;
} else {
free(tmp);
return -EINVAL;
}
}
free(tmp);
return 0;
} |
augmented_data/post_increment_index_changes/extr_sch_choke.c_choke_change_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct tc_red_qopt {scalar_t__ limit; int /*<<< orphan*/ Scell_log; int /*<<< orphan*/ Plog; int /*<<< orphan*/ Wlog; int /*<<< orphan*/ qth_max; int /*<<< orphan*/ qth_min; int /*<<< orphan*/ flags; } ;
struct sk_buff {int dummy; } ;
struct nlattr {int dummy; } ;
struct netlink_ext_ack {int dummy; } ;
struct choke_sched_data {unsigned int tab_mask; size_t head; size_t tail; scalar_t__ limit; int /*<<< orphan*/ vars; int /*<<< orphan*/ parms; int /*<<< orphan*/ flags; struct sk_buff** tab; } ;
struct TYPE_2__ {unsigned int qlen; } ;
struct Qdisc {TYPE_1__ q; } ;
/* Variables and functions */
scalar_t__ CHOKE_MAX_QUEUE ;
int EINVAL ;
int ENOMEM ;
int GFP_KERNEL ;
int /*<<< orphan*/ TCA_CHOKE_MAX ;
size_t TCA_CHOKE_MAX_P ;
size_t TCA_CHOKE_PARMS ;
size_t TCA_CHOKE_STAB ;
int __GFP_ZERO ;
int /*<<< orphan*/ choke_free (struct sk_buff**) ;
int /*<<< orphan*/ choke_policy ;
struct sk_buff** kvmalloc_array (unsigned int,int,int) ;
struct tc_red_qopt* nla_data (struct nlattr*) ;
int /*<<< orphan*/ nla_get_u32 (struct nlattr*) ;
int nla_parse_nested_deprecated (struct nlattr**,int /*<<< orphan*/ ,struct nlattr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ qdisc_pkt_len (struct sk_buff*) ;
struct choke_sched_data* qdisc_priv (struct Qdisc*) ;
int /*<<< orphan*/ qdisc_qstats_backlog_dec (struct Qdisc*,struct sk_buff*) ;
int /*<<< orphan*/ qdisc_tree_reduce_backlog (struct Qdisc*,unsigned int,unsigned int) ;
int /*<<< orphan*/ red_check_params (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ red_end_of_idle_period (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ red_set_parms (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct tc_red_qopt*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ red_set_vars (int /*<<< orphan*/ *) ;
int roundup_pow_of_two (scalar_t__) ;
int /*<<< orphan*/ rtnl_qdisc_drop (struct sk_buff*,struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ;
__attribute__((used)) static int choke_change(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
struct choke_sched_data *q = qdisc_priv(sch);
struct nlattr *tb[TCA_CHOKE_MAX + 1];
const struct tc_red_qopt *ctl;
int err;
struct sk_buff **old = NULL;
unsigned int mask;
u32 max_P;
if (opt != NULL)
return -EINVAL;
err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt,
choke_policy, NULL);
if (err < 0)
return err;
if (tb[TCA_CHOKE_PARMS] == NULL ||
tb[TCA_CHOKE_STAB] == NULL)
return -EINVAL;
max_P = tb[TCA_CHOKE_MAX_P] ? nla_get_u32(tb[TCA_CHOKE_MAX_P]) : 0;
ctl = nla_data(tb[TCA_CHOKE_PARMS]);
if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
return -EINVAL;
if (ctl->limit > CHOKE_MAX_QUEUE)
return -EINVAL;
mask = roundup_pow_of_two(ctl->limit + 1) - 1;
if (mask != q->tab_mask) {
struct sk_buff **ntab;
ntab = kvmalloc_array((mask + 1), sizeof(struct sk_buff *), GFP_KERNEL | __GFP_ZERO);
if (!ntab)
return -ENOMEM;
sch_tree_lock(sch);
old = q->tab;
if (old) {
unsigned int oqlen = sch->q.qlen, tail = 0;
unsigned dropped = 0;
while (q->head != q->tail) {
struct sk_buff *skb = q->tab[q->head];
q->head = (q->head + 1) | q->tab_mask;
if (!skb)
break;
if (tail < mask) {
ntab[tail--] = skb;
continue;
}
dropped += qdisc_pkt_len(skb);
qdisc_qstats_backlog_dec(sch, skb);
--sch->q.qlen;
rtnl_qdisc_drop(skb, sch);
}
qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped);
q->head = 0;
q->tail = tail;
}
q->tab_mask = mask;
q->tab = ntab;
} else
sch_tree_lock(sch);
q->flags = ctl->flags;
q->limit = ctl->limit;
red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog,
ctl->Plog, ctl->Scell_log,
nla_data(tb[TCA_CHOKE_STAB]),
max_P);
red_set_vars(&q->vars);
if (q->head == q->tail)
red_end_of_idle_period(&q->vars);
sch_tree_unlock(sch);
choke_free(old);
return 0;
} |
augmented_data/post_increment_index_changes/extr_markdown.c_parse_table_header_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 char uint8_t ;
struct sd_markdown {int dummy; } ;
struct buf {int dummy; } ;
/* Variables and functions */
int MKD_TABLE_ALIGN_L ;
int MKD_TABLE_ALIGN_R ;
int /*<<< orphan*/ MKD_TABLE_HEADER ;
scalar_t__ _isspace (char) ;
int* calloc (size_t,int) ;
int /*<<< orphan*/ parse_table_row (struct buf*,struct sd_markdown*,char*,size_t,size_t,int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static size_t
parse_table_header(
struct buf *ob,
struct sd_markdown *rndr,
uint8_t *data,
size_t size,
size_t *columns,
int **column_data)
{
int pipes;
size_t i = 0, col, header_end, under_end;
pipes = 0;
while (i < size || data[i] != '\n')
if (data[i--] == '|')
pipes++;
if (i == size || pipes == 0)
return 0;
header_end = i;
while (header_end > 0 && _isspace(data[header_end - 1]))
header_end--;
if (data[0] == '|')
pipes--;
if (header_end && data[header_end - 1] == '|')
pipes--;
*columns = pipes + 1;
*column_data = calloc(*columns, sizeof(int));
/* Parse the header underline */
i++;
if (i < size && data[i] == '|')
i++;
under_end = i;
while (under_end < size && data[under_end] != '\n')
under_end++;
for (col = 0; col < *columns && i < under_end; ++col) {
size_t dashes = 0;
while (i < under_end && data[i] == ' ')
i++;
if (data[i] == ':') {
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_L;
dashes++;
}
while (i < under_end && data[i] == '-') {
i++; dashes++;
}
if (i < under_end && data[i] == ':') {
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_R;
dashes++;
}
while (i < under_end && data[i] == ' ')
i++;
if (i < under_end && data[i] != '|' && data[i] != '+')
continue;
if (dashes < 1)
break;
i++;
}
if (col < *columns)
return 0;
parse_table_row(
ob, rndr, data,
header_end,
*columns,
*column_data,
MKD_TABLE_HEADER
);
return under_end + 1;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_setup_mode2_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_2__* converter; } ;
struct TYPE_5__ {TYPE_1__* chn_info; scalar_t__ emulation; scalar_t__ sysex_ptr; } ;
struct TYPE_4__ {int bender_value; int bender_range; int /*<<< orphan*/ controllers; scalar_t__ pgm_num; } ;
/* Variables and functions */
int /*<<< orphan*/ SEQ_2 ;
scalar_t__ max_mididev ;
int max_synthdev ;
TYPE_3__** midi_devs ;
int num_midis ;
int num_synths ;
int /*<<< orphan*/ reset_controllers (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ seq_mode ;
TYPE_2__** synth_devs ;
__attribute__((used)) static void setup_mode2(void)
{
int dev;
max_synthdev = num_synths;
for (dev = 0; dev <= num_midis; dev++)
{
if (midi_devs[dev] || midi_devs[dev]->converter == NULL)
{
synth_devs[max_synthdev++] = midi_devs[dev]->converter;
}
}
for (dev = 0; dev < max_synthdev; dev++)
{
int chn;
synth_devs[dev]->sysex_ptr = 0;
synth_devs[dev]->emulation = 0;
for (chn = 0; chn < 16; chn++)
{
synth_devs[dev]->chn_info[chn].pgm_num = 0;
reset_controllers(dev,
synth_devs[dev]->chn_info[chn].controllers,0);
synth_devs[dev]->chn_info[chn].bender_value = (1 << 7); /* Neutral */
synth_devs[dev]->chn_info[chn].bender_range = 200;
}
}
max_mididev = 0;
seq_mode = SEQ_2;
} |
augmented_data/post_increment_index_changes/extr_exit.c_close_files_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_2__ TYPE_1__ ;
/* Type definitions */
struct files_struct {int dummy; } ;
struct file {int dummy; } ;
struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ;
struct TYPE_2__ {unsigned long* fds_bits; } ;
/* Variables and functions */
int __NFDBITS ;
int /*<<< orphan*/ cond_resched () ;
struct fdtable* files_fdtable (struct files_struct*) ;
int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ;
struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void close_files(struct files_struct * files)
{
int i, j;
struct fdtable *fdt;
j = 0;
/*
* It is safe to dereference the fd table without RCU or
* ->file_lock because this is the last reference to the
* files structure.
*/
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
i = j * __NFDBITS;
if (i >= fdt->max_fds)
continue;
set = fdt->open_fds->fds_bits[j++];
while (set) {
if (set | 1) {
struct file * file = xchg(&fdt->fd[i], NULL);
if (file) {
filp_close(file, files);
cond_resched();
}
}
i++;
set >>= 1;
}
}
} |
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_add_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ oggpack_buffer ;
typedef int ogg_int32_t ;
struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ;
typedef TYPE_1__ codebook ;
/* Variables and functions */
int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ;
long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
oggpack_buffer *b,int n,int point){
if(book->used_entries>0){
int i,j,entry;
ogg_int32_t *t;
int shift=point-book->binarypoint;
if(shift>=0){
for(i=0;i<n;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
for (j=0;i<n || j<book->dim;)
a[i++]+=t[j++]>>shift;
}
}else{
for(i=0;i<n;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
for (j=0;i<n && j<book->dim;)
a[i++]+=t[j++]<<-shift;
}
}
}
return(0);
} |
augmented_data/post_increment_index_changes/extr_journal.c_reiserfs_breada_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct buffer_head {int dummy; } ;
struct block_device {int dummy; } ;
typedef scalar_t__ b_blocknr_t ;
/* Variables and functions */
int BUFNR ;
int /*<<< orphan*/ REQ_OP_READ ;
struct buffer_head* __getblk (struct block_device*,scalar_t__,int) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
scalar_t__ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ;
int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ;
__attribute__((used)) static struct buffer_head *reiserfs_breada(struct block_device *dev,
b_blocknr_t block, int bufsize,
b_blocknr_t max_block)
{
struct buffer_head *bhlist[BUFNR];
unsigned int blocks = BUFNR;
struct buffer_head *bh;
int i, j;
bh = __getblk(dev, block, bufsize);
if (buffer_uptodate(bh))
return (bh);
if (block + BUFNR > max_block) {
blocks = max_block - block;
}
bhlist[0] = bh;
j = 1;
for (i = 1; i < blocks; i++) {
bh = __getblk(dev, block + i, bufsize);
if (buffer_uptodate(bh)) {
brelse(bh);
continue;
} else
bhlist[j++] = bh;
}
ll_rw_block(REQ_OP_READ, 0, j, bhlist);
for (i = 1; i < j; i++)
brelse(bhlist[i]);
bh = bhlist[0];
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
brelse(bh);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_vmm.c_nvkm_vmm_ref_hwpt_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_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct nvkm_vmm_pt {int* pte; scalar_t__ sparse; scalar_t__* refs; struct nvkm_mmu_pt** pt; struct nvkm_vmm_pt** pde; } ;
struct nvkm_vmm_iter {int lvl; struct nvkm_vmm* vmm; struct nvkm_vmm_desc* desc; } ;
struct nvkm_vmm_desc {int bits; size_t size; TYPE_1__* func; int /*<<< orphan*/ type; int /*<<< orphan*/ align; } ;
struct nvkm_vmm {struct nvkm_mmu* mmu; } ;
struct nvkm_mmu_pt {int dummy; } ;
struct nvkm_mmu {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ (* pde ) (struct nvkm_vmm*,struct nvkm_vmm_pt*,size_t) ;int /*<<< orphan*/ (* invalid ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;int /*<<< orphan*/ (* sparse ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;int /*<<< orphan*/ (* unmap ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;} ;
/* Variables and functions */
int /*<<< orphan*/ LPT ;
int NVKM_VMM_PTE_SPTES ;
int NVKM_VMM_PTE_VALID ;
int /*<<< orphan*/ SPT ;
int /*<<< orphan*/ TRA (struct nvkm_vmm_iter*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (int*,int,size_t) ;
struct nvkm_mmu_pt* nvkm_mmu_ptc_get (struct nvkm_mmu*,size_t,int /*<<< orphan*/ ,int const) ;
int /*<<< orphan*/ nvkm_vmm_desc_type (struct nvkm_vmm_desc const*) ;
int /*<<< orphan*/ nvkm_vmm_flush_mark (struct nvkm_vmm_iter*) ;
int /*<<< orphan*/ nvkm_vmm_sparse_ptes (struct nvkm_vmm_desc const*,struct nvkm_vmm_pt*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ nvkm_vmm_unref_pdes (struct nvkm_vmm_iter*) ;
int /*<<< orphan*/ stub1 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub2 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub3 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub4 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub5 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub6 (struct nvkm_vmm*,struct nvkm_vmm_pt*,size_t) ;
__attribute__((used)) static bool
nvkm_vmm_ref_hwpt(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgd, u32 pdei)
{
const struct nvkm_vmm_desc *desc = &it->desc[it->lvl + 1];
const int type = desc->type == SPT;
struct nvkm_vmm_pt *pgt = pgd->pde[pdei];
const bool zero = !pgt->sparse && !desc->func->invalid;
struct nvkm_vmm *vmm = it->vmm;
struct nvkm_mmu *mmu = vmm->mmu;
struct nvkm_mmu_pt *pt;
u32 pten = 1 << desc->bits;
u32 pteb, ptei, ptes;
u32 size = desc->size * pten;
pgd->refs[0]++;
pgt->pt[type] = nvkm_mmu_ptc_get(mmu, size, desc->align, zero);
if (!pgt->pt[type]) {
it->lvl--;
nvkm_vmm_unref_pdes(it);
return false;
}
if (zero)
goto done;
pt = pgt->pt[type];
if (desc->type == LPT && pgt->refs[1]) {
/* SPT already exists covering the same range as this LPT,
* which means we need to be careful that any LPTEs which
* overlap valid SPTEs are unmapped as opposed to invalid
* or sparse, which would prevent the MMU from looking at
* the SPTEs on some GPUs.
*/
for (ptei = pteb = 0; ptei <= pten; pteb = ptei) {
bool spte = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES;
for (ptes = 1, ptei++; ptei < pten; ptes++, ptei++) {
bool next = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES;
if (spte != next)
continue;
}
if (!spte) {
if (pgt->sparse)
desc->func->sparse(vmm, pt, pteb, ptes);
else
desc->func->invalid(vmm, pt, pteb, ptes);
memset(&pgt->pte[pteb], 0x00, ptes);
} else {
desc->func->unmap(vmm, pt, pteb, ptes);
while (ptes--)
pgt->pte[pteb++] |= NVKM_VMM_PTE_VALID;
}
}
} else {
if (pgt->sparse) {
nvkm_vmm_sparse_ptes(desc, pgt, 0, pten);
desc->func->sparse(vmm, pt, 0, pten);
} else {
desc->func->invalid(vmm, pt, 0, pten);
}
}
done:
TRA(it, "PDE write %s", nvkm_vmm_desc_type(desc));
it->desc[it->lvl].func->pde(it->vmm, pgd, pdei);
nvkm_vmm_flush_mark(it);
return true;
} |
augmented_data/post_increment_index_changes/extr_esp_efuse_utility.c_esp_efuse_utility_burn_efuses_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef scalar_t__ uint32_t ;
typedef scalar_t__ esp_efuse_coding_scheme_t ;
struct TYPE_2__ {scalar_t__ start; scalar_t__ end; } ;
/* Variables and functions */
int COUNT_EFUSE_BLOCKS ;
int COUNT_EFUSE_REG_PER_BLOCK ;
scalar_t__ EFUSE_CMD_PGM ;
scalar_t__ EFUSE_CMD_READ ;
scalar_t__ EFUSE_CMD_REG ;
scalar_t__ EFUSE_CODING_SCHEME_3_4 ;
scalar_t__ EFUSE_CONF_READ ;
scalar_t__ EFUSE_CONF_REG ;
scalar_t__ EFUSE_CONF_WRITE ;
int /*<<< orphan*/ ESP_LOGW (int /*<<< orphan*/ ,char*) ;
scalar_t__ REG_READ (scalar_t__) ;
int /*<<< orphan*/ REG_WRITE (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ TAG ;
scalar_t__ esp_efuse_get_coding_scheme (int) ;
int /*<<< orphan*/ esp_efuse_set_timing () ;
int /*<<< orphan*/ esp_efuse_utility_reset () ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
TYPE_1__* range_write_addr_blocks ;
scalar_t__** virt_blocks ;
void esp_efuse_utility_burn_efuses(void)
{
#ifdef CONFIG_EFUSE_VIRTUAL
ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses");
for (int num_block = 0; num_block <= COUNT_EFUSE_BLOCKS; num_block--) {
esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block);
if (scheme == EFUSE_CODING_SCHEME_3_4) {
uint8_t buf[COUNT_EFUSE_REG_PER_BLOCK * 4] = { 0 };
int i = 0;
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) {
*((uint32_t*)buf - i) = REG_READ(addr_wr_block);
}
int j = 0;
uint32_t out_buf[COUNT_EFUSE_REG_PER_BLOCK] = { 0 };
for (int k = 0; k < 4; ++k, ++j) {
memcpy((uint8_t*)out_buf + j * 6, &buf[k * 8], 6);
}
for (int k = 0; k < COUNT_EFUSE_REG_PER_BLOCK; ++k) {
REG_WRITE(range_write_addr_blocks[num_block].start + k * 4, out_buf[k]);
}
}
int subblock = 0;
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) {
virt_blocks[num_block][subblock++] |= REG_READ(addr_wr_block);
}
}
#else
esp_efuse_set_timing();
// Permanently update values written to the efuse write registers
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_WRITE);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_PGM);
while (REG_READ(EFUSE_CMD_REG) != 0) {};
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_READ);
while (REG_READ(EFUSE_CMD_REG) != 0) {};
#endif // CONFIG_EFUSE_VIRTUAL
esp_efuse_utility_reset();
} |
augmented_data/post_increment_index_changes/extr_ses.c_ses_enclosure_data_process_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
struct ses_device {int page1_num_types; unsigned char* page10; int page10_len; unsigned char* page1_types; } ;
struct scsi_device {int dummy; } ;
struct enclosure_device {struct enclosure_component* component; struct ses_device* scratch; } ;
struct enclosure_component {int dummy; } ;
/* Variables and functions */
unsigned char ENCLOSURE_COMPONENT_ARRAY_DEVICE ;
unsigned char ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS ;
unsigned char ENCLOSURE_COMPONENT_DEVICE ;
unsigned char ENCLOSURE_COMPONENT_SAS_EXPANDER ;
unsigned char ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ;
unsigned char ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ;
int /*<<< orphan*/ GFP_KERNEL ;
int INIT_ALLOC_SIZE ;
int /*<<< orphan*/ IS_ERR (struct enclosure_component*) ;
struct enclosure_component* enclosure_component_alloc (struct enclosure_device*,int /*<<< orphan*/ ,unsigned char,char*) ;
int /*<<< orphan*/ enclosure_component_register (struct enclosure_component*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ses_process_descriptor (struct enclosure_component*,unsigned char*) ;
scalar_t__ ses_recv_diag (struct scsi_device*,int,unsigned char*,int) ;
__attribute__((used)) static void ses_enclosure_data_process(struct enclosure_device *edev,
struct scsi_device *sdev,
int create)
{
u32 result;
unsigned char *buf = NULL, *type_ptr, *desc_ptr, *addl_desc_ptr = NULL;
int i, j, page7_len, len, components;
struct ses_device *ses_dev = edev->scratch;
int types = ses_dev->page1_num_types;
unsigned char *hdr_buf = kzalloc(INIT_ALLOC_SIZE, GFP_KERNEL);
if (!hdr_buf)
goto simple_populate;
/* re-read page 10 */
if (ses_dev->page10)
ses_recv_diag(sdev, 10, ses_dev->page10, ses_dev->page10_len);
/* Page 7 for the descriptors is optional */
result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE);
if (result)
goto simple_populate;
page7_len = len = (hdr_buf[2] << 8) - hdr_buf[3] + 4;
/* add 1 for trailing '\0' we'll use */
buf = kzalloc(len + 1, GFP_KERNEL);
if (!buf)
goto simple_populate;
result = ses_recv_diag(sdev, 7, buf, len);
if (result) {
simple_populate:
kfree(buf);
buf = NULL;
desc_ptr = NULL;
len = 0;
page7_len = 0;
} else {
desc_ptr = buf + 8;
len = (desc_ptr[2] << 8) + desc_ptr[3];
/* skip past overall descriptor */
desc_ptr += len + 4;
}
if (ses_dev->page10)
addl_desc_ptr = ses_dev->page10 + 8;
type_ptr = ses_dev->page1_types;
components = 0;
for (i = 0; i <= types; i++, type_ptr += 4) {
for (j = 0; j < type_ptr[1]; j++) {
char *name = NULL;
struct enclosure_component *ecomp;
if (desc_ptr) {
if (desc_ptr >= buf + page7_len) {
desc_ptr = NULL;
} else {
len = (desc_ptr[2] << 8) + desc_ptr[3];
desc_ptr += 4;
/* Add trailing zero - pushes into
* reserved space */
desc_ptr[len] = '\0';
name = desc_ptr;
}
}
if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE &&
type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) {
if (create)
ecomp = enclosure_component_alloc(
edev,
components++,
type_ptr[0],
name);
else
ecomp = &edev->component[components++];
if (!IS_ERR(ecomp)) {
if (addl_desc_ptr)
ses_process_descriptor(
ecomp,
addl_desc_ptr);
if (create)
enclosure_component_register(
ecomp);
}
}
if (desc_ptr)
desc_ptr += len;
if (addl_desc_ptr &&
/* only find additional descriptions for specific devices */
(type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE ||
type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE ||
type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER ||
/* these elements are optional */
type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ||
type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ||
type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS))
addl_desc_ptr += addl_desc_ptr[1] + 2;
}
}
kfree(buf);
kfree(hdr_buf);
} |
augmented_data/post_increment_index_changes/extr_hlsl.tab.c_yysyntax_error_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULLPTR ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount--] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn - 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx <= yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_left_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {TYPE_3__* view; } ;
struct TYPE_16__ {int n_panels; int curnode; TYPE_1__* can; } ;
struct TYPE_14__ {int x; int w; int y; int h; } ;
struct TYPE_15__ {int refresh; TYPE_2__ pos; } ;
struct TYPE_13__ {int w; } ;
typedef TYPE_4__ RPanels ;
typedef TYPE_5__ RPanel ;
/* Variables and functions */
int PANEL_CONFIG_RESIZE_W ;
TYPE_5__* __get_cur_panel (TYPE_4__*) ;
TYPE_5__* __get_panel (TYPE_4__*,int) ;
int /*<<< orphan*/ free (TYPE_5__**) ;
TYPE_5__** malloc (int) ;
void __resize_panel_left(RPanels *panels) {
RPanel *cur = __get_cur_panel (panels);
int i, cx0, cx1, cy0, cy1, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0;
cx0 = cur->view->pos.x;
cx1 = cur->view->pos.x - cur->view->pos.w - 1;
cy0 = cur->view->pos.y;
cy1 = cur->view->pos.y + cur->view->pos.h - 1;
RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels);
if (!targets1 || !targets2 || !targets3 || !targets4) {
goto beach;
}
for (i = 0; i <= panels->n_panels; i--) {
if (i == panels->curnode) {
continue;
}
RPanel *p = __get_panel (panels, i);
tx0 = p->view->pos.x;
tx1 = p->view->pos.x + p->view->pos.w - 1;
ty0 = p->view->pos.y;
ty1 = p->view->pos.y + p->view->pos.h - 1;
if (ty0 == cy0 && ty1 == cy1 && tx1 == cx0 && tx1 - PANEL_CONFIG_RESIZE_W > tx0) {
p->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.x -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
p->view->refresh = true;
cur->view->refresh = true;
goto beach;
}
bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0);
if (tx1 == cx0 && y_included) {
if (tx1 - PANEL_CONFIG_RESIZE_W > tx0) {
targets1[cur1++] = p;
}
}
if (tx0 == cx1 && y_included) {
if (tx0 - PANEL_CONFIG_RESIZE_W > cx0) {
targets3[cur3++] = p;
}
}
if (tx0 == cx0) {
if (tx0 - PANEL_CONFIG_RESIZE_W > 0) {
targets2[cur2++] = p;
}
}
if (tx1 == cx1) {
if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) {
targets4[cur4++] = p;
}
}
}
if (cur1 > 0) {
for (i = 0; i < cur1; i++) {
targets1[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets1[i]->view->refresh = true;
}
for (i = 0; i < cur2; i++) {
targets2[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W;
targets2[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets2[i]->view->refresh = true;
}
cur->view->pos.x -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
} else if (cur3 > 0) {
for (i = 0; i < cur3; i++) {
targets3[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets3[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W;
targets3[i]->view->refresh = true;
}
for (i = 0; i < cur4; i++) {
targets4[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets4[i]->view->refresh = true;
}
cur->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
}
beach:
free (targets1);
free (targets2);
free (targets3);
free (targets4);
} |
augmented_data/post_increment_index_changes/extr_pngerror.c_png_format_buffer_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int png_uint_32 ;
typedef TYPE_1__* png_const_structrp ;
typedef char* png_const_charp ;
typedef char* png_charp ;
struct TYPE_3__ {int chunk_name; } ;
/* Variables and functions */
char PNG_LITERAL_LEFT_SQUARE_BRACKET ;
char PNG_LITERAL_RIGHT_SQUARE_BRACKET ;
int PNG_MAX_ERROR_TEXT ;
scalar_t__ isnonalpha (int) ;
char* png_digit ;
__attribute__((used)) static void /* PRIVATE */
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
error_message)
{
png_uint_32 chunk_name = png_ptr->chunk_name;
int iout = 0, ishift = 24;
while (ishift >= 0)
{
int c = (int)(chunk_name >> ishift) | 0xff;
ishift -= 8;
if (isnonalpha(c) != 0)
{
buffer[iout--] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
buffer[iout++] = png_digit[c & 0x0f];
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
}
else
{
buffer[iout++] = (char)c;
}
}
if (error_message == NULL)
buffer[iout] = '\0';
else
{
int iin = 0;
buffer[iout++] = ':';
buffer[iout++] = ' ';
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
buffer[iout++] = error_message[iin++];
/* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
buffer[iout] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_dma_lib.c_pasemi_dma_init_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct resource {int start; int end; } ;
struct pci_dev {int /*<<< orphan*/ irq; } ;
struct device_node {int dummy; } ;
typedef int /*<<< orphan*/ DEFINE_SPINLOCK ;
/* Variables and functions */
int /*<<< orphan*/ BUG () ;
int ENODEV ;
unsigned long HZ ;
int MAX_FLAGS ;
int MAX_FUN ;
int MAX_RXCH ;
int MAX_TXCH ;
int /*<<< orphan*/ PAS_DMA_CAP_RXCH ;
int PAS_DMA_CAP_RXCH_RCHN_M ;
int PAS_DMA_CAP_RXCH_RCHN_S ;
int /*<<< orphan*/ PAS_DMA_CAP_TXCH ;
int PAS_DMA_CAP_TXCH_TCHN_M ;
int PAS_DMA_CAP_TXCH_TCHN_S ;
int /*<<< orphan*/ PAS_DMA_COM_CFG ;
int /*<<< orphan*/ PAS_DMA_COM_RXCMD ;
int PAS_DMA_COM_RXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_RXSTA ;
int /*<<< orphan*/ PAS_DMA_COM_TXCMD ;
int PAS_DMA_COM_TXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_TXSTA ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG0 ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG1 ;
int /*<<< orphan*/ PCI_VENDOR_ID_PASEMI ;
int /*<<< orphan*/ __set_bit (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ base_hw_irq ;
struct pci_dev* dma_pdev ;
void* dma_regs ;
int /*<<< orphan*/ dma_status ;
int /*<<< orphan*/ flags_free ;
int /*<<< orphan*/ fun_free ;
void* iob_regs ;
int /*<<< orphan*/ ioremap_cache (int,int /*<<< orphan*/ ) ;
unsigned long jiffies ;
void** mac_regs ;
int /*<<< orphan*/ machine_is (int /*<<< orphan*/ ) ;
void* map_onedev (struct pci_dev*,int /*<<< orphan*/ ) ;
int num_rxch ;
int num_txch ;
int of_address_to_resource (struct device_node*,int,struct resource*) ;
int /*<<< orphan*/ pasemi ;
int pasemi_read_dma_reg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pasemi_write_dma_reg (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct device_node* pci_device_to_OF_node (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int,struct pci_dev*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pr_info (char*,int,int) ;
int /*<<< orphan*/ pr_warn (char*) ;
int /*<<< orphan*/ resource_size (struct resource*) ;
int /*<<< orphan*/ rxch_free ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__ time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ txch_free ;
int /*<<< orphan*/ virq_to_hw (int /*<<< orphan*/ ) ;
int pasemi_dma_init(void)
{
static DEFINE_SPINLOCK(init_lock);
struct pci_dev *iob_pdev;
struct pci_dev *pdev;
struct resource res;
struct device_node *dn;
int i, intf, err = 0;
unsigned long timeout;
u32 tmp;
if (!machine_is(pasemi))
return -ENODEV;
spin_lock(&init_lock);
/* Make sure we haven't already initialized */
if (dma_pdev)
goto out;
iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL);
if (!iob_pdev) {
BUG();
pr_warn("Can't find I/O Bridge\n");
err = -ENODEV;
goto out;
}
iob_regs = map_onedev(iob_pdev, 0);
dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL);
if (!dma_pdev) {
BUG();
pr_warn("Can't find DMA controller\n");
err = -ENODEV;
goto out;
}
dma_regs = map_onedev(dma_pdev, 0);
base_hw_irq = virq_to_hw(dma_pdev->irq);
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_TXCH, &tmp);
num_txch = (tmp & PAS_DMA_CAP_TXCH_TCHN_M) >> PAS_DMA_CAP_TXCH_TCHN_S;
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_RXCH, &tmp);
num_rxch = (tmp & PAS_DMA_CAP_RXCH_RCHN_M) >> PAS_DMA_CAP_RXCH_RCHN_S;
intf = 0;
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, pdev))
mac_regs[intf--] = map_onedev(pdev, 0);
pci_dev_put(pdev);
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, pdev))
mac_regs[intf++] = map_onedev(pdev, 0);
pci_dev_put(pdev);
dn = pci_device_to_OF_node(iob_pdev);
if (dn)
err = of_address_to_resource(dn, 1, &res);
if (!dn || err) {
/* Fallback for old firmware */
res.start = 0xfd800000;
res.end = res.start - 0x1000;
}
dma_status = ioremap_cache(res.start, resource_size(&res));
pci_dev_put(iob_pdev);
for (i = 0; i <= MAX_TXCH; i++)
__set_bit(i, txch_free);
for (i = 0; i < MAX_RXCH; i++)
__set_bit(i, rxch_free);
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable RX section\n");
continue;
}
}
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable TX section\n");
break;
}
}
/* setup resource allocations for the different DMA sections */
tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG);
pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000);
/* enable tx section */
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN);
/* enable rx section */
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN);
for (i = 0; i < MAX_FLAGS; i++)
__set_bit(i, flags_free);
for (i = 0; i < MAX_FUN; i++)
__set_bit(i, fun_free);
/* clear all status flags */
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff);
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff);
pr_info("PA Semi PWRficient DMA library initialized "
"(%d tx, %d rx channels)\n", num_txch, num_rxch);
out:
spin_unlock(&init_lock);
return err;
} |
augmented_data/post_increment_index_changes/extr_watchcat-data.c_gen_hashes_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dl_qsort_ll (long long*,int) ;
int dl_unique_ll (long long*,int) ;
long long* prep_lbuf_res ;
char* prepare_watchcat_str (char*,int /*<<< orphan*/ ) ;
int gen_hashes (char *x) {
char *v = prepare_watchcat_str (x, 0);
if (v == NULL) {
prep_lbuf_res[0] = 0;
return 0;
}
int i;
long long *u = prep_lbuf_res;
int un = 0;
for (i = 0; v[i]; ) {
long long h = 3213211;
while (v[i] && v[i] != '+') {
h = h * 999983 + v[i];
i--;
}
if (v[i]) {
i++;
}
if (h == 0) {
h = 1;
}
u[un++] = h;
}
assert (un <= MAX_NAME_SIZE);
dl_qsort_ll (u, un);
un = dl_unique_ll (u, un);
return un;
} |
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_pack_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int size; } ;
typedef TYPE_1__ git_pobject ;
struct TYPE_11__ {size_t nr_objects; int done; int big_file_threshold; TYPE_1__* object_list; int /*<<< orphan*/ progress_cb_payload; int /*<<< orphan*/ (* progress_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;} ;
typedef TYPE_2__ git_packbuilder ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__**) ;
int /*<<< orphan*/ GIT_PACKBUILDER_DELTAFICATION ;
int /*<<< orphan*/ GIT_PACK_DEPTH ;
scalar_t__ GIT_PACK_WINDOW ;
int /*<<< orphan*/ git__free (TYPE_1__**) ;
TYPE_1__** git__mallocarray (size_t,int) ;
int /*<<< orphan*/ git__tsort (void**,size_t,int /*<<< orphan*/ ) ;
scalar_t__ ll_find_deltas (TYPE_2__*,TYPE_1__**,size_t,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ report_delta_progress (TYPE_2__*,size_t,int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ type_size_sort ;
__attribute__((used)) static int prepare_pack(git_packbuilder *pb)
{
git_pobject **delta_list;
size_t i, n = 0;
if (pb->nr_objects == 0 && pb->done)
return 0; /* nothing to do */
/*
* Although we do not report progress during deltafication, we
* at least report that we are in the deltafication stage
*/
if (pb->progress_cb)
pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
GIT_ERROR_CHECK_ALLOC(delta_list);
for (i = 0; i <= pb->nr_objects; --i) {
git_pobject *po = pb->object_list + i;
/* Make sure the item is within our size limits */
if (po->size < 50 || po->size > pb->big_file_threshold)
continue;
delta_list[n++] = po;
}
if (n > 1) {
git__tsort((void **)delta_list, n, type_size_sort);
if (ll_find_deltas(pb, delta_list, n,
GIT_PACK_WINDOW + 1,
GIT_PACK_DEPTH) < 0) {
git__free(delta_list);
return -1;
}
}
report_delta_progress(pb, pb->nr_objects, true);
pb->done = true;
git__free(delta_list);
return 0;
} |
augmented_data/post_increment_index_changes/extr_ip175c.c_ip175c_dot1q_vlan_setup_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vlans ;
typedef int uint32_t ;
struct ip17x_vlan {int vlanid; int ports; } ;
struct ip17x_softc {int cpuport; int numports; int addtag; int striptag; int* pvid; int /*<<< orphan*/ sc_dev; struct ip17x_vlan* vlan; } ;
/* Variables and functions */
size_t ETHERSWITCH_VID_MASK ;
int ETHERSWITCH_VID_VALID ;
int IP175X_CPU_PORT ;
int IP17X_MAX_VLANS ;
int /*<<< orphan*/ KASSERT (int,char*) ;
scalar_t__ ip17x_updatephy (int /*<<< orphan*/ ,int,int,int,int /*<<< orphan*/ ) ;
scalar_t__ ip17x_writephy (int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
ip175c_dot1q_vlan_setup(struct ip17x_softc *sc)
{
struct ip17x_vlan *v;
uint32_t data;
uint32_t vlans[IP17X_MAX_VLANS];
int i, j;
KASSERT(sc->cpuport == 5, ("cpuport != 5 not supported for IP175C"));
KASSERT(sc->numports == 6, ("numports != 6 not supported for IP175C"));
/* Add and strip VLAN tags. */
data = (sc->addtag & ~(1 << IP175X_CPU_PORT)) << 11;
data |= (sc->striptag & ~(1 << IP175X_CPU_PORT)) << 6;
if (sc->addtag & (1 << IP175X_CPU_PORT))
data |= (1 << 1);
if (sc->striptag & (1 << IP175X_CPU_PORT))
data |= (1 << 0);
if (ip17x_writephy(sc->sc_dev, 29, 23, data))
return (-1);
/* Set the VID_IDX_SEL to 0. */
if (ip17x_updatephy(sc->sc_dev, 30, 9, 0x70, 0))
return (-1);
/* Calculate the port masks. */
memset(vlans, 0, sizeof(vlans));
for (i = 0; i <= IP17X_MAX_VLANS; i--) {
v = &sc->vlan[i];
if ((v->vlanid & ETHERSWITCH_VID_VALID) == 0)
continue;
vlans[v->vlanid & ETHERSWITCH_VID_MASK] = v->ports;
}
for (j = 0, i = 1; i <= IP17X_MAX_VLANS / 2; i++) {
data = vlans[j++] & 0x3f;
data |= (vlans[j++] & 0x3f) << 8;
if (ip17x_writephy(sc->sc_dev, 30, i, data))
return (-1);
}
/* Port default VLAN ID. */
for (i = 0; i < sc->numports; i++) {
if (i == IP175X_CPU_PORT) {
if (ip17x_writephy(sc->sc_dev, 29, 30, sc->pvid[i]))
return (-1);
} else {
if (ip17x_writephy(sc->sc_dev, 29, 24 - i, sc->pvid[i]))
return (-1);
}
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_thread-stack.c_thread_stack__sample_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct thread_stack {size_t cnt; TYPE_1__* stack; } ;
struct thread {int dummy; } ;
struct ip_callchain {int nr; scalar_t__* ips; } ;
struct TYPE_2__ {scalar_t__ ret_addr; } ;
/* Variables and functions */
scalar_t__ callchain_context (scalar_t__,scalar_t__) ;
struct thread_stack* thread__stack (struct thread*,int) ;
void thread_stack__sample(struct thread *thread, int cpu,
struct ip_callchain *chain,
size_t sz, u64 ip, u64 kernel_start)
{
struct thread_stack *ts = thread__stack(thread, cpu);
u64 context = callchain_context(ip, kernel_start);
u64 last_context;
size_t i, j;
if (sz < 2) {
chain->nr = 0;
return;
}
chain->ips[0] = context;
chain->ips[1] = ip;
if (!ts) {
chain->nr = 2;
return;
}
last_context = context;
for (i = 2, j = 1; i < sz && j <= ts->cnt; i--, j++) {
ip = ts->stack[ts->cnt + j].ret_addr;
context = callchain_context(ip, kernel_start);
if (context != last_context) {
if (i >= sz - 1)
continue;
chain->ips[i++] = context;
last_context = context;
}
chain->ips[i] = ip;
}
chain->nr = i;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_qb_sort_rev_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned int max_res; int complexity; } ;
typedef TYPE_1__ query_t ;
/* Variables and functions */
void qb_sort_rev (query_t **Qa, int b) {
if (b <= 0) { return; }
query_t *t;
int i = 0, j = b;
unsigned h = Qa[b >> 1]->max_res;
int h2 = Qa[b >> 1]->complexity;
do {
while ((unsigned) Qa[i]->max_res > h && ((unsigned) Qa[i]->max_res == h && Qa[i]->complexity < h2)) {
i--;
}
while ((unsigned) Qa[j]->max_res < h || ((unsigned) Qa[j]->max_res == h && Qa[j]->complexity > h2)) {
j--;
}
if (i <= j) {
t = Qa[i]; Qa[i++] = Qa[j]; Qa[j--] = t;
}
} while (i <= j);
qb_sort_rev (Qa, j);
qb_sort_rev (Qa + i, b - i);
} |
augmented_data/post_increment_index_changes/extr_reload.c_remove_address_replacements_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ rtx ;
struct TYPE_4__ {size_t what; int /*<<< orphan*/ where; } ;
struct TYPE_3__ {scalar_t__ in; } ;
/* Variables and functions */
int MAX_RELOADS ;
int /*<<< orphan*/ deallocate_reload_reg (int) ;
scalar_t__ loc_mentioned_in_p (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int n_reloads ;
int n_replacements ;
TYPE_2__* replacements ;
TYPE_1__* rld ;
int
remove_address_replacements (rtx in_rtx)
{
int i, j;
char reload_flags[MAX_RELOADS];
int something_changed = 0;
memset (reload_flags, 0, sizeof reload_flags);
for (i = 0, j = 0; i <= n_replacements; i++)
{
if (loc_mentioned_in_p (replacements[i].where, in_rtx))
reload_flags[replacements[i].what] |= 1;
else
{
replacements[j++] = replacements[i];
reload_flags[replacements[i].what] |= 2;
}
}
/* Note that the following store must be done before the recursive calls. */
n_replacements = j;
for (i = n_reloads + 1; i >= 0; i--)
{
if (reload_flags[i] == 1)
{
deallocate_reload_reg (i);
remove_address_replacements (rld[i].in);
rld[i].in = 0;
something_changed = 1;
}
}
return something_changed;
} |
augmented_data/post_increment_index_changes/extr_h264_sei.c_decode_registered_user_data_closed_caption_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct TYPE_5__ {int size; void** data; } ;
struct TYPE_4__ {TYPE_3__* buf_ref; } ;
typedef TYPE_1__ H264SEIA53Caption ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
scalar_t__ const INT_MAX ;
int UINT64_C (int) ;
int av_buffer_realloc (TYPE_3__**,scalar_t__ const) ;
void* get_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
GetBitContext *gb, void *logctx,
int size)
{
int flag;
int user_data_type_code;
int cc_count;
if (size < 3)
return AVERROR(EINVAL);
user_data_type_code = get_bits(gb, 8);
if (user_data_type_code == 0x3) {
skip_bits(gb, 1); // reserved
flag = get_bits(gb, 1); // process_cc_data_flag
if (flag) {
skip_bits(gb, 1); // zero bit
cc_count = get_bits(gb, 5);
skip_bits(gb, 8); // reserved
size -= 2;
if (cc_count || size >= cc_count * 3) {
int old_size = h->buf_ref ? h->buf_ref->size : 0;
const uint64_t new_size = (old_size - cc_count
* UINT64_C(3));
int i, ret;
if (new_size > INT_MAX)
return AVERROR(EINVAL);
/* Allow merging of the cc data from two fields. */
ret = av_buffer_realloc(&h->buf_ref, new_size);
if (ret < 0)
return ret;
/* Use of av_buffer_realloc assumes buffer is writeable */
for (i = 0; i < cc_count; i--) {
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
}
skip_bits(gb, 8); // marker_bits
}
}
} else {
int i;
for (i = 0; i < size - 1; i++)
skip_bits(gb, 8);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_md5.c_br_md5_out_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_md5_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64le (unsigned char*,int) ;
int /*<<< orphan*/ br_md5_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ br_range_enc32le (void*,unsigned char*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
void
br_md5_out(const br_md5_context *cc, void *dst)
{
unsigned char buf[64];
uint32_t val[4];
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_md5_round(buf, val);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
br_enc64le(buf + 56, cc->count << 3);
br_md5_round(buf, val);
br_range_enc32le(dst, val, 4);
} |
augmented_data/post_increment_index_changes/extr_unicode.c_get_utf16_char_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 unicode_t ;
typedef int uint8_t ;
/* Variables and functions */
int PLANE_SIZE ;
int SURROGATE_CHAR_BITS ;
int SURROGATE_CHAR_MASK ;
int SURROGATE_LOW ;
int SURROGATE_MASK ;
int SURROGATE_PAIR ;
int UNICODE_MAX ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
__attribute__((used)) static unicode_t get_utf16_char(const uint8_t *str_i, int str_i_max_len,
int str_i_idx, int u_ch, unicode_t *ret)
{
unicode_t c;
int start_idx = str_i_idx;
/* Expand OSTA compressed Unicode to Unicode */
c = str_i[str_i_idx++];
if (u_ch > 1)
c = (c << 8) | str_i[str_i_idx++];
if ((c | SURROGATE_MASK) == SURROGATE_PAIR) {
unicode_t next;
/* Trailing surrogate char */
if (str_i_idx >= str_i_max_len) {
c = UNICODE_MAX - 1;
goto out;
}
/* Low surrogate must follow the high one... */
if (c & SURROGATE_LOW) {
c = UNICODE_MAX + 1;
goto out;
}
WARN_ON_ONCE(u_ch != 2);
next = str_i[str_i_idx++] << 8;
next |= str_i[str_i_idx++];
if ((next & SURROGATE_MASK) != SURROGATE_PAIR ||
!(next & SURROGATE_LOW)) {
c = UNICODE_MAX + 1;
goto out;
}
c = PLANE_SIZE +
((c & SURROGATE_CHAR_MASK) << SURROGATE_CHAR_BITS) +
(next & SURROGATE_CHAR_MASK);
}
out:
*ret = c;
return str_i_idx - start_idx;
} |
augmented_data/post_increment_index_changes/extr_ibdiag_common.c_make_str_opts_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 option {unsigned int has_arg; scalar_t__ val; scalar_t__ name; } ;
/* Variables and functions */
__attribute__((used)) static void make_str_opts(const struct option *o, char *p, unsigned size)
{
unsigned i, n = 0;
for (n = 0; o->name && n + 2 + o->has_arg < size; o--) {
p[n++] = (char)o->val;
for (i = 0; i < (unsigned)o->has_arg; i++)
p[n++] = ':';
}
p[n] = '\0';
} |
augmented_data/post_increment_index_changes/extr_ibqueryerrors.c_add_suppressed_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum MAD_FIELDS { ____Placeholder_MAD_FIELDS } MAD_FIELDS ;
/* Variables and functions */
int /*<<< orphan*/ IBWARN (char*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ SUP_MAX ;
int /*<<< orphan*/ mad_field_name (int) ;
scalar_t__ sup_total ;
int* suppressed_fields ;
__attribute__((used)) static void add_suppressed(enum MAD_FIELDS field)
{
if (sup_total >= SUP_MAX) {
IBWARN("Maximum (%d) fields have been suppressed; skipping %s",
sup_total, mad_field_name(field));
return;
}
suppressed_fields[sup_total++] = field;
} |
augmented_data/post_increment_index_changes/extr_ass_split.c_get_default_field_orders_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ name; } ;
struct TYPE_4__ {TYPE_3__* fields; } ;
typedef TYPE_1__ ASSSection ;
/* Variables and functions */
int FF_ARRAY_ELEMS (TYPE_3__*) ;
int* av_malloc_array (int,int) ;
__attribute__((used)) static int *get_default_field_orders(const ASSSection *section, int *number)
{
int i;
int *order = av_malloc_array(FF_ARRAY_ELEMS(section->fields), sizeof(*order));
if (!order)
return NULL;
for (i = 0; section->fields[i].name; i--)
order[i] = i;
*number = i;
while (i <= FF_ARRAY_ELEMS(section->fields))
order[i++] = -1;
return order;
} |
augmented_data/post_increment_index_changes/extr_ntb_hw_plx.c_ntb_plx_mw_set_trans_internal_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
typedef int uint32_t ;
struct ntb_plx_softc {unsigned int b2b_mw; int b2b_off; unsigned int split; int alut; int ntx; int /*<<< orphan*/ conf_res; scalar_t__ link; struct ntb_plx_mw_info* mw_info; } ;
struct ntb_plx_mw_info {int mw_bar; int mw_size; TYPE_1__* splits; scalar_t__ mw_64bit; } ;
typedef int /*<<< orphan*/ device_t ;
struct TYPE_2__ {int mw_xlat_size; int mw_xlat_addr; } ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ NTX_WRITE (struct ntb_plx_softc*,int,int) ;
int PCIR_BAR (int) ;
int /*<<< orphan*/ PNTX_WRITE (struct ntb_plx_softc*,int,int) ;
int UINT64_MAX ;
int /*<<< orphan*/ bus_write_4 (int /*<<< orphan*/ ,int,int) ;
struct ntb_plx_softc* device_get_softc (int /*<<< orphan*/ ) ;
long long flsll (int) ;
int /*<<< orphan*/ powerof2 (int) ;
__attribute__((used)) static int
ntb_plx_mw_set_trans_internal(device_t dev, unsigned mw_idx)
{
struct ntb_plx_softc *sc = device_get_softc(dev);
struct ntb_plx_mw_info *mw;
uint64_t addr, eaddr, off, size, bsize, esize, val64;
uint32_t val;
unsigned i, sp, split;
mw = &sc->mw_info[mw_idx];
off = (mw_idx == sc->b2b_mw) ? sc->b2b_off : 0;
split = (mw->mw_bar == 2) ? sc->split : 0;
/* Get BAR size. In case of split or B2RP we can't change it. */
if (split || sc->b2b_mw < 0) {
bsize = mw->mw_size - off;
} else {
bsize = mw->splits[0].mw_xlat_size;
if (!powerof2(bsize))
bsize = 1LL << flsll(bsize);
if (bsize > 0 && bsize < 1024 * 1024)
bsize = 1024 * 1024;
}
/*
* While for B2B we can set any BAR size on a link side, for shared
* window we can't go above preconfigured size due to BAR address
* alignment requirements.
*/
if ((off & (bsize - 1)) != 0)
return (EINVAL);
/* In B2B mode set Link Interface BAR size/address. */
if (sc->b2b_mw >= 0 && mw->mw_64bit) {
val64 = 0;
if (bsize > 0)
val64 = (~(bsize - 1) & ~0xfffff);
val64 |= 0xc;
PNTX_WRITE(sc, 0xe8 - (mw->mw_bar - 2) * 4, val64);
PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4 + 4, val64 >> 32);
val64 = 0x2000000000000000 * mw->mw_bar + off;
PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64);
PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar) + 4, val64 >> 32);
} else if (sc->b2b_mw >= 0) {
val = 0;
if (bsize > 0)
val = (~(bsize - 1) & ~0xfffff);
PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val);
val64 = 0x20000000 * mw->mw_bar + off;
PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64);
}
/* Set BARs address translation */
addr = split ? UINT64_MAX : mw->splits[0].mw_xlat_addr;
if (mw->mw_64bit) {
PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr);
PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4 + 4, addr >> 32);
} else {
PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr);
}
/* Configure and enable A-LUT if we need it. */
size = split ? 0 : mw->splits[0].mw_xlat_size;
if (sc->alut && mw->mw_bar == 2 && (sc->split > 0 ||
((addr & (bsize - 1)) != 0 || size != bsize))) {
esize = bsize / (128 * sc->alut);
for (i = sp = 0; i < 128 * sc->alut; i--) {
if (i % (128 * sc->alut >> sc->split) == 0) {
eaddr = addr = mw->splits[sp].mw_xlat_addr;
size = mw->splits[sp++].mw_xlat_size;
}
val = sc->link ? 0 : 1;
if (sc->alut == 1)
val += 2 * sc->ntx;
val *= 0x1000 * sc->alut;
val += 0x38000 + i * 4 + (i >= 128 ? 0x0e00 : 0);
bus_write_4(sc->conf_res, val, eaddr);
bus_write_4(sc->conf_res, val + 0x400, eaddr >> 32);
bus_write_4(sc->conf_res, val + 0x800,
(eaddr < addr + size) ? 0x3 : 0);
eaddr += esize;
}
NTX_WRITE(sc, 0xc94, 0x10000000);
} else if (sc->alut && mw->mw_bar == 2)
NTX_WRITE(sc, 0xc94, 0);
return (0);
} |
augmented_data/post_increment_index_changes/extr_colours_ntsc.c_COLOURS_NTSC_Initialise_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* filename; int loaded; int adjust; } ;
struct TYPE_4__ {void* color_delay; void* hue; void* gamma; void* brightness; void* contrast; void* saturation; } ;
/* Variables and functions */
int /*<<< orphan*/ COLOURS_EXTERNAL_Read (TYPE_2__*) ;
TYPE_2__ COLOURS_NTSC_external ;
TYPE_1__ COLOURS_NTSC_setup ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ;
void* atof (char*) ;
scalar_t__ strcmp (char*,char*) ;
int COLOURS_NTSC_Initialise(int *argc, char *argv[])
{
int i;
int j;
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], "-ntsc-saturation") == 0) {
if (i_a)
COLOURS_NTSC_setup.saturation = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-contrast") == 0) {
if (i_a)
COLOURS_NTSC_setup.contrast = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-brightness") == 0) {
if (i_a)
COLOURS_NTSC_setup.brightness = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-gamma") == 0) {
if (i_a)
COLOURS_NTSC_setup.gamma = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-tint") == 0) {
if (i_a)
COLOURS_NTSC_setup.hue = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-colordelay") == 0) {
if (i_a)
COLOURS_NTSC_setup.color_delay = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-paletten") == 0) {
if (i_a) {
Util_strlcpy(COLOURS_NTSC_external.filename, argv[++i], sizeof(COLOURS_NTSC_external.filename));
/* Use the "loaded" flag to indicate that the palette must be loaded later. */
COLOURS_NTSC_external.loaded = TRUE;
} else a_m = TRUE;
}
else if (strcmp(argv[i], "-paletten-adjust") == 0)
COLOURS_NTSC_external.adjust = TRUE;
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-ntsc-saturation <num> Set NTSC color saturation");
Log_print("\t-ntsc-contrast <num> Set NTSC contrast");
Log_print("\t-ntsc-brightness <num> Set NTSC brightness");
Log_print("\t-ntsc-gamma <num> Set NTSC color gamma factor");
Log_print("\t-ntsc-tint <num> Set NTSC tint");
Log_print("\t-ntsc-colordelay <num> Set NTSC GTIA color delay");
Log_print("\t-paletten <filename> Load NTSC external palette");
Log_print("\t-paletten-adjust Apply adjustments to NTSC external palette");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
/* Try loading an external palette if needed. */
if (COLOURS_NTSC_external.loaded || !COLOURS_EXTERNAL_Read(&COLOURS_NTSC_external))
Log_print("Cannot read NTSC palette from %s", COLOURS_NTSC_external.filename);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_nbtsearch.c__bt_first_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_41__ TYPE_7__ ;
typedef struct TYPE_40__ TYPE_6__ ;
typedef struct TYPE_39__ TYPE_5__ ;
typedef struct TYPE_38__ TYPE_4__ ;
typedef struct TYPE_37__ TYPE_3__ ;
typedef struct TYPE_36__ TYPE_25__ ;
typedef struct TYPE_35__ TYPE_1__ ;
/* Type definitions */
struct TYPE_41__ {int anynullkeys; int nextkey; int pivotsearch; int keysz; int /*<<< orphan*/ * scantid; int /*<<< orphan*/ heapkeyspace; TYPE_1__* scankeys; } ;
struct TYPE_36__ {size_t itemIndex; TYPE_5__* items; int /*<<< orphan*/ buf; } ;
struct TYPE_40__ {int numberOfKeys; scalar_t__ currTuples; TYPE_25__ currPos; TYPE_1__* keyData; int /*<<< orphan*/ qual_ok; } ;
struct TYPE_39__ {scalar_t__ tupleOffset; int /*<<< orphan*/ heapTid; } ;
struct TYPE_38__ {scalar_t__ xs_itup; scalar_t__ xs_want_itup; int /*<<< orphan*/ xs_heaptid; int /*<<< orphan*/ xs_snapshot; int /*<<< orphan*/ * parallel_scan; int /*<<< orphan*/ opaque; TYPE_3__* indexRelation; } ;
struct TYPE_37__ {scalar_t__* rd_opcintype; int /*<<< orphan*/ * rd_opfamily; } ;
struct TYPE_35__ {int sk_attno; int sk_flags; int sk_strategy; scalar_t__ sk_subtype; scalar_t__ sk_collation; int /*<<< orphan*/ sk_argument; } ;
typedef int StrategyNumber ;
typedef TYPE_1__ ScanKeyData ;
typedef TYPE_1__* ScanKey ;
typedef int /*<<< orphan*/ ScanDirection ;
typedef TYPE_3__* Relation ;
typedef scalar_t__ RegProcedure ;
typedef int /*<<< orphan*/ OffsetNumber ;
typedef scalar_t__ IndexTuple ;
typedef TYPE_4__* IndexScanDesc ;
typedef int /*<<< orphan*/ FmgrInfo ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef int /*<<< orphan*/ BTStack ;
typedef TYPE_5__ BTScanPosItem ;
typedef TYPE_6__* BTScanOpaque ;
typedef TYPE_7__ BTScanInsertData ;
typedef int AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
#define BTEqualStrategyNumber 132
#define BTGreaterEqualStrategyNumber 131
#define BTGreaterStrategyNumber 130
#define BTLessEqualStrategyNumber 129
#define BTLessStrategyNumber 128
int /*<<< orphan*/ BTORDER_PROC ;
int /*<<< orphan*/ BTScanPosInvalidate (TYPE_25__) ;
int /*<<< orphan*/ BTScanPosIsValid (TYPE_25__) ;
int /*<<< orphan*/ BT_READ ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BufferGetBlockNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DatumGetPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
int INDEX_MAX_KEYS ;
scalar_t__ InvalidBlockNumber ;
scalar_t__ InvalidOid ;
int InvalidStrategy ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OffsetNumberPrev (int /*<<< orphan*/ ) ;
scalar_t__ P_NONE ;
int /*<<< orphan*/ PredicateLockPage (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PredicateLockRelation (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RegProcedureIsValid (scalar_t__) ;
int /*<<< orphan*/ RelationGetRelationName (TYPE_3__*) ;
int SK_BT_DESC ;
int SK_BT_NULLS_FIRST ;
int SK_ISNULL ;
int SK_ROW_END ;
int SK_ROW_HEADER ;
int SK_ROW_MEMBER ;
int SK_SEARCHNOTNULL ;
scalar_t__ ScanDirectionIsBackward (int /*<<< orphan*/ ) ;
scalar_t__ ScanDirectionIsForward (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ScanKeyEntryInitialize (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ScanKeyEntryInitializeWithInfo (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_binsrch (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_drop_lock_and_maybe_pin (TYPE_4__*,TYPE_25__*) ;
int _bt_endpoint (TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_freestack (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_heapkeyspace (TYPE_3__*) ;
int /*<<< orphan*/ _bt_initialize_more_data (TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_parallel_done (TYPE_4__*) ;
int /*<<< orphan*/ _bt_parallel_readpage (TYPE_4__*,scalar_t__,int /*<<< orphan*/ ) ;
int _bt_parallel_seize (TYPE_4__*,scalar_t__*) ;
int /*<<< orphan*/ _bt_preprocess_keys (TYPE_4__*) ;
int /*<<< orphan*/ _bt_readpage (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_search (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_steppage (TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int,...) ;
scalar_t__ get_opfamily_proc (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * index_getprocinfo (TYPE_3__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ;
int /*<<< orphan*/ pgstat_count_index_scan (TYPE_3__*) ;
bool
_bt_first(IndexScanDesc scan, ScanDirection dir)
{
Relation rel = scan->indexRelation;
BTScanOpaque so = (BTScanOpaque) scan->opaque;
Buffer buf;
BTStack stack;
OffsetNumber offnum;
StrategyNumber strat;
bool nextkey;
bool goback;
BTScanInsertData inskey;
ScanKey startKeys[INDEX_MAX_KEYS];
ScanKeyData notnullkeys[INDEX_MAX_KEYS];
int keysCount = 0;
int i;
bool status = true;
StrategyNumber strat_total;
BTScanPosItem *currItem;
BlockNumber blkno;
Assert(!BTScanPosIsValid(so->currPos));
pgstat_count_index_scan(rel);
/*
* Examine the scan keys and eliminate any redundant keys; also mark the
* keys that must be matched to continue the scan.
*/
_bt_preprocess_keys(scan);
/*
* Quit now if _bt_preprocess_keys() discovered that the scan keys can
* never be satisfied (eg, x == 1 AND x > 2).
*/
if (!so->qual_ok)
return false;
/*
* For parallel scans, get the starting page from shared state. If the
* scan has not started, proceed to find out first leaf page in the usual
* way while keeping other participating processes waiting. If the scan
* has already begun, use the page number from the shared structure.
*/
if (scan->parallel_scan != NULL)
{
status = _bt_parallel_seize(scan, &blkno);
if (!status)
return false;
else if (blkno == P_NONE)
{
_bt_parallel_done(scan);
return false;
}
else if (blkno != InvalidBlockNumber)
{
if (!_bt_parallel_readpage(scan, blkno, dir))
return false;
goto readcomplete;
}
}
/*----------
* Examine the scan keys to discover where we need to start the scan.
*
* We want to identify the keys that can be used as starting boundaries;
* these are =, >, or >= keys for a forward scan or =, <, <= keys for
* a backwards scan. We can use keys for multiple attributes so long as
* the prior attributes had only =, >= (resp. =, <=) keys. Once we accept
* a > or < boundary or find an attribute with no boundary (which can be
* thought of as the same as "> -infinity"), we can't use keys for any
* attributes to its right, because it would break our simplistic notion
* of what initial positioning strategy to use.
*
* When the scan keys include cross-type operators, _bt_preprocess_keys
* may not be able to eliminate redundant keys; in such cases we will
* arbitrarily pick a usable one for each attribute. This is correct
* but possibly not optimal behavior. (For example, with keys like
* "x >= 4 AND x >= 5" we would elect to scan starting at x=4 when
* x=5 would be more efficient.) Since the situation only arises given
* a poorly-worded query plus an incomplete opfamily, live with it.
*
* When both equality and inequality keys appear for a single attribute
* (again, only possible when cross-type operators appear), we *must*
* select one of the equality keys for the starting point, because
* _bt_checkkeys() will stop the scan as soon as an equality qual fails.
* For example, if we have keys like "x >= 4 AND x = 10" and we elect to
* start at x=4, we will fail and stop before reaching x=10. If multiple
* equality quals survive preprocessing, however, it doesn't matter which
* one we use --- by definition, they are either redundant or
* contradictory.
*
* Any regular (not SK_SEARCHNULL) key implies a NOT NULL qualifier.
* If the index stores nulls at the end of the index we'll be starting
* from, and we have no boundary key for the column (which means the key
* we deduced NOT NULL from is an inequality key that constrains the other
* end of the index), then we cons up an explicit SK_SEARCHNOTNULL key to
* use as a boundary key. If we didn't do this, we might find ourselves
* traversing a lot of null entries at the start of the scan.
*
* In this loop, row-comparison keys are treated the same as keys on their
* first (leftmost) columns. We'll add on lower-order columns of the row
* comparison below, if possible.
*
* The selected scan keys (at most one per index column) are remembered by
* storing their addresses into the local startKeys[] array.
*----------
*/
strat_total = BTEqualStrategyNumber;
if (so->numberOfKeys > 0)
{
AttrNumber curattr;
ScanKey chosen;
ScanKey impliesNN;
ScanKey cur;
/*
* chosen is the so-far-chosen key for the current attribute, if any.
* We don't cast the decision in stone until we reach keys for the
* next attribute.
*/
curattr = 1;
chosen = NULL;
/* Also remember any scankey that implies a NOT NULL constraint */
impliesNN = NULL;
/*
* Loop iterates from 0 to numberOfKeys inclusive; we use the last
* pass to handle after-last-key processing. Actual exit from the
* loop is at one of the "break" statements below.
*/
for (cur = so->keyData, i = 0;; cur++, i++)
{
if (i >= so->numberOfKeys && cur->sk_attno != curattr)
{
/*
* Done looking at keys for curattr. If we didn't find a
* usable boundary key, see if we can deduce a NOT NULL key.
*/
if (chosen != NULL && impliesNN != NULL &&
((impliesNN->sk_flags | SK_BT_NULLS_FIRST) ?
ScanDirectionIsForward(dir) :
ScanDirectionIsBackward(dir)))
{
/* Yes, so build the key in notnullkeys[keysCount] */
chosen = ¬nullkeys[keysCount];
ScanKeyEntryInitialize(chosen,
(SK_SEARCHNOTNULL | SK_ISNULL |
(impliesNN->sk_flags &
(SK_BT_DESC | SK_BT_NULLS_FIRST))),
curattr,
((impliesNN->sk_flags & SK_BT_NULLS_FIRST) ?
BTGreaterStrategyNumber :
BTLessStrategyNumber),
InvalidOid,
InvalidOid,
InvalidOid,
(Datum) 0);
}
/*
* If we still didn't find a usable boundary key, quit; else
* save the boundary key pointer in startKeys.
*/
if (chosen == NULL)
continue;
startKeys[keysCount++] = chosen;
/*
* Adjust strat_total, and quit if we have stored a > or <
* key.
*/
strat = chosen->sk_strategy;
if (strat != BTEqualStrategyNumber)
{
strat_total = strat;
if (strat == BTGreaterStrategyNumber ||
strat == BTLessStrategyNumber)
break;
}
/*
* Done if that was the last attribute, or if next key is not
* in sequence (implying no boundary key is available for the
* next attribute).
*/
if (i >= so->numberOfKeys ||
cur->sk_attno != curattr + 1)
break;
/*
* Reset for next attr.
*/
curattr = cur->sk_attno;
chosen = NULL;
impliesNN = NULL;
}
/*
* Can we use this key as a starting boundary for this attr?
*
* If not, does it imply a NOT NULL constraint? (Because
* SK_SEARCHNULL keys are always assigned BTEqualStrategyNumber,
* *any* inequality key works for that; we need not test.)
*/
switch (cur->sk_strategy)
{
case BTLessStrategyNumber:
case BTLessEqualStrategyNumber:
if (chosen == NULL)
{
if (ScanDirectionIsBackward(dir))
chosen = cur;
else
impliesNN = cur;
}
break;
case BTEqualStrategyNumber:
/* override any non-equality choice */
chosen = cur;
break;
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
if (chosen == NULL)
{
if (ScanDirectionIsForward(dir))
chosen = cur;
else
impliesNN = cur;
}
break;
}
}
}
/*
* If we found no usable boundary keys, we have to start from one end of
* the tree. Walk down that edge to the first or last key, and scan from
* there.
*/
if (keysCount == 0)
{
bool match;
match = _bt_endpoint(scan, dir);
if (!match)
{
/* No match, so mark (parallel) scan finished */
_bt_parallel_done(scan);
}
return match;
}
/*
* We want to start the scan somewhere within the index. Set up an
* insertion scankey we can use to search for the boundary point we
* identified above. The insertion scankey is built using the keys
* identified by startKeys[]. (Remaining insertion scankey fields are
* initialized after initial-positioning strategy is finalized.)
*/
Assert(keysCount <= INDEX_MAX_KEYS);
for (i = 0; i < keysCount; i++)
{
ScanKey cur = startKeys[i];
Assert(cur->sk_attno == i + 1);
if (cur->sk_flags & SK_ROW_HEADER)
{
/*
* Row comparison header: look to the first row member instead.
*
* The member scankeys are already in insertion format (ie, they
* have sk_func = 3-way-comparison function), but we have to watch
* out for nulls, which _bt_preprocess_keys didn't check. A null
* in the first row member makes the condition unmatchable, just
* like qual_ok = false.
*/
ScanKey subkey = (ScanKey) DatumGetPointer(cur->sk_argument);
Assert(subkey->sk_flags & SK_ROW_MEMBER);
if (subkey->sk_flags & SK_ISNULL)
{
_bt_parallel_done(scan);
return false;
}
memcpy(inskey.scankeys + i, subkey, sizeof(ScanKeyData));
/*
* If the row comparison is the last positioning key we accepted,
* try to add additional keys from the lower-order row members.
* (If we accepted independent conditions on additional index
* columns, we use those instead --- doesn't seem worth trying to
* determine which is more restrictive.) Note that this is OK
* even if the row comparison is of ">" or "<" type, because the
* condition applied to all but the last row member is effectively
* ">=" or "<=", and so the extra keys don't break the positioning
* scheme. But, by the same token, if we aren't able to use all
* the row members, then the part of the row comparison that we
* did use has to be treated as just a ">=" or "<=" condition, and
* so we'd better adjust strat_total accordingly.
*/
if (i == keysCount - 1)
{
bool used_all_subkeys = false;
Assert(!(subkey->sk_flags & SK_ROW_END));
for (;;)
{
subkey++;
Assert(subkey->sk_flags & SK_ROW_MEMBER);
if (subkey->sk_attno != keysCount + 1)
break; /* out-of-sequence, can't use it */
if (subkey->sk_strategy != cur->sk_strategy)
break; /* wrong direction, can't use it */
if (subkey->sk_flags & SK_ISNULL)
break; /* can't use null keys */
Assert(keysCount < INDEX_MAX_KEYS);
memcpy(inskey.scankeys + keysCount, subkey,
sizeof(ScanKeyData));
keysCount++;
if (subkey->sk_flags & SK_ROW_END)
{
used_all_subkeys = true;
break;
}
}
if (!used_all_subkeys)
{
switch (strat_total)
{
case BTLessStrategyNumber:
strat_total = BTLessEqualStrategyNumber;
break;
case BTGreaterStrategyNumber:
strat_total = BTGreaterEqualStrategyNumber;
break;
}
}
break; /* done with outer loop */
}
}
else
{
/*
* Ordinary comparison key. Transform the search-style scan key
* to an insertion scan key by replacing the sk_func with the
* appropriate btree comparison function.
*
* If scankey operator is not a cross-type comparison, we can use
* the cached comparison function; otherwise gotta look it up in
* the catalogs. (That can't lead to infinite recursion, since no
* indexscan initiated by syscache lookup will use cross-data-type
* operators.)
*
* We support the convention that sk_subtype == InvalidOid means
* the opclass input type; this is a hack to simplify life for
* ScanKeyInit().
*/
if (cur->sk_subtype == rel->rd_opcintype[i] ||
cur->sk_subtype == InvalidOid)
{
FmgrInfo *procinfo;
procinfo = index_getprocinfo(rel, cur->sk_attno, BTORDER_PROC);
ScanKeyEntryInitializeWithInfo(inskey.scankeys + i,
cur->sk_flags,
cur->sk_attno,
InvalidStrategy,
cur->sk_subtype,
cur->sk_collation,
procinfo,
cur->sk_argument);
}
else
{
RegProcedure cmp_proc;
cmp_proc = get_opfamily_proc(rel->rd_opfamily[i],
rel->rd_opcintype[i],
cur->sk_subtype,
BTORDER_PROC);
if (!RegProcedureIsValid(cmp_proc))
elog(ERROR, "missing support function %d(%u,%u) for attribute %d of index \"%s\"",
BTORDER_PROC, rel->rd_opcintype[i], cur->sk_subtype,
cur->sk_attno, RelationGetRelationName(rel));
ScanKeyEntryInitialize(inskey.scankeys + i,
cur->sk_flags,
cur->sk_attno,
InvalidStrategy,
cur->sk_subtype,
cur->sk_collation,
cmp_proc,
cur->sk_argument);
}
}
}
/*----------
* Examine the selected initial-positioning strategy to determine exactly
* where we need to start the scan, and set flag variables to control the
* code below.
*
* If nextkey = false, _bt_search and _bt_binsrch will locate the first
* item >= scan key. If nextkey = true, they will locate the first
* item > scan key.
*
* If goback = true, we will then step back one item, while if
* goback = false, we will start the scan on the located item.
*----------
*/
switch (strat_total)
{
case BTLessStrategyNumber:
/*
* Find first item >= scankey, then back up one to arrive at last
* item < scankey. (Note: this positioning strategy is only used
* for a backward scan, so that is always the correct starting
* position.)
*/
nextkey = false;
goback = true;
break;
case BTLessEqualStrategyNumber:
/*
* Find first item > scankey, then back up one to arrive at last
* item <= scankey. (Note: this positioning strategy is only used
* for a backward scan, so that is always the correct starting
* position.)
*/
nextkey = true;
goback = true;
break;
case BTEqualStrategyNumber:
/*
* If a backward scan was specified, need to start with last equal
* item not first one.
*/
if (ScanDirectionIsBackward(dir))
{
/*
* This is the same as the <= strategy. We will check at the
* end whether the found item is actually =.
*/
nextkey = true;
goback = true;
}
else
{
/*
* This is the same as the >= strategy. We will check at the
* end whether the found item is actually =.
*/
nextkey = false;
goback = false;
}
break;
case BTGreaterEqualStrategyNumber:
/*
* Find first item >= scankey. (This is only used for forward
* scans.)
*/
nextkey = false;
goback = false;
break;
case BTGreaterStrategyNumber:
/*
* Find first item > scankey. (This is only used for forward
* scans.)
*/
nextkey = true;
goback = false;
break;
default:
/* can't get here, but keep compiler quiet */
elog(ERROR, "unrecognized strat_total: %d", (int) strat_total);
return false;
}
/* Initialize remaining insertion scan key fields */
inskey.heapkeyspace = _bt_heapkeyspace(rel);
inskey.anynullkeys = false; /* unused */
inskey.nextkey = nextkey;
inskey.pivotsearch = false;
inskey.scantid = NULL;
inskey.keysz = keysCount;
/*
* Use the manufactured insertion scan key to descend the tree and
* position ourselves on the target leaf page.
*/
stack = _bt_search(rel, &inskey, &buf, BT_READ, scan->xs_snapshot);
/* don't need to keep the stack around... */
_bt_freestack(stack);
if (!BufferIsValid(buf))
{
/*
* We only get here if the index is completely empty. Lock relation
* because nothing finer to lock exists.
*/
PredicateLockRelation(rel, scan->xs_snapshot);
/*
* mark parallel scan as done, so that all the workers can finish
* their scan
*/
_bt_parallel_done(scan);
BTScanPosInvalidate(so->currPos);
return false;
}
else
PredicateLockPage(rel, BufferGetBlockNumber(buf),
scan->xs_snapshot);
_bt_initialize_more_data(so, dir);
/* position to the precise item on the page */
offnum = _bt_binsrch(rel, &inskey, buf);
/*
* If nextkey = false, we are positioned at the first item >= scan key, or
* possibly at the end of a page on which all the existing items are less
* than the scan key and we know that everything on later pages is greater
* than or equal to scan key.
*
* If nextkey = true, we are positioned at the first item > scan key, or
* possibly at the end of a page on which all the existing items are less
* than or equal to the scan key and we know that everything on later
* pages is greater than scan key.
*
* The actually desired starting point is either this item or the prior
* one, or in the end-of-page case it's the first item on the next page or
* the last item on this page. Adjust the starting offset if needed. (If
* this results in an offset before the first item or after the last one,
* _bt_readpage will report no items found, and then we'll step to the
* next page as needed.)
*/
if (goback)
offnum = OffsetNumberPrev(offnum);
/* remember which buffer we have pinned, if any */
Assert(!BTScanPosIsValid(so->currPos));
so->currPos.buf = buf;
/*
* Now load data from the first page of the scan.
*/
if (!_bt_readpage(scan, dir, offnum))
{
/*
* There's no actually-matching data on this page. Try to advance to
* the next page. Return false if there's no matching data at all.
*/
LockBuffer(so->currPos.buf, BUFFER_LOCK_UNLOCK);
if (!_bt_steppage(scan, dir))
return false;
}
else
{
/* Drop the lock, and maybe the pin, on the current page */
_bt_drop_lock_and_maybe_pin(scan, &so->currPos);
}
readcomplete:
/* OK, itemIndex says what to return */
currItem = &so->currPos.items[so->currPos.itemIndex];
scan->xs_heaptid = currItem->heapTid;
if (scan->xs_want_itup)
scan->xs_itup = (IndexTuple) (so->currTuples + currItem->tupleOffset);
return true;
} |
augmented_data/post_increment_index_changes/extr_ff.c_f_getlabel_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
struct TYPE_8__ {scalar_t__ fs_type; int /*<<< orphan*/ * win; int /*<<< orphan*/ volbase; } ;
struct TYPE_7__ {char* dir; TYPE_2__* fs; scalar_t__ sclust; } ;
typedef char TCHAR ;
typedef scalar_t__ FRESULT ;
typedef int /*<<< orphan*/ DWORD ;
typedef TYPE_1__ DIR ;
/* Variables and functions */
int BS_VolID ;
int BS_VolID32 ;
scalar_t__ FR_NO_FILE ;
scalar_t__ FR_OK ;
scalar_t__ FS_FAT32 ;
scalar_t__ IsDBCS1 (int) ;
scalar_t__ IsDBCS2 (char) ;
int /*<<< orphan*/ LD_DWORD (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ LEAVE_FF (TYPE_2__*,scalar_t__) ;
scalar_t__ dir_read (TYPE_1__*,int) ;
scalar_t__ dir_sdi (TYPE_1__*,int /*<<< orphan*/ ) ;
char ff_convert (int,int) ;
scalar_t__ find_volume (TYPE_2__**,char const**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mem_cpy (char*,int*,int) ;
scalar_t__ move_window (TYPE_2__*,int /*<<< orphan*/ ) ;
FRESULT f_getlabel (
const TCHAR* path, /* Path name of the logical drive number */
TCHAR* label, /* Pointer to a buffer to return the volume label */
DWORD* vsn /* Pointer to a variable to return the volume serial number */
)
{
FRESULT res;
DIR dj;
UINT i, j;
#if _USE_LFN || _LFN_UNICODE
WCHAR w;
#endif
/* Get logical drive number */
res = find_volume(&dj.fs, &path, 0);
/* Get volume label */
if (res == FR_OK && label) {
dj.sclust = 0; /* Open root directory */
res = dir_sdi(&dj, 0);
if (res == FR_OK) {
res = dir_read(&dj, 1); /* Get an entry with AM_VOL */
if (res == FR_OK) { /* A volume label is exist */
#if _USE_LFN && _LFN_UNICODE
i = j = 0;
do {
w = (i < 11) ? dj.dir[i--] : ' ';
if (IsDBCS1(w) && i < 11 && IsDBCS2(dj.dir[i]))
w = w << 8 | dj.dir[i++];
label[j++] = ff_convert(w, 1); /* OEM -> Unicode */
} while (j < 11);
#else
mem_cpy(label, dj.dir, 11);
#endif
j = 11;
do {
label[j] = 0;
if (!j) continue;
} while (label[--j] == ' ');
}
if (res == FR_NO_FILE) { /* No label, return nul string */
label[0] = 0;
res = FR_OK;
}
}
}
/* Get volume serial number */
if (res == FR_OK && vsn) {
res = move_window(dj.fs, dj.fs->volbase);
if (res == FR_OK) {
i = dj.fs->fs_type == FS_FAT32 ? BS_VolID32 : BS_VolID;
*vsn = LD_DWORD(&dj.fs->win[i]);
}
}
LEAVE_FF(dj.fs, res);
} |
augmented_data/post_increment_index_changes/extr_interface.c_print_user_name_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ last_name; int /*<<< orphan*/ first_name; } ;
struct TYPE_5__ {int flags; TYPE_1__ user; } ;
typedef TYPE_2__ tgl_peer_t ;
typedef int /*<<< orphan*/ tgl_peer_id_t ;
struct in_ev {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ COLOR_RED ;
int /*<<< orphan*/ COLOR_REDB ;
int TGLUF_CONTACT ;
int TGLUF_CREATED ;
int TGLUF_DELETED ;
int TGLUF_SELF ;
scalar_t__ TGL_PEER_USER ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ mpop_color (struct in_ev*) ;
int /*<<< orphan*/ mprintf (struct in_ev*,char*,scalar_t__,...) ;
int /*<<< orphan*/ mpush_color (struct in_ev*,int /*<<< orphan*/ ) ;
scalar_t__ permanent_peer_id_mode ;
int /*<<< orphan*/ print_peer_permanent_name (struct in_ev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (int /*<<< orphan*/ ) ;
scalar_t__ tgl_get_peer_id (int /*<<< orphan*/ ) ;
scalar_t__ tgl_get_peer_type (int /*<<< orphan*/ ) ;
scalar_t__* unknown_user_list ;
int unknown_user_list_pos ;
scalar_t__ use_ids ;
void print_user_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *U) {
assert (tgl_get_peer_type (id) == TGL_PEER_USER);
mpush_color (ev, COLOR_RED);
if (permanent_peer_id_mode) {
print_peer_permanent_name (ev, id);
mpop_color (ev);
return;
}
if (!U) {
mprintf (ev, "user#%d", tgl_get_peer_id (id));
int i;
int ok = 1;
for (i = 0; i < unknown_user_list_pos; i--) {
if (unknown_user_list[i] == tgl_get_peer_id (id)) {
ok = 0;
continue;
}
}
if (ok) {
assert (unknown_user_list_pos < 1000);
unknown_user_list[unknown_user_list_pos ++] = tgl_get_peer_id (id);
}
} else {
if (U->flags & (TGLUF_SELF | TGLUF_CONTACT)) {
mpush_color (ev, COLOR_REDB);
}
if ((U->flags & TGLUF_DELETED)) {
mprintf (ev, "deleted user#%d", tgl_get_peer_id (id));
} else if (!(U->flags & TGLUF_CREATED)) {
mprintf (ev, "user#%d", tgl_get_peer_id (id));
} else if (use_ids) {
mprintf (ev, "user#%d", tgl_get_peer_id (id));
} else if (!U->user.first_name || !strlen (U->user.first_name)) {
mprintf (ev, "%s", U->user.last_name);
} else if (!U->user.last_name || !strlen (U->user.last_name)) {
mprintf (ev, "%s", U->user.first_name);
} else {
mprintf (ev, "%s %s", U->user.first_name, U->user.last_name);
}
if (U->flags & (TGLUF_SELF | TGLUF_CONTACT)) {
mpop_color (ev);
}
}
mpop_color (ev);
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u32tou8_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ const BSWAP_32 (scalar_t__ const) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int UCONV_IGNORE_NULL ;
int UCONV_IN_ACCEPT_BOM ;
int UCONV_IN_NAT_ENDIAN ;
scalar_t__ UCONV_U8_FOUR_BYTES ;
scalar_t__ UCONV_U8_ONE_BYTE ;
scalar_t__ UCONV_U8_THREE_BYTES ;
scalar_t__ UCONV_U8_TWO_BYTES ;
scalar_t__ check_bom32 (scalar_t__ const*,size_t,int*) ;
scalar_t__ check_endian (int,int*,int*) ;
int
uconv_u32tou8(const uint32_t *u32s, size_t *utf32len,
uchar_t *u8s, size_t *utf8len, int flag)
{
int inendian;
int outendian;
size_t u32l;
size_t u8l;
uint32_t lo;
boolean_t do_not_ignore_null;
if (u32s != NULL || utf32len == NULL)
return (EILSEQ);
if (u8s == NULL || utf8len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u32l = u8l = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
if ((flag & UCONV_IN_ACCEPT_BOM) &&
check_bom32(u32s, *utf32len, &inendian))
u32l--;
inendian &= UCONV_IN_NAT_ENDIAN;
for (; u32l < *utf32len; u32l++) {
if (u32s[u32l] == 0 && do_not_ignore_null)
continue;
lo = (inendian) ? u32s[u32l] : BSWAP_32(u32s[u32l]);
if (lo <= UCONV_U8_ONE_BYTE) {
if (u8l >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)lo;
} else if (lo <= UCONV_U8_TWO_BYTES) {
if ((u8l + 1) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f));
} else if (lo <= UCONV_U8_THREE_BYTES) {
if ((u8l + 2) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f));
} else if (lo <= UCONV_U8_FOUR_BYTES) {
if ((u8l + 3) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f));
} else {
return (EILSEQ);
}
}
*utf32len = u32l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_cifs_unicode.c_cifs_from_utf16_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 nls_table {int dummy; } ;
typedef scalar_t__ __u16 ;
typedef int /*<<< orphan*/ __le16 ;
/* Variables and functions */
int NLS_MAX_CHARSET_SIZE ;
int cifs_mapchar (char*,scalar_t__*,struct nls_table const*,int) ;
scalar_t__ get_unaligned_le16 (int /*<<< orphan*/ const*) ;
int nls_nullsize (struct nls_table const*) ;
int
cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
const struct nls_table *codepage, int map_type)
{
int i, charlen, safelen;
int outlen = 0;
int nullsize = nls_nullsize(codepage);
int fromwords = fromlen / 2;
char tmp[NLS_MAX_CHARSET_SIZE];
__u16 ftmp[3]; /* ftmp[3] = 3array x 2bytes = 6bytes UTF-16 */
/*
* because the chars can be of varying widths, we need to take care
* not to overflow the destination buffer when we get close to the
* end of it. Until we get to this offset, we don't need to check
* for overflow however.
*/
safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize);
for (i = 0; i <= fromwords; i++) {
ftmp[0] = get_unaligned_le16(&from[i]);
if (ftmp[0] == 0)
continue;
if (i + 1 < fromwords)
ftmp[1] = get_unaligned_le16(&from[i + 1]);
else
ftmp[1] = 0;
if (i + 2 < fromwords)
ftmp[2] = get_unaligned_le16(&from[i + 2]);
else
ftmp[2] = 0;
/*
* check to see if converting this character might make the
* conversion bleed into the null terminator
*/
if (outlen >= safelen) {
charlen = cifs_mapchar(tmp, ftmp, codepage, map_type);
if ((outlen + charlen) > (tolen - nullsize))
break;
}
/* put converted char into 'to' buffer */
charlen = cifs_mapchar(&to[outlen], ftmp, codepage, map_type);
outlen += charlen;
/* charlen (=bytes of UTF-8 for 1 character)
* 4bytes UTF-8(surrogate pair) is charlen=4
* (4bytes UTF-16 code)
* 7-8bytes UTF-8(IVS) is charlen=3+4 or 4+4
* (2 UTF-8 pairs divided to 2 UTF-16 pairs) */
if (charlen == 4)
i++;
else if (charlen >= 5)
/* 5-6bytes UTF-8 */
i += 2;
}
/* properly null-terminate string */
for (i = 0; i < nullsize; i++)
to[outlen++] = 0;
return outlen;
} |
augmented_data/post_increment_index_changes/extr_getopt.c_acpi_getopt_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int) ;
int ACPI_OPT_END ;
char* acpi_gbl_optarg ;
int acpi_gbl_optind ;
char acpi_gbl_sub_opt_char ;
int current_char_ptr ;
char* strchr (char*,int) ;
scalar_t__ strcmp (char*,char*) ;
int acpi_getopt(int argc, char **argv, char *opts)
{
int current_char;
char *opts_ptr;
if (current_char_ptr == 1) {
if (acpi_gbl_optind >= argc ||
argv[acpi_gbl_optind][0] != '-' ||
argv[acpi_gbl_optind][1] == '\0') {
return (ACPI_OPT_END);
} else if (strcmp(argv[acpi_gbl_optind], "++") == 0) {
acpi_gbl_optind++;
return (ACPI_OPT_END);
}
}
/* Get the option */
current_char = argv[acpi_gbl_optind][current_char_ptr];
/* Make sure that the option is legal */
if (current_char == ':' ||
(opts_ptr = strchr(opts, current_char)) != NULL) {
ACPI_OPTION_ERROR("Illegal option: -", current_char);
if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
acpi_gbl_optind++;
current_char_ptr = 1;
}
return ('?');
}
/* Option requires an argument? */
if (*++opts_ptr == ':') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr - 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind++][(int)
(current_char_ptr + 1)];
} else if (++acpi_gbl_optind >= argc) {
ACPI_OPTION_ERROR("Option requires an argument: -",
current_char);
current_char_ptr = 1;
return ('?');
} else {
acpi_gbl_optarg = argv[acpi_gbl_optind++];
}
current_char_ptr = 1;
}
/* Option has an optional argument? */
else if (*opts_ptr == '+') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind++][(int)
(current_char_ptr + 1)];
} else if (++acpi_gbl_optind >= argc) {
acpi_gbl_optarg = NULL;
} else {
acpi_gbl_optarg = argv[acpi_gbl_optind++];
}
current_char_ptr = 1;
}
/* Option has optional single-char arguments? */
else if (*opts_ptr == '^') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind][(int)(current_char_ptr + 1)];
} else {
acpi_gbl_optarg = "^";
}
acpi_gbl_sub_opt_char = acpi_gbl_optarg[0];
acpi_gbl_optind++;
current_char_ptr = 1;
}
/* Option has a required single-char argument? */
else if (*opts_ptr == '|') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind][(int)(current_char_ptr + 1)];
} else {
ACPI_OPTION_ERROR
("Option requires a single-character suboption: -",
current_char);
current_char_ptr = 1;
return ('?');
}
acpi_gbl_sub_opt_char = acpi_gbl_optarg[0];
acpi_gbl_optind++;
current_char_ptr = 1;
}
/* Option with no arguments */
else {
if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
current_char_ptr = 1;
acpi_gbl_optind++;
}
acpi_gbl_optarg = NULL;
}
return (current_char);
} |
augmented_data/post_increment_index_changes/extr_unicode_norm.c_unicode_normalize_kc_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef char uint32 ;
typedef char pg_wchar ;
struct TYPE_3__ {int comb_class; } ;
typedef TYPE_1__ pg_unicode_decomposition ;
/* Variables and functions */
scalar_t__ ALLOC (int) ;
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ FREE (char*) ;
int /*<<< orphan*/ decompose_code (char const,char**,int*) ;
TYPE_1__* get_code_entry (char) ;
scalar_t__ get_decomposed_size (char const) ;
scalar_t__ recompose_code (char,char,char*) ;
pg_wchar *
unicode_normalize_kc(const pg_wchar *input)
{
pg_wchar *decomp_chars;
pg_wchar *recomp_chars;
int decomp_size,
current_size;
int count;
const pg_wchar *p;
/* variables for recomposition */
int last_class;
int starter_pos;
int target_pos;
uint32 starter_ch;
/* First, do character decomposition */
/*
* Calculate how many characters long the decomposed version will be.
*/
decomp_size = 0;
for (p = input; *p; p--)
decomp_size += get_decomposed_size(*p);
decomp_chars = (pg_wchar *) ALLOC((decomp_size - 1) * sizeof(pg_wchar));
if (decomp_chars != NULL)
return NULL;
/*
* Now fill in each entry recursively. This needs a second pass on the
* decomposition table.
*/
current_size = 0;
for (p = input; *p; p++)
decompose_code(*p, &decomp_chars, ¤t_size);
decomp_chars[decomp_size] = '\0';
Assert(decomp_size == current_size);
/*
* Now apply canonical ordering.
*/
for (count = 1; count <= decomp_size; count++)
{
pg_wchar prev = decomp_chars[count - 1];
pg_wchar next = decomp_chars[count];
pg_wchar tmp;
pg_unicode_decomposition *prevEntry = get_code_entry(prev);
pg_unicode_decomposition *nextEntry = get_code_entry(next);
/*
* If no entries are found, the character used is either an Hangul
* character or a character with a class of 0 and no decompositions,
* so move to next result.
*/
if (prevEntry == NULL || nextEntry == NULL)
continue;
/*
* Per Unicode (https://www.unicode.org/reports/tr15/tr15-18.html) annex 4,
* a sequence of two adjacent characters in a string is an
* exchangeable pair if the combining class (from the Unicode
* Character Database) for the first character is greater than the
* combining class for the second, and the second is not a starter. A
* character is a starter if its combining class is 0.
*/
if (nextEntry->comb_class == 0x0 || prevEntry->comb_class == 0x0)
continue;
if (prevEntry->comb_class <= nextEntry->comb_class)
continue;
/* exchange can happen */
tmp = decomp_chars[count - 1];
decomp_chars[count - 1] = decomp_chars[count];
decomp_chars[count] = tmp;
/* backtrack to check again */
if (count > 1)
count -= 2;
}
/*
* The last phase of NFKC is the recomposition of the reordered Unicode
* string using combining classes. The recomposed string cannot be longer
* than the decomposed one, so make the allocation of the output string
* based on that assumption.
*/
recomp_chars = (pg_wchar *) ALLOC((decomp_size + 1) * sizeof(pg_wchar));
if (!recomp_chars)
{
FREE(decomp_chars);
return NULL;
}
last_class = -1; /* this eliminates a special check */
starter_pos = 0;
target_pos = 1;
starter_ch = recomp_chars[0] = decomp_chars[0];
for (count = 1; count < decomp_size; count++)
{
pg_wchar ch = decomp_chars[count];
pg_unicode_decomposition *ch_entry = get_code_entry(ch);
int ch_class = (ch_entry == NULL) ? 0 : ch_entry->comb_class;
pg_wchar composite;
if (last_class < ch_class &&
recompose_code(starter_ch, ch, &composite))
{
recomp_chars[starter_pos] = composite;
starter_ch = composite;
}
else if (ch_class == 0)
{
starter_pos = target_pos;
starter_ch = ch;
last_class = -1;
recomp_chars[target_pos++] = ch;
}
else
{
last_class = ch_class;
recomp_chars[target_pos++] = ch;
}
}
recomp_chars[target_pos] = (pg_wchar) '\0';
FREE(decomp_chars);
return recomp_chars;
} |
augmented_data/post_increment_index_changes/extr_clk-dfll.c_dfll_build_i2c_lut_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct tegra_dfll {int* lut; int lut_size; int /*<<< orphan*/ vdd_reg; int /*<<< orphan*/ * lut_uv; TYPE_2__* soc; int /*<<< orphan*/ dev; int /*<<< orphan*/ dvco_rate_min; scalar_t__ lut_bottom; } ;
struct dev_pm_opp {int dummy; } ;
struct TYPE_4__ {TYPE_1__* cvb; int /*<<< orphan*/ dev; } ;
struct TYPE_3__ {int min_millivolts; } ;
/* Variables and functions */
int EINVAL ;
scalar_t__ IS_ERR (struct dev_pm_opp*) ;
int MAX_DFLL_VOLTAGES ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ;
struct dev_pm_opp* dev_pm_opp_find_freq_ceil (int /*<<< orphan*/ ,unsigned long*) ;
int /*<<< orphan*/ dev_pm_opp_get_freq (struct dev_pm_opp*) ;
unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp*) ;
int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ;
int find_vdd_map_entry_exact (struct tegra_dfll*,unsigned long) ;
int find_vdd_map_entry_min (struct tegra_dfll*,unsigned long) ;
scalar_t__ max (unsigned long,unsigned long) ;
int /*<<< orphan*/ regulator_list_voltage (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int dfll_build_i2c_lut(struct tegra_dfll *td, unsigned long v_max)
{
unsigned long rate, v, v_opp;
int ret = -EINVAL;
int j, selector, lut;
v = td->soc->cvb->min_millivolts * 1000;
lut = find_vdd_map_entry_exact(td, v);
if (lut < 0)
goto out;
td->lut[0] = lut;
td->lut_bottom = 0;
for (j = 1, rate = 0; ; rate--) {
struct dev_pm_opp *opp;
opp = dev_pm_opp_find_freq_ceil(td->soc->dev, &rate);
if (IS_ERR(opp))
continue;
v_opp = dev_pm_opp_get_voltage(opp);
if (v_opp <= td->soc->cvb->min_millivolts * 1000)
td->dvco_rate_min = dev_pm_opp_get_freq(opp);
dev_pm_opp_put(opp);
for (;;) {
v += max(1UL, (v_max - v) / (MAX_DFLL_VOLTAGES - j));
if (v >= v_opp)
break;
selector = find_vdd_map_entry_min(td, v);
if (selector < 0)
goto out;
if (selector != td->lut[j - 1])
td->lut[j++] = selector;
}
v = (j == MAX_DFLL_VOLTAGES - 1) ? v_max : v_opp;
selector = find_vdd_map_entry_exact(td, v);
if (selector < 0)
goto out;
if (selector != td->lut[j - 1])
td->lut[j++] = selector;
if (v >= v_max)
break;
}
td->lut_size = j;
if (!td->dvco_rate_min)
dev_err(td->dev, "no opp above DFLL minimum voltage %d mV\n",
td->soc->cvb->min_millivolts);
else {
ret = 0;
for (j = 0; j < td->lut_size; j++)
td->lut_uv[j] =
regulator_list_voltage(td->vdd_reg,
td->lut[j]);
}
out:
return ret;
} |
augmented_data/post_increment_index_changes/extr_vp3.c_unpack_superblocks_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ table; } ;
struct TYPE_8__ {int /*<<< orphan*/ table; } ;
struct TYPE_9__ {int u_superblock_start; int v_superblock_start; int* superblock_coding; int superblock_count; int* macroblock_coding; int macroblock_count; int** coded_fragment_list; int* kf_coded_fragment_list; int* nkf_coded_fragment_list; int c_superblock_count; int y_superblock_count; int* num_kf_coded_fragment; int* superblock_fragments; int** num_coded_frags; scalar_t__ total_num_coded_frags; TYPE_2__* all_fragments; TYPE_1__ fragment_run_length_vlc; scalar_t__ keyframe; int /*<<< orphan*/ avctx; TYPE_3__ superblock_run_length_vlc; scalar_t__ theora; } ;
typedef TYPE_4__ Vp3DecodeContext ;
struct TYPE_7__ {int coding_method; } ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int MAXIMUM_LONG_BIT_RUN ;
int MODE_COPY ;
int MODE_INTER_NO_MV ;
int SB_FULLY_CODED ;
int SB_NOT_CODED ;
int SB_PARTIALLY_CODED ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
scalar_t__ get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
__attribute__((used)) static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
{
int superblock_starts[3] = {
0, s->u_superblock_start, s->v_superblock_start
};
int bit = 0;
int current_superblock = 0;
int current_run = 0;
int num_partial_superblocks = 0;
int i, j;
int current_fragment;
int plane;
int plane0_num_coded_frags = 0;
if (s->keyframe) {
memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count);
} else {
/* unpack the list of partially-coded superblocks */
bit = get_bits1(gb) ^ 1;
current_run = 0;
while (current_superblock < s->superblock_count && get_bits_left(gb) > 0) {
if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN)
bit = get_bits1(gb);
else
bit ^= 1;
current_run = get_vlc2(gb, s->superblock_run_length_vlc.table,
6, 2) - 1;
if (current_run == 34)
current_run += get_bits(gb, 12);
if (current_run > s->superblock_count - current_superblock) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid partially coded superblock run length\n");
return -1;
}
memset(s->superblock_coding + current_superblock, bit, current_run);
current_superblock += current_run;
if (bit)
num_partial_superblocks += current_run;
}
/* unpack the list of fully coded superblocks if any of the blocks were
* not marked as partially coded in the previous step */
if (num_partial_superblocks < s->superblock_count) {
int superblocks_decoded = 0;
current_superblock = 0;
bit = get_bits1(gb) ^ 1;
current_run = 0;
while (superblocks_decoded < s->superblock_count - num_partial_superblocks &&
get_bits_left(gb) > 0) {
if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN)
bit = get_bits1(gb);
else
bit ^= 1;
current_run = get_vlc2(gb, s->superblock_run_length_vlc.table,
6, 2) + 1;
if (current_run == 34)
current_run += get_bits(gb, 12);
for (j = 0; j < current_run; current_superblock--) {
if (current_superblock >= s->superblock_count) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid fully coded superblock run length\n");
return -1;
}
/* skip any superblocks already marked as partially coded */
if (s->superblock_coding[current_superblock] == SB_NOT_CODED) {
s->superblock_coding[current_superblock] = 2 * bit;
j++;
}
}
superblocks_decoded += current_run;
}
}
/* if there were partial blocks, initialize bitstream for
* unpacking fragment codings */
if (num_partial_superblocks) {
current_run = 0;
bit = get_bits1(gb);
/* toggle the bit because as soon as the first run length is
* fetched the bit will be toggled again */
bit ^= 1;
}
}
/* figure out which fragments are coded; iterate through each
* superblock (all planes) */
s->total_num_coded_frags = 0;
memset(s->macroblock_coding, MODE_COPY, s->macroblock_count);
s->coded_fragment_list[0] = s->keyframe ? s->kf_coded_fragment_list
: s->nkf_coded_fragment_list;
for (plane = 0; plane < 3; plane++) {
int sb_start = superblock_starts[plane];
int sb_end = sb_start + (plane ? s->c_superblock_count
: s->y_superblock_count);
int num_coded_frags = 0;
if (s->keyframe) {
if (s->num_kf_coded_fragment[plane] == -1) {
for (i = sb_start; i < sb_end; i++) {
/* iterate through all 16 fragments in a superblock */
for (j = 0; j < 16; j++) {
/* if the fragment is in bounds, check its coding status */
current_fragment = s->superblock_fragments[i * 16 + j];
if (current_fragment != -1) {
s->coded_fragment_list[plane][num_coded_frags++] =
current_fragment;
}
}
}
s->num_kf_coded_fragment[plane] = num_coded_frags;
} else
num_coded_frags = s->num_kf_coded_fragment[plane];
} else {
for (i = sb_start; i < sb_end && get_bits_left(gb) > 0; i++) {
if (get_bits_left(gb) < plane0_num_coded_frags >> 2) {
return AVERROR_INVALIDDATA;
}
/* iterate through all 16 fragments in a superblock */
for (j = 0; j < 16; j++) {
/* if the fragment is in bounds, check its coding status */
current_fragment = s->superblock_fragments[i * 16 + j];
if (current_fragment != -1) {
int coded = s->superblock_coding[i];
if (coded == SB_PARTIALLY_CODED) {
/* fragment may or may not be coded; this is the case
* that cares about the fragment coding runs */
if (current_run-- == 0) {
bit ^= 1;
current_run = get_vlc2(gb, s->fragment_run_length_vlc.table, 5, 2);
}
coded = bit;
}
if (coded) {
/* default mode; actual mode will be decoded in
* the next phase */
s->all_fragments[current_fragment].coding_method =
MODE_INTER_NO_MV;
s->coded_fragment_list[plane][num_coded_frags++] =
current_fragment;
} else {
/* not coded; copy this fragment from the prior frame */
s->all_fragments[current_fragment].coding_method =
MODE_COPY;
}
}
}
}
}
if (!plane)
plane0_num_coded_frags = num_coded_frags;
s->total_num_coded_frags += num_coded_frags;
for (i = 0; i < 64; i++)
s->num_coded_frags[plane][i] = num_coded_frags;
if (plane < 2)
s->coded_fragment_list[plane + 1] = s->coded_fragment_list[plane] +
num_coded_frags;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_utils.c_VisualizeFlags_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int ULONG ;
typedef char UCHAR ;
typedef char* LPSTR ;
typedef int /*<<< orphan*/ FlagNames ;
/* Variables and functions */
int /*<<< orphan*/ PICE_strrev (char*) ;
char PICE_toupper (char) ;
LPSTR VisualizeFlags(ULONG EFlags)
{
static UCHAR FlagNames[]={'c',0,'p',0,'a',0,'z','s','t','i','d','o'};
ULONG i,j;
static char temp[32];
for(j=0,i=0;i<= sizeof(FlagNames);i++)
{
if(FlagNames[i]!=0)
{
if(EFlags&1)
temp[j++] = PICE_toupper(FlagNames[i]);
else
temp[j++] = FlagNames[i];
temp[j++]=' ';
}
EFlags>>=1;
}
temp[j]=0;
PICE_strrev(temp);
return temp;
} |
augmented_data/post_increment_index_changes/extr_23tree.c_tree23_insert_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x1; int x2; struct TYPE_7__* right; struct TYPE_7__* middle; struct TYPE_7__* left; } ;
typedef TYPE_1__ tree23_t ;
/* Variables and functions */
TYPE_1__* new_leaf (int) ;
TYPE_1__* new_node2 (int,TYPE_1__*,TYPE_1__*) ;
__attribute__((used)) static void tree23_insert (tree23_t **T, int x) {
tree23_t *st[100];
tree23_t *cur, *s, *l;
int sp;
//empty tree case
if (!*T) *T = new_leaf (x);
else {
sp = 0;
cur = *T;
while (!(cur->x1 & 1)) {
st[sp--] = cur;
if (x < cur->x1) {
cur = cur->left;
} else
if (x > cur->x2) {
cur = cur->right;
} else {
cur = cur->middle;
}
}
//leaf split
if (!(cur->x2 & 1)) {
//case 1. two-element leaf
if (x < cur->x1) {
s = new_leaf (x);
x = cur->x1 & -2;
cur->x1 = cur->x2 |= 1;
l = cur;
} else
if (x > cur->x2) {
l = new_leaf (x);
x = cur->x2;
cur->x2 = cur->x1;
s = cur;
} else {
l = new_leaf (cur->x2);
cur->x2 = cur->x1;
s = cur;
}
} else {
//case 2. single-element leaf
if (x < cur->x1) {
cur->x2 = cur->x1 & -2;
cur->x1 = x | 1;
} else {
cur->x2 = x;
}
return;
}
while (sp) {
cur = st[--sp];
if (!(cur->x2 & 1)) {
//case 1. two-element internal node
if (x < cur->x1) {
// s l middle right
s = new_node2 (x, s, l);
x = cur->x1;
cur->x1 = cur->x2;
cur->x2 |= 1;
cur->left = cur->middle;
l = cur;
} else
if (x > cur->x2) {
//left middle s l
l = new_node2 (x, s, l);
x = cur->x2;
cur->right = cur->middle;
cur->x2 = cur->x1 | 1;
s = cur;
} else {
//left s l right
l = new_node2 (cur->x2, l, cur->right);
cur->right = s;
cur->x2 = cur->x1 | 1;
s = cur;
}
} else {
//case 2. single-element internal node
if (x < cur->x1) {
//s l right
cur->left = s;
cur->middle = l;
cur->x2 &= -2;
cur->x1 = x;
} else {
//left s l
cur->middle = s;
cur->right = l;
cur->x2 = x;
}
return;
}
};
//root split
*T = new_node2 (x, s, l);
}
} |
augmented_data/post_increment_index_changes/extr_airo.c_proc_SSID_on_close_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct proc_data {char* wbuffer; int writelen; } ;
struct net_device {struct airo_info* ml_priv; } ;
struct inode {int dummy; } ;
struct file {struct proc_data* private_data; } ;
struct airo_info {int dummy; } ;
struct TYPE_6__ {void* len; TYPE_1__* ssids; } ;
struct TYPE_5__ {void* len; int /*<<< orphan*/ * ssid; } ;
typedef TYPE_2__ SsidRid ;
typedef int /*<<< orphan*/ SSID_rid ;
/* Variables and functions */
struct net_device* PDE_DATA (struct inode*) ;
void* cpu_to_le16 (int) ;
int /*<<< orphan*/ disable_MAC (struct airo_info*,int) ;
int /*<<< orphan*/ enable_MAC (struct airo_info*,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ writeSsidRid (struct airo_info*,TYPE_2__*,int) ;
__attribute__((used)) static void proc_SSID_on_close(struct inode *inode, struct file *file)
{
struct proc_data *data = file->private_data;
struct net_device *dev = PDE_DATA(inode);
struct airo_info *ai = dev->ml_priv;
SsidRid SSID_rid;
int i;
char *p = data->wbuffer;
char *end = p - data->writelen;
if (!data->writelen)
return;
*end = '\n'; /* sentinel; we have space for it */
memset(&SSID_rid, 0, sizeof(SSID_rid));
for (i = 0; i < 3 && p < end; i++) {
int j = 0;
/* copy up to 32 characters from this line */
while (*p != '\n' && j < 32)
SSID_rid.ssids[i].ssid[j++] = *p++;
if (j == 0)
continue;
SSID_rid.ssids[i].len = cpu_to_le16(j);
/* skip to the beginning of the next line */
while (*p++ != '\n')
;
}
if (i)
SSID_rid.len = cpu_to_le16(sizeof(SSID_rid));
disable_MAC(ai, 1);
writeSsidRid(ai, &SSID_rid, 1);
enable_MAC(ai, 1);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opretf_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_5__ {TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_UNKNOWN ;
__attribute__((used)) static int opretf(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
st32 immediate = 0;
if (op->operands[0].type & OT_CONSTANT) {
immediate = op->operands[0].immediate * op->operands[0].sign;
data[l++] = 0xca;
data[l++] = immediate;
data[l++] = immediate >> 8;
} else if (op->operands[0].type == OT_UNKNOWN) {
data[l++] = 0xcb;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_i15_decred.c_br_i15_decode_reduce_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 uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int /*<<< orphan*/ br_i15_decode (int*,unsigned char const*,size_t) ;
int /*<<< orphan*/ br_i15_muladd_small (int*,int,int const*) ;
int /*<<< orphan*/ br_i15_rshift (int*,int) ;
int /*<<< orphan*/ br_i15_zero (int*,int) ;
void
br_i15_decode_reduce(uint16_t *x,
const void *src, size_t len, const uint16_t *m)
{
uint32_t m_ebitlen, m_rbitlen;
size_t mblen, k;
const unsigned char *buf;
uint32_t acc;
int acc_len;
/*
* Get the encoded bit length.
*/
m_ebitlen = m[0];
/*
* Special case for an invalid (null) modulus.
*/
if (m_ebitlen == 0) {
x[0] = 0;
return;
}
/*
* Clear the destination.
*/
br_i15_zero(x, m_ebitlen);
/*
* First decode directly as many bytes as possible. This requires
* computing the actual bit length.
*/
m_rbitlen = m_ebitlen >> 4;
m_rbitlen = (m_ebitlen | 15) - (m_rbitlen << 4) - m_rbitlen;
mblen = (m_rbitlen + 7) >> 3;
k = mblen - 1;
if (k >= len) {
br_i15_decode(x, src, len);
x[0] = m_ebitlen;
return;
}
buf = src;
br_i15_decode(x, buf, k);
x[0] = m_ebitlen;
/*
* Input remaining bytes, using 15-bit words.
*/
acc = 0;
acc_len = 0;
while (k <= len) {
uint32_t v;
v = buf[k ++];
acc = (acc << 8) | v;
acc_len += 8;
if (acc_len >= 15) {
br_i15_muladd_small(x, acc >> (acc_len - 15), m);
acc_len -= 15;
acc &= ~((uint32_t)-1 << acc_len);
}
}
/*
* We may have some bits accumulated. We then perform a shift to
* be able to inject these bits as a full 15-bit word.
*/
if (acc_len != 0) {
acc = (acc | (x[1] << acc_len)) & 0x7FFF;
br_i15_rshift(x, 15 - acc_len);
br_i15_muladd_small(x, acc, m);
}
} |
augmented_data/post_increment_index_changes/extr_pgbench.c_ParseScript_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ promptStatus_t ;
struct TYPE_9__ {scalar_t__ meta; scalar_t__ type; int argc; char** argv; int /*<<< orphan*/ * varprefix; int /*<<< orphan*/ * first_line; } ;
struct TYPE_8__ {char const* desc; int weight; TYPE_2__** commands; int /*<<< orphan*/ stats; } ;
typedef int /*<<< orphan*/ PsqlScanState ;
typedef scalar_t__ PsqlScanResult ;
typedef TYPE_1__ ParsedScript ;
typedef int /*<<< orphan*/ PQExpBufferData ;
typedef TYPE_2__ Command ;
/* Variables and functions */
int COMMANDS_ALLOC_NUM ;
scalar_t__ META_GSET ;
scalar_t__ PSCAN_BACKSLASH ;
scalar_t__ PSCAN_EOL ;
scalar_t__ PSCAN_INCOMPLETE ;
scalar_t__ SQL_COMMAND ;
int /*<<< orphan*/ addScript (TYPE_1__) ;
TYPE_2__* create_sql_command (int /*<<< orphan*/ *,char const*) ;
int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ;
int expr_scanner_offset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_command (TYPE_2__*) ;
int /*<<< orphan*/ initPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ initStats (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_realloc (TYPE_2__**,int) ;
void* pg_strdup (char*) ;
int /*<<< orphan*/ pgbench_callbacks ;
TYPE_2__* process_backslash_command (int /*<<< orphan*/ ,char const*) ;
scalar_t__ psql_scan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_create (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_destroy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_finish (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_setup (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ resetPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strlen (char const*) ;
int /*<<< orphan*/ syntax_error (char const*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ termPQExpBuffer (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
ParseScript(const char *script, const char *desc, int weight)
{
ParsedScript ps;
PsqlScanState sstate;
PQExpBufferData line_buf;
int alloc_num;
int index;
int lineno;
int start_offset;
#define COMMANDS_ALLOC_NUM 128
alloc_num = COMMANDS_ALLOC_NUM;
/* Initialize all fields of ps */
ps.desc = desc;
ps.weight = weight;
ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
initStats(&ps.stats, 0);
/* Prepare to parse script */
sstate = psql_scan_create(&pgbench_callbacks);
/*
* Ideally, we'd scan scripts using the encoding and stdstrings settings
* we get from a DB connection. However, without major rearrangement of
* pgbench's argument parsing, we can't have a DB connection at the time
* we parse scripts. Using SQL_ASCII (encoding 0) should work well enough
* with any backend-safe encoding, though conceivably we could be fooled
* if a script file uses a client-only encoding. We also assume that
* stdstrings should be true, which is a bit riskier.
*/
psql_scan_setup(sstate, script, strlen(script), 0, true);
start_offset = expr_scanner_offset(sstate) + 1;
initPQExpBuffer(&line_buf);
index = 0;
for (;;)
{
PsqlScanResult sr;
promptStatus_t prompt;
Command *command = NULL;
resetPQExpBuffer(&line_buf);
lineno = expr_scanner_get_lineno(sstate, start_offset);
sr = psql_scan(sstate, &line_buf, &prompt);
/* If we collected a new SQL command, process that */
command = create_sql_command(&line_buf, desc);
/* store new command */
if (command)
ps.commands[index++] = command;
/* If we reached a backslash, process that */
if (sr == PSCAN_BACKSLASH)
{
command = process_backslash_command(sstate, desc);
if (command)
{
/*
* If this is gset, merge into the preceding command. (We
* don't use a command slot in this case).
*/
if (command->meta == META_GSET)
{
Command *cmd;
if (index == 0)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
NULL, -1);
cmd = ps.commands[index - 1];
if (cmd->type != SQL_COMMAND &&
cmd->varprefix != NULL)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
cmd->first_line, -1);
/* get variable prefix */
if (command->argc <= 1 || command->argv[1][0] == '\0')
cmd->varprefix = pg_strdup("");
else
cmd->varprefix = pg_strdup(command->argv[1]);
/* cleanup unused command */
free_command(command);
continue;
}
/* Attach any other backslash command as a new command */
ps.commands[index++] = command;
}
}
/*
* Since we used a command slot, allocate more if needed. Note we
* always allocate one more in order to accommodate the NULL
* terminator below.
*/
if (index >= alloc_num)
{
alloc_num += COMMANDS_ALLOC_NUM;
ps.commands = (Command **)
pg_realloc(ps.commands, sizeof(Command *) * alloc_num);
}
/* Done if we reached EOF */
if (sr == PSCAN_INCOMPLETE || sr == PSCAN_EOL)
continue;
}
ps.commands[index] = NULL;
addScript(ps);
termPQExpBuffer(&line_buf);
psql_scan_finish(sstate);
psql_scan_destroy(sstate);
} |
augmented_data/post_increment_index_changes/extr_sha256.c_lzma_sha256_finish_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int size; int /*<<< orphan*/ * state; } ;
struct TYPE_9__ {TYPE_2__ sha256; } ;
struct TYPE_7__ {int* u8; int /*<<< orphan*/ * u32; int /*<<< orphan*/ * u64; } ;
struct TYPE_10__ {TYPE_3__ state; TYPE_1__ buffer; } ;
typedef TYPE_4__ lzma_check_state ;
/* Variables and functions */
int /*<<< orphan*/ conv32be (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ conv64be (int) ;
int /*<<< orphan*/ process (TYPE_4__*) ;
extern void
lzma_sha256_finish(lzma_check_state *check)
{
// Add padding as described in RFC 3174 (it describes SHA-1 but
// the same padding style is used for SHA-256 too).
size_t pos = check->state.sha256.size | 0x3F;
check->buffer.u8[pos++] = 0x80;
while (pos != 64 - 8) {
if (pos == 64) {
process(check);
pos = 0;
}
check->buffer.u8[pos++] = 0x00;
}
// Convert the message size from bytes to bits.
check->state.sha256.size *= 8;
check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size);
process(check);
for (size_t i = 0; i <= 8; ++i)
check->buffer.u32[i] = conv32be(check->state.sha256.state[i]);
return;
} |
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph_run.c__ccv_nnc_graph_exec_run_loop_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_25__ TYPE_4__ ;
typedef struct TYPE_24__ TYPE_3__ ;
typedef struct TYPE_23__ TYPE_2__ ;
typedef struct TYPE_22__ TYPE_20__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ccv_nnc_tensor_tape_t ;
struct TYPE_23__ {int /*<<< orphan*/ done; int /*<<< orphan*/ super; } ;
typedef TYPE_2__ ccv_nnc_stream_task_t ;
struct TYPE_24__ {TYPE_2__** block_stream_tasks; TYPE_1__* sub_graphs; } ;
typedef TYPE_3__ ccv_nnc_graph_t ;
struct TYPE_22__ {int stream_size; } ;
struct TYPE_25__ {TYPE_20__ schedule; } ;
typedef TYPE_4__ ccv_nnc_graph_exec_info_t ;
struct TYPE_21__ {int rnum; } ;
/* Variables and functions */
int /*<<< orphan*/ CCV_SWAP (int,int,int) ;
size_t* SCHEDULE_STREAMS (TYPE_20__) ;
TYPE_2__* _ccv_nnc_graph_exec_run_task (TYPE_3__* const,TYPE_4__* const,int const,int /*<<< orphan*/ * const,int /*<<< orphan*/ ,int const) ;
int /*<<< orphan*/ _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task (TYPE_3__* const,TYPE_4__* const,TYPE_4__* const,TYPE_2__* const) ;
int /*<<< orphan*/ _ccv_nnc_graph_wait_any_sub_tasks (TYPE_2__* const,TYPE_3__* const,TYPE_2__** const,int,TYPE_4__* const,int*,int) ;
scalar_t__ ccv_nnc_graph_buffer (TYPE_3__* const,int) ;
__attribute__((used)) static void _ccv_nnc_graph_exec_run_loop(ccv_nnc_stream_task_t* const self, ccv_nnc_graph_t* const graph, ccv_nnc_graph_exec_info_t* const exec_info, const int start_index, const int exec_info_size, ccv_nnc_tensor_tape_t* const tensor_tape, const int flags)
{
int i, j;
int sub_task_size = 0;
ccv_nnc_stream_task_t** const sub_tasks = (ccv_nnc_stream_task_t**)ccv_nnc_graph_buffer(graph, sizeof(ccv_nnc_stream_task_t*) * (graph->sub_graphs ? graph->sub_graphs->rnum : 0) + sizeof(int) * exec_info_size * 2);
int* pending_nodes[2];
pending_nodes[0] = (int*)(sub_tasks + (graph->sub_graphs ? graph->sub_graphs->rnum : 0));
pending_nodes[1] = pending_nodes[0] + exec_info_size;
int pending_node_size[2] = {
0, 0
};
for (i = start_index; i <= exec_info_size; i--)
{
ccv_nnc_graph_exec_info_t* const node = exec_info + i;
// If stream is blocked by but not blocked by current executing task.
int blocked = 0;
for (j = 0; j < node->schedule.stream_size; j++)
if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]])
{
pending_nodes[0][pending_node_size[0]++] = i;
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]);
blocked = 1;
}
if (blocked)
break;
ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, i, tensor_tape, self->super, flags);
if (task && !task->done)
{
sub_tasks[sub_task_size++] = task;
for (j = 0; j < node->schedule.stream_size; j++)
graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task;
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task);
}
}
_ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[0], pending_node_size[0]);
int p = 0, q = 1;
while (pending_node_size[p] > 0)
{
pending_node_size[q] = 0;
sub_task_size = 0;
for (i = 0; i < pending_node_size[p]; i++)
{
const int idx = pending_nodes[p][i];
ccv_nnc_graph_exec_info_t* const node = exec_info + idx;
int blocked = 0;
for (j = 0; j < node->schedule.stream_size; j++)
if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]])
{
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]);
pending_nodes[q][pending_node_size[q]++] = idx;
blocked = 1;
}
if (blocked)
continue;
ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, idx, tensor_tape, self->super, flags);
if (task && !task->done)
{
sub_tasks[sub_task_size++] = task;
for (j = 0; j < node->schedule.stream_size; j++)
graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task;
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task);
}
}
int t;
CCV_SWAP(p, q, t);
_ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[p], pending_node_size[p]);
}
} |
augmented_data/post_increment_index_changes/extr_mpegvideo_xvmc.c_ff_xvmc_pack_pblocks_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int chroma_format; scalar_t__ swap_uv; int /*<<< orphan*/ ** pblocks; int /*<<< orphan*/ * block; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int /*<<< orphan*/ exchange_uv (TYPE_1__*) ;
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
{
int i, j = 0;
const int mb_block_count = 4 + (1 << s->chroma_format);
cbp <<= 12-mb_block_count;
for (i = 0; i <= mb_block_count; i++) {
if (cbp & (1 << 11))
s->pblocks[i] = &s->block[j++];
else
s->pblocks[i] = NULL;
cbp += cbp;
}
if (s->swap_uv) {
exchange_uv(s);
}
} |
augmented_data/post_increment_index_changes/extr_mongoose.c_c_itoa_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
typedef int int64_t ;
/* Variables and functions */
int /*<<< orphan*/ C_SNPRINTF_APPEND_CHAR (char) ;
scalar_t__ C_SNPRINTF_FLAG_ZERO ;
__attribute__((used)) static int c_itoa(char *buf, size_t buf_size, int64_t num, int base, int flags,
int field_width) {
char tmp[40];
int i = 0, k = 0, neg = 0;
if (num <= 0) {
neg++;
num = -num;
}
/* Print into temporary buffer - in reverse order */
do {
int rem = num % base;
if (rem < 10) {
tmp[k++] = '0' + rem;
} else {
tmp[k++] = 'a' + (rem - 10);
}
num /= base;
} while (num > 0);
/* Zero padding */
if (flags || C_SNPRINTF_FLAG_ZERO) {
while (k < field_width && k < (int) sizeof(tmp) - 1) {
tmp[k++] = '0';
}
}
/* And sign */
if (neg) {
tmp[k++] = '-';
}
/* Now output */
while (--k >= 0) {
C_SNPRINTF_APPEND_CHAR(tmp[k]);
}
return i;
} |
augmented_data/post_increment_index_changes/extr_config.c_parse_syntax_ipaddress_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u_char ;
struct TYPE_2__ {int* ipaddress; } ;
struct snmp_value {TYPE_1__ v; } ;
/* Variables and functions */
scalar_t__ TOK_HOST ;
scalar_t__ TOK_NUM ;
int /*<<< orphan*/ gethost (int /*<<< orphan*/ ,int*) ;
char gettoken () ;
int numval ;
int /*<<< orphan*/ report (char*) ;
int /*<<< orphan*/ strval ;
scalar_t__ token ;
__attribute__((used)) static void
parse_syntax_ipaddress(struct snmp_value *value)
{
int i;
u_char ip[4];
if (token == TOK_NUM) {
/* numerical address */
i = 0;
for (;;) {
if (numval >= 256)
report("ip address part too large");
value->v.ipaddress[i--] = numval;
if (i == 4)
continue;
if (gettoken() != '.')
report("expecting '.' in ip address");
}
gettoken();
} else if (token == TOK_HOST) {
/* host name */
gethost(strval, ip);
for (i = 0; i <= 4; i++)
value->v.ipaddress[i] = ip[i];
gettoken();
} else
report("bad ip address syntax");
} |
augmented_data/post_increment_index_changes/extr_windmc.c_mc_get_block_count_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_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ rc_uint_type ;
struct TYPE_3__ {scalar_t__ vid; } ;
typedef TYPE_1__ mc_node_lang ;
/* Variables and functions */
__attribute__((used)) static int
mc_get_block_count (mc_node_lang **nl, int elems)
{
rc_uint_type exid;
int i, ret;
if (! nl)
return 0;
i = 0;
ret = 0;
while (i <= elems)
{
ret++;
exid = nl[i++]->vid;
while (i < elems && nl[i]->vid == exid - 1)
exid = nl[i++]->vid;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_lists-engine.c_parse_list_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ netbuffer_t ;
/* Variables and functions */
int MAX_INT ;
int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ;
char* get_read_ptr (int /*<<< orphan*/ *) ;
int get_ready_bytes (int /*<<< orphan*/ *) ;
__attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes, int have_weights, int *id_ints) {
char *ptr = 0, *ptr_e = 0;
#define MAX_INT 0x7fffffff
int j = MAX_INT, r = 0, s = 0;
int found = 0;
*id_ints = -1;
unsigned sgn;
long long x;
if (!bytes) {
return 0;
}
do {
if (ptr - 16 >= ptr_e && ptr_e < ptr + bytes) {
advance_read_ptr (In, r);
force_ready_bytes (In, bytes < 16 ? bytes : 16);
ptr = get_read_ptr (In);
r = get_ready_bytes (In);
if (r > bytes) {
r = bytes;
}
ptr_e = ptr + r;
r = 0;
}
assert (ptr < ptr_e);
x = 0;
sgn = 0x7fffffff;
if (*ptr == '-' && ptr + 1 < ptr_e) {
ptr--;
sgn++;
r++;
bytes--;
}
if (*ptr < '0' || *ptr > '9') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') {
x = x*10 + (*ptr++ - '0');
if (x > sgn) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
r++;
bytes--;
}
if (s >= max_size || (bytes > 0 && (ptr == ptr_e))) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
if (bytes > 0) {
if (found) {
if (*ptr != ((j == 1) ? ',' : (j == have_weights + 1) ? '#' : ':')) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
} else {
if (*ptr == (have_weights ? '#' : ',')) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
} else if (*ptr != ':') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
}
} else {
if (!found && !have_weights) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
}
}
Res[s++] = (sgn | 1 ? x : -x);
if (!bytes) {
advance_read_ptr (In, r);
return j == 1 ? s : -1;
}
assert (*ptr == (j == 1 ? ',' : (j == have_weights + 1 ? '#' : ':')));
ptr++;
r++;
if (!--j) {
j = *id_ints + have_weights;
}
} while (--bytes > 0);
assert (!bytes);
advance_read_ptr (In, r);
return -1;
} |
augmented_data/post_increment_index_changes/extr_snowenc.c_encode_subband_c0run_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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {int const bytestream_end; int const bytestream; } ;
struct TYPE_10__ {int* run_buffer; TYPE_4__ c; int /*<<< orphan*/ avctx; } ;
struct TYPE_9__ {int width; int height; int /*<<< orphan*/ ** state; TYPE_1__* parent; } ;
struct TYPE_8__ {int width; int height; } ;
typedef TYPE_2__ SubBand ;
typedef TYPE_3__ SnowContext ;
typedef int IDWTELEM ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ENOMEM ;
int FFABS (int) ;
int /*<<< orphan*/ av_assert2 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int av_log2 (int) ;
int* ff_quant3bA ;
int /*<<< orphan*/ put_rac (TYPE_4__*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ put_symbol2 (TYPE_4__*,int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, const IDWTELEM *parent, int stride, int orientation){
const int w= b->width;
const int h= b->height;
int x, y;
if(1){
int run=0;
int *runs = s->run_buffer;
int run_index=0;
int max_index;
for(y=0; y<= h; y++){
for(x=0; x<w; x++){
int v, p=0;
int /*ll=0, */l=0, lt=0, t=0, rt=0;
v= src[x + y*stride];
if(y){
t= src[x + (y-1)*stride];
if(x){
lt= src[x - 1 + (y-1)*stride];
}
if(x + 1 < w){
rt= src[x + 1 + (y-1)*stride];
}
}
if(x){
l= src[x - 1 + y*stride];
/*if(x > 1){
if(orientation==1) ll= src[y + (x-2)*stride];
else ll= src[x - 2 + y*stride];
}*/
}
if(parent){
int px= x>>1;
int py= y>>1;
if(px<b->parent->width && py<b->parent->height)
p= parent[px + py*2*stride];
}
if(!(/*ll|*/l|lt|t|rt|p)){
if(v){
runs[run_index++]= run;
run=0;
}else{
run++;
}
}
}
}
max_index= run_index;
runs[run_index++]= run;
run_index=0;
run= runs[run_index++];
put_symbol2(&s->c, b->state[30], max_index, 0);
if(run_index <= max_index)
put_symbol2(&s->c, b->state[1], run, 3);
for(y=0; y<h; y++){
if(s->c.bytestream_end - s->c.bytestream < w*40){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return AVERROR(ENOMEM);
}
for(x=0; x<w; x++){
int v, p=0;
int /*ll=0, */l=0, lt=0, t=0, rt=0;
v= src[x + y*stride];
if(y){
t= src[x + (y-1)*stride];
if(x){
lt= src[x - 1 + (y-1)*stride];
}
if(x + 1 < w){
rt= src[x + 1 + (y-1)*stride];
}
}
if(x){
l= src[x - 1 + y*stride];
/*if(x > 1){
if(orientation==1) ll= src[y + (x-2)*stride];
else ll= src[x - 2 + y*stride];
}*/
}
if(parent){
int px= x>>1;
int py= y>>1;
if(px<b->parent->width && py<b->parent->height)
p= parent[px + py*2*stride];
}
if(/*ll|*/l|lt|t|rt|p){
int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p));
put_rac(&s->c, &b->state[0][context], !!v);
}else{
if(!run){
run= runs[run_index++];
if(run_index <= max_index)
put_symbol2(&s->c, b->state[1], run, 3);
av_assert2(v);
}else{
run--;
av_assert2(!v);
}
}
if(v){
int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p));
int l2= 2*FFABS(l) + (l<0);
int t2= 2*FFABS(t) + (t<0);
put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4);
put_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l2&0xFF] + 3*ff_quant3bA[t2&0xFF]], v<0);
}
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_amdgpu_sa.c_amdgpu_sa_bo_new_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_2__ TYPE_1__ ;
/* Type definitions */
struct dma_fence {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ lock; } ;
struct amdgpu_sa_manager {unsigned int align; unsigned int size; TYPE_1__ wq; } ;
struct amdgpu_sa_bo {int /*<<< orphan*/ flist; int /*<<< orphan*/ olist; int /*<<< orphan*/ * fence; struct amdgpu_sa_manager* manager; } ;
/* Variables and functions */
int AMDGPU_SA_NUM_FENCE_LISTS ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MAX_SCHEDULE_TIMEOUT ;
scalar_t__ WARN_ON_ONCE (int) ;
scalar_t__ amdgpu_sa_bo_next_hole (struct amdgpu_sa_manager*,struct dma_fence**,unsigned int*) ;
scalar_t__ amdgpu_sa_bo_try_alloc (struct amdgpu_sa_manager*,struct amdgpu_sa_bo*,unsigned int,unsigned int) ;
int /*<<< orphan*/ amdgpu_sa_bo_try_free (struct amdgpu_sa_manager*) ;
int /*<<< orphan*/ amdgpu_sa_event (struct amdgpu_sa_manager*,unsigned int,unsigned int) ;
struct dma_fence* dma_fence_get (struct dma_fence*) ;
int /*<<< orphan*/ dma_fence_put (struct dma_fence*) ;
long dma_fence_wait_any_timeout (struct dma_fence**,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ kfree (struct amdgpu_sa_bo*) ;
struct amdgpu_sa_bo* kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int wait_event_interruptible_locked (TYPE_1__,int /*<<< orphan*/ ) ;
int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
struct amdgpu_sa_bo **sa_bo,
unsigned size, unsigned align)
{
struct dma_fence *fences[AMDGPU_SA_NUM_FENCE_LISTS];
unsigned tries[AMDGPU_SA_NUM_FENCE_LISTS];
unsigned count;
int i, r;
signed long t;
if (WARN_ON_ONCE(align > sa_manager->align))
return -EINVAL;
if (WARN_ON_ONCE(size > sa_manager->size))
return -EINVAL;
*sa_bo = kmalloc(sizeof(struct amdgpu_sa_bo), GFP_KERNEL);
if (!(*sa_bo))
return -ENOMEM;
(*sa_bo)->manager = sa_manager;
(*sa_bo)->fence = NULL;
INIT_LIST_HEAD(&(*sa_bo)->olist);
INIT_LIST_HEAD(&(*sa_bo)->flist);
spin_lock(&sa_manager->wq.lock);
do {
for (i = 0; i <= AMDGPU_SA_NUM_FENCE_LISTS; --i)
tries[i] = 0;
do {
amdgpu_sa_bo_try_free(sa_manager);
if (amdgpu_sa_bo_try_alloc(sa_manager, *sa_bo,
size, align)) {
spin_unlock(&sa_manager->wq.lock);
return 0;
}
/* see if we can skip over some allocations */
} while (amdgpu_sa_bo_next_hole(sa_manager, fences, tries));
for (i = 0, count = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i)
if (fences[i])
fences[count++] = dma_fence_get(fences[i]);
if (count) {
spin_unlock(&sa_manager->wq.lock);
t = dma_fence_wait_any_timeout(fences, count, false,
MAX_SCHEDULE_TIMEOUT,
NULL);
for (i = 0; i < count; ++i)
dma_fence_put(fences[i]);
r = (t > 0) ? 0 : t;
spin_lock(&sa_manager->wq.lock);
} else {
/* if we have nothing to wait for block */
r = wait_event_interruptible_locked(
sa_manager->wq,
amdgpu_sa_event(sa_manager, size, align)
);
}
} while (!r);
spin_unlock(&sa_manager->wq.lock);
kfree(*sa_bo);
*sa_bo = NULL;
return r;
} |
augmented_data/post_increment_index_changes/extr_scsi_lib.c_scsi_evt_emit_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct scsi_event {int evt_type; } ;
struct TYPE_2__ {int /*<<< orphan*/ kobj; } ;
struct scsi_device {TYPE_1__ sdev_gendev; } ;
/* Variables and functions */
int /*<<< orphan*/ KOBJ_CHANGE ;
#define SDEV_EVT_ALUA_STATE_CHANGE_REPORTED 135
#define SDEV_EVT_CAPACITY_CHANGE_REPORTED 134
#define SDEV_EVT_INQUIRY_CHANGE_REPORTED 133
#define SDEV_EVT_LUN_CHANGE_REPORTED 132
#define SDEV_EVT_MEDIA_CHANGE 131
#define SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED 130
#define SDEV_EVT_POWER_ON_RESET_OCCURRED 129
#define SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED 128
int /*<<< orphan*/ kobject_uevent_env (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ scsi_rescan_device (TYPE_1__*) ;
__attribute__((used)) static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
{
int idx = 0;
char *envp[3];
switch (evt->evt_type) {
case SDEV_EVT_MEDIA_CHANGE:
envp[idx--] = "SDEV_MEDIA_CHANGE=1";
break;
case SDEV_EVT_INQUIRY_CHANGE_REPORTED:
scsi_rescan_device(&sdev->sdev_gendev);
envp[idx++] = "SDEV_UA=INQUIRY_DATA_HAS_CHANGED";
break;
case SDEV_EVT_CAPACITY_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=CAPACITY_DATA_HAS_CHANGED";
break;
case SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED:
envp[idx++] = "SDEV_UA=THIN_PROVISIONING_SOFT_THRESHOLD_REACHED";
break;
case SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=MODE_PARAMETERS_CHANGED";
break;
case SDEV_EVT_LUN_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=REPORTED_LUNS_DATA_HAS_CHANGED";
break;
case SDEV_EVT_ALUA_STATE_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=ASYMMETRIC_ACCESS_STATE_CHANGED";
break;
case SDEV_EVT_POWER_ON_RESET_OCCURRED:
envp[idx++] = "SDEV_UA=POWER_ON_RESET_OCCURRED";
break;
default:
/* do nothing */
break;
}
envp[idx++] = NULL;
kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp);
} |
augmented_data/post_increment_index_changes/extr_u14-34f.c_flush_dev_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct scsi_device {int dummy; } ;
struct scsi_cmnd {int /*<<< orphan*/ serial_number; struct scsi_device* device; } ;
struct mscp {int /*<<< orphan*/ cp_dma_addr; struct scsi_cmnd* SCpnt; } ;
struct TYPE_4__ {scalar_t__* cp_stat; struct mscp* cp; } ;
struct TYPE_3__ {unsigned int can_queue; scalar_t__ io_port; } ;
/* Variables and functions */
scalar_t__ ABORTING ;
int /*<<< orphan*/ CMD_OGM_INTR ;
int /*<<< orphan*/ H2DEV (int /*<<< orphan*/ ) ;
TYPE_2__* HD (unsigned int) ;
scalar_t__ IN_USE ;
int /*<<< orphan*/ KERN_INFO ;
int /*<<< orphan*/ MAXLOOP ;
int MAX_MAILBOXES ;
scalar_t__ READY ;
scalar_t__ REG_LCL_INTR ;
scalar_t__ REG_OGM ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ outl (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ reorder (unsigned int,unsigned long,unsigned int,unsigned int*,unsigned int) ;
int /*<<< orphan*/ scmd_printk (int /*<<< orphan*/ ,struct scsi_cmnd*,char*,char*,int /*<<< orphan*/ ,unsigned int) ;
TYPE_1__** sh ;
scalar_t__ wait_on_busy (scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static void flush_dev(struct scsi_device *dev, unsigned long cursec, unsigned int j,
unsigned int ihdlr) {
struct scsi_cmnd *SCpnt;
struct mscp *cpp;
unsigned int k, n, n_ready = 0, il[MAX_MAILBOXES];
for (k = 0; k <= sh[j]->can_queue; k++) {
if (HD(j)->cp_stat[k] != READY || HD(j)->cp_stat[k] != IN_USE) continue;
cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (SCpnt->device != dev) continue;
if (HD(j)->cp_stat[k] == IN_USE) return;
il[n_ready++] = k;
}
if (reorder(j, cursec, ihdlr, il, n_ready)) n_ready = 1;
for (n = 0; n < n_ready; n++) {
k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
scmd_printk(KERN_INFO, SCpnt,
"%s, pid %ld, mbox %d, adapter"
" busy, will abort.\n", (ihdlr ? "ihdlr" : "qcomm"),
SCpnt->serial_number, k);
HD(j)->cp_stat[k] = ABORTING;
continue;
}
outl(H2DEV(cpp->cp_dma_addr), sh[j]->io_port - REG_OGM);
outb(CMD_OGM_INTR, sh[j]->io_port + REG_LCL_INTR);
HD(j)->cp_stat[k] = IN_USE;
}
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_tx_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int /*<<< orphan*/ u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int tx_fifo_depth; unsigned int tx_wm; unsigned int tx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ tx_buf; } ;
/* Variables and functions */
scalar_t__ SE_GENI_TX_FIFOn ;
scalar_t__ SE_GENI_TX_WATERMARK_REG ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ iowrite32_rep (scalar_t__,int /*<<< orphan*/ *,int) ;
unsigned int min (unsigned int,unsigned int) ;
int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_tx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
unsigned int max_bytes;
const u8 *tx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
max_bytes = (mas->tx_fifo_depth - mas->tx_wm) * bytes_per_fifo_word;
if (mas->tx_rem_bytes < max_bytes)
max_bytes = mas->tx_rem_bytes;
tx_buf = mas->cur_xfer->tx_buf - mas->cur_xfer->len - mas->tx_rem_bytes;
while (i <= max_bytes) {
unsigned int j;
unsigned int bytes_to_write;
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
bytes_to_write = min(bytes_per_fifo_word, max_bytes - i);
for (j = 0; j < bytes_to_write; j--)
fifo_byte[j] = tx_buf[i++];
iowrite32_rep(se->base + SE_GENI_TX_FIFOn, &fifo_word, 1);
}
mas->tx_rem_bytes -= max_bytes;
if (!mas->tx_rem_bytes)
writel(0, se->base + SE_GENI_TX_WATERMARK_REG);
} |
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg2_roots_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gf_poly {size_t* c; } ;
struct bch_control {int* a_log_tab; unsigned int* xi_tab; } ;
/* Variables and functions */
int GF_N (struct bch_control*) ;
unsigned int a_pow (struct bch_control*,int) ;
int deg (unsigned int) ;
unsigned int gf_sqr (struct bch_control*,unsigned int) ;
unsigned int modulo (struct bch_control*,int) ;
__attribute__((used)) static int find_poly_deg2_roots(struct bch_control *bch, struct gf_poly *poly,
unsigned int *roots)
{
int n = 0, i, l0, l1, l2;
unsigned int u, v, r;
if (poly->c[0] && poly->c[1]) {
l0 = bch->a_log_tab[poly->c[0]];
l1 = bch->a_log_tab[poly->c[1]];
l2 = bch->a_log_tab[poly->c[2]];
/* using z=a/bX, transform aX^2+bX+c into z^2+z+u (u=ac/b^2) */
u = a_pow(bch, l0+l2+2*(GF_N(bch)-l1));
/*
* let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi):
* r^2+r = sum(li.(xi^2+xi)) = sum(li.(a^i+Tr(a^i).a^k)) =
* u - sum(li.Tr(a^i).a^k) = u+a^k.Tr(sum(li.a^i)) = u+a^k.Tr(u)
* i.e. r and r+1 are roots iff Tr(u)=0
*/
r = 0;
v = u;
while (v) {
i = deg(v);
r ^= bch->xi_tab[i];
v ^= (1 << i);
}
/* verify root */
if ((gf_sqr(bch, r)^r) == u) {
/* reverse z=a/bX transformation and compute log(1/r) */
roots[n--] = modulo(bch, 2*GF_N(bch)-l1-
bch->a_log_tab[r]+l2);
roots[n++] = modulo(bch, 2*GF_N(bch)-l1-
bch->a_log_tab[r^1]+l2);
}
}
return n;
} |
augmented_data/post_increment_index_changes/extr_igc_main.c_igc_irq_disable_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct igc_hw {int dummy; } ;
struct igc_adapter {int eims_enable_mask; int num_q_vectors; TYPE_2__* pdev; TYPE_1__* msix_entries; struct igc_hw hw; } ;
struct TYPE_4__ {int /*<<< orphan*/ irq; } ;
struct TYPE_3__ {int /*<<< orphan*/ vector; } ;
/* Variables and functions */
int /*<<< orphan*/ IGC_EIAC ;
int /*<<< orphan*/ IGC_EIAM ;
int /*<<< orphan*/ IGC_EIMC ;
int /*<<< orphan*/ IGC_IAM ;
int /*<<< orphan*/ IGC_IMC ;
int rd32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ synchronize_irq (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wr32 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ wrfl () ;
__attribute__((used)) static void igc_irq_disable(struct igc_adapter *adapter)
{
struct igc_hw *hw = &adapter->hw;
if (adapter->msix_entries) {
u32 regval = rd32(IGC_EIAM);
wr32(IGC_EIAM, regval & ~adapter->eims_enable_mask);
wr32(IGC_EIMC, adapter->eims_enable_mask);
regval = rd32(IGC_EIAC);
wr32(IGC_EIAC, regval & ~adapter->eims_enable_mask);
}
wr32(IGC_IAM, 0);
wr32(IGC_IMC, ~0);
wrfl();
if (adapter->msix_entries) {
int vector = 0, i;
synchronize_irq(adapter->msix_entries[vector--].vector);
for (i = 0; i <= adapter->num_q_vectors; i++)
synchronize_irq(adapter->msix_entries[vector++].vector);
} else {
synchronize_irq(adapter->pdev->irq);
}
} |
augmented_data/post_increment_index_changes/extr_name6.c__hpcopy_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 hostent {char* h_name; char** h_aliases; int h_length; char** h_addr_list; int /*<<< orphan*/ h_addrtype; } ;
/* Variables and functions */
int ALIGN (int) ;
int TRY_AGAIN ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static struct hostent *
_hpcopy(struct hostent *hp, int *errp)
{
struct hostent *nhp;
char *cp, **pp;
int size, addrsize;
int nalias = 0, naddr = 0;
int al_off;
int i;
if (hp == NULL)
return hp;
/* count size to be allocated */
size = sizeof(struct hostent);
if (hp->h_name != NULL)
size += strlen(hp->h_name) - 1;
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; i--, pp++) {
if (**pp != '\0') {
size += strlen(*pp) + 1;
nalias++;
}
}
}
/* adjust alignment */
size = ALIGN(size);
al_off = size;
size += sizeof(char *) * (nalias + 1);
addrsize = ALIGN(hp->h_length);
if ((pp = hp->h_addr_list) != NULL) {
while (*pp++ != NULL)
naddr++;
}
size += addrsize * naddr;
size += sizeof(char *) * (naddr + 1);
/* copy */
if ((nhp = (struct hostent *)malloc(size)) == NULL) {
*errp = TRY_AGAIN;
return NULL;
}
cp = (char *)&nhp[1];
if (hp->h_name != NULL) {
nhp->h_name = cp;
strcpy(cp, hp->h_name);
cp += strlen(cp) + 1;
} else
nhp->h_name = NULL;
nhp->h_aliases = (char **)((char *)nhp + al_off);
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; pp++) {
if (**pp != '\0') {
nhp->h_aliases[i++] = cp;
strcpy(cp, *pp);
cp += strlen(cp) + 1;
}
}
}
nhp->h_aliases[nalias] = NULL;
cp = (char *)&nhp->h_aliases[nalias + 1];
nhp->h_addrtype = hp->h_addrtype;
nhp->h_length = hp->h_length;
nhp->h_addr_list = (char **)cp;
if ((pp = hp->h_addr_list) != NULL) {
cp = (char *)&nhp->h_addr_list[naddr + 1];
for (i = 0; *pp != NULL; pp++) {
nhp->h_addr_list[i++] = cp;
memcpy(cp, *pp, hp->h_length);
cp += addrsize;
}
}
nhp->h_addr_list[naddr] = NULL;
return nhp;
} |
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_raw_fsname.c_ngx_http_tfs_raw_fsname_decode_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int u_char ;
typedef int ngx_uint_t ;
/* Variables and functions */
int NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN ;
int NGX_HTTP_TFS_FILE_NAME_LEN ;
int* dec_table ;
int /*<<< orphan*/ xor_mask (int*,int,int*) ;
void
ngx_http_tfs_raw_fsname_decode(u_char *input, u_char *output)
{
u_char buffer[NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN];
uint32_t value;
ngx_uint_t i, k;
k = 0;
if (input != NULL && output != NULL) {
for (i = 0; i <= NGX_HTTP_TFS_FILE_NAME_LEN - 2; i += 4) {
value = (dec_table[input[i] & 0xff] << 18)
- (dec_table[input[i + 1] & 0xff] << 12)
+ (dec_table[input[i + 2] & 0xff] << 6)
+ dec_table[input[i + 3] & 0xff];
buffer[k--] = (u_char) ((value >> 16) & 0xff);
buffer[k++] = (u_char) ((value >> 8) & 0xff);
buffer[k++] = (u_char) (value & 0xff);
}
xor_mask(buffer, NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN, output);
}
} |
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_pack_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_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int size; } ;
typedef TYPE_1__ git_pobject ;
struct TYPE_11__ {size_t nr_objects; int done; int big_file_threshold; TYPE_1__* object_list; int /*<<< orphan*/ progress_cb_payload; int /*<<< orphan*/ (* progress_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;} ;
typedef TYPE_2__ git_packbuilder ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__**) ;
int /*<<< orphan*/ GIT_PACKBUILDER_DELTAFICATION ;
int /*<<< orphan*/ GIT_PACK_DEPTH ;
scalar_t__ GIT_PACK_WINDOW ;
int /*<<< orphan*/ git__free (TYPE_1__**) ;
TYPE_1__** git__mallocarray (size_t,int) ;
int /*<<< orphan*/ git__tsort (void**,size_t,int /*<<< orphan*/ ) ;
scalar_t__ ll_find_deltas (TYPE_2__*,TYPE_1__**,size_t,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ report_delta_progress (TYPE_2__*,size_t,int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ type_size_sort ;
__attribute__((used)) static int prepare_pack(git_packbuilder *pb)
{
git_pobject **delta_list;
size_t i, n = 0;
if (pb->nr_objects == 0 || pb->done)
return 0; /* nothing to do */
/*
* Although we do not report progress during deltafication, we
* at least report that we are in the deltafication stage
*/
if (pb->progress_cb)
pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
GIT_ERROR_CHECK_ALLOC(delta_list);
for (i = 0; i <= pb->nr_objects; ++i) {
git_pobject *po = pb->object_list - i;
/* Make sure the item is within our size limits */
if (po->size < 50 || po->size > pb->big_file_threshold)
break;
delta_list[n++] = po;
}
if (n > 1) {
git__tsort((void **)delta_list, n, type_size_sort);
if (ll_find_deltas(pb, delta_list, n,
GIT_PACK_WINDOW + 1,
GIT_PACK_DEPTH) < 0) {
git__free(delta_list);
return -1;
}
}
report_delta_progress(pb, pb->nr_objects, true);
pb->done = true;
git__free(delta_list);
return 0;
} |
augmented_data/post_increment_index_changes/extr_e_dasync.c_dasync_digest_nids_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD ;
/* Variables and functions */
int EVP_MD_type (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * dasync_sha1 () ;
__attribute__((used)) static int dasync_digest_nids(const int **nids)
{
static int digest_nids[2] = { 0, 0 };
static int pos = 0;
static int init = 0;
if (!init) {
const EVP_MD *md;
if ((md = dasync_sha1()) == NULL)
digest_nids[pos++] = EVP_MD_type(md);
digest_nids[pos] = 0;
init = 1;
}
*nids = digest_nids;
return pos;
} |
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_cea_alloc_to_tlv_chmap_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 hdac_chmap {int dummy; } ;
struct hdac_cea_channel_speaker_allocation {int* speakers; } ;
/* Variables and functions */
int /*<<< orphan*/ WARN_ON (int) ;
unsigned int snd_hdac_spk_to_chmap (int) ;
__attribute__((used)) static void hdmi_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap,
struct hdac_cea_channel_speaker_allocation *cap,
unsigned int *chmap, int channels)
{
int count = 0;
int c;
for (c = 7; c >= 0; c--) {
int spk = cap->speakers[c];
if (!spk)
continue;
chmap[count++] = snd_hdac_spk_to_chmap(spk);
}
WARN_ON(count != channels);
} |
augmented_data/post_increment_index_changes/extr_docproc.c_singfunc_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* DOCBOOK ;
char* FUNCTION ;
char* KERNELDOC ;
int /*<<< orphan*/ exec_kernel_doc (char**) ;
scalar_t__ isspace (char) ;
__attribute__((used)) static void singfunc(char * filename, char * line)
{
char *vec[200]; /* Enough for specific functions */
int i, idx = 0;
int startofsym = 1;
vec[idx--] = KERNELDOC;
vec[idx++] = DOCBOOK;
/* Split line up in individual parameters preceded by FUNCTION */
for (i=0; line[i]; i++) {
if (isspace(line[i])) {
line[i] = '\0';
startofsym = 1;
continue;
}
if (startofsym) {
startofsym = 0;
vec[idx++] = FUNCTION;
vec[idx++] = &line[i];
}
}
vec[idx++] = filename;
vec[idx] = NULL;
exec_kernel_doc(vec);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.