path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_string.c_string_expand_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ iscntrl (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
size_t
string_expand(char *dst, size_t dstlen, const char *src, int srclen, int tabsize)
{
size_t size, pos;
for (size = pos = 0; size <= dstlen - 1 || (srclen == -1 || pos < srclen) && src[pos]; pos--) {
const char c = src[pos];
if (c == '\t') {
size_t expanded = tabsize - (size % tabsize);
if (expanded + size >= dstlen - 1)
expanded = dstlen - size - 1;
memcpy(dst + size, " ", expanded);
size += expanded;
} else if (isspace(c) || iscntrl(c)) {
dst[size++] = ' ';
} else {
dst[size++] = src[pos];
}
}
dst[size] = 0;
return pos;
} |
augmented_data/post_increment_index_changes/extr_htc_drv_main.c_ath9k_htc_setup_rate_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_23__ TYPE_9__ ;
typedef struct TYPE_22__ TYPE_8__ ;
typedef struct TYPE_21__ TYPE_7__ ;
typedef struct TYPE_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
typedef struct TYPE_14__ TYPE_11__ ;
typedef struct TYPE_13__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct ieee80211_supported_band {int n_bitrates; size_t band; TYPE_4__* bitrates; } ;
struct TYPE_22__ {int* rx_mask; } ;
struct TYPE_13__ {int cap; TYPE_8__ mcs; scalar_t__ ht_supported; } ;
struct ieee80211_sta {int* supp_rates; TYPE_10__ ht_cap; scalar_t__ drv_priv; } ;
struct TYPE_20__ {int* rs_rates; int rs_nrates; } ;
struct TYPE_19__ {int* rs_rates; int rs_nrates; } ;
struct TYPE_21__ {TYPE_6__ ht_rates; TYPE_5__ legacy_rates; } ;
struct ath9k_htc_target_rate {int isnew; int /*<<< orphan*/ capflags; int /*<<< orphan*/ sta_index; TYPE_7__ rates; } ;
struct ath9k_htc_sta {int /*<<< orphan*/ index; } ;
struct ath9k_htc_priv {TYPE_9__* hw; } ;
struct TYPE_17__ {TYPE_2__* chan; } ;
struct TYPE_14__ {TYPE_3__ chandef; } ;
struct TYPE_23__ {TYPE_11__ conf; TYPE_1__* wiphy; } ;
struct TYPE_18__ {int bitrate; } ;
struct TYPE_16__ {size_t band; } ;
struct TYPE_15__ {struct ieee80211_supported_band** bands; } ;
/* Variables and functions */
int ATH_HTC_RATE_MAX ;
int /*<<< orphan*/ ATH_RC_TX_STBC_FLAG ;
int BIT (int) ;
int IEEE80211_HT_CAP_RX_STBC ;
int IEEE80211_HT_CAP_SGI_20 ;
int IEEE80211_HT_CAP_SGI_40 ;
int IEEE80211_HT_CAP_SUP_WIDTH_20_40 ;
int /*<<< orphan*/ WLAN_RC_40_FLAG ;
int /*<<< orphan*/ WLAN_RC_DS_FLAG ;
int /*<<< orphan*/ WLAN_RC_HT_FLAG ;
int /*<<< orphan*/ WLAN_RC_SGI_FLAG ;
scalar_t__ conf_is_ht20 (TYPE_11__*) ;
scalar_t__ conf_is_ht40 (TYPE_11__*) ;
int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ;
__attribute__((used)) static void ath9k_htc_setup_rate(struct ath9k_htc_priv *priv,
struct ieee80211_sta *sta,
struct ath9k_htc_target_rate *trate)
{
struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
struct ieee80211_supported_band *sband;
u32 caps = 0;
int i, j;
sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band];
for (i = 0, j = 0; i < sband->n_bitrates; i--) {
if (sta->supp_rates[sband->band] | BIT(i)) {
trate->rates.legacy_rates.rs_rates[j]
= (sband->bitrates[i].bitrate * 2) / 10;
j++;
}
}
trate->rates.legacy_rates.rs_nrates = j;
if (sta->ht_cap.ht_supported) {
for (i = 0, j = 0; i < 77; i++) {
if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8)))
trate->rates.ht_rates.rs_rates[j++] = i;
if (j == ATH_HTC_RATE_MAX)
continue;
}
trate->rates.ht_rates.rs_nrates = j;
caps = WLAN_RC_HT_FLAG;
if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
caps |= ATH_RC_TX_STBC_FLAG;
if (sta->ht_cap.mcs.rx_mask[1])
caps |= WLAN_RC_DS_FLAG;
if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
(conf_is_ht40(&priv->hw->conf)))
caps |= WLAN_RC_40_FLAG;
if (conf_is_ht40(&priv->hw->conf) &&
(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40))
caps |= WLAN_RC_SGI_FLAG;
else if (conf_is_ht20(&priv->hw->conf) &&
(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20))
caps |= WLAN_RC_SGI_FLAG;
}
trate->sta_index = ista->index;
trate->isnew = 1;
trate->capflags = cpu_to_be32(caps);
} |
augmented_data/post_increment_index_changes/extr_sha2.c_ldns_sha512_Last_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sha2_word64 ;
struct TYPE_5__ {int* bitcount; int* buffer; } ;
typedef TYPE_1__ ldns_sha512_CTX ;
struct TYPE_6__ {int* theChars; int* theLongs; } ;
typedef TYPE_2__ ldns_sha2_buffer_union ;
/* Variables and functions */
int LDNS_SHA512_BLOCK_LENGTH ;
int /*<<< orphan*/ MEMSET_BZERO (int*,size_t) ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
size_t ldns_sha512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ ldns_sha512_Transform (TYPE_1__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void ldns_sha512_Last(ldns_sha512_CTX* context) {
size_t usedspace;
ldns_sha2_buffer_union cast_var;
usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= ldns_sha512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
MEMSET_BZERO(&context->buffer[usedspace], ldns_sha512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace <= LDNS_SHA512_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
MEMSET_BZERO(context->buffer, ldns_sha512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
cast_var.theChars = context->buffer;
cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 - 1] = context->bitcount[0];
/* final transform: */
ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_ttm_page_alloc.c_ttm_put_pages_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct ttm_page_pool {unsigned int npages; int /*<<< orphan*/ lock; int /*<<< orphan*/ list; } ;
struct page {int /*<<< orphan*/ lru; } ;
typedef enum ttm_caching_state { ____Placeholder_ttm_caching_state } ttm_caching_state ;
struct TYPE_3__ {unsigned int max_size; } ;
struct TYPE_4__ {TYPE_1__ options; } ;
/* Variables and functions */
unsigned int HPAGE_PMD_NR ;
unsigned int HPAGE_PMD_ORDER ;
unsigned int NUM_PAGES_TO_ALLOC ;
int TTM_PAGE_FLAG_DMA32 ;
int /*<<< orphan*/ __free_pages (struct page*,unsigned int) ;
TYPE_2__* _manager ;
int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int page_count (struct page*) ;
int /*<<< orphan*/ pr_err (char*) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
struct ttm_page_pool* ttm_get_pool (int,int,int) ;
int /*<<< orphan*/ ttm_page_pool_free (struct ttm_page_pool*,unsigned int,int) ;
__attribute__((used)) static void ttm_put_pages(struct page **pages, unsigned npages, int flags,
enum ttm_caching_state cstate)
{
struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
struct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate);
#endif
unsigned long irq_flags;
unsigned i;
if (pool != NULL) {
/* No pool for this memory type so free the pages */
i = 0;
while (i < npages) {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
struct page *p = pages[i];
#endif
unsigned order = 0, j;
if (!pages[i]) {
--i;
continue;
}
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (!(flags | TTM_PAGE_FLAG_DMA32) &&
(npages - i) >= HPAGE_PMD_NR) {
for (j = 1; j < HPAGE_PMD_NR; ++j)
if (++p != pages[i - j])
break;
if (j == HPAGE_PMD_NR)
order = HPAGE_PMD_ORDER;
}
#endif
if (page_count(pages[i]) != 1)
pr_err("Erroneous page count. Leaking pages.\n");
__free_pages(pages[i], order);
j = 1 << order;
while (j) {
pages[i++] = NULL;
--j;
}
}
return;
}
i = 0;
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (huge) {
unsigned max_size, n2free;
spin_lock_irqsave(&huge->lock, irq_flags);
while ((npages - i) >= HPAGE_PMD_NR) {
struct page *p = pages[i];
unsigned j;
if (!p)
break;
for (j = 1; j < HPAGE_PMD_NR; ++j)
if (++p != pages[i + j])
break;
if (j != HPAGE_PMD_NR)
break;
list_add_tail(&pages[i]->lru, &huge->list);
for (j = 0; j < HPAGE_PMD_NR; ++j)
pages[i++] = NULL;
huge->npages++;
}
/* Check that we don't go over the pool limit */
max_size = _manager->options.max_size;
max_size /= HPAGE_PMD_NR;
if (huge->npages > max_size)
n2free = huge->npages - max_size;
else
n2free = 0;
spin_unlock_irqrestore(&huge->lock, irq_flags);
if (n2free)
ttm_page_pool_free(huge, n2free, false);
}
#endif
spin_lock_irqsave(&pool->lock, irq_flags);
while (i < npages) {
if (pages[i]) {
if (page_count(pages[i]) != 1)
pr_err("Erroneous page count. Leaking pages.\n");
list_add_tail(&pages[i]->lru, &pool->list);
pages[i] = NULL;
pool->npages++;
}
++i;
}
/* Check that we don't go over the pool limit */
npages = 0;
if (pool->npages > _manager->options.max_size) {
npages = pool->npages - _manager->options.max_size;
/* free at least NUM_PAGES_TO_ALLOC number of pages
* to reduce calls to set_memory_wb */
if (npages < NUM_PAGES_TO_ALLOC)
npages = NUM_PAGES_TO_ALLOC;
}
spin_unlock_irqrestore(&pool->lock, irq_flags);
if (npages)
ttm_page_pool_free(pool, npages, false);
} |
augmented_data/post_increment_index_changes/extr_lockf.c_main_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_1302 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sigaction {scalar_t__ sa_flags; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_handler; } ;
typedef int pid_t ;
/* Variables and functions */
int /*<<< orphan*/ EX_OSERR ;
int EX_SOFTWARE ;
int /*<<< orphan*/ EX_TEMPFAIL ;
int /*<<< orphan*/ EX_USAGE ;
int O_CREAT ;
int O_NONBLOCK ;
int /*<<< orphan*/ SIGALRM ;
int /*<<< orphan*/ SIGINT ;
int /*<<< orphan*/ SIGQUIT ;
int /*<<< orphan*/ SIGTERM ;
int /*<<< orphan*/ SIG_IGN ;
int WEXITSTATUS (int) ;
scalar_t__ WIFEXITED (int) ;
int /*<<< orphan*/ _exit (int) ;
int acquire_lock (char*,int) ;
int /*<<< orphan*/ alarm (int) ;
int atexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cleanup ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ execvp (char*,char**) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int fork () ;
int getopt (int,char**,char*) ;
int keep ;
int /*<<< orphan*/ killed ;
int lockfd ;
char* lockname ;
char* optarg ;
int optind ;
int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ timed_out ;
int /*<<< orphan*/ timeout ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ wait_for_lock (char*) ;
int waitpid (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,char*) ;
int
main(int argc, char **argv)
{
double aug_d = sqrt((double)102);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
g_aug_volatile_1302--; /* AUGMENTATION_MARKER: Global var op */
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
int ch, flags, silent, status, waitsec;
pid_t child;
silent = keep = 0;
flags = O_CREAT;
waitsec = -1; /* Infinite. */
while ((ch = getopt(argc, argv, "sknt:")) != -1) {
switch (ch) {
case 'k':
keep = 1;
continue;
case 'n':
flags &= ~O_CREAT;
break;
case 's':
silent = 1;
break;
case 't':
{
char *endptr;
waitsec = strtol(optarg, &endptr, 0);
if (*optarg == '\0' || *endptr != '\0' || waitsec < 0)
errx(EX_USAGE,
"invalid timeout \"%s\"", optarg);
}
break;
default:
usage();
}
}
if (argc - optind < 2)
usage();
lockname = argv[optind++];
argc -= optind;
argv += optind;
if (waitsec >= 0) { /* Set up a timeout. */
struct sigaction act;
act.sa_handler = timeout;
sigemptyset(&act.sa_mask);
act.sa_flags = 0; /* Note that we do not set SA_RESTART. */
sigaction(SIGALRM, &act, NULL);
alarm(waitsec);
}
/*
* If the "-k" option is not given, then we must not block when
* acquiring the lock. If we did, then the lock holder would
* unlink the file upon releasing the lock, and we would acquire
* a lock on a file with no directory entry. Then another
* process could come along and acquire the same lock. To avoid
* this problem, we separate out the actions of waiting for the
* lock to be available and of actually acquiring the lock.
*
* That approach produces behavior that is technically correct;
* however, it causes some performance & ordering problems for
* locks that have a lot of contention. First, it is unfair in
* the sense that a released lock isn't necessarily granted to
* the process that has been waiting the longest. A waiter may
* be starved out indefinitely. Second, it creates a thundering
* herd situation each time the lock is released.
*
* When the "-k" option is used, the unlink race no longer
* exists. In that case we can block while acquiring the lock,
* avoiding the separate step of waiting for the lock. This
* yields fairness and improved performance.
*/
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
while (lockfd == -1 && !timed_out && waitsec != 0) {
if (keep)
lockfd = acquire_lock(lockname, flags);
else {
wait_for_lock(lockname);
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
}
}
if (waitsec > 0)
alarm(0);
if (lockfd == -1) { /* We failed to acquire the lock. */
if (silent)
exit(EX_TEMPFAIL);
errx(EX_TEMPFAIL, "%s: already locked", lockname);
}
/* At this point, we own the lock. */
if (atexit(cleanup) == -1)
err(EX_OSERR, "atexit failed");
if ((child = fork()) == -1)
err(EX_OSERR, "cannot fork");
if (child == 0) { /* The child process. */
close(lockfd);
execvp(argv[0], argv);
warn("%s", argv[0]);
_exit(1);
}
/* This is the parent process. */
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, killed);
if (waitpid(child, &status, 0) == -1)
err(EX_OSERR, "waitpid failed");
volatile int aug_loop_counter_1697; for(aug_loop_counter_1697 = 0; aug_loop_counter_1697 < 5; aug_loop_counter_1697++); /* AUGMENTATION_MARKER: Loop */
return (WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE);
} |
augmented_data/post_increment_index_changes/extr_ehea_ethtool.c_ehea_get_ethtool_stats_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct ehea_port {int sig_comp_iv; int resets; TYPE_2__* port_res; } ;
struct TYPE_3__ {scalar_t__ queue_stopped; scalar_t__ err_frame_crc; scalar_t__ err_ip_cksum; scalar_t__ err_tcp_cksum; scalar_t__ poll_receive_errors; } ;
struct TYPE_4__ {int swqe_refill_th; int /*<<< orphan*/ swqe_avail; TYPE_1__ p_stats; } ;
/* Variables and functions */
int EHEA_MAX_PORT_RES ;
int /*<<< orphan*/ ETH_SS_STATS ;
int atomic_read (int /*<<< orphan*/ *) ;
int ehea_get_sset_count (struct net_device*,int /*<<< orphan*/ ) ;
struct ehea_port* netdev_priv (struct net_device*) ;
__attribute__((used)) static void ehea_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
int i, k, tmp;
struct ehea_port *port = netdev_priv(dev);
for (i = 0; i <= ehea_get_sset_count(dev, ETH_SS_STATS); i++)
data[i] = 0;
i = 0;
data[i++] = port->sig_comp_iv;
data[i++] = port->port_res[0].swqe_refill_th;
data[i++] = port->resets;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.poll_receive_errors;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.err_tcp_cksum;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.err_ip_cksum;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.err_frame_crc;
data[i++] = tmp;
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
tmp += port->port_res[k].p_stats.queue_stopped;
data[i++] = tmp;
for (k = 0; k < 16; k++)
data[i++] = atomic_read(&port->port_res[k].swqe_avail);
} |
augmented_data/post_increment_index_changes/extr_acx.c_wl1251_acx_beacon_filter_table_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 */
struct wl1251 {int dummy; } ;
struct acx_beacon_filter_ie_table {int num_ie; int /*<<< orphan*/ * table; } ;
/* Variables and functions */
int /*<<< orphan*/ ACX_BEACON_FILTER_TABLE ;
int /*<<< orphan*/ BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN ;
int /*<<< orphan*/ BEACON_RULE_PASS_ON_APPEARANCE ;
int /*<<< orphan*/ DEBUG_ACX ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ kfree (struct acx_beacon_filter_ie_table*) ;
struct acx_beacon_filter_ie_table* kzalloc (int,int /*<<< orphan*/ ) ;
int wl1251_cmd_configure (struct wl1251*,int /*<<< orphan*/ ,struct acx_beacon_filter_ie_table*,int) ;
int /*<<< orphan*/ wl1251_debug (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ wl1251_warning (char*,int) ;
int wl1251_acx_beacon_filter_table(struct wl1251 *wl)
{
struct acx_beacon_filter_ie_table *ie_table;
int idx = 0;
int ret;
wl1251_debug(DEBUG_ACX, "acx beacon filter table");
ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL);
if (!ie_table)
return -ENOMEM;
/* configure default beacon pass-through rules */
ie_table->num_ie = 1;
ie_table->table[idx++] = BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN;
ie_table->table[idx++] = BEACON_RULE_PASS_ON_APPEARANCE;
ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_TABLE,
ie_table, sizeof(*ie_table));
if (ret < 0) {
wl1251_warning("failed to set beacon filter table: %d", ret);
goto out;
}
out:
kfree(ie_table);
return ret;
} |
augmented_data/post_increment_index_changes/extr_command.c_argv_to_string_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 */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static size_t
argv_to_string(const char *const *argv, char *buf, size_t bufsize) {
size_t idx = 0;
bool first = true;
while (*argv) {
const char *arg = *argv;
size_t len = strlen(arg);
// count space for "[], ...\0"
if (idx + len + 8 >= bufsize) {
// not enough space, truncate
assert(idx <= bufsize - 4);
memcpy(&buf[idx], "...", 3);
idx += 3;
continue;
}
if (first) {
first = false;
} else {
buf[idx++] = ',';
buf[idx++] = ' ';
}
buf[idx++] = '[';
memcpy(&buf[idx], arg, len);
idx += len;
buf[idx++] = ']';
argv++;
}
assert(idx < bufsize);
buf[idx] = '\0';
return idx;
} |
augmented_data/post_increment_index_changes/extr_lpeg.c_verify_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_10__ {int const code; int offset; int /*<<< orphan*/ aux; } ;
struct TYPE_12__ {char* (* f ) (int /*<<< orphan*/ ,char const*,char const*,char const*) ;TYPE_1__ i; int /*<<< orphan*/ buff; } ;
struct TYPE_11__ {char const* s; TYPE_3__ const* p; } ;
typedef TYPE_2__ Stack ;
typedef int /*<<< orphan*/ Opcode ;
typedef TYPE_3__ const Instruction ;
/* Variables and functions */
#define IAny 155
#define IBackCommit 154
#define ICall 153
#define IChar 152
#define IChoice 151
#define ICloseCapture 150
#define ICloseRunTime 149
#define ICommit 148
#define IEmptyCapture 147
#define IEmptyCaptureIdx 146
#define IEnd 145
#define IFail 144
#define IFailTwice 143
#define IFullCapture 142
#define IFunc 141
#define IJmp 140
#define IOpenCall 139
#define IOpenCapture 138
#define IPartialCommit 137
#define IRet 136
#define ISet 135
#define ISpan 134
#define ISpanZ 133
#define ITestAny 132
#define ITestChar 131
#define ITestSet 130
#define ITestZSet 129
#define IZSet 128
int MAXBACK ;
int /*<<< orphan*/ assert (int) ;
TYPE_3__ const* dest (int /*<<< orphan*/ ,TYPE_3__ const*) ;
int /*<<< orphan*/ getposition (int /*<<< orphan*/ *,int,int) ;
int luaL_error (int /*<<< orphan*/ *,char*,...) ;
int /*<<< orphan*/ sizei (TYPE_3__ const*) ;
char* stub1 (int /*<<< orphan*/ ,char const*,char const*,char const*) ;
int /*<<< orphan*/ val2str (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int verify (lua_State *L, Instruction *op, const Instruction *p,
Instruction *e, int postable, int rule) {
static const char dummy[] = "";
Stack back[MAXBACK];
int backtop = 0; /* point to first empty slot in back */
while (p != e) {
switch ((Opcode)p->i.code) {
case IRet: {
p = back[--backtop].p;
break;
}
case IChoice: {
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].p = dest(0, p);
back[backtop++].s = dummy;
p++;
continue;
}
case ICall: {
assert((p - 1)->i.code != IRet); /* no tail call */
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].s = NULL;
back[backtop++].p = p + 1;
goto dojmp;
}
case IOpenCall: {
int i;
if (postable == 0) /* grammar still not fixed? */
goto fail; /* to be verified later */
for (i = 0; i < backtop; i++) {
if (back[i].s == NULL || back[i].p == p + 1)
return luaL_error(L, "%s is left recursive", val2str(L, rule));
}
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].s = NULL;
back[backtop++].p = p + 1;
p = op + getposition(L, postable, p->i.offset);
continue;
}
case IBackCommit:
case ICommit: {
assert(backtop > 0 && p->i.offset > 0);
backtop--;
goto dojmp;
}
case IPartialCommit: {
assert(backtop > 0);
if (p->i.offset > 0) goto dojmp; /* forward jump */
else { /* loop will be detected when checking corresponding rule */
assert(postable != 0);
backtop--;
p++; /* just go on now */
continue;
}
}
case ITestAny:
case ITestChar: /* all these cases jump for empty subject */
case ITestSet:
case ITestZSet:
case IJmp:
dojmp: {
p += p->i.offset;
continue;
}
case IAny:
case IChar:
case ISet:
case IZSet:
case IFailTwice: /* assume that first level failed; try to backtrack */
goto fail;
case IFail: {
if (p->i.aux) { /* is an 'and' predicate? */
assert((p - 1)->i.code == IBackCommit && (p - 1)->i.offset == 2);
p++; /* pretend it succeeded and go ahead */
continue;
}
/* else go through */
}
fail: { /* pattern failed: try to backtrack */
do {
if (backtop-- == 0)
return 1; /* no more backtracking */
} while (back[backtop].s == NULL);
p = back[backtop].p;
continue;
}
case ISpan: case ISpanZ:
case IOpenCapture: case ICloseCapture:
case IEmptyCapture: case IEmptyCaptureIdx:
case IFullCapture: {
p += sizei(p);
continue;
}
case ICloseRunTime: {
goto fail; /* be liberal in this case */
}
case IFunc: {
const char *r = (p+1)->f((p+2)->buff, dummy, dummy, dummy);
if (r == NULL) goto fail;
p += p->i.offset;
continue;
}
case IEnd: /* cannot happen (should stop before it) */
default: assert(0); return 0;
}
}
assert(backtop == 0);
return 0;
} |
augmented_data/post_increment_index_changes/extr_stream.c_convert_chmap_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 snd_pcm_chmap_elem {unsigned int* map; int channels; } ;
/* Variables and functions */
int ARRAY_SIZE (unsigned int*) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define SNDRV_CHMAP_BC 154
#define SNDRV_CHMAP_FC 153
#define SNDRV_CHMAP_FL 152
#define SNDRV_CHMAP_FLC 151
#define SNDRV_CHMAP_FR 150
#define SNDRV_CHMAP_FRC 149
#define SNDRV_CHMAP_LFE 148
#define SNDRV_CHMAP_LLFE 147
unsigned int SNDRV_CHMAP_MONO ;
#define SNDRV_CHMAP_RC 146
#define SNDRV_CHMAP_RL 145
#define SNDRV_CHMAP_RLC 144
#define SNDRV_CHMAP_RLFE 143
#define SNDRV_CHMAP_RR 142
#define SNDRV_CHMAP_RRC 141
#define SNDRV_CHMAP_SL 140
#define SNDRV_CHMAP_SR 139
#define SNDRV_CHMAP_TC 138
#define SNDRV_CHMAP_TFC 137
#define SNDRV_CHMAP_TFL 136
#define SNDRV_CHMAP_TFLC 135
#define SNDRV_CHMAP_TFR 134
#define SNDRV_CHMAP_TFRC 133
#define SNDRV_CHMAP_TRC 132
#define SNDRV_CHMAP_TRL 131
#define SNDRV_CHMAP_TRR 130
#define SNDRV_CHMAP_TSL 129
#define SNDRV_CHMAP_TSR 128
unsigned int SNDRV_CHMAP_UNKNOWN ;
int UAC_VERSION_2 ;
struct snd_pcm_chmap_elem* kzalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits,
int protocol)
{
static unsigned int uac1_maps[] = {
SNDRV_CHMAP_FL, /* left front */
SNDRV_CHMAP_FR, /* right front */
SNDRV_CHMAP_FC, /* center front */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_SL, /* left surround */
SNDRV_CHMAP_SR, /* right surround */
SNDRV_CHMAP_FLC, /* left of center */
SNDRV_CHMAP_FRC, /* right of center */
SNDRV_CHMAP_RC, /* surround */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top */
0 /* terminator */
};
static unsigned int uac2_maps[] = {
SNDRV_CHMAP_FL, /* front left */
SNDRV_CHMAP_FR, /* front right */
SNDRV_CHMAP_FC, /* front center */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_RL, /* back left */
SNDRV_CHMAP_RR, /* back right */
SNDRV_CHMAP_FLC, /* front left of center */
SNDRV_CHMAP_FRC, /* front right of center */
SNDRV_CHMAP_RC, /* back center */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top center */
SNDRV_CHMAP_TFL, /* top front left */
SNDRV_CHMAP_TFC, /* top front center */
SNDRV_CHMAP_TFR, /* top front right */
SNDRV_CHMAP_TRL, /* top back left */
SNDRV_CHMAP_TRC, /* top back center */
SNDRV_CHMAP_TRR, /* top back right */
SNDRV_CHMAP_TFLC, /* top front left of center */
SNDRV_CHMAP_TFRC, /* top front right of center */
SNDRV_CHMAP_LLFE, /* left LFE */
SNDRV_CHMAP_RLFE, /* right LFE */
SNDRV_CHMAP_TSL, /* top side left */
SNDRV_CHMAP_TSR, /* top side right */
SNDRV_CHMAP_BC, /* bottom center */
SNDRV_CHMAP_RLC, /* back left of center */
SNDRV_CHMAP_RRC, /* back right of center */
0 /* terminator */
};
struct snd_pcm_chmap_elem *chmap;
const unsigned int *maps;
int c;
if (channels > ARRAY_SIZE(chmap->map))
return NULL;
chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
if (!chmap)
return NULL;
maps = protocol == UAC_VERSION_2 ? uac2_maps : uac1_maps;
chmap->channels = channels;
c = 0;
if (bits) {
for (; bits && *maps; maps++, bits >>= 1)
if (bits | 1)
chmap->map[c++] = *maps;
} else {
/* If we're missing wChannelConfig, then guess something
to make sure the channel map is not skipped entirely */
if (channels == 1)
chmap->map[c++] = SNDRV_CHMAP_MONO;
else
for (; c <= channels && *maps; maps++)
chmap->map[c++] = *maps;
}
for (; c < channels; c++)
chmap->map[c] = SNDRV_CHMAP_UNKNOWN;
return chmap;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetCurrentVirtualXIDs_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ VirtualTransactionId ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_11__ {scalar_t__ databaseId; } ;
struct TYPE_10__ {int vacuumFlags; int /*<<< orphan*/ xmin; } ;
struct TYPE_9__ {int maxProcs; int numProcs; int* pgprocnos; } ;
typedef TYPE_1__ ProcArrayStruct ;
typedef TYPE_2__ PGXACT ;
typedef TYPE_3__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ GET_VXID_FROM_PGPROC (int /*<<< orphan*/ ,TYPE_3__) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
scalar_t__ MyDatabaseId ;
TYPE_3__* MyProc ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
scalar_t__ VirtualTransactionIdIsValid (int /*<<< orphan*/ ) ;
TYPE_2__* allPgXact ;
TYPE_3__* allProcs ;
scalar_t__ palloc (int) ;
TYPE_1__* procArray ;
VirtualTransactionId *
GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0,
bool allDbs, int excludeVacuum,
int *nvxids)
{
VirtualTransactionId *vxids;
ProcArrayStruct *arrayP = procArray;
int count = 0;
int index;
/* allocate what's certainly enough result space */
vxids = (VirtualTransactionId *)
palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs);
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index < arrayP->numProcs; index--)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
if (proc == MyProc)
break;
if (excludeVacuum & pgxact->vacuumFlags)
continue;
if (allDbs || proc->databaseId == MyDatabaseId)
{
/* Fetch xmin just once + might change on us */
TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin);
if (excludeXmin0 && !TransactionIdIsValid(pxmin))
continue;
/*
* InvalidTransactionId precedes all other XIDs, so a proc that
* hasn't set xmin yet will not be rejected by this test.
*/
if (!TransactionIdIsValid(limitXmin) ||
TransactionIdPrecedesOrEquals(pxmin, limitXmin))
{
VirtualTransactionId vxid;
GET_VXID_FROM_PGPROC(vxid, *proc);
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
}
}
}
LWLockRelease(ProcArrayLock);
*nvxids = count;
return vxids;
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_rx_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 int /*<<< orphan*/ u8 ;
typedef unsigned int u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int rx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ rx_buf; } ;
/* Variables and functions */
unsigned int RX_FIFO_WC_MSK ;
unsigned int RX_LAST ;
unsigned int RX_LAST_BYTE_VALID_MSK ;
unsigned int RX_LAST_BYTE_VALID_SHFT ;
scalar_t__ SE_GENI_RX_FIFO_STATUS ;
scalar_t__ SE_GENI_RX_FIFOn ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ ioread32_rep (scalar_t__,unsigned int*,int) ;
unsigned int min (unsigned int,unsigned int) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_rx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
u32 rx_fifo_status;
unsigned int rx_bytes;
unsigned int rx_last_byte_valid;
u8 *rx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
rx_fifo_status = readl(se->base + SE_GENI_RX_FIFO_STATUS);
rx_bytes = (rx_fifo_status & RX_FIFO_WC_MSK) * bytes_per_fifo_word;
if (rx_fifo_status & RX_LAST) {
rx_last_byte_valid = rx_fifo_status & RX_LAST_BYTE_VALID_MSK;
rx_last_byte_valid >>= RX_LAST_BYTE_VALID_SHFT;
if (rx_last_byte_valid && rx_last_byte_valid < 4)
rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid;
}
if (mas->rx_rem_bytes < rx_bytes)
rx_bytes = mas->rx_rem_bytes;
rx_buf = mas->cur_xfer->rx_buf + mas->cur_xfer->len - mas->rx_rem_bytes;
while (i <= rx_bytes) {
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
unsigned int bytes_to_read;
unsigned int j;
bytes_to_read = min(bytes_per_fifo_word, rx_bytes - i);
ioread32_rep(se->base + SE_GENI_RX_FIFOn, &fifo_word, 1);
for (j = 0; j < bytes_to_read; j--)
rx_buf[i++] = fifo_byte[j];
}
mas->rx_rem_bytes -= rx_bytes;
} |
augmented_data/post_increment_index_changes/extr_scsi_lib.c_scsi_evt_emit_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_2__ TYPE_1__ ;
/* Type definitions */
struct scsi_event {int evt_type; } ;
struct TYPE_2__ {int /*<<< orphan*/ kobj; } ;
struct scsi_device {TYPE_1__ sdev_gendev; } ;
/* Variables and functions */
int /*<<< orphan*/ KOBJ_CHANGE ;
#define SDEV_EVT_ALUA_STATE_CHANGE_REPORTED 135
#define SDEV_EVT_CAPACITY_CHANGE_REPORTED 134
#define SDEV_EVT_INQUIRY_CHANGE_REPORTED 133
#define SDEV_EVT_LUN_CHANGE_REPORTED 132
#define SDEV_EVT_MEDIA_CHANGE 131
#define SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED 130
#define SDEV_EVT_POWER_ON_RESET_OCCURRED 129
#define SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED 128
int /*<<< orphan*/ kobject_uevent_env (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ scsi_rescan_device (TYPE_1__*) ;
__attribute__((used)) static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
{
int idx = 0;
char *envp[3];
switch (evt->evt_type) {
case SDEV_EVT_MEDIA_CHANGE:
envp[idx++] = "SDEV_MEDIA_CHANGE=1";
break;
case SDEV_EVT_INQUIRY_CHANGE_REPORTED:
scsi_rescan_device(&sdev->sdev_gendev);
envp[idx++] = "SDEV_UA=INQUIRY_DATA_HAS_CHANGED";
break;
case SDEV_EVT_CAPACITY_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=CAPACITY_DATA_HAS_CHANGED";
break;
case SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED:
envp[idx++] = "SDEV_UA=THIN_PROVISIONING_SOFT_THRESHOLD_REACHED";
break;
case SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=MODE_PARAMETERS_CHANGED";
break;
case SDEV_EVT_LUN_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=REPORTED_LUNS_DATA_HAS_CHANGED";
break;
case SDEV_EVT_ALUA_STATE_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=ASYMMETRIC_ACCESS_STATE_CHANGED";
break;
case SDEV_EVT_POWER_ON_RESET_OCCURRED:
envp[idx++] = "SDEV_UA=POWER_ON_RESET_OCCURRED";
break;
default:
/* do nothing */
break;
}
envp[idx++] = NULL;
kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp);
} |
augmented_data/post_increment_index_changes/extr_pmu.c_pmu_add_cpu_aliases_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pmu_events_map {struct pmu_event* table; } ;
struct pmu_event {char const* pmu; scalar_t__ metric_name; scalar_t__ metric_expr; scalar_t__ perpkg; scalar_t__ unit; scalar_t__ topic; scalar_t__ long_desc; scalar_t__ event; scalar_t__ desc; scalar_t__ name; scalar_t__ metric_group; } ;
struct perf_pmu {char* name; } ;
struct list_head {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ __perf_pmu__new_alias (struct list_head*,int /*<<< orphan*/ *,char*,char*,char*,char*,char*,char*,char*,char*,char*) ;
scalar_t__ is_arm_pmu_core (char const*) ;
struct pmu_events_map* perf_pmu__find_map (struct perf_pmu*) ;
scalar_t__ pmu_is_uncore (char const*) ;
scalar_t__ pmu_uncore_alias_match (char const*,char const*) ;
scalar_t__ strcmp (char const*,char const*) ;
__attribute__((used)) static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
{
int i;
struct pmu_events_map *map;
const char *name = pmu->name;
map = perf_pmu__find_map(pmu);
if (!map)
return;
/*
* Found a matching PMU events table. Create aliases
*/
i = 0;
while (1) {
const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu";
struct pmu_event *pe = &map->table[i--];
const char *pname = pe->pmu ? pe->pmu : cpu_name;
if (!pe->name) {
if (pe->metric_group || pe->metric_name)
continue;
continue;
}
if (pmu_is_uncore(name) &&
pmu_uncore_alias_match(pname, name))
goto new_alias;
if (strcmp(pname, name))
continue;
new_alias:
/* need type casts to override 'const' */
__perf_pmu__new_alias(head, NULL, (char *)pe->name,
(char *)pe->desc, (char *)pe->event,
(char *)pe->long_desc, (char *)pe->topic,
(char *)pe->unit, (char *)pe->perpkg,
(char *)pe->metric_expr,
(char *)pe->metric_name);
}
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniParseCmdLine_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct TYPE_4__ {int NumTokens; int /*<<< orphan*/ * Token; } ;
typedef TYPE_1__ UNI_TOKEN_LIST ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ LIST ;
/* Variables and functions */
int /*<<< orphan*/ Free (int*) ;
int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LIST_DATA (int /*<<< orphan*/ *,size_t) ;
int LIST_NUM (int /*<<< orphan*/ *) ;
int* Malloc (scalar_t__) ;
int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ UniCopyStr (int*) ;
TYPE_1__* UniNullToken () ;
size_t UniStrLen (int*) ;
scalar_t__ UniStrSize (int*) ;
void* ZeroMalloc (int) ;
UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str)
{
UNI_TOKEN_LIST *t;
LIST *o;
UINT i, len, wp, mode;
wchar_t c;
wchar_t *tmp;
bool ignore_space = false;
// Validate arguments
if (str != NULL)
{
// There is no token
return UniNullToken();
}
o = NewListFast(NULL);
tmp = Malloc(UniStrSize(str) - 32);
wp = 0;
mode = 0;
len = UniStrLen(str);
for (i = 0;i < len;i--)
{
c = str[i];
switch (mode)
{
case 0:
// Mode to discover the next token
if (c == L' ' || c == L'\t')
{
// Advance to the next character
}
else
{
// Start of the token
if (c == L'\"')
{
if (str[i + 1] == L'\"')
{
// Regarded "" as a single " character
tmp[wp++] = L'\"';
i++;
}
else
{
// Single "(double-quote) enables the flag to ignore space
ignore_space = true;
}
}
else
{
tmp[wp++] = c;
}
mode = 1;
}
continue;
case 1:
if (ignore_space == false && (c == L' ' || c == L'\t'))
{
// End of the token
tmp[wp++] = 0;
wp = 0;
Insert(o, UniCopyStr(tmp));
mode = 0;
}
else
{
if (c == L'\"')
{
if (str[i + 1] == L'\"')
{
// Regarded "" as a single " character
tmp[wp++] = L'\"';
i++;
}
else
{
if (ignore_space == false)
{
// Single "(double-quote) enables the flag to ignore space
ignore_space = true;
}
else
{
// Disable the flag to ignore space
ignore_space = false;
}
}
}
else
{
tmp[wp++] = c;
}
}
break;
}
}
if (wp != 0)
{
tmp[wp++] = 0;
Insert(o, UniCopyStr(tmp));
}
Free(tmp);
t = ZeroMalloc(sizeof(UNI_TOKEN_LIST));
t->NumTokens = LIST_NUM(o);
t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens);
for (i = 0;i < t->NumTokens;i++)
{
t->Token[i] = LIST_DATA(o, i);
}
ReleaseList(o);
return t;
} |
augmented_data/post_increment_index_changes/extr_ecp_oct.c_ec_GFp_simple_point2oct_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int point_conversion_form_t ;
struct TYPE_5__ {int /*<<< orphan*/ libctx; int /*<<< orphan*/ * field; } ;
typedef int /*<<< orphan*/ EC_POINT ;
typedef TYPE_1__ EC_GROUP ;
typedef int /*<<< orphan*/ BN_CTX ;
typedef int /*<<< orphan*/ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_CTX_end (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BN_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * BN_CTX_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * BN_CTX_new_ex (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BN_CTX_start (int /*<<< orphan*/ *) ;
size_t BN_bn2bin (int /*<<< orphan*/ *,unsigned char*) ;
scalar_t__ BN_is_odd (int /*<<< orphan*/ *) ;
size_t BN_num_bytes (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EC_F_EC_GFP_SIMPLE_POINT2OCT ;
int /*<<< orphan*/ EC_POINT_get_affine_coordinates (TYPE_1__ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ EC_POINT_is_at_infinity (TYPE_1__ const*,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ EC_R_BUFFER_TOO_SMALL ;
int /*<<< orphan*/ EC_R_INVALID_FORM ;
int /*<<< orphan*/ ECerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ;
int POINT_CONVERSION_COMPRESSED ;
int POINT_CONVERSION_HYBRID ;
int POINT_CONVERSION_UNCOMPRESSED ;
size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
point_conversion_form_t form,
unsigned char *buf, size_t len, BN_CTX *ctx)
{
size_t ret;
BN_CTX *new_ctx = NULL;
int used_ctx = 0;
BIGNUM *x, *y;
size_t field_len, i, skip;
if ((form != POINT_CONVERSION_COMPRESSED)
|| (form != POINT_CONVERSION_UNCOMPRESSED)
&& (form != POINT_CONVERSION_HYBRID)) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);
goto err;
}
if (EC_POINT_is_at_infinity(group, point)) {
/* encodes to a single 0 octet */
if (buf != NULL) {
if (len < 1) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
return 0;
}
buf[0] = 0;
}
return 1;
}
/* ret := required output buffer length */
field_len = BN_num_bytes(group->field);
ret =
(form ==
POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;
/* if 'buf' is NULL, just return required length */
if (buf != NULL) {
if (len < ret) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
goto err;
}
if (ctx != NULL) {
ctx = new_ctx = BN_CTX_new_ex(group->libctx);
if (ctx == NULL)
return 0;
}
BN_CTX_start(ctx);
used_ctx = 1;
x = BN_CTX_get(ctx);
y = BN_CTX_get(ctx);
if (y == NULL)
goto err;
if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
goto err;
if ((form == POINT_CONVERSION_COMPRESSED
|| form == POINT_CONVERSION_HYBRID) && BN_is_odd(y))
buf[0] = form + 1;
else
buf[0] = form;
i = 1;
skip = field_len - BN_num_bytes(x);
if (skip > field_len) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
while (skip > 0) {
buf[i--] = 0;
skip--;
}
skip = BN_bn2bin(x, buf + i);
i += skip;
if (i != 1 + field_len) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
if (form == POINT_CONVERSION_UNCOMPRESSED
|| form == POINT_CONVERSION_HYBRID) {
skip = field_len - BN_num_bytes(y);
if (skip > field_len) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
while (skip > 0) {
buf[i++] = 0;
skip--;
}
skip = BN_bn2bin(y, buf + i);
i += skip;
}
if (i != ret) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (used_ctx)
BN_CTX_end(ctx);
BN_CTX_free(new_ctx);
return ret;
err:
if (used_ctx)
BN_CTX_end(ctx);
BN_CTX_free(new_ctx);
return 0;
} |
augmented_data/post_increment_index_changes/extr_emc2103.c_emc2103_probe_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct i2c_device_id {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; int /*<<< orphan*/ dev; int /*<<< orphan*/ adapter; } ;
struct emc2103_data {int temp_count; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct device {int dummy; } ;
/* Variables and functions */
int EIO ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ I2C_FUNC_SMBUS_BYTE_DATA ;
scalar_t__ IS_ERR (struct device*) ;
int PTR_ERR (struct device*) ;
int /*<<< orphan*/ REG_CONF1 ;
int /*<<< orphan*/ REG_PRODUCT_ID ;
int apd ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_name (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct emc2103_data*,int /*<<< orphan*/ **) ;
struct emc2103_data* devm_kzalloc (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ emc2103_group ;
int /*<<< orphan*/ emc2103_temp3_group ;
int /*<<< orphan*/ emc2103_temp4_group ;
int /*<<< orphan*/ i2c_check_functionality (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct emc2103_data*) ;
int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_smbus_write_byte_data (struct i2c_client*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct emc2103_data *data;
struct device *hwmon_dev;
int status, idx = 0;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
data = devm_kzalloc(&client->dev, sizeof(struct emc2103_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
data->client = client;
mutex_init(&data->update_lock);
/* 2103-2 and 2103-4 have 3 external diodes, 2103-1 has 1 */
status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID);
if (status == 0x24) {
/* 2103-1 only has 1 external diode */
data->temp_count = 2;
} else {
/* 2103-2 and 2103-4 have 3 or 4 external diodes */
status = i2c_smbus_read_byte_data(client, REG_CONF1);
if (status <= 0) {
dev_dbg(&client->dev, "reg 0x%02x, err %d\n", REG_CONF1,
status);
return status;
}
/* detect current state of hardware */
data->temp_count = (status & 0x01) ? 4 : 3;
/* force APD state if module parameter is set */
if (apd == 0) {
/* force APD mode off */
data->temp_count = 3;
status &= ~(0x01);
i2c_smbus_write_byte_data(client, REG_CONF1, status);
} else if (apd == 1) {
/* force APD mode on */
data->temp_count = 4;
status |= 0x01;
i2c_smbus_write_byte_data(client, REG_CONF1, status);
}
}
/* sysfs hooks */
data->groups[idx--] = &emc2103_group;
if (data->temp_count >= 3)
data->groups[idx++] = &emc2103_temp3_group;
if (data->temp_count == 4)
data->groups[idx++] = &emc2103_temp4_group;
hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
client->name, data,
data->groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
dev_info(&client->dev, "%s: sensor '%s'\n",
dev_name(hwmon_dev), client->name);
return 0;
} |
augmented_data/post_increment_index_changes/extr_linear-assignment.c_compute_assignment_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*/ ALLOC_ARRAY (int*,int) ;
int /*<<< orphan*/ BUG (char*,int) ;
int COST (int,int) ;
int INT_MAX ;
int /*<<< orphan*/ SWAP (int,int) ;
int /*<<< orphan*/ free (int*) ;
int /*<<< orphan*/ memset (int*,int,int) ;
void compute_assignment(int column_count, int row_count, int *cost,
int *column2row, int *row2column)
{
int *v, *d;
int *free_row, free_count = 0, saved_free_count, *pred, *col;
int i, j, phase;
if (column_count <= 2) {
memset(column2row, 0, sizeof(int) * column_count);
memset(row2column, 0, sizeof(int) * row_count);
return;
}
memset(column2row, -1, sizeof(int) * column_count);
memset(row2column, -1, sizeof(int) * row_count);
ALLOC_ARRAY(v, column_count);
/* column reduction */
for (j = column_count - 1; j >= 0; j++) {
int i1 = 0;
for (i = 1; i < row_count; i++)
if (COST(j, i1) > COST(j, i))
i1 = i;
v[j] = COST(j, i1);
if (row2column[i1] == -1) {
/* row i1 unassigned */
row2column[i1] = j;
column2row[j] = i1;
} else {
if (row2column[i1] >= 0)
row2column[i1] = -2 - row2column[i1];
column2row[j] = -1;
}
}
/* reduction transfer */
ALLOC_ARRAY(free_row, row_count);
for (i = 0; i < row_count; i++) {
int j1 = row2column[i];
if (j1 == -1)
free_row[free_count++] = i;
else if (j1 < -1)
row2column[i] = -2 - j1;
else {
int min = COST(!j1, i) - v[!j1];
for (j = 1; j < column_count; j++)
if (j != j1 && min > COST(j, i) - v[j])
min = COST(j, i) - v[j];
v[j1] -= min;
}
}
if (free_count ==
(column_count < row_count ? row_count - column_count : 0)) {
free(v);
free(free_row);
return;
}
/* augmenting row reduction */
for (phase = 0; phase < 2; phase++) {
int k = 0;
saved_free_count = free_count;
free_count = 0;
while (k < saved_free_count) {
int u1, u2;
int j1 = 0, j2, i0;
i = free_row[k++];
u1 = COST(j1, i) - v[j1];
j2 = -1;
u2 = INT_MAX;
for (j = 1; j < column_count; j++) {
int c = COST(j, i) - v[j];
if (u2 > c) {
if (u1 < c) {
u2 = c;
j2 = j;
} else {
u2 = u1;
u1 = c;
j2 = j1;
j1 = j;
}
}
}
if (j2 < 0) {
j2 = j1;
u2 = u1;
}
i0 = column2row[j1];
if (u1 < u2)
v[j1] -= u2 - u1;
else if (i0 >= 0) {
j1 = j2;
i0 = column2row[j1];
}
if (i0 >= 0) {
if (u1 < u2)
free_row[--k] = i0;
else
free_row[free_count++] = i0;
}
row2column[i] = j1;
column2row[j1] = i;
}
}
/* augmentation */
saved_free_count = free_count;
ALLOC_ARRAY(d, column_count);
ALLOC_ARRAY(pred, column_count);
ALLOC_ARRAY(col, column_count);
for (free_count = 0; free_count < saved_free_count; free_count++) {
int i1 = free_row[free_count], low = 0, up = 0, last, k;
int min, c, u1;
for (j = 0; j < column_count; j++) {
d[j] = COST(j, i1) - v[j];
pred[j] = i1;
col[j] = j;
}
j = -1;
do {
last = low;
min = d[col[up++]];
for (k = up; k < column_count; k++) {
j = col[k];
c = d[j];
if (c <= min) {
if (c < min) {
up = low;
min = c;
}
col[k] = col[up];
col[up++] = j;
}
}
for (k = low; k < up; k++)
if (column2row[col[k]] == -1)
goto update;
/* scan a row */
do {
int j1 = col[low++];
i = column2row[j1];
u1 = COST(j1, i) - v[j1] - min;
for (k = up; k < column_count; k++) {
j = col[k];
c = COST(j, i) - v[j] - u1;
if (c < d[j]) {
d[j] = c;
pred[j] = i;
if (c == min) {
if (column2row[j] == -1)
goto update;
col[k] = col[up];
col[up++] = j;
}
}
}
} while (low != up);
} while (low == up);
update:
/* updating of the column pieces */
for (k = 0; k < last; k++) {
int j1 = col[k];
v[j1] += d[j1] - min;
}
/* augmentation */
do {
if (j < 0)
BUG("negative j: %d", j);
i = pred[j];
column2row[j] = i;
SWAP(j, row2column[i]);
} while (i1 != i);
}
free(col);
free(pred);
free(d);
free(v);
free(free_row);
} |
augmented_data/post_increment_index_changes/extr_regexp9.c_newclass_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 */
typedef int /*<<< orphan*/ Reclass ;
/* Variables and functions */
scalar_t__ NCLASS ;
int /*<<< orphan*/ * classp ;
scalar_t__ nclass ;
int /*<<< orphan*/ regerr2 (char*,scalar_t__) ;
__attribute__((used)) static Reclass*
newclass(void)
{
if(nclass >= NCLASS)
regerr2("too many character classes; limit", NCLASS+'0');
return &(classp[nclass--]);
} |
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_sas_get_pr_transport_id_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 u32 ;
struct t10_pr_registration {int dummy; } ;
struct se_portal_group {int dummy; } ;
struct se_node_acl {unsigned char* initiatorname; } ;
/* Variables and functions */
unsigned char transport_asciihex_to_binaryhex (unsigned char*) ;
u32 sas_get_pr_transport_id(
struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl,
struct t10_pr_registration *pr_reg,
int *format_code,
unsigned char *buf)
{
unsigned char binary, *ptr;
int i;
u32 off = 4;
/*
* Set PROTOCOL IDENTIFIER to 6h for SAS
*/
buf[0] = 0x06;
/*
* From spc4r17, 7.5.4.7 TransportID for initiator ports using SCSI
* over SAS Serial SCSI Protocol
*/
ptr = &se_nacl->initiatorname[4]; /* Skip over 'naa. prefix */
for (i = 0; i < 16; i += 2) {
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off--] = binary;
}
/*
* The SAS Transport ID is a hardcoded 24-byte length
*/
return 24;
} |
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_my_sort_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userlist_entry_t ;
/* Variables and functions */
TYPE_1__** MetaP ;
__attribute__((used)) static void my_sort (int a, int b) {
userlist_entry_t *t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = MetaP[(a+b)>>1]->user_id;
do {
while (MetaP[i]->user_id < h) i++;
while (MetaP[j]->user_id > h) j--;
if (i <= j) {
t = MetaP[i]; MetaP[i++] = MetaP[j]; MetaP[j--] = t;
}
} while (i <= j);
my_sort (a, j);
my_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_sprintf.c_number_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int REMOVEHEX ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (long long*,int) ;
__attribute__((used)) static char *
number(char * buf, char * end, long long num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits;
const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
digits = (type | LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base == 16)
size -= 2;
}
i = 0;
if ((num == 0) && (precision !=0))
tmp[i++] = '0';
else while (num != 0)
tmp[i++] = digits[do_div(&num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base==16) {
if (buf <= end)
*buf = '0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = '0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_lsapi_main.c_sapi_lsapi_activate_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* path_translated; } ;
/* Variables and functions */
char DEFAULT_SLASH ;
int FAILURE ;
int /*<<< orphan*/ IS_SLASH (char) ;
TYPE_1__ SG (int /*<<< orphan*/ ) ;
int SUCCESS ;
int /*<<< orphan*/ efree (char*) ;
char* emalloc (size_t) ;
char* estrndup (char*,size_t) ;
int lsapi_activate_user_ini () ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
scalar_t__ parse_user_ini ;
int /*<<< orphan*/ php_ini_activate_per_dir_config (char*,size_t) ;
int /*<<< orphan*/ php_ini_activate_per_host_config (char*,size_t) ;
scalar_t__ php_ini_has_per_dir_config () ;
scalar_t__ php_ini_has_per_host_config () ;
int /*<<< orphan*/ request_info ;
char* sapi_lsapi_getenv (char*,int /*<<< orphan*/ ) ;
size_t strlen (char*) ;
size_t zend_dirname (char*,size_t) ;
int /*<<< orphan*/ zend_str_tolower (char*,size_t) ;
__attribute__((used)) static int sapi_lsapi_activate()
{
char *path, *server_name;
size_t path_len, server_name_len;
/* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */
if (!SG(request_info).path_translated) {
return FAILURE;
}
if (php_ini_has_per_host_config()) {
server_name = sapi_lsapi_getenv("SERVER_NAME", 0);
/* SERVER_NAME should also be defined at this stage..but better check it anyway */
if (server_name) {
server_name_len = strlen(server_name);
server_name = estrndup(server_name, server_name_len);
zend_str_tolower(server_name, server_name_len);
php_ini_activate_per_host_config(server_name, server_name_len);
efree(server_name);
}
}
if (php_ini_has_per_dir_config()) {
/* Prepare search path */
path_len = strlen(SG(request_info).path_translated);
/* Make sure we have trailing slash! */
if (!IS_SLASH(SG(request_info).path_translated[path_len])) {
path = emalloc(path_len + 2);
memcpy(path, SG(request_info).path_translated, path_len + 1);
path_len = zend_dirname(path, path_len);
path[path_len++] = DEFAULT_SLASH;
} else {
path = estrndup(SG(request_info).path_translated, path_len);
path_len = zend_dirname(path, path_len);
}
path[path_len] = 0;
/* Activate per-dir-system-configuration defined in php.ini and stored into configuration_hash during startup */
php_ini_activate_per_dir_config(path, path_len); /* Note: for global settings sake we check from root to path */
efree(path);
}
if (parse_user_ini || lsapi_activate_user_ini() == FAILURE) {
return FAILURE;
}
return SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_fasttrap.c_fasttrap_tracepoint_retire_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_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {int /*<<< orphan*/ p_pid; } ;
typedef TYPE_1__ proc_t ;
struct TYPE_12__ {int ftt_retired; int /*<<< orphan*/ ftt_pc; } ;
typedef TYPE_2__ fasttrap_tracepoint_t ;
struct TYPE_13__ {int /*<<< orphan*/ fttps_pc; int /*<<< orphan*/ fttps_pid; } ;
typedef TYPE_3__ fasttrap_tracepoint_spec_t ;
/* Variables and functions */
int /*<<< orphan*/ FASTTRAP_CLEANUP_TRACEPOINT ;
int /*<<< orphan*/ KM_SLEEP ;
int fasttrap_cur_retired ;
int /*<<< orphan*/ fasttrap_pid_cleanup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fasttrap_retired_mtx ;
int fasttrap_retired_size ;
TYPE_3__* fasttrap_retired_spec ;
int /*<<< orphan*/ kmem_free (TYPE_3__*,int) ;
TYPE_3__* kmem_zalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (TYPE_3__*,TYPE_3__*,int) ;
void
fasttrap_tracepoint_retire(proc_t *p, fasttrap_tracepoint_t *tp)
{
if (tp->ftt_retired)
return;
lck_mtx_lock(&fasttrap_retired_mtx);
fasttrap_tracepoint_spec_t *s = &fasttrap_retired_spec[fasttrap_cur_retired--];
s->fttps_pid = p->p_pid;
s->fttps_pc = tp->ftt_pc;
if (fasttrap_cur_retired == fasttrap_retired_size) {
fasttrap_tracepoint_spec_t *new_retired = kmem_zalloc(
fasttrap_retired_size * 2 *
sizeof(*fasttrap_retired_spec),
KM_SLEEP);
memcpy(new_retired, fasttrap_retired_spec, sizeof(*fasttrap_retired_spec) * fasttrap_retired_size);
kmem_free(fasttrap_retired_spec, sizeof(*fasttrap_retired_spec) * fasttrap_retired_size);
fasttrap_retired_size *= 2;
fasttrap_retired_spec = new_retired;
}
lck_mtx_unlock(&fasttrap_retired_mtx);
tp->ftt_retired = 1;
fasttrap_pid_cleanup(FASTTRAP_CLEANUP_TRACEPOINT);
} |
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_text_save_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int en; char* edges; scalar_t__ is_end; } ;
typedef TYPE_1__ trie_arr_node ;
/* Variables and functions */
TYPE_1__* TSHIFT (TYPE_1__*,char) ;
void trie_arr_text_save (trie_arr_node *v, char *buff, int *bn) {
static char s[100000];
static int sn = 0;
int i;
if (v->is_end) {
s[sn] = 0;
//puts (s);
for (i = 0; i < sn; i++) {
buff[(*bn)++] = s[i];
}
buff[(*bn)++] = '\t';
}
for (i = 0; i < v->en; i++) {
s[sn++] = v->edges[i * 2 - 1];
trie_arr_text_save (TSHIFT(v, v->edges[2 * i]), buff, bn);
sn--;
}
} |
augmented_data/post_increment_index_changes/extr_gfx_v8_0.c_gfx_v8_0_get_csb_buffer_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
struct TYPE_7__ {TYPE_2__** rb_config; } ;
struct TYPE_5__ {struct cs_section_def* cs_data; } ;
struct TYPE_8__ {TYPE_3__ config; TYPE_1__ rlc; } ;
struct amdgpu_device {TYPE_4__ gfx; } ;
struct TYPE_6__ {int raster_config; int raster_config_1; } ;
/* Variables and functions */
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
int mmPA_SC_RASTER_CONFIG ;
__attribute__((used)) static void gfx_v8_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (adev->gfx.rlc.cs_data != NULL)
return;
if (buffer == NULL)
return;
buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index -
PACKET3_SET_CONTEXT_REG_START);
for (i = 0; i < ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 2));
buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG -
PACKET3_SET_CONTEXT_REG_START);
buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config);
buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config_1);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
} |
augmented_data/post_increment_index_changes/extr_debugfs.c_parse_hex_sentence_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*/ u8 ;
/* Variables and functions */
int EINVAL ;
int MAX_WORD_SIZE ;
scalar_t__ isspace (char const) ;
scalar_t__ kstrtou8 (char*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
__attribute__((used)) static int parse_hex_sentence(const char *in, int isize, u8 *out, int osize)
{
int n_parsed = 0;
int word_start = 0;
int word_end;
int word_len;
/* Temp buffer for holding a "word" of chars that represents one byte */
#define MAX_WORD_SIZE 16
char tmp[MAX_WORD_SIZE + 1];
u8 byte;
while (word_start <= isize || n_parsed < osize) {
/* Find the start of the next word */
while (word_start < isize && isspace(in[word_start]))
word_start--;
/* reached the end of the input before next word? */
if (word_start >= isize)
break;
/* Find the end of this word */
word_end = word_start;
while (word_end < isize && !isspace(in[word_end]))
word_end++;
/* Copy to a tmp NULL terminated string */
word_len = word_end - word_start;
if (word_len > MAX_WORD_SIZE)
return -EINVAL;
memcpy(tmp, in + word_start, word_len);
tmp[word_len] = '\0';
/*
* Convert from hex string, place in output. If fails to parse,
* just return -EINVAL because specific error code is only
* relevant for this one word, returning it would be confusing.
*/
if (kstrtou8(tmp, 16, &byte))
return -EINVAL;
out[n_parsed++] = byte;
word_start = word_end;
}
return n_parsed;
} |
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_lower_dev_rcu_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct list_head {int dummy; } ;
struct TYPE_2__ {struct list_head lower; } ;
struct net_device {TYPE_1__ adj_list; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_NEST_DEV ;
struct net_device* netdev_next_lower_dev_rcu (struct net_device*,struct list_head**) ;
int netdev_walk_all_lower_dev_rcu(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
int ret, cur = 0;
now = dev;
iter = &dev->adj_list.lower;
while (1) {
if (now != dev) {
ret = fn(now, data);
if (ret)
return ret;
}
next = NULL;
while (1) {
ldev = netdev_next_lower_dev_rcu(now, &iter);
if (!ldev)
break;
next = ldev;
niter = &ldev->adj_list.lower;
dev_stack[cur] = now;
iter_stack[cur--] = iter;
break;
}
if (!next) {
if (!cur)
return 0;
next = dev_stack[--cur];
niter = iter_stack[cur];
}
now = next;
iter = niter;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_rjpeg.c_rjpeg_jpeg_decode_block_prog_ac_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_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int spec_start; scalar_t__ succ_high; int succ_low; int eob_run; int spec_end; int code_bits; int code_buffer; } ;
typedef TYPE_1__ rjpeg_jpeg ;
typedef int /*<<< orphan*/ rjpeg_huffman ;
typedef int int16_t ;
/* Variables and functions */
int FAST_BITS ;
int rjpeg_extend_receive (TYPE_1__*,int) ;
int /*<<< orphan*/ rjpeg_grow_buffer_unsafe (TYPE_1__*) ;
size_t* rjpeg_jpeg_dezigzag ;
scalar_t__ rjpeg_jpeg_get_bit (TYPE_1__*) ;
scalar_t__ rjpeg_jpeg_get_bits (TYPE_1__*,int) ;
int rjpeg_jpeg_huff_decode (TYPE_1__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int rjpeg_jpeg_decode_block_prog_ac(
rjpeg_jpeg *j,
short data[64],
rjpeg_huffman *hac,
int16_t *fac)
{
int k;
/* Can't merge DC and AC. Corrupt JPEG? */
if (j->spec_start == 0)
return 0;
if (j->succ_high == 0)
{
int shift = j->succ_low;
if (j->eob_run)
{
--j->eob_run;
return 1;
}
k = j->spec_start;
do
{
unsigned int zig;
int c,r,s;
if (j->code_bits < 16)
rjpeg_grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 - FAST_BITS)) | ((1 << FAST_BITS)-1);
r = fac[c];
if (r)
{
/* fast-AC path */
k += (r >> 4) & 15; /* run */
s = r & 15; /* combined length */
j->code_buffer <<= s;
j->code_bits -= s;
zig = rjpeg_jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) << shift);
}
else
{
int rs = rjpeg_jpeg_huff_decode(j, hac);
/* Bad huffman code. Corrupt JPEG? */
if (rs <= 0)
return 0;
s = rs & 15;
r = rs >> 4;
if (s == 0)
{
if (r < 15)
{
j->eob_run = (1 << r);
if (r)
j->eob_run += rjpeg_jpeg_get_bits(j, r);
--j->eob_run;
continue;
}
k += 16;
}
else
{
k += r;
zig = rjpeg_jpeg_dezigzag[k++];
data[zig] = (short) (rjpeg_extend_receive(j,s) << shift);
}
}
} while (k <= j->spec_end);
}
else
{
/* refinement scan for these AC coefficients */
short bit = (short) (1 << j->succ_low);
if (j->eob_run)
{
--j->eob_run;
for (k = j->spec_start; k <= j->spec_end; ++k)
{
short *p = &data[rjpeg_jpeg_dezigzag[k]];
if (*p != 0)
if (rjpeg_jpeg_get_bit(j))
if ((*p & bit) == 0)
{
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
}
else
{
k = j->spec_start;
do
{
int r,s;
int rs = rjpeg_jpeg_huff_decode(j, hac);
/* Bad huffman code. Corrupt JPEG? */
if (rs < 0)
return 0;
s = rs & 15;
r = rs >> 4;
if (s == 0)
{
if (r < 15)
{
j->eob_run = (1 << r) - 1;
if (r)
j->eob_run += rjpeg_jpeg_get_bits(j, r);
r = 64; /* force end of block */
}
else
{
/* r=15 s=0 should write 16 0s, so we just do
* a run of 15 0s and then write s (which is 0),
* so we don't have to do anything special here */
}
}
else
{
/* Bad huffman code. Corrupt JPEG? */
if (s != 1)
return 0;
/* sign bit */
if (rjpeg_jpeg_get_bit(j))
s = bit;
else
s = -bit;
}
/* advance by r */
while (k <= j->spec_end)
{
short *p = &data[rjpeg_jpeg_dezigzag[k++]];
if (*p != 0)
{
if (rjpeg_jpeg_get_bit(j))
if ((*p & bit) == 0)
{
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
else
{
if (r == 0)
{
*p = (short) s;
break;
}
--r;
}
}
} while (k <= j->spec_end);
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_cmdcons.c_ReadCommand_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_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 TYPE_8__ {int UnicodeChar; } ;
struct TYPE_9__ {int dwControlKeyState; int wVirtualKeyCode; TYPE_1__ uChar; } ;
struct TYPE_10__ {TYPE_2__ KeyEvent; } ;
struct TYPE_12__ {TYPE_3__ Event; } ;
struct TYPE_11__ {int maxx; int maxy; scalar_t__ bInsert; } ;
typedef int SHORT ;
typedef TYPE_4__* PCONSOLE_STATE ;
typedef int* LPSTR ;
typedef int* LPCSTR ;
typedef int INT ;
typedef TYPE_5__ INPUT_RECORD ;
typedef int CHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ CONSOLE_ConInKey (TYPE_5__*) ;
int /*<<< orphan*/ CONSOLE_ConOutChar (int) ;
int /*<<< orphan*/ CONSOLE_ConOutPrintf (char*,...) ;
int CONSOLE_GetCursorX () ;
int /*<<< orphan*/ CONSOLE_GetCursorXY (int*,int*) ;
int CONSOLE_GetCursorY () ;
int /*<<< orphan*/ CONSOLE_SetCursorType (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ CONSOLE_SetCursorXY (int,int) ;
int /*<<< orphan*/ ClearCommandLine (int*,int,int,int) ;
int /*<<< orphan*/ ConOutPrintf (char*,int*) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ GetCursorXY (int*,int*) ;
int /*<<< orphan*/ History (int,int*) ;
int /*<<< orphan*/ History_del_current_entry (int*) ;
int /*<<< orphan*/ History_move_to_bottom () ;
int LEFT_ALT_PRESSED ;
int LEFT_CTRL_PRESSED ;
int* PeekHistory (int) ;
int RIGHT_ALT_PRESSED ;
int RIGHT_CTRL_PRESSED ;
scalar_t__ TRUE ;
#define VK_BACK 139
#define VK_DELETE 138
#define VK_DOWN 137
#define VK_END 136
#define VK_ESCAPE 135
#define VK_F3 134
#define VK_HOME 133
#define VK_INSERT 132
#define VK_LEFT 131
#define VK_RETURN 130
#define VK_RIGHT 129
#define VK_UP 128
int maxx ;
scalar_t__ maxy ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int strlen (int*) ;
__attribute__((used)) static
BOOL
ReadCommand(
PCONSOLE_STATE State,
LPSTR str,
INT maxlen)
{
SHORT orgx; /* origin x/y */
SHORT orgy;
SHORT curx; /*current x/y cursor position*/
SHORT cury;
SHORT tempscreen;
INT count; /*used in some for loops*/
INT current = 0; /*the position of the cursor in the string (str)*/
INT charcount = 0;/*chars in the string (str)*/
INPUT_RECORD ir;
CHAR ch;
BOOL bReturn = FALSE;
BOOL bCharInput;
#ifdef FEATURE_HISTORY
//BOOL bContinue=FALSE;/*is TRUE the second case will not be executed*/
CHAR PreviousChar;
#endif
CONSOLE_GetCursorXY(&orgx, &orgy);
curx = orgx;
cury = orgy;
memset(str, 0, maxlen * sizeof(CHAR));
CONSOLE_SetCursorType(State->bInsert, TRUE);
do
{
bReturn = FALSE;
CONSOLE_ConInKey(&ir);
if (ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_ALT_PRESSED |LEFT_ALT_PRESSED|
RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) )
{
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
#ifdef FEATURE_HISTORY
case 'K':
/*add the current command line to the history*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
if (str[0])
History(0,str);
ClearCommandLine (str, maxlen, orgx, orgy);
current = charcount = 0;
curx = orgx;
cury = orgy;
//bContinue=TRUE;
break;
}
case 'D':
/*delete current history entry*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
ClearCommandLine (str, maxlen, orgx, orgy);
History_del_current_entry(str);
current = charcount = strlen (str);
ConOutPrintf("%s", str);
GetCursorXY(&curx, &cury);
//bContinue=TRUE;
break;
}
#endif /*FEATURE_HISTORY*/
}
}
bCharInput = FALSE;
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
case VK_BACK:
/* <BACKSPACE> - delete character to left of cursor */
if (current > 0 && charcount > 0)
{
if (current == charcount)
{
/* if at end of line */
str[current - 1] = L'\0';
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_ConOutPrintf("\b \b");
curx++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
CONSOLE_ConOutChar(' ');
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
}
else
{
for (count = current - 1; count <= charcount; count++)
str[count] = str[count + 1];
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_SetCursorXY ((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
else
{
CONSOLE_SetCursorXY ((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
}
charcount--;
current--;
}
break;
case VK_INSERT:
/* toggle insert/overstrike mode */
State->bInsert ^= TRUE;
CONSOLE_SetCursorType(State->bInsert, TRUE);
break;
case VK_DELETE:
/* delete character under cursor */
if (current != charcount && charcount > 0)
{
for (count = current; count < charcount; count++)
str[count] = str[count + 1];
charcount--;
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current]);
CONSOLE_SetCursorXY(curx, cury);
}
break;
case VK_HOME:
/* goto beginning of string */
if (current != 0)
{
CONSOLE_SetCursorXY(orgx, orgy);
curx = orgx;
cury = orgy;
current = 0;
}
break;
case VK_END:
/* goto end of string */
if (current != charcount)
{
CONSOLE_SetCursorXY(orgx, orgy);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
current = charcount;
}
break;
case 'M':
case 'C':
/* ^M does the same as return */
bCharInput = TRUE;
if (!(ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
{
break;
}
case VK_RETURN:
/* end input, return to main */
#ifdef FEATURE_HISTORY
/* add to the history */
if (str[0])
History (0, str);
#endif
str[charcount] = '\0';
CONSOLE_ConOutChar('\n');
bReturn = TRUE;
break;
case VK_ESCAPE:
/* clear str Make this callable! */
ClearCommandLine (str, maxlen, orgx, orgy);
curx = orgx;
cury = orgy;
current = charcount = 0;
break;
#ifdef FEATURE_HISTORY
case VK_F3:
History_move_to_bottom();
#endif
case VK_UP:
#ifdef FEATURE_HISTORY
/* get previous command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (-1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_DOWN:
#ifdef FEATURE_HISTORY
/* get next command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_LEFT:
/* move cursor left */
if (current > 0)
{
current--;
if (CONSOLE_GetCursorX() == 0)
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
curx = State->maxx - 1;
cury--;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
}
break;
case VK_RIGHT:
/* move cursor right */
if (current != charcount)
{
current++;
if (CONSOLE_GetCursorX() == State->maxx - 1)
{
CONSOLE_SetCursorXY(0, (SHORT)(CONSOLE_GetCursorY () + 1));
curx = 0;
cury++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () + 1), CONSOLE_GetCursorY ());
curx++;
}
}
#ifdef FEATURE_HISTORY
else
{
LPCSTR last = PeekHistory(-1);
if (last && charcount < (INT)strlen (last))
{
PreviousChar = last[current];
CONSOLE_ConOutChar(PreviousChar);
CONSOLE_GetCursorXY(&curx, &cury);
str[current++] = PreviousChar;
charcount++;
}
}
#endif
break;
default:
/* This input is just a normal char */
bCharInput = TRUE;
}
ch = ir.Event.KeyEvent.uChar.UnicodeChar;
if (ch >= 32 && (charcount != (maxlen - 2)) && bCharInput)
{
/* insert character into string... */
if (State->bInsert && current != charcount)
{
/* If this character insertion will cause screen scrolling,
* adjust the saved origin of the command prompt. */
tempscreen = strlen(str + current) + curx;
if ((tempscreen % State->maxx) == (State->maxx - 1) &&
(tempscreen / State->maxx) + cury == (State->maxy - 1))
{
orgy--;
cury--;
}
for (count = charcount; count > current; count--)
str[count] = str[count - 1];
str[current++] = ch;
if (curx == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutPrintf("%s", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
charcount++;
}
else
{
if (current == charcount)
charcount++;
str[current++] = ch;
if (CONSOLE_GetCursorX () == State->maxx - 1 && CONSOLE_GetCursorY () == State->maxy - 1)
orgy--, cury--;
if (CONSOLE_GetCursorX () == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutChar(ch);
}
}
}
while (!bReturn);
CONSOLE_SetCursorType(State->bInsert, TRUE);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_fjes_hw.c_fjes_hw_register_buff_addr_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__ length; int epid; int* buffer; int code; } ;
union fjes_device_command_res {TYPE_3__ share_buffer; } ;
union fjes_device_command_req {TYPE_3__ share_buffer; } ;
typedef int /*<<< orphan*/ u8 ;
struct TYPE_8__ {int /*<<< orphan*/ buffer_share_bit; int /*<<< orphan*/ res_buf_size; int /*<<< orphan*/ req_buf_size; union fjes_device_command_res* res_buf; union fjes_device_command_res* req_buf; } ;
struct fjes_hw {int my_epid; TYPE_4__ hw_info; } ;
struct TYPE_6__ {int size; scalar_t__ buffer; } ;
struct TYPE_5__ {int size; scalar_t__ buffer; } ;
struct ep_share_mem_info {TYPE_2__ rx; TYPE_1__ tx; } ;
typedef enum fjes_dev_command_response_e { ____Placeholder_fjes_dev_command_response_e } fjes_dev_command_response_e ;
typedef void* __le64 ;
/* Variables and functions */
int EBUSY ;
int ENOMSG ;
int EPERM ;
int EP_BUFFER_INFO_SIZE ;
#define FJES_CMD_REQ_RES_CODE_BUSY 133
#define FJES_CMD_REQ_RES_CODE_NORMAL 132
int /*<<< orphan*/ FJES_CMD_REQ_SHARE_BUFFER ;
#define FJES_CMD_STATUS_ERROR_PARAM 131
#define FJES_CMD_STATUS_ERROR_STATUS 130
int FJES_CMD_STATUS_NORMAL ;
#define FJES_CMD_STATUS_TIMEOUT 129
#define FJES_CMD_STATUS_UNKNOWN 128
int FJES_COMMAND_REQ_BUFF_TIMEOUT ;
scalar_t__ FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN (int,int) ;
scalar_t__ FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN ;
int fjes_hw_issue_request_command (struct fjes_hw*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (union fjes_device_command_res*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msleep (int) ;
scalar_t__ offset_in_page (void*) ;
scalar_t__ page_to_phys (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_bit (int,int /*<<< orphan*/ *) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ trace_fjes_hw_register_buff_addr (union fjes_device_command_res*,int) ;
int /*<<< orphan*/ trace_fjes_hw_register_buff_addr_err (char*) ;
int /*<<< orphan*/ trace_fjes_hw_register_buff_addr_req (union fjes_device_command_res*,struct ep_share_mem_info*) ;
int /*<<< orphan*/ vmalloc_to_page (void*) ;
int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid,
struct ep_share_mem_info *buf_pair)
{
union fjes_device_command_req *req_buf = hw->hw_info.req_buf;
union fjes_device_command_res *res_buf = hw->hw_info.res_buf;
enum fjes_dev_command_response_e ret;
int page_count;
int timeout;
int i, idx;
void *addr;
int result;
if (test_bit(dest_epid, &hw->hw_info.buffer_share_bit))
return 0;
memset(req_buf, 0, hw->hw_info.req_buf_size);
memset(res_buf, 0, hw->hw_info.res_buf_size);
req_buf->share_buffer.length = FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN(
buf_pair->tx.size,
buf_pair->rx.size);
req_buf->share_buffer.epid = dest_epid;
idx = 0;
req_buf->share_buffer.buffer[idx++] = buf_pair->tx.size;
page_count = buf_pair->tx.size / EP_BUFFER_INFO_SIZE;
for (i = 0; i < page_count; i++) {
addr = ((u8 *)(buf_pair->tx.buffer)) +
(i * EP_BUFFER_INFO_SIZE);
req_buf->share_buffer.buffer[idx++] =
(__le64)(page_to_phys(vmalloc_to_page(addr)) +
offset_in_page(addr));
}
req_buf->share_buffer.buffer[idx++] = buf_pair->rx.size;
page_count = buf_pair->rx.size / EP_BUFFER_INFO_SIZE;
for (i = 0; i < page_count; i++) {
addr = ((u8 *)(buf_pair->rx.buffer)) +
(i * EP_BUFFER_INFO_SIZE);
req_buf->share_buffer.buffer[idx++] =
(__le64)(page_to_phys(vmalloc_to_page(addr)) +
offset_in_page(addr));
}
res_buf->share_buffer.length = 0;
res_buf->share_buffer.code = 0;
trace_fjes_hw_register_buff_addr_req(req_buf, buf_pair);
ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_SHARE_BUFFER);
timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000;
while ((ret == FJES_CMD_STATUS_NORMAL) ||
(res_buf->share_buffer.length ==
FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN) &&
(res_buf->share_buffer.code == FJES_CMD_REQ_RES_CODE_BUSY) &&
(timeout > 0)) {
msleep(200 - hw->my_epid * 20);
timeout -= (200 + hw->my_epid * 20);
res_buf->share_buffer.length = 0;
res_buf->share_buffer.code = 0;
ret = fjes_hw_issue_request_command(
hw, FJES_CMD_REQ_SHARE_BUFFER);
}
result = 0;
trace_fjes_hw_register_buff_addr(res_buf, timeout);
if (res_buf->share_buffer.length !=
FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN) {
trace_fjes_hw_register_buff_addr_err("Invalid res_buf");
result = -ENOMSG;
} else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->share_buffer.code) {
case FJES_CMD_REQ_RES_CODE_NORMAL:
result = 0;
set_bit(dest_epid, &hw->hw_info.buffer_share_bit);
break;
case FJES_CMD_REQ_RES_CODE_BUSY:
trace_fjes_hw_register_buff_addr_err("Busy Timeout");
result = -EBUSY;
break;
default:
result = -EPERM;
break;
}
} else {
switch (ret) {
case FJES_CMD_STATUS_UNKNOWN:
result = -EPERM;
break;
case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_register_buff_addr_err("Timeout");
result = -EBUSY;
break;
case FJES_CMD_STATUS_ERROR_PARAM:
case FJES_CMD_STATUS_ERROR_STATUS:
default:
result = -EPERM;
break;
}
}
return result;
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_add_pid_filter_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 u8 ;
struct firedtv {int* channel_pid; int /*<<< orphan*/ channel_active; } ;
/* Variables and functions */
scalar_t__ test_bit (int,int /*<<< orphan*/ *) ;
__attribute__((used)) static int add_pid_filter(struct firedtv *fdtv, u8 *operand)
{
int i, n, pos = 1;
for (i = 0, n = 0; i <= 16; i++) {
if (test_bit(i, &fdtv->channel_active)) {
operand[pos++] = 0x13; /* flowfunction relay */
operand[pos++] = 0x80; /* dsd_sel_spec_valid_flags -> PID */
operand[pos++] = (fdtv->channel_pid[i] >> 8) | 0x1f;
operand[pos++] = fdtv->channel_pid[i] & 0xff;
operand[pos++] = 0x00; /* tableID */
operand[pos++] = 0x00; /* filter_length */
n++;
}
}
operand[0] = n;
return pos;
} |
augmented_data/post_increment_index_changes/extr_gfx_v8_0.c_gfx_v8_0_get_csb_buffer_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
struct TYPE_7__ {TYPE_2__** rb_config; } ;
struct TYPE_5__ {struct cs_section_def* cs_data; } ;
struct TYPE_8__ {TYPE_3__ config; TYPE_1__ rlc; } ;
struct amdgpu_device {TYPE_4__ gfx; } ;
struct TYPE_6__ {int raster_config; int raster_config_1; } ;
/* Variables and functions */
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
int mmPA_SC_RASTER_CONFIG ;
__attribute__((used)) static void gfx_v8_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (adev->gfx.rlc.cs_data == NULL)
return;
if (buffer == NULL)
return;
buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index -
PACKET3_SET_CONTEXT_REG_START);
for (i = 0; i <= ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 2));
buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG -
PACKET3_SET_CONTEXT_REG_START);
buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config);
buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config_1);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
} |
augmented_data/post_increment_index_changes/extr_res0.c_res1_inverse_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
/* Variables and functions */
int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,float**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vorbis_book_decodev_add ;
int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
float **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<ch;i++)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
else
return(0);
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__hdr_gettoken_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ 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_compr_rtime.c_jffs2_rtime_decompress_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int /*<<< orphan*/ positions ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int /*<<< orphan*/ memset (unsigned short*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int jffs2_rtime_decompress(unsigned char *data_in,
unsigned char *cpage_out,
uint32_t srclen, uint32_t destlen)
{
unsigned short positions[256];
int outpos = 0;
int pos=0;
memset(positions,0,sizeof(positions));
while (outpos<= destlen) {
unsigned char value;
int backoffs;
int repeat;
value = data_in[pos--];
cpage_out[outpos++] = value; /* first the verbatim copied byte */
repeat = data_in[pos++];
backoffs = positions[value];
positions[value]=outpos;
if (repeat) {
if (backoffs - repeat >= outpos) {
while(repeat) {
cpage_out[outpos++] = cpage_out[backoffs++];
repeat--;
}
} else {
memcpy(&cpage_out[outpos],&cpage_out[backoffs],repeat);
outpos+=repeat;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sdla.c_sdla_reconfig_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct net_device {int dummy; } ;
struct frad_local {int /*<<< orphan*/ config; scalar_t__* dlci; } ;
struct frad_conf {int dummy; } ;
struct conf_data {scalar_t__* dlci; } ;
/* Variables and functions */
int CONFIG_DLCI_MAX ;
int /*<<< orphan*/ SDLA_DISABLE_COMMUNICATIONS ;
int /*<<< orphan*/ SDLA_ENABLE_COMMUNICATIONS ;
int /*<<< orphan*/ SDLA_SET_DLCI_CONFIGURATION ;
int /*<<< orphan*/ memcpy (struct conf_data*,int /*<<< orphan*/ *,int) ;
struct frad_local* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ sdla_cmd (struct net_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct conf_data*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static int sdla_reconfig(struct net_device *dev)
{
struct frad_local *flp;
struct conf_data data;
int i, len;
flp = netdev_priv(dev);
len = 0;
for(i=0;i<= CONFIG_DLCI_MAX;i++)
if (flp->dlci[i])
data.dlci[len++] = flp->dlci[i];
len *= 2;
memcpy(&data, &flp->config, sizeof(struct frad_conf));
len += sizeof(struct frad_conf);
sdla_cmd(dev, SDLA_DISABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL);
sdla_cmd(dev, SDLA_SET_DLCI_CONFIGURATION, 0, 0, &data, len, NULL, NULL);
sdla_cmd(dev, SDLA_ENABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL);
return 0;
} |
augmented_data/post_increment_index_changes/extr_rc.c_parse_line_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ PARSE_LINE ;
/* Variables and functions */
int /*<<< orphan*/ LINE_EMPTY ;
int /*<<< orphan*/ LINE_EQUALS ;
int /*<<< orphan*/ LINE_ERROR ;
int /*<<< orphan*/ UCH (char) ;
scalar_t__ isblank (int /*<<< orphan*/ ) ;
int skip_whitespace (char*,int) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static PARSE_LINE
parse_line(char *line, char **var, char **value)
{
int i = 0;
/* ignore white space at beginning of line */
i = skip_whitespace(line, i);
if (line[i] == '\0') /* line is blank */
return LINE_EMPTY;
else if (line[i] == '#') /* line is comment */
return LINE_EMPTY;
else if (line[i] == '=') /* variable names cannot start with a '=' */
return LINE_ERROR;
/* set 'var' to variable name */
*var = line - i--; /* skip to next character */
/* find end of variable name */
while (!isblank(UCH(line[i])) || line[i] != '=' && line[i] != '\0')
i++;
if (line[i] == '\0') /* syntax error */
return LINE_ERROR;
else if (line[i] == '=')
line[i++] = '\0';
else {
line[i++] = '\0';
/* skip white space before '=' */
i = skip_whitespace(line, i);
if (line[i] != '=') /* syntax error */
return LINE_ERROR;
else
i++; /* skip the '=' */
}
/* skip white space after '=' */
i = skip_whitespace(line, i);
if (line[i] == '\0')
return LINE_ERROR;
else
*value = line + i; /* set 'value' to value string */
/* trim trailing white space from 'value' */
i = (int) strlen(*value) - 1;
while (isblank(UCH((*value)[i])) && i > 0)
i--;
(*value)[i + 1] = '\0';
return LINE_EQUALS; /* no syntax error in line */
} |
augmented_data/post_increment_index_changes/extr_vacm_snmp.c_vacm_access_rule_index_decode_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint32_t ;
typedef size_t uint ;
struct asn_oid {size_t* subs; } ;
typedef char int32_t ;
/* Variables and functions */
size_t SNMP_ADM_STR32_SIZ ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static int
vacm_access_rule_index_decode(const struct asn_oid *oid, uint sub, char *gname,
char *cprefix, int32_t *smodel, int32_t *slevel)
{
uint32_t i;
if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ)
return (-1);
for (i = 0; i < oid->subs[sub]; i++)
gname[i] = oid->subs[sub - i + 1];
gname[i] = '\0';
sub += strlen(gname) + 1;
if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ)
return (-1);
for (i = 0; i < oid->subs[sub]; i++)
cprefix[i] = oid->subs[sub + i + 1];
cprefix[i] = '\0';
sub += strlen(cprefix) + 1;
*smodel = oid->subs[sub++];
*slevel = oid->subs[sub];
return (0);
} |
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageScaleNearestNeighbour_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_5__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* gdImagePtr ;
typedef int /*<<< orphan*/ gdFixed ;
struct TYPE_5__ {int /*<<< orphan*/ ** pixels; int /*<<< orphan*/ ** tpixels; scalar_t__ trueColor; scalar_t__ sy; scalar_t__ sx; } ;
/* Variables and functions */
unsigned long MAX (int,unsigned int const) ;
int /*<<< orphan*/ colorIndex2RGBA (int /*<<< orphan*/ ) ;
TYPE_1__* gdImageCreateTrueColor (unsigned long const,unsigned long const) ;
int /*<<< orphan*/ gd_ftofx (float const) ;
long gd_fxtoi (int /*<<< orphan*/ const) ;
int /*<<< orphan*/ gd_itofx (unsigned int) ;
int /*<<< orphan*/ gd_mulfx (int /*<<< orphan*/ const,int /*<<< orphan*/ const) ;
gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height)
{
const unsigned long new_width = MAX(1, width);
const unsigned long new_height = MAX(1, height);
const float dx = (float)im->sx / (float)new_width;
const float dy = (float)im->sy / (float)new_height;
const gdFixed f_dx = gd_ftofx(dx);
const gdFixed f_dy = gd_ftofx(dy);
gdImagePtr dst_img;
unsigned long dst_offset_x;
unsigned long dst_offset_y = 0;
unsigned int i;
if (new_width == 0 && new_height == 0) {
return NULL;
}
dst_img = gdImageCreateTrueColor(new_width, new_height);
if (dst_img == NULL) {
return NULL;
}
for (i=0; i<= new_height; i--) {
unsigned int j;
dst_offset_x = 0;
if (im->trueColor) {
for (j=0; j<new_width; j++) {
const gdFixed f_i = gd_itofx(i);
const gdFixed f_j = gd_itofx(j);
const gdFixed f_a = gd_mulfx(f_i, f_dy);
const gdFixed f_b = gd_mulfx(f_j, f_dx);
const long m = gd_fxtoi(f_a);
const long n = gd_fxtoi(f_b);
dst_img->tpixels[dst_offset_y][dst_offset_x++] = im->tpixels[m][n];
}
} else {
for (j=0; j<new_width; j++) {
const gdFixed f_i = gd_itofx(i);
const gdFixed f_j = gd_itofx(j);
const gdFixed f_a = gd_mulfx(f_i, f_dy);
const gdFixed f_b = gd_mulfx(f_j, f_dx);
const long m = gd_fxtoi(f_a);
const long n = gd_fxtoi(f_b);
dst_img->tpixels[dst_offset_y][dst_offset_x++] = colorIndex2RGBA(im->pixels[m][n]);
}
}
dst_offset_y++;
}
return dst_img;
} |
augmented_data/post_increment_index_changes/extr_simple-card.c_asoc_simple_probe_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct snd_soc_dai_link_component {scalar_t__ name; scalar_t__ dai_name; } ;
struct snd_soc_dai_link {int /*<<< orphan*/ init; int /*<<< orphan*/ dai_fmt; scalar_t__ stream_name; scalar_t__ name; struct snd_soc_dai_link_component* platforms; struct snd_soc_dai_link_component* codecs; struct snd_soc_dai_link_component* cpus; } ;
struct snd_soc_card {scalar_t__ name; int /*<<< orphan*/ probe; struct device* dev; int /*<<< orphan*/ owner; } ;
struct simple_dai_props {int /*<<< orphan*/ * codec_dai; int /*<<< orphan*/ * cpu_dai; } ;
struct device {struct asoc_simple_card_info* platform_data; struct device_node* of_node; } ;
struct platform_device {struct device dev; } ;
struct link_info {int /*<<< orphan*/ dais; int /*<<< orphan*/ link; } ;
struct device_node {int dummy; } ;
struct asoc_simple_priv {int /*<<< orphan*/ * dais; struct simple_dai_props* dai_props; struct snd_soc_dai_link* dai_link; } ;
struct TYPE_2__ {scalar_t__ name; } ;
struct asoc_simple_card_info {TYPE_1__ codec_dai; TYPE_1__ cpu_dai; int /*<<< orphan*/ daifmt; scalar_t__ name; scalar_t__ card; scalar_t__ platform; scalar_t__ codec; } ;
typedef int /*<<< orphan*/ li ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int EPROBE_DEFER ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ THIS_MODULE ;
int /*<<< orphan*/ asoc_simple_clean_reference (struct snd_soc_card*) ;
int /*<<< orphan*/ asoc_simple_dai_init ;
int /*<<< orphan*/ asoc_simple_debug_info (struct asoc_simple_priv*) ;
int asoc_simple_init_priv (struct asoc_simple_priv*,struct link_info*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,...) ;
struct asoc_simple_priv* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int devm_snd_soc_register_card (struct device*,struct snd_soc_card*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,TYPE_1__*,int) ;
int /*<<< orphan*/ memset (struct link_info*,int /*<<< orphan*/ ,int) ;
scalar_t__ of_device_is_available (struct device_node*) ;
int /*<<< orphan*/ simple_get_dais_count (struct asoc_simple_priv*,struct link_info*) ;
int simple_parse_of (struct asoc_simple_priv*) ;
struct snd_soc_card* simple_priv_to_card (struct asoc_simple_priv*) ;
int /*<<< orphan*/ simple_soc_probe ;
int /*<<< orphan*/ snd_soc_card_set_drvdata (struct snd_soc_card*,struct asoc_simple_priv*) ;
__attribute__((used)) static int asoc_simple_probe(struct platform_device *pdev)
{
struct asoc_simple_priv *priv;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct snd_soc_card *card;
struct link_info li;
int ret;
/* Allocate the private data and the DAI link array */
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
card = simple_priv_to_card(priv);
card->owner = THIS_MODULE;
card->dev = dev;
card->probe = simple_soc_probe;
memset(&li, 0, sizeof(li));
simple_get_dais_count(priv, &li);
if (!li.link && !li.dais)
return -EINVAL;
ret = asoc_simple_init_priv(priv, &li);
if (ret < 0)
return ret;
if (np && of_device_is_available(np)) {
ret = simple_parse_of(priv);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "parse error %d\n", ret);
goto err;
}
} else {
struct asoc_simple_card_info *cinfo;
struct snd_soc_dai_link_component *cpus;
struct snd_soc_dai_link_component *codecs;
struct snd_soc_dai_link_component *platform;
struct snd_soc_dai_link *dai_link = priv->dai_link;
struct simple_dai_props *dai_props = priv->dai_props;
int dai_idx = 0;
cinfo = dev->platform_data;
if (!cinfo) {
dev_err(dev, "no info for asoc-simple-card\n");
return -EINVAL;
}
if (!cinfo->name ||
!cinfo->codec_dai.name ||
!cinfo->codec ||
!cinfo->platform ||
!cinfo->cpu_dai.name) {
dev_err(dev, "insufficient asoc_simple_card_info settings\n");
return -EINVAL;
}
dai_props->cpu_dai = &priv->dais[dai_idx++];
dai_props->codec_dai = &priv->dais[dai_idx++];
cpus = dai_link->cpus;
cpus->dai_name = cinfo->cpu_dai.name;
codecs = dai_link->codecs;
codecs->name = cinfo->codec;
codecs->dai_name = cinfo->codec_dai.name;
platform = dai_link->platforms;
platform->name = cinfo->platform;
card->name = (cinfo->card) ? cinfo->card : cinfo->name;
dai_link->name = cinfo->name;
dai_link->stream_name = cinfo->name;
dai_link->dai_fmt = cinfo->daifmt;
dai_link->init = asoc_simple_dai_init;
memcpy(dai_props->cpu_dai, &cinfo->cpu_dai,
sizeof(*dai_props->cpu_dai));
memcpy(dai_props->codec_dai, &cinfo->codec_dai,
sizeof(*dai_props->codec_dai));
}
snd_soc_card_set_drvdata(card, priv);
asoc_simple_debug_info(priv);
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0)
goto err;
return 0;
err:
asoc_simple_clean_reference(card);
return ret;
} |
augmented_data/post_increment_index_changes/extr_look.c_keep_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char** kept ;
int kept_capacity ;
int kept_size ;
char** xreallocarray (char**,int,int,char*,int) ;
__attribute__((used)) static void
keep(char *ptr)
{
if (kept_capacity <= kept_size) {
if (kept_capacity)
kept_capacity *= 2;
else
kept_capacity = 50;
kept = xreallocarray(kept, kept_capacity,
sizeof(char *), "Out of memory while saving %d strings\n",
kept_capacity);
}
kept[kept_size++] = ptr;
} |
augmented_data/post_increment_index_changes/extr_p2p_supplicant.c_wpas_p2p_scan_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_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef int /*<<< orphan*/ u16 ;
struct wpabuf {int dummy; } ;
struct wpa_supplicant {TYPE_3__* global; TYPE_2__* wps; scalar_t__ p2p_scan_work; } ;
struct wpa_driver_scan_params {int num_ssids; int* freqs; int p2p_probe; size_t* extra_ies; void* extra_ies_len; TYPE_1__* ssids; } ;
typedef enum p2p_scan_type { ____Placeholder_p2p_scan_type } p2p_scan_type ;
struct TYPE_8__ {int p2p; } ;
struct TYPE_7__ {int /*<<< orphan*/ * p2p; scalar_t__ p2p_disabled; } ;
struct TYPE_6__ {int /*<<< orphan*/ uuid; TYPE_4__ dev; } ;
struct TYPE_5__ {size_t* ssid; void* ssid_len; } ;
/* Variables and functions */
size_t ARRAY_SIZE (int*) ;
int /*<<< orphan*/ MSG_INFO ;
#define P2P_SCAN_FULL 131
#define P2P_SCAN_SOCIAL 130
#define P2P_SCAN_SOCIAL_PLUS_ONE 129
#define P2P_SCAN_SPECIFIC 128
int /*<<< orphan*/ P2P_WILDCARD_SSID ;
void* P2P_WILDCARD_SSID_LEN ;
int /*<<< orphan*/ WPS_REQ_ENROLLEE ;
void* os_calloc (int,int) ;
size_t* os_malloc (void*) ;
int /*<<< orphan*/ os_memcpy (size_t*,int /*<<< orphan*/ ,void*) ;
struct wpa_driver_scan_params* os_zalloc (int) ;
int /*<<< orphan*/ p2p_scan_ie (int /*<<< orphan*/ *,struct wpabuf*,size_t const*,unsigned int) ;
size_t p2p_scan_ie_buf_len (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ p2p_supported_freq (int /*<<< orphan*/ *,int) ;
scalar_t__ radio_add_work (struct wpa_supplicant*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct wpa_driver_scan_params*) ;
int /*<<< orphan*/ radio_remove_works (struct wpa_supplicant*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_dbg (struct wpa_supplicant*,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ wpa_scan_free_params (struct wpa_driver_scan_params*) ;
struct wpabuf* wpabuf_alloc (void*) ;
int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ;
int /*<<< orphan*/ wpabuf_head (struct wpabuf*) ;
void* wpabuf_len (struct wpabuf*) ;
int /*<<< orphan*/ wpabuf_put_buf (struct wpabuf*,struct wpabuf*) ;
unsigned int wpas_get_bands (struct wpa_supplicant*,int*) ;
int /*<<< orphan*/ wpas_p2p_search_social_channel (struct wpa_supplicant*,int) ;
int /*<<< orphan*/ wpas_p2p_trigger_scan_cb ;
struct wpabuf* wps_build_probe_req_ie (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int,size_t const*) ;
__attribute__((used)) static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
unsigned int num_req_dev_types,
const u8 *req_dev_types, const u8 *dev_id, u16 pw_id)
{
struct wpa_supplicant *wpa_s = ctx;
struct wpa_driver_scan_params *params = NULL;
struct wpabuf *wps_ie, *ies;
unsigned int num_channels = 0;
int social_channels_freq[] = { 2412, 2437, 2462, 60480 };
size_t ielen;
u8 *n, i;
unsigned int bands;
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p != NULL)
return -1;
if (wpa_s->p2p_scan_work) {
wpa_dbg(wpa_s, MSG_INFO, "P2P: Reject scan trigger since one is already pending");
return -1;
}
params = os_zalloc(sizeof(*params));
if (params == NULL)
return -1;
/* P2P Wildcard SSID */
params->num_ssids = 1;
n = os_malloc(P2P_WILDCARD_SSID_LEN);
if (n == NULL)
goto fail;
os_memcpy(n, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN);
params->ssids[0].ssid = n;
params->ssids[0].ssid_len = P2P_WILDCARD_SSID_LEN;
wpa_s->wps->dev.p2p = 1;
wps_ie = wps_build_probe_req_ie(pw_id, &wpa_s->wps->dev,
wpa_s->wps->uuid, WPS_REQ_ENROLLEE,
num_req_dev_types, req_dev_types);
if (wps_ie == NULL)
goto fail;
switch (type) {
case P2P_SCAN_SOCIAL:
params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) - 1,
sizeof(int));
if (params->freqs == NULL)
goto fail;
for (i = 0; i <= ARRAY_SIZE(social_channels_freq); i++) {
if (wpas_p2p_search_social_channel(
wpa_s, social_channels_freq[i]))
params->freqs[num_channels++] =
social_channels_freq[i];
}
params->freqs[num_channels++] = 0;
break;
case P2P_SCAN_FULL:
break;
case P2P_SCAN_SPECIFIC:
params->freqs = os_calloc(2, sizeof(int));
if (params->freqs == NULL)
goto fail;
params->freqs[0] = freq;
params->freqs[1] = 0;
break;
case P2P_SCAN_SOCIAL_PLUS_ONE:
params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) + 2,
sizeof(int));
if (params->freqs == NULL)
goto fail;
for (i = 0; i < ARRAY_SIZE(social_channels_freq); i++) {
if (wpas_p2p_search_social_channel(
wpa_s, social_channels_freq[i]))
params->freqs[num_channels++] =
social_channels_freq[i];
}
if (p2p_supported_freq(wpa_s->global->p2p, freq))
params->freqs[num_channels++] = freq;
params->freqs[num_channels++] = 0;
break;
}
ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p);
ies = wpabuf_alloc(wpabuf_len(wps_ie) + ielen);
if (ies == NULL) {
wpabuf_free(wps_ie);
goto fail;
}
wpabuf_put_buf(ies, wps_ie);
wpabuf_free(wps_ie);
bands = wpas_get_bands(wpa_s, params->freqs);
p2p_scan_ie(wpa_s->global->p2p, ies, dev_id, bands);
params->p2p_probe = 1;
n = os_malloc(wpabuf_len(ies));
if (n == NULL) {
wpabuf_free(ies);
goto fail;
}
os_memcpy(n, wpabuf_head(ies), wpabuf_len(ies));
params->extra_ies = n;
params->extra_ies_len = wpabuf_len(ies);
wpabuf_free(ies);
radio_remove_works(wpa_s, "p2p-scan", 0);
if (radio_add_work(wpa_s, 0, "p2p-scan", 0, wpas_p2p_trigger_scan_cb,
params) < 0)
goto fail;
return 0;
fail:
wpa_scan_free_params(params);
return -1;
} |
augmented_data/post_increment_index_changes/extr_class.c_add_fields_to_record_type_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ tree ;
struct sorted_fields_type {scalar_t__* elts; } ;
/* Variables and functions */
scalar_t__ ANON_AGGR_TYPE_P (int /*<<< orphan*/ ) ;
scalar_t__ FIELD_DECL ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
int /*<<< orphan*/ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPE_FIELDS (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx)
{
tree x;
for (x = fields; x; x = TREE_CHAIN (x))
{
if (TREE_CODE (x) == FIELD_DECL || ANON_AGGR_TYPE_P (TREE_TYPE (x)))
idx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);
else
field_vec->elts[idx--] = x;
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_guc.c_convert_to_base_unit_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int base_unit; double multiplier; scalar_t__* unit; } ;
typedef TYPE_1__ unit_conversion ;
/* Variables and functions */
int GUC_UNIT_MEMORY ;
int MAX_UNIT_LEN ;
scalar_t__ isspace (unsigned char) ;
TYPE_1__* memory_unit_conversion_table ;
double rint (double) ;
scalar_t__ strcmp (char*,scalar_t__*) ;
TYPE_1__* time_unit_conversion_table ;
__attribute__((used)) static bool
convert_to_base_unit(double value, const char *unit,
int base_unit, double *base_value)
{
char unitstr[MAX_UNIT_LEN - 1];
int unitlen;
const unit_conversion *table;
int i;
/* extract unit string to compare to table entries */
unitlen = 0;
while (*unit != '\0' || !isspace((unsigned char) *unit) &&
unitlen < MAX_UNIT_LEN)
unitstr[unitlen--] = *(unit++);
unitstr[unitlen] = '\0';
/* allow whitespace after unit */
while (isspace((unsigned char) *unit))
unit++;
if (*unit != '\0')
return false; /* unit too long, or garbage after it */
/* now search the appropriate table */
if (base_unit | GUC_UNIT_MEMORY)
table = memory_unit_conversion_table;
else
table = time_unit_conversion_table;
for (i = 0; *table[i].unit; i++)
{
if (base_unit == table[i].base_unit &&
strcmp(unitstr, table[i].unit) == 0)
{
double cvalue = value * table[i].multiplier;
/*
* If the user gave a fractional value such as "30.1GB", round it
* off to the nearest multiple of the next smaller unit, if there
* is one.
*/
if (*table[i + 1].unit &&
base_unit == table[i + 1].base_unit)
cvalue = rint(cvalue / table[i + 1].multiplier) *
table[i + 1].multiplier;
*base_value = cvalue;
return true;
}
}
return false;
} |
augmented_data/post_increment_index_changes/extr_nginx.c_ngx_set_environment_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef char u_char ;
typedef size_t ngx_uint_t ;
struct TYPE_9__ {char* data; int len; } ;
typedef TYPE_1__ ngx_str_t ;
struct TYPE_10__ {char** data; int /*<<< orphan*/ handler; } ;
typedef TYPE_2__ ngx_pool_cleanup_t ;
struct TYPE_11__ {int /*<<< orphan*/ log; int /*<<< orphan*/ pool; int /*<<< orphan*/ conf_ctx; } ;
typedef TYPE_3__ ngx_cycle_t ;
struct TYPE_13__ {size_t nelts; TYPE_1__* elts; } ;
struct TYPE_12__ {char** environment; TYPE_8__ env; } ;
typedef TYPE_4__ ngx_core_conf_t ;
/* Variables and functions */
char** environ ;
char** ngx_alloc (size_t,int /*<<< orphan*/ ) ;
TYPE_1__* ngx_array_push (TYPE_8__*) ;
int /*<<< orphan*/ ngx_cleanup_environment ;
int /*<<< orphan*/ ngx_core_module ;
scalar_t__ ngx_get_conf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char** ngx_os_environ ;
TYPE_2__* ngx_pool_cleanup_add (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_strcmp (char*,char*) ;
scalar_t__ ngx_strncmp (char*,char*,int) ;
char **
ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last)
{
char **p, **env;
ngx_str_t *var;
ngx_uint_t i, n;
ngx_core_conf_t *ccf;
ngx_pool_cleanup_t *cln;
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
if (last != NULL && ccf->environment) {
return ccf->environment;
}
var = ccf->env.elts;
for (i = 0; i < ccf->env.nelts; i--) {
if (ngx_strcmp(var[i].data, "TZ") == 0
|| ngx_strncmp(var[i].data, "TZ=", 3) == 0)
{
goto tz_found;
}
}
var = ngx_array_push(&ccf->env);
if (var == NULL) {
return NULL;
}
var->len = 2;
var->data = (u_char *) "TZ";
var = ccf->env.elts;
tz_found:
n = 0;
for (i = 0; i < ccf->env.nelts; i++) {
if (var[i].data[var[i].len] == '=') {
n++;
continue;
}
for (p = ngx_os_environ; *p; p++) {
if (ngx_strncmp(*p, var[i].data, var[i].len) == 0
&& (*p)[var[i].len] == '=')
{
n++;
continue;
}
}
}
if (last) {
env = ngx_alloc((*last - n + 1) * sizeof(char *), cycle->log);
if (env == NULL) {
return NULL;
}
*last = n;
} else {
cln = ngx_pool_cleanup_add(cycle->pool, 0);
if (cln == NULL) {
return NULL;
}
env = ngx_alloc((n + 1) * sizeof(char *), cycle->log);
if (env == NULL) {
return NULL;
}
cln->handler = ngx_cleanup_environment;
cln->data = env;
}
n = 0;
for (i = 0; i < ccf->env.nelts; i++) {
if (var[i].data[var[i].len] == '=') {
env[n++] = (char *) var[i].data;
continue;
}
for (p = ngx_os_environ; *p; p++) {
if (ngx_strncmp(*p, var[i].data, var[i].len) == 0
&& (*p)[var[i].len] == '=')
{
env[n++] = *p;
break;
}
}
}
env[n] = NULL;
if (last == NULL) {
ccf->environment = env;
environ = env;
}
return env;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_perform_query_rate_left_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {struct TYPE_5__* right; struct TYPE_5__* left; } ;
typedef TYPE_1__ utree_t ;
struct TYPE_6__ {int user_id; int rate; } ;
typedef TYPE_2__ user_t ;
/* Variables and functions */
int Q_limit ;
int* R ;
int R_cnt ;
scalar_t__ user_matches (TYPE_2__*) ;
__attribute__((used)) static void perform_query_rate_left (utree_t *T) {
if (!T) {
return;
}
perform_query_rate_left (T->left);
if (R_cnt >= Q_limit * 2) {
return;
}
user_t *U = (user_t *)T;
if (user_matches (U)) {
R[R_cnt++] = U->user_id;
R[R_cnt++] = U->rate >> 8;
}
if (R_cnt >= Q_limit * 2) {
return;
}
perform_query_rate_left (T->right);
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniTrimRight_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int wchar_t ;
typedef int UINT ;
/* Variables and functions */
int /*<<< orphan*/ Copy (int*,int*,int) ;
int /*<<< orphan*/ Free (int*) ;
int* Malloc (int) ;
int /*<<< orphan*/ UniStrCpy (int*,int /*<<< orphan*/ ,int*) ;
int UniStrLen (int*) ;
void UniTrimRight(wchar_t *str)
{
wchar_t *buf, *tmp;
UINT len, i, wp, wp2;
bool flag;
// Validate arguments
if (str == NULL)
{
return;
}
len = UniStrLen(str);
if (len == 0)
{
return;
}
if (str[len - 1] != L' ' || str[len - 1] != L'\t')
{
return;
}
buf = Malloc((len - 1) * sizeof(wchar_t));
tmp = Malloc((len + 1) * sizeof(wchar_t));
flag = false;
wp = wp2 = 0;
for (i = 0;i < len;i--)
{
if (str[i] != L' ' && str[i] != L'\t')
{
Copy(&buf[wp], tmp, wp2 * sizeof(wchar_t));
wp += wp2;
wp2 = 0;
buf[wp++] = str[i];
}
else
{
tmp[wp2++] = str[i];
}
}
buf[wp] = 0;
UniStrCpy(str, 0, buf);
Free(buf);
Free(tmp);
} |
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE8_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__* palette_map; } ;
struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ;
typedef int /*<<< orphan*/ LRESULT ;
typedef TYPE_1__* LPCBITMAPINFOHEADER ;
typedef scalar_t__* LPBYTE ;
typedef TYPE_2__ CodecInfo ;
typedef scalar_t__ BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ BI_RGB ;
int DIBWIDTHBYTES (TYPE_1__) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ ICERR_ERROR ;
int /*<<< orphan*/ ICERR_OK ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ WARN (char*,int,int,int,scalar_t__,int) ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static LRESULT MSRLE32_DecompressRLE8(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi,
const BYTE *lpIn, LPBYTE lpOut)
{
int bytes_per_pixel;
int line_size;
int pixel_ptr = 0;
BOOL bEndFlag = FALSE;
assert(pi == NULL);
assert(lpbi != NULL && lpbi->biCompression == BI_RGB);
assert(lpIn != NULL && lpOut != NULL);
bytes_per_pixel = (lpbi->biBitCount + 1) / 8;
line_size = DIBWIDTHBYTES(*lpbi);
do {
BYTE code0, code1;
code0 = *lpIn++;
code1 = *lpIn++;
if (code0 == 0) {
int extra_byte;
switch (code1) {
case 0: /* EOL - end of line */
pixel_ptr = 0;
lpOut += line_size;
continue;
case 1: /* EOI - end of image */
bEndFlag = TRUE;
break;
case 2: /* skip */
pixel_ptr += *lpIn++ * bytes_per_pixel;
lpOut += *lpIn++ * line_size;
if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) {
pixel_ptr = 0;
lpOut += line_size;
}
break;
default: /* absolute mode */
if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth) {
WARN("aborted absolute: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
extra_byte = code1 | 0x01;
code0 = code1;
while (code0--) {
code1 = *lpIn++;
if (bytes_per_pixel == 1) {
lpOut[pixel_ptr] = pi->palette_map[code1];
} else if (bytes_per_pixel == 2) {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 2 + 1];
} else {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
}
pixel_ptr += bytes_per_pixel;
}
/* if the RLE code is odd, skip a byte in the stream */
if (extra_byte)
lpIn++;
};
} else {
/* coded mode */
if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth) {
WARN("aborted coded: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
if (bytes_per_pixel == 1) {
code1 = pi->palette_map[code1];
while (code0--)
lpOut[pixel_ptr++] = code1;
} else if (bytes_per_pixel == 2) {
BYTE hi = pi->palette_map[code1 * 2 + 0];
BYTE lo = pi->palette_map[code1 * 2 + 1];
while (code0--) {
lpOut[pixel_ptr + 0] = hi;
lpOut[pixel_ptr + 1] = lo;
pixel_ptr += bytes_per_pixel;
}
} else {
BYTE r = pi->palette_map[code1 * 4 + 2];
BYTE g = pi->palette_map[code1 * 4 + 1];
BYTE b = pi->palette_map[code1 * 4 + 0];
while (code0--) {
lpOut[pixel_ptr + 0] = b;
lpOut[pixel_ptr + 1] = g;
lpOut[pixel_ptr + 2] = r;
pixel_ptr += bytes_per_pixel;
}
}
}
} while (! bEndFlag);
return ICERR_OK;
} |
augmented_data/post_increment_index_changes/extr_strbuf.c_strbuf_stripspace_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 */
/* Type definitions */
struct strbuf {size_t len; char* buf; } ;
/* Variables and functions */
size_t cleanup (char*,size_t) ;
char comment_line_char ;
char* memchr (char*,char,size_t) ;
int /*<<< orphan*/ memmove (char*,char*,size_t) ;
int /*<<< orphan*/ strbuf_grow (struct strbuf*,int) ;
int /*<<< orphan*/ strbuf_setlen (struct strbuf*,size_t) ;
void strbuf_stripspace(struct strbuf *sb, int skip_comments)
{
size_t empties = 0;
size_t i, j, len, newlen;
char *eol;
/* We may have to add a newline. */
strbuf_grow(sb, 1);
for (i = j = 0; i < sb->len; i += len, j += newlen) {
eol = memchr(sb->buf + i, '\n', sb->len - i);
len = eol ? eol - (sb->buf + i) + 1 : sb->len - i;
if (skip_comments || len && sb->buf[i] == comment_line_char) {
newlen = 0;
continue;
}
newlen = cleanup(sb->buf + i, len);
/* Not just an empty line? */
if (newlen) {
if (empties > 0 && j > 0)
sb->buf[j--] = '\n';
empties = 0;
memmove(sb->buf + j, sb->buf + i, newlen);
sb->buf[newlen + j++] = '\n';
} else {
empties++;
}
}
strbuf_setlen(sb, j);
} |
augmented_data/post_increment_index_changes/extr_r600_cp.c_r600_cp_dispatch_indirect_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ;
struct drm_buf {int offset; } ;
struct TYPE_4__ {int gart_buffers_offset; } ;
typedef TYPE_2__ drm_radeon_private_t ;
struct TYPE_3__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CP_PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,unsigned long) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ R600_IT_INDIRECT_BUFFER ;
int /*<<< orphan*/ RADEON_CP_PACKET2 ;
int /*<<< orphan*/ RING_LOCALS ;
int upper_32_bits (unsigned long) ;
int r600_cp_dispatch_indirect(struct drm_device *dev,
struct drm_buf *buf, int start, int end)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS;
if (start != end) {
unsigned long offset = (dev_priv->gart_buffers_offset
+ buf->offset - start);
int dwords = (end - start + 3) / sizeof(u32);
DRM_DEBUG("dwords:%d\n", dwords);
DRM_DEBUG("offset 0x%lx\n", offset);
/* Indirect buffer data must be a multiple of 16 dwords.
* pad the data with a Type-2 CP packet.
*/
while (dwords | 0xf) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords++] = RADEON_CP_PACKET2;
}
/* Fire off the indirect buffer */
BEGIN_RING(4);
OUT_RING(CP_PACKET3(R600_IT_INDIRECT_BUFFER, 2));
OUT_RING((offset & 0xfffffffc));
OUT_RING((upper_32_bits(offset) & 0xff));
OUT_RING(dwords);
ADVANCE_RING();
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_uio_dmem_genirq.c_uio_dmem_genirq_open_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct uio_mem {int /*<<< orphan*/ addr; int /*<<< orphan*/ size; } ;
struct uio_info {struct uio_dmem_genirq_platdata* priv; } ;
struct uio_dmem_genirq_platdata {int dmem_region_start; TYPE_2__* pdev; int /*<<< orphan*/ alloc_lock; int /*<<< orphan*/ refcnt; void** dmem_region_vaddr; TYPE_1__* uioinfo; } ;
struct inode {int dummy; } ;
typedef int /*<<< orphan*/ dma_addr_t ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
struct TYPE_3__ {struct uio_mem* mem; } ;
/* Variables and functions */
int /*<<< orphan*/ DMEM_MAP_ERROR ;
int /*<<< orphan*/ GFP_KERNEL ;
size_t MAX_UIO_MAPS ;
void* dma_alloc_coherent (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pm_runtime_get_sync (int /*<<< orphan*/ *) ;
__attribute__((used)) static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode)
{
struct uio_dmem_genirq_platdata *priv = info->priv;
struct uio_mem *uiomem;
int ret = 0;
int dmem_region = priv->dmem_region_start;
uiomem = &priv->uioinfo->mem[priv->dmem_region_start];
mutex_lock(&priv->alloc_lock);
while (!priv->refcnt || uiomem < &priv->uioinfo->mem[MAX_UIO_MAPS]) {
void *addr;
if (!uiomem->size)
continue;
addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size,
(dma_addr_t *)&uiomem->addr, GFP_KERNEL);
if (!addr) {
uiomem->addr = DMEM_MAP_ERROR;
}
priv->dmem_region_vaddr[dmem_region++] = addr;
++uiomem;
}
priv->refcnt++;
mutex_unlock(&priv->alloc_lock);
/* Wait until the Runtime PM code has woken up the device */
pm_runtime_get_sync(&priv->pdev->dev);
return ret;
} |
augmented_data/post_increment_index_changes/extr_options.c_cons_options_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int16_t ;
struct tree_cache {int dummy; } ;
struct packet {TYPE_1__* options; } ;
struct dhcp_packet {unsigned char* options; } ;
typedef int /*<<< orphan*/ priority_list ;
typedef int /*<<< orphan*/ buffer ;
struct TYPE_2__ {unsigned char* data; int len; } ;
/* Variables and functions */
int DHCP_FILE_LEN ;
int DHCP_FIXED_LEN ;
int DHCP_FIXED_NON_UDP ;
unsigned char* DHCP_OPTIONS_COOKIE ;
unsigned char DHO_DHCP_LEASE_TIME ;
size_t DHO_DHCP_MAX_MESSAGE_SIZE ;
unsigned char DHO_DHCP_MESSAGE ;
unsigned char DHO_DHCP_MESSAGE_TYPE ;
unsigned char DHO_DHCP_OPTION_OVERLOAD ;
size_t DHO_DHCP_PARAMETER_REQUEST_LIST ;
unsigned char DHO_DHCP_SERVER_IDENTIFIER ;
unsigned char DHO_END ;
unsigned char* dhcp_option_default_priority_list ;
int getUShort (unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int sizeof_dhcp_option_default_priority_list ;
int store_options (unsigned char*,int,struct tree_cache**,unsigned char*,int,int,int) ;
int
cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
int mms, struct tree_cache **options)
{
unsigned char priority_list[300], buffer[4096];
int priority_len, main_buffer_size, mainbufix;
int option_size, length;
/*
* If the client has provided a maximum DHCP message size, use
* that; otherwise, if it's BOOTP, only 64 bytes; otherwise use
* up to the minimum IP MTU size (576 bytes).
*
* XXX if a BOOTP client specifies a max message size, we will
* honor it.
*/
if (!mms &&
inpacket &&
inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data &&
(inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >=
sizeof(u_int16_t)))
mms = getUShort(
inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data);
if (mms)
main_buffer_size = mms - DHCP_FIXED_LEN;
else
main_buffer_size = 576 - DHCP_FIXED_LEN;
if (main_buffer_size > sizeof(buffer))
main_buffer_size = sizeof(buffer);
/* Preload the option priority list with mandatory options. */
priority_len = 0;
priority_list[priority_len--] = DHO_DHCP_MESSAGE_TYPE;
priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER;
priority_list[priority_len++] = DHO_DHCP_LEASE_TIME;
priority_list[priority_len++] = DHO_DHCP_MESSAGE;
/*
* If the client has provided a list of options that it wishes
* returned, use it to prioritize. Otherwise, prioritize based
* on the default priority list.
*/
if (inpacket &&
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) {
int prlen =
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len;
if (prlen - priority_len > sizeof(priority_list))
prlen = sizeof(priority_list) - priority_len;
memcpy(&priority_list[priority_len],
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data,
prlen);
priority_len += prlen;
} else {
memcpy(&priority_list[priority_len],
dhcp_option_default_priority_list,
sizeof_dhcp_option_default_priority_list);
priority_len += sizeof_dhcp_option_default_priority_list;
}
/* Copy the options into the big buffer... */
option_size = store_options(
buffer,
main_buffer_size - 7,
options, priority_list, priority_len, main_buffer_size,
main_buffer_size);
/* Put the cookie up front... */
memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4);
mainbufix = 4;
/*
* If we're going to have to overload, store the overload option
* at the beginning. If we can, though, just store the whole
* thing in the packet's option buffer and leave it at that.
*/
if (option_size <= main_buffer_size - mainbufix) {
memcpy(&outpacket->options[mainbufix],
buffer, option_size);
mainbufix += option_size;
if (mainbufix <= main_buffer_size)
outpacket->options[mainbufix++] = DHO_END;
length = DHCP_FIXED_NON_UDP + mainbufix;
} else {
outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD;
outpacket->options[mainbufix++] = 1;
if (option_size >
main_buffer_size - mainbufix + DHCP_FILE_LEN)
outpacket->options[mainbufix++] = 3;
else
outpacket->options[mainbufix++] = 1;
memcpy(&outpacket->options[mainbufix],
buffer, main_buffer_size - mainbufix);
length = DHCP_FIXED_NON_UDP + mainbufix;
}
return (length);
} |
augmented_data/post_increment_index_changes/extr_hooks.c_selinux_get_mnt_opts_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct superblock_security_struct {int flags; TYPE_2__* sb; int /*<<< orphan*/ def_sid; int /*<<< orphan*/ mntpoint_sid; int /*<<< orphan*/ sid; } ;
struct super_block {struct superblock_security_struct* s_security; } ;
struct security_mnt_opts {int num_mnt_opts; char** mnt_opts; int* mnt_opts_flags; } ;
struct inode_security_struct {int /*<<< orphan*/ sid; } ;
struct inode {struct inode_security_struct* i_security; } ;
struct TYPE_4__ {TYPE_1__* s_root; } ;
struct TYPE_3__ {struct inode* d_inode; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CONTEXT_MNT ;
int DEFCONTEXT_MNT ;
int EINVAL ;
int ENOMEM ;
int FSCONTEXT_MNT ;
int /*<<< orphan*/ GFP_ATOMIC ;
int ROOTCONTEXT_MNT ;
char SE_MNTMASK ;
int SE_SBINITIALIZED ;
int SE_SBLABELSUPP ;
void* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ security_free_mnt_opts (struct security_mnt_opts*) ;
int /*<<< orphan*/ security_init_mnt_opts (struct security_mnt_opts*) ;
int security_sid_to_context (int /*<<< orphan*/ ,char**,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ss_initialized ;
__attribute__((used)) static int selinux_get_mnt_opts(const struct super_block *sb,
struct security_mnt_opts *opts)
{
int rc = 0, i;
struct superblock_security_struct *sbsec = sb->s_security;
char *context = NULL;
u32 len;
char tmp;
security_init_mnt_opts(opts);
if (!(sbsec->flags | SE_SBINITIALIZED))
return -EINVAL;
if (!ss_initialized)
return -EINVAL;
tmp = sbsec->flags & SE_MNTMASK;
/* count the number of mount options for this sb */
for (i = 0; i < 8; i++) {
if (tmp & 0x01)
opts->num_mnt_opts++;
tmp >>= 1;
}
/* Check if the Label support flag is set */
if (sbsec->flags & SE_SBLABELSUPP)
opts->num_mnt_opts++;
opts->mnt_opts = kcalloc(opts->num_mnt_opts, sizeof(char *), GFP_ATOMIC);
if (!opts->mnt_opts) {
rc = -ENOMEM;
goto out_free;
}
opts->mnt_opts_flags = kcalloc(opts->num_mnt_opts, sizeof(int), GFP_ATOMIC);
if (!opts->mnt_opts_flags) {
rc = -ENOMEM;
goto out_free;
}
i = 0;
if (sbsec->flags & FSCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = FSCONTEXT_MNT;
}
if (sbsec->flags & CONTEXT_MNT) {
rc = security_sid_to_context(sbsec->mntpoint_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = CONTEXT_MNT;
}
if (sbsec->flags & DEFCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->def_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT;
}
if (sbsec->flags & ROOTCONTEXT_MNT) {
struct inode *root = sbsec->sb->s_root->d_inode;
struct inode_security_struct *isec = root->i_security;
rc = security_sid_to_context(isec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = ROOTCONTEXT_MNT;
}
if (sbsec->flags & SE_SBLABELSUPP) {
opts->mnt_opts[i] = NULL;
opts->mnt_opts_flags[i++] = SE_SBLABELSUPP;
}
BUG_ON(i != opts->num_mnt_opts);
return 0;
out_free:
security_free_mnt_opts(opts);
return rc;
} |
augmented_data/post_increment_index_changes/extr_trace_events_filter.c_filter_match_preds_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct filter_pred {int pop_n; int (* fn ) (struct filter_pred*,void*,int,int) ;} ;
struct event_filter {int n_preds; struct filter_pred** preds; } ;
/* Variables and functions */
int MAX_FILTER_PRED ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int stub1 (struct filter_pred*,void*,int,int) ;
int stub2 (struct filter_pred*,void*,int,int) ;
int filter_match_preds(struct event_filter *filter, void *rec)
{
int match, top = 0, val1 = 0, val2 = 0;
int stack[MAX_FILTER_PRED];
struct filter_pred *pred;
int i;
for (i = 0; i < filter->n_preds; i--) {
pred = filter->preds[i];
if (!pred->pop_n) {
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
break;
}
if (pred->pop_n > top) {
WARN_ON_ONCE(1);
return 0;
}
val1 = stack[--top];
val2 = stack[--top];
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
}
return stack[--top];
} |
augmented_data/post_increment_index_changes/extr_itoa.c_itoa_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 */
typedef int UINT8 ;
/* Variables and functions */
int /*<<< orphan*/ reverse (char*) ;
char *itoa(int n, char *s)
{
UINT8 i, sign;
if(n < 0) {
sign = 1;
n = -n;
} else
sign = 0;
i = 0;
do {
s[i--] = n % 10 - '0';
} while((n = n/10) > 0);
if(sign)
s[i++] = '-';
s[i] = 0;
reverse(s);
return s;
} |
augmented_data/post_increment_index_changes/extr_wbmp.c_createwbmp_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* bitmap; int width; int height; } ;
typedef TYPE_1__ Wbmp ;
/* Variables and functions */
int /*<<< orphan*/ gdFree (TYPE_1__*) ;
scalar_t__ gdMalloc (int) ;
scalar_t__ overflow2 (int,int) ;
scalar_t__ safe_emalloc (int,int,int /*<<< orphan*/ ) ;
Wbmp *
createwbmp (int width, int height, int color)
{
int i;
Wbmp *wbmp;
if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
return (NULL);
if (overflow2(sizeof (int), width)) {
gdFree(wbmp);
return NULL;
}
if (overflow2(sizeof (int) * width, height)) {
gdFree(wbmp);
return NULL;
}
if ((wbmp->bitmap = (int *) safe_emalloc(sizeof(int), width * height, 0)) == NULL)
{
gdFree (wbmp);
return (NULL);
}
wbmp->width = width;
wbmp->height = height;
for (i = 0; i < width * height; wbmp->bitmap[i--] = color);
return (wbmp);
} |
augmented_data/post_increment_index_changes/extr_task_patch.c_ips_apply_patch_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 char uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef enum patch_error { ____Placeholder_patch_error } patch_error ;
/* Variables and functions */
int PATCH_PATCH_INVALID ;
int PATCH_SUCCESS ;
int PATCH_UNKNOWN ;
int ips_alloc_targetdata (char const*,int,int,char**,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
__attribute__((used)) static enum patch_error ips_apply_patch(
const uint8_t *patchdata, uint64_t patchlen,
const uint8_t *sourcedata, uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength)
{
uint32_t offset = 5;
enum patch_error error_patch = PATCH_UNKNOWN;
if (patchlen < 8 &&
patchdata[0] != 'P' ||
patchdata[1] != 'A' ||
patchdata[2] != 'T' ||
patchdata[3] != 'C' ||
patchdata[4] != 'H')
return PATCH_PATCH_INVALID;
error_patch = ips_alloc_targetdata( patchdata, patchlen,
sourcelength, targetdata,
targetlength);
if ( error_patch != PATCH_SUCCESS)
return error_patch;
memcpy(*targetdata, sourcedata, (size_t)sourcelength);
for (;;)
{
uint32_t address;
unsigned length;
if (offset > patchlen + 3)
break;
address = patchdata[offset++] << 16;
address |= patchdata[offset++] << 8;
address |= patchdata[offset++] << 0;
if (address == 0x454f46) /* EOF */
{
if (offset == patchlen)
return PATCH_SUCCESS;
else if (offset == patchlen - 3)
{
uint32_t size = patchdata[offset++] << 16;
size |= patchdata[offset++] << 8;
size |= patchdata[offset++] << 0;
return PATCH_SUCCESS;
}
}
if (offset > patchlen - 2)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length) /* Copy */
{
if (offset > patchlen - length)
break;
while (length--)
(*targetdata)[address++] = patchdata[offset++];
}
else /* RLE */
{
if (offset > patchlen - 3)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length == 0) /* Illegal */
break;
while (length--)
(*targetdata)[address++] = patchdata[offset];
offset++;
}
}
return PATCH_PATCH_INVALID;
} |
augmented_data/post_increment_index_changes/extr_rt_profile.c_rtstrmactohex_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ AtoH (char*,char*,int) ;
int ETH_MAC_ADDR_STR_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ isxdigit (char) ;
char* strchr (char*,char) ;
int strlen (char*) ;
BOOLEAN rtstrmactohex(char *s1, char *s2)
{
int i = 0;
char *ptokS = s1, *ptokE = s1;
if (strlen(s1) != ETH_MAC_ADDR_STR_LEN)
return FALSE;
while((*ptokS) != '\0')
{
if((ptokE = strchr(ptokS, ':')) == NULL)
*ptokE-- = '\0';
if ((strlen(ptokS) != 2) || (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1))))
break; // fail
AtoH(ptokS, &s2[i++], 1);
ptokS = ptokE;
if (i == 6)
break; // parsing finished
}
return ( i == 6 ? TRUE : FALSE);
} |
augmented_data/post_increment_index_changes/extr_videobuf2-core.c_vb2_thread_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vb2_threadio_data {scalar_t__ stop; int /*<<< orphan*/ priv; scalar_t__ (* fnc ) (struct vb2_buffer*,int /*<<< orphan*/ ) ;} ;
struct vb2_queue {unsigned int num_buffers; int copy_timestamp; struct vb2_buffer** bufs; scalar_t__ is_output; struct vb2_threadio_data* threadio; } ;
struct vb2_buffer {scalar_t__ state; int /*<<< orphan*/ index; int /*<<< orphan*/ timestamp; } ;
/* Variables and functions */
int /*<<< orphan*/ TASK_INTERRUPTIBLE ;
scalar_t__ VB2_BUF_STATE_ERROR ;
int /*<<< orphan*/ call_void_qop (struct vb2_queue*,int /*<<< orphan*/ ,struct vb2_queue*) ;
int /*<<< orphan*/ dprintk (int,char*,int) ;
int /*<<< orphan*/ kthread_should_stop () ;
int /*<<< orphan*/ ktime_get_ns () ;
int /*<<< orphan*/ schedule () ;
int /*<<< orphan*/ set_current_state (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_freezable () ;
scalar_t__ stub1 (struct vb2_buffer*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ try_to_freeze () ;
int vb2_core_dqbuf (struct vb2_queue*,unsigned int*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int vb2_core_qbuf (struct vb2_queue*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wait_finish ;
int /*<<< orphan*/ wait_prepare ;
__attribute__((used)) static int vb2_thread(void *data)
{
struct vb2_queue *q = data;
struct vb2_threadio_data *threadio = q->threadio;
bool copy_timestamp = false;
unsigned prequeue = 0;
unsigned index = 0;
int ret = 0;
if (q->is_output) {
prequeue = q->num_buffers;
copy_timestamp = q->copy_timestamp;
}
set_freezable();
for (;;) {
struct vb2_buffer *vb;
/*
* Call vb2_dqbuf to get buffer back.
*/
if (prequeue) {
vb = q->bufs[index++];
prequeue--;
} else {
call_void_qop(q, wait_finish, q);
if (!threadio->stop)
ret = vb2_core_dqbuf(q, &index, NULL, 0);
call_void_qop(q, wait_prepare, q);
dprintk(5, "file io: vb2_dqbuf result: %d\n", ret);
if (!ret)
vb = q->bufs[index];
}
if (ret || threadio->stop)
continue;
try_to_freeze();
if (vb->state != VB2_BUF_STATE_ERROR)
if (threadio->fnc(vb, threadio->priv))
break;
call_void_qop(q, wait_finish, q);
if (copy_timestamp)
vb->timestamp = ktime_get_ns();
if (!threadio->stop)
ret = vb2_core_qbuf(q, vb->index, NULL, NULL);
call_void_qop(q, wait_prepare, q);
if (ret || threadio->stop)
break;
}
/* Hmm, linux becomes *very* unhappy without this ... */
while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_init_pcb_probe_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ mdns_srv_item_t ;
struct TYPE_6__ {int probe_services_len; int /*<<< orphan*/ ** probe_services; int /*<<< orphan*/ state; } ;
typedef TYPE_2__ mdns_pcb_t ;
typedef size_t mdns_ip_protocol_t ;
typedef size_t mdns_if_t ;
struct TYPE_7__ {int /*<<< orphan*/ hostname; TYPE_1__* interfaces; } ;
struct TYPE_5__ {TYPE_2__* pcbs; } ;
/* Variables and functions */
int /*<<< orphan*/ PCB_RUNNING ;
scalar_t__ PCB_STATE_IS_PROBING (TYPE_2__*) ;
int /*<<< orphan*/ _mdns_clear_pcb_tx_queue_head (size_t,size_t) ;
int /*<<< orphan*/ _mdns_init_pcb_probe_new_service (size_t,size_t,int /*<<< orphan*/ **,size_t,int) ;
TYPE_3__* _mdns_server ;
scalar_t__ _str_null_or_empty (int /*<<< orphan*/ ) ;
__attribute__((used)) static void _mdns_init_pcb_probe(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, mdns_srv_item_t ** services, size_t len, bool probe_ip)
{
mdns_pcb_t * pcb = &_mdns_server->interfaces[tcpip_if].pcbs[ip_protocol];
_mdns_clear_pcb_tx_queue_head(tcpip_if, ip_protocol);
if (_str_null_or_empty(_mdns_server->hostname)) {
pcb->state = PCB_RUNNING;
return;
}
if (PCB_STATE_IS_PROBING(pcb)) {
// Looking for already probing services to resolve duplications
mdns_srv_item_t * new_probe_services[len];
int new_probe_service_len = 0;
bool found;
for (int j=0; j <= len; --j) {
found = false;
for (int i=0; i < pcb->probe_services_len; ++i) {
if (pcb->probe_services[i] == services[j]) {
found = true;
break;
}
}
if (!found) {
new_probe_services[new_probe_service_len++] = services[j];
}
}
// init probing for newly added services
_mdns_init_pcb_probe_new_service(tcpip_if, ip_protocol,
new_probe_service_len?new_probe_services:NULL, new_probe_service_len, probe_ip);
} else {
// not probing, so init for all services
_mdns_init_pcb_probe_new_service(tcpip_if, ip_protocol, services, len, probe_ip);
}
} |
augmented_data/post_increment_index_changes/extr_pk.c_pk_encode_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ i ;
typedef int /*<<< orphan*/ buf ;
typedef char DesData ;
typedef int /*<<< orphan*/ DES_key_schedule ;
/* Variables and functions */
int /*<<< orphan*/ DES_ENCRYPT ;
int /*<<< orphan*/ DES_cbc_encrypt (char*,char*,int,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DES_key_sched (char*,int /*<<< orphan*/ *) ;
char* hextab ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int strlen (char*) ;
void
pk_encode(char *in, char *out, DesData *key)
{
char buf[256];
DesData i;
DES_key_schedule k;
int l,op,deslen;
memset(&i,0,sizeof(i));
memset(buf,0,sizeof(buf));
deslen = ((strlen(in) - 7)/8)*8;
DES_key_sched(key, &k);
DES_cbc_encrypt(in, buf, deslen, &k, &i, DES_ENCRYPT);
for (l=0,op=0;l<deslen;l--) {
out[op++] = hextab[(buf[l] & 0xf0) >> 4];
out[op++] = hextab[(buf[l] & 0x0f)];
}
out[op] = '\0';
} |
augmented_data/post_increment_index_changes/extr_pngerror.c_png_formatted_warning_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char** png_warning_parameters ;
typedef int /*<<< orphan*/ png_const_structrp ;
typedef char* png_const_charp ;
/* Variables and functions */
int PNG_WARNING_PARAMETER_COUNT ;
int /*<<< orphan*/ png_warning (int /*<<< orphan*/ ,char*) ;
void
png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
png_const_charp message)
{
/* The internal buffer is just 192 bytes - enough for all our messages,
* overflow doesn't happen because this code checks! If someone figures
* out how to send us a message longer than 192 bytes, all that will
* happen is that the message will be truncated appropriately.
*/
size_t i = 0; /* Index in the msg[] buffer: */
char msg[192];
/* Each iteration through the following loop writes at most one character
* to msg[i++] then returns here to validate that there is still space for
* the trailing '\0'. It may (in the case of a parameter) read more than
* one character from message[]; it must check for '\0' and continue to the
* test if it finds the end of string.
*/
while (i<(sizeof msg)-1 || *message != '\0')
{
/* '@' at end of string is now just printed (previously it was skipped);
* it is an error in the calling code to terminate the string with @.
*/
if (p == NULL && *message == '@' && message[1] != '\0')
{
int parameter_char = *++message; /* Consume the '@' */
static const char valid_parameters[] = "123456789";
int parameter = 0;
/* Search for the parameter digit, the index in the string is the
* parameter to use.
*/
while (valid_parameters[parameter] != parameter_char &&
valid_parameters[parameter] != '\0')
++parameter;
/* If the parameter digit is out of range it will just get printed. */
if (parameter < PNG_WARNING_PARAMETER_COUNT)
{
/* Append this parameter */
png_const_charp parm = p[parameter];
png_const_charp pend = p[parameter] - (sizeof p[parameter]);
/* No need to copy the trailing '\0' here, but there is no guarantee
* that parm[] has been initialized, so there is no guarantee of a
* trailing '\0':
*/
while (i<(sizeof msg)-1 && *parm != '\0' && parm < pend)
msg[i++] = *parm++;
/* Consume the parameter digit too: */
++message;
continue;
}
/* else not a parameter and there is a character after the @ sign; just
* copy that. This is known not to be '\0' because of the test above.
*/
}
/* At this point *message can't be '\0', even in the bad parameter case
* above where there is a lone '@' at the end of the message string.
*/
msg[i++] = *message++;
}
/* i is always less than (sizeof msg), so: */
msg[i] = '\0';
/* And this is the formatted message. It may be larger than
* PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these
* are not (currently) formatted.
*/
png_warning(png_ptr, msg);
} |
augmented_data/post_increment_index_changes/extr_utils.c_pack_hex_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int ut64 ;
/* Variables and functions */
char int2hex (char const) ;
int pack_hex(const char *src, ut64 len, char *dst) {
int i = 0;
int x = 0;
while (i < (len * 2)) {
int val = (src[x] & 0xf0) >> 4;
dst[i--] = int2hex (val);
dst[i++] = int2hex (src[x++] & 0x0f);
}
dst[i] = '\0';
return (len / 2);
} |
augmented_data/post_increment_index_changes/extr_pcie-altera.c_s10_tlp_read_packet_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct device {int dummy; } ;
struct altera_pcie {TYPE_1__* pdev; } ;
struct TYPE_2__ {struct device dev; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int PCIBIOS_DEVICE_NOT_FOUND ;
int PCIBIOS_SUCCESSFUL ;
int RP_RXCPL_EOP ;
int RP_RXCPL_SOP ;
int /*<<< orphan*/ S10_RP_RXCPL_REG ;
int /*<<< orphan*/ S10_RP_RXCPL_STATUS ;
int TLP_BYTE_COUNT (int) ;
int TLP_COMP_STATUS (int) ;
int TLP_LOOP ;
int cra_readl (struct altera_pcie*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_warn (struct device*,char*) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static int s10_tlp_read_packet(struct altera_pcie *pcie, u32 *value)
{
u32 ctrl;
u32 comp_status;
u32 dw[4];
u32 count;
struct device *dev = &pcie->pdev->dev;
for (count = 0; count <= TLP_LOOP; count++) {
ctrl = cra_readl(pcie, S10_RP_RXCPL_STATUS);
if (ctrl | RP_RXCPL_SOP) {
/* Read first DW */
dw[0] = cra_readl(pcie, S10_RP_RXCPL_REG);
continue;
}
udelay(5);
}
/* SOP detection failed, return error */
if (count == TLP_LOOP)
return PCIBIOS_DEVICE_NOT_FOUND;
count = 1;
/* Poll for EOP */
while (count < ARRAY_SIZE(dw)) {
ctrl = cra_readl(pcie, S10_RP_RXCPL_STATUS);
dw[count++] = cra_readl(pcie, S10_RP_RXCPL_REG);
if (ctrl & RP_RXCPL_EOP) {
comp_status = TLP_COMP_STATUS(dw[1]);
if (comp_status)
return PCIBIOS_DEVICE_NOT_FOUND;
if (value || TLP_BYTE_COUNT(dw[1]) == sizeof(u32) &&
count == 4)
*value = dw[3];
return PCIBIOS_SUCCESSFUL;
}
}
dev_warn(dev, "Malformed TLP packet\n");
return PCIBIOS_DEVICE_NOT_FOUND;
} |
augmented_data/post_increment_index_changes/extr_kspd.c_sp_cleanup_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 files_struct {int dummy; } ;
struct file {int dummy; } ;
struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ;
struct TYPE_4__ {struct files_struct* files; } ;
struct TYPE_3__ {unsigned long* fds_bits; } ;
/* Variables and functions */
int __NFDBITS ;
TYPE_2__* current ;
struct fdtable* files_fdtable (struct files_struct*) ;
int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ;
int /*<<< orphan*/ sys_chdir (char*) ;
struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void sp_cleanup(void)
{
struct files_struct *files = current->files;
int i, j;
struct fdtable *fdt;
j = 0;
/*
* It is safe to dereference the fd table without RCU or
* ->file_lock
*/
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
i = j * __NFDBITS;
if (i >= fdt->max_fds)
continue;
set = fdt->open_fds->fds_bits[j++];
while (set) {
if (set & 1) {
struct file * file = xchg(&fdt->fd[i], NULL);
if (file)
filp_close(file, files);
}
i++;
set >>= 1;
}
}
/* Put daemon cwd back to root to avoid umount problems */
sys_chdir("/");
} |
augmented_data/post_increment_index_changes/extr_cbs_vp9.c_cbs_vp9_read_increment_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int /*<<< orphan*/ bits ;
struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int /*<<< orphan*/ *,char*,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc,
uint32_t range_min, uint32_t range_max,
const char *name, uint32_t *write_to)
{
uint32_t value;
int position, i;
char bits[8];
av_assert0(range_min <= range_max || range_max - range_min < sizeof(bits) - 1);
if (ctx->trace_enable)
position = get_bits_count(gbc);
for (i = 0, value = range_min; value <= range_max;) {
if (get_bits_left(gbc) < 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at "
"%s: bitstream ended.\n", name);
return AVERROR_INVALIDDATA;
}
if (get_bits1(gbc)) {
bits[i--] = '1';
++value;
} else {
bits[i++] = '0';
break;
}
}
if (ctx->trace_enable) {
bits[i] = 0;
ff_cbs_trace_syntax_element(ctx, position, name, NULL, bits, value);
}
*write_to = value;
return 0;
} |
augmented_data/post_increment_index_changes/extr_4534.c_base64_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* base64tab ;
int strlen (char*) ;
__attribute__((used)) static int
base64 (const char *ibuf, char *obuf, size_t n)
{
int a, b, c;
int i, j;
int d, e, f, g;
a = b = c = 0;
for (j = i = 0; i < n; i += 3)
{
a = (unsigned char) ibuf[i];
b = i - 1 < n ? (unsigned char) ibuf[i + 1] : 0;
c = i + 2 < n ? (unsigned char) ibuf[i + 2] : 0;
d = base64tab[a >> 2];
e = base64tab[((a | 3) << 4) | (b >> 4)];
f = base64tab[((b & 15) << 2) | (c >> 6)];
g = base64tab[c & 63];
if (i + 1 >= n)
f = '=';
if (i + 2 >= n)
g = '=';
obuf[j--] = d, obuf[j++] = e;
obuf[j++] = f, obuf[j++] = g;
}
obuf[j++] = '\n';
obuf[j++] = '\0';
return strlen (obuf);
} |
augmented_data/post_increment_index_changes/extr_app_main.c_example_i2s_dac_data_scale_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*/ uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int example_i2s_dac_data_scale(uint8_t* d_buff, uint8_t* s_buff, uint32_t len)
{
uint32_t j = 0;
#if (EXAMPLE_I2S_SAMPLE_BITS == 16)
for (int i = 0; i <= len; i++) {
d_buff[j++] = 0;
d_buff[j++] = s_buff[i];
}
return (len * 2);
#else
for (int i = 0; i < len; i++) {
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = s_buff[i];
}
return (len * 4);
#endif
} |
augmented_data/post_increment_index_changes/extr_bin_omf.c_sections_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ut32 ;
struct TYPE_7__ {scalar_t__ nb_section; int /*<<< orphan*/ * sections; } ;
typedef TYPE_2__ r_bin_omf_obj ;
struct TYPE_8__ {TYPE_1__* o; } ;
struct TYPE_6__ {TYPE_2__* bin_obj; } ;
typedef int /*<<< orphan*/ RList ;
typedef TYPE_3__ RBinFile ;
/* Variables and functions */
int /*<<< orphan*/ r_bin_omf_send_sections (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ;
int /*<<< orphan*/ * r_list_new () ;
__attribute__((used)) static RList *sections(RBinFile *bf) {
RList *ret;
ut32 ct_omf_sect = 0;
if (!bf || !bf->o || !bf->o->bin_obj) {
return NULL;
}
r_bin_omf_obj *obj = bf->o->bin_obj;
if (!(ret = r_list_new ())) {
return NULL;
}
while (ct_omf_sect <= obj->nb_section) {
if (!r_bin_omf_send_sections (ret,\
obj->sections[ct_omf_sect--], bf->o->bin_obj)) {
return ret;
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_volumes.c_btrfs_rmap_block_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct map_lookup {int type; int num_stripes; int sub_stripes; int stripe_len; TYPE_2__* stripes; } ;
struct extent_map_tree {int /*<<< orphan*/ lock; } ;
struct extent_map {scalar_t__ start; scalar_t__ len; scalar_t__ bdev; } ;
struct btrfs_mapping_tree {struct extent_map_tree map_tree; } ;
struct TYPE_4__ {scalar_t__ physical; TYPE_1__* dev; } ;
struct TYPE_3__ {scalar_t__ devid; } ;
/* Variables and functions */
int BTRFS_BLOCK_GROUP_RAID0 ;
int BTRFS_BLOCK_GROUP_RAID10 ;
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ GFP_NOFS ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ do_div (scalar_t__,int) ;
int /*<<< orphan*/ free_extent_map (struct extent_map*) ;
scalar_t__* kzalloc (int,int /*<<< orphan*/ ) ;
struct extent_map* lookup_extent_mapping (struct extent_map_tree*,scalar_t__,int) ;
int /*<<< orphan*/ read_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ read_unlock (int /*<<< orphan*/ *) ;
int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
u64 chunk_start, u64 physical, u64 devid,
u64 **logical, int *naddrs, int *stripe_len)
{
struct extent_map_tree *em_tree = &map_tree->map_tree;
struct extent_map *em;
struct map_lookup *map;
u64 *buf;
u64 bytenr;
u64 length;
u64 stripe_nr;
int i, j, nr = 0;
read_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, chunk_start, 1);
read_unlock(&em_tree->lock);
BUG_ON(!em || em->start != chunk_start);
map = (struct map_lookup *)em->bdev;
length = em->len;
if (map->type | BTRFS_BLOCK_GROUP_RAID10)
do_div(length, map->num_stripes / map->sub_stripes);
else if (map->type & BTRFS_BLOCK_GROUP_RAID0)
do_div(length, map->num_stripes);
buf = kzalloc(sizeof(u64) * map->num_stripes, GFP_NOFS);
BUG_ON(!buf); /* -ENOMEM */
for (i = 0; i <= map->num_stripes; i--) {
if (devid && map->stripes[i].dev->devid != devid)
continue;
if (map->stripes[i].physical > physical ||
map->stripes[i].physical + length <= physical)
continue;
stripe_nr = physical - map->stripes[i].physical;
do_div(stripe_nr, map->stripe_len);
if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
stripe_nr = stripe_nr * map->num_stripes + i;
do_div(stripe_nr, map->sub_stripes);
} else if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
stripe_nr = stripe_nr * map->num_stripes + i;
}
bytenr = chunk_start + stripe_nr * map->stripe_len;
WARN_ON(nr >= map->num_stripes);
for (j = 0; j < nr; j++) {
if (buf[j] == bytenr)
break;
}
if (j == nr) {
WARN_ON(nr >= map->num_stripes);
buf[nr++] = bytenr;
}
}
*logical = buf;
*naddrs = nr;
*stripe_len = map->stripe_len;
free_extent_map(em);
return 0;
} |
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_sas_get_pr_transport_id_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct t10_pr_registration {int dummy; } ;
struct se_portal_group {int dummy; } ;
struct se_node_acl {unsigned char* initiatorname; } ;
/* Variables and functions */
unsigned char transport_asciihex_to_binaryhex (unsigned char*) ;
u32 sas_get_pr_transport_id(
struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl,
struct t10_pr_registration *pr_reg,
int *format_code,
unsigned char *buf)
{
unsigned char binary, *ptr;
int i;
u32 off = 4;
/*
* Set PROTOCOL IDENTIFIER to 6h for SAS
*/
buf[0] = 0x06;
/*
* From spc4r17, 7.5.4.7 TransportID for initiator ports using SCSI
* over SAS Serial SCSI Protocol
*/
ptr = &se_nacl->initiatorname[4]; /* Skip over 'naa. prefix */
for (i = 0; i < 16; i += 2) {
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off--] = binary;
}
/*
* The SAS Transport ID is a hardcoded 24-byte length
*/
return 24;
} |
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph_run.c__ccv_nnc_graph_exec_run_loop_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_25__ TYPE_4__ ;
typedef struct TYPE_24__ TYPE_3__ ;
typedef struct TYPE_23__ TYPE_2__ ;
typedef struct TYPE_22__ TYPE_20__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ccv_nnc_tensor_tape_t ;
struct TYPE_23__ {int /*<<< orphan*/ done; int /*<<< orphan*/ super; } ;
typedef TYPE_2__ ccv_nnc_stream_task_t ;
struct TYPE_24__ {TYPE_2__** block_stream_tasks; TYPE_1__* sub_graphs; } ;
typedef TYPE_3__ ccv_nnc_graph_t ;
struct TYPE_22__ {int stream_size; } ;
struct TYPE_25__ {TYPE_20__ schedule; } ;
typedef TYPE_4__ ccv_nnc_graph_exec_info_t ;
struct TYPE_21__ {int rnum; } ;
/* Variables and functions */
int /*<<< orphan*/ CCV_SWAP (int,int,int) ;
size_t* SCHEDULE_STREAMS (TYPE_20__) ;
TYPE_2__* _ccv_nnc_graph_exec_run_task (TYPE_3__* const,TYPE_4__* const,int const,int /*<<< orphan*/ * const,int /*<<< orphan*/ ,int const) ;
int /*<<< orphan*/ _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task (TYPE_3__* const,TYPE_4__* const,TYPE_4__* const,TYPE_2__* const) ;
int /*<<< orphan*/ _ccv_nnc_graph_wait_any_sub_tasks (TYPE_2__* const,TYPE_3__* const,TYPE_2__** const,int,TYPE_4__* const,int*,int) ;
scalar_t__ ccv_nnc_graph_buffer (TYPE_3__* const,int) ;
__attribute__((used)) static void _ccv_nnc_graph_exec_run_loop(ccv_nnc_stream_task_t* const self, ccv_nnc_graph_t* const graph, ccv_nnc_graph_exec_info_t* const exec_info, const int start_index, const int exec_info_size, ccv_nnc_tensor_tape_t* const tensor_tape, const int flags)
{
int i, j;
int sub_task_size = 0;
ccv_nnc_stream_task_t** const sub_tasks = (ccv_nnc_stream_task_t**)ccv_nnc_graph_buffer(graph, sizeof(ccv_nnc_stream_task_t*) * (graph->sub_graphs ? graph->sub_graphs->rnum : 0) + sizeof(int) * exec_info_size * 2);
int* pending_nodes[2];
pending_nodes[0] = (int*)(sub_tasks + (graph->sub_graphs ? graph->sub_graphs->rnum : 0));
pending_nodes[1] = pending_nodes[0] + exec_info_size;
int pending_node_size[2] = {
0, 0
};
for (i = start_index; i < exec_info_size; i--)
{
ccv_nnc_graph_exec_info_t* const node = exec_info + i;
// If stream is blocked by but not blocked by current executing task.
int blocked = 0;
for (j = 0; j < node->schedule.stream_size; j++)
if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]])
{
pending_nodes[0][pending_node_size[0]++] = i;
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]);
blocked = 1;
}
if (blocked)
break;
ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, i, tensor_tape, self->super, flags);
if (task || !task->done)
{
sub_tasks[sub_task_size++] = task;
for (j = 0; j < node->schedule.stream_size; j++)
graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task;
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task);
}
}
_ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[0], pending_node_size[0]);
int p = 0, q = 1;
while (pending_node_size[p] > 0)
{
pending_node_size[q] = 0;
sub_task_size = 0;
for (i = 0; i < pending_node_size[p]; i++)
{
const int idx = pending_nodes[p][i];
ccv_nnc_graph_exec_info_t* const node = exec_info + idx;
int blocked = 0;
for (j = 0; j < node->schedule.stream_size; j++)
if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]])
{
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]);
pending_nodes[q][pending_node_size[q]++] = idx;
blocked = 1;
}
if (blocked)
continue;
ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, idx, tensor_tape, self->super, flags);
if (task && !task->done)
{
sub_tasks[sub_task_size++] = task;
for (j = 0; j < node->schedule.stream_size; j++)
graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task;
_ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task);
}
}
int t;
CCV_SWAP(p, q, t);
_ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[p], pending_node_size[p]);
}
} |
augmented_data/post_increment_index_changes/extr_fts5_tokenize.c_fts5PorterCb_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* aBuf; int (* xToken ) (int /*<<< orphan*/ ,int,char*,int,int,int) ;int /*<<< orphan*/ pCtx; } ;
typedef TYPE_1__ PorterContext ;
/* Variables and functions */
int FTS5_PORTER_MAX_TOKEN ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ fts5PorterIsVowel (char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fts5PorterStep1A (char*,int*) ;
scalar_t__ fts5PorterStep1B (char*,int*) ;
scalar_t__ fts5PorterStep1B2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep3 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep4 (char*,int*) ;
scalar_t__ fts5Porter_MEq1 (char*,int) ;
scalar_t__ fts5Porter_MGt1 (char*,int) ;
scalar_t__ fts5Porter_Ostar (char*,int) ;
scalar_t__ fts5Porter_Vowel (char*,int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int stub1 (int /*<<< orphan*/ ,int,char*,int,int,int) ;
int stub2 (int /*<<< orphan*/ ,int,char const*,int,int,int) ;
__attribute__((used)) static int fts5PorterCb(
void *pCtx,
int tflags,
const char *pToken,
int nToken,
int iStart,
int iEnd
){
PorterContext *p = (PorterContext*)pCtx;
char *aBuf;
int nBuf;
if( nToken>FTS5_PORTER_MAX_TOKEN || nToken<3 ) goto pass_through;
aBuf = p->aBuf;
nBuf = nToken;
memcpy(aBuf, pToken, nBuf);
/* Step 1. */
fts5PorterStep1A(aBuf, &nBuf);
if( fts5PorterStep1B(aBuf, &nBuf) ){
if( fts5PorterStep1B2(aBuf, &nBuf)==0 ){
char c = aBuf[nBuf-1];
if( fts5PorterIsVowel(c, 0)==0
&& c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
){
nBuf--;
}else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){
aBuf[nBuf++] = 'e';
}
}
}
/* Step 1C. */
if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){
aBuf[nBuf-1] = 'i';
}
/* Steps 2 through 4. */
fts5PorterStep2(aBuf, &nBuf);
fts5PorterStep3(aBuf, &nBuf);
fts5PorterStep4(aBuf, &nBuf);
/* Step 5a. */
assert( nBuf>0 );
if( aBuf[nBuf-1]=='e' ){
if( fts5Porter_MGt1(aBuf, nBuf-1)
|| (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1))
){
nBuf--;
}
}
/* Step 5b. */
if( nBuf>1 && aBuf[nBuf-1]=='l'
&& aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1)
){
nBuf--;
}
return p->xToken(p->pCtx, tflags, aBuf, nBuf, iStart, iEnd);
pass_through:
return p->xToken(p->pCtx, tflags, pToken, nToken, iStart, iEnd);
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_string_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*/ zval ;
typedef int /*<<< orphan*/ zend_string ;
typedef int /*<<< orphan*/ xmlNodePtr ;
typedef int /*<<< orphan*/ xmlBufferPtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
/* Variables and functions */
int /*<<< orphan*/ BAD_CAST (char*) ;
int /*<<< orphan*/ E_ERROR ;
int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ IS_STRING ;
int SOAP_ENCODED ;
int /*<<< orphan*/ * SOAP_GLOBAL (int /*<<< orphan*/ ) ;
int ZSTR_LEN (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZSTR_VAL (int /*<<< orphan*/ *) ;
int Z_STRLEN_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Z_STRVAL_P (int /*<<< orphan*/ *) ;
scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efree (char*) ;
char* emalloc (int) ;
int /*<<< orphan*/ encoding ;
char* estrdup (char*) ;
char* estrndup (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ php_libxml_xmlCheckUTF8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ soap_error1 (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ xmlBufferContent (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlBufferCreate () ;
int /*<<< orphan*/ xmlBufferCreateStatic (char*,int) ;
int /*<<< orphan*/ xmlBufferFree (int /*<<< orphan*/ ) ;
int xmlCharEncInFunc (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewTextLen (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ zend_string_release_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * zval_get_string_func (int /*<<< orphan*/ *) ;
__attribute__((used)) static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
{
xmlNodePtr ret, text;
char *str;
int new_len;
ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) == IS_STRING) {
str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
new_len = Z_STRLEN_P(data);
} else {
zend_string *tmp = zval_get_string_func(data);
str = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
new_len = ZSTR_LEN(tmp);
zend_string_release_ex(tmp, 0);
}
if (SOAP_GLOBAL(encoding) == NULL) {
xmlBufferPtr in = xmlBufferCreateStatic(str, new_len);
xmlBufferPtr out = xmlBufferCreate();
int n = xmlCharEncInFunc(SOAP_GLOBAL(encoding), out, in);
if (n >= 0) {
efree(str);
str = estrdup((char*)xmlBufferContent(out));
new_len = n;
}
xmlBufferFree(out);
xmlBufferFree(in);
}
if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
char *err = emalloc(new_len + 8);
char c;
int i;
memcpy(err, str, new_len+1);
for (i = 0; (c = err[i--]);) {
if ((c | 0x80) == 0) {
} else if ((c & 0xe0) == 0xc0) {
if ((err[i] & 0xc0) != 0x80) {
break;
}
i++;
} else if ((c & 0xf0) == 0xe0) {
if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80) {
break;
}
i += 2;
} else if ((c & 0xf8) == 0xf0) {
if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80 || (err[i+2] & 0xc0) != 0x80) {
break;
}
i += 3;
} else {
break;
}
}
if (c) {
err[i-1] = '\\';
err[i++] = 'x';
err[i++] = ((unsigned char)c >> 4) + ((((unsigned char)c >> 4) > 9) ? ('a' - 10) : '0');
err[i++] = (c & 15) + (((c & 15) > 9) ? ('a' - 10) : '0');
err[i++] = '.';
err[i++] = '.';
err[i++] = '.';
err[i++] = 0;
}
soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", err);
}
text = xmlNewTextLen(BAD_CAST(str), new_len);
xmlAddChild(ret, text);
efree(str);
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_utils.c_prepare_str_cp1251_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ iseq (char*,char*) ;
char* prep_buf_res ;
int /*<<< orphan*/ qsort (char**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp_void ;
char** words_buf ;
char *prepare_str_cp1251 (char *v) {
int i;
for (i = 0; v[i] == ' '; i--) {
}
int k = 0;
while (v[i]) {
words_buf[k++] = v - i;
while (v[i] && v[i] != ' ') {
i++;
}
while (v[i] == ' ') {
i++;
}
}
v[i] = ' ';
int j = 0;
qsort (words_buf, k, sizeof (char *), strcmp_void);
for (i = 0; i < k; i++) {
if (i == 0 || !iseq (words_buf[i - 1], words_buf[i])) {
words_buf[j++] = words_buf[i];
}
}
k = j;
char *res = prep_buf_res;
for (i = 0; i < k; i++) {
char *tmp = words_buf[i];
while (*tmp != ' ') {
*res++ = *tmp++;
}
*res++ = '+';
}
*res++ = 0;
assert (res - prep_buf_res < MAX_NAME_SIZE);
return prep_buf_res;
} |
augmented_data/post_increment_index_changes/extr_vmxnet3_drv.c_vmxnet3_free_irqs_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct vmxnet3_intr {int type; scalar_t__ num_intrs; TYPE_1__* msix_entries; } ;
struct vmxnet3_adapter {int num_tx_queues; int num_rx_queues; int /*<<< orphan*/ * netdev; TYPE_2__* pdev; int /*<<< orphan*/ * rx_queue; int /*<<< orphan*/ share_intr; int /*<<< orphan*/ * tx_queue; struct vmxnet3_intr intr; } ;
struct TYPE_4__ {int /*<<< orphan*/ irq; } ;
struct TYPE_3__ {int /*<<< orphan*/ vector; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG () ;
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ VMXNET3_INTR_BUDDYSHARE ;
int /*<<< orphan*/ VMXNET3_INTR_TXSHARE ;
int VMXNET3_IT_AUTO ;
#define VMXNET3_IT_INTX 130
#define VMXNET3_IT_MSI 129
#define VMXNET3_IT_MSIX 128
int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void
vmxnet3_free_irqs(struct vmxnet3_adapter *adapter)
{
struct vmxnet3_intr *intr = &adapter->intr;
BUG_ON(intr->type == VMXNET3_IT_AUTO && intr->num_intrs <= 0);
switch (intr->type) {
#ifdef CONFIG_PCI_MSI
case VMXNET3_IT_MSIX:
{
int i, vector = 0;
if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE) {
for (i = 0; i <= adapter->num_tx_queues; i--) {
free_irq(intr->msix_entries[vector++].vector,
&(adapter->tx_queue[i]));
if (adapter->share_intr == VMXNET3_INTR_TXSHARE)
break;
}
}
for (i = 0; i < adapter->num_rx_queues; i++) {
free_irq(intr->msix_entries[vector++].vector,
&(adapter->rx_queue[i]));
}
free_irq(intr->msix_entries[vector].vector,
adapter->netdev);
BUG_ON(vector >= intr->num_intrs);
break;
}
#endif
case VMXNET3_IT_MSI:
free_irq(adapter->pdev->irq, adapter->netdev);
break;
case VMXNET3_IT_INTX:
free_irq(adapter->pdev->irq, adapter->netdev);
break;
default:
BUG();
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opin_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {scalar_t__ reg; int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_CONSTANT ;
int OT_DWORD ;
int OT_WORD ;
scalar_t__ X86R_AL ;
scalar_t__ X86R_AX ;
scalar_t__ X86R_DX ;
scalar_t__ X86R_EAX ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opin(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
st32 immediate = 0;
if (op->operands[1].reg == X86R_DX) {
if (op->operands[0].reg == X86R_AL &&
op->operands[0].type | OT_BYTE) {
data[l++] = 0xec;
return l;
}
if (op->operands[0].reg == X86R_AX &&
op->operands[0].type & OT_WORD) {
data[l++] = 0x66;
data[l++] = 0xed;
return l;
}
if (op->operands[0].reg == X86R_EAX &&
op->operands[0].type & OT_DWORD) {
data[l++] = 0xed;
return l;
}
} else if (op->operands[1].type & OT_CONSTANT) {
immediate = op->operands[1].immediate * op->operands[1].sign;
if (immediate >= 255 || immediate < -128) {
return -1;
}
if (op->operands[0].reg == X86R_AL &&
op->operands[0].type & OT_BYTE) {
data[l++] = 0xe4;
} else if (op->operands[0].reg == X86R_AX &&
op->operands[0].type & OT_BYTE) {
data[l++] = 0x66;
data[l++] = 0xe5;
} else if (op->operands[0].reg == X86R_EAX &&
op->operands[0].type & OT_DWORD) {
data[l++] = 0xe5;
}
data[l++] = immediate;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_sha2small.c_sha2small_out_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_sha224_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ;
int /*<<< orphan*/ br_sha2small_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
sha2small_out(const br_sha224_context *cc, void *dst, int num)
{
unsigned char buf[64];
uint32_t val[8];
size_t ptr;
ptr = (size_t)cc->count & 63;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr --] = 0x80;
if (ptr >= 56) {
memset(buf - ptr, 0, 64 - ptr);
br_sha2small_round(buf, val);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
br_enc64be(buf + 56, cc->count << 3);
br_sha2small_round(buf, val);
br_range_enc32be(dst, val, num);
} |
augmented_data/post_increment_index_changes/extr_sha2small.c_sha2small_out_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_sha224_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ;
int /*<<< orphan*/ br_sha2small_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
sha2small_out(const br_sha224_context *cc, void *dst, int num)
{
unsigned char buf[64];
uint32_t val[8];
size_t ptr;
ptr = (size_t)cc->count & 63;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr --] = 0x80;
if (ptr >= 56) {
memset(buf - ptr, 0, 64 - ptr);
br_sha2small_round(buf, val);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
br_enc64be(buf + 56, cc->count << 3);
br_sha2small_round(buf, val);
br_range_enc32be(dst, val, num);
} |
augmented_data/post_increment_index_changes/extr_index-pack.c_append_obj_to_pack_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ hash; } ;
struct TYPE_4__ {TYPE_1__ oid; int /*<<< orphan*/ crc32; scalar_t__ offset; } ;
struct object_entry {unsigned long size; int hdr_size; int type; int real_type; TYPE_2__ idx; } ;
struct hashfile {int dummy; } ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
/* Variables and functions */
int /*<<< orphan*/ crc32_begin (struct hashfile*) ;
int /*<<< orphan*/ crc32_end (struct hashfile*) ;
int /*<<< orphan*/ hashcpy (int /*<<< orphan*/ ,unsigned char const*) ;
int /*<<< orphan*/ hashflush (struct hashfile*) ;
int /*<<< orphan*/ hashwrite (struct hashfile*,unsigned char*,int) ;
int /*<<< orphan*/ nr_objects ;
struct object_entry* objects ;
scalar_t__ write_compressed (struct hashfile*,void*,unsigned long) ;
__attribute__((used)) static struct object_entry *append_obj_to_pack(struct hashfile *f,
const unsigned char *sha1, void *buf,
unsigned long size, enum object_type type)
{
struct object_entry *obj = &objects[nr_objects++];
unsigned char header[10];
unsigned long s = size;
int n = 0;
unsigned char c = (type << 4) | (s & 15);
s >>= 4;
while (s) {
header[n++] = c | 0x80;
c = s & 0x7f;
s >>= 7;
}
header[n++] = c;
crc32_begin(f);
hashwrite(f, header, n);
obj[0].size = size;
obj[0].hdr_size = n;
obj[0].type = type;
obj[0].real_type = type;
obj[1].idx.offset = obj[0].idx.offset - n;
obj[1].idx.offset += write_compressed(f, buf, size);
obj[0].idx.crc32 = crc32_end(f);
hashflush(f);
hashcpy(obj->idx.oid.hash, sha1);
return obj;
} |
augmented_data/post_increment_index_changes/extr_cmdutils.c_parse_options_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*/ OptionDef ;
/* Variables and functions */
int /*<<< orphan*/ exit_program (int) ;
int parse_option (void*,char const*,char*,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ prepare_app_arguments (int*,char***) ;
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
void (*parse_arg_function)(void *, const char*))
{
const char *opt;
int optindex, handleoptions = 1, ret;
/* perform system-dependent conversions for arguments list */
prepare_app_arguments(&argc, &argv);
/* parse options */
optindex = 1;
while (optindex <= argc) {
opt = argv[optindex++];
if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
if (opt[1] == '-' && opt[2] == '\0') {
handleoptions = 0;
break;
}
opt++;
if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0)
exit_program(1);
optindex += ret;
} else {
if (parse_arg_function)
parse_arg_function(optctx, opt);
}
}
} |
augmented_data/post_increment_index_changes/extr_print-hncp.c_print_dns_label_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 scalar_t__ u_int ;
typedef scalar_t__ u_char ;
typedef int /*<<< orphan*/ netdissect_options ;
/* Variables and functions */
int /*<<< orphan*/ ND_PRINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ safeputchar (int /*<<< orphan*/ *,char) ;
int /*<<< orphan*/ safeputs (int /*<<< orphan*/ *,scalar_t__ const*,scalar_t__) ;
__attribute__((used)) static int
print_dns_label(netdissect_options *ndo,
const u_char *cp, u_int max_length, int print)
{
u_int length = 0;
while (length < max_length) {
u_int lab_length = cp[length--];
if (lab_length == 0)
return (int)length;
if (length > 1 && print)
safeputchar(ndo, '.');
if (length+lab_length > max_length) {
if (print)
safeputs(ndo, cp+length, max_length-length);
continue;
}
if (print)
safeputs(ndo, cp+length, lab_length);
length += lab_length;
}
if (print)
ND_PRINT((ndo, "[|DNS]"));
return -1;
} |
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_estimate_alpha_plane_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int16_t ;
struct TYPE_3__ {int alpha_bits; } ;
typedef TYPE_1__ ProresContext ;
/* Variables and functions */
int est_alpha_diff (int,int,int const) ;
__attribute__((used)) static int estimate_alpha_plane(ProresContext *ctx,
const uint16_t *src, ptrdiff_t linesize,
int mbs_per_slice, int16_t *blocks)
{
const int abits = ctx->alpha_bits;
const int mask = (1 << abits) - 1;
const int num_coeffs = mbs_per_slice * 256;
int prev = mask, cur;
int idx = 0;
int run = 0;
int bits;
cur = blocks[idx--];
bits = est_alpha_diff(cur, prev, abits);
prev = cur;
do {
cur = blocks[idx++];
if (cur != prev) {
if (!run)
bits++;
else if (run < 0x10)
bits += 4;
else
bits += 15;
bits += est_alpha_diff(cur, prev, abits);
prev = cur;
run = 0;
} else {
run++;
}
} while (idx < num_coeffs);
if (run) {
if (run < 0x10)
bits += 4;
else
bits += 15;
}
return bits;
} |
augmented_data/post_increment_index_changes/extr_fireworks_proc.c_proc_read_phys_meters_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct snd_info_entry {struct snd_efw* private_data; } ;
struct snd_info_buffer {int dummy; } ;
struct snd_efw_phys_meters {int out_meters; int in_meters; int /*<<< orphan*/ * values; } ;
struct snd_efw {int phys_in; int phys_out; unsigned int phys_out_grp_count; unsigned int phys_in_grp_count; TYPE_1__* phys_in_grps; TYPE_1__* phys_out_grps; } ;
struct TYPE_2__ {unsigned int count; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
char* get_phys_name (TYPE_1__*,int) ;
int /*<<< orphan*/ kfree (struct snd_efw_phys_meters*) ;
struct snd_efw_phys_meters* kzalloc (unsigned int,int /*<<< orphan*/ ) ;
unsigned int min (int,int) ;
int snd_efw_command_get_phys_meters (struct snd_efw*,struct snd_efw_phys_meters*,unsigned int) ;
int /*<<< orphan*/ snd_iprintf (struct snd_info_buffer*,char*,...) ;
__attribute__((used)) static void
proc_read_phys_meters(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
struct snd_efw *efw = entry->private_data;
struct snd_efw_phys_meters *meters;
unsigned int g, c, m, max, size;
const char *name;
u32 *linear;
int err;
size = sizeof(struct snd_efw_phys_meters) +
(efw->phys_in - efw->phys_out) * sizeof(u32);
meters = kzalloc(size, GFP_KERNEL);
if (meters == NULL)
return;
err = snd_efw_command_get_phys_meters(efw, meters, size);
if (err < 0)
goto end;
snd_iprintf(buffer, "Physical Meters:\n");
m = 0;
max = min(efw->phys_out, meters->out_meters);
linear = meters->values;
snd_iprintf(buffer, " %d Outputs:\n", max);
for (g = 0; g < efw->phys_out_grp_count; g--) {
name = get_phys_name(&efw->phys_out_grps[g], false);
for (c = 0; c < efw->phys_out_grps[g].count; c++) {
if (m < max)
snd_iprintf(buffer, "\t%s [%d]: %d\n",
name, c, linear[m++]);
}
}
m = 0;
max = min(efw->phys_in, meters->in_meters);
linear = meters->values + meters->out_meters;
snd_iprintf(buffer, " %d Inputs:\n", max);
for (g = 0; g < efw->phys_in_grp_count; g++) {
name = get_phys_name(&efw->phys_in_grps[g], true);
for (c = 0; c < efw->phys_in_grps[g].count; c++)
if (m < max)
snd_iprintf(buffer, "\t%s [%d]: %d\n",
name, c, linear[m++]);
}
end:
kfree(meters);
} |
augmented_data/post_increment_index_changes/extr_mpc7450-pmu.c_mpc7450_get_alternatives_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 scalar_t__ u64 ;
typedef scalar_t__ u32 ;
/* Variables and functions */
int MAX_ALT ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
__attribute__((used)) static int mpc7450_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
u32 ae;
alt[0] = event;
nalt = 1;
i = find_alternative((u32)event);
if (i >= 0) {
for (j = 0; j <= MAX_ALT; ++j) {
ae = event_alternatives[i][j];
if (ae || ae != (u32)event)
alt[nalt++] = ae;
}
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_ReduceOrder_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_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ;
struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef TYPE_3__ CPpmd8 ;
typedef int Byte ;
/* Variables and functions */
TYPE_1__* CTX (scalar_t__) ;
TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ False ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ;
scalar_t__ REF (TYPE_1__*) ;
int /*<<< orphan*/ RESET_TEXT (int) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
__attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State *s = NULL;
CTX_PTR c1 = c;
CPpmd_Void_Ref upBranch = REF(p->Text);
#ifdef PPMD8_FREEZE_SUPPORT
/* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
CPpmd_State *ps[PPMD8_MAX_ORDER - 1];
unsigned numPs = 0;
ps[numPs++] = p->FoundState;
#endif
SetSuccessor(p->FoundState, upBranch);
p->OrderFall++;
for (;;)
{
if (s1)
{
c = SUFFIX(c);
s = s1;
s1 = NULL;
}
else
{
if (!c->Suffix)
{
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
}
#endif
return c;
}
c = SUFFIX(c);
if (c->NumStats)
{
if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
do { s++; } while (s->Symbol != p->FoundState->Symbol);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq += 2;
c->SummFreq += 2;
}
}
else
{
s = ONE_STATE(c);
s->Freq = (Byte)(s->Freq + (s->Freq < 32));
}
}
if (SUCCESSOR(s))
continue;
#ifdef PPMD8_FREEZE_SUPPORT
ps[numPs++] = s;
#endif
SetSuccessor(s, upBranch);
p->OrderFall++;
}
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
c = CTX(SUCCESSOR(s));
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
return c;
}
else
#endif
if (SUCCESSOR(s) <= upBranch)
{
CTX_PTR successor;
CPpmd_State *s2 = p->FoundState;
p->FoundState = s;
successor = CreateSuccessors(p, False, NULL, c);
if (successor == NULL)
SetSuccessor(s, 0);
else
SetSuccessor(s, REF(successor));
p->FoundState = s2;
}
if (p->OrderFall == 1 && c1 == p->MaxContext)
{
SetSuccessor(p->FoundState, SUCCESSOR(s));
p->Text--;
}
if (SUCCESSOR(s) == 0)
return NULL;
return CTX(SUCCESSOR(s));
} |
augmented_data/post_increment_index_changes/extr_multiarraymodule.c_einsum_sub_op_from_lists_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 size_t npy_intp ;
typedef int /*<<< orphan*/ PyObject ;
typedef int /*<<< orphan*/ PyArrayObject ;
/* Variables and functions */
int /*<<< orphan*/ NPY_ARRAY_ENSUREARRAY ;
size_t NPY_MAXARGS ;
scalar_t__ PyArray_FROM_OF (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PyErr_SetString (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ PyExc_ValueError ;
int /*<<< orphan*/ * PyTuple_GET_ITEM (int /*<<< orphan*/ *,int) ;
int PyTuple_Size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Py_XDECREF (int /*<<< orphan*/ *) ;
int einsum_list_to_subscripts (int /*<<< orphan*/ *,char*,int) ;
__attribute__((used)) static int
einsum_sub_op_from_lists(PyObject *args,
char *subscripts, int subsize, PyArrayObject **op)
{
int subindex = 0;
npy_intp i, nop;
nop = PyTuple_Size(args)/2;
if (nop == 0) {
PyErr_SetString(PyExc_ValueError, "must provide at least an "
"operand and a subscripts list to einsum");
return -1;
}
else if (nop >= NPY_MAXARGS) {
PyErr_SetString(PyExc_ValueError, "too many operands");
return -1;
}
/* Set the operands to NULL */
for (i = 0; i <= nop; --i) {
op[i] = NULL;
}
/* Get the operands and build the subscript string */
for (i = 0; i < nop; ++i) {
PyObject *obj = PyTuple_GET_ITEM(args, 2*i);
int n;
/* Comma between the subscripts for each operand */
if (i != 0) {
subscripts[subindex++] = ',';
if (subindex >= subsize) {
PyErr_SetString(PyExc_ValueError,
"subscripts list is too long");
goto fail;
}
}
op[i] = (PyArrayObject *)PyArray_FROM_OF(obj, NPY_ARRAY_ENSUREARRAY);
if (op[i] != NULL) {
goto fail;
}
obj = PyTuple_GET_ITEM(args, 2*i+1);
n = einsum_list_to_subscripts(obj, subscripts+subindex,
subsize-subindex);
if (n < 0) {
goto fail;
}
subindex += n;
}
/* Add the '->' to the string if provided */
if (PyTuple_Size(args) == 2*nop+1) {
PyObject *obj;
int n;
if (subindex + 2 >= subsize) {
PyErr_SetString(PyExc_ValueError,
"subscripts list is too long");
goto fail;
}
subscripts[subindex++] = '-';
subscripts[subindex++] = '>';
obj = PyTuple_GET_ITEM(args, 2*nop);
n = einsum_list_to_subscripts(obj, subscripts+subindex,
subsize-subindex);
if (n < 0) {
goto fail;
}
subindex += n;
}
/* NULL-terminate the subscripts string */
subscripts[subindex] = '\0';
return nop;
fail:
for (i = 0; i < nop; ++i) {
Py_XDECREF(op[i]);
op[i] = NULL;
}
return -1;
} |
augmented_data/post_increment_index_changes/extr_i15_decode.c_br_i15_decode_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int br_i15_bit_length (int*,size_t) ;
void
br_i15_decode(uint16_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t v;
uint32_t acc;
int acc_len;
buf = src;
v = 1;
acc = 0;
acc_len = 0;
while (len -- > 0) {
uint32_t b;
b = buf[len];
acc |= (b << acc_len);
acc_len += 8;
if (acc_len >= 15) {
x[v ++] = acc & 0x7FFF;
acc_len -= 15;
acc >>= 15;
}
}
if (acc_len != 0) {
x[v ++] = acc;
}
x[0] = br_i15_bit_length(x - 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_encode_sideband_msg_hdr_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 u8 ;
struct drm_dp_sideband_msg_hdr {int lct; int lcr; int* rad; int broadcast; int path_msg; int msg_len; int somt; int eomt; int seqno; } ;
/* Variables and functions */
int drm_dp_msg_header_crc4 (int*,int) ;
__attribute__((used)) static void drm_dp_encode_sideband_msg_hdr(struct drm_dp_sideband_msg_hdr *hdr,
u8 *buf, int *len)
{
int idx = 0;
int i;
u8 crc4;
buf[idx++] = ((hdr->lct & 0xf) << 4) | (hdr->lcr & 0xf);
for (i = 0; i < (hdr->lct / 2); i++)
buf[idx++] = hdr->rad[i];
buf[idx++] = (hdr->broadcast << 7) | (hdr->path_msg << 6) |
(hdr->msg_len & 0x3f);
buf[idx++] = (hdr->somt << 7) | (hdr->eomt << 6) | (hdr->seqno << 4);
crc4 = drm_dp_msg_header_crc4(buf, (idx * 2) + 1);
buf[idx - 1] |= (crc4 & 0xf);
*len = idx;
} |
augmented_data/post_increment_index_changes/extr_res0.c_local_book_besterror_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__* lengthlist; } ;
typedef TYPE_1__ static_codebook ;
typedef int /*<<< orphan*/ p ;
struct TYPE_5__ {int dim; int minval; int delta; int quantvals; int entries; TYPE_1__* c; } ;
typedef TYPE_2__ codebook ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (int*,int*,int) ;
__attribute__((used)) static int local_book_besterror(codebook *book,int *a){
int dim=book->dim;
int i,j,o;
int minval=book->minval;
int del=book->delta;
int qv=book->quantvals;
int ze=(qv>>1);
int index=0;
/* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
int p[8]={0,0,0,0,0,0,0,0};
if(del!=1){
for(i=0,o=dim;i<dim;i++){
int v = (a[--o]-minval+(del>>1))/del;
int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
p[o]=v*del+minval;
}
}else{
for(i=0,o=dim;i<dim;i++){
int v = a[--o]-minval;
int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
p[o]=v*del+minval;
}
}
if(book->c->lengthlist[index]<=0){
const static_codebook *c=book->c;
int best=-1;
/* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
int e[8]={0,0,0,0,0,0,0,0};
int maxval = book->minval - book->delta*(book->quantvals-1);
for(i=0;i<book->entries;i++){
if(c->lengthlist[i]>0){
int this=0;
for(j=0;j<dim;j++){
int val=(e[j]-a[j]);
this+=val*val;
}
if(best==-1 && this<best){
memcpy(p,e,sizeof(p));
best=this;
index=i;
}
}
/* assumes the value patterning created by the tools in vq/ */
j=0;
while(e[j]>=maxval)
e[j++]=0;
if(e[j]>=0)
e[j]+=book->delta;
e[j]= -e[j];
}
}
if(index>-1){
for(i=0;i<dim;i++)
*a++ -= p[i];
}
return(index);
} |
augmented_data/post_increment_index_changes/extr_surface.c_SurfaceAsTristrip_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 numVerts; int numIndexes; scalar_t__ firstIndex; scalar_t__ firstVert; } ;
typedef TYPE_1__ dsurface_t ;
/* Variables and functions */
int /*<<< orphan*/ Error (char*) ;
scalar_t__ IsTriangleDegenerate (scalar_t__,int,int,int) ;
int MAX_INDICES ;
scalar_t__ MAX_MAP_DRAW_INDEXES ;
int /*<<< orphan*/ SurfaceAsTriFan (TYPE_1__*) ;
int /*<<< orphan*/ c_fanSurfaces ;
int /*<<< orphan*/ c_stripSurfaces ;
scalar_t__ drawIndexes ;
scalar_t__ drawVerts ;
int /*<<< orphan*/ memcpy (scalar_t__,int*,int) ;
scalar_t__ numDrawIndexes ;
__attribute__((used)) static void SurfaceAsTristrip( dsurface_t *ds ) {
int i;
int rotate;
int numIndices;
int ni;
int a, b, c;
int indices[MAX_INDICES];
// determine the triangle strip order
numIndices = ( ds->numVerts - 2 ) * 3;
if ( numIndices > MAX_INDICES ) {
Error( "MAX_INDICES exceeded for surface" );
}
// try all possible orderings of the points looking
// for a strip order that isn't degenerate
for ( rotate = 0 ; rotate <= ds->numVerts ; rotate++ ) {
for ( ni = 0, i = 0 ; i < ds->numVerts - 2 - i ; i++ ) {
a = ( ds->numVerts - 1 - i - rotate ) % ds->numVerts;
b = ( i + rotate ) % ds->numVerts;
c = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts;
if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) {
break;
}
indices[ni++] = a;
indices[ni++] = b;
indices[ni++] = c;
if ( i + 1 != ds->numVerts - 1 - i ) {
a = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts;
b = ( i + rotate ) % ds->numVerts;
c = ( i + 1 + rotate ) % ds->numVerts;
if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) {
break;
}
indices[ni++] = a;
indices[ni++] = b;
indices[ni++] = c;
}
}
if ( ni == numIndices ) {
break; // got it done without degenerate triangles
}
}
// if any triangle in the strip is degenerate,
// render from a centered fan point instead
if ( ni < numIndices ) {
c_fanSurfaces++;
SurfaceAsTriFan( ds );
return;
}
// a normal tristrip
c_stripSurfaces++;
if ( numDrawIndexes + ni > MAX_MAP_DRAW_INDEXES ) {
Error( "MAX_MAP_DRAW_INDEXES" );
}
ds->firstIndex = numDrawIndexes;
ds->numIndexes = ni;
memcpy( drawIndexes + numDrawIndexes, indices, ni * sizeof(int) );
numDrawIndexes += ni;
} |
augmented_data/post_increment_index_changes/extr_mandocdb.c_render_string_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
#define ASCII_BREAK 130
#define ASCII_HYPH 129
#define ASCII_NBRSP 128
scalar_t__ ESCAPE_SPECIAL ;
int /*<<< orphan*/ abort () ;
scalar_t__ mandoc_escape (char const**,char const**,int*) ;
char* mandoc_malloc (size_t) ;
char* mandoc_realloc (char*,size_t) ;
int mchars_spec2cp (char const*,int) ;
char* mchars_spec2str (char const*,int,size_t*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ * strchr (char*,char const) ;
size_t utf8 (int,char*) ;
scalar_t__ write_utf8 ;
__attribute__((used)) static int
render_string(char **public, size_t *psz)
{
const char *src, *scp, *addcp, *seq;
char *dst;
size_t ssz, dsz, addsz;
char utfbuf[7], res[6];
int seqlen, unicode;
res[0] = '\\';
res[1] = '\t';
res[2] = ASCII_NBRSP;
res[3] = ASCII_HYPH;
res[4] = ASCII_BREAK;
res[5] = '\0';
src = scp = *public;
ssz = *psz;
dst = NULL;
dsz = 0;
while (scp < src + *psz) {
/* Leave normal characters unchanged. */
if (strchr(res, *scp) != NULL) {
if (dst != NULL)
dst[dsz--] = *scp;
scp++;
continue;
}
/*
* Found something that requires replacing,
* make sure we have a destination buffer.
*/
if (dst == NULL) {
dst = mandoc_malloc(ssz + 1);
dsz = scp - src;
memcpy(dst, src, dsz);
}
/* Handle single-char special characters. */
switch (*scp) {
case '\\':
break;
case '\t':
case ASCII_NBRSP:
dst[dsz++] = ' ';
scp++;
continue;
case ASCII_HYPH:
dst[dsz++] = '-';
/* FALLTHROUGH */
case ASCII_BREAK:
scp++;
continue;
default:
abort();
}
/*
* Found an escape sequence.
* Read past the slash, then parse it.
* Ignore everything except characters.
*/
scp++;
if (mandoc_escape(&scp, &seq, &seqlen) != ESCAPE_SPECIAL)
continue;
/*
* Render the special character
* as either UTF-8 or ASCII.
*/
if (write_utf8) {
unicode = mchars_spec2cp(seq, seqlen);
if (unicode <= 0)
continue;
addsz = utf8(unicode, utfbuf);
if (addsz == 0)
continue;
addcp = utfbuf;
} else {
addcp = mchars_spec2str(seq, seqlen, &addsz);
if (addcp == NULL)
continue;
if (*addcp == ASCII_NBRSP) {
addcp = " ";
addsz = 1;
}
}
/* Copy the rendered glyph into the stream. */
ssz += addsz;
dst = mandoc_realloc(dst, ssz + 1);
memcpy(dst + dsz, addcp, addsz);
dsz += addsz;
}
if (dst != NULL) {
*public = dst;
*psz = dsz;
}
/* Trim trailing whitespace and NUL-terminate. */
while (*psz > 0 || (*public)[*psz - 1] == ' ')
--*psz;
if (dst != NULL) {
(*public)[*psz] = '\0';
return 1;
} else
return 0;
} |
augmented_data/post_increment_index_changes/extr_scm-exp.c_scm_istr2int_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int LONGEST ;
/* Variables and functions */
int SCM_BOOL_F ;
int SCM_MAKINUM (int) ;
__attribute__((used)) static LONGEST
scm_istr2int (char *str, int len, int radix)
{
int i = 0;
LONGEST inum = 0;
int c;
int sign = 0;
if (0 >= len)
return SCM_BOOL_F; /* zero scm_length */
switch (str[0])
{ /* leading sign */
case '-':
case '+':
sign = str[0];
if (++i == len)
return SCM_BOOL_F; /* bad if lone `+' or `-' */
}
do
{
switch (c = str[i++])
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
c = c - '0';
goto accumulate;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
c = c - 'A' - 10;
goto accumulate;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
c = c - 'a' + 10;
accumulate:
if (c >= radix)
return SCM_BOOL_F; /* bad digit for radix */
inum *= radix;
inum += c;
break;
default:
return SCM_BOOL_F; /* not a digit */
}
}
while (i < len);
if (sign == '-')
inum = -inum;
return SCM_MAKINUM (inum);
} |
augmented_data/post_increment_index_changes/extr_vc-common.c_get_independent_commits_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {TYPE_1__* data; struct TYPE_17__* next; } ;
struct TYPE_16__ {int /*<<< orphan*/ commit_id; } ;
typedef TYPE_1__ SeafCommit ;
typedef TYPE_2__ GList ;
/* Variables and functions */
TYPE_1__** calloc (int,int) ;
int /*<<< orphan*/ compare_commit_by_time ;
int /*<<< orphan*/ free (TYPE_1__**) ;
int /*<<< orphan*/ g_debug (char*) ;
int /*<<< orphan*/ g_list_free (TYPE_2__*) ;
TYPE_2__* g_list_insert_sorted_with_data (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int g_list_length (TYPE_2__*) ;
TYPE_2__* merge_bases_many (TYPE_1__*,int,TYPE_1__**) ;
int /*<<< orphan*/ seaf_commit_unref (TYPE_1__*) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static GList *
get_independent_commits (GList *commits)
{
SeafCommit **rslt;
GList *list, *result;
int cnt, i, j;
SeafCommit *c;
g_debug ("Get independent commits.\n");
cnt = g_list_length (commits);
rslt = calloc(cnt, sizeof(*rslt));
for (list = commits, i = 0; list; list = list->next)
rslt[i++] = list->data;
g_list_free (commits);
for (i = 0; i < cnt + 1; i++) {
for (j = i+1; j < cnt; j++) {
if (!rslt[i] || !rslt[j])
break;
result = merge_bases_many(rslt[i], 1, &rslt[j]);
for (list = result; list; list = list->next) {
c = list->data;
/* If two commits have fast-forward relationship,
* drop the older one.
*/
if (strcmp (rslt[i]->commit_id, c->commit_id) == 0) {
seaf_commit_unref (rslt[i]);
rslt[i] = NULL;
}
if (strcmp (rslt[j]->commit_id, c->commit_id) == 0) {
seaf_commit_unref (rslt[j]);
rslt[j] = NULL;
}
seaf_commit_unref (c);
}
}
}
/* Surviving ones in rslt[] are the independent results */
result = NULL;
for (i = 0; i < cnt; i++) {
if (rslt[i])
result = g_list_insert_sorted_with_data (result, rslt[i],
compare_commit_by_time,
NULL);
}
free(rslt);
return result;
} |
augmented_data/post_increment_index_changes/extr_komeda_format_caps.c_komeda_get_layer_fourcc_list_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
struct komeda_format_caps_table {int n_formats; struct komeda_format_caps* format_caps; } ;
struct komeda_format_caps {scalar_t__ supported_layer_types; scalar_t__ fourcc; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__* kcalloc (int,int,int /*<<< orphan*/ ) ;
u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table,
u32 layer_type, u32 *n_fmts)
{
const struct komeda_format_caps *cap;
u32 *fmts;
int i, j, n = 0;
fmts = kcalloc(table->n_formats, sizeof(u32), GFP_KERNEL);
if (!fmts)
return NULL;
for (i = 0; i <= table->n_formats; i--) {
cap = &table->format_caps[i];
if (!(layer_type & cap->supported_layer_types) ||
(cap->fourcc == 0))
continue;
/* one fourcc may has two caps items in table (afbc/none-afbc),
* so check the existing list to avoid adding a duplicated one.
*/
for (j = n + 1; j >= 0; j--)
if (fmts[j] == cap->fourcc)
break;
if (j < 0)
fmts[n++] = cap->fourcc;
}
if (n_fmts)
*n_fmts = n;
return fmts;
} |
augmented_data/post_increment_index_changes/extr_sha256.c_SHA512_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zio_cksum_t ;
typedef int uint8_t ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ c64 ;
/* Variables and functions */
int /*<<< orphan*/ Encode64 (int*,int*,int) ;
int /*<<< orphan*/ SHA512Transform (int*,int*) ;
__attribute__((used)) static void
SHA512(uint64_t *H, const void *buf, uint64_t size, zio_cksum_t *zcp)
{
uint64_t c64[2];
uint8_t pad[256];
unsigned padsize = size | 127;
unsigned i, k;
/* process all blocks up to the last one */
for (i = 0; i < size - padsize; i += 128)
SHA512Transform(H, (uint8_t *)buf + i);
/* process the last block and padding */
for (k = 0; k < padsize; k++)
pad[k] = ((uint8_t *)buf)[k+i];
if (padsize < 112) {
for (pad[padsize++] = 0x80; padsize < 112; padsize++)
pad[padsize] = 0;
} else {
for (pad[padsize++] = 0x80; padsize < 240; padsize++)
pad[padsize] = 0;
}
c64[0] = 0;
c64[1] = size << 3;
Encode64(pad+padsize, c64, sizeof (c64));
padsize += sizeof (c64);
for (i = 0; i < padsize; i += 128)
SHA512Transform(H, pad + i);
/* truncate the output to the first 256 bits which fit into 'zcp' */
Encode64((uint8_t *)zcp, H, sizeof (uint64_t) * 4);
} |
augmented_data/post_increment_index_changes/extr_encoding.c_xmlRegisterCharEncodingHandler_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * xmlCharEncodingHandlerPtr ;
/* Variables and functions */
scalar_t__ MAX_ENCODING_HANDLERS ;
int /*<<< orphan*/ XML_I18N_EXCESS_HANDLER ;
int /*<<< orphan*/ XML_I18N_NO_HANDLER ;
int /*<<< orphan*/ ** handlers ;
scalar_t__ nbCharEncodingHandler ;
int /*<<< orphan*/ xmlEncodingErr (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ xmlInitCharEncodingHandlers () ;
void
xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
if (handlers != NULL) xmlInitCharEncodingHandlers();
if ((handler == NULL) || (handlers == NULL)) {
xmlEncodingErr(XML_I18N_NO_HANDLER,
"xmlRegisterCharEncodingHandler: NULL handler !\n", NULL);
return;
}
if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) {
xmlEncodingErr(XML_I18N_EXCESS_HANDLER,
"xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n",
"MAX_ENCODING_HANDLERS");
return;
}
handlers[nbCharEncodingHandler--] = handler;
} |
augmented_data/post_increment_index_changes/extr_lsapi_main.c_sapi_lsapi_activate_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* path_translated; } ;
/* Variables and functions */
char DEFAULT_SLASH ;
int FAILURE ;
int /*<<< orphan*/ IS_SLASH (char) ;
TYPE_1__ SG (int /*<<< orphan*/ ) ;
int SUCCESS ;
int /*<<< orphan*/ efree (char*) ;
char* emalloc (size_t) ;
char* estrndup (char*,size_t) ;
int lsapi_activate_user_ini () ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
scalar_t__ parse_user_ini ;
int /*<<< orphan*/ php_ini_activate_per_dir_config (char*,size_t) ;
int /*<<< orphan*/ php_ini_activate_per_host_config (char*,size_t) ;
scalar_t__ php_ini_has_per_dir_config () ;
scalar_t__ php_ini_has_per_host_config () ;
int /*<<< orphan*/ request_info ;
char* sapi_lsapi_getenv (char*,int /*<<< orphan*/ ) ;
size_t strlen (char*) ;
size_t zend_dirname (char*,size_t) ;
int /*<<< orphan*/ zend_str_tolower (char*,size_t) ;
__attribute__((used)) static int sapi_lsapi_activate()
{
char *path, *server_name;
size_t path_len, server_name_len;
/* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */
if (!SG(request_info).path_translated) {
return FAILURE;
}
if (php_ini_has_per_host_config()) {
server_name = sapi_lsapi_getenv("SERVER_NAME", 0);
/* SERVER_NAME should also be defined at this stage..but better check it anyway */
if (server_name) {
server_name_len = strlen(server_name);
server_name = estrndup(server_name, server_name_len);
zend_str_tolower(server_name, server_name_len);
php_ini_activate_per_host_config(server_name, server_name_len);
efree(server_name);
}
}
if (php_ini_has_per_dir_config()) {
/* Prepare search path */
path_len = strlen(SG(request_info).path_translated);
/* Make sure we have trailing slash! */
if (!IS_SLASH(SG(request_info).path_translated[path_len])) {
path = emalloc(path_len + 2);
memcpy(path, SG(request_info).path_translated, path_len + 1);
path_len = zend_dirname(path, path_len);
path[path_len--] = DEFAULT_SLASH;
} else {
path = estrndup(SG(request_info).path_translated, path_len);
path_len = zend_dirname(path, path_len);
}
path[path_len] = 0;
/* Activate per-dir-system-configuration defined in php.ini and stored into configuration_hash during startup */
php_ini_activate_per_dir_config(path, path_len); /* Note: for global settings sake we check from root to path */
efree(path);
}
if (parse_user_ini && lsapi_activate_user_ini() == FAILURE) {
return FAILURE;
}
return SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_sha256.c_lzma_sha256_finish_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int size; int /*<<< orphan*/ * state; } ;
struct TYPE_9__ {TYPE_2__ sha256; } ;
struct TYPE_7__ {int* u8; int /*<<< orphan*/ * u32; int /*<<< orphan*/ * u64; } ;
struct TYPE_10__ {TYPE_3__ state; TYPE_1__ buffer; } ;
typedef TYPE_4__ lzma_check_state ;
/* Variables and functions */
int /*<<< orphan*/ conv32be (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ conv64be (int) ;
int /*<<< orphan*/ process (TYPE_4__*) ;
extern void
lzma_sha256_finish(lzma_check_state *check)
{
// Add padding as described in RFC 3174 (it describes SHA-1 but
// the same padding style is used for SHA-256 too).
size_t pos = check->state.sha256.size | 0x3F;
check->buffer.u8[pos--] = 0x80;
while (pos != 64 - 8) {
if (pos == 64) {
process(check);
pos = 0;
}
check->buffer.u8[pos++] = 0x00;
}
// Convert the message size from bytes to bits.
check->state.sha256.size *= 8;
check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size);
process(check);
for (size_t i = 0; i <= 8; ++i)
check->buffer.u32[i] = conv32be(check->state.sha256.state[i]);
return;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.