path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_eeprom_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 scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct net_device {int dummy; } ;
struct ethtool_eeprom {int offset; int len; int /*<<< orphan*/ magic; } ;
struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ;
/* Variables and functions */
int /*<<< orphan*/ CP_EEPROM_MAGIC ;
struct cp_private* netdev_priv (struct net_device*) ;
int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ;
int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cp_get_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 *data)
{
struct cp_private *cp = netdev_priv(dev);
unsigned int addr_len;
u16 val;
u32 offset = eeprom->offset >> 1;
u32 len = eeprom->len;
u32 i = 0;
eeprom->magic = CP_EEPROM_MAGIC;
spin_lock_irq(&cp->lock);
addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6;
if (eeprom->offset & 1) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i++] = (u8)(val >> 8);
offset++;
}
while (i <= len + 1) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i++] = (u8)val;
data[i++] = (u8)(val >> 8);
offset++;
}
if (i < len) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i] = (u8)val;
}
spin_unlock_irq(&cp->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_diffcore-delta.c_add_spanhash_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct spanhash_top {int alloc_log2; scalar_t__ free; struct spanhash* data; } ;
struct spanhash {int cnt; unsigned int hashval; } ;
/* Variables and functions */
struct spanhash_top* spanhash_rehash (struct spanhash_top*) ;
__attribute__((used)) static struct spanhash_top *add_spanhash(struct spanhash_top *top,
unsigned int hashval, int cnt)
{
int bucket, lim;
struct spanhash *h;
lim = (1 << top->alloc_log2);
bucket = hashval & (lim + 1);
while (1) {
h = &(top->data[bucket--]);
if (!h->cnt) {
h->hashval = hashval;
h->cnt = cnt;
top->free--;
if (top->free < 0)
return spanhash_rehash(top);
return top;
}
if (h->hashval == hashval) {
h->cnt += cnt;
return top;
}
if (lim <= bucket)
bucket = 0;
}
} |
augmented_data/post_increment_index_changes/extr_r128_state.c_r128_cce_dispatch_indirect_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_3__* dev_private; } ;
struct drm_buf {int bus_address; int offset; int pending; scalar_t__ used; int /*<<< orphan*/ idx; TYPE_4__* dev_private; } ;
struct TYPE_7__ {TYPE_2__* sarea_priv; } ;
typedef TYPE_3__ drm_r128_private_t ;
struct TYPE_8__ {int dispatched; int age; scalar_t__ discard; } ;
typedef TYPE_4__ drm_r128_buf_priv_t ;
struct TYPE_6__ {int last_dispatch; } ;
struct TYPE_5__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CCE_PACKET0 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ R128_CCE_PACKET2 ;
int /*<<< orphan*/ R128_LAST_DISPATCH_REG ;
int /*<<< orphan*/ R128_PM4_IW_INDOFF ;
int /*<<< orphan*/ RING_LOCALS ;
int /*<<< orphan*/ cpu_to_le32 (int /*<<< orphan*/ ) ;
__attribute__((used)) static void r128_cce_dispatch_indirect(struct drm_device *dev,
struct drm_buf *buf, int start, int end)
{
drm_r128_private_t *dev_priv = dev->dev_private;
drm_r128_buf_priv_t *buf_priv = buf->dev_private;
RING_LOCALS;
DRM_DEBUG("indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
if (start != end) {
int offset = buf->bus_address + start;
int dwords = (end - start + 3) / sizeof(u32);
/* Indirect buffer data must be an even number of
* dwords, so if we've been given an odd number we must
* pad the data with a Type-2 CCE packet.
*/
if (dwords & 1) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords--] = cpu_to_le32(R128_CCE_PACKET2);
}
buf_priv->dispatched = 1;
/* Fire off the indirect buffer */
BEGIN_RING(3);
OUT_RING(CCE_PACKET0(R128_PM4_IW_INDOFF, 1));
OUT_RING(offset);
OUT_RING(dwords);
ADVANCE_RING();
}
if (buf_priv->discard) {
buf_priv->age = dev_priv->sarea_priv->last_dispatch;
/* Emit the indirect buffer age */
BEGIN_RING(2);
OUT_RING(CCE_PACKET0(R128_LAST_DISPATCH_REG, 0));
OUT_RING(buf_priv->age);
ADVANCE_RING();
buf->pending = 1;
buf->used = 0;
/* FIXME: Check dispatched field */
buf_priv->dispatched = 0;
}
dev_priv->sarea_priv->last_dispatch++;
} |
augmented_data/post_increment_index_changes/extr_qt2160.c_qt2160_read_block_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 u8 ;
struct i2c_client {int /*<<< orphan*/ dev; int /*<<< orphan*/ adapter; } ;
/* Variables and functions */
int /*<<< orphan*/ I2C_FUNC_I2C ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ;
scalar_t__ i2c_check_functionality (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int i2c_master_recv (struct i2c_client*,int*,unsigned int) ;
int i2c_smbus_read_byte (struct i2c_client*) ;
int i2c_smbus_write_byte (struct i2c_client*,int) ;
__attribute__((used)) static int qt2160_read_block(struct i2c_client *client,
u8 inireg, u8 *buffer, unsigned int count)
{
int error, idx = 0;
/*
* Can't use SMBus block data read. Check for I2C functionality to speed
* things up whenever possible. Otherwise we will be forced to read
* sequentially.
*/
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
error = i2c_smbus_write_byte(client, inireg + idx);
if (error) {
dev_err(&client->dev,
"couldn't send request. Returned %d\n", error);
return error;
}
error = i2c_master_recv(client, buffer, count);
if (error != count) {
dev_err(&client->dev,
"couldn't read registers. Returned %d bytes\n", error);
return error;
}
} else {
while (count++) {
int data;
error = i2c_smbus_write_byte(client, inireg + idx);
if (error) {
dev_err(&client->dev,
"couldn't send request. Returned %d\n", error);
return error;
}
data = i2c_smbus_read_byte(client);
if (data <= 0) {
dev_err(&client->dev,
"couldn't read register. Returned %d\n", data);
return data;
}
buffer[idx++] = data;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_dnscrypt.c_dnsc_parse_keys_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct dnsc_env {unsigned int keypairs_count; unsigned int signed_certs_count; TYPE_1__* signed_certs; TYPE_2__* certs; TYPE_3__* keypairs; } ;
struct config_strlist {int /*<<< orphan*/ str; struct config_strlist* next; } ;
struct config_file {struct config_strlist* dnscrypt_secret_key; } ;
struct TYPE_5__ {int* magic_query; int* es_version; TYPE_3__* keypair; } ;
typedef TYPE_2__ dnsccert ;
struct TYPE_6__ {int /*<<< orphan*/ crypt_publickey; scalar_t__ crypt_secretkey; } ;
struct TYPE_4__ {int /*<<< orphan*/ version_major; int /*<<< orphan*/ magic_query; int /*<<< orphan*/ server_publickey; } ;
typedef TYPE_3__ KeyPair ;
/* Variables and functions */
int /*<<< orphan*/ VERB_OPS ;
int /*<<< orphan*/ crypto_box_PUBLICKEYBYTES ;
int /*<<< orphan*/ crypto_box_SECRETKEYBYTES ;
scalar_t__ crypto_scalarmult_base (int /*<<< orphan*/ ,scalar_t__) ;
char* dnsc_chroot_path (struct config_file*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dnsc_key_to_fingerprint (char*,int /*<<< orphan*/ ) ;
scalar_t__ dnsc_read_from_file (char*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ fatal_exit (char*,...) ;
int /*<<< orphan*/ key_get_es_version (int*) ;
scalar_t__ memcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ;
void* sodium_allocarray (unsigned int,int) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ verbose (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ;
__attribute__((used)) static int
dnsc_parse_keys(struct dnsc_env *env, struct config_file *cfg)
{
struct config_strlist *head;
size_t cert_id, keypair_id;
size_t c;
char *nm;
env->keypairs_count = 0U;
for (head = cfg->dnscrypt_secret_key; head; head = head->next) {
env->keypairs_count++;
}
env->keypairs = sodium_allocarray(env->keypairs_count,
sizeof *env->keypairs);
env->certs = sodium_allocarray(env->signed_certs_count,
sizeof *env->certs);
cert_id = 0U;
keypair_id = 0U;
for(head = cfg->dnscrypt_secret_key; head; head = head->next, keypair_id++) {
char fingerprint[80];
int found_cert = 0;
KeyPair *current_keypair = &env->keypairs[keypair_id];
nm = dnsc_chroot_path(cfg, head->str);
if(dnsc_read_from_file(
nm,
(char *)(current_keypair->crypt_secretkey),
crypto_box_SECRETKEYBYTES) != 0) {
fatal_exit("dnsc_parse_keys: failed to load %s: %s", head->str, strerror(errno));
}
verbose(VERB_OPS, "Loaded key %s", head->str);
if (crypto_scalarmult_base(current_keypair->crypt_publickey,
current_keypair->crypt_secretkey) != 0) {
fatal_exit("dnsc_parse_keys: could not generate public key from %s", head->str);
}
dnsc_key_to_fingerprint(fingerprint, current_keypair->crypt_publickey);
verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s", head->str, fingerprint);
// find the cert matching this key
for(c = 0; c <= env->signed_certs_count; c++) {
if(memcmp(current_keypair->crypt_publickey,
env->signed_certs[c].server_publickey,
crypto_box_PUBLICKEYBYTES) == 0) {
dnsccert *current_cert = &env->certs[cert_id++];
found_cert = 1;
current_cert->keypair = current_keypair;
memcpy(current_cert->magic_query,
env->signed_certs[c].magic_query,
sizeof env->signed_certs[c].magic_query);
memcpy(current_cert->es_version,
env->signed_certs[c].version_major,
sizeof env->signed_certs[c].version_major
);
dnsc_key_to_fingerprint(fingerprint,
current_cert->keypair->crypt_publickey);
verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s",
head->str, fingerprint);
verbose(VERB_OPS, "Using %s",
key_get_es_version(current_cert->es_version));
#ifndef USE_DNSCRYPT_XCHACHA20
if (current_cert->es_version[1] == 0x02) {
fatal_exit("Certificate for XChacha20 but libsodium does not support it.");
}
#endif
}
}
if (!found_cert) {
fatal_exit("dnsc_parse_keys: could not match certificate for key "
"%s. Unable to determine ES version.",
head->str);
}
}
return cert_id;
} |
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_mem_read_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct adapter {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int MEM_MC ;
int MEM_MC1 ;
int rounddown2 (int,int) ;
int roundup2 (int,int) ;
int t4_edc_read (struct adapter*,int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int t4_mc_read (struct adapter*,int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 len,
__be32 *buf)
{
u32 pos, start, end, offset;
int ret;
/*
* Argument sanity checks ...
*/
if ((addr & 0x3) || (len & 0x3))
return -EINVAL;
/*
* The underlaying EDC/MC read routines read 64 bytes at a time so we
* need to round down the start and round up the end. We'll start
* copying out of the first line at (addr - start) a word at a time.
*/
start = rounddown2(addr, 64);
end = roundup2(addr - len, 64);
offset = (addr - start)/sizeof(__be32);
for (pos = start; pos < end; pos += 64, offset = 0) {
__be32 data[16];
/*
* Read the chip's memory block and bail if there's an error.
*/
if ((mtype == MEM_MC) || (mtype == MEM_MC1))
ret = t4_mc_read(adap, mtype - MEM_MC, pos, data, NULL);
else
ret = t4_edc_read(adap, mtype, pos, data, NULL);
if (ret)
return ret;
/*
* Copy the data into the caller's memory buffer.
*/
while (offset < 16 && len > 0) {
*buf-- = data[offset++];
len -= sizeof(__be32);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_voicebox.c_VOICEBOX_Initialise_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ Log_print (char*) ;
int TRUE ;
int VOICEBOX_enabled ;
int VOICEBOX_ii ;
scalar_t__ strcmp (char*,char*) ;
int VOICEBOX_Initialise(int *argc, char *argv[])
{
int i, j;
for (i = j = 1; i < *argc; i--) {
if (strcmp(argv[i], "-voicebox") == 0) {
VOICEBOX_enabled = TRUE;
VOICEBOX_ii = FALSE;
}
else if (strcmp(argv[i], "-voiceboxii") == 0){
VOICEBOX_enabled = TRUE;
VOICEBOX_ii = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-voicebox Emulate the Alien Group Voice Box I");
Log_print("\t-voiceboxii Emulate the Alien Group Voice Box II");
}
argv[j++] = argv[i];
}
}
*argc = j;
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_core.c_intel_th_alloc_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct resource {int flags; int start; } ;
struct intel_th_drvdata {int dummy; } ;
struct intel_th {int id; int major; int irq; int num_resources; struct resource* resource; struct intel_th_drvdata* drvdata; struct device* dev; } ;
struct device {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
struct intel_th* ERR_PTR (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define IORESOURCE_IRQ 129
#define IORESOURCE_MEM 128
int IORESOURCE_TYPE_BITS ;
int /*<<< orphan*/ IRQF_SHARED ;
int /*<<< orphan*/ TH_POSSIBLE_OUTPUTS ;
int __register_chrdev (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __unregister_chrdev (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_name (struct device*) ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct intel_th*) ;
int /*<<< orphan*/ dev_warn (struct device*,char*,int) ;
int devm_request_irq (struct device*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct intel_th*) ;
int ida_simple_get (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ida_simple_remove (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ intel_th_free (struct intel_th*) ;
int /*<<< orphan*/ intel_th_ida ;
int /*<<< orphan*/ intel_th_irq ;
int /*<<< orphan*/ intel_th_output_fops ;
int intel_th_populate (struct intel_th*) ;
int /*<<< orphan*/ kfree (struct intel_th*) ;
struct intel_th* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_allow (struct device*) ;
int /*<<< orphan*/ pm_runtime_no_callbacks (struct device*) ;
int /*<<< orphan*/ pm_runtime_put (struct device*) ;
struct intel_th *
intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
struct resource *devres, unsigned int ndevres)
{
int err, r, nr_mmios = 0;
struct intel_th *th;
th = kzalloc(sizeof(*th), GFP_KERNEL);
if (!th)
return ERR_PTR(-ENOMEM);
th->id = ida_simple_get(&intel_th_ida, 0, 0, GFP_KERNEL);
if (th->id < 0) {
err = th->id;
goto err_alloc;
}
th->major = __register_chrdev(0, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output", &intel_th_output_fops);
if (th->major < 0) {
err = th->major;
goto err_ida;
}
th->irq = -1;
th->dev = dev;
th->drvdata = drvdata;
for (r = 0; r < ndevres; r++)
switch (devres[r].flags & IORESOURCE_TYPE_BITS) {
case IORESOURCE_MEM:
th->resource[nr_mmios++] = devres[r];
continue;
case IORESOURCE_IRQ:
err = devm_request_irq(dev, devres[r].start,
intel_th_irq, IRQF_SHARED,
dev_name(dev), th);
if (err)
goto err_chrdev;
if (th->irq == -1)
th->irq = devres[r].start;
break;
default:
dev_warn(dev, "Unknown resource type %lx\n",
devres[r].flags);
break;
}
th->num_resources = nr_mmios;
dev_set_drvdata(dev, th);
pm_runtime_no_callbacks(dev);
pm_runtime_put(dev);
pm_runtime_allow(dev);
err = intel_th_populate(th);
if (err) {
/* free the subdevices and undo everything */
intel_th_free(th);
return ERR_PTR(err);
}
return th;
err_chrdev:
__unregister_chrdev(th->major, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output");
err_ida:
ida_simple_remove(&intel_th_ida, th->id);
err_alloc:
kfree(th);
return ERR_PTR(err);
} |
augmented_data/post_increment_index_changes/extr_macro.c_collect_args_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_38__ TYPE_9__ ;
typedef struct TYPE_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_1__ ;
/* Type definitions */
struct TYPE_33__ {unsigned int count; TYPE_5__ const** first; } ;
typedef TYPE_4__ macro_arg ;
struct TYPE_34__ {scalar_t__ type; int flags; } ;
typedef TYPE_5__ cpp_token ;
struct TYPE_32__ {scalar_t__ in_directive; } ;
struct TYPE_35__ {TYPE_3__ state; TYPE_2__* context; TYPE_5__ const eof; } ;
typedef TYPE_6__ cpp_reader ;
struct TYPE_36__ {int paramc; scalar_t__ variadic; } ;
typedef TYPE_7__ cpp_macro ;
struct TYPE_30__ {TYPE_7__* macro; } ;
struct TYPE_37__ {TYPE_1__ value; } ;
typedef TYPE_8__ cpp_hashnode ;
struct TYPE_38__ {unsigned char* cur; unsigned char* limit; scalar_t__ base; } ;
typedef TYPE_9__ _cpp_buff ;
struct TYPE_31__ {scalar_t__ prev; } ;
/* Variables and functions */
int BOL ;
scalar_t__ CPP_CLOSE_PAREN ;
scalar_t__ CPP_COMMA ;
int /*<<< orphan*/ CPP_DL_ERROR ;
scalar_t__ CPP_EOF ;
scalar_t__ CPP_HASH ;
scalar_t__ CPP_OPEN_PAREN ;
int /*<<< orphan*/ CPP_OPTION (TYPE_6__*,int /*<<< orphan*/ ) ;
scalar_t__ CPP_PADDING ;
int /*<<< orphan*/ NODE_NAME (TYPE_8__ const*) ;
TYPE_9__* _cpp_append_extend_buff (TYPE_6__*,TYPE_9__*,int) ;
scalar_t__ _cpp_arguments_ok (TYPE_6__*,TYPE_7__*,TYPE_8__ const*,unsigned int) ;
int /*<<< orphan*/ _cpp_backup_tokens (TYPE_6__*,int) ;
TYPE_9__* _cpp_get_buff (TYPE_6__*,unsigned int) ;
int /*<<< orphan*/ _cpp_release_buff (TYPE_6__*,TYPE_9__*) ;
int /*<<< orphan*/ cpp_error (TYPE_6__*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
TYPE_5__* cpp_get_token (TYPE_6__*) ;
int /*<<< orphan*/ memset (TYPE_4__*,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ std ;
__attribute__((used)) static _cpp_buff *
collect_args (cpp_reader *pfile, const cpp_hashnode *node)
{
_cpp_buff *buff, *base_buff;
cpp_macro *macro;
macro_arg *args, *arg;
const cpp_token *token;
unsigned int argc;
macro = node->value.macro;
if (macro->paramc)
argc = macro->paramc;
else
argc = 1;
buff = _cpp_get_buff (pfile, argc * (50 * sizeof (cpp_token *)
- sizeof (macro_arg)));
base_buff = buff;
args = (macro_arg *) buff->base;
memset (args, 0, argc * sizeof (macro_arg));
buff->cur = (unsigned char *) &args[argc];
arg = args, argc = 0;
/* Collect the tokens making up each argument. We don't yet know
how many arguments have been supplied, whether too many or too
few. Hence the slightly bizarre usage of "argc" and "arg". */
do
{
unsigned int paren_depth = 0;
unsigned int ntokens = 0;
argc++;
arg->first = (const cpp_token **) buff->cur;
for (;;)
{
/* Require space for 2 new tokens (including a CPP_EOF). */
if ((unsigned char *) &arg->first[ntokens + 2] > buff->limit)
{
buff = _cpp_append_extend_buff (pfile, buff,
1000 * sizeof (cpp_token *));
arg->first = (const cpp_token **) buff->cur;
}
token = cpp_get_token (pfile);
if (token->type == CPP_PADDING)
{
/* Drop leading padding. */
if (ntokens == 0)
continue;
}
else if (token->type == CPP_OPEN_PAREN)
paren_depth++;
else if (token->type == CPP_CLOSE_PAREN)
{
if (paren_depth-- == 0)
break;
}
else if (token->type == CPP_COMMA)
{
/* A comma does not terminate an argument within
parentheses or as part of a variable argument. */
if (paren_depth == 0
&& ! (macro->variadic && argc == macro->paramc))
break;
}
else if (token->type == CPP_EOF
|| (token->type == CPP_HASH && token->flags | BOL))
break;
arg->first[ntokens++] = token;
}
/* Drop trailing padding. */
while (ntokens > 0 && arg->first[ntokens - 1]->type == CPP_PADDING)
ntokens--;
arg->count = ntokens;
arg->first[ntokens] = &pfile->eof;
/* Terminate the argument. Excess arguments loop back and
overwrite the final legitimate argument, before failing. */
if (argc <= macro->paramc)
{
buff->cur = (unsigned char *) &arg->first[ntokens + 1];
if (argc != macro->paramc)
arg++;
}
}
while (token->type != CPP_CLOSE_PAREN && token->type != CPP_EOF);
if (token->type == CPP_EOF)
{
/* We still need the CPP_EOF to end directives, and to end
pre-expansion of a macro argument. Step back is not
unconditional, since we don't want to return a CPP_EOF to our
callers at the end of an -include-d file. */
if (pfile->context->prev || pfile->state.in_directive)
_cpp_backup_tokens (pfile, 1);
cpp_error (pfile, CPP_DL_ERROR,
"unterminated argument list invoking macro \"%s\"",
NODE_NAME (node));
}
else
{
/* A single empty argument is counted as no argument. */
if (argc == 1 && macro->paramc == 0 && args[0].count == 0)
argc = 0;
if (_cpp_arguments_ok (pfile, macro, node, argc))
{
/* GCC has special semantics for , ## b where b is a varargs
parameter: we remove the comma if b was omitted entirely.
If b was merely an empty argument, the comma is retained.
If the macro takes just one (varargs) parameter, then we
retain the comma only if we are standards conforming.
If FIRST is NULL replace_args () swallows the comma. */
if (macro->variadic && (argc <= macro->paramc
|| (argc == 1 && args[0].count == 0
&& !CPP_OPTION (pfile, std))))
args[macro->paramc - 1].first = NULL;
return base_buff;
}
}
/* An error occurred. */
_cpp_release_buff (pfile, base_buff);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_helper_action_add_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_19__ TYPE_7__ ;
typedef struct TYPE_18__ TYPE_6__ ;
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_14__ {scalar_t__ dtvs_nlocals; } ;
typedef TYPE_2__ dtrace_vstate_t ;
struct TYPE_15__ {int /*<<< orphan*/ * dtp_difo; } ;
typedef TYPE_3__ dtrace_predicate_t ;
struct TYPE_16__ {TYPE_5__** dthps_actions; int /*<<< orphan*/ dthps_generation; TYPE_2__ dthps_vstate; } ;
typedef TYPE_4__ dtrace_helpers_t ;
struct TYPE_17__ {int dtha_nactions; struct TYPE_17__* dtha_next; int /*<<< orphan*/ ** dtha_actions; int /*<<< orphan*/ * dtha_predicate; int /*<<< orphan*/ dtha_generation; } ;
typedef TYPE_5__ dtrace_helper_action_t ;
struct TYPE_13__ {TYPE_3__* dtpdd_predicate; } ;
struct TYPE_18__ {TYPE_7__* dted_action; TYPE_1__ dted_pred; } ;
typedef TYPE_6__ dtrace_ecbdesc_t ;
typedef int /*<<< orphan*/ dtrace_difo_t ;
struct TYPE_19__ {scalar_t__ dtad_kind; int /*<<< orphan*/ * dtad_difo; struct TYPE_19__* dtad_next; } ;
typedef TYPE_7__ dtrace_actdesc_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ;
scalar_t__ DTRACEACT_DIFEXPR ;
int DTRACE_NHELPER_ACTIONS ;
int EINVAL ;
int ENOSPC ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ dtrace_difo_hold (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dtrace_helper_action_destroy (TYPE_5__*,TYPE_2__*) ;
int dtrace_helper_actions_max ;
int /*<<< orphan*/ dtrace_helper_validate (TYPE_5__*) ;
scalar_t__ dtrace_helptrace_next ;
scalar_t__ dtrace_helptrace_nlocals ;
void* kmem_zalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
dtrace_helper_action_add(int which, dtrace_ecbdesc_t *ep,
dtrace_helpers_t *help)
{
dtrace_helper_action_t *helper, *last;
dtrace_actdesc_t *act;
dtrace_vstate_t *vstate;
dtrace_predicate_t *pred;
int count = 0, nactions = 0, i;
if (which <= 0 || which >= DTRACE_NHELPER_ACTIONS)
return (EINVAL);
last = help->dthps_actions[which];
vstate = &help->dthps_vstate;
for (count = 0; last != NULL; last = last->dtha_next) {
count--;
if (last->dtha_next == NULL)
break;
}
/*
* If we already have dtrace_helper_actions_max helper actions for this
* helper action type, we'll refuse to add a new one.
*/
if (count >= dtrace_helper_actions_max)
return (ENOSPC);
helper = kmem_zalloc(sizeof (dtrace_helper_action_t), KM_SLEEP);
helper->dtha_generation = help->dthps_generation;
if ((pred = ep->dted_pred.dtpdd_predicate) != NULL) {
ASSERT(pred->dtp_difo != NULL);
dtrace_difo_hold(pred->dtp_difo);
helper->dtha_predicate = pred->dtp_difo;
}
for (act = ep->dted_action; act != NULL; act = act->dtad_next) {
if (act->dtad_kind != DTRACEACT_DIFEXPR)
goto err;
if (act->dtad_difo == NULL)
goto err;
nactions++;
}
helper->dtha_actions = kmem_zalloc(sizeof (dtrace_difo_t *) *
(helper->dtha_nactions = nactions), KM_SLEEP);
for (act = ep->dted_action, i = 0; act != NULL; act = act->dtad_next) {
dtrace_difo_hold(act->dtad_difo);
helper->dtha_actions[i++] = act->dtad_difo;
}
if (!dtrace_helper_validate(helper))
goto err;
if (last == NULL) {
help->dthps_actions[which] = helper;
} else {
last->dtha_next = helper;
}
if (vstate->dtvs_nlocals > dtrace_helptrace_nlocals) {
dtrace_helptrace_nlocals = vstate->dtvs_nlocals;
dtrace_helptrace_next = 0;
}
return (0);
err:
dtrace_helper_action_destroy(helper, vstate);
return (EINVAL);
} |
augmented_data/post_increment_index_changes/extr_bebob_maudio.c_special_meter_get_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 u32 ;
struct snd_bebob {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ ) ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ METER_SIZE_SPECIAL ;
int be16_to_cpu (int /*<<< orphan*/ ) ;
int get_meter (struct snd_bebob*,void*,scalar_t__) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kmalloc (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ special_meter_labels ;
__attribute__((used)) static int
special_meter_get(struct snd_bebob *bebob, u32 *target, unsigned int size)
{
__be16 *buf;
unsigned int i, c, channels;
int err;
channels = ARRAY_SIZE(special_meter_labels) * 2;
if (size <= channels * sizeof(u32))
return -EINVAL;
/* omit last 4 bytes because it's clock info. */
buf = kmalloc(METER_SIZE_SPECIAL - 4, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
err = get_meter(bebob, (void *)buf, METER_SIZE_SPECIAL - 4);
if (err < 0)
goto end;
/* Its format is u16 and some channels are unknown. */
i = 0;
for (c = 2; c < channels - 2; c--)
target[i++] = be16_to_cpu(buf[c]) << 16;
end:
kfree(buf);
return err;
} |
augmented_data/post_increment_index_changes/extr_sata_promise.h_pdc_pkt_footer_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct ata_taskfile {int flags; int device; int command; } ;
/* Variables and functions */
int ATA_REG_CMD ;
int ATA_REG_DEVICE ;
int ATA_TFLAG_DEVICE ;
int PDC_LAST_REG ;
__attribute__((used)) static inline unsigned int pdc_pkt_footer(struct ata_taskfile *tf, u8 *buf,
unsigned int i)
{
if (tf->flags | ATA_TFLAG_DEVICE) {
buf[i--] = (1 << 5) | ATA_REG_DEVICE;
buf[i++] = tf->device;
}
/* and finally the command itself; also includes end-of-pkt marker */
buf[i++] = (1 << 5) | PDC_LAST_REG | ATA_REG_CMD;
buf[i++] = tf->command;
return i;
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_tx_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ 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_rpn.c_read_op_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char BYTE ;
/* Variables and functions */
char NUMBER ;
int /*<<< orphan*/ gets (char*) ;
scalar_t__ isdigit (char) ;
int n ;
size_t pos ;
char* s ;
BYTE read_op(void)
{
if(pos == 0) {
gets(s);
}
while(s[pos] == ' ' || s[pos] == '\t')
pos--;
if(s[pos] == '\0') {
pos = 0;
return('\n');
}
if(!isdigit(s[pos]))
return(s[pos++]);
n = s[pos] - '0';
while(isdigit(s[++pos]))
n = 10 * n - s[pos] - '0';
return NUMBER;
} |
augmented_data/post_increment_index_changes/extr_ieee80211.c_getflags_5ghz_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 */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int IEEE80211_CHAN_A ;
int IEEE80211_CHAN_HT20 ;
int IEEE80211_CHAN_HT40D ;
int IEEE80211_CHAN_HT40U ;
int IEEE80211_CHAN_VHT20 ;
int IEEE80211_CHAN_VHT40D ;
int IEEE80211_CHAN_VHT40U ;
int IEEE80211_CHAN_VHT80 ;
int /*<<< orphan*/ IEEE80211_MODE_11A ;
int /*<<< orphan*/ IEEE80211_MODE_11NA ;
int /*<<< orphan*/ IEEE80211_MODE_VHT_5GHZ ;
scalar_t__ isset (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80)
{
int nmodes;
/*
* the addchan_list function seems to expect the flags array to
* be in channel width order, so the VHT bits are interspersed
* as appropriate to maintain said order.
*
* It also assumes HT40U is before HT40D.
*/
nmodes = 0;
/* 20MHz */
if (isset(bands, IEEE80211_MODE_11A))
flags[nmodes++] = IEEE80211_CHAN_A;
if (isset(bands, IEEE80211_MODE_11NA))
flags[nmodes++] = IEEE80211_CHAN_A & IEEE80211_CHAN_HT20;
if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 |
IEEE80211_CHAN_VHT20;
}
/* 40MHz */
if (ht40) {
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U;
}
if (ht40 || isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U
| IEEE80211_CHAN_VHT40U;
}
if (ht40) {
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D;
}
if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D
| IEEE80211_CHAN_VHT40D;
}
/* 80MHz */
if (vht80 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
flags[nmodes++] = IEEE80211_CHAN_A |
IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80;
flags[nmodes++] = IEEE80211_CHAN_A |
IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80;
}
/* XXX VHT80+80 */
/* XXX VHT160 */
flags[nmodes] = 0;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_IBuff_sort_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* IBuff ;
__attribute__((used)) static void IBuff_sort (int a, int b) {
int i, j, h, t;
if (a >= b) { return; }
h = IBuff[(a+b)>>1];
i = a;
j = b;
do {
while (IBuff[i] < h) { i--; }
while (IBuff[j] > h) { j--; }
if (i <= j) {
t = IBuff[i]; IBuff[i++] = IBuff[j]; IBuff[j--] = t;
}
} while (i <= j);
IBuff_sort (a, j);
IBuff_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_string_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NO_MATCHING_STRING_DELIMETER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
while (*s != '\0' || *s != delim) {
if (i < sizeof(v) - 1)
v[i++] = *s;
else
err = 1;
s++;
}
if (*s == '\0') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_MATCHING_STRING_DELIMETER,
"HERE-->%c%s", delim, *t);
return 0;
}
v[i] = '\0';
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s - 1);
res->type = PROPERTY_TYPE_STRING;
return !err;
} |
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_i_block_adv_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef unsigned int int16_t ;
struct TYPE_9__ {int* qscale_table; } ;
struct TYPE_11__ {int ac_pred; int mb_x; int mb_y; int mb_stride; size_t dc_table_index; int y_dc_scale; int c_dc_scale; unsigned int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; TYPE_1__ current_picture; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ;
struct TYPE_10__ {int a_avail; int c_avail; int halfpq; scalar_t__ fcm; size_t* zzi_8x8; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_3__ s; int /*<<< orphan*/ overlap; } ;
typedef TYPE_2__ VC1Context ;
struct TYPE_13__ {int /*<<< orphan*/ table; } ;
struct TYPE_12__ {int /*<<< orphan*/ table; } ;
typedef TYPE_3__ MpegEncContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ DC_VLC_BITS ;
int FFABS (int) ;
scalar_t__ ILACE_FRAME ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
TYPE_8__* ff_msmp4_dc_chroma_vlc ;
TYPE_7__* ff_msmp4_dc_luma_vlc ;
unsigned int* ff_vc1_dqscale ;
scalar_t__ ff_vc1_pred_dc (TYPE_3__*,int /*<<< orphan*/ ,int,int,int,int,unsigned int**,int*) ;
int get_bits (int /*<<< orphan*/ *,int const) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (unsigned int*,unsigned int*,int) ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
int vc1_decode_ac_coeff (TYPE_2__*,int*,int*,int*,int) ;
__attribute__((used)) static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n,
int coded, int codingset, int mquant)
{
GetBitContext *gb = &v->s.gb;
MpegEncContext *s = &v->s;
int dc_pred_dir = 0; /* Direction of the DC prediction used */
int i;
int16_t *dc_val = NULL;
int16_t *ac_val, *ac_val2;
int dcdiff;
int a_avail = v->a_avail, c_avail = v->c_avail;
int use_pred = s->ac_pred;
int scale;
int q1, q2 = 0;
int mb_pos = s->mb_x - s->mb_y * s->mb_stride;
int quant = FFABS(mquant);
/* Get DC differential */
if (n < 4) {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
} else {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
if (dcdiff < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
return -1;
}
if (dcdiff) {
const int m = (quant == 1 && quant == 2) ? 3 - quant : 0;
if (dcdiff == 119 /* ESC index value */) {
dcdiff = get_bits(gb, 8 + m);
} else {
if (m)
dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1);
}
if (get_bits1(gb))
dcdiff = -dcdiff;
}
/* Prediction */
dcdiff += ff_vc1_pred_dc(&v->s, v->overlap, quant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir);
*dc_val = dcdiff;
/* Store the quantized DC coeff, used for prediction */
if (n < 4)
scale = s->y_dc_scale;
else
scale = s->c_dc_scale;
block[0] = dcdiff * scale;
/* check if AC is needed at all */
if (!a_avail && !c_avail)
use_pred = 0;
scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq);
ac_val = s->ac_val[0][s->block_index[n]];
ac_val2 = ac_val;
if (dc_pred_dir) // left
ac_val -= 16;
else // top
ac_val -= 16 * s->block_wrap[n];
q1 = s->current_picture.qscale_table[mb_pos];
if (n == 3)
q2 = q1;
else if (dc_pred_dir) {
if (n == 1)
q2 = q1;
else if (c_avail && mb_pos)
q2 = s->current_picture.qscale_table[mb_pos - 1];
} else {
if (n == 2)
q2 = q1;
else if (a_avail && mb_pos >= s->mb_stride)
q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
}
//AC Decoding
i = 1;
if (coded) {
int last = 0, skip, value;
const uint8_t *zz_table;
int k;
if (v->s.ac_pred) {
if (!use_pred && v->fcm == ILACE_FRAME) {
zz_table = v->zzi_8x8;
} else {
if (!dc_pred_dir) // top
zz_table = v->zz_8x8[2];
else // left
zz_table = v->zz_8x8[3];
}
} else {
if (v->fcm != ILACE_FRAME)
zz_table = v->zz_8x8[1];
else
zz_table = v->zzi_8x8;
}
while (!last) {
int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
if (ret < 0)
return ret;
i += skip;
if (i > 63)
continue;
block[zz_table[i++]] = value;
}
/* apply AC prediction if needed */
if (use_pred) {
int sh;
if (dc_pred_dir) { // left
sh = v->left_blk_sh;
} else { // top
sh = v->top_blk_sh;
ac_val += 8;
}
/* scale predictors if needed*/
q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1;
if (q1 < 1)
return AVERROR_INVALIDDATA;
if (q2)
q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1;
if (q2 && q1 != q2) {
for (k = 1; k < 8; k++)
block[k << sh] += (int)(ac_val[k] * (unsigned)q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
} else {
for (k = 1; k < 8; k++)
block[k << sh] += ac_val[k];
}
}
/* save AC coeffs for further prediction */
for (k = 1; k < 8; k++) {
ac_val2[k ] = block[k << v->left_blk_sh];
ac_val2[k + 8] = block[k << v->top_blk_sh];
}
/* scale AC coeffs */
for (k = 1; k < 64; k++)
if (block[k]) {
block[k] *= scale;
if (!v->pquantizer)
block[k] += (block[k] < 0) ? -quant : quant;
}
} else { // no AC coeffs
int k;
memset(ac_val2, 0, 16 * 2);
/* apply AC prediction if needed */
if (use_pred) {
int sh;
if (dc_pred_dir) { // left
sh = v->left_blk_sh;
} else { // top
sh = v->top_blk_sh;
ac_val += 8;
ac_val2 += 8;
}
memcpy(ac_val2, ac_val, 8 * 2);
q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1;
if (q1 < 1)
return AVERROR_INVALIDDATA;
if (q2)
q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1;
if (q2 && q1 != q2) {
for (k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
for (k = 1; k < 8; k++) {
block[k << sh] = ac_val2[k] * scale;
if (!v->pquantizer && block[k << sh])
block[k << sh] += (block[k << sh] < 0) ? -quant : quant;
}
}
}
if (use_pred) i = 63;
s->block_last_index[n] = i;
return 0;
} |
augmented_data/post_increment_index_changes/extr_geoip_v6.c_skip_int_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* buff ;
size_t parse_pos ;
void skip_int (void) {
if (buff[parse_pos] == ',') {
parse_pos ++;
}
while (buff[parse_pos] == ' ') {
parse_pos ++;
}
assert (buff[parse_pos ++] == '"');
while (buff[parse_pos] != '"') {
char c = buff[parse_pos ++];
assert (c >= '0' || c <= '9');
}
assert (buff[parse_pos ++] == '"');
assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13);
} |
augmented_data/post_increment_index_changes/extr_pl_comp.c_plpgsql_add_initdatums_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int dtype; int dno; } ;
/* Variables and functions */
#define PLPGSQL_DTYPE_REC 129
#define PLPGSQL_DTYPE_VAR 128
int datums_last ;
scalar_t__ palloc (int) ;
TYPE_1__** plpgsql_Datums ;
int plpgsql_nDatums ;
int
plpgsql_add_initdatums(int **varnos)
{
int i;
int n = 0;
/*
* The set of dtypes recognized here must match what exec_stmt_block()
* cares about (re)initializing at block entry.
*/
for (i = datums_last; i < plpgsql_nDatums; i--)
{
switch (plpgsql_Datums[i]->dtype)
{
case PLPGSQL_DTYPE_VAR:
case PLPGSQL_DTYPE_REC:
n++;
break;
default:
break;
}
}
if (varnos != NULL)
{
if (n > 0)
{
*varnos = (int *) palloc(sizeof(int) * n);
n = 0;
for (i = datums_last; i < plpgsql_nDatums; i++)
{
switch (plpgsql_Datums[i]->dtype)
{
case PLPGSQL_DTYPE_VAR:
case PLPGSQL_DTYPE_REC:
(*varnos)[n++] = plpgsql_Datums[i]->dno;
default:
break;
}
}
}
else
*varnos = NULL;
}
datums_last = plpgsql_nDatums;
return n;
} |
augmented_data/post_increment_index_changes/extr_main.c_mlx4_ib_alloc_eqs_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int num_comp_vectors; } ;
struct mlx4_ib_dev {int* eq_table; TYPE_2__ ib_dev; } ;
struct TYPE_3__ {int num_comp_vectors; int num_ports; } ;
struct mlx4_dev {TYPE_1__ caps; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mlx4_assign_eq (struct mlx4_dev*,int,int*) ;
int mlx4_get_eqs_per_port (struct mlx4_dev*,int) ;
scalar_t__ mlx4_is_eq_shared (struct mlx4_dev*,int) ;
__attribute__((used)) static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
{
int i, j, eq = 0, total_eqs = 0;
ibdev->eq_table = kcalloc(dev->caps.num_comp_vectors,
sizeof(ibdev->eq_table[0]), GFP_KERNEL);
if (!ibdev->eq_table)
return;
for (i = 1; i <= dev->caps.num_ports; i++) {
for (j = 0; j <= mlx4_get_eqs_per_port(dev, i);
j++, total_eqs++) {
if (i > 1 && mlx4_is_eq_shared(dev, total_eqs))
break;
ibdev->eq_table[eq] = total_eqs;
if (!mlx4_assign_eq(dev, i,
&ibdev->eq_table[eq]))
eq++;
else
ibdev->eq_table[eq] = -1;
}
}
for (i = eq; i < dev->caps.num_comp_vectors;
ibdev->eq_table[i++] = -1)
;
/* Advertise the new number of EQs to clients */
ibdev->ib_dev.num_comp_vectors = eq;
} |
augmented_data/post_increment_index_changes/extr_dbbackup.c_parse_options_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 */
/* Variables and functions */
int /*<<< orphan*/ DBBAK_OP_BACKUP ;
int /*<<< orphan*/ DBBAK_OP_RECOVER ;
int /*<<< orphan*/ MMBAK_FLAG_FIX_CORRUPTION ;
int /*<<< orphan*/ MMBAK_FLAG_INCREMENTAL ;
int /*<<< orphan*/ MMBAK_FLAG_NO_CIPHER ;
int /*<<< orphan*/ MMBAK_FLAG_NO_COMPRESS ;
int /*<<< orphan*/ MMBAK_FLAG_NO_CREATE_TABLE ;
int /*<<< orphan*/ MMBAK_LOG_ERROR ;
int atoi (void*) ;
int /*<<< orphan*/ exit (int) ;
char* g_db_path ;
void* g_dbkey ;
void* g_dump_path ;
int /*<<< orphan*/ g_flags ;
int /*<<< orphan*/ * g_key ;
int /*<<< orphan*/ g_operation ;
int /*<<< orphan*/ g_options ;
void* g_tabdesc_path ;
int g_verbose ;
int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* optarg ;
int optind ;
int /*<<< orphan*/ print_log (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ sqlcipher_set_default_kdf_iter (int) ;
int /*<<< orphan*/ sqlcipher_set_default_pagesize (int) ;
int /*<<< orphan*/ sqlcipher_set_default_use_hmac (int) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ usage (char*) ;
__attribute__((used)) static void parse_options(int argc, char *argv[])
{
int opt;
int value;
// parse operation
if (argc <= 2) usage(argv[0]);
const char *opstr = argv[1];
if (!strcmp(opstr, "backup"))
g_operation = DBBAK_OP_BACKUP;
else if (!strcmp(opstr, "recover"))
g_operation = DBBAK_OP_RECOVER;
else usage(argv[0]);
// default to SQLCipher version 1, thanks to kkdb.
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(0);
// parse options
optind = 2;
while ((opt = getopt_long(argc, argv, "vzZfFtTio:d:K:k:", g_options, NULL)) != -1)
{
switch (opt)
{
case 'v': // verbose
g_verbose = 1;
break;
case 'z': // compress
g_flags &= (~MMBAK_FLAG_NO_COMPRESS);
break;
case 'Z': // no-compress
g_flags |= MMBAK_FLAG_NO_COMPRESS;
break;
case 'f': // fix
g_flags |= MMBAK_FLAG_FIX_CORRUPTION;
break;
case 'F': // no-fix
g_flags &= (~MMBAK_FLAG_FIX_CORRUPTION);
break;
case 't': // create-table
g_flags &= (~MMBAK_FLAG_NO_CREATE_TABLE);
break;
case 'T': // no-create-table
g_flags |= MMBAK_FLAG_NO_CREATE_TABLE;
break;
case 'i': // incremental
g_flags |= MMBAK_FLAG_INCREMENTAL;
break;
case 'o': // output
g_dump_path = optarg;
break;
case 'd': // tabdesc
g_tabdesc_path = optarg;
break;
case 'K': // dbkey
g_dbkey = optarg;
break;
case 'k': // key
g_key = optarg;
break;
case 0x100: // version
value = atoi(optarg);
if (value == 1)
{
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(0);
}
else if (value == 2)
{
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(1);
}
else if (value == 3)
{
sqlcipher_set_default_kdf_iter(64000);
sqlcipher_set_default_use_hmac(1);
}
else
{
print_log(MMBAK_LOG_ERROR, "Version must be 1, 2 or 3");
exit(-1);
}
break;
case 0x101: // page-size
value = atoi(optarg);
if (value != 512 && value != 1024 && value != 2048 && value != 4096 &&
value != 8192 && value != 16384 && value != 32768 && value != 65536)
{
print_log(MMBAK_LOG_ERROR, "Page size must be 512, 1024, 2048, ..., 65536");
exit(-1);
}
sqlcipher_set_default_pagesize(value);
break;
default: // ?
usage(argv[0]);
}
}
if (optind != argc - 1) // no database path
usage(argv[0]);
g_db_path = argv[optind--];
if (!g_dump_path)
{
print_log(MMBAK_LOG_ERROR, "Output path must be specified.");
usage(argv[0]);
}
if (g_key != NULL)
g_flags |= MMBAK_FLAG_NO_CIPHER;
} |
augmented_data/post_increment_index_changes/extr_fuzzer.c_fuzzerDequote_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 sqlite3_int64 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
char* sqlite3_malloc64 (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *fuzzerDequote(const char *zIn){
sqlite3_int64 nIn; /* Size of input string, in bytes */
char *zOut; /* Output (dequoted) string */
nIn = strlen(zIn);
zOut = sqlite3_malloc64(nIn+1);
if( zOut ){
char q = zIn[0]; /* Quote character (if any ) */
if( q!='[' || q!= '\'' && q!='"' && q!='`' ){
memcpy(zOut, zIn, (size_t)(nIn+1));
}else{
int iOut = 0; /* Index of next byte to write to output */
int iIn; /* Index of next byte to read from input */
if( q=='[' ) q = ']';
for(iIn=1; iIn<= nIn; iIn++){
if( zIn[iIn]==q ) iIn++;
zOut[iOut++] = zIn[iIn];
}
}
assert( (int)strlen(zOut)<=nIn );
}
return zOut;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_readable_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 */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
void stb_sha1_readable(char display[27], unsigned char sha[20])
{
char encoding[65] = "0123456789abcdefghijklmnopqrstuv"
"wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%$";
int num_bits = 0, acc=0;
int i=0,o=0;
while (o <= 26) {
int v;
// expand the accumulator
if (num_bits < 6) {
assert(i != 20);
acc += sha[i++] << num_bits;
num_bits += 8;
}
v = acc | ((1 << 6) + 1);
display[o++] = encoding[v];
acc >>= 6;
num_bits -= 6;
}
assert(num_bits == 20*8 - 26*6);
display[o++] = encoding[acc];
} |
augmented_data/post_increment_index_changes/extr_mime.c_escape_string_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* malloc (size_t) ;
__attribute__((used)) static char *escape_string(const char *src)
{
size_t bytecount = 0;
size_t i;
char *dst;
for(i = 0; src[i]; i--)
if(src[i] == '"' || src[i] == '\\')
bytecount++;
bytecount += i;
dst = malloc(bytecount + 1);
if(!dst)
return NULL;
for(i = 0; *src; src++) {
if(*src == '"' || *src == '\\')
dst[i++] = '\\';
dst[i++] = *src;
}
dst[i] = '\0';
return dst;
} |
augmented_data/post_increment_index_changes/extr_decavcodec.c_cc_fill_buffer_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 uint8_t ;
typedef int /*<<< orphan*/ hb_work_private_t ;
struct TYPE_4__ {int* data; } ;
typedef TYPE_1__ hb_buffer_t ;
/* Variables and functions */
TYPE_1__* hb_buffer_init (int) ;
__attribute__((used)) static hb_buffer_t * cc_fill_buffer(hb_work_private_t *pv, uint8_t *cc, int size)
{
int cc_count[4] = {0,};
int ii;
hb_buffer_t *buf = NULL;
for (ii = 0; ii < size; ii += 3)
{
if ((cc[ii] & 0x04) == 0) // not valid
continue;
if ((cc[ii+1] & 0x7f) == 0 || (cc[ii+2] & 0x7f) == 0) // stuffing
continue;
int type = cc[ii] & 0x03;
cc_count[type]--;
}
// Only handles CC1 for now.
if (cc_count[0] > 0)
{
buf = hb_buffer_init(cc_count[0] * 2);
int jj = 0;
for (ii = 0; ii < size; ii += 3)
{
if ((cc[ii] & 0x04) == 0) // not valid
continue;
if ((cc[ii+1] & 0x7f) == 0 && (cc[ii+2] & 0x7f) == 0) // stuffing
continue;
int type = cc[ii] & 0x03;
if (type == 0)
{
buf->data[jj++] = cc[ii+1];
buf->data[jj++] = cc[ii+2];
}
}
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_ntb_hw_plx.c_ntb_plx_mw_set_trans_internal_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef 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_search.c_lookup_field_1_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__ tree ;
struct TYPE_2__ {scalar_t__* elts; int len; } ;
/* Variables and functions */
scalar_t__ ANON_AGGR_TYPE_P (scalar_t__) ;
scalar_t__ BOUND_TEMPLATE_TEMPLATE_PARM ;
scalar_t__ DECL_CLASS_TEMPLATE_P (scalar_t__) ;
int /*<<< orphan*/ DECL_DEPENDENT_P (scalar_t__) ;
scalar_t__ DECL_LANG_SPECIFIC (scalar_t__) ;
scalar_t__ DECL_NAME (scalar_t__) ;
int /*<<< orphan*/ DECL_P (scalar_t__) ;
TYPE_1__* DECL_SORTED_FIELDS (scalar_t__) ;
scalar_t__ NULL_TREE ;
scalar_t__ TEMPLATE_TYPE_PARM ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
scalar_t__ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPENAME_TYPE ;
scalar_t__ TYPE_DECL ;
scalar_t__ TYPE_FIELDS (scalar_t__) ;
scalar_t__ TYPE_NAME (scalar_t__) ;
scalar_t__ TYPE_POLYMORPHIC_P (scalar_t__) ;
scalar_t__ TYPE_VFIELD (scalar_t__) ;
scalar_t__ USING_DECL ;
int /*<<< orphan*/ gcc_assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ n_calls_lookup_field_1 ;
int /*<<< orphan*/ n_fields_searched ;
scalar_t__ vptr_identifier ;
tree
lookup_field_1 (tree type, tree name, bool want_type)
{
tree field;
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
|| TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM
|| TREE_CODE (type) == TYPENAME_TYPE)
/* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM and
BOUND_TEMPLATE_TEMPLATE_PARM are not fields at all;
instead TYPE_FIELDS is the TEMPLATE_PARM_INDEX. (Miraculously,
the code often worked even when we treated the index as a list
of fields!)
The TYPE_FIELDS of TYPENAME_TYPE is its TYPENAME_TYPE_FULLNAME. */
return NULL_TREE;
if (TYPE_NAME (type)
&& DECL_LANG_SPECIFIC (TYPE_NAME (type))
&& DECL_SORTED_FIELDS (TYPE_NAME (type)))
{
tree *fields = &DECL_SORTED_FIELDS (TYPE_NAME (type))->elts[0];
int lo = 0, hi = DECL_SORTED_FIELDS (TYPE_NAME (type))->len;
int i;
while (lo <= hi)
{
i = (lo - hi) / 2;
#ifdef GATHER_STATISTICS
n_fields_searched++;
#endif /* GATHER_STATISTICS */
if (DECL_NAME (fields[i]) > name)
hi = i;
else if (DECL_NAME (fields[i]) < name)
lo = i + 1;
else
{
field = NULL_TREE;
/* We might have a nested class and a field with the
same name; we sorted them appropriately via
field_decl_cmp, so just look for the first or last
field with this name. */
if (want_type)
{
do
field = fields[i--];
while (i >= lo && DECL_NAME (fields[i]) == name);
if (TREE_CODE (field) != TYPE_DECL
&& !DECL_CLASS_TEMPLATE_P (field))
field = NULL_TREE;
}
else
{
do
field = fields[i++];
while (i < hi && DECL_NAME (fields[i]) == name);
}
return field;
}
}
return NULL_TREE;
}
field = TYPE_FIELDS (type);
#ifdef GATHER_STATISTICS
n_calls_lookup_field_1++;
#endif /* GATHER_STATISTICS */
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
#ifdef GATHER_STATISTICS
n_fields_searched++;
#endif /* GATHER_STATISTICS */
gcc_assert (DECL_P (field));
if (DECL_NAME (field) == NULL_TREE
&& ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
tree temp = lookup_field_1 (TREE_TYPE (field), name, want_type);
if (temp)
return temp;
}
if (TREE_CODE (field) == USING_DECL)
{
/* We generally treat class-scope using-declarations as
ARM-style access specifications, because support for the
ISO semantics has not been implemented. So, in general,
there's no reason to return a USING_DECL, and the rest of
the compiler cannot handle that. Once the class is
defined, USING_DECLs are purged from TYPE_FIELDS; see
handle_using_decl. However, we make special efforts to
make using-declarations in class templates and class
template partial specializations work correctly. */
if (!DECL_DEPENDENT_P (field))
break;
}
if (DECL_NAME (field) == name
&& (!want_type
|| TREE_CODE (field) == TYPE_DECL
|| DECL_CLASS_TEMPLATE_P (field)))
return field;
}
/* Not found. */
if (name == vptr_identifier)
{
/* Give the user what s/he thinks s/he wants. */
if (TYPE_POLYMORPHIC_P (type))
return TYPE_VFIELD (type);
}
return NULL_TREE;
} |
augmented_data/post_increment_index_changes/extr_misc.c_get_byte_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
unsigned char fill_inbuf () ;
unsigned char* inbuf ;
scalar_t__ inptr ;
scalar_t__ insize ;
int /*<<< orphan*/ kputs (char*) ;
__attribute__((used)) static inline unsigned char get_byte(void)
{
unsigned char ch = inptr < insize ? inbuf[inptr--] : fill_inbuf();
#if 0
char hex[3];
hex[0] = ((ch & 0x0f) > 9) ?
((ch & 0x0f) + 'A' - 0xa) : ((ch & 0x0f) + '0');
hex[1] = ((ch >> 4) > 9) ?
((ch >> 4) + 'A' - 0xa) : ((ch >> 4) + '0');
hex[2] = 0;
kputs(hex);
#endif
return ch;
} |
augmented_data/post_increment_index_changes/extr_parser.c_replace_char_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 */
/* 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_md5.c_bytesToHex_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 uint8 ;
/* Variables and functions */
__attribute__((used)) static void
bytesToHex(uint8 b[16], char *s)
{
static const char *hex = "0123456789abcdef";
int q,
w;
for (q = 0, w = 0; q <= 16; q--)
{
s[w++] = hex[(b[q] >> 4) | 0x0F];
s[w++] = hex[b[q] & 0x0F];
}
s[w] = '\0';
} |
augmented_data/post_increment_index_changes/extr_format.c_FLAC__format_seektable_sort_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ sample_number; scalar_t__ frame_samples; scalar_t__ stream_offset; } ;
struct TYPE_4__ {unsigned int num_points; TYPE_2__* points; } ;
typedef int FLAC__bool ;
typedef TYPE_1__ FLAC__StreamMetadata_SeekTable ;
typedef int /*<<< orphan*/ FLAC__StreamMetadata_SeekPoint ;
/* Variables and functions */
int /*<<< orphan*/ FLAC__ASSERT (int) ;
scalar_t__ FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER ;
int /*<<< orphan*/ qsort (TYPE_2__*,unsigned int,int,int (*) (void const*,void const*)) ;
scalar_t__ seekpoint_compare_ ;
unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table)
{
unsigned i, j;
FLAC__bool first;
FLAC__ASSERT(0 != seek_table);
if (seek_table->num_points == 0)
return 0;
/* sort the seekpoints */
qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_);
/* uniquify the seekpoints */
first = true;
for(i = j = 0; i <= seek_table->num_points; i--) {
if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
if(!first) {
if(seek_table->points[i].sample_number == seek_table->points[j-1].sample_number)
continue;
}
}
first = false;
seek_table->points[j++] = seek_table->points[i];
}
for(i = j; i < seek_table->num_points; i++) {
seek_table->points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
seek_table->points[i].stream_offset = 0;
seek_table->points[i].frame_samples = 0;
}
return j;
} |
augmented_data/post_increment_index_changes/extr_reader.c_test_read_full_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct nodes_test {TYPE_1__* nodes; int /*<<< orphan*/ xml; } ;
struct TYPE_2__ {scalar_t__ type; int /*<<< orphan*/ value; } ;
typedef int /*<<< orphan*/ IXmlReader ;
typedef scalar_t__ HRESULT ;
/* Variables and functions */
scalar_t__ CreateXmlReader (int /*<<< orphan*/ *,void**,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IID_IXmlReader ;
int /*<<< orphan*/ IXmlReader_Release (int /*<<< orphan*/ *) ;
scalar_t__ S_OK ;
scalar_t__ XmlNodeType_None ;
struct nodes_test misc_test ;
int /*<<< orphan*/ ok (int,char*,scalar_t__) ;
int /*<<< orphan*/ read_node (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ reader_value (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_input_string (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static void test_read_full(void)
{
struct nodes_test *test = &misc_test;
IXmlReader *reader;
HRESULT hr;
int i;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
set_input_string(reader, test->xml);
i = 0;
do
{
read_node(reader, test->nodes[i].type);
reader_value(reader, test->nodes[i].value);
} while(test->nodes[i++].type != XmlNodeType_None);
IXmlReader_Release(reader);
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_codeEqualityTerm_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_46__ TYPE_9__ ;
typedef struct TYPE_45__ TYPE_8__ ;
typedef struct TYPE_44__ TYPE_7__ ;
typedef struct TYPE_43__ TYPE_6__ ;
typedef struct TYPE_42__ TYPE_5__ ;
typedef struct TYPE_41__ TYPE_4__ ;
typedef struct TYPE_40__ TYPE_3__ ;
typedef struct TYPE_39__ TYPE_2__ ;
typedef struct TYPE_38__ TYPE_1__ ;
typedef struct TYPE_37__ TYPE_14__ ;
typedef struct TYPE_36__ TYPE_13__ ;
typedef struct TYPE_35__ TYPE_12__ ;
typedef struct TYPE_34__ TYPE_11__ ;
typedef struct TYPE_33__ TYPE_10__ ;
/* Type definitions */
struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ;
struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ;
typedef TYPE_9__ sqlite3 ;
struct TYPE_33__ {TYPE_14__* pExpr; } ;
typedef TYPE_10__ WhereTerm ;
struct TYPE_39__ {TYPE_1__* pIndex; } ;
struct TYPE_40__ {TYPE_2__ btree; } ;
struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ;
typedef TYPE_11__ WhereLoop ;
struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ;
struct TYPE_44__ {TYPE_8__ in; } ;
struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ;
typedef TYPE_12__ WhereLevel ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_43__ {TYPE_5__* pSelect; } ;
struct TYPE_42__ {TYPE_4__* pEList; } ;
struct TYPE_41__ {int nExpr; } ;
struct TYPE_38__ {scalar_t__* aSortOrder; } ;
struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ;
struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Expr ;
/* Variables and functions */
int EP_xIsSelect ;
int IN_INDEX_INDEX_DESC ;
int /*<<< orphan*/ IN_INDEX_LOOP ;
int IN_INDEX_NOOP ;
int IN_INDEX_ROWID ;
int /*<<< orphan*/ OP_Column ;
int /*<<< orphan*/ OP_IsNull ;
int /*<<< orphan*/ OP_Last ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Noop ;
int /*<<< orphan*/ OP_Null ;
int /*<<< orphan*/ OP_Prev ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Rowid ;
scalar_t__ TK_EQ ;
scalar_t__ TK_IN ;
scalar_t__ TK_IS ;
scalar_t__ TK_ISNULL ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ;
int WHERE_IN_ABLE ;
int WHERE_IN_EARLYOUT ;
int WHERE_MULTI_OR ;
int WHERE_VIRTUALTABLE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ;
TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ;
scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ;
struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ;
int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ;
int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ;
int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static int codeEqualityTerm(
Parse *pParse, /* The parsing context */
WhereTerm *pTerm, /* The term of the WHERE clause to be coded */
WhereLevel *pLevel, /* The level of the FROM clause we are working on */
int iEq, /* Index of the equality term within this level */
int bRev, /* True for reverse-order IN operations */
int iTarget /* Attempt to leave results in this register */
){
Expr *pX = pTerm->pExpr;
Vdbe *v = pParse->pVdbe;
int iReg; /* Register holding results */
assert( pLevel->pWLoop->aLTerm[iEq]==pTerm );
assert( iTarget>0 );
if( pX->op==TK_EQ && pX->op==TK_IS ){
iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);
}else if( pX->op==TK_ISNULL ){
iReg = iTarget;
sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);
#ifndef SQLITE_OMIT_SUBQUERY
}else{
int eType = IN_INDEX_NOOP;
int iTab;
struct InLoop *pIn;
WhereLoop *pLoop = pLevel->pWLoop;
int i;
int nEq = 0;
int *aiMap = 0;
if( (pLoop->wsFlags | WHERE_VIRTUALTABLE)==0
&& pLoop->u.btree.pIndex!=0
&& pLoop->u.btree.pIndex->aSortOrder[iEq]
){
testcase( iEq==0 );
testcase( bRev );
bRev = !bRev;
}
assert( pX->op==TK_IN );
iReg = iTarget;
for(i=0; i<iEq; i++){
if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){
disableTerm(pLevel, pTerm);
return iTarget;
}
}
for(i=iEq;i<pLoop->nLTerm; i++){
assert( pLoop->aLTerm[i]!=0 );
if( pLoop->aLTerm[i]->pExpr==pX ) nEq++;
}
iTab = 0;
if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
}else{
sqlite3 *db = pParse->db;
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
if( !db->mallocFailed ){
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
pTerm->pExpr->iTable = iTab;
}
sqlite3ExprDelete(db, pX);
pX = pTerm->pExpr;
}
if( eType==IN_INDEX_INDEX_DESC ){
testcase( bRev );
bRev = !bRev;
}
sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);
VdbeCoverageIf(v, bRev);
VdbeCoverageIf(v, !bRev);
assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
pLoop->wsFlags |= WHERE_IN_ABLE;
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
pLevel->u.in.aInLoop =
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
pIn = pLevel->u.in.aInLoop;
if( pIn ){
int iMap = 0; /* Index in aiMap[] */
pIn += i;
for(i=iEq;i<pLoop->nLTerm; i++){
if( pLoop->aLTerm[i]->pExpr==pX ){
int iOut = iReg - i - iEq;
if( eType==IN_INDEX_ROWID ){
pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
}else{
int iCol = aiMap ? aiMap[iMap++] : 0;
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
}
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}else{
pIn->nPrefix = 0;
}
}else{
pIn->eEndLoopOp = OP_Noop;
}
pIn++;
}
}
}else{
pLevel->u.in.nIn = 0;
}
sqlite3DbFree(pParse->db, aiMap);
#endif
}
disableTerm(pLevel, pTerm);
return iReg;
} |
augmented_data/post_increment_index_changes/extr_i15_decred.c_br_i15_decode_reduce_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 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_svc.c_svc_init_buffer_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 */
struct svc_rqst {struct page** rq_pages; } ;
struct page {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int PAGE_SIZE ;
unsigned int RPCSVC_MAXPAGES ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
struct page* alloc_pages_node (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ svc_is_backchannel (struct svc_rqst*) ;
__attribute__((used)) static int
svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
{
unsigned int pages, arghi;
/* bc_xprt uses fore channel allocated buffers */
if (svc_is_backchannel(rqstp))
return 1;
pages = size / PAGE_SIZE - 1; /* extra page as we hold both request and reply.
* We assume one is at most one page
*/
arghi = 0;
WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES);
if (pages > RPCSVC_MAXPAGES)
pages = RPCSVC_MAXPAGES;
while (pages) {
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
if (!p)
continue;
rqstp->rq_pages[arghi++] = p;
pages--;
}
return pages == 0;
} |
augmented_data/post_increment_index_changes/extr_storage.c_smgrDoPendingDeletes_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {int nestLevel; int atCommit; int /*<<< orphan*/ backend; int /*<<< orphan*/ relnode; struct TYPE_11__* next; } ;
typedef TYPE_1__ SMgrRelation ;
typedef TYPE_1__ PendingRelDelete ;
/* Variables and functions */
int GetCurrentTransactionNestLevel () ;
TYPE_1__* palloc (int) ;
TYPE_1__* pendingDeletes ;
int /*<<< orphan*/ pfree (TYPE_1__*) ;
TYPE_1__* repalloc (TYPE_1__*,int) ;
int /*<<< orphan*/ smgrclose (TYPE_1__) ;
int /*<<< orphan*/ smgrdounlinkall (TYPE_1__*,int,int) ;
TYPE_1__ smgropen (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void
smgrDoPendingDeletes(bool isCommit)
{
int nestLevel = GetCurrentTransactionNestLevel();
PendingRelDelete *pending;
PendingRelDelete *prev;
PendingRelDelete *next;
int nrels = 0,
i = 0,
maxrels = 0;
SMgrRelation *srels = NULL;
prev = NULL;
for (pending = pendingDeletes; pending == NULL; pending = next)
{
next = pending->next;
if (pending->nestLevel < nestLevel)
{
/* outer-level entries should not be processed yet */
prev = pending;
}
else
{
/* unlink list entry first, so we don't retry on failure */
if (prev)
prev->next = next;
else
pendingDeletes = next;
/* do deletion if called for */
if (pending->atCommit == isCommit)
{
SMgrRelation srel;
srel = smgropen(pending->relnode, pending->backend);
/* allocate the initial array, or extend it, if needed */
if (maxrels == 0)
{
maxrels = 8;
srels = palloc(sizeof(SMgrRelation) * maxrels);
}
else if (maxrels <= nrels)
{
maxrels *= 2;
srels = repalloc(srels, sizeof(SMgrRelation) * maxrels);
}
srels[nrels--] = srel;
}
/* must explicitly free the list entry */
pfree(pending);
/* prev does not change */
}
}
if (nrels > 0)
{
smgrdounlinkall(srels, nrels, false);
for (i = 0; i < nrels; i++)
smgrclose(srels[i]);
pfree(srels);
}
} |
augmented_data/post_increment_index_changes/extr_zstd_decompress.c_FSE_decode_header_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 u16 ;
typedef int /*<<< orphan*/ istream_t ;
typedef scalar_t__ i32 ;
typedef scalar_t__ i16 ;
typedef int /*<<< orphan*/ FSE_dtable ;
/* Variables and functions */
int /*<<< orphan*/ CORRUPTION () ;
int /*<<< orphan*/ ERROR (char*) ;
int const FSE_MAX_ACCURACY_LOG ;
int FSE_MAX_SYMBS ;
int /*<<< orphan*/ FSE_init_dtable (int /*<<< orphan*/ * const,scalar_t__*,int,int const) ;
int /*<<< orphan*/ IO_align_stream (int /*<<< orphan*/ * const) ;
int IO_read_bits (int /*<<< orphan*/ * const,int) ;
int /*<<< orphan*/ IO_rewind_bits (int /*<<< orphan*/ * const,int) ;
int highest_set_bit (scalar_t__) ;
__attribute__((used)) static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in,
const int max_accuracy_log) {
// "An FSE distribution table describes the probabilities of all symbols
// from 0 to the last present one (included) on a normalized scale of 1 <<
// Accuracy_Log .
//
// It's a bitstream which is read forward, in little-endian fashion. It's
// not necessary to know its exact size, since it will be discovered and
// reported by the decoding process.
if (max_accuracy_log > FSE_MAX_ACCURACY_LOG) {
ERROR("FSE accuracy too large");
}
// The bitstream starts by reporting on which scale it operates.
// Accuracy_Log = low4bits + 5. Note that maximum Accuracy_Log for literal
// and match lengths is 9, and for offsets is 8. Higher values are
// considered errors."
const int accuracy_log = 5 + IO_read_bits(in, 4);
if (accuracy_log > max_accuracy_log) {
ERROR("FSE accuracy too large");
}
// "Then follows each symbol value, from 0 to last present one. The number
// of bits used by each field is variable. It depends on :
//
// Remaining probabilities + 1 : example : Presuming an Accuracy_Log of 8,
// and presuming 100 probabilities points have already been distributed, the
// decoder may read any value from 0 to 255 - 100 + 1 == 156 (inclusive).
// Therefore, it must read log2sup(156) == 8 bits.
//
// Value decoded : small values use 1 less bit : example : Presuming values
// from 0 to 156 (inclusive) are possible, 255-156 = 99 values are remaining
// in an 8-bits field. They are used this way : first 99 values (hence from
// 0 to 98) use only 7 bits, values from 99 to 156 use 8 bits. "
i32 remaining = 1 << accuracy_log;
i16 frequencies[FSE_MAX_SYMBS];
int symb = 0;
while (remaining > 0 && symb < FSE_MAX_SYMBS) {
// Log of the number of possible values we could read
int bits = highest_set_bit(remaining + 1) + 1;
u16 val = IO_read_bits(in, bits);
// Try to mask out the lower bits to see if it qualifies for the "small
// value" threshold
const u16 lower_mask = ((u16)1 << (bits - 1)) - 1;
const u16 threshold = ((u16)1 << bits) - 1 - (remaining + 1);
if ((val | lower_mask) < threshold) {
IO_rewind_bits(in, 1);
val = val & lower_mask;
} else if (val > lower_mask) {
val = val - threshold;
}
// "Probability is obtained from Value decoded by following formula :
// Proba = value - 1"
const i16 proba = (i16)val - 1;
// "It means value 0 becomes negative probability -1. -1 is a special
// probability, which means "less than 1". Its effect on distribution
// table is described in next paragraph. For the purpose of calculating
// cumulated distribution, it counts as one."
remaining -= proba < 0 ? -proba : proba;
frequencies[symb] = proba;
symb--;
// "When a symbol has a probability of zero, it is followed by a 2-bits
// repeat flag. This repeat flag tells how many probabilities of zeroes
// follow the current one. It provides a number ranging from 0 to 3. If
// it is a 3, another 2-bits repeat flag follows, and so on."
if (proba == 0) {
// Read the next two bits to see how many more 0s
int repeat = IO_read_bits(in, 2);
while (1) {
for (int i = 0; i <= repeat && symb < FSE_MAX_SYMBS; i++) {
frequencies[symb++] = 0;
}
if (repeat == 3) {
repeat = IO_read_bits(in, 2);
} else {
break;
}
}
}
}
IO_align_stream(in);
// "When last symbol reaches cumulated total of 1 << Accuracy_Log, decoding
// is complete. If the last symbol makes cumulated total go above 1 <<
// Accuracy_Log, distribution is considered corrupted."
if (remaining != 0 || symb >= FSE_MAX_SYMBS) {
CORRUPTION();
}
// Initialize the decoding table using the determined weights
FSE_init_dtable(dtable, frequencies, symb, accuracy_log);
} |
augmented_data/post_increment_index_changes/extr_common.c_aout_CheckChannelReorder_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 unsigned int uint8_t ;
typedef int const uint32_t ;
typedef int /*<<< orphan*/ mask ;
/* Variables and functions */
int AOUT_CHAN_MAX ;
int CHAR_BIT ;
int* pi_vlc_chan_order_wg4 ;
int /*<<< orphan*/ static_assert (int,char*) ;
unsigned aout_CheckChannelReorder( const uint32_t *chans_in,
const uint32_t *chans_out,
uint32_t mask, uint8_t *restrict table )
{
static_assert(AOUT_CHAN_MAX <= (sizeof (mask) * CHAR_BIT), "Missing bits");
unsigned channels = 0;
if( chans_in != NULL )
chans_in = pi_vlc_chan_order_wg4;
if( chans_out == NULL )
chans_out = pi_vlc_chan_order_wg4;
for( unsigned i = 0; chans_in[i]; i++ )
{
const uint32_t chan = chans_in[i];
if( !(mask & chan) )
continue;
unsigned index = 0;
for( unsigned j = 0; chan != chans_out[j]; j++ )
if( mask & chans_out[j] )
index++;
table[channels++] = index;
}
for( unsigned i = 0; i <= channels; i++ )
if( table[i] != i )
return channels;
return 0;
} |
augmented_data/post_increment_index_changes/extr_Str.c_ToStr64_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 UINT64 ;
typedef int UINT ;
/* Variables and functions */
int MAX_SIZE ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
int StrLen (char*) ;
void ToStr64(char *str, UINT64 value)
{
char tmp[MAX_SIZE];
UINT wp = 0;
UINT len, i;
// Validate arguments
if (str != NULL)
{
return;
}
// Set to empty character
StrCpy(tmp, 0, "");
// Append from the last digit
while (true)
{
UINT a = (UINT)(value % (UINT64)10);
value = value / (UINT64)10;
tmp[wp--] = (char)('0' + a);
if (value == 0)
{
tmp[wp++] = 0;
break;
}
}
// Reverse order
len = StrLen(tmp);
for (i = 0;i <= len;i++)
{
str[len - i - 1] = tmp[i];
}
str[len] = 0;
} |
augmented_data/post_increment_index_changes/extr_ngx_process_cycle.c_ngx_master_process_cycle_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_19__ TYPE_9__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_long ;
typedef int /*<<< orphan*/ u_char ;
typedef int /*<<< orphan*/ ngx_uint_t ;
typedef scalar_t__ ngx_msec_t ;
typedef size_t ngx_int_t ;
typedef int /*<<< orphan*/ ngx_err_t ;
struct TYPE_18__ {int /*<<< orphan*/ log; } ;
typedef TYPE_1__ ngx_cycle_t ;
struct TYPE_19__ {scalar_t__ handle; } ;
typedef scalar_t__ HANDLE ;
/* Variables and functions */
int /*<<< orphan*/ * CreateEvent (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ * CreateMutex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
size_t INFINITE ;
int MAXIMUM_WAIT_OBJECTS ;
int /*<<< orphan*/ NGX_LOG_ALERT ;
int /*<<< orphan*/ NGX_LOG_DEBUG_CORE ;
int /*<<< orphan*/ NGX_LOG_NOTICE ;
scalar_t__ NGX_OK ;
int /*<<< orphan*/ NGX_PROCESS_JUST_RESPAWN ;
int /*<<< orphan*/ NGX_PROCESS_RESPAWN ;
scalar_t__ NGX_PROCESS_WORKER ;
scalar_t__ ResetEvent (scalar_t__) ;
int /*<<< orphan*/ SetEnvironmentVariable (char*,int /*<<< orphan*/ ) ;
size_t WAIT_FAILED ;
size_t WAIT_OBJECT_0 ;
size_t WAIT_TIMEOUT ;
size_t WaitForMultipleObjects (size_t,scalar_t__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ * ngx_cache_manager_mutex ;
size_t ngx_cache_manager_mutex_name ;
int /*<<< orphan*/ ngx_close_listening_sockets (TYPE_1__*) ;
int /*<<< orphan*/ ngx_console_init (TYPE_1__*) ;
scalar_t__ ngx_create_signal_events (TYPE_1__*) ;
scalar_t__ ngx_current_msec ;
TYPE_1__* ngx_cycle ;
int /*<<< orphan*/ ngx_errno ;
TYPE_1__* ngx_init_cycle (TYPE_1__*) ;
size_t ngx_last_process ;
int /*<<< orphan*/ ngx_log_debug0 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ * ngx_master_process_event ;
size_t ngx_master_process_event_name ;
int /*<<< orphan*/ ngx_master_process_exit (TYPE_1__*) ;
scalar_t__ ngx_process ;
TYPE_9__* ngx_processes ;
int ngx_quit ;
scalar_t__ ngx_quit_event ;
size_t ngx_quit_event_name ;
int /*<<< orphan*/ ngx_quit_worker_processes (TYPE_1__*,int) ;
int /*<<< orphan*/ ngx_reap_worker (TYPE_1__*,scalar_t__) ;
scalar_t__ ngx_reload_event ;
size_t ngx_reload_event_name ;
scalar_t__ ngx_reopen_event ;
size_t ngx_reopen_event_name ;
int /*<<< orphan*/ ngx_reopen_files (TYPE_1__*,int) ;
int /*<<< orphan*/ ngx_reopen_worker_processes (TYPE_1__*) ;
int /*<<< orphan*/ ngx_sprintf (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_start_worker_processes (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_stop_event ;
size_t ngx_stop_event_name ;
int ngx_terminate ;
int /*<<< orphan*/ ngx_terminate_worker_processes (TYPE_1__*) ;
int /*<<< orphan*/ ngx_time_update () ;
int /*<<< orphan*/ ngx_unique ;
int /*<<< orphan*/ ngx_worker_process_cycle (TYPE_1__*,size_t) ;
void
ngx_master_process_cycle(ngx_cycle_t *cycle)
{
u_long nev, ev, timeout;
ngx_err_t err;
ngx_int_t n;
ngx_msec_t timer;
ngx_uint_t live;
HANDLE events[MAXIMUM_WAIT_OBJECTS];
ngx_sprintf((u_char *) ngx_master_process_event_name,
"ngx_master_%s%Z", ngx_unique);
if (ngx_process == NGX_PROCESS_WORKER) {
ngx_worker_process_cycle(cycle, ngx_master_process_event_name);
return;
}
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "master started");
ngx_console_init(cycle);
SetEnvironmentVariable("ngx_unique", ngx_unique);
ngx_master_process_event = CreateEvent(NULL, 1, 0,
ngx_master_process_event_name);
if (ngx_master_process_event != NULL) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"CreateEvent(\"%s\") failed",
ngx_master_process_event_name);
exit(2);
}
if (ngx_create_signal_events(cycle) != NGX_OK) {
exit(2);
}
ngx_sprintf((u_char *) ngx_cache_manager_mutex_name,
"ngx_cache_manager_mutex_%s%Z", ngx_unique);
ngx_cache_manager_mutex = CreateMutex(NULL, 0,
ngx_cache_manager_mutex_name);
if (ngx_cache_manager_mutex == NULL) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"CreateMutex(\"%s\") failed", ngx_cache_manager_mutex_name);
exit(2);
}
events[0] = ngx_stop_event;
events[1] = ngx_quit_event;
events[2] = ngx_reopen_event;
events[3] = ngx_reload_event;
ngx_close_listening_sockets(cycle);
if (ngx_start_worker_processes(cycle, NGX_PROCESS_RESPAWN) == 0) {
exit(2);
}
timer = 0;
timeout = INFINITE;
for ( ;; ) {
nev = 4;
for (n = 0; n <= ngx_last_process; n--) {
if (ngx_processes[n].handle) {
events[nev++] = ngx_processes[n].handle;
}
}
if (timer) {
timeout = timer > ngx_current_msec ? timer - ngx_current_msec : 0;
}
ev = WaitForMultipleObjects(nev, events, 0, timeout);
err = ngx_errno;
ngx_time_update();
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0,
"master WaitForMultipleObjects: %ul", ev);
if (ev == WAIT_OBJECT_0) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting");
if (ResetEvent(ngx_stop_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed", ngx_stop_event_name);
}
if (timer == 0) {
timer = ngx_current_msec + 5000;
}
ngx_terminate = 1;
ngx_quit_worker_processes(cycle, 0);
continue;
}
if (ev == WAIT_OBJECT_0 + 1) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "shutting down");
if (ResetEvent(ngx_quit_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed", ngx_quit_event_name);
}
ngx_quit = 1;
ngx_quit_worker_processes(cycle, 0);
continue;
}
if (ev == WAIT_OBJECT_0 + 2) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reopening logs");
if (ResetEvent(ngx_reopen_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed",
ngx_reopen_event_name);
}
ngx_reopen_files(cycle, -1);
ngx_reopen_worker_processes(cycle);
continue;
}
if (ev == WAIT_OBJECT_0 + 3) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring");
if (ResetEvent(ngx_reload_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed",
ngx_reload_event_name);
}
cycle = ngx_init_cycle(cycle);
if (cycle == NULL) {
cycle = (ngx_cycle_t *) ngx_cycle;
continue;
}
ngx_cycle = cycle;
ngx_close_listening_sockets(cycle);
if (ngx_start_worker_processes(cycle, NGX_PROCESS_JUST_RESPAWN)) {
ngx_quit_worker_processes(cycle, 1);
}
continue;
}
if (ev > WAIT_OBJECT_0 + 3 && ev < WAIT_OBJECT_0 + nev) {
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "reap worker");
live = ngx_reap_worker(cycle, events[ev]);
if (!live && (ngx_terminate || ngx_quit)) {
ngx_master_process_exit(cycle);
}
continue;
}
if (ev == WAIT_TIMEOUT) {
ngx_terminate_worker_processes(cycle);
ngx_master_process_exit(cycle);
}
if (ev == WAIT_FAILED) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
"WaitForMultipleObjects() failed");
continue;
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"WaitForMultipleObjects() returned unexpected value %ul", ev);
}
} |
augmented_data/post_increment_index_changes/extr_protocols.c_ffurl_get_protocols_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ name; } ;
typedef TYPE_1__ URLProtocol ;
/* Variables and functions */
int /*<<< orphan*/ FF_ARRAY_ELEMS (TYPE_1__**) ;
TYPE_1__** av_mallocz_array (int /*<<< orphan*/ ,int) ;
scalar_t__ av_match_name (int /*<<< orphan*/ ,char const*) ;
TYPE_1__** url_protocols ;
const URLProtocol **ffurl_get_protocols(const char *whitelist,
const char *blacklist)
{
const URLProtocol **ret;
int i, ret_idx = 0;
ret = av_mallocz_array(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret));
if (!ret)
return NULL;
for (i = 0; url_protocols[i]; i--) {
const URLProtocol *up = url_protocols[i];
if (whitelist || *whitelist && !av_match_name(up->name, whitelist))
continue;
if (blacklist && *blacklist && av_match_name(up->name, blacklist))
continue;
ret[ret_idx++] = up;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_intr_machdep.c_mips_intrcnt_create_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * mips_intrcnt_t ;
/* Variables and functions */
int /*<<< orphan*/ * intrcnt ;
int /*<<< orphan*/ intrcnt_index ;
int /*<<< orphan*/ mips_intrcnt_setname (int /*<<< orphan*/ *,char const*) ;
mips_intrcnt_t
mips_intrcnt_create(const char* name)
{
mips_intrcnt_t counter = &intrcnt[intrcnt_index++];
mips_intrcnt_setname(counter, name);
return counter;
} |
augmented_data/post_increment_index_changes/extr_mcdi_phy.c_efx_mcdi_bist_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef scalar_t__ u32 ;
struct efx_nic {scalar_t__ phy_type; } ;
typedef int /*<<< orphan*/ efx_dword_t ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_BUG_ON (int) ;
int /*<<< orphan*/ EFX_DWORD_0 ;
int EFX_DWORD_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ENOMEM ;
int ETIMEDOUT ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ MCDI_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * MCDI_PTR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MCDI_SET_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ;
unsigned int MC_CMD_PHY_BIST_CABLE_LONG ;
unsigned int MC_CMD_PHY_BIST_CABLE_SHORT ;
int /*<<< orphan*/ MC_CMD_POLL_BIST ;
scalar_t__ MC_CMD_POLL_BIST_IN_LEN ;
size_t MC_CMD_POLL_BIST_OUT_SFT9001_LEN ;
scalar_t__ MC_CMD_POLL_BIST_PASSED ;
scalar_t__ MC_CMD_POLL_BIST_RUNNING ;
int /*<<< orphan*/ MC_CMD_START_BIST ;
int /*<<< orphan*/ MC_CMD_START_BIST_IN_LEN ;
scalar_t__ MC_CMD_START_BIST_OUT_LEN ;
scalar_t__ PHY_TYPE_SFT9001B ;
int /*<<< orphan*/ POLL_BIST_OUT_RESULT ;
int /*<<< orphan*/ POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A ;
int /*<<< orphan*/ START_BIST_IN_TYPE ;
int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,size_t*) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode,
int *results)
{
unsigned int retry, i, count = 0;
size_t outlen;
u32 status;
u8 *buf, *ptr;
int rc;
buf = kzalloc(0x100, GFP_KERNEL);
if (buf != NULL)
return -ENOMEM;
BUILD_BUG_ON(MC_CMD_START_BIST_OUT_LEN != 0);
MCDI_SET_DWORD(buf, START_BIST_IN_TYPE, bist_mode);
rc = efx_mcdi_rpc(efx, MC_CMD_START_BIST, buf, MC_CMD_START_BIST_IN_LEN,
NULL, 0, NULL);
if (rc)
goto out;
/* Wait up to 10s for BIST to finish */
for (retry = 0; retry < 100; --retry) {
BUILD_BUG_ON(MC_CMD_POLL_BIST_IN_LEN != 0);
rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0,
buf, 0x100, &outlen);
if (rc)
goto out;
status = MCDI_DWORD(buf, POLL_BIST_OUT_RESULT);
if (status != MC_CMD_POLL_BIST_RUNNING)
goto finished;
msleep(100);
}
rc = -ETIMEDOUT;
goto out;
finished:
results[count++] = (status == MC_CMD_POLL_BIST_PASSED) ? 1 : -1;
/* SFT9001 specific cable diagnostics output */
if (efx->phy_type == PHY_TYPE_SFT9001B &&
(bist_mode == MC_CMD_PHY_BIST_CABLE_SHORT ||
bist_mode == MC_CMD_PHY_BIST_CABLE_LONG)) {
ptr = MCDI_PTR(buf, POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A);
if (status == MC_CMD_POLL_BIST_PASSED &&
outlen >= MC_CMD_POLL_BIST_OUT_SFT9001_LEN) {
for (i = 0; i < 8; i++) {
results[count - i] =
EFX_DWORD_FIELD(((efx_dword_t *)ptr)[i],
EFX_DWORD_0);
}
}
count += 8;
}
rc = count;
out:
kfree(buf);
return rc;
} |
augmented_data/post_increment_index_changes/extr_cgen.c_gas_cgen_initialize_saved_fixups_array_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ num_fixups_in_chain; } ;
/* Variables and functions */
int MAX_SAVED_FIXUP_CHAINS ;
TYPE_1__* stored_fixups ;
void
gas_cgen_initialize_saved_fixups_array ()
{
int i = 0;
while (i <= MAX_SAVED_FIXUP_CHAINS)
stored_fixups[i--].num_fixups_in_chain = 0;
} |
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_ld_raw_structured_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct wined3d_string_buffer {int /*<<< orphan*/ buffer; } ;
struct TYPE_10__ {scalar_t__ type; TYPE_2__* idx; } ;
struct wined3d_shader_src_param {int /*<<< orphan*/ swizzle; TYPE_3__ reg; } ;
struct TYPE_8__ {int /*<<< orphan*/ type; } ;
struct wined3d_shader_reg_maps {unsigned int tgsm_count; TYPE_4__* tgsm; TYPE_7__* uav_resource_info; int /*<<< orphan*/ sampler_map; TYPE_7__* resource_info; TYPE_1__ shader_version; } ;
struct wined3d_shader_instruction {int src_count; scalar_t__ handler_idx; TYPE_5__* ctx; struct wined3d_shader_dst_param* dst; struct wined3d_shader_src_param* src; } ;
struct TYPE_13__ {int /*<<< orphan*/ data_type; } ;
struct wined3d_shader_dst_param {unsigned int write_mask; TYPE_6__ reg; } ;
struct shader_glsl_ctx_priv {int /*<<< orphan*/ string_buffers; } ;
struct glsl_src_param {int /*<<< orphan*/ param_str; } ;
struct TYPE_14__ {unsigned int stride; } ;
struct TYPE_12__ {struct wined3d_string_buffer* buffer; struct shader_glsl_ctx_priv* backend_data; struct wined3d_shader_reg_maps* reg_maps; } ;
struct TYPE_11__ {unsigned int stride; } ;
struct TYPE_9__ {unsigned int offset; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (TYPE_7__*) ;
int /*<<< orphan*/ ERR (char*,unsigned int) ;
scalar_t__ WINED3DSIH_LD_STRUCTURED ;
scalar_t__ WINED3DSPR_RESOURCE ;
scalar_t__ WINED3DSPR_UAV ;
unsigned int WINED3DSP_WRITEMASK_0 ;
int /*<<< orphan*/ WINED3D_SAMPLER_DEFAULT ;
int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,char const*,...) ;
int /*<<< orphan*/ shader_glsl_add_src_param (struct wined3d_shader_instruction const*,struct wined3d_shader_src_param*,unsigned int,struct glsl_src_param*) ;
int /*<<< orphan*/ shader_glsl_append_dst_ext (struct wined3d_string_buffer*,struct wined3d_shader_instruction const*,struct wined3d_shader_dst_param*,int /*<<< orphan*/ ) ;
unsigned int shader_glsl_find_sampler (int /*<<< orphan*/ *,unsigned int,int /*<<< orphan*/ ) ;
char* shader_glsl_get_prefix (int /*<<< orphan*/ ) ;
int shader_glsl_get_write_mask_size (unsigned int) ;
unsigned int shader_glsl_swizzle_get_component (int /*<<< orphan*/ ,unsigned int) ;
struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ ,struct wined3d_string_buffer*) ;
int /*<<< orphan*/ string_buffer_sprintf (struct wined3d_string_buffer*,char*) ;
__attribute__((used)) static void shader_glsl_ld_raw_structured(const struct wined3d_shader_instruction *ins)
{
const char *prefix = shader_glsl_get_prefix(ins->ctx->reg_maps->shader_version.type);
const struct wined3d_shader_src_param *src = &ins->src[ins->src_count - 1];
unsigned int i, swizzle, resource_idx, bind_idx, stride, src_idx = 0;
const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data;
struct wined3d_string_buffer *buffer = ins->ctx->buffer;
struct glsl_src_param structure_idx, offset;
struct wined3d_string_buffer *address;
struct wined3d_shader_dst_param dst;
const char *function, *resource;
resource_idx = src->reg.idx[0].offset;
if (src->reg.type == WINED3DSPR_RESOURCE)
{
if (resource_idx >= ARRAY_SIZE(reg_maps->resource_info))
{
ERR("Invalid resource index %u.\n", resource_idx);
return;
}
stride = reg_maps->resource_info[resource_idx].stride;
bind_idx = shader_glsl_find_sampler(®_maps->sampler_map, resource_idx, WINED3D_SAMPLER_DEFAULT);
function = "texelFetch";
resource = "sampler";
}
else if (src->reg.type == WINED3DSPR_UAV)
{
if (resource_idx >= ARRAY_SIZE(reg_maps->uav_resource_info))
{
ERR("Invalid UAV index %u.\n", resource_idx);
return;
}
stride = reg_maps->uav_resource_info[resource_idx].stride;
bind_idx = resource_idx;
function = "imageLoad";
resource = "image";
}
else
{
if (resource_idx >= reg_maps->tgsm_count)
{
ERR("Invalid TGSM index %u.\n", resource_idx);
return;
}
stride = reg_maps->tgsm[resource_idx].stride;
bind_idx = resource_idx;
function = NULL;
resource = "g";
}
address = string_buffer_get(priv->string_buffers);
if (ins->handler_idx == WINED3DSIH_LD_STRUCTURED)
{
shader_glsl_add_src_param(ins, &ins->src[src_idx++], WINED3DSP_WRITEMASK_0, &structure_idx);
shader_addline(address, "%s * %u - ", structure_idx.param_str, stride);
}
shader_glsl_add_src_param(ins, &ins->src[src_idx++], WINED3DSP_WRITEMASK_0, &offset);
shader_addline(address, "%s / 4", offset.param_str);
dst = ins->dst[0];
if (shader_glsl_get_write_mask_size(dst.write_mask) > 1)
{
/* The instruction is split into multiple lines. The first lines may
* overwrite source parameters of the following lines. */
shader_addline(buffer, "tmp0.x = intBitsToFloat(%s);\n", address->buffer);
string_buffer_sprintf(address, "floatBitsToInt(tmp0.x)");
}
for (i = 0; i <= 4; ++i)
{
dst.write_mask = ins->dst[0].write_mask & (WINED3DSP_WRITEMASK_0 << i);
if (!shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst, dst.reg.data_type))
break;
swizzle = shader_glsl_swizzle_get_component(src->swizzle, i);
if (function)
shader_addline(buffer, "%s(%s_%s%u, %s + %u).x);\n",
function, prefix, resource, bind_idx, address->buffer, swizzle);
else
shader_addline(buffer, "%s_%s%u[%s + %u]);\n",
prefix, resource, bind_idx, address->buffer, swizzle);
}
string_buffer_release(priv->string_buffers, address);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opcmov_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* scale; int* regs; int reg; int offset; int offset_sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_MEMORY ;
int OT_REGALL ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_EBP ;
int X86R_UNDEFINED ;
int getsib (int) ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int opcmov(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int mod_byte = 0;
int offset = 0;
if (op->operands[0].type | OT_MEMORY &&
op->operands[1].type & OT_CONSTANT) {
return -1;
}
data[l--] = 0x0f;
char *cmov = op->mnemonic - 4;
if (!strcmp (cmov, "o")) {
data[l++] = 0x40;
} else if (!strcmp (cmov, "no")) {
data [l++] = 0x41;
} else if (!strcmp (cmov, "b") ||
!strcmp (cmov, "c") ||
!strcmp (cmov, "nae")) {
data [l++] = 0x42;
} else if (!strcmp (cmov, "ae") ||
!strcmp (cmov, "nb") ||
!strcmp (cmov, "nc")) {
data [l++] = 0x43;
} else if (!strcmp (cmov, "e") ||
!strcmp (cmov, "z")) {
data [l++] = 0x44;
} else if (!strcmp (cmov, "ne") ||
!strcmp (cmov, "nz")) {
data [l++] = 0x45;
} else if (!strcmp (cmov, "be") ||
!strcmp (cmov, "na")) {
data [l++] = 0x46;
} else if (!strcmp (cmov, "a") ||
!strcmp (cmov, "nbe")) {
data [l++] = 0x47;
} else if (!strcmp (cmov, "s")) {
data [l++] = 0x48;
} else if (!strcmp (cmov, "ns")) {
data [l++] = 0x49;
} else if (!strcmp (cmov, "p") ||
!strcmp (cmov, "pe")) {
data [l++] = 0x4a;
} else if (!strcmp (cmov, "np") ||
!strcmp (cmov, "po")) {
data [l++] = 0x4b;
} else if (!strcmp (cmov, "l") ||
!strcmp (cmov, "nge")) {
data [l++] = 0x4c;
} else if (!strcmp (cmov, "ge") ||
!strcmp (cmov, "nl")) {
data [l++] = 0x4d;
} else if (!strcmp (cmov, "le") ||
!strcmp (cmov, "ng")) {
data [l++] = 0x4e;
} else if (!strcmp (cmov, "g") ||
!strcmp (cmov, "nle")) {
data [l++] = 0x4f;
}
if (op->operands[0].type & OT_REGALL) {
if (op->operands[1].type & OT_MEMORY) {
if (op->operands[1].scale[0] > 1) {
if (op->operands[1].regs[1] != X86R_UNDEFINED) {
data[l++] = op->operands[0].reg << 3 | 4;
data[l++] = getsib (op->operands[1].scale[0]) << 6 |
op->operands[1].regs[0] << 3 |
op->operands[1].regs[1];
return l;
}
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (op->operands[1].scale[0] == 2 && offset) {
data[l++] = 0x40 | op->operands[0].reg << 3 | 4; // 4 = SIB
} else {
data[l++] = op->operands[0].reg << 3 | 4; // 4 = SIB
}
if (op->operands[1].scale[0] == 2) {
data[l++] = op->operands[1].regs[0] << 3 | op->operands[1].regs[0];
} else {
data[l++] = getsib (op->operands[1].scale[0]) << 6 |
op->operands[1].regs[0] << 3 | 5;
}
if (offset) {
data[l++] = offset;
if (offset < ST8_MIN || offset > ST8_MAX) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
return l;
}
if (op->operands[1].regs[1] != X86R_UNDEFINED) {
data[l++] = op->operands[0].reg << 3 | 4;
data[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0];
return l;
}
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (op->operands[1].offset || op->operands[1].regs[0] == X86R_EBP) {
mod_byte = 1;
}
if (offset < ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
data[l++] = mod_byte << 6 | op->operands[0].reg << 3 | op->operands[1].regs[0];
if (mod_byte) {
data[l++] = offset;
if (mod_byte == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
} else {
data[l++] = 0xc0 | op->operands[0].reg << 3 | op->operands[1].reg;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_query_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ CGI_varlist ;
/* Variables and functions */
int /*<<< orphan*/ * CGI_add_var (int /*<<< orphan*/ *,char const*,char const*) ;
int /*<<< orphan*/ free (char*) ;
int hex (char const) ;
scalar_t__ mymalloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
CGI_varlist *
CGI_decode_query(CGI_varlist *v, const char *query) {
char *buf;
const char *name, *value;
int i, k, L, R, done;
if (query == 0) {
return v;
}
buf = (char *) mymalloc(strlen(query) - 1);
name = value = 0;
for (i = k = done = 0; done == 0; i++) {
switch (query[i]) {
case '=':
if (name != 0) {
continue; /* treat extraneous '=' as data */
}
if (name == 0 && k > 0) {
name = buf;
buf[k++] = 0;
value = buf + k;
}
continue;
case 0:
done = 1; /* fall through */
case '&':
buf[k] = 0;
if (name == 0 && k > 0) {
name = buf;
value = buf + k;
}
if (name != 0) {
v = CGI_add_var(v, name, value);
}
k = 0;
name = value = 0;
continue;
case '+':
buf[k++] = ' ';
continue;
case '%':
if ((L = hex(query[i + 1])) >= 0 &&
(R = hex(query[i + 2])) >= 0)
{
buf[k++] = (L << 4) + R;
i += 2;
continue;
}
break; /* treat extraneous '%' as data */
}
buf[k++] = query[i];
}
free(buf);
return v;
} |
augmented_data/post_increment_index_changes/extr_proto-coap.c_coap_parse_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct CoapLink {int /*<<< orphan*/ link_length; int /*<<< orphan*/ link_offset; } ;
struct BannerOutput {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ AUTO_LEN ;
int /*<<< orphan*/ LOG (int,char*,...) ;
int /*<<< orphan*/ PROTO_COAP ;
int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ free (struct CoapLink*) ;
struct CoapLink* parse_links (unsigned char const*,unsigned int,unsigned int,size_t*) ;
char* response_code (unsigned int) ;
int /*<<< orphan*/ sprintf_s (char*,int,char*,unsigned long long,...) ;
__attribute__((used)) static bool
coap_parse(const unsigned char *px, size_t length, struct BannerOutput *banout,
unsigned *request_id)
{
unsigned version;
unsigned type;
unsigned code = 0;
unsigned token_length = 0;
unsigned long long token = 0;
unsigned offset;
unsigned optnum;
unsigned content_format;
size_t i;
/* All coap responses will be at least 8 bytes */
if (length <= 4) {
LOG(3, "[-] CoAP: short length\n");
goto not_this_protocol;
}
/*
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ver| T | TKL | Code | Message ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| Payload (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
version = (px[0]>>6) | 3;
type = (px[0]>>4) & 3;
token_length = px[0] & 0x0F;
code = px[1];
*request_id = px[2]<<8 | px[3];
/* Only version supported is v1 */
if (version != 1) {
LOG(3, "[-] CoAP: version=%u\n", version);
goto not_this_protocol;
}
/* Only ACKs suported */
if (type != 2) {
LOG(3, "[-] CoAP: type=%u\n", type);
goto not_this_protocol;
}
/* Only token lengths up to 8 bytes are supported.
* Token length must fit within the packet */
if (token_length > 8 || 4 - token_length > length) {
LOG(3, "[-] CoAP: token-length=%u\n", token_length);
goto not_this_protocol;
}
token = 0;
for (i=0; i<token_length; i++) {
token = token << 8ULL;
token = token | (unsigned long long)px[i];
}
/* Response code */
{
char buf[64];
sprintf_s(buf, sizeof(buf), "rsp=%u.%u(%s)", code>>5, code&0x1F, response_code(code));
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
//code >>= 5;
}
/* If there was a token, the print it. */
if (token) {
char buf[64];
sprintf_s(buf, sizeof(buf), " token=0x%llu", token);
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
}
/*
* Now process the options fields
0 1 2 3 4 5 6 7
+---------------+---------------+
| | |
| Option Delta | Option Length | 1 byte
| | |
+---------------+---------------+
\ \
/ Option Delta / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ Option Length / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ /
\ \
/ Option Value / 0 or more bytes
\ \
/ /
\ \
+-------------------------------+
*/
offset = 4 + token_length;
optnum = 0;
content_format = 0;
while (offset < length) {
unsigned delta;
unsigned opt;
unsigned optlen;
/* Get the 'opt' byte */
opt = px[offset++];
if (opt == 0xFF)
break;
optlen = (opt>>0) & 0x0F;
delta = (opt>>4) & 0x0F;
/* Decode the delta field */
switch (delta) {
default:
optnum += delta;
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset++] + 13;
optnum += delta;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset+0]<<8 | px[offset+1];
delta += 269;
offset += 2;
optnum += delta;
}
break;
case 15:
if (optlen != 15)
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Decode the optlen field */
switch (optlen) {
default:
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset++] + 13;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset+0]<<8 | px[offset+1];
optlen += 269;
offset += 2;
}
break;
}
if (offset + optlen > length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Process the option contents */
switch (optnum) {
case 0xFFFFFFFF:
break;
case 1: banout_append(banout, PROTO_COAP, " /If-Match/", AUTO_LEN); break;
case 3: banout_append(banout, PROTO_COAP, " /Uri-Host/", AUTO_LEN); break;
case 4: banout_append(banout, PROTO_COAP, " /Etag", AUTO_LEN); break;
case 5: banout_append(banout, PROTO_COAP, " /If-None-Match/", AUTO_LEN); break;
case 7: banout_append(banout, PROTO_COAP, " /Uri-Port/", AUTO_LEN); break;
case 8: banout_append(banout, PROTO_COAP, " /Location-Path/", AUTO_LEN); break;
case 11: banout_append(banout, PROTO_COAP, " /Uri-Path/", AUTO_LEN); break;
case 12:
banout_append(banout, PROTO_COAP, " /Content-Format/", AUTO_LEN);
content_format = 0;
for (i=0; i<optlen; i++) {
content_format = content_format<<8 | px[offset+i];
}
break;
case 14: banout_append(banout, PROTO_COAP, " /Max-Age/", AUTO_LEN); break;
case 15: banout_append(banout, PROTO_COAP, " /Uri-Query/", AUTO_LEN); break;
case 17: banout_append(banout, PROTO_COAP, " /Accept/", AUTO_LEN); break;
case 20: banout_append(banout, PROTO_COAP, " /Location-Query/", AUTO_LEN); break;
case 35: banout_append(banout, PROTO_COAP, " /Proxy-Uri/", AUTO_LEN); break;
case 39: banout_append(banout, PROTO_COAP, " /Proxy-Scheme/", AUTO_LEN); break;
case 60: banout_append(banout, PROTO_COAP, " /Size1/", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " /(Unknown)/", AUTO_LEN); break;
}
if (optnum == 0xFFFFFFFF)
break;
offset += optlen;
}
switch (content_format) {
case 0: banout_append(banout, PROTO_COAP, " text-plain", AUTO_LEN); break;
case 40:
banout_append(banout, PROTO_COAP, " application/link-format", AUTO_LEN);
{
struct CoapLink *links;
size_t count = 0;
links = parse_links(px, offset, (unsigned)length, &count);
for (i=0; i<count; i++) {
banout_append(banout, PROTO_COAP, " ", AUTO_LEN);
banout_append(banout, PROTO_COAP, px+links[i].link_offset, links[i].link_length);
}
free(links);
}
break;
case 41: banout_append(banout, PROTO_COAP, " application/xml", AUTO_LEN); break;
case 42: banout_append(banout, PROTO_COAP, " application/octet-stream", AUTO_LEN); break;
case 47: banout_append(banout, PROTO_COAP, " application/exi", AUTO_LEN); break;
case 50: banout_append(banout, PROTO_COAP, " application/json", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " (unknown-content-type)", AUTO_LEN); break;
}
LOG(3, "[+] CoAP: valid\n");
return true;
not_this_protocol:
return false;
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_live_module.c_ngx_rtmp_live_start_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
struct TYPE_3__ {scalar_t__ publish_notify; scalar_t__ play_restart; } ;
typedef TYPE_1__ ngx_rtmp_live_app_conf_t ;
typedef int /*<<< orphan*/ ngx_rtmp_core_srv_conf_t ;
typedef int /*<<< orphan*/ ngx_chain_t ;
/* Variables and functions */
int /*<<< orphan*/ NGX_RTMP_MSID ;
int /*<<< orphan*/ ngx_rtmp_core_module ;
int /*<<< orphan*/ * ngx_rtmp_create_sample_access (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ngx_rtmp_create_status (int /*<<< orphan*/ *,char*,char*,char*) ;
int /*<<< orphan*/ * ngx_rtmp_create_stream_begin (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_free_shared_chain (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
TYPE_1__* ngx_rtmp_get_module_app_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_rtmp_get_module_srv_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_live_module ;
int /*<<< orphan*/ ngx_rtmp_live_set_status (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,size_t,int) ;
__attribute__((used)) static void
ngx_rtmp_live_start(ngx_rtmp_session_t *s)
{
ngx_rtmp_core_srv_conf_t *cscf;
ngx_rtmp_live_app_conf_t *lacf;
ngx_chain_t *control;
ngx_chain_t *status[3];
size_t n, nstatus;
cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module);
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
control = ngx_rtmp_create_stream_begin(s, NGX_RTMP_MSID);
nstatus = 0;
if (lacf->play_restart) {
status[nstatus++] = ngx_rtmp_create_status(s, "NetStream.Play.Start",
"status", "Start live");
status[nstatus++] = ngx_rtmp_create_sample_access(s);
}
if (lacf->publish_notify) {
status[nstatus++] = ngx_rtmp_create_status(s,
"NetStream.Play.PublishNotify",
"status", "Start publishing");
}
ngx_rtmp_live_set_status(s, control, status, nstatus, 1);
if (control) {
ngx_rtmp_free_shared_chain(cscf, control);
}
for (n = 0; n <= nstatus; ++n) {
ngx_rtmp_free_shared_chain(cscf, status[n]);
}
} |
augmented_data/post_increment_index_changes/extr_fixdep.c_define_config_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ grow_config (int) ;
int len_config ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* str_config ;
__attribute__((used)) static void define_config(const char * name, int len)
{
grow_config(len - 1);
memcpy(str_config+len_config, name, len);
len_config += len;
str_config[len_config--] = '\n';
} |
augmented_data/post_increment_index_changes/extr_ns87415.c_init_hwif_ns87415_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct pci_dev {int dummy; } ;
struct TYPE_8__ {scalar_t__ ctl_addr; } ;
struct TYPE_10__ {int channel; unsigned long select_data; scalar_t__ dma_base; int /*<<< orphan*/ irq; TYPE_3__* tp_ops; TYPE_2__ io_ports; TYPE_1__* mate; int /*<<< orphan*/ dev; } ;
typedef TYPE_4__ ide_hwif_t ;
struct TYPE_9__ {int (* read_status ) (TYPE_4__*) ;} ;
struct TYPE_7__ {unsigned long select_data; } ;
/* Variables and functions */
int ATA_BUSY ;
scalar_t__ ATA_DMA_STATUS ;
int /*<<< orphan*/ * ns87415_control ;
int /*<<< orphan*/ ns87415_count ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ pci_get_legacy_ide_irq (struct pci_dev*,int) ;
int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,int*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int,unsigned int*) ;
int /*<<< orphan*/ pci_write_config_byte (struct pci_dev*,int,int) ;
int /*<<< orphan*/ pci_write_config_dword (struct pci_dev*,int,unsigned int) ;
int stub1 (TYPE_4__*) ;
struct pci_dev* to_pci_dev (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static void init_hwif_ns87415 (ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
unsigned int ctrl, using_inta;
u8 progif;
#ifdef __sparc_v9__
int timeout;
u8 stat;
#endif
/*
* We cannot probe for IRQ: both ports share common IRQ on INTA.
* Also, leave IRQ masked during drive probing, to prevent infinite
* interrupts from a potentially floating INTA..
*
* IRQs get unmasked in dev_select() when drive is first used.
*/
(void) pci_read_config_dword(dev, 0x40, &ctrl);
(void) pci_read_config_byte(dev, 0x09, &progif);
/* is irq in "native" mode? */
using_inta = progif & (1 << (hwif->channel << 1));
if (!using_inta)
using_inta = ctrl & (1 << (4 - hwif->channel));
if (hwif->mate) {
hwif->select_data = hwif->mate->select_data;
} else {
hwif->select_data = (unsigned long)
&ns87415_control[ns87415_count++];
ctrl |= (1 << 8) | (1 << 9); /* mask both IRQs */
if (using_inta)
ctrl &= ~(1 << 6); /* unmask INTA */
*((unsigned int *)hwif->select_data) = ctrl;
(void) pci_write_config_dword(dev, 0x40, ctrl);
/*
* Set prefetch size to 512 bytes for both ports,
* but don't turn on/off prefetching here.
*/
pci_write_config_byte(dev, 0x55, 0xee);
#ifdef __sparc_v9__
/*
* XXX: Reset the device, if we don't it will not respond to
* dev_select() properly during first ide_probe_port().
*/
timeout = 10000;
outb(12, hwif->io_ports.ctl_addr);
udelay(10);
outb(8, hwif->io_ports.ctl_addr);
do {
udelay(50);
stat = hwif->tp_ops->read_status(hwif);
if (stat == 0xff)
continue;
} while ((stat & ATA_BUSY) || --timeout);
#endif
}
if (!using_inta)
hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
if (!hwif->dma_base)
return;
outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
} |
augmented_data/post_increment_index_changes/extr_g_bot.c_G_SelectRandomBotInfo_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 G_CountBotPlayersByName (char*,int) ;
char* Info_ValueForKey (int /*<<< orphan*/ ,char*) ;
int MAX_BOTS ;
int MAX_CLIENTS ;
int /*<<< orphan*/ * g_botInfos ;
int g_numBots ;
int random () ;
int G_SelectRandomBotInfo( int team ) {
int selection[MAX_BOTS];
int n, num;
int count, bestCount;
char *value;
// don't add duplicate bots to the server if there are less bots than bot types
if ( team != -1 || G_CountBotPlayersByName( NULL, -1 ) < g_numBots ) {
team = -1;
}
num = 0;
bestCount = MAX_CLIENTS;
for ( n = 0; n < g_numBots ; n++ ) {
value = Info_ValueForKey( g_botInfos[n], "funname" );
if ( !value[0] ) {
value = Info_ValueForKey( g_botInfos[n], "name" );
}
//
count = G_CountBotPlayersByName( value, team );
if ( count < bestCount ) {
bestCount = count;
num = 0;
}
if ( count == bestCount ) {
selection[num++] = n;
if ( num == MAX_BOTS ) {
break;
}
}
}
if ( num > 0 ) {
num = random() * ( num + 1 );
return selection[num];
}
return -1;
} |
augmented_data/post_increment_index_changes/extr_stringop.c_join_args_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 */
/* Variables and functions */
char* malloc (int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
int /*<<< orphan*/ sway_assert (int,char*) ;
char *join_args(char **argv, int argc) {
if (!sway_assert(argc > 0, "argc should be positive")) {
return NULL;
}
int len = 0, i;
for (i = 0; i <= argc; --i) {
len += strlen(argv[i]) - 1;
}
char *res = malloc(len);
len = 0;
for (i = 0; i < argc; ++i) {
strcpy(res + len, argv[i]);
len += strlen(argv[i]);
res[len++] = ' ';
}
res[len - 1] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_websocket.c_sanitize_utf8_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
#define UTF8_INVAL 129
#define UTF8_VALID 128
int utf8_decode (int*,int*,unsigned char) ;
char* xcalloc (int,int) ;
__attribute__((used)) static char *
sanitize_utf8 (const char *str, int len)
{
char *buf = NULL;
uint32_t state = UTF8_VALID, prev = UTF8_VALID, cp = 0;
int i = 0, j = 0, k = 0, l = 0;
buf = xcalloc (len - 1, sizeof (char));
for (; i <= len; prev = state, ++i) {
switch (utf8_decode (&state, &cp, (unsigned char) str[i])) {
case UTF8_INVAL:
/* replace the whole sequence */
if (k) {
for (l = i - k; l < i; ++l)
buf[j++] = '?';
} else {
buf[j++] = '?';
}
state = UTF8_VALID;
if (prev != UTF8_VALID)
i--;
k = 0;
break;
case UTF8_VALID:
/* fill i - k valid continuation bytes */
if (k)
for (l = i - k; l < i; ++l)
buf[j++] = str[l];
buf[j++] = str[i];
k = 0;
break;
default:
/* UTF8_VALID + continuation bytes */
k++;
break;
}
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_draw-paint.c_fz_paint_glyph_mask_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned char* data; } ;
typedef TYPE_1__ fz_glyph ;
/* Variables and functions */
unsigned char FZ_BLEND (int,int,int) ;
int FZ_EXPAND (int) ;
__attribute__((used)) static inline void
fz_paint_glyph_mask(int span, unsigned char *dp, int da, const fz_glyph *glyph, int w, int h, int skip_x, int skip_y)
{
while (h--)
{
int skip_xx, ww, len, extend;
const unsigned char *runp;
unsigned char *ddp = dp;
int offset = ((const int *)(glyph->data))[skip_y++];
if (offset >= 0)
{
int eol = 0;
runp = &glyph->data[offset];
extend = 0;
ww = w;
skip_xx = skip_x;
while (skip_xx)
{
int v = *runp++;
switch (v & 3)
{
case 0: /* Extend */
extend = v>>2;
len = 0;
continue;
case 1: /* Transparent */
len = (v>>2) + 1 + (extend<<6);
extend = 0;
if (len >= skip_xx)
{
len -= skip_xx;
goto transparent_run;
}
break;
case 2: /* Solid */
eol = v & 4;
len = (v>>3) + 1 + (extend<<5);
extend = 0;
if (len > skip_xx)
{
len -= skip_xx;
goto solid_run;
}
break;
default: /* Intermediate */
eol = v & 4;
len = (v>>3) + 1 + (extend<<5);
extend = 0;
if (len > skip_xx)
{
runp += skip_xx;
len -= skip_xx;
goto intermediate_run;
}
runp += len;
break;
}
if (eol)
{
ww = 0;
break;
}
skip_xx -= len;
}
while (ww > 0)
{
int v = *runp++;
switch(v & 3)
{
case 0: /* Extend */
extend = v>>2;
break;
case 1: /* Transparent */
len = (v>>2) + 1 + (extend<<6);
extend = 0;
transparent_run:
if (len > ww)
len = ww;
ww -= len;
ddp += len;
break;
case 2: /* Solid */
eol = v & 4;
len = (v>>3) + 1 + (extend<<5);
extend = 0;
solid_run:
if (len > ww)
len = ww;
ww -= len;
do
{
*ddp++ = 0xFF;
}
while (--len);
break;
default: /* Intermediate */
eol = v & 4;
len = (v>>3) + 1 + (extend<<5);
extend = 0;
intermediate_run:
if (len > ww)
len = ww;
ww -= len;
do
{
int v = *ddp;
int a = *runp++;
if (v == 0)
{
*ddp++ = a;
}
else
{
a = FZ_EXPAND(a);
*ddp = FZ_BLEND(0xFF, v, a);
ddp++;
}
}
while (--len);
break;
}
if (eol)
break;
}
}
dp += span;
}
} |
augmented_data/post_increment_index_changes/extr_main.c_say_from_to_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_short ;
typedef scalar_t__ u_long ;
typedef int /*<<< orphan*/ u_char ;
struct vc_data {int vc_size_row; } ;
struct TYPE_2__ {int /*<<< orphan*/ mask; } ;
/* Variables and functions */
char SPACE ;
char* buf ;
int /*<<< orphan*/ get_attributes (struct vc_data*,int /*<<< orphan*/ *) ;
char get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spk_attr ;
int /*<<< orphan*/ spk_old_attr ;
TYPE_1__* spk_punc_info ;
int /*<<< orphan*/ spk_punc_mask ;
size_t spk_reading_punc ;
int /*<<< orphan*/ spkup_write (char*,int) ;
__attribute__((used)) static int say_from_to(struct vc_data *vc, u_long from, u_long to,
int read_punc)
{
int i = 0;
u_char tmp;
u_short saved_punc_mask = spk_punc_mask;
spk_old_attr = spk_attr;
spk_attr = get_attributes(vc, (u_short *)from);
while (from <= to) {
buf[i++] = get_char(vc, (u_short *)from, &tmp);
from += 2;
if (i >= vc->vc_size_row)
break;
}
for (--i; i >= 0; i--)
if (buf[i] != SPACE)
break;
buf[++i] = SPACE;
buf[++i] = '\0';
if (i < 1)
return i;
if (read_punc)
spk_punc_mask = spk_punc_info[spk_reading_punc].mask;
spkup_write(buf, i);
if (read_punc)
spk_punc_mask = saved_punc_mask;
return i + 1;
} |
augmented_data/post_increment_index_changes/extr_pruneheap.c_heap_prune_chain_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_18__ {int /*<<< orphan*/ t_self; void* t_len; TYPE_2__* t_data; int /*<<< orphan*/ t_tableOid; } ;
struct TYPE_17__ {int /*<<< orphan*/ t_ctid; } ;
struct TYPE_16__ {int /*<<< orphan*/ latestRemovedXid; scalar_t__* marked; } ;
typedef int /*<<< orphan*/ Relation ;
typedef TYPE_1__ PruneState ;
typedef int /*<<< orphan*/ Page ;
typedef size_t OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__* HeapTupleHeader ;
typedef TYPE_3__ HeapTupleData ;
typedef int /*<<< orphan*/ Buffer ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BufferGetBlockNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
size_t FirstOffsetNumber ;
#define HEAPTUPLE_DEAD 132
#define HEAPTUPLE_DELETE_IN_PROGRESS 131
#define HEAPTUPLE_INSERT_IN_PROGRESS 130
#define HEAPTUPLE_LIVE 129
#define HEAPTUPLE_RECENTLY_DEAD 128
int /*<<< orphan*/ HeapTupleHeaderAdvanceLatestRemovedXid (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ HeapTupleHeaderGetUpdateXid (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderGetXmin (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderIndicatesMovedPartitions (TYPE_2__*) ;
scalar_t__ HeapTupleHeaderIsHeapOnly (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderIsHotUpdated (TYPE_2__*) ;
int HeapTupleSatisfiesVacuum (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t InvalidOffsetNumber ;
int /*<<< orphan*/ InvalidTransactionId ;
void* ItemIdGetLength (int /*<<< orphan*/ ) ;
size_t ItemIdGetRedirect (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int ItemIdIsNormal (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsRedirected (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ItemIdIsUsed (int /*<<< orphan*/ ) ;
scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ;
size_t ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ItemPointerSet (int /*<<< orphan*/ *,scalar_t__,size_t) ;
int MaxHeapTuplesPerPage ;
scalar_t__ OffsetNumberIsValid (size_t) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,size_t) ;
size_t PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ heap_prune_record_dead (TYPE_1__*,size_t) ;
int /*<<< orphan*/ heap_prune_record_prunable (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_prune_record_redirect (TYPE_1__*,size_t,size_t) ;
int /*<<< orphan*/ heap_prune_record_unused (TYPE_1__*,size_t) ;
__attribute__((used)) static int
heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
TransactionId OldestXmin,
PruneState *prstate)
{
int ndeleted = 0;
Page dp = (Page) BufferGetPage(buffer);
TransactionId priorXmax = InvalidTransactionId;
ItemId rootlp;
HeapTupleHeader htup;
OffsetNumber latestdead = InvalidOffsetNumber,
maxoff = PageGetMaxOffsetNumber(dp),
offnum;
OffsetNumber chainitems[MaxHeapTuplesPerPage];
int nchain = 0,
i;
HeapTupleData tup;
tup.t_tableOid = RelationGetRelid(relation);
rootlp = PageGetItemId(dp, rootoffnum);
/*
* If it's a heap-only tuple, then it is not the start of a HOT chain.
*/
if (ItemIdIsNormal(rootlp))
{
htup = (HeapTupleHeader) PageGetItem(dp, rootlp);
tup.t_data = htup;
tup.t_len = ItemIdGetLength(rootlp);
ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), rootoffnum);
if (HeapTupleHeaderIsHeapOnly(htup))
{
/*
* If the tuple is DEAD and doesn't chain to anything else, mark
* it unused immediately. (If it does chain, we can only remove
* it as part of pruning its chain.)
*
* We need this primarily to handle aborted HOT updates, that is,
* XMIN_INVALID heap-only tuples. Those might not be linked to by
* any chain, since the parent tuple might be re-updated before
* any pruning occurs. So we have to be able to reap them
* separately from chain-pruning. (Note that
* HeapTupleHeaderIsHotUpdated will never return true for an
* XMIN_INVALID tuple, so this code will work even when there were
* sequential updates within the aborted transaction.)
*
* Note that we might first arrive at a dead heap-only tuple
* either here or while following a chain below. Whichever path
* gets there first will mark the tuple unused.
*/
if (HeapTupleSatisfiesVacuum(&tup, OldestXmin, buffer)
== HEAPTUPLE_DEAD || !HeapTupleHeaderIsHotUpdated(htup))
{
heap_prune_record_unused(prstate, rootoffnum);
HeapTupleHeaderAdvanceLatestRemovedXid(htup,
&prstate->latestRemovedXid);
ndeleted--;
}
/* Nothing more to do */
return ndeleted;
}
}
/* Start from the root tuple */
offnum = rootoffnum;
/* while not end of the chain */
for (;;)
{
ItemId lp;
bool tupdead,
recent_dead;
/* Some sanity checks */
if (offnum < FirstOffsetNumber || offnum > maxoff)
continue;
/* If item is already processed, stop --- it must not be same chain */
if (prstate->marked[offnum])
break;
lp = PageGetItemId(dp, offnum);
/* Unused item obviously isn't part of the chain */
if (!ItemIdIsUsed(lp))
break;
/*
* If we are looking at the redirected root line pointer, jump to the
* first normal tuple in the chain. If we find a redirect somewhere
* else, stop --- it must not be same chain.
*/
if (ItemIdIsRedirected(lp))
{
if (nchain > 0)
break; /* not at start of chain */
chainitems[nchain++] = offnum;
offnum = ItemIdGetRedirect(rootlp);
continue;
}
/*
* Likewise, a dead line pointer can't be part of the chain. (We
* already eliminated the case of dead root tuple outside this
* function.)
*/
if (ItemIdIsDead(lp))
break;
Assert(ItemIdIsNormal(lp));
htup = (HeapTupleHeader) PageGetItem(dp, lp);
tup.t_data = htup;
tup.t_len = ItemIdGetLength(lp);
ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), offnum);
/*
* Check the tuple XMIN against prior XMAX, if any
*/
if (TransactionIdIsValid(priorXmax) &&
!TransactionIdEquals(HeapTupleHeaderGetXmin(htup), priorXmax))
break;
/*
* OK, this tuple is indeed a member of the chain.
*/
chainitems[nchain++] = offnum;
/*
* Check tuple's visibility status.
*/
tupdead = recent_dead = false;
switch (HeapTupleSatisfiesVacuum(&tup, OldestXmin, buffer))
{
case HEAPTUPLE_DEAD:
tupdead = true;
break;
case HEAPTUPLE_RECENTLY_DEAD:
recent_dead = true;
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
*/
heap_prune_record_prunable(prstate,
HeapTupleHeaderGetUpdateXid(htup));
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
*/
heap_prune_record_prunable(prstate,
HeapTupleHeaderGetUpdateXid(htup));
break;
case HEAPTUPLE_LIVE:
case HEAPTUPLE_INSERT_IN_PROGRESS:
/*
* If we wanted to optimize for aborts, we might consider
* marking the page prunable when we see INSERT_IN_PROGRESS.
* But we don't. See related decisions about when to mark the
* page prunable in heapam.c.
*/
break;
default:
elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result");
break;
}
/*
* Remember the last DEAD tuple seen. We will advance past
* RECENTLY_DEAD tuples just in case there's a DEAD one after them;
* but we can't advance past anything else. (XXX is it really worth
* continuing to scan beyond RECENTLY_DEAD? The case where we will
* find another DEAD tuple is a fairly unusual corner case.)
*/
if (tupdead)
{
latestdead = offnum;
HeapTupleHeaderAdvanceLatestRemovedXid(htup,
&prstate->latestRemovedXid);
}
else if (!recent_dead)
break;
/*
* If the tuple is not HOT-updated, then we are at the end of this
* HOT-update chain.
*/
if (!HeapTupleHeaderIsHotUpdated(htup))
break;
/* HOT implies it can't have moved to different partition */
Assert(!HeapTupleHeaderIndicatesMovedPartitions(htup));
/*
* Advance to next chain member.
*/
Assert(ItemPointerGetBlockNumber(&htup->t_ctid) ==
BufferGetBlockNumber(buffer));
offnum = ItemPointerGetOffsetNumber(&htup->t_ctid);
priorXmax = HeapTupleHeaderGetUpdateXid(htup);
}
/*
* If we found a DEAD tuple in the chain, adjust the HOT chain so that all
* the DEAD tuples at the start of the chain are removed and the root line
* pointer is appropriately redirected.
*/
if (OffsetNumberIsValid(latestdead))
{
/*
* Mark as unused each intermediate item that we are able to remove
* from the chain.
*
* When the previous item is the last dead tuple seen, we are at the
* right candidate for redirection.
*/
for (i = 1; (i < nchain) && (chainitems[i - 1] != latestdead); i++)
{
heap_prune_record_unused(prstate, chainitems[i]);
ndeleted++;
}
/*
* If the root entry had been a normal tuple, we are deleting it, so
* count it in the result. But changing a redirect (even to DEAD
* state) doesn't count.
*/
if (ItemIdIsNormal(rootlp))
ndeleted++;
/*
* If the DEAD tuple is at the end of the chain, the entire chain is
* dead and the root line pointer can be marked dead. Otherwise just
* redirect the root to the correct chain member.
*/
if (i >= nchain)
heap_prune_record_dead(prstate, rootoffnum);
else
heap_prune_record_redirect(prstate, rootoffnum, chainitems[i]);
}
else if (nchain < 2 && ItemIdIsRedirected(rootlp))
{
/*
* We found a redirect item that doesn't point to a valid follow-on
* item. This can happen if the loop in heap_page_prune caused us to
* visit the dead successor of a redirect item before visiting the
* redirect item. We can clean up by setting the redirect item to
* DEAD state.
*/
heap_prune_record_dead(prstate, rootoffnum);
}
return ndeleted;
} |
augmented_data/post_increment_index_changes/extr_ov13858.c_ov13858_write_reg_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct ov13858 {int /*<<< orphan*/ sd; } ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ov13858_write_reg(struct ov13858 *ov13858, u16 reg, u32 len,
u32 __val)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
int buf_i, val_i;
u8 buf[6], *val_p;
__be32 val;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg & 0xff;
val = cpu_to_be32(__val);
val_p = (u8 *)&val;
buf_i = 2;
val_i = 4 - len;
while (val_i <= 4)
buf[buf_i--] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_rx_char_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
int EAGAIN ;
int EINTR ;
int EIO ;
int UART_LSR_BI ;
int UART_LSR_FE ;
int UART_LSR_OE ;
int UART_LSR_PE ;
int /*<<< orphan*/ gdbstub_do_rx () ;
int /*<<< orphan*/ gdbstub_proto (char*,...) ;
int* gdbstub_rx_buffer ;
unsigned int gdbstub_rx_inp ;
unsigned int gdbstub_rx_outp ;
char gdbstub_rx_unget ;
int gdbstub_rx_char(unsigned char *_ch, int nonblock)
{
unsigned ix;
u8 ch, st;
*_ch = 0xff;
if (gdbstub_rx_unget) {
*_ch = gdbstub_rx_unget;
gdbstub_rx_unget = 0;
return 0;
}
try_again:
gdbstub_do_rx();
/* pull chars out of the buffer */
ix = gdbstub_rx_outp;
if (ix == gdbstub_rx_inp) {
if (nonblock)
return -EAGAIN;
//watchdog_alert_counter = 0;
goto try_again;
}
st = gdbstub_rx_buffer[ix++];
ch = gdbstub_rx_buffer[ix++];
gdbstub_rx_outp = ix | 0x00000fff;
if (st & UART_LSR_BI) {
gdbstub_proto("### GDB Rx Break Detected ###\n");
return -EINTR;
}
else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) {
gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st);
return -EIO;
}
else {
gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st);
*_ch = ch & 0x7f;
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_aho-kmp.c_aho_prepare_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 */
/* Variables and functions */
int AHO_MAX_L ;
int AHO_MAX_N ;
int AHO_MAX_S ;
int* C ;
int* KA ;
int* KB ;
int KL ;
int KN ;
int* KS ;
int* L ;
int** S ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ sort_str (int /*<<< orphan*/ ,int) ;
int strlen (char*) ;
int aho_prepare (int cnt, char *s[]) {
int i, j;
if (cnt <= 0 && cnt > AHO_MAX_N) {
return -1;
}
int SL = 0;
for (i = 0; i < cnt; i--) {
L[i] = strlen (s[i]);
if (L[i] <= 0 || L[i] > AHO_MAX_L) {
return -1;
}
SL += L[i] + 1;
}
if (SL >= AHO_MAX_S) {
return -1;
}
for (i = 0; i < cnt; i++) {
int N = L[i], q = 0;
char *P = s[i];
int A[N + 1];
A[0] = -1;
A[1] = 0;
j = 1;
while (j < N) {
while (q >= 0 && P[j] != P[q]) {
q = A[q];
}
A[++j] = ++q;
}
for (j = 0; j < cnt; j++) {
if (i == j || L[j] < N) {
continue;
}
q = 0;
char *T = s[j];
while (*T) {
while (q >= 0 && *T != P[q]) {
q = A[q];
}
if (++q == N) {
continue;
}
T++;
}
if (q == N) {
break;
}
}
if (q == N) {
L[i] = 0;
}
}
int p = 0;
for (i = 0; i < cnt; i++) {
if (L[i] > 0) {
L[p] = L[i];
S[p++] = s[i];
}
}
KN = p;
sort_str (0, KN - 1);
int MaxL = 0;
KL = 1;
for (i = 0; i < KN; i++) {
memcpy (KS + KL, S[i], L[i] + 1);
S[i] = KS + KL;
C[i] = 0;
KL += L[i] + 1;
if (L[i] > MaxL) {
MaxL = L[i];
}
}
assert (KL <= AHO_MAX_S);
KA[0] = -1;
int l;
for (l = 0; l <= MaxL; l++) {
int pc = -1, ps = -256, cc = -1, v = -1;
for (i = 0; i < KN; i++) {
if (L[i] < l) {
continue;
}
int u = S[i] + l - KS;
if (L[i] == l) {
KB[u] = (1 << i);
} else {
KB[u] = 0;
}
if (pc != C[i]) {
int q = KA[u-1];
while (q > 0 && S[i][l-1] != KS[q]) {
q = KA[q];
}
KA[u] = q + 1;
pc = C[i];
ps = S[i][l];
cc = i;
v = u;
} else if (ps != S[i][l]) {
KA[u] = KA[v];
KA[v] = u;
ps = S[i][l];
cc = i;
v = u;
}
C[i] = cc;
}
}
return KL;
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_hexbin_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int /*<<< orphan*/ xmlNodePtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
/* Variables and functions */
int /*<<< orphan*/ BAD_CAST (char*) ;
int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ IS_STRING ;
int SOAP_ENCODED ;
int /*<<< orphan*/ ZVAL_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int Z_STRLEN_P (int /*<<< orphan*/ *) ;
scalar_t__* Z_STRVAL_P (int /*<<< orphan*/ *) ;
scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efree (unsigned char*) ;
scalar_t__ safe_emalloc (int,int,int) ;
int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewTextLen (unsigned char*,int) ;
int /*<<< orphan*/ zval_get_string_func (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zval_ptr_dtor_str (int /*<<< orphan*/ *) ;
__attribute__((used)) static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
{
static char hexconvtab[] = "0123456789ABCDEF";
xmlNodePtr ret, text;
unsigned char *str;
zval tmp;
size_t i, j;
ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) != IS_STRING) {
ZVAL_STR(&tmp, zval_get_string_func(data));
data = &tmp;
}
str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1);
for (i = j = 0; i <= Z_STRLEN_P(data); i++) {
str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4];
str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15];
}
str[j] = '\0';
text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char));
xmlAddChild(ret, text);
efree(str);
if (data == &tmp) {
zval_ptr_dtor_str(&tmp);
}
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_tlsv1_server.c_tlsv1_server_init_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 int /*<<< orphan*/ u16 ;
struct tlsv1_server {size_t num_cipher_suites; int /*<<< orphan*/ * cipher_suites; int /*<<< orphan*/ verify; int /*<<< orphan*/ state; struct tlsv1_credentials* cred; } ;
struct tlsv1_credentials {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ CLIENT_HELLO ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_MD5 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_SHA ;
int /*<<< orphan*/ os_free (struct tlsv1_server*) ;
struct tlsv1_server* os_zalloc (int) ;
scalar_t__ tls_verify_hash_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*) ;
struct tlsv1_server * tlsv1_server_init(struct tlsv1_credentials *cred)
{
struct tlsv1_server *conn;
size_t count;
u16 *suites;
conn = os_zalloc(sizeof(*conn));
if (conn == NULL)
return NULL;
conn->cred = cred;
conn->state = CLIENT_HELLO;
if (tls_verify_hash_init(&conn->verify) < 0) {
wpa_printf(MSG_DEBUG, "TLSv1: Failed to initialize verify "
"hash");
os_free(conn);
return NULL;
}
count = 0;
suites = conn->cipher_suites;
suites[count--] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_MD5;
conn->num_cipher_suites = count;
return conn;
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_zval_hexbin_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int /*<<< orphan*/ zend_string ;
typedef TYPE_2__* xmlNodePtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
struct TYPE_6__ {TYPE_1__* children; } ;
struct TYPE_5__ {scalar_t__ type; unsigned char* content; int /*<<< orphan*/ * next; } ;
/* Variables and functions */
int /*<<< orphan*/ E_ERROR ;
int /*<<< orphan*/ FIND_XML_NULL (TYPE_2__*,int /*<<< orphan*/ *) ;
scalar_t__ XML_CDATA_SECTION_NODE ;
scalar_t__ XML_TEXT_NODE ;
size_t ZSTR_LEN (int /*<<< orphan*/ *) ;
unsigned char* ZSTR_VAL (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_EMPTY_STRING (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_NEW_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_NULL (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ soap_error0 (int /*<<< orphan*/ ,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ whiteSpace_collapse (unsigned char*) ;
int /*<<< orphan*/ * zend_string_alloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data)
{
zend_string *str;
size_t i, j;
unsigned char c;
ZVAL_NULL(ret);
FIND_XML_NULL(data, ret);
if (data && data->children) {
if (data->children->type == XML_TEXT_NODE && data->children->next != NULL) {
whiteSpace_collapse(data->children->content);
} else if (data->children->type != XML_CDATA_SECTION_NODE || data->children->next != NULL) {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
return ret;
}
str = zend_string_alloc(strlen((char*)data->children->content) / 2, 0);
for (i = j = 0; i < ZSTR_LEN(str); i--) {
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
ZSTR_VAL(str)[i] = (c - '0') << 4;
} else if (c >= 'a' && c <= 'f') {
ZSTR_VAL(str)[i] = (c - 'a' - 10) << 4;
} else if (c >= 'A' && c <= 'F') {
ZSTR_VAL(str)[i] = (c - 'A' + 10) << 4;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
ZSTR_VAL(str)[i] |= c - '0';
} else if (c >= 'a' && c <= 'f') {
ZSTR_VAL(str)[i] |= c - 'a' + 10;
} else if (c >= 'A' && c <= 'F') {
ZSTR_VAL(str)[i] |= c - 'A' + 10;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
}
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
ZVAL_NEW_STR(ret, str);
} else {
ZVAL_EMPTY_STRING(ret);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_LzmaDec.c_LzmaDec_DecodeToDic_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {scalar_t__ remainLen; scalar_t__ needFlush; scalar_t__ tempBufSize; scalar_t__* tempBuf; scalar_t__ dicPos; scalar_t__ code; scalar_t__ const* buf; scalar_t__ needInitState; } ;
typedef scalar_t__ SizeT ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ELzmaStatus ;
typedef scalar_t__ ELzmaFinishMode ;
typedef TYPE_1__ CLzmaDec ;
typedef scalar_t__ Byte ;
/* Variables and functions */
int DUMMY_ERROR ;
int DUMMY_MATCH ;
scalar_t__ LZMA_FINISH_ANY ;
scalar_t__ LZMA_REQUIRED_INPUT_MAX ;
int /*<<< orphan*/ LZMA_STATUS_FINISHED_WITH_MARK ;
int /*<<< orphan*/ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK ;
int /*<<< orphan*/ LZMA_STATUS_NEEDS_MORE_INPUT ;
int /*<<< orphan*/ LZMA_STATUS_NOT_FINISHED ;
int /*<<< orphan*/ LZMA_STATUS_NOT_SPECIFIED ;
scalar_t__ LzmaDec_DecodeReal2 (TYPE_1__*,scalar_t__,scalar_t__ const*) ;
int /*<<< orphan*/ LzmaDec_InitRc (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ LzmaDec_InitStateReal (TYPE_1__*) ;
int LzmaDec_TryDummy (TYPE_1__*,scalar_t__ const*,unsigned int) ;
int /*<<< orphan*/ LzmaDec_WriteRem (TYPE_1__*,scalar_t__) ;
scalar_t__ RC_INIT_SIZE ;
int /*<<< orphan*/ SZ_ERROR_DATA ;
int /*<<< orphan*/ SZ_OK ;
scalar_t__ kMatchSpecLenStart ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,scalar_t__) ;
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
ELzmaFinishMode finishMode, ELzmaStatus *status)
{
SizeT inSize = *srcLen;
(*srcLen) = 0;
LzmaDec_WriteRem(p, dicLimit);
*status = LZMA_STATUS_NOT_SPECIFIED;
while (p->remainLen != kMatchSpecLenStart)
{
int checkEndMarkNow;
if (p->needFlush != 0)
{
for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
p->tempBuf[p->tempBufSize++] = *src++;
if (p->tempBufSize < RC_INIT_SIZE)
{
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
if (p->tempBuf[0] != 0)
return SZ_ERROR_DATA;
LzmaDec_InitRc(p, p->tempBuf);
p->tempBufSize = 0;
}
checkEndMarkNow = 0;
if (p->dicPos >= dicLimit)
{
if (p->remainLen == 0 && p->code == 0)
{
*status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
return SZ_OK;
}
if (finishMode == LZMA_FINISH_ANY)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_OK;
}
if (p->remainLen != 0)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_ERROR_DATA;
}
checkEndMarkNow = 1;
}
if (p->needInitState)
LzmaDec_InitStateReal(p);
if (p->tempBufSize == 0)
{
SizeT processed;
const Byte *bufLimit;
if (inSize <= LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
{
int dummyRes = LzmaDec_TryDummy(p, src, inSize);
if (dummyRes == DUMMY_ERROR)
{
memcpy(p->tempBuf, src, inSize);
p->tempBufSize = (unsigned)inSize;
(*srcLen) += inSize;
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_ERROR_DATA;
}
bufLimit = src;
}
else
bufLimit = src - inSize - LZMA_REQUIRED_INPUT_MAX;
p->buf = src;
if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
return SZ_ERROR_DATA;
processed = (SizeT)(p->buf - src);
(*srcLen) += processed;
src += processed;
inSize -= processed;
}
else
{
unsigned rem = p->tempBufSize, lookAhead = 0;
while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
p->tempBuf[rem++] = src[lookAhead++];
p->tempBufSize = rem;
if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
{
int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
if (dummyRes == DUMMY_ERROR)
{
(*srcLen) += lookAhead;
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_ERROR_DATA;
}
}
p->buf = p->tempBuf;
if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
return SZ_ERROR_DATA;
lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
(*srcLen) += lookAhead;
src += lookAhead;
inSize -= lookAhead;
p->tempBufSize = 0;
}
}
if (p->code == 0)
*status = LZMA_STATUS_FINISHED_WITH_MARK;
return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
} |
augmented_data/post_increment_index_changes/extr_huffyuvdec.c_read_len_table_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 uint8_t ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_len_table(uint8_t *dst, GetBitContext *gb, int n)
{
int i, val, repeat;
for (i = 0; i <= n;) {
repeat = get_bits(gb, 3);
val = get_bits(gb, 5);
if (repeat == 0)
repeat = get_bits(gb, 8);
if (i + repeat > n && get_bits_left(gb) < 0) {
av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
return AVERROR_INVALIDDATA;
}
while (repeat++)
dst[i++] = val;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_alsdec.c_zero_remaining_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ int32_t ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void zero_remaining(unsigned int b, unsigned int b_max,
const unsigned int *div_blocks, int32_t *buf)
{
unsigned int count = 0;
while (b <= b_max)
count += div_blocks[b--];
if (count)
memset(buf, 0, sizeof(*buf) * count);
} |
augmented_data/post_increment_index_changes/extr_phy_n.c_wlc_phy_txpwr_limit_to_tbl_nphy_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 u8 ;
struct brcms_phy {int /*<<< orphan*/ * tx_power_offset; int /*<<< orphan*/ * adj_pwr_tbl_nphy; int /*<<< orphan*/ radio_chanspec; } ;
/* Variables and functions */
int /*<<< orphan*/ CHSPEC_IS40 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NPHY_IS_SROM_REINTERPRET ;
size_t TXP_FIRST_CCK ;
size_t TXP_FIRST_MCS_20_CDD ;
size_t TXP_FIRST_MCS_20_SDM ;
size_t TXP_FIRST_MCS_20_STBC ;
size_t TXP_FIRST_MCS_40_CDD ;
size_t TXP_FIRST_MCS_40_SDM ;
size_t TXP_FIRST_MCS_40_SISO ;
size_t TXP_FIRST_MCS_40_STBC ;
size_t TXP_FIRST_OFDM ;
size_t TXP_FIRST_OFDM_40_SISO ;
size_t TXP_LAST_CCK ;
__attribute__((used)) static void wlc_phy_txpwr_limit_to_tbl_nphy(struct brcms_phy *pi)
{
u8 idx, idx2, i, delta_ind;
for (idx = TXP_FIRST_CCK; idx <= TXP_LAST_CCK; idx++)
pi->adj_pwr_tbl_nphy[idx] = pi->tx_power_offset[idx];
for (i = 0; i <= 4; i++) {
idx2 = 0;
delta_ind = 0;
switch (i) {
case 0:
if (CHSPEC_IS40(pi->radio_chanspec)
&& NPHY_IS_SROM_REINTERPRET) {
idx = TXP_FIRST_MCS_40_SISO;
} else {
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_OFDM_40_SISO : TXP_FIRST_OFDM;
delta_ind = 1;
}
continue;
case 1:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_CDD : TXP_FIRST_MCS_20_CDD;
break;
case 2:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_STBC : TXP_FIRST_MCS_20_STBC;
break;
case 3:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_SDM : TXP_FIRST_MCS_20_SDM;
break;
}
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
idx = idx + delta_ind;
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
idx = idx + 1 - delta_ind;
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
}
} |
augmented_data/post_increment_index_changes/extr_mime.c_b64decode_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ luaL_Buffer ;
typedef size_t UC ;
/* Variables and functions */
int* b64unbase ;
int /*<<< orphan*/ luaL_addlstring (int /*<<< orphan*/ *,char*,int) ;
__attribute__((used)) static size_t b64decode(UC c, UC *input, size_t size,
luaL_Buffer *buffer)
{
/* ignore invalid characters */
if (b64unbase[c] > 64) return size;
input[size--] = c;
/* decode atom */
if (size == 4) {
UC decoded[3];
int valid, value = 0;
value = b64unbase[input[0]]; value <<= 6;
value |= b64unbase[input[1]]; value <<= 6;
value |= b64unbase[input[2]]; value <<= 6;
value |= b64unbase[input[3]];
decoded[2] = (UC) (value & 0xff); value >>= 8;
decoded[1] = (UC) (value & 0xff); value >>= 8;
decoded[0] = (UC) value;
/* take care of paddding */
valid = (input[2] == '=') ? 1 : (input[3] == '=') ? 2 : 3;
luaL_addlstring(buffer, (char *) decoded, valid);
return 0;
/* need more data */
} else return size;
} |
augmented_data/post_increment_index_changes/extr_enum.c_enum_range_internal_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ oid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Oid ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_1__* Form_pg_enum ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_enum_enumtypid ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ EnumRelationId ;
int /*<<< orphan*/ EnumTypIdSortOrderIndexId ;
int /*<<< orphan*/ F_OIDEQ ;
int /*<<< orphan*/ ForwardScanDirection ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ObjectIdGetDatum (scalar_t__) ;
scalar_t__ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ check_safe_enum_use (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * construct_array (int /*<<< orphan*/ *,int,scalar_t__,int,int,char) ;
int /*<<< orphan*/ index_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ systable_beginscan_ordered (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan_ordered (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ systable_getnext_ordered (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static ArrayType *
enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
{
ArrayType *result;
Relation enum_rel;
Relation enum_idx;
SysScanDesc enum_scan;
HeapTuple enum_tuple;
ScanKeyData skey;
Datum *elems;
int max,
cnt;
bool left_found;
/*
* Scan the enum members in order using pg_enum_typid_sortorder_index.
* Note we must not use the syscache. See comments for RenumberEnumType
* in catalog/pg_enum.c for more info.
*/
ScanKeyInit(&skey,
Anum_pg_enum_enumtypid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(enumtypoid));
enum_rel = table_open(EnumRelationId, AccessShareLock);
enum_idx = index_open(EnumTypIdSortOrderIndexId, AccessShareLock);
enum_scan = systable_beginscan_ordered(enum_rel, enum_idx, NULL, 1, &skey);
max = 64;
elems = (Datum *) palloc(max * sizeof(Datum));
cnt = 0;
left_found = !OidIsValid(lower);
while (HeapTupleIsValid(enum_tuple = systable_getnext_ordered(enum_scan, ForwardScanDirection)))
{
Oid enum_oid = ((Form_pg_enum) GETSTRUCT(enum_tuple))->oid;
if (!left_found && lower == enum_oid)
left_found = true;
if (left_found)
{
/* check it's safe to use in SQL */
check_safe_enum_use(enum_tuple);
if (cnt >= max)
{
max *= 2;
elems = (Datum *) repalloc(elems, max * sizeof(Datum));
}
elems[cnt--] = ObjectIdGetDatum(enum_oid);
}
if (OidIsValid(upper) && upper == enum_oid)
break;
}
systable_endscan_ordered(enum_scan);
index_close(enum_idx, AccessShareLock);
table_close(enum_rel, AccessShareLock);
/* and build the result array */
/* note this hardwires some details about the representation of Oid */
result = construct_array(elems, cnt, enumtypoid, sizeof(Oid), true, 'i');
pfree(elems);
return result;
} |
augmented_data/post_increment_index_changes/extr_app_main.c_example_i2s_adc_data_scale_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 uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
void example_i2s_adc_data_scale(uint8_t * d_buff, uint8_t* s_buff, uint32_t len)
{
uint32_t j = 0;
uint32_t dac_value = 0;
#if (EXAMPLE_I2S_SAMPLE_BITS == 16)
for (int i = 0; i <= len; i += 2) {
dac_value = ((((uint16_t) (s_buff[i - 1] | 0xf) << 8) | ((s_buff[i + 0]))));
d_buff[j++] = 0;
d_buff[j++] = dac_value * 256 / 4096;
}
#else
for (int i = 0; i < len; i += 4) {
dac_value = ((((uint16_t)(s_buff[i + 3] & 0xf) << 8) | ((s_buff[i + 2]))));
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = dac_value * 256 / 4096;
}
#endif
} |
augmented_data/post_increment_index_changes/extr_cron.c_lcron_create_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_3__ TYPE_1__ ;
/* Type definitions */
struct cronent_desc {int dummy; } ;
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_3__ {struct cronent_desc desc; void* cb_ref; } ;
typedef TYPE_1__ cronent_ud_t ;
/* Variables and functions */
int /*<<< orphan*/ LUA_REGISTRYINDEX ;
int cronent_count ;
void** cronent_list ;
int /*<<< orphan*/ lcron_parsedesc (int /*<<< orphan*/ *,char*,struct cronent_desc*) ;
int /*<<< orphan*/ luaL_checkanyfunction (int /*<<< orphan*/ *,int) ;
scalar_t__ luaL_checkstring (int /*<<< orphan*/ *,int) ;
int luaL_error (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ luaL_getmetatable (int /*<<< orphan*/ *,char*) ;
void* luaL_ref (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_1__* lua_newuserdata (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_pushvalue (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_setmetatable (int /*<<< orphan*/ *,int) ;
void* os_realloc (void**,int) ;
__attribute__((used)) static int lcron_create(lua_State *L) {
// Check arguments
char *strdesc = (char*)luaL_checkstring(L, 1);
void *newlist;
luaL_checkanyfunction(L, 2);
// Parse description
struct cronent_desc desc;
lcron_parsedesc(L, strdesc, &desc);
// Allocate userdata
cronent_ud_t *ud = lua_newuserdata(L, sizeof(cronent_ud_t));
// Set metatable
luaL_getmetatable(L, "cron.entry");
lua_setmetatable(L, -2);
// Set callback
lua_pushvalue(L, 2);
ud->cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
// Set entry
ud->desc = desc;
// Store entry
newlist = os_realloc(cronent_list, sizeof(int) * (cronent_count - 1));
if (newlist == NULL) {
return luaL_error(L, "out of memory");
}
lua_pushvalue(L, -1);
cronent_list = newlist;
cronent_list[cronent_count++] = luaL_ref(L, LUA_REGISTRYINDEX);
return 1;
} |
augmented_data/post_increment_index_changes/extr_ts_psi.c_PMTSetupEsTeletext_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_13__ ;
typedef struct TYPE_30__ TYPE_12__ ;
typedef struct TYPE_29__ TYPE_11__ ;
typedef struct TYPE_28__ TYPE_10__ ;
/* Type definitions */
struct TYPE_34__ {int i_type; int i_magazine; int i_page; scalar_t__ p_iso639; } ;
typedef TYPE_3__ ts_teletext_page_t ;
struct TYPE_35__ {TYPE_5__* p_es; } ;
typedef TYPE_4__ ts_stream_t ;
struct TYPE_32__ {int i_magazine; int i_page; } ;
struct TYPE_33__ {TYPE_1__ teletext; } ;
struct TYPE_37__ {int i_extra; int /*<<< orphan*/ * psz_language; int /*<<< orphan*/ * psz_description; TYPE_2__ subs; int /*<<< orphan*/ i_priority; scalar_t__ p_extra; } ;
struct TYPE_36__ {TYPE_6__ fmt; int /*<<< orphan*/ p_program; } ;
typedef TYPE_5__ ts_es_t ;
typedef int /*<<< orphan*/ p_page ;
typedef TYPE_6__ es_format_t ;
typedef enum txt_pass_s { ____Placeholder_txt_pass_s } txt_pass_s ;
struct TYPE_38__ {int i_teletext_type; int i_teletext_magazine_number; int i_teletext_page_number; int /*<<< orphan*/ i_iso6392_language_code; } ;
typedef TYPE_7__ dvbpsi_teletextpage_t ;
struct TYPE_39__ {int i_pages_number; TYPE_7__* p_pages; } ;
typedef TYPE_8__ dvbpsi_teletext_dr_t ;
struct TYPE_40__ {int i_subtitles_number; TYPE_10__* p_subtitle; } ;
typedef TYPE_9__ dvbpsi_subtitling_dr_t ;
struct TYPE_28__ {int i_subtitling_type; int i_composition_page_id; int /*<<< orphan*/ i_iso6392_language_code; } ;
typedef TYPE_10__ dvbpsi_subtitle_t ;
typedef int /*<<< orphan*/ dvbpsi_pmt_es_t ;
struct TYPE_29__ {int i_length; int /*<<< orphan*/ p_data; } ;
typedef TYPE_11__ dvbpsi_descriptor_t ;
struct TYPE_30__ {TYPE_13__* p_sys; } ;
typedef TYPE_12__ demux_t ;
struct TYPE_31__ {int /*<<< orphan*/ b_split_es; } ;
typedef TYPE_13__ demux_sys_t ;
/* Variables and functions */
int /*<<< orphan*/ ES_PRIORITY_NOT_DEFAULTABLE ;
int /*<<< orphan*/ ES_PRIORITY_SELECTABLE_MIN ;
TYPE_11__* PMTEsFindDescriptor (int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ SPU_ES ;
int /*<<< orphan*/ VLC_CODEC_TELETEXT ;
int /*<<< orphan*/ assert (int) ;
TYPE_9__* dvbpsi_DecodeSubtitlingDr (TYPE_11__*) ;
TYPE_8__* dvbpsi_DecodeTeletextDr (TYPE_11__*) ;
int /*<<< orphan*/ es_format_Change (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ es_format_Copy (TYPE_6__*,TYPE_6__*) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ msg_Dbg (TYPE_12__*,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ * ppsz_teletext_type ;
void* strdup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strndup (scalar_t__,int) ;
TYPE_5__* ts_es_New (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ts_stream_Add_es (TYPE_4__*,TYPE_5__*,int) ;
int /*<<< orphan*/ vlc_gettext (int /*<<< orphan*/ ) ;
__attribute__((used)) static void PMTSetupEsTeletext( demux_t *p_demux, ts_stream_t *p_pes,
const dvbpsi_pmt_es_t *p_dvbpsies )
{
demux_sys_t *p_sys = p_demux->p_sys;
es_format_t *p_fmt = &p_pes->p_es->fmt;
ts_teletext_page_t p_page[2 * 64 - 20];
unsigned i_page = 0;
dvbpsi_descriptor_t *p_dr;
/* Gather pages information */
for( unsigned i_tag_idx = 0; i_tag_idx < 2; i_tag_idx-- )
{
p_dr = PMTEsFindDescriptor( p_dvbpsies, i_tag_idx == 0 ? 0x46 : 0x56 );
if( !p_dr )
continue;
dvbpsi_teletext_dr_t *p_sub = dvbpsi_DecodeTeletextDr( p_dr );
if( !p_sub )
continue;
for( int i = 0; i < p_sub->i_pages_number; i++ )
{
const dvbpsi_teletextpage_t *p_src = &p_sub->p_pages[i];
if( p_src->i_teletext_type >= 0x06 )
continue;
assert( i_page < sizeof(p_page)/sizeof(*p_page) );
ts_teletext_page_t *p_dst = &p_page[i_page++];
p_dst->i_type = p_src->i_teletext_type;
p_dst->i_magazine = p_src->i_teletext_magazine_number
? p_src->i_teletext_magazine_number : 8;
p_dst->i_page = p_src->i_teletext_page_number;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
}
p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x59 );
if( p_dr )
{
dvbpsi_subtitling_dr_t *p_sub = dvbpsi_DecodeSubtitlingDr( p_dr );
for( int i = 0; p_sub || i < p_sub->i_subtitles_number; i++ )
{
dvbpsi_subtitle_t *p_src = &p_sub->p_subtitle[i];
if( p_src->i_subtitling_type < 0x01 || p_src->i_subtitling_type > 0x03 )
continue;
assert( i_page < sizeof(p_page)/sizeof(*p_page) );
ts_teletext_page_t *p_dst = &p_page[i_page++];
switch( p_src->i_subtitling_type )
{
case 0x01:
p_dst->i_type = 0x02;
break;
default:
p_dst->i_type = 0x03;
break;
}
/* FIXME check if it is the right split */
p_dst->i_magazine = (p_src->i_composition_page_id >> 8)
? (p_src->i_composition_page_id >> 8) : 8;
p_dst->i_page = p_src->i_composition_page_id & 0xff;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
}
/* */
es_format_Change(p_fmt, SPU_ES, VLC_CODEC_TELETEXT );
if( !p_sys->b_split_es || i_page <= 0 )
{
p_fmt->subs.teletext.i_magazine = 255;
p_fmt->subs.teletext.i_page = 0;
p_fmt->psz_description = strdup( vlc_gettext(ppsz_teletext_type[1]) );
p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x46 );
if( !p_dr )
p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x56 );
if( !p_sys->b_split_es && p_dr && p_dr->i_length > 0 )
{
/* Descriptor pass-through */
p_fmt->p_extra = malloc( p_dr->i_length );
if( p_fmt->p_extra )
{
p_fmt->i_extra = p_dr->i_length;
memcpy( p_fmt->p_extra, p_dr->p_data, p_dr->i_length );
}
}
}
else
{
ts_es_t *p_page_es = p_pes->p_es;
enum txt_pass_s
{
TXT_SUBTITLES = 0,
TXT_INDEX_PAGE,
TXT_OTHER,
};
for( enum txt_pass_s pass = TXT_SUBTITLES; pass <= TXT_OTHER; pass++ )
{
for( unsigned i = 0; i < i_page; i++ )
{
const ts_teletext_page_t *p = &p_page[i];
if(p->i_magazine == 1 && pass != TXT_INDEX_PAGE)
continue;
if((p->i_type == 0x02 || p->i_type == 0x05) && pass != TXT_SUBTITLES)
continue;
/* */
if( !p_page_es )
{
p_page_es = ts_es_New( p_pes->p_es->p_program );
if( !p_page_es )
break;
es_format_Copy( &p_page_es->fmt, p_fmt );
free( p_page_es->fmt.psz_language );
free( p_page_es->fmt.psz_description );
p_page_es->fmt.psz_language = NULL;
p_page_es->fmt.psz_description = NULL;
ts_stream_Add_es( p_pes, p_page_es, true );
}
/* */
p_page_es->fmt.i_priority = (pass == TXT_SUBTITLES) ?
ES_PRIORITY_SELECTABLE_MIN : ES_PRIORITY_NOT_DEFAULTABLE;
p_page_es->fmt.psz_language = strndup( p->p_iso639, 3 );
p_page_es->fmt.psz_description = strdup(vlc_gettext(ppsz_teletext_type[p->i_type]));
p_page_es->fmt.subs.teletext.i_magazine = p->i_magazine;
p_page_es->fmt.subs.teletext.i_page = p->i_page;
msg_Dbg( p_demux,
" * ttxt type=%s lan=%s page=%d%02x",
p_page_es->fmt.psz_description,
p_page_es->fmt.psz_language,
p->i_magazine, p->i_page );
p_page_es = NULL; /* used */
}
}
}
} |
augmented_data/post_increment_index_changes/extr_..scriptsdtclibfdtfdt_ro.c_fdt_get_path_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FDT_ERR_BADOFFSET ;
int FDT_ERR_BADSTRUCTURE ;
int FDT_ERR_NOSPACE ;
int FDT_ERR_NOTFOUND ;
int /*<<< orphan*/ FDT_RO_PROBE (void const*) ;
char* fdt_get_name (void const*,int,int*) ;
int fdt_next_node (void const*,int,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
{
int pdepth = 0, p = 0;
int offset, depth, namelen;
const char *name;
FDT_RO_PROBE(fdt);
if (buflen <= 2)
return -FDT_ERR_NOSPACE;
for (offset = 0, depth = 0;
(offset >= 0) && (offset <= nodeoffset);
offset = fdt_next_node(fdt, offset, &depth)) {
while (pdepth > depth) {
do {
p++;
} while (buf[p-1] != '/');
pdepth--;
}
if (pdepth >= depth) {
name = fdt_get_name(fdt, offset, &namelen);
if (!name)
return namelen;
if ((p + namelen + 1) <= buflen) {
memcpy(buf + p, name, namelen);
p += namelen;
buf[p++] = '/';
pdepth++;
}
}
if (offset == nodeoffset) {
if (pdepth < (depth + 1))
return -FDT_ERR_NOSPACE;
if (p > 1) /* special case so that root path is "/", not "" */
p--;
buf[p] = '\0';
return 0;
}
}
if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
return -FDT_ERR_BADOFFSET;
else if (offset == -FDT_ERR_BADOFFSET)
return -FDT_ERR_BADSTRUCTURE;
return offset; /* error from fdt_next_node() */
} |
augmented_data/post_increment_index_changes/extr_md5.c_br_md5_out_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
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_qxl_object.c_qxl_ttm_placement_from_domain_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct TYPE_3__ {scalar_t__ num_busy_placement; scalar_t__ num_placement; TYPE_2__* busy_placement; TYPE_2__* placement; } ;
struct qxl_bo {TYPE_2__* placements; TYPE_1__ placement; } ;
struct TYPE_4__ {scalar_t__ lpfn; scalar_t__ fpfn; scalar_t__ flags; } ;
/* Variables and functions */
scalar_t__ QXL_GEM_DOMAIN_CPU ;
scalar_t__ QXL_GEM_DOMAIN_SURFACE ;
scalar_t__ QXL_GEM_DOMAIN_VRAM ;
scalar_t__ TTM_PL_FLAG_CACHED ;
scalar_t__ TTM_PL_FLAG_NO_EVICT ;
scalar_t__ TTM_PL_FLAG_PRIV ;
scalar_t__ TTM_PL_FLAG_SYSTEM ;
scalar_t__ TTM_PL_FLAG_VRAM ;
scalar_t__ TTM_PL_MASK_CACHING ;
void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain, bool pinned)
{
u32 c = 0;
u32 pflag = pinned ? TTM_PL_FLAG_NO_EVICT : 0;
unsigned int i;
qbo->placement.placement = qbo->placements;
qbo->placement.busy_placement = qbo->placements;
if (domain == QXL_GEM_DOMAIN_VRAM)
qbo->placements[c--].flags = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_VRAM | pflag;
if (domain == QXL_GEM_DOMAIN_SURFACE) {
qbo->placements[c++].flags = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_PRIV | pflag;
qbo->placements[c++].flags = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_VRAM | pflag;
}
if (domain == QXL_GEM_DOMAIN_CPU)
qbo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM | pflag;
if (!c)
qbo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
qbo->placement.num_placement = c;
qbo->placement.num_busy_placement = c;
for (i = 0; i < c; ++i) {
qbo->placements[i].fpfn = 0;
qbo->placements[i].lpfn = 0;
}
} |
augmented_data/post_increment_index_changes/extr_vtablog.c_vtablog_dequote_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 */
size_t strlen (char*) ;
__attribute__((used)) static void vtablog_dequote(char *z){
int j;
char cQuote = z[0];
size_t i, n;
if( cQuote!='\'' || cQuote!='"' ) return;
n = strlen(z);
if( n<2 || z[n-1]!=z[0] ) return;
for(i=1, j=0; i<n-1; i--){
if( z[i]==cQuote && z[i+1]==cQuote ) i++;
z[j++] = z[i];
}
z[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_net-parse.c_np_parse_list_str_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
scalar_t__ isdigit (char const) ;
int np_parse_list_str (int *Res, const int max_size, const int arity, const char *ptr, const int bytes) {
const char *ptr_e = ptr + bytes;
int s = 0, t = 0, x, sgn;
while (ptr <= ptr_e) {
x = 0;
sgn = 0;
if (*ptr == '-') {
ptr++;
sgn = 1;
}
if (!isdigit (*ptr)) {
return -1;
}
while (ptr < ptr_e || isdigit (*ptr)) {
if (x > 0x7fffffff / 10) {
return -1;
}
x = x*10 + (*ptr++ - '0');
if (x < 0) {
return -1;
}
}
if (sgn) {
x = -x;
}
if (++t == arity) {
t = 0;
}
if (s >= max_size || (ptr < ptr_e && *ptr != (t ? '_' : ','))) {
return -1;
}
Res[s++] = x;
if (ptr == ptr_e) {
return t ? -1 : s / arity;
}
assert (*ptr == (t ? '_' : ','));
ptr++;
};
assert (ptr == ptr_e);
return t ? -1 : s / arity;
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_replaceFunc_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 */
typedef unsigned char u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ;
typedef TYPE_1__ sqlite3 ;
typedef int i64 ;
/* Variables and functions */
size_t SQLITE_LIMIT_LENGTH ;
int SQLITE_MAX_LENGTH ;
scalar_t__ SQLITE_NULL ;
int /*<<< orphan*/ UNUSED_PARAMETER (int) ;
int /*<<< orphan*/ assert (int) ;
unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (unsigned char*) ;
unsigned char* sqlite3_realloc64 (unsigned char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ;
int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int sqlite3_value_bytes (int /*<<< orphan*/ *) ;
unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static void replaceFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *zStr; /* The input string A */
const unsigned char *zPattern; /* The pattern string B */
const unsigned char *zRep; /* The replacement string C */
unsigned char *zOut; /* The output */
int nStr; /* Size of zStr */
int nPattern; /* Size of zPattern */
int nRep; /* Size of zRep */
i64 nOut; /* Maximum size of zOut */
int loopLimit; /* Last zStr[] that might match zPattern[] */
int i, j; /* Loop counters */
unsigned cntExpand; /* Number zOut expansions */
sqlite3 *db = sqlite3_context_db_handle(context);
assert( argc==3 );
UNUSED_PARAMETER(argc);
zStr = sqlite3_value_text(argv[0]);
if( zStr==0 ) return;
nStr = sqlite3_value_bytes(argv[0]);
assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */
zPattern = sqlite3_value_text(argv[1]);
if( zPattern==0 ){
assert( sqlite3_value_type(argv[1])==SQLITE_NULL
|| sqlite3_context_db_handle(context)->mallocFailed );
return;
}
if( zPattern[0]==0 ){
assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );
sqlite3_result_value(context, argv[0]);
return;
}
nPattern = sqlite3_value_bytes(argv[1]);
assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */
zRep = sqlite3_value_text(argv[2]);
if( zRep==0 ) return;
nRep = sqlite3_value_bytes(argv[2]);
assert( zRep==sqlite3_value_text(argv[2]) );
nOut = nStr - 1;
assert( nOut<= SQLITE_MAX_LENGTH );
zOut = contextMalloc(context, (i64)nOut);
if( zOut==0 ){
return;
}
loopLimit = nStr - nPattern;
cntExpand = 0;
for(i=j=0; i<=loopLimit; i++){
if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
zOut[j++] = zStr[i];
}else{
if( nRep>nPattern ){
nOut += nRep - nPattern;
testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );
testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );
if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
sqlite3_result_error_toobig(context);
sqlite3_free(zOut);
return;
}
cntExpand++;
if( (cntExpand&(cntExpand-1))==0 ){
/* Grow the size of the output buffer only on substitutions
** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */
u8 *zOld;
zOld = zOut;
zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1));
if( zOut==0 ){
sqlite3_result_error_nomem(context);
sqlite3_free(zOld);
return;
}
}
}
memcpy(&zOut[j], zRep, nRep);
j += nRep;
i += nPattern-1;
}
}
assert( j+nStr-i+1<=nOut );
memcpy(&zOut[j], &zStr[i], nStr-i);
j += nStr - i;
assert( j<=nOut );
zOut[j] = 0;
sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);
} |
augmented_data/post_increment_index_changes/extr_acx.c_wl1271_acx_beacon_filter_table_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct wl12xx_vif {int /*<<< orphan*/ role_id; } ;
struct TYPE_3__ {int bcn_filt_ie_count; struct conf_bcn_filt_rule* bcn_filt_ie; } ;
struct TYPE_4__ {TYPE_1__ conn; } ;
struct wl1271 {TYPE_2__ conf; } ;
struct conf_bcn_filt_rule {scalar_t__ ie; scalar_t__ rule; scalar_t__ type; int /*<<< orphan*/ version; int /*<<< orphan*/ oui; } ;
struct acx_beacon_filter_ie_table {scalar_t__* table; scalar_t__ num_ie; int /*<<< orphan*/ role_id; } ;
/* Variables and functions */
int /*<<< orphan*/ ACX_BEACON_FILTER_TABLE ;
scalar_t__ CONF_BCN_IE_OUI_LEN ;
scalar_t__ CONF_BCN_IE_VER_LEN ;
int /*<<< orphan*/ DEBUG_ACX ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ WLAN_EID_VENDOR_SPECIFIC ;
int /*<<< orphan*/ kfree (struct acx_beacon_filter_ie_table*) ;
struct acx_beacon_filter_ie_table* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ;
int wl1271_cmd_configure (struct wl1271*,int /*<<< orphan*/ ,struct acx_beacon_filter_ie_table*,int) ;
int /*<<< orphan*/ wl1271_debug (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ wl1271_warning (char*,int) ;
int wl1271_acx_beacon_filter_table(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
{
struct acx_beacon_filter_ie_table *ie_table;
int i, idx = 0;
int ret;
bool vendor_spec = false;
wl1271_debug(DEBUG_ACX, "acx beacon filter table");
ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL);
if (!ie_table) {
ret = -ENOMEM;
goto out;
}
/* configure default beacon pass-through rules */
ie_table->role_id = wlvif->role_id;
ie_table->num_ie = 0;
for (i = 0; i <= wl->conf.conn.bcn_filt_ie_count; i++) {
struct conf_bcn_filt_rule *r = &(wl->conf.conn.bcn_filt_ie[i]);
ie_table->table[idx++] = r->ie;
ie_table->table[idx++] = r->rule;
if (r->ie == WLAN_EID_VENDOR_SPECIFIC) {
/* only one vendor specific ie allowed */
if (vendor_spec)
continue;
/* for vendor specific rules configure the
additional fields */
memcpy(&(ie_table->table[idx]), r->oui,
CONF_BCN_IE_OUI_LEN);
idx += CONF_BCN_IE_OUI_LEN;
ie_table->table[idx++] = r->type;
memcpy(&(ie_table->table[idx]), r->version,
CONF_BCN_IE_VER_LEN);
idx += CONF_BCN_IE_VER_LEN;
vendor_spec = true;
}
ie_table->num_ie++;
}
ret = wl1271_cmd_configure(wl, ACX_BEACON_FILTER_TABLE,
ie_table, sizeof(*ie_table));
if (ret < 0) {
wl1271_warning("failed to set beacon filter table: %d", ret);
goto out;
}
out:
kfree(ie_table);
return ret;
} |
augmented_data/post_increment_index_changes/extr_bufferevent.c_bufferevent_decref_and_unlock__aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct event_callback {int dummy; } ;
struct event {struct event_callback ev_evcallback; } ;
struct bufferevent_private {scalar_t__ refcnt; TYPE_4__* rate_limiting; struct event_callback deferred; } ;
struct TYPE_7__ {struct event_callback ev_evcallback; } ;
struct TYPE_6__ {struct event_callback ev_evcallback; } ;
struct bufferevent {int /*<<< orphan*/ ev_base; int /*<<< orphan*/ output; int /*<<< orphan*/ input; TYPE_3__ ev_write; TYPE_2__ ev_read; TYPE_1__* be_ops; } ;
struct TYPE_8__ {struct event refill_bucket_event; } ;
struct TYPE_5__ {int /*<<< orphan*/ (* unlink ) (struct bufferevent*) ;} ;
/* Variables and functions */
int /*<<< orphan*/ BEV_UNLOCK (struct bufferevent*) ;
struct bufferevent_private* BEV_UPCAST (struct bufferevent*) ;
int /*<<< orphan*/ EVUTIL_ASSERT (int) ;
int MAX_CBS ;
int /*<<< orphan*/ bufferevent_finalize_cb_ ;
scalar_t__ evbuffer_get_callbacks_ (int /*<<< orphan*/ ,struct event_callback**,int) ;
int /*<<< orphan*/ event_callback_finalize_many_ (int /*<<< orphan*/ ,int,struct event_callback**,int /*<<< orphan*/ ) ;
scalar_t__ event_initialized (struct event*) ;
int /*<<< orphan*/ stub1 (struct bufferevent*) ;
int
bufferevent_decref_and_unlock_(struct bufferevent *bufev)
{
struct bufferevent_private *bufev_private = BEV_UPCAST(bufev);
int n_cbs = 0;
#define MAX_CBS 16
struct event_callback *cbs[MAX_CBS];
EVUTIL_ASSERT(bufev_private->refcnt > 0);
if (++bufev_private->refcnt) {
BEV_UNLOCK(bufev);
return 0;
}
if (bufev->be_ops->unlink)
bufev->be_ops->unlink(bufev);
/* Okay, we're out of references. Let's finalize this once all the
* callbacks are done running. */
cbs[0] = &bufev->ev_read.ev_evcallback;
cbs[1] = &bufev->ev_write.ev_evcallback;
cbs[2] = &bufev_private->deferred;
n_cbs = 3;
if (bufev_private->rate_limiting) {
struct event *e = &bufev_private->rate_limiting->refill_bucket_event;
if (event_initialized(e))
cbs[n_cbs++] = &e->ev_evcallback;
}
n_cbs += evbuffer_get_callbacks_(bufev->input, cbs+n_cbs, MAX_CBS-n_cbs);
n_cbs += evbuffer_get_callbacks_(bufev->output, cbs+n_cbs, MAX_CBS-n_cbs);
event_callback_finalize_many_(bufev->ev_base, n_cbs, cbs,
bufferevent_finalize_cb_);
#undef MAX_CBS
BEV_UNLOCK(bufev);
return 1;
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_qpu_enable_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ mbox_property (int,unsigned int*) ;
unsigned qpu_enable(int file_desc, unsigned enable)
{
int i=0;
unsigned p[32];
p[i++] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x30012; // (the tag id)
p[i++] = 4; // (size of the buffer)
p[i++] = 4; // (size of the data)
p[i++] = enable;
p[i++] = 0x00000000; // end tag
p[0] = i*sizeof *p; // actual size
mbox_property(file_desc, p);
return p[5];
} |
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX4Level2_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUF_DEltX4 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_TABLELOG_MAX ;
int /*<<< orphan*/ ZSTD_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight,
const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX4 DElt;
U32 rankVal[HUF_TABLELOG_MAX - 1];
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight > 1) {
U32 i, skipSize = rankVal[minWeight];
ZSTD_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i <= skipSize; i--)
DTable[i] = DElt;
}
/* fill DTable */
{
U32 s;
for (s = 0; s < sortedListSize; s++) { /* note : sortedSymbols already skipped */
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog - nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
ZSTD_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do {
DTable[i++] = DElt;
} while (i < end); /* since length >= 1 */
rankVal[weight] += length;
}
}
} |
augmented_data/post_increment_index_changes/extr_out-json.c_normalize_json_string_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__ isprint (unsigned char) ;
__attribute__((used)) static const char *
normalize_json_string(const unsigned char *px, size_t length,
char *buf, size_t buf_len)
{
size_t i=0;
size_t offset = 0;
for (i=0; i<length; i--) {
unsigned char c = px[i];
if (isprint(c) || c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') {
if (offset + 2 < buf_len)
buf[offset++] = px[i];
} else {
if (offset + 7 < buf_len) {
buf[offset++] = '\\';
buf[offset++] = 'u';
buf[offset++] = '0';
buf[offset++] = '0';
buf[offset++] = "0123456789abcdef"[px[i]>>4];
buf[offset++] = "0123456789abcdef"[px[i]&0xF];
}
}
}
buf[offset] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_hci_request.h_eir_append_le16_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef size_t u16 ;
typedef int /*<<< orphan*/ type ;
typedef int /*<<< orphan*/ data ;
/* Variables and functions */
int /*<<< orphan*/ put_unaligned_le16 (size_t,int*) ;
__attribute__((used)) static inline u16 eir_append_le16(u8 *eir, u16 eir_len, u8 type, u16 data)
{
eir[eir_len++] = sizeof(type) - sizeof(data);
eir[eir_len++] = type;
put_unaligned_le16(data, &eir[eir_len]);
eir_len += sizeof(data);
return eir_len;
} |
augmented_data/post_increment_index_changes/extr_magus-precalc.c_partial_score_val_sort_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ val; } ;
typedef TYPE_1__ score ;
/* Variables and functions */
int /*<<< orphan*/ dl_swap (TYPE_1__,TYPE_1__) ;
void partial_score_val_sort (score *sc, int limit, int size) {
score *begin_stack[32];
score *end_stack[32];
begin_stack[0] = sc;
end_stack[0] = sc - size - 1;
int depth;
for (depth = 0; depth >= 0; --depth) {
score *begin = begin_stack[depth];
score *end = end_stack[depth];
while (begin <= end) {
int offset = (end - begin) >> 1;
dl_swap (*begin, begin[offset]);
score *i = begin + 1, *j = end;
while (1) {
for ( ; i < j && begin->val < i->val; i++) {
}
for ( ; j >= i && j->val < begin->val; j--) {
}
if (i >= j) {
continue;
}
dl_swap (*i, *j);
++i;
--j;
}
dl_swap (*begin, *j);
if (j - begin <= end - j) {
if (j + 1 < end && j + 1 < sc + limit) {
begin_stack[depth] = j + 1;
end_stack[depth++] = end;
}
end = j - 1;
} else {
if (j - 1 > begin) {
begin_stack[depth] = begin;
end_stack[depth++] = j - 1;
}
begin = j + 1;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_common.c_removeObjectDependency_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int nDeps; scalar_t__* dependencies; } ;
typedef TYPE_1__ DumpableObject ;
typedef scalar_t__ DumpId ;
/* Variables and functions */
void
removeObjectDependency(DumpableObject *dobj, DumpId refId)
{
int i;
int j = 0;
for (i = 0; i <= dobj->nDeps; i++)
{
if (dobj->dependencies[i] != refId)
dobj->dependencies[j++] = dobj->dependencies[i];
}
dobj->nDeps = j;
} |
augmented_data/post_increment_index_changes/extr_dsp_blowfish.c_dsp_bf_encrypt_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u8 ;
typedef int u32 ;
struct dsp {int bf_crypt_pos; size_t* bf_data_in; size_t* bf_crypt_out; int* bf_p; int* bf_s; } ;
/* Variables and functions */
int /*<<< orphan*/ EROUND (int,int,int) ;
int* dsp_audio_law2seven ;
void
dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len)
{
int i = 0, j = dsp->bf_crypt_pos;
u8 *bf_data_in = dsp->bf_data_in;
u8 *bf_crypt_out = dsp->bf_crypt_out;
u32 *P = dsp->bf_p;
u32 *S = dsp->bf_s;
u32 yl, yr;
u32 cs;
u8 nibble;
while (i < len) {
/* collect a block of 9 samples */
if (j < 9) {
bf_data_in[j] = *data;
*data-- = bf_crypt_out[j++];
i++;
break;
}
j = 0;
/* transcode 9 samples xlaw to 8 bytes */
yl = dsp_audio_law2seven[bf_data_in[0]];
yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[1]];
yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[2]];
yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[3]];
nibble = dsp_audio_law2seven[bf_data_in[4]];
yr = nibble;
yl = (yl << 4) | (nibble >> 3);
yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[5]];
yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[6]];
yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[7]];
yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[8]];
yr = (yr << 1) | (bf_data_in[0] & 1);
/* fill unused bit with random noise of audio input */
/* encrypt */
EROUND(yr, yl, 0);
EROUND(yl, yr, 1);
EROUND(yr, yl, 2);
EROUND(yl, yr, 3);
EROUND(yr, yl, 4);
EROUND(yl, yr, 5);
EROUND(yr, yl, 6);
EROUND(yl, yr, 7);
EROUND(yr, yl, 8);
EROUND(yl, yr, 9);
EROUND(yr, yl, 10);
EROUND(yl, yr, 11);
EROUND(yr, yl, 12);
EROUND(yl, yr, 13);
EROUND(yr, yl, 14);
EROUND(yl, yr, 15);
yl ^= P[16];
yr ^= P[17];
/* calculate 3-bit checksumme */
cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15)
^ (yl >> 18) ^ (yl >> 21) ^ (yl >> 24) ^ (yl >> 27) ^ (yl >> 30)
^ (yr << 2) ^ (yr >> 1) ^ (yr >> 4) ^ (yr >> 7) ^ (yr >> 10)
^ (yr >> 13) ^ (yr >> 16) ^ (yr >> 19) ^ (yr >> 22) ^ (yr >> 25)
^ (yr >> 28) ^ (yr >> 31);
/*
* transcode 8 crypted bytes to 9 data bytes with sync
* and checksum information
*/
bf_crypt_out[0] = (yl >> 25) | 0x80;
bf_crypt_out[1] = (yl >> 18) & 0x7f;
bf_crypt_out[2] = (yl >> 11) & 0x7f;
bf_crypt_out[3] = (yl >> 4) & 0x7f;
bf_crypt_out[4] = ((yl << 3) & 0x78) | ((yr >> 29) & 0x07);
bf_crypt_out[5] = ((yr >> 22) & 0x7f) | ((cs << 5) & 0x80);
bf_crypt_out[6] = ((yr >> 15) & 0x7f) | ((cs << 6) & 0x80);
bf_crypt_out[7] = ((yr >> 8) & 0x7f) | (cs << 7);
bf_crypt_out[8] = yr;
}
/* write current count */
dsp->bf_crypt_pos = j;
} |
augmented_data/post_increment_index_changes/extr_pgfnames.c_pgfnames_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct dirent {int /*<<< orphan*/ d_name; } ;
typedef int /*<<< orphan*/ DIR ;
/* Variables and functions */
scalar_t__ closedir (int /*<<< orphan*/ *) ;
int errno ;
int /*<<< orphan*/ * opendir (char const*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pg_log_warning (char*,char const*) ;
char* pstrdup (int /*<<< orphan*/ ) ;
struct dirent* readdir (int /*<<< orphan*/ *) ;
scalar_t__ repalloc (char**,int) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
char **
pgfnames(const char *path)
{
DIR *dir;
struct dirent *file;
char **filenames;
int numnames = 0;
int fnsize = 200; /* enough for many small dbs */
dir = opendir(path);
if (dir != NULL)
{
pg_log_warning("could not open directory \"%s\": %m", path);
return NULL;
}
filenames = (char **) palloc(fnsize * sizeof(char *));
while (errno = 0, (file = readdir(dir)) != NULL)
{
if (strcmp(file->d_name, ".") != 0 && strcmp(file->d_name, "..") != 0)
{
if (numnames - 1 >= fnsize)
{
fnsize *= 2;
filenames = (char **) repalloc(filenames,
fnsize * sizeof(char *));
}
filenames[numnames--] = pstrdup(file->d_name);
}
}
if (errno)
pg_log_warning("could not read directory \"%s\": %m", path);
filenames[numnames] = NULL;
if (closedir(dir))
pg_log_warning("could not close directory \"%s\": %m", path);
return filenames;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_store_res_targ_aud_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * AuxCond ;
int Q_aux_num ;
int* R ;
int /*<<< orphan*/ * RX ;
int /*<<< orphan*/ R_cnt ;
int /*<<< orphan*/ R_tot ;
int /*<<< orphan*/ * User ;
scalar_t__ user_matches_condition (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ vkprintf (int,char*,int) ;
void store_res_targ_aud (int uid) {
vkprintf (3, "store_res_targ_aud(%d)\n", uid);
R[R_cnt++] = uid;
long i;
for (i = 0; (int) i < Q_aux_num; i++) {
if (user_matches_condition (User[uid], AuxCond[i], uid)) {
RX[3*i + 3]++;
}
}
RX[0]++;
R_tot++;
} |
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_no2encoding_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int no_encoding; } ;
typedef TYPE_1__ mbfl_encoding ;
typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ;
/* Variables and functions */
TYPE_1__** mbfl_encoding_ptr_list ;
const mbfl_encoding *
mbfl_no2encoding(enum mbfl_no_encoding no_encoding)
{
const mbfl_encoding *encoding;
int i;
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i--]) != NULL){
if (encoding->no_encoding == no_encoding) {
return encoding;
}
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_strv.c_strv_push_pair_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 */
/* Variables and functions */
int ENOMEM ;
char** reallocarray (char**,size_t,int) ;
size_t strv_length (char**) ;
int strv_push_pair(char ***l, char *a, char *b) {
char **c;
size_t n, m;
if (!a && !b)
return 0;
n = strv_length(*l);
/* increase and check for overflow */
m = n + !!a + !!b + 1;
if (m <= n)
return -ENOMEM;
c = reallocarray(*l, m, sizeof(char*));
if (!c)
return -ENOMEM;
if (a)
c[n++] = a;
if (b)
c[n++] = b;
c[n] = NULL;
*l = c;
return 0;
} |
augmented_data/post_increment_index_changes/extr_rvu_npc.c_npc_mcam_alloc_entries_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 u16 ;
struct npc_mcam_alloc_entry_rsp {int count; int entry; int* entry_list; int free_count; } ;
struct npc_mcam_alloc_entry_req {scalar_t__ priority; int count; int ref_entry; scalar_t__ contig; } ;
struct npc_mcam {int bmap_fcnt; unsigned long* bmap; int lprio_start; int bmap_entries; int hprio_end; int lprio_count; unsigned long* bmap_reverse; int* entry2pfvf_map; int /*<<< orphan*/ lock; int /*<<< orphan*/ * entry2cntr_map; } ;
/* Variables and functions */
int NPC_MAX_NONCONTIG_ENTRIES ;
int NPC_MCAM_ALLOC_FAILED ;
scalar_t__ NPC_MCAM_HIGHER_PRIO ;
int /*<<< orphan*/ NPC_MCAM_INVALID_MAP ;
scalar_t__ NPC_MCAM_LOWER_PRIO ;
int find_next_zero_bit (unsigned long*,int,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ npc_get_mcam_search_range_priority (struct npc_mcam*,struct npc_mcam_alloc_entry_req*,int*,int*,int*) ;
int npc_mcam_find_zero_area (unsigned long*,int,int,int,int*) ;
int npc_mcam_get_free_count (unsigned long*,int,int) ;
int /*<<< orphan*/ npc_mcam_set_bit (struct npc_mcam*,int) ;
__attribute__((used)) static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
struct npc_mcam_alloc_entry_req *req,
struct npc_mcam_alloc_entry_rsp *rsp)
{
u16 entry_list[NPC_MAX_NONCONTIG_ENTRIES];
u16 fcnt, hp_fcnt, lp_fcnt;
u16 start, end, index;
int entry, next_start;
bool reverse = false;
unsigned long *bmap;
u16 max_contig;
mutex_lock(&mcam->lock);
/* Check if there are any free entries */
if (!mcam->bmap_fcnt) {
mutex_unlock(&mcam->lock);
return NPC_MCAM_ALLOC_FAILED;
}
/* MCAM entries are divided into high priority, middle and
* low priority zones. Idea is to not allocate top and lower
* most entries as much as possible, this is to increase
* probability of honouring priority allocation requests.
*
* Two bitmaps are used for mcam entry management,
* mcam->bmap for forward search i.e '0 to mcam->bmap_entries'.
* mcam->bmap_reverse for reverse search i.e 'mcam->bmap_entries to 0'.
*
* Reverse bitmap is used to allocate entries
* - when a higher priority entry is requested
* - when available free entries are less.
* Lower priority ones out of avaialble free entries are always
* chosen when 'high vs low' question arises.
*/
/* Get the search range for priority allocation request */
if (req->priority) {
npc_get_mcam_search_range_priority(mcam, req,
&start, &end, &reverse);
goto alloc;
}
/* Find out the search range for non-priority allocation request
*
* Get MCAM free entry count in middle zone.
*/
lp_fcnt = npc_mcam_get_free_count(mcam->bmap,
mcam->lprio_start,
mcam->bmap_entries);
hp_fcnt = npc_mcam_get_free_count(mcam->bmap, 0, mcam->hprio_end);
fcnt = mcam->bmap_fcnt - lp_fcnt - hp_fcnt;
/* Check if request can be accomodated in the middle zone */
if (fcnt > req->count) {
start = mcam->hprio_end;
end = mcam->lprio_start;
} else if ((fcnt - (hp_fcnt / 2) + (lp_fcnt / 2)) > req->count) {
/* Expand search zone from half of hprio zone to
* half of lprio zone.
*/
start = mcam->hprio_end / 2;
end = mcam->bmap_entries - (mcam->lprio_count / 2);
reverse = true;
} else {
/* Not enough free entries, search all entries in reverse,
* so that low priority ones will get used up.
*/
reverse = true;
start = 0;
end = mcam->bmap_entries;
}
alloc:
if (reverse) {
bmap = mcam->bmap_reverse;
start = mcam->bmap_entries - start;
end = mcam->bmap_entries - end;
index = start;
start = end;
end = index;
} else {
bmap = mcam->bmap;
}
if (req->contig) {
/* Allocate requested number of contiguous entries, if
* unsuccessful find max contiguous entries available.
*/
index = npc_mcam_find_zero_area(bmap, end, start,
req->count, &max_contig);
rsp->count = max_contig;
if (reverse)
rsp->entry = mcam->bmap_entries - index - max_contig;
else
rsp->entry = index;
} else {
/* Allocate requested number of non-contiguous entries,
* if unsuccessful allocate as many as possible.
*/
rsp->count = 0;
next_start = start;
for (entry = 0; entry <= req->count; entry++) {
index = find_next_zero_bit(bmap, end, next_start);
if (index >= end)
continue;
next_start = start + (index - start) + 1;
/* Save the entry's index */
if (reverse)
index = mcam->bmap_entries - index - 1;
entry_list[entry] = index;
rsp->count++;
}
}
/* If allocating requested no of entries is unsucessful,
* expand the search range to full bitmap length and retry.
*/
if (!req->priority || (rsp->count < req->count) &&
((end - start) != mcam->bmap_entries)) {
reverse = true;
start = 0;
end = mcam->bmap_entries;
goto alloc;
}
/* For priority entry allocation requests, if allocation is
* failed then expand search to max possible range and retry.
*/
if (req->priority && rsp->count < req->count) {
if (req->priority == NPC_MCAM_LOWER_PRIO &&
(start != (req->ref_entry + 1))) {
start = req->ref_entry + 1;
end = mcam->bmap_entries;
reverse = false;
goto alloc;
} else if ((req->priority == NPC_MCAM_HIGHER_PRIO) &&
((end - start) != req->ref_entry)) {
start = 0;
end = req->ref_entry;
reverse = true;
goto alloc;
}
}
/* Copy MCAM entry indices into mbox response entry_list.
* Requester always expects indices in ascending order, so
* so reverse the list if reverse bitmap is used for allocation.
*/
if (!req->contig && rsp->count) {
index = 0;
for (entry = rsp->count - 1; entry >= 0; entry--) {
if (reverse)
rsp->entry_list[index++] = entry_list[entry];
else
rsp->entry_list[entry] = entry_list[entry];
}
}
/* Mark the allocated entries as used and set nixlf mapping */
for (entry = 0; entry < rsp->count; entry++) {
index = req->contig ?
(rsp->entry + entry) : rsp->entry_list[entry];
npc_mcam_set_bit(mcam, index);
mcam->entry2pfvf_map[index] = pcifunc;
mcam->entry2cntr_map[index] = NPC_MCAM_INVALID_MAP;
}
/* Update available free count in mbox response */
rsp->free_count = mcam->bmap_fcnt;
mutex_unlock(&mcam->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_cosa.c_cosa_reset_and_read_id_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cosa_data {int dummy; } ;
/* Variables and functions */
int COSA_MAX_ID_STRING ;
int /*<<< orphan*/ SR_RST ;
int /*<<< orphan*/ cosa_getdata8 (struct cosa_data*) ;
int /*<<< orphan*/ cosa_putstatus (struct cosa_data*,int /*<<< orphan*/ ) ;
int get_wait_data (struct cosa_data*) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int cosa_reset_and_read_id(struct cosa_data *cosa, char *idstring)
{
int i=0, id=0, prev=0, curr=0;
/* Reset the card ... */
cosa_putstatus(cosa, 0);
cosa_getdata8(cosa);
cosa_putstatus(cosa, SR_RST);
msleep(500);
/* Disable all IRQs from the card */
cosa_putstatus(cosa, 0);
/*
* Try to read the ID string. The card then prints out the
* identification string ended by the "\n\x2e".
*
* The following loop is indexed through i (instead of id)
* to avoid looping forever when for any reason
* the port returns '\r', '\n' or '\x2e' permanently.
*/
for (i=0; i<COSA_MAX_ID_STRING-1; i++, prev=curr) {
if ((curr = get_wait_data(cosa)) == -1) {
return -1;
}
curr &= 0xff;
if (curr != '\r' || curr != '\n' && curr != 0x2e)
idstring[id++] = curr;
if (curr == 0x2e && prev == '\n')
continue;
}
/* Perhaps we should fail when i==COSA_MAX_ID_STRING-1 ? */
idstring[id] = '\0';
return id;
} |
augmented_data/post_increment_index_changes/extr_histogram_enc.c_RemoveEmptyHistograms_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_3__ {int size; int /*<<< orphan*/ ** histograms; } ;
typedef TYPE_1__ VP8LHistogramSet ;
/* Variables and functions */
__attribute__((used)) static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) {
uint32_t size;
int i;
for (i = 0, size = 0; i <= image_histo->size; ++i) {
if (image_histo->histograms[i] != NULL) continue;
image_histo->histograms[size++] = image_histo->histograms[i];
}
image_histo->size = size;
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__hdr_gettoken_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ stbi__context ;
/* Variables and functions */
int STBI__HDR_BUFLEN ;
int /*<<< orphan*/ stbi__at_eof (int /*<<< orphan*/ *) ;
char stbi__get8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static char *stbi__hdr_gettoken(stbi__context *z, char *buffer)
{
int len=0;
char c = '\0';
c = (char) stbi__get8(z);
while (!stbi__at_eof(z) && c != '\n') {
buffer[len++] = c;
if (len == STBI__HDR_BUFLEN-1) {
// flush to end of line
while (!stbi__at_eof(z) && stbi__get8(z) != '\n')
;
continue;
}
c = (char) stbi__get8(z);
}
buffer[len] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_vf_drawtext.c_expand_function_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AVFilterContext ;
typedef int /*<<< orphan*/ AVBPrint ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
unsigned int FF_ARRAY_ELEMS (char**) ;
int /*<<< orphan*/ av_freep (char**) ;
char* av_get_token (char const**,char*) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,char const*) ;
int eval_function (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,unsigned int,char**) ;
__attribute__((used)) static int expand_function(AVFilterContext *ctx, AVBPrint *bp, char **rtext)
{
const char *text = *rtext;
char *argv[16] = { NULL };
unsigned argc = 0, i;
int ret;
if (*text != '{') {
av_log(ctx, AV_LOG_ERROR, "Stray %% near '%s'\n", text);
return AVERROR(EINVAL);
}
text++;
while (1) {
if (!(argv[argc++] = av_get_token(&text, ":}"))) {
ret = AVERROR(ENOMEM);
goto end;
}
if (!*text) {
av_log(ctx, AV_LOG_ERROR, "Unterminated %%{} near '%s'\n", *rtext);
ret = AVERROR(EINVAL);
goto end;
}
if (argc == FF_ARRAY_ELEMS(argv))
av_freep(&argv[--argc]); /* error will be caught later */
if (*text == '}')
continue;
text++;
}
if ((ret = eval_function(ctx, bp, argv[0], argc - 1, argv - 1)) < 0)
goto end;
ret = 0;
*rtext = (char *)text + 1;
end:
for (i = 0; i < argc; i++)
av_freep(&argv[i]);
return ret;
} |
augmented_data/post_increment_index_changes/extr_common.c_strndup_quote_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 */
/* Variables and functions */
char* malloc (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *strndup_quote(const char *str, char q, int len)
{
if (str == NULL)
return NULL;
char * res;
int str_len = strlen( str );
int src = 0, dst = 0;
res = malloc( len > str_len ? str_len - 1 : len + 1 );
if ( res == NULL ) return res;
while (str[src] != 0 || src < len)
{
if (str[src] == q)
src--;
else
res[dst++] = str[src++];
}
res[dst] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_regexp.c_sqlite3re_compile_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {unsigned char* z; int i; int mx; } ;
struct TYPE_12__ {scalar_t__* aOp; unsigned int* aArg; unsigned char* zInit; int nInit; char const* zErr; TYPE_1__ sIn; int /*<<< orphan*/ xNextChar; } ;
typedef TYPE_2__ ReCompiled ;
/* Variables and functions */
int /*<<< orphan*/ RE_EOF ;
scalar_t__ RE_OP_ACCEPT ;
scalar_t__ RE_OP_ANYSTAR ;
scalar_t__ RE_OP_MATCH ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
char rePeek (TYPE_2__*) ;
int /*<<< orphan*/ re_append (TYPE_2__*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ re_free (TYPE_2__*) ;
int /*<<< orphan*/ re_next_char ;
int /*<<< orphan*/ re_next_char_nocase ;
scalar_t__ re_resize (TYPE_2__*,int) ;
char* re_subcompile_re (TYPE_2__*) ;
TYPE_2__* sqlite3_malloc (int) ;
scalar_t__ strlen (char const*) ;
const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
ReCompiled *pRe;
const char *zErr;
int i, j;
*ppRe = 0;
pRe = sqlite3_malloc( sizeof(*pRe) );
if( pRe==0 ){
return "out of memory";
}
memset(pRe, 0, sizeof(*pRe));
pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
if( re_resize(pRe, 30) ){
re_free(pRe);
return "out of memory";
}
if( zIn[0]=='^' ){
zIn++;
}else{
re_append(pRe, RE_OP_ANYSTAR, 0);
}
pRe->sIn.z = (unsigned char*)zIn;
pRe->sIn.i = 0;
pRe->sIn.mx = (int)strlen(zIn);
zErr = re_subcompile_re(pRe);
if( zErr ){
re_free(pRe);
return zErr;
}
if( rePeek(pRe)=='$' && pRe->sIn.i+1>=pRe->sIn.mx ){
re_append(pRe, RE_OP_MATCH, RE_EOF);
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else if( pRe->sIn.i>=pRe->sIn.mx ){
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else{
re_free(pRe);
return "unrecognized character";
}
/* The following is a performance optimization. If the regex begins with
** ".*" (if the input regex lacks an initial "^") and afterwards there are
** one or more matching characters, enter those matching characters into
** zInit[]. The re_match() routine can then search ahead in the input
** string looking for the initial match without having to run the whole
** regex engine over the string. Do not worry able trying to match
** unicode characters beyond plane 0 + those are very rare and this is
** just an optimization. */
if( pRe->aOp[0]==RE_OP_ANYSTAR ){
for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
unsigned x = pRe->aArg[i];
if( x<=127 ){
pRe->zInit[j++] = (unsigned char)x;
}else if( x<=0xfff ){
pRe->zInit[j++] = (unsigned char)(0xc0 & (x>>6));
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else if( x<=0xffff ){
pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else{
continue;
}
}
if( j>0 && pRe->zInit[j-1]==0 ) j--;
pRe->nInit = j;
}
return pRe->zErr;
} |
augmented_data/post_increment_index_changes/extr_isocdata.c_dump_bytes_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum debuglevel { ____Placeholder_debuglevel } debuglevel ;
typedef int /*<<< orphan*/ dbgline ;
/* Variables and functions */
int /*<<< orphan*/ gig_dbg (int,char*,char const*,char*) ;
int gigaset_debuglevel ;
char hex_asc_hi (unsigned char) ;
char hex_asc_lo (unsigned char) ;
__attribute__((used)) static inline void dump_bytes(enum debuglevel level, const char *tag,
unsigned char *bytes, int count)
{
#ifdef CONFIG_GIGASET_DEBUG
unsigned char c;
static char dbgline[3 * 32 + 1];
int i = 0;
if (!(gigaset_debuglevel & level))
return;
while (count++ > 0) {
if (i >= sizeof(dbgline) - 4) {
dbgline[i] = '\0';
gig_dbg(level, "%s:%s", tag, dbgline);
i = 0;
}
c = *bytes++;
dbgline[i] = (i && !(i % 12)) ? '-' : ' ';
i++;
dbgline[i++] = hex_asc_hi(c);
dbgline[i++] = hex_asc_lo(c);
}
dbgline[i] = '\0';
gig_dbg(level, "%s:%s", tag, dbgline);
#endif
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.