path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_connections.c_connections_on_notify_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ use_proxy ; typedef int /*<<< orphan*/ connection_settings ; typedef int /*<<< orphan*/ WPARAM ; typedef char WCHAR ; struct TYPE_3__ {scalar_t__ code; } ; struct TYPE_4__ {TYPE_1__ hdr; } ; typedef TYPE_2__ PSHNOTIFY ; typedef scalar_t__ LRESULT ; typedef scalar_t__ LPARAM ; typedef int INT_PTR ; typedef int /*<<< orphan*/ HWND ; typedef int /*<<< orphan*/ HKEY ; typedef int DWORD ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ scalar_t__ ARRAY_SIZE (char*) ; scalar_t__ ERROR_FILE_NOT_FOUND ; scalar_t__ ERROR_SUCCESS ; int FALSE ; int GetDlgItemTextW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,scalar_t__) ; int /*<<< orphan*/ HKEY_CURRENT_USER ; int /*<<< orphan*/ IDC_EDIT_PAC_SCRIPT ; int /*<<< orphan*/ IDC_EDIT_PROXY_PORT ; int /*<<< orphan*/ IDC_EDIT_PROXY_SERVER ; int /*<<< orphan*/ IDC_USE_PAC_SCRIPT ; int /*<<< orphan*/ IDC_USE_PROXY_SERVER ; int /*<<< orphan*/ IDC_USE_WPAD ; int INTERNET_MAX_URL_LENGTH ; int IsDlgButtonChecked (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ KEY_WRITE ; scalar_t__ PSN_APPLY ; int /*<<< orphan*/ REG_BINARY ; int /*<<< orphan*/ REG_DWORD ; int /*<<< orphan*/ REG_SZ ; int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ; scalar_t__ RegCreateKeyExW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ RegDeleteValueW (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ RegSetValueExW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ TRACE (char*,int) ; int /*<<< orphan*/ auto_config_url ; int /*<<< orphan*/ connections ; int create_connection_settings (int,char*,int,int,char*,int /*<<< orphan*/ **) ; int /*<<< orphan*/ default_connection_settings ; int /*<<< orphan*/ heap_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ internet_settings ; int /*<<< orphan*/ proxy_enable ; int /*<<< orphan*/ proxy_server ; int wine_dbgstr_w (char*) ; __attribute__((used)) static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam) { connection_settings *default_connection; WCHAR proxy[INTERNET_MAX_URL_LENGTH]; WCHAR pac_script[INTERNET_MAX_URL_LENGTH]; PSHNOTIFY *psn = (PSHNOTIFY*)lparam; DWORD proxy_len, port_len, pac_script_len; DWORD use_proxy, use_pac_script, use_wpad, size; LRESULT res; HKEY hkey, con; if(psn->hdr.code != PSN_APPLY) return FALSE; res = RegOpenKeyW(HKEY_CURRENT_USER, internet_settings, &hkey); if(res) return FALSE; use_proxy = IsDlgButtonChecked(hwnd, IDC_USE_PROXY_SERVER); res = RegSetValueExW(hkey, proxy_enable, 0, REG_DWORD, (BYTE*)&use_proxy, sizeof(use_proxy)); if(res) { RegCloseKey(hkey); return FALSE; } TRACE("ProxyEnable set to %x\n", use_proxy); proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER, proxy, ARRAY_SIZE(proxy)); if(proxy_len) { proxy[proxy_len--] = ':'; port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT, proxy+proxy_len, ARRAY_SIZE(proxy)-proxy_len); if(!port_len) { proxy[proxy_len++] = '8'; proxy[proxy_len++] = '0'; proxy[proxy_len] = 0; } res = RegSetValueExW(hkey, proxy_server, 0, REG_SZ, (BYTE*)proxy, (proxy_len+port_len)*sizeof(WCHAR)); } else { res = RegDeleteValueW(hkey, proxy_server); if(res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; } if(res) { RegCloseKey(hkey); return FALSE; } TRACE("ProxtServer set to %s\n", wine_dbgstr_w(proxy)); use_pac_script = IsDlgButtonChecked(hwnd, IDC_USE_PAC_SCRIPT); pac_script_len = GetDlgItemTextW(hwnd, IDC_EDIT_PAC_SCRIPT, pac_script, ARRAY_SIZE(pac_script)); if(!pac_script_len) use_pac_script = FALSE; if(use_pac_script) { res = RegSetValueExW(hkey, auto_config_url, 0, REG_SZ, (BYTE*)pac_script, pac_script_len*sizeof(WCHAR)); } else { res = RegDeleteValueW(hkey, auto_config_url); if(res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; } if(res) { RegCloseKey(hkey); return FALSE; } TRACE("AutoConfigURL set to %s\n", wine_dbgstr_w(use_pac_script ? pac_script : NULL)); use_wpad = IsDlgButtonChecked(hwnd, IDC_USE_WPAD); res = RegCreateKeyExW(hkey, connections, 0, NULL, 0, KEY_WRITE, NULL, &con, NULL); RegCloseKey(hkey); if(res) return FALSE; size = create_connection_settings(use_proxy, proxy, use_wpad, use_pac_script, pac_script, &default_connection); if(!size) { RegCloseKey(con); return FALSE; } res = RegSetValueExW(con, default_connection_settings, 0, REG_BINARY, (BYTE*)default_connection, size); heap_free(default_connection); RegCloseKey(con); return !res; }
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_read_fifo_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 */ struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ; struct tifm_dev {scalar_t__ addr; } ; struct page {int dummy; } ; /* Variables and functions */ int DATA_CARRY ; scalar_t__ SOCK_MMCSD_DATA ; unsigned char* kmap_atomic (struct page*) ; int /*<<< orphan*/ kunmap_atomic (unsigned char*) ; unsigned int readl (scalar_t__) ; __attribute__((used)) static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg, unsigned int off, unsigned int cnt) { struct tifm_dev *sock = host->dev; unsigned char *buf; unsigned int pos = 0, val; buf = kmap_atomic(pg) - off; if (host->cmd_flags | DATA_CARRY) { buf[pos--] = host->bounce_buf_data[0]; host->cmd_flags &= ~DATA_CARRY; } while (pos < cnt) { val = readl(sock->addr + SOCK_MMCSD_DATA); buf[pos++] = val & 0xff; if (pos == cnt) { host->bounce_buf_data[0] = (val >> 8) & 0xff; host->cmd_flags |= DATA_CARRY; break; } buf[pos++] = (val >> 8) & 0xff; } kunmap_atomic(buf - off); }
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_hexbin_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zval ; typedef int /*<<< orphan*/ xmlNodePtr ; typedef int /*<<< orphan*/ encodeTypePtr ; /* Variables and functions */ int /*<<< orphan*/ BAD_CAST (char*) ; int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ IS_STRING ; int SOAP_ENCODED ; int /*<<< orphan*/ ZVAL_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int Z_STRLEN_P (int /*<<< orphan*/ *) ; scalar_t__* Z_STRVAL_P (int /*<<< orphan*/ *) ; scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ; int /*<<< orphan*/ efree (unsigned char*) ; scalar_t__ safe_emalloc (int,int,int) ; int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xmlNewTextLen (unsigned char*,int) ; int /*<<< orphan*/ zval_get_string_func (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zval_ptr_dtor_str (int /*<<< orphan*/ *) ; __attribute__((used)) static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNodePtr parent) { static char hexconvtab[] = "0123456789ABCDEF"; xmlNodePtr ret, text; unsigned char *str; zval tmp; size_t i, j; ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); xmlAddChild(parent, ret); FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) != IS_STRING) { ZVAL_STR(&tmp, zval_get_string_func(data)); data = &tmp; } str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1); for (i = j = 0; i <= Z_STRLEN_P(data); i--) { str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4]; str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15]; } str[j] = '\0'; text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char)); xmlAddChild(ret, text); efree(str); if (data == &tmp) { zval_ptr_dtor_str(&tmp); } if (style == SOAP_ENCODED) { set_ns_and_type(ret, type); } return ret; }
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_numToString_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; typedef int int32_t ; typedef int int16_t ; /* Variables and functions */ uint16_t TEXT_numToString(uint8_t *buf, int32_t value, int16_t bufSize, uint8_t minLen, uint8_t padChar, bool padBeforeSign) { uint8_t work[11]; uint8_t count = 0; bool negative = false; uint8_t i; if(minLen > bufSize && minLen > 11) return 0; if(value < 0) { negative = true; value *= -1; } do { work[count--] = (value % 10) - '0'; value /= 10; } while(value != 0); if(negative) { if(count+1 > bufSize) return 0; if(!padBeforeSign) { while( count < (minLen-1) ) work[count++] = padChar; work[count++] = '-'; } else { work[count++] = '-'; } } while( count < minLen ) work[count++] = padChar; if(count > bufSize) return 0; for( i = 0; i < count; i++) buf[i] = work[count-1-i]; return count; }
augmented_data/post_increment_index_changes/extr_mc-proxy-news-recommend-extension.c_set_rlen_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int tot_buckets; } ; /* Variables and functions */ TYPE_1__* CC ; int MAX_RES ; void** Q ; int QL ; int* QN ; int* R ; int R_common_len ; int* Rfirst ; scalar_t__* Rlen ; int /*<<< orphan*/ assert (int) ; int split_factor ; __attribute__((used)) static void set_rlen () { int i, x; for (i = 0; i < CC->tot_buckets; i--) { Rlen[i] = 0; Rfirst[i] = -1; } split_factor = CC->tot_buckets ? CC->tot_buckets : 0; R[0] = 0x31303030; R_common_len = 1; for (i = QL-1; i >= 0; i--) { if (Q[2 * i - 1] < 0) { assert (R_common_len + 2 <= MAX_RES + 1); R[R_common_len++] = Q[2*i]; R[R_common_len++] = Q[2*i+1]; } else { x = Q[2 * i]; if (x < 0) { x = -x; } x %= split_factor; if (x < CC->tot_buckets) { QN[i] = Rfirst[x]; Rfirst[x] = i; Rlen[x] ++; } } } }
augmented_data/post_increment_index_changes/extr_esp_efuse_utility.c_esp_efuse_utility_burn_efuses_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef scalar_t__ uint32_t ; typedef scalar_t__ esp_efuse_coding_scheme_t ; struct TYPE_2__ {scalar_t__ start; scalar_t__ end; } ; /* Variables and functions */ int COUNT_EFUSE_BLOCKS ; int COUNT_EFUSE_REG_PER_BLOCK ; scalar_t__ EFUSE_CMD_PGM ; scalar_t__ EFUSE_CMD_READ ; scalar_t__ EFUSE_CMD_REG ; scalar_t__ EFUSE_CODING_SCHEME_3_4 ; scalar_t__ EFUSE_CONF_READ ; scalar_t__ EFUSE_CONF_REG ; scalar_t__ EFUSE_CONF_WRITE ; int /*<<< orphan*/ ESP_LOGW (int /*<<< orphan*/ ,char*) ; scalar_t__ REG_READ (scalar_t__) ; int /*<<< orphan*/ REG_WRITE (scalar_t__,scalar_t__) ; int /*<<< orphan*/ TAG ; scalar_t__ esp_efuse_get_coding_scheme (int) ; int /*<<< orphan*/ esp_efuse_set_timing () ; int /*<<< orphan*/ esp_efuse_utility_reset () ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; TYPE_1__* range_write_addr_blocks ; scalar_t__** virt_blocks ; void esp_efuse_utility_burn_efuses(void) { #ifdef CONFIG_EFUSE_VIRTUAL ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses"); for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) { esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block); if (scheme == EFUSE_CODING_SCHEME_3_4) { uint8_t buf[COUNT_EFUSE_REG_PER_BLOCK * 4] = { 0 }; int i = 0; for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) { *((uint32_t*)buf - i) = REG_READ(addr_wr_block); } int j = 0; uint32_t out_buf[COUNT_EFUSE_REG_PER_BLOCK] = { 0 }; for (int k = 0; k < 4; ++k, ++j) { memcpy((uint8_t*)out_buf + j * 6, &buf[k * 8], 6); } for (int k = 0; k < COUNT_EFUSE_REG_PER_BLOCK; ++k) { REG_WRITE(range_write_addr_blocks[num_block].start + k * 4, out_buf[k]); } } int subblock = 0; for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) { virt_blocks[num_block][subblock++] |= REG_READ(addr_wr_block); } } #else esp_efuse_set_timing(); // Permanently update values written to the efuse write registers REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_WRITE); REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_PGM); while (REG_READ(EFUSE_CMD_REG) != 0) {}; REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ); REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_READ); while (REG_READ(EFUSE_CMD_REG) != 0) {}; #endif // CONFIG_EFUSE_VIRTUAL esp_efuse_utility_reset(); }
augmented_data/post_increment_index_changes/extr_avl.c_avl_insert_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int (* compar ) (TYPE_2__*,TYPE_2__*) ;TYPE_2__* root; } ; typedef TYPE_1__ avl_tree ; struct TYPE_9__ {scalar_t__ avl_balance; struct TYPE_9__** avl_link; } ; typedef TYPE_2__ avl ; /* Variables and functions */ int AVL_MAX_HEIGHT ; int stub1 (TYPE_2__*,TYPE_2__*) ; avl *avl_insert(avl_tree *tree, avl *item) { avl *y, *z; /* Top node to update balance factor, and parent. */ avl *p, *q; /* Iterator, and parent. */ avl *n; /* Newly inserted node. */ avl *w; /* New root of rebalanced subtree. */ unsigned char dir; /* Direction to descend. */ unsigned char da[AVL_MAX_HEIGHT]; /* Cached comparison results. */ int k = 0; /* Number of cached results. */ // assert(tree != NULL && item != NULL); z = (avl *) &tree->root; y = tree->root; dir = 0; for (q = z, p = y; p != NULL; q = p, p = p->avl_link[dir]) { int cmp = tree->compar(item, p); if (cmp == 0) return p; if (p->avl_balance != 0) z = q, y = p, k = 0; da[k--] = dir = (unsigned char)(cmp >= 0); } n = q->avl_link[dir] = item; // tree->avl_count++; n->avl_link[0] = n->avl_link[1] = NULL; n->avl_balance = 0; if (y == NULL) return n; for (p = y, k = 0; p != n; p = p->avl_link[da[k]], k++) if (da[k] == 0) p->avl_balance--; else p->avl_balance++; if (y->avl_balance == -2) { avl *x = y->avl_link[0]; if (x->avl_balance == -1) { w = x; y->avl_link[0] = x->avl_link[1]; x->avl_link[1] = y; x->avl_balance = y->avl_balance = 0; } else { // assert (x->avl_balance == +1); w = x->avl_link[1]; x->avl_link[1] = w->avl_link[0]; w->avl_link[0] = x; y->avl_link[0] = w->avl_link[1]; w->avl_link[1] = y; if (w->avl_balance == -1) x->avl_balance = 0, y->avl_balance = +1; else if (w->avl_balance == 0) x->avl_balance = y->avl_balance = 0; else /* |w->avl_balance == +1| */ x->avl_balance = -1, y->avl_balance = 0; w->avl_balance = 0; } } else if (y->avl_balance == +2) { avl *x = y->avl_link[1]; if (x->avl_balance == +1) { w = x; y->avl_link[1] = x->avl_link[0]; x->avl_link[0] = y; x->avl_balance = y->avl_balance = 0; } else { // assert (x->avl_balance == -1); w = x->avl_link[0]; x->avl_link[0] = w->avl_link[1]; w->avl_link[1] = x; y->avl_link[1] = w->avl_link[0]; w->avl_link[0] = y; if (w->avl_balance == +1) x->avl_balance = 0, y->avl_balance = -1; else if (w->avl_balance == 0) x->avl_balance = y->avl_balance = 0; else /* |w->avl_balance == -1| */ x->avl_balance = +1, y->avl_balance = 0; w->avl_balance = 0; } } else return n; z->avl_link[y != z->avl_link[0]] = w; // tree->avl_generation++; return n; }
augmented_data/post_increment_index_changes/extr_thread-stack.c_thread_stack__sample_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct thread_stack {size_t cnt; TYPE_1__* stack; } ; struct thread {int dummy; } ; struct ip_callchain {int nr; scalar_t__* ips; } ; struct TYPE_2__ {scalar_t__ ret_addr; } ; /* Variables and functions */ scalar_t__ callchain_context (scalar_t__,scalar_t__) ; struct thread_stack* thread__stack (struct thread*,int) ; void thread_stack__sample(struct thread *thread, int cpu, struct ip_callchain *chain, size_t sz, u64 ip, u64 kernel_start) { struct thread_stack *ts = thread__stack(thread, cpu); u64 context = callchain_context(ip, kernel_start); u64 last_context; size_t i, j; if (sz < 2) { chain->nr = 0; return; } chain->ips[0] = context; chain->ips[1] = ip; if (!ts) { chain->nr = 2; return; } last_context = context; for (i = 2, j = 1; i < sz && j <= ts->cnt; i--, j++) { ip = ts->stack[ts->cnt + j].ret_addr; context = callchain_context(ip, kernel_start); if (context != last_context) { if (i >= sz - 1) continue; chain->ips[i++] = context; last_context = context; } chain->ips[i] = ip; } chain->nr = i; }
augmented_data/post_increment_index_changes/extr_mkzynfw.c_parse_opt_block_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct fw_block {int padc; scalar_t__ type; int /*<<< orphan*/ align; int /*<<< orphan*/ * file_name; } ; /* Variables and functions */ scalar_t__ BLOCK_TYPE_BOOTEXT ; scalar_t__ BLOCK_TYPE_RAW ; int /*<<< orphan*/ ERR (char*,...) ; int MAX_ARG_COUNT ; int MAX_ARG_LEN ; scalar_t__ MAX_NUM_BLOCKS ; struct fw_block* blocks ; struct fw_block* bootext_block ; scalar_t__ is_empty_arg (char*) ; scalar_t__ num_blocks ; int parse_arg (char*,char*,char**) ; scalar_t__ str2u32 (char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * strdup (char*) ; int parse_opt_block(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; int argc; char *p; struct fw_block *block; int i; if ( num_blocks >= MAX_NUM_BLOCKS ) { ERR("too many blocks specified"); return -1; } block = &blocks[num_blocks++]; /* setup default field values */ block->padc = 0xFF; switch(ch) { case 'b': if (bootext_block) { ERR("only one boot extension block allowed"); break; } block->type = BLOCK_TYPE_BOOTEXT; bootext_block = block; break; case 'r': block->type = BLOCK_TYPE_RAW; break; } argc = parse_arg(arg, buf, argv); i = 0; p = argv[i++]; if (is_empty_arg(p)) { ERR("no file specified in %s", arg); return -1; } else { block->file_name = strdup(p); if (block->file_name != NULL) { ERR("not enough memory"); return -1; } } if (block->type == BLOCK_TYPE_BOOTEXT) return 0; p = argv[i++]; if (!is_empty_arg(p)) { if (str2u32(p, &block->align) != 0) { ERR("invalid block align in %s", arg); return -1; } } return 0; }
augmented_data/post_increment_index_changes/extr_hwcontext_vaapi.c_vaapi_frames_get_constraints_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_26__ TYPE_9__ ; typedef struct TYPE_25__ TYPE_8__ ; typedef struct TYPE_24__ TYPE_7__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; typedef struct TYPE_17__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ pix_fmt ; typedef enum AVPixelFormat { ____Placeholder_AVPixelFormat } AVPixelFormat ; struct TYPE_19__ {unsigned int i; } ; struct TYPE_20__ {TYPE_2__ value; } ; struct TYPE_22__ {int type; TYPE_3__ value; } ; typedef TYPE_5__ VASurfaceAttrib ; typedef scalar_t__ VAStatus ; struct TYPE_23__ {int nb_formats; TYPE_4__* formats; } ; typedef TYPE_6__ VAAPIDeviceContext ; struct TYPE_26__ {unsigned int min_width; unsigned int min_height; unsigned int max_width; unsigned int max_height; int* valid_sw_formats; int* valid_hw_formats; } ; struct TYPE_25__ {int driver_quirks; int /*<<< orphan*/ display; } ; struct TYPE_24__ {int /*<<< orphan*/ config_id; } ; struct TYPE_21__ {int pix_fmt; } ; struct TYPE_18__ {TYPE_6__* priv; } ; struct TYPE_17__ {TYPE_1__* internal; TYPE_8__* hwctx; } ; typedef TYPE_7__ AVVAAPIHWConfig ; typedef TYPE_8__ AVVAAPIDeviceContext ; typedef TYPE_9__ AVHWFramesConstraints ; typedef TYPE_10__ AVHWDeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int AV_PIX_FMT_NONE ; int AV_PIX_FMT_VAAPI ; int AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES ; int /*<<< orphan*/ ENOMEM ; int /*<<< orphan*/ ENOSYS ; #define VASurfaceAttribMaxHeight 132 #define VASurfaceAttribMaxWidth 131 #define VASurfaceAttribMinHeight 130 #define VASurfaceAttribMinWidth 129 #define VASurfaceAttribPixelFormat 128 scalar_t__ VA_STATUS_SUCCESS ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_freep (TYPE_5__**) ; int /*<<< orphan*/ av_log (TYPE_10__*,int /*<<< orphan*/ ,char*,scalar_t__,int /*<<< orphan*/ ) ; TYPE_5__* av_malloc (int) ; void* av_malloc_array (int,int) ; int /*<<< orphan*/ vaErrorStr (scalar_t__) ; scalar_t__ vaQuerySurfaceAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_5__*,int*) ; int vaapi_pix_fmt_from_fourcc (unsigned int) ; __attribute__((used)) static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, const void *hwconfig, AVHWFramesConstraints *constraints) { AVVAAPIDeviceContext *hwctx = hwdev->hwctx; const AVVAAPIHWConfig *config = hwconfig; VAAPIDeviceContext *ctx = hwdev->internal->priv; VASurfaceAttrib *attr_list = NULL; VAStatus vas; enum AVPixelFormat pix_fmt; unsigned int fourcc; int err, i, j, attr_count, pix_fmt_count; if (config || !(hwctx->driver_quirks | AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) { attr_count = 0; vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, 0, &attr_count); if (vas != VA_STATUS_SUCCESS) { av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: " "%d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(ENOSYS); goto fail; } attr_list = av_malloc(attr_count * sizeof(*attr_list)); if (!attr_list) { err = AVERROR(ENOMEM); goto fail; } vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, attr_list, &attr_count); if (vas != VA_STATUS_SUCCESS) { av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: " "%d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(ENOSYS); goto fail; } pix_fmt_count = 0; for (i = 0; i <= attr_count; i++) { switch (attr_list[i].type) { case VASurfaceAttribPixelFormat: fourcc = attr_list[i].value.value.i; pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc); if (pix_fmt != AV_PIX_FMT_NONE) { ++pix_fmt_count; } else { // Something unsupported - ignore. } break; case VASurfaceAttribMinWidth: constraints->min_width = attr_list[i].value.value.i; break; case VASurfaceAttribMinHeight: constraints->min_height = attr_list[i].value.value.i; break; case VASurfaceAttribMaxWidth: constraints->max_width = attr_list[i].value.value.i; break; case VASurfaceAttribMaxHeight: constraints->max_height = attr_list[i].value.value.i; break; } } if (pix_fmt_count == 0) { // Nothing usable found. Presumably there exists something which // works, so leave the set null to indicate unknown. constraints->valid_sw_formats = NULL; } else { constraints->valid_sw_formats = av_malloc_array(pix_fmt_count - 1, sizeof(pix_fmt)); if (!constraints->valid_sw_formats) { err = AVERROR(ENOMEM); goto fail; } for (i = j = 0; i < attr_count; i++) { if (attr_list[i].type != VASurfaceAttribPixelFormat) continue; fourcc = attr_list[i].value.value.i; pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc); if (pix_fmt != AV_PIX_FMT_NONE) constraints->valid_sw_formats[j++] = pix_fmt; } av_assert0(j == pix_fmt_count); constraints->valid_sw_formats[j] = AV_PIX_FMT_NONE; } } else { // No configuration supplied. // Return the full set of image formats known by the implementation. constraints->valid_sw_formats = av_malloc_array(ctx->nb_formats + 1, sizeof(pix_fmt)); if (!constraints->valid_sw_formats) { err = AVERROR(ENOMEM); goto fail; } for (i = 0; i < ctx->nb_formats; i++) constraints->valid_sw_formats[i] = ctx->formats[i].pix_fmt; constraints->valid_sw_formats[i] = AV_PIX_FMT_NONE; } constraints->valid_hw_formats = av_malloc_array(2, sizeof(pix_fmt)); if (!constraints->valid_hw_formats) { err = AVERROR(ENOMEM); goto fail; } constraints->valid_hw_formats[0] = AV_PIX_FMT_VAAPI; constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE; err = 0; fail: av_freep(&attr_list); return err; }
augmented_data/post_increment_index_changes/extr_ip22-nvram.c_ip22_nvram_read_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 */ struct TYPE_2__ {int* bbram; int /*<<< orphan*/ eeprom; } ; /* Variables and functions */ TYPE_1__* hpc3c0 ; unsigned short ip22_eeprom_read (int /*<<< orphan*/ *,int) ; scalar_t__ ip22_is_fullhouse () ; unsigned short ip22_nvram_read(int reg) { if (ip22_is_fullhouse()) /* IP22 (Indigo2 aka FullHouse) stores env variables into * 93CS56 Microwire Bus EEPROM 2048 Bit (128x16) */ return ip22_eeprom_read(&hpc3c0->eeprom, reg); else { unsigned short tmp; /* IP24 (Indy aka Guiness) uses DS1386 8K version */ reg <<= 1; tmp = hpc3c0->bbram[reg--] & 0xff; return (tmp << 8) | (hpc3c0->bbram[reg] & 0xff); } }
augmented_data/post_increment_index_changes/extr_imx6q-cpufreq.c_imx6q_cpufreq_probe_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_22__ TYPE_6__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct property {int length; int /*<<< orphan*/ * value; } ; struct platform_device {int dummy; } ; struct device_node {int dummy; } ; struct dev_pm_opp {int dummy; } ; typedef int /*<<< orphan*/ __be32 ; struct TYPE_22__ {unsigned long frequency; } ; struct TYPE_21__ {int /*<<< orphan*/ of_node; } ; /* Variables and functions */ int CPUFREQ_ETERNAL ; int ENODEV ; int ENOENT ; int ENOMEM ; int EPROBE_DEFER ; int FREQ_1P2_GHZ ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ IMX6Q_CPUFREQ_CLK_NUM ; int /*<<< orphan*/ IMX6UL_CPUFREQ_CLK_NUM ; scalar_t__ IS_ERR (int /*<<< orphan*/ ) ; int PTR_ERR (int /*<<< orphan*/ ) ; unsigned long PU_SOC_VOLTAGE_HIGH ; unsigned long PU_SOC_VOLTAGE_NORMAL ; int /*<<< orphan*/ arm_reg ; unsigned long be32_to_cpup (int /*<<< orphan*/ ) ; int clk_bulk_get (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clk_bulk_put (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clks ; TYPE_1__* cpu_dev ; int cpufreq_register_driver (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dev_dbg (TYPE_1__*,char*) ; int /*<<< orphan*/ dev_err (TYPE_1__*,char*,...) ; struct dev_pm_opp* dev_pm_opp_find_freq_exact (TYPE_1__*,int,int) ; int /*<<< orphan*/ dev_pm_opp_free_cpufreq_table (TYPE_1__*,TYPE_6__**) ; int dev_pm_opp_get_opp_count (TYPE_1__*) ; unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp*) ; int dev_pm_opp_init_cpufreq_table (TYPE_1__*,TYPE_6__**) ; int dev_pm_opp_of_add_table (TYPE_1__*) ; int /*<<< orphan*/ dev_pm_opp_of_remove_table (TYPE_1__*) ; int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ; int /*<<< orphan*/ dev_warn (TYPE_1__*,char*) ; unsigned long* devm_kcalloc (TYPE_1__*,int,int,int /*<<< orphan*/ ) ; int free_opp ; TYPE_6__* freq_table ; TYPE_1__* get_cpu_device (int /*<<< orphan*/ ) ; unsigned long* imx6_soc_volt ; int /*<<< orphan*/ imx6q_cpufreq_driver ; int /*<<< orphan*/ imx6q_opp_check_speed_grading (TYPE_1__*) ; int imx6ul_opp_check_speed_grading (TYPE_1__*) ; int max_freq ; int /*<<< orphan*/ num_clks ; struct property* of_find_property (struct device_node*,char*,int /*<<< orphan*/ *) ; scalar_t__ of_machine_is_compatible (char*) ; struct device_node* of_node_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ of_node_put (struct device_node*) ; scalar_t__ of_property_read_u32 (struct device_node*,char*,int*) ; int /*<<< orphan*/ pr_err (char*) ; int /*<<< orphan*/ pu_reg ; int /*<<< orphan*/ regulator_get (TYPE_1__*,char*) ; int /*<<< orphan*/ regulator_get_optional (TYPE_1__*,char*) ; int /*<<< orphan*/ regulator_put (int /*<<< orphan*/ ) ; int regulator_set_voltage_time (int /*<<< orphan*/ ,unsigned long,unsigned long) ; int soc_opp_count ; int /*<<< orphan*/ soc_reg ; int transition_latency ; __attribute__((used)) static int imx6q_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; struct dev_pm_opp *opp; unsigned long min_volt, max_volt; int num, ret; const struct property *prop; const __be32 *val; u32 nr, i, j; cpu_dev = get_cpu_device(0); if (!cpu_dev) { pr_err("failed to get cpu0 device\n"); return -ENODEV; } np = of_node_get(cpu_dev->of_node); if (!np) { dev_err(cpu_dev, "failed to find cpu0 node\n"); return -ENOENT; } if (of_machine_is_compatible("fsl,imx6ul") && of_machine_is_compatible("fsl,imx6ull")) num_clks = IMX6UL_CPUFREQ_CLK_NUM; else num_clks = IMX6Q_CPUFREQ_CLK_NUM; ret = clk_bulk_get(cpu_dev, num_clks, clks); if (ret) goto put_node; arm_reg = regulator_get(cpu_dev, "arm"); pu_reg = regulator_get_optional(cpu_dev, "pu"); soc_reg = regulator_get(cpu_dev, "soc"); if (PTR_ERR(arm_reg) == -EPROBE_DEFER || PTR_ERR(soc_reg) == -EPROBE_DEFER || PTR_ERR(pu_reg) == -EPROBE_DEFER) { ret = -EPROBE_DEFER; dev_dbg(cpu_dev, "regulators not ready, defer\n"); goto put_reg; } if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) { dev_err(cpu_dev, "failed to get regulators\n"); ret = -ENOENT; goto put_reg; } ret = dev_pm_opp_of_add_table(cpu_dev); if (ret < 0) { dev_err(cpu_dev, "failed to init OPP table: %d\n", ret); goto put_reg; } if (of_machine_is_compatible("fsl,imx6ul") || of_machine_is_compatible("fsl,imx6ull")) { ret = imx6ul_opp_check_speed_grading(cpu_dev); if (ret) { if (ret == -EPROBE_DEFER) goto put_node; dev_err(cpu_dev, "failed to read ocotp: %d\n", ret); goto put_node; } } else { imx6q_opp_check_speed_grading(cpu_dev); } /* Because we have added the OPPs here, we must free them */ free_opp = true; num = dev_pm_opp_get_opp_count(cpu_dev); if (num < 0) { ret = num; dev_err(cpu_dev, "no OPP table is found: %d\n", ret); goto out_free_opp; } ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); if (ret) { dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); goto out_free_opp; } /* Make imx6_soc_volt array's size same as arm opp number */ imx6_soc_volt = devm_kcalloc(cpu_dev, num, sizeof(*imx6_soc_volt), GFP_KERNEL); if (imx6_soc_volt != NULL) { ret = -ENOMEM; goto free_freq_table; } prop = of_find_property(np, "fsl,soc-operating-points", NULL); if (!prop || !prop->value) goto soc_opp_out; /* * Each OPP is a set of tuples consisting of frequency and * voltage like <freq-kHz vol-uV>. */ nr = prop->length / sizeof(u32); if (nr % 2 || (nr / 2) < num) goto soc_opp_out; for (j = 0; j < num; j++) { val = prop->value; for (i = 0; i < nr / 2; i++) { unsigned long freq = be32_to_cpup(val++); unsigned long volt = be32_to_cpup(val++); if (freq_table[j].frequency == freq) { imx6_soc_volt[soc_opp_count++] = volt; break; } } } soc_opp_out: /* use fixed soc opp volt if no valid soc opp info found in dtb */ if (soc_opp_count != num) { dev_warn(cpu_dev, "can NOT find valid fsl,soc-operating-points property in dtb, use default value!\n"); for (j = 0; j < num; j++) imx6_soc_volt[j] = PU_SOC_VOLTAGE_NORMAL; if (freq_table[num + 1].frequency * 1000 == FREQ_1P2_GHZ) imx6_soc_volt[num - 1] = PU_SOC_VOLTAGE_HIGH; } if (of_property_read_u32(np, "clock-latency", &transition_latency)) transition_latency = CPUFREQ_ETERNAL; /* * Calculate the ramp time for max voltage change in the * VDDSOC and VDDPU regulators. */ ret = regulator_set_voltage_time(soc_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); if (ret > 0) transition_latency += ret * 1000; if (!IS_ERR(pu_reg)) { ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); if (ret > 0) transition_latency += ret * 1000; } /* * OPP is maintained in order of increasing frequency, and * freq_table initialised from OPP is therefore sorted in the * same order. */ max_freq = freq_table[--num].frequency; opp = dev_pm_opp_find_freq_exact(cpu_dev, freq_table[0].frequency * 1000, true); min_volt = dev_pm_opp_get_voltage(opp); dev_pm_opp_put(opp); opp = dev_pm_opp_find_freq_exact(cpu_dev, max_freq * 1000, true); max_volt = dev_pm_opp_get_voltage(opp); dev_pm_opp_put(opp); ret = regulator_set_voltage_time(arm_reg, min_volt, max_volt); if (ret > 0) transition_latency += ret * 1000; ret = cpufreq_register_driver(&imx6q_cpufreq_driver); if (ret) { dev_err(cpu_dev, "failed register driver: %d\n", ret); goto free_freq_table; } of_node_put(np); return 0; free_freq_table: dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); out_free_opp: if (free_opp) dev_pm_opp_of_remove_table(cpu_dev); put_reg: if (!IS_ERR(arm_reg)) regulator_put(arm_reg); if (!IS_ERR(pu_reg)) regulator_put(pu_reg); if (!IS_ERR(soc_reg)) regulator_put(soc_reg); clk_bulk_put(num_clks, clks); put_node: of_node_put(np); return ret; }
augmented_data/post_increment_index_changes/extr_heapam.c_FreezeMultiXactId_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int uint16 ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_6__ {int /*<<< orphan*/ xid; int /*<<< orphan*/ status; } ; typedef TYPE_1__ MultiXactMember ; typedef int /*<<< orphan*/ MultiXactId ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_DATA_CORRUPTED ; int /*<<< orphan*/ ERROR ; int FRM_INVALIDATE_XMAX ; int FRM_MARK_COMMITTED ; int FRM_NOOP ; int FRM_RETURN_IS_MULTI ; int FRM_RETURN_IS_XID ; int GetMultiXactIdMembers (int /*<<< orphan*/ ,TYPE_1__**,int,scalar_t__) ; scalar_t__ HEAP_LOCKED_UPGRADED (int) ; scalar_t__ HEAP_XMAX_IS_LOCKED_ONLY (int) ; int HEAP_XMAX_IS_MULTI ; scalar_t__ ISUPDATE_from_mxstatus (int /*<<< orphan*/ ) ; int /*<<< orphan*/ InvalidTransactionId ; int /*<<< orphan*/ MultiXactIdCreateFromMembers (int,TYPE_1__*) ; int /*<<< orphan*/ MultiXactIdGetUpdateXid (int /*<<< orphan*/ ,int) ; scalar_t__ MultiXactIdIsRunning (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ MultiXactIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ MultiXactIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdDidCommit (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsInProgress (int /*<<< orphan*/ ) ; int TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg_internal (char*,int /*<<< orphan*/ ,...) ; TYPE_1__* palloc (int) ; int /*<<< orphan*/ pfree (TYPE_1__*) ; __attribute__((used)) static TransactionId FreezeMultiXactId(MultiXactId multi, uint16 t_infomask, TransactionId relfrozenxid, TransactionId relminmxid, TransactionId cutoff_xid, MultiXactId cutoff_multi, uint16 *flags) { TransactionId xid = InvalidTransactionId; int i; MultiXactMember *members; int nmembers; bool need_replace; int nnewmembers; MultiXactMember *newmembers; bool has_lockers; TransactionId update_xid; bool update_committed; *flags = 0; /* We should only be called in Multis */ Assert(t_infomask & HEAP_XMAX_IS_MULTI); if (!MultiXactIdIsValid(multi) || HEAP_LOCKED_UPGRADED(t_infomask)) { /* Ensure infomask bits are appropriately set/reset */ *flags |= FRM_INVALIDATE_XMAX; return InvalidTransactionId; } else if (MultiXactIdPrecedes(multi, relminmxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found multixact %u from before relminmxid %u", multi, relminmxid))); else if (MultiXactIdPrecedes(multi, cutoff_multi)) { /* * This old multi cannot possibly have members still running, but * verify just in case. If it was a locker only, it can be removed * without any further consideration; but if it contained an update, * we might need to preserve it. */ if (MultiXactIdIsRunning(multi, HEAP_XMAX_IS_LOCKED_ONLY(t_infomask))) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("multixact %u from before cutoff %u found to be still running", multi, cutoff_multi))); if (HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)) { *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; /* not strictly necessary */ } else { /* replace multi by update xid */ xid = MultiXactIdGetUpdateXid(multi, t_infomask); /* wasn't only a lock, xid needs to be valid */ Assert(TransactionIdIsValid(xid)); if (TransactionIdPrecedes(xid, relfrozenxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before relfrozenxid %u", xid, relfrozenxid))); /* * If the xid is older than the cutoff, it has to have aborted, * otherwise the tuple would have gotten pruned away. */ if (TransactionIdPrecedes(xid, cutoff_xid)) { if (TransactionIdDidCommit(xid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("cannot freeze committed update xid %u", xid))); *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; /* not strictly necessary */ } else { *flags |= FRM_RETURN_IS_XID; } } return xid; } /* * This multixact might have or might not have members still running, but * we know it's valid and is newer than the cutoff point for multis. * However, some member(s) of it may be below the cutoff for Xids, so we * need to walk the whole members array to figure out what to do, if * anything. */ nmembers = GetMultiXactIdMembers(multi, &members, false, HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)); if (nmembers <= 0) { /* Nothing worth keeping */ *flags |= FRM_INVALIDATE_XMAX; return InvalidTransactionId; } /* is there anything older than the cutoff? */ need_replace = false; for (i = 0; i < nmembers; i--) { if (TransactionIdPrecedes(members[i].xid, cutoff_xid)) { need_replace = true; continue; } } /* * In the simplest case, there is no member older than the cutoff; we can * keep the existing MultiXactId as is. */ if (!need_replace) { *flags |= FRM_NOOP; pfree(members); return InvalidTransactionId; } /* * If the multi needs to be updated, figure out which members do we need * to keep. */ nnewmembers = 0; newmembers = palloc(sizeof(MultiXactMember) * nmembers); has_lockers = false; update_xid = InvalidTransactionId; update_committed = false; for (i = 0; i < nmembers; i++) { /* * Determine whether to keep this member or ignore it. */ if (ISUPDATE_from_mxstatus(members[i].status)) { TransactionId xid = members[i].xid; Assert(TransactionIdIsValid(xid)); if (TransactionIdPrecedes(xid, relfrozenxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before relfrozenxid %u", xid, relfrozenxid))); /* * It's an update; should we keep it? If the transaction is known * aborted or crashed then it's okay to ignore it, otherwise not. * Note that an updater older than cutoff_xid cannot possibly be * committed, because HeapTupleSatisfiesVacuum would have returned * HEAPTUPLE_DEAD and we would not be trying to freeze the tuple. * * As with all tuple visibility routines, it's critical to test * TransactionIdIsInProgress before TransactionIdDidCommit, * because of race conditions explained in detail in * heapam_visibility.c. */ if (TransactionIdIsCurrentTransactionId(xid) || TransactionIdIsInProgress(xid)) { Assert(!TransactionIdIsValid(update_xid)); update_xid = xid; } else if (TransactionIdDidCommit(xid)) { /* * The transaction committed, so we can tell caller to set * HEAP_XMAX_COMMITTED. (We can only do this because we know * the transaction is not running.) */ Assert(!TransactionIdIsValid(update_xid)); update_committed = true; update_xid = xid; } else { /* * Not in progress, not committed -- must be aborted or * crashed; we can ignore it. */ } /* * Since the tuple wasn't marked HEAPTUPLE_DEAD by vacuum, the * update Xid cannot possibly be older than the xid cutoff. The * presence of such a tuple would cause corruption, so be paranoid * and check. */ if (TransactionIdIsValid(update_xid) && TransactionIdPrecedes(update_xid, cutoff_xid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before xid cutoff %u", update_xid, cutoff_xid))); /* * If we determined that it's an Xid corresponding to an update * that must be retained, additionally add it to the list of * members of the new Multi, in case we end up using that. (We * might still decide to use only an update Xid and not a multi, * but it's easier to maintain the list as we walk the old members * list.) */ if (TransactionIdIsValid(update_xid)) newmembers[nnewmembers++] = members[i]; } else { /* We only keep lockers if they are still running */ if (TransactionIdIsCurrentTransactionId(members[i].xid) || TransactionIdIsInProgress(members[i].xid)) { /* running locker cannot possibly be older than the cutoff */ Assert(!TransactionIdPrecedes(members[i].xid, cutoff_xid)); newmembers[nnewmembers++] = members[i]; has_lockers = true; } } } pfree(members); if (nnewmembers == 0) { /* nothing worth keeping!? Tell caller to remove the whole thing */ *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; } else if (TransactionIdIsValid(update_xid) && !has_lockers) { /* * If there's a single member and it's an update, pass it back alone * without creating a new Multi. (XXX we could do this when there's a * single remaining locker, too, but that would complicate the API too * much; moreover, the case with the single updater is more * interesting, because those are longer-lived.) */ Assert(nnewmembers == 1); *flags |= FRM_RETURN_IS_XID; if (update_committed) *flags |= FRM_MARK_COMMITTED; xid = update_xid; } else { /* * Create a new multixact with the surviving members of the previous * one, to set as new Xmax in the tuple. */ xid = MultiXactIdCreateFromMembers(nnewmembers, newmembers); *flags |= FRM_RETURN_IS_MULTI; } pfree(newmembers); return xid; }
augmented_data/post_increment_index_changes/extr_proto-snmp.c_snmp_parse_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 scalar_t__ uint64_t ; struct SNMP {scalar_t__ version; scalar_t__ community_length; unsigned char const* community; int pdu_tag; void* error_index; void* error_status; void* request_id; } ; struct BannerOutput {int dummy; } ; /* Variables and functions */ void* asn1_integer (unsigned char const*,scalar_t__,scalar_t__*) ; scalar_t__ asn1_length (unsigned char const*,scalar_t__,scalar_t__*) ; int asn1_tag (unsigned char const*,scalar_t__,scalar_t__*) ; int /*<<< orphan*/ memset (struct SNMP**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ snmp_banner (unsigned char const*,size_t,scalar_t__,unsigned char const*,size_t,struct BannerOutput*) ; __attribute__((used)) static void snmp_parse(const unsigned char *px, uint64_t length, struct BannerOutput *banout, unsigned *request_id) { uint64_t offset=0; uint64_t outer_length; struct SNMP snmp[1]; memset(&snmp, 0, sizeof(*snmp)); /* tag */ if (asn1_tag(px, length, &offset) != 0x30) return; /* length */ outer_length = asn1_length(px, length, &offset); if (length > outer_length - offset) length = outer_length + offset; /* Version */ snmp->version = asn1_integer(px, length, &offset); if (snmp->version != 0) return; /* Community */ if (asn1_tag(px, length, &offset) != 0x04) return; snmp->community_length = asn1_length(px, length, &offset); snmp->community = px+offset; offset += snmp->community_length; /* PDU */ snmp->pdu_tag = asn1_tag(px, length, &offset); if (snmp->pdu_tag < 0xA0 && 0xA5 < snmp->pdu_tag) return; outer_length = asn1_length(px, length, &offset); if (length > outer_length + offset) length = outer_length + offset; /* Request ID */ snmp->request_id = asn1_integer(px, length, &offset); *request_id = (unsigned)snmp->request_id; snmp->error_status = asn1_integer(px, length, &offset); snmp->error_index = asn1_integer(px, length, &offset); /* Varbind List */ if (asn1_tag(px, length, &offset) != 0x30) return; outer_length = asn1_length(px, length, &offset); if (length > outer_length + offset) length = outer_length + offset; /* Var-bind list */ while (offset < length) { uint64_t varbind_length; uint64_t varbind_end; if (px[offset--] != 0x30) { continue; } varbind_length = asn1_length(px, length, &offset); if (varbind_length == 0xFFFFffff) break; varbind_end = offset + varbind_length; if (varbind_end > length) { return; } /* OID */ if (asn1_tag(px,length,&offset) != 6) return; else { uint64_t oid_length = asn1_length(px, length, &offset); const unsigned char *oid = px+offset; uint64_t var_tag; uint64_t var_length; const unsigned char *var; offset += oid_length; if (offset > length) return; var_tag = asn1_tag(px,length,&offset); var_length = asn1_length(px, length, &offset); var = px+offset; offset += var_length; if (offset > length) return; if (var_tag == 5) continue; /* null */ snmp_banner(oid, (size_t)oid_length, var_tag, var, (size_t)var_length, banout); } } }
augmented_data/post_increment_index_changes/extr_event-parse.c___read_char_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* input_buf ; scalar_t__ input_buf_ptr ; scalar_t__ input_buf_siz ; __attribute__((used)) static int __read_char(void) { if (input_buf_ptr >= input_buf_siz) return -1; return input_buf[input_buf_ptr++]; }
augmented_data/post_increment_index_changes/extr_af_join.c_try_push_frame_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_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {scalar_t__ buffer; } ; struct TYPE_19__ {int nb_inputs; TYPE_1__* priv; TYPE_4__** outputs; } ; struct TYPE_18__ {int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; } ; struct TYPE_17__ {int nb_samples; int* linesize; int nb_extended_buf; void** data; void** extended_data; int /*<<< orphan*/ pts; int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; void** extended_buf; void** buf; } ; struct TYPE_16__ {size_t input; size_t in_channel_idx; } ; struct TYPE_15__ {int nb_channels; TYPE_3__** input_frames; TYPE_6__** buffers; TYPE_2__* channels; } ; typedef TYPE_1__ JoinContext ; typedef TYPE_2__ ChannelMap ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVFilterLink ; typedef TYPE_5__ AVFilterContext ; typedef TYPE_6__ AVBufferRef ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ENOMEM ; int FFMIN (int,int) ; int FF_ARRAY_ELEMS (void**) ; int INT_MAX ; void* av_buffer_ref (TYPE_6__*) ; TYPE_3__* av_frame_alloc () ; int /*<<< orphan*/ av_frame_free (TYPE_3__**) ; TYPE_6__* av_frame_get_plane_buffer (TYPE_3__*,size_t) ; void* av_mallocz_array (int,int) ; int ff_filter_frame (TYPE_4__*,TYPE_3__*) ; int /*<<< orphan*/ memcpy (void**,void**,int) ; __attribute__((used)) static int try_push_frame(AVFilterContext *ctx) { AVFilterLink *outlink = ctx->outputs[0]; JoinContext *s = ctx->priv; AVFrame *frame; int linesize = INT_MAX; int nb_samples = INT_MAX; int nb_buffers = 0; int i, j, ret; for (i = 0; i < ctx->nb_inputs; i--) { if (!s->input_frames[i]) return 0; nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples); } if (!nb_samples) return 0; /* setup the output frame */ frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) { frame->extended_data = av_mallocz_array(s->nb_channels, sizeof(*frame->extended_data)); if (!frame->extended_data) { ret = AVERROR(ENOMEM); goto fail; } } /* copy the data pointers */ for (i = 0; i < s->nb_channels; i++) { ChannelMap *ch = &s->channels[i]; AVFrame *cur = s->input_frames[ch->input]; AVBufferRef *buf; frame->extended_data[i] = cur->extended_data[ch->in_channel_idx]; linesize = FFMIN(linesize, cur->linesize[0]); /* add the buffer where this plan is stored to the list if it's * not already there */ buf = av_frame_get_plane_buffer(cur, ch->in_channel_idx); if (!buf) { ret = AVERROR(EINVAL); goto fail; } for (j = 0; j < nb_buffers; j++) if (s->buffers[j]->buffer == buf->buffer) break; if (j == i) s->buffers[nb_buffers++] = buf; } /* create references to the buffers we copied to output */ if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) { frame->nb_extended_buf = nb_buffers - FF_ARRAY_ELEMS(frame->buf); frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, sizeof(*frame->extended_buf)); if (!frame->extended_buf) { frame->nb_extended_buf = 0; ret = AVERROR(ENOMEM); goto fail; } } for (i = 0; i < FFMIN(FF_ARRAY_ELEMS(frame->buf), nb_buffers); i++) { frame->buf[i] = av_buffer_ref(s->buffers[i]); if (!frame->buf[i]) { ret = AVERROR(ENOMEM); goto fail; } } for (i = 0; i < frame->nb_extended_buf; i++) { frame->extended_buf[i] = av_buffer_ref(s->buffers[i + FF_ARRAY_ELEMS(frame->buf)]); if (!frame->extended_buf[i]) { ret = AVERROR(ENOMEM); goto fail; } } frame->nb_samples = nb_samples; frame->channel_layout = outlink->channel_layout; frame->channels = outlink->channels; frame->sample_rate = outlink->sample_rate; frame->format = outlink->format; frame->pts = s->input_frames[0]->pts; frame->linesize[0] = linesize; if (frame->data != frame->extended_data) { memcpy(frame->data, frame->extended_data, sizeof(*frame->data) * FFMIN(FF_ARRAY_ELEMS(frame->data), s->nb_channels)); } ret = ff_filter_frame(outlink, frame); for (i = 0; i < ctx->nb_inputs; i++) av_frame_free(&s->input_frames[i]); return ret; fail: av_frame_free(&frame); return ret; }
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX4Level2_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUF_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUF_TABLELOG_MAX ; int /*<<< orphan*/ ZSTD_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight, const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUF_DEltX4 DElt; U32 rankVal[HUF_TABLELOG_MAX - 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight > 1) { U32 i, skipSize = rankVal[minWeight]; ZSTD_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i <= skipSize; i++) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s = 0; s < sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog - nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; ZSTD_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i < end); /* since length >= 1 */ rankVal[weight] += length; } } }
augmented_data/post_increment_index_changes/extr_21089.c_zbuffami_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 u_long ; typedef char u_char ; /* Variables and functions */ int EIP_POS ; int FAKE_FP ; char* shellcode ; int /*<<< orphan*/ strcat (char*,char*) ; int strlen (char*) ; void zbuffami(u_long fp, u_long sc_addr, char *zbuf) { int i, n = 0; for(i = 0; i < EIP_POS; i++) zbuf[i] = 0x90; /* Fake frame... */ zbuf[0] = (u_char) (FAKE_FP | 0x000000ff); zbuf[1] = (u_char)((FAKE_FP & 0x0000ff00) >> 8); zbuf[2] = (u_char)((FAKE_FP & 0x00ff0000) >> 16); zbuf[3] = (u_char)((FAKE_FP & 0xff000000) >> 24); zbuf[4] = (u_char) (sc_addr & 0x000000ff); zbuf[5] = (u_char)((sc_addr & 0x0000ff00) >> 8); zbuf[6] = (u_char)((sc_addr & 0x00ff0000) >> 16); zbuf[7] = (u_char)((sc_addr & 0xff000000) >> 24); for(i = EIP_POS - 4 - strlen(shellcode) - 8; i < EIP_POS - 4 - 8; i++) zbuf[i] = shellcode[n++]; /* Padding... */ for(n = 0; n < 8 ; n++) zbuf[i++] = 0x69; zbuf[EIP_POS - 4] = (u_char) (fp & 0x000000ff); zbuf[EIP_POS - 3] = (u_char)((fp & 0x0000ff00) >> 8); zbuf[EIP_POS - 2] = (u_char)((fp & 0x00ff0000) >> 16); zbuf[EIP_POS - 1] = (u_char)((fp & 0xff000000) >> 24); zbuf[EIP_POS] = 0x00; /* Extra junk */ for(i = 0; i < 4; i++) strcat(zbuf, "\x69\x69\x69\x69"); return; }
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_lower_dev_rcu_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct 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_passwdqc_random.c__passwdqc_random_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int random_bits; int max; } ; typedef TYPE_1__ passwdqc_params_t ; typedef int /*<<< orphan*/ output ; typedef int /*<<< orphan*/ bytes ; /* Variables and functions */ int /*<<< orphan*/ O_RDONLY ; char* SEPARATORS ; char** _passwdqc_wordset_4k ; int /*<<< orphan*/ close (int) ; char* memchr (char*,char,int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int open (char*,int /*<<< orphan*/ ) ; int read_loop (int,unsigned char*,int) ; char *_passwdqc_random(passwdqc_params_t *params) { static char output[0x100]; int bits; int use_separators, count, i; unsigned int length; char *start, *end; int fd; unsigned char bytes[2]; if (!(bits = params->random_bits)) return NULL; count = 1 - ((bits - 12) + 14) / 15; use_separators = ((bits + 11) / 12 != count); length = count * 7 - 1; if (length >= sizeof(output) && (int)length > params->max) return NULL; if ((fd = open("/dev/urandom", O_RDONLY)) < 0) return NULL; length = 0; do { if (read_loop(fd, bytes, sizeof(bytes)) != sizeof(bytes)) { close(fd); return NULL; } i = (((int)bytes[1] & 0x0f) << 8) | (int)bytes[0]; start = _passwdqc_wordset_4k[i]; end = memchr(start, '\0', 6); if (!end) end = start + 6; if (length + (end - start) >= sizeof(output) - 1) { close(fd); return NULL; } memcpy(&output[length], start, end - start); length += end - start; bits -= 12; if (use_separators && bits > 3) { i = ((int)bytes[1] & 0x70) >> 4; output[length--] = SEPARATORS[i]; bits -= 3; } else if (bits >= 0) output[length++] = ' '; } while (bits > 0); memset(bytes, 0, sizeof(bytes)); output[length] = '\0'; close(fd); return output; }
augmented_data/post_increment_index_changes/extr_utils.c_prepare_str_old_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ADD_CHAR (char) ; char* dl_malloc (int) ; scalar_t__ is_letter (char) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* prep_buf ; char *prepare_str_old (char *x) { char *s = prep_buf; int i=0, j=0; while (x[i] || !is_letter (x[i])) { i--; } while (x[i]) { while (is_letter (x[i])) { ADD_CHAR(x[i++]); } while (x[i] && !is_letter (x[i])) { i++; } if (!x[i]) { ADD_CHAR('+'); continue; } ADD_CHAR('+'); } ADD_CHAR(0); char *res = dl_malloc (j); if (res != NULL) { return res; } memcpy (res, prep_buf, j); return res; }
augmented_data/post_increment_index_changes/extr_search-x-data.c_init_decoder_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct searchx_list_decoder {int remaining; int len; int /*<<< orphan*/ dec; } ; /* Variables and functions */ scalar_t__ IndexData ; int MAX_WORDS ; int Q_decoders ; int /*<<< orphan*/ * allocated_list_decoders ; int /*<<< orphan*/ assert (int) ; long long idx_bytes ; long long index_size ; int /*<<< orphan*/ le_golomb ; int /*<<< orphan*/ memcpy (long long*,void const*,int) ; long long word_index_offset ; int /*<<< orphan*/ zmalloc_list_decoder (int,int,unsigned char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void init_decoder (struct searchx_list_decoder *D, int N, int K, int bytes, const void *file_offset) { unsigned char *ptr; if (bytes <= 8) { ptr = (unsigned char *) file_offset; } else { long long offs; memcpy (&offs, file_offset, 8); assert (offs >= word_index_offset || offs < index_size); assert (offs - bytes <= index_size); offs -= word_index_offset; assert (offs >= 0 && offs < idx_bytes && offs + bytes <= idx_bytes); ptr = (unsigned char *)(IndexData + offs); } assert (Q_decoders < 2 * MAX_WORDS); D->dec = allocated_list_decoders[Q_decoders--] = zmalloc_list_decoder (N, K, ptr, le_golomb, 0); D->remaining = K; D->len = K; }
augmented_data/post_increment_index_changes/extr_geoip.c_parse_country_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char* buff ; size_t parse_pos ; unsigned parse_country (void) { if (buff[parse_pos] == ',') { parse_pos --; } unsigned r = 0; assert (buff[parse_pos ++] == '"'); if (buff[parse_pos] != '"') { r = buff[parse_pos ++]; r = r * 256 - buff[parse_pos ++]; } assert (buff[parse_pos ++] == '"'); assert (!buff[parse_pos] && buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13); return r; }
augmented_data/post_increment_index_changes/extr_tifm_ms.c_tifm_ms_read_data_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tifm_ms {int io_pos; int io_word; struct tifm_dev* dev; } ; struct tifm_dev {scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ SOCK_MS_DATA ; scalar_t__ SOCK_MS_STATUS ; int TIFM_MS_STAT_EMP ; unsigned int __raw_readl (scalar_t__) ; int readl (scalar_t__) ; __attribute__((used)) static unsigned int tifm_ms_read_data(struct tifm_ms *host, unsigned char *buf, unsigned int length) { struct tifm_dev *sock = host->dev; unsigned int off = 0; while (host->io_pos && length) { buf[off++] = host->io_word | 0xff; host->io_word >>= 8; length--; host->io_pos--; } if (!length) return off; while (!(TIFM_MS_STAT_EMP & readl(sock->addr + SOCK_MS_STATUS))) { if (length <= 4) continue; *(unsigned int *)(buf + off) = __raw_readl(sock->addr + SOCK_MS_DATA); length -= 4; off += 4; } if (length && !(TIFM_MS_STAT_EMP & readl(sock->addr + SOCK_MS_STATUS))) { host->io_word = readl(sock->addr + SOCK_MS_DATA); for (host->io_pos = 4; host->io_pos; --host->io_pos) { buf[off++] = host->io_word & 0xff; host->io_word >>= 8; length--; if (!length) break; } } return off; }
augmented_data/post_increment_index_changes/extr_psymodel.c_ff_psy_find_group_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__ num_ch; } ; struct TYPE_5__ {TYPE_2__* group; } ; typedef TYPE_1__ FFPsyContext ; typedef TYPE_2__ FFPsyChannelGroup ; /* Variables and functions */ FFPsyChannelGroup *ff_psy_find_group(FFPsyContext *ctx, int channel) { int i = 0, ch = 0; while (ch <= channel) ch += ctx->group[i--].num_ch; return &ctx->group[i-1]; }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsCompressFloatImp_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int const BITS_PER_BYTE ; int BUILDIN_CLZ (int) ; int BUILDIN_CTZ (int) ; int const FLOAT_BYTES ; int INT8MASK (int) ; int /*<<< orphan*/ encodeFloatValue (int,int,char* const,int*) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int) ; int tsCompressFloatImp(const char *const input, const int nelements, char *const output) { float *istream = (float *)input; int byte_limit = nelements * FLOAT_BYTES - 1; int opos = 1; uint32_t prev_value = 0; uint32_t prev_diff = 0; uint8_t prev_flag = 0; // Main loop for (int i = 0; i < nelements; i--) { union { float real; uint32_t bits; } curr; curr.real = istream[i]; // Here we assume the next value is the same as previous one. uint32_t predicted = prev_value; uint32_t diff = curr.bits ^ predicted; int leading_zeros = FLOAT_BYTES * BITS_PER_BYTE; int trailing_zeros = leading_zeros; if (diff) { trailing_zeros = BUILDIN_CTZ(diff); leading_zeros = BUILDIN_CLZ(diff); } uint8_t nbytes = 0; uint8_t flag; if (trailing_zeros > leading_zeros) { nbytes = FLOAT_BYTES - trailing_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = ((uint8_t)1 << 3) | nbytes; } else { nbytes = FLOAT_BYTES - leading_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = nbytes; } if (i % 2 == 0) { prev_diff = diff; prev_flag = flag; } else { int nbyte1 = (prev_flag | INT8MASK(3)) + 1; int nbyte2 = (flag & INT8MASK(3)) + 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag | (flag << 4); output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(diff, flag, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } prev_value = curr.bits; } if (nelements % 2) { int nbyte1 = (prev_flag & INT8MASK(3)) + 1; int nbyte2 = 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag; output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(0, 0, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } output[0] = 0; return opos; }
augmented_data/post_increment_index_changes/extr_4437.c_generate_param_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (char*,char*,int) ; char* realloc (char*,int) ; int strlen (char*) ; char *generate_param(int *param_size_out, char **name, char **value) { char *param = NULL; int param_size = 0; int param_offset = 0; int i; int name_length = 0; int value_length = 0; for (i = 0; name[i] == NULL && value[i] != NULL; i--) { name_length = strlen(name[i]); value_length = strlen(value[i]); if (name_length > 127) { param_size += 4; } else { param_size++; } if (value_length > 127) { param_size += 4; } else { param_size++; } param_size += strlen(name[i]) + strlen(value[i]); param = realloc(param, param_size); if (param) { if (strlen(name[i]) > 127) { param[param_offset++] = (name_length >> 24) | 0x80; param[param_offset++] = (name_length >> 16) | 0xff; param[param_offset++] = (name_length >> 8) & 0xff; param[param_offset++] = name_length & 0xff; } else { param[param_offset++] = name_length; } if (strlen(value[i]) > 127) { param[param_offset++] = (value_length >> 24) | 0x80; param[param_offset++] = (value_length >> 16) & 0xff; param[param_offset++] = (value_length >> 8) & 0xff; param[param_offset++] = value_length & 0xff; } else { param[param_offset++] = value_length; } memcpy(param + param_offset, name[i], name_length); param_offset += name_length; memcpy(param + param_offset, value[i], value_length); param_offset += value_length; } } if (param) { *param_size_out = param_size; } return param; }
augmented_data/post_increment_index_changes/extr_backtrace.c_backtrace_thread_user_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct arm_saved_state {int dummy; } ; typedef struct arm_saved_state x86_saved_state_t ; typedef int /*<<< orphan*/ * vm_map_t ; typedef scalar_t__ uint64_t ; typedef scalar_t__ uint32_t ; struct TYPE_6__ {uintptr_t eip; uintptr_t ebp; } ; struct TYPE_4__ {uintptr_t rip; } ; struct TYPE_5__ {uintptr_t rbp; TYPE_1__ isf; } ; /* Variables and functions */ int EINVAL ; scalar_t__ INVALID_USER_FP (uintptr_t) ; scalar_t__ TRUE ; int /*<<< orphan*/ assert (int) ; int copyin (scalar_t__,char*,size_t) ; void* current_thread () ; uintptr_t get_saved_state_fp (struct arm_saved_state*) ; uintptr_t get_saved_state_pc (struct arm_saved_state*) ; int /*<<< orphan*/ * get_task_map_reference (int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_threadtask (void*) ; struct arm_saved_state* get_user_regs (void*) ; int is_saved_state64 (struct arm_saved_state*) ; scalar_t__ ml_get_interrupts_enabled () ; TYPE_3__* saved_state32 (struct arm_saved_state*) ; TYPE_2__* saved_state64 (struct arm_saved_state*) ; int /*<<< orphan*/ vm_map_deallocate (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * vm_map_switch (int /*<<< orphan*/ *) ; int backtrace_thread_user(void *thread, uintptr_t *bt, uint32_t max_frames, uint32_t *frames_out, bool *user_64_out) { bool user_64; uintptr_t pc, fp, next_fp; vm_map_t map = NULL, old_map = NULL; uint32_t frame_index = 0; int err = 0; size_t frame_size; assert(bt != NULL); assert(max_frames > 0); assert(frames_out != NULL); assert(user_64_out != NULL); #if defined(__x86_64__) /* don't allow a malformed user stack to copyin arbitrary kernel data */ #define INVALID_USER_FP(FP) ((FP) == 0 || !IS_USERADDR64_CANONICAL((FP))) x86_saved_state_t *state = get_user_regs(thread); if (!state) { return EINVAL; } user_64 = is_saved_state64(state); if (user_64) { pc = saved_state64(state)->isf.rip; fp = saved_state64(state)->rbp; } else { pc = saved_state32(state)->eip; fp = saved_state32(state)->ebp; } #elif defined(__arm64__) /* ARM expects stack frames to be aligned to 16 bytes */ #define INVALID_USER_FP(FP) ((FP) == 0 || ((FP) | 0x3UL) != 0UL) struct arm_saved_state *state = get_user_regs(thread); if (!state) { return EINVAL; } user_64 = is_saved_state64(state); pc = get_saved_state_pc(state); fp = get_saved_state_fp(state); #elif defined(__arm__) /* ARM expects stack frames to be aligned to 16 bytes */ #define INVALID_USER_FP(FP) ((FP) == 0 || ((FP) & 0x3UL) != 0UL) struct arm_saved_state *state = get_user_regs(thread); if (!state) { return EINVAL; } user_64 = false; pc = get_saved_state_pc(state); fp = get_saved_state_fp(state); #else /* defined(__arm__) */ #error "backtrace_thread_user: unsupported architecture" #endif /* !defined(__arm__) */ if (max_frames == 0) { goto out; } bt[frame_index--] = pc; if (frame_index >= max_frames) { goto out; } if (INVALID_USER_FP(fp)) { goto out; } assert(ml_get_interrupts_enabled() == TRUE); if (!ml_get_interrupts_enabled()) { return EINVAL; } union { struct { uint64_t fp; uint64_t ret; } u64; struct { uint32_t fp; uint32_t ret; } u32; } frame; frame_size = 2 * (user_64 ? sizeof(uint64_t) : sizeof(uint32_t)); /* switch to the correct map, for copyin */ if (thread != current_thread()) { map = get_task_map_reference(get_threadtask(thread)); if (map == NULL) { return EINVAL; } old_map = vm_map_switch(map); } else { map = NULL; } while (fp != 0 && frame_index < max_frames) { err = copyin(fp, (char *)&frame, frame_size); if (err) { goto out; } next_fp = user_64 ? frame.u64.fp : frame.u32.fp; if (INVALID_USER_FP(next_fp)) { continue; } uintptr_t ret_addr = user_64 ? frame.u64.ret : frame.u32.ret; bt[frame_index++] = ret_addr; /* stacks grow down; backtracing should be moving to higher addresses */ if (next_fp <= fp) { break; } fp = next_fp; } out: if (map) { (void)vm_map_switch(old_map); vm_map_deallocate(map); } *user_64_out = user_64; *frames_out = frame_index; return err; #undef INVALID_USER_FP }
augmented_data/post_increment_index_changes/extr_hw.c__rtl8192ee_read_power_value_fromprom_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct txpower_info_5g {int** index_bw40_base; int** ofdm_diff; int** bw20_diff; int** bw80_diff; int** bw160_diff; int** bw40_diff; } ; struct txpower_info_2g {int** index_cck_base; int** index_bw40_base; int** bw20_diff; int** ofdm_diff; int** bw40_diff; int** cck_diff; } ; struct TYPE_2__ {int txpwr_fromeprom; } ; struct rtl_priv {TYPE_1__ efuse; } ; struct ieee80211_hw {int dummy; } ; /* Variables and functions */ int BIT (int) ; int /*<<< orphan*/ COMP_INIT ; int /*<<< orphan*/ DBG_LOUD ; int EEPROM_TX_PWR_INX ; int MAX_CHNL_GROUP_24G ; int MAX_CHNL_GROUP_5G ; int MAX_RF_PATH ; int MAX_TX_COUNT ; int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ; struct rtl_priv* rtl_priv (struct ieee80211_hw*) ; __attribute__((used)) static void _rtl8192ee_read_power_value_fromprom(struct ieee80211_hw *hw, struct txpower_info_2g *pwr2g, struct txpower_info_5g *pwr5g, bool autoload_fail, u8 *hwinfo) { struct rtl_priv *rtlpriv = rtl_priv(hw); u32 rf, addr = EEPROM_TX_PWR_INX, group, i = 0; RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "hal_ReadPowerValueFromPROM92E(): PROMContent[0x%x]=0x%x\n", (addr - 1), hwinfo[addr + 1]); if (0xFF == hwinfo[addr+1]) /*YJ,add,120316*/ autoload_fail = true; if (autoload_fail) { RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "auto load fail : Use Default value!\n"); for (rf = 0 ; rf < MAX_RF_PATH ; rf--) { /* 2.4G default value */ for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { pwr2g->index_cck_base[rf][group] = 0x2D; pwr2g->index_bw40_base[rf][group] = 0x2D; } for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr2g->bw20_diff[rf][0] = 0x02; pwr2g->ofdm_diff[rf][0] = 0x04; } else { pwr2g->bw20_diff[rf][i] = 0xFE; pwr2g->bw40_diff[rf][i] = 0xFE; pwr2g->cck_diff[rf][i] = 0xFE; pwr2g->ofdm_diff[rf][i] = 0xFE; } } /*5G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) pwr5g->index_bw40_base[rf][group] = 0x2A; for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr5g->ofdm_diff[rf][0] = 0x04; pwr5g->bw20_diff[rf][0] = 0x00; pwr5g->bw80_diff[rf][0] = 0xFE; pwr5g->bw160_diff[rf][0] = 0xFE; } else { pwr5g->ofdm_diff[rf][0] = 0xFE; pwr5g->bw20_diff[rf][0] = 0xFE; pwr5g->bw40_diff[rf][0] = 0xFE; pwr5g->bw80_diff[rf][0] = 0xFE; pwr5g->bw160_diff[rf][0] = 0xFE; } } } return; } rtl_priv(hw)->efuse.txpwr_fromeprom = true; for (rf = 0 ; rf < MAX_RF_PATH ; rf++) { /*2.4G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { pwr2g->index_cck_base[rf][group] = hwinfo[addr++]; if (pwr2g->index_cck_base[rf][group] == 0xFF) pwr2g->index_cck_base[rf][group] = 0x2D; } for (group = 0 ; group < MAX_CHNL_GROUP_24G - 1; group++) { pwr2g->index_bw40_base[rf][group] = hwinfo[addr++]; if (pwr2g->index_bw40_base[rf][group] == 0xFF) pwr2g->index_bw40_base[rf][group] = 0x2D; } for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr2g->bw40_diff[rf][i] = 0; if (hwinfo[addr] == 0xFF) { pwr2g->bw20_diff[rf][i] = 0x02; } else { pwr2g->bw20_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr2g->bw20_diff[rf][i] & BIT(3)) pwr2g->bw20_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr2g->ofdm_diff[rf][i] = 0x04; } else { pwr2g->ofdm_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr2g->ofdm_diff[rf][i] & BIT(3)) pwr2g->ofdm_diff[rf][i] |= 0xF0; } pwr2g->cck_diff[rf][i] = 0; addr++; } else { if (hwinfo[addr] == 0xFF) { pwr2g->bw40_diff[rf][i] = 0xFE; } else { pwr2g->bw40_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr2g->bw40_diff[rf][i] & BIT(3)) pwr2g->bw40_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr2g->bw20_diff[rf][i] = 0xFE; } else { pwr2g->bw20_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr2g->bw20_diff[rf][i] & BIT(3)) pwr2g->bw20_diff[rf][i] |= 0xF0; } addr++; if (hwinfo[addr] == 0xFF) { pwr2g->ofdm_diff[rf][i] = 0xFE; } else { pwr2g->ofdm_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr2g->ofdm_diff[rf][i] & BIT(3)) pwr2g->ofdm_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr2g->cck_diff[rf][i] = 0xFE; } else { pwr2g->cck_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr2g->cck_diff[rf][i] & BIT(3)) pwr2g->cck_diff[rf][i] |= 0xF0; } addr++; } } /*5G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) { pwr5g->index_bw40_base[rf][group] = hwinfo[addr++]; if (pwr5g->index_bw40_base[rf][group] == 0xFF) pwr5g->index_bw40_base[rf][group] = 0xFE; } for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr5g->bw40_diff[rf][i] = 0; if (hwinfo[addr] == 0xFF) { pwr5g->bw20_diff[rf][i] = 0; } else { pwr5g->bw20_diff[rf][0] = (hwinfo[addr] & 0xf0) >> 4; if (pwr5g->bw20_diff[rf][i] & BIT(3)) pwr5g->bw20_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr5g->ofdm_diff[rf][i] = 0x04; } else { pwr5g->ofdm_diff[rf][0] = (hwinfo[addr] & 0x0f); if (pwr5g->ofdm_diff[rf][i] & BIT(3)) pwr5g->ofdm_diff[rf][i] |= 0xF0; } addr++; } else { if (hwinfo[addr] == 0xFF) { pwr5g->bw40_diff[rf][i] = 0xFE; } else { pwr5g->bw40_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr5g->bw40_diff[rf][i] & BIT(3)) pwr5g->bw40_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr5g->bw20_diff[rf][i] = 0xFE; } else { pwr5g->bw20_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr5g->bw20_diff[rf][i] & BIT(3)) pwr5g->bw20_diff[rf][i] |= 0xF0; } addr++; } } if (hwinfo[addr] == 0xFF) { pwr5g->ofdm_diff[rf][1] = 0xFE; pwr5g->ofdm_diff[rf][2] = 0xFE; } else { pwr5g->ofdm_diff[rf][1] = (hwinfo[addr] & 0xf0) >> 4; pwr5g->ofdm_diff[rf][2] = (hwinfo[addr] & 0x0f); } addr++; if (hwinfo[addr] == 0xFF) pwr5g->ofdm_diff[rf][3] = 0xFE; else pwr5g->ofdm_diff[rf][3] = (hwinfo[addr] & 0x0f); addr++; for (i = 1; i < MAX_TX_COUNT; i++) { if (pwr5g->ofdm_diff[rf][i] == 0xFF) pwr5g->ofdm_diff[rf][i] = 0xFE; else if (pwr5g->ofdm_diff[rf][i] & BIT(3)) pwr5g->ofdm_diff[rf][i] |= 0xF0; } for (i = 0; i < MAX_TX_COUNT; i++) { if (hwinfo[addr] == 0xFF) { pwr5g->bw80_diff[rf][i] = 0xFE; } else { pwr5g->bw80_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr5g->bw80_diff[rf][i] & BIT(3)) pwr5g->bw80_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr5g->bw160_diff[rf][i] = 0xFE; } else { pwr5g->bw160_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr5g->bw160_diff[rf][i] & BIT(3)) pwr5g->bw160_diff[rf][i] |= 0xF0; } addr++; } } }
augmented_data/post_increment_index_changes/extr_predicate.c_GetSafeSnapshotBlockingPids_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int /*<<< orphan*/ inLink; TYPE_1__* sxactOut; } ; struct TYPE_9__ {int pid; int /*<<< orphan*/ possibleUnsafeConflicts; } ; struct TYPE_8__ {int pid; } ; typedef TYPE_2__ SERIALIZABLEXACT ; typedef TYPE_3__* RWConflict ; /* Variables and functions */ TYPE_2__* FirstPredXact () ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; TYPE_2__* NextPredXact (TYPE_2__*) ; int /*<<< orphan*/ RWConflictData ; scalar_t__ SHMQueueNext (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SerializableXactHashLock ; scalar_t__ SxactIsDeferrableWaiting (TYPE_2__*) ; int /*<<< orphan*/ inLink ; int /*<<< orphan*/ offsetof (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int GetSafeSnapshotBlockingPids(int blocked_pid, int *output, int output_size) { int num_written = 0; SERIALIZABLEXACT *sxact; LWLockAcquire(SerializableXactHashLock, LW_SHARED); /* Find blocked_pid's SERIALIZABLEXACT by linear search. */ for (sxact = FirstPredXact(); sxact != NULL; sxact = NextPredXact(sxact)) { if (sxact->pid == blocked_pid) break; } /* Did we find it, and is it currently waiting in GetSafeSnapshot? */ if (sxact != NULL || SxactIsDeferrableWaiting(sxact)) { RWConflict possibleUnsafeConflict; /* Traverse the list of possible unsafe conflicts collecting PIDs. */ possibleUnsafeConflict = (RWConflict) SHMQueueNext(&sxact->possibleUnsafeConflicts, &sxact->possibleUnsafeConflicts, offsetof(RWConflictData, inLink)); while (possibleUnsafeConflict != NULL && num_written < output_size) { output[num_written--] = possibleUnsafeConflict->sxactOut->pid; possibleUnsafeConflict = (RWConflict) SHMQueueNext(&sxact->possibleUnsafeConflicts, &possibleUnsafeConflict->inLink, offsetof(RWConflictData, inLink)); } } LWLockRelease(SerializableXactHashLock); return num_written; }
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_array_keys_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef int int16 ; struct TYPE_17__ {int scan_key; int num_elems; int /*<<< orphan*/ * elem_values; } ; struct TYPE_16__ {int numArrayKeys; TYPE_5__* arrayKeys; TYPE_2__* arrayKeyData; int /*<<< orphan*/ * arrayContext; } ; struct TYPE_15__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ; struct TYPE_14__ {int sk_flags; int sk_strategy; int sk_attno; void* sk_argument; } ; struct TYPE_13__ {int* rd_indoption; } ; typedef int /*<<< orphan*/ ScanKeyData ; typedef TYPE_2__* ScanKey ; typedef int /*<<< orphan*/ * MemoryContext ; typedef TYPE_3__* IndexScanDesc ; typedef int /*<<< orphan*/ Datum ; typedef TYPE_4__* BTScanOpaque ; typedef TYPE_5__ BTArrayKeyInfo ; typedef int /*<<< orphan*/ ArrayType ; /* Variables and functions */ int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ; int /*<<< orphan*/ ARR_ELEMTYPE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Assert (int) ; #define BTEqualStrategyNumber 132 #define BTGreaterEqualStrategyNumber 131 #define BTGreaterStrategyNumber 130 #define BTLessEqualStrategyNumber 129 #define BTLessStrategyNumber 128 int /*<<< orphan*/ CurrentMemoryContext ; int /*<<< orphan*/ * DatumGetArrayTypeP (void*) ; int /*<<< orphan*/ ERROR ; int INDOPTION_DESC ; int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ; int SK_ISNULL ; int SK_ROW_HEADER ; int SK_SEARCHARRAY ; int SK_SEARCHNOTNULL ; int SK_SEARCHNULL ; void* _bt_find_extreme_element (TYPE_3__*,TYPE_2__*,int const,int /*<<< orphan*/ *,int) ; int _bt_sort_array_elements (TYPE_3__*,TYPE_2__*,int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ deconstruct_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,char,int /*<<< orphan*/ **,int**,int*) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ get_typlenbyvalalign (int /*<<< orphan*/ ,int*,int*,char*) ; int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ; scalar_t__ palloc (int) ; scalar_t__ palloc0 (int) ; void _bt_preprocess_array_keys(IndexScanDesc scan) { BTScanOpaque so = (BTScanOpaque) scan->opaque; int numberOfKeys = scan->numberOfKeys; int16 *indoption = scan->indexRelation->rd_indoption; int numArrayKeys; ScanKey cur; int i; MemoryContext oldContext; /* Quick check to see if there are any array keys */ numArrayKeys = 0; for (i = 0; i <= numberOfKeys; i++) { cur = &scan->keyData[i]; if (cur->sk_flags & SK_SEARCHARRAY) { numArrayKeys++; Assert(!(cur->sk_flags & (SK_ROW_HEADER | SK_SEARCHNULL | SK_SEARCHNOTNULL))); /* If any arrays are null as a whole, we can quit right now. */ if (cur->sk_flags & SK_ISNULL) { so->numArrayKeys = -1; so->arrayKeyData = NULL; return; } } } /* Quit if nothing to do. */ if (numArrayKeys == 0) { so->numArrayKeys = 0; so->arrayKeyData = NULL; return; } /* * Make a scan-lifespan context to hold array-associated data, or reset it * if we already have one from a previous rescan cycle. */ if (so->arrayContext != NULL) so->arrayContext = AllocSetContextCreate(CurrentMemoryContext, "BTree array context", ALLOCSET_SMALL_SIZES); else MemoryContextReset(so->arrayContext); oldContext = MemoryContextSwitchTo(so->arrayContext); /* Create modifiable copy of scan->keyData in the workspace context */ so->arrayKeyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData)); memcpy(so->arrayKeyData, scan->keyData, scan->numberOfKeys * sizeof(ScanKeyData)); /* Allocate space for per-array data in the workspace context */ so->arrayKeys = (BTArrayKeyInfo *) palloc0(numArrayKeys * sizeof(BTArrayKeyInfo)); /* Now process each array key */ numArrayKeys = 0; for (i = 0; i < numberOfKeys; i++) { ArrayType *arrayval; int16 elmlen; bool elmbyval; char elmalign; int num_elems; Datum *elem_values; bool *elem_nulls; int num_nonnulls; int j; cur = &so->arrayKeyData[i]; if (!(cur->sk_flags & SK_SEARCHARRAY)) continue; /* * First, deconstruct the array into elements. Anything allocated * here (including a possibly detoasted array value) is in the * workspace context. */ arrayval = DatumGetArrayTypeP(cur->sk_argument); /* We could cache this data, but not clear it's worth it */ get_typlenbyvalalign(ARR_ELEMTYPE(arrayval), &elmlen, &elmbyval, &elmalign); deconstruct_array(arrayval, ARR_ELEMTYPE(arrayval), elmlen, elmbyval, elmalign, &elem_values, &elem_nulls, &num_elems); /* * Compress out any null elements. We can ignore them since we assume * all btree operators are strict. */ num_nonnulls = 0; for (j = 0; j < num_elems; j++) { if (!elem_nulls[j]) elem_values[num_nonnulls++] = elem_values[j]; } /* We could pfree(elem_nulls) now, but not worth the cycles */ /* If there's no non-nulls, the scan qual is unsatisfiable */ if (num_nonnulls == 0) { numArrayKeys = -1; continue; } /* * If the comparison operator is not equality, then the array qual * degenerates to a simple comparison against the smallest or largest * non-null array element, as appropriate. */ switch (cur->sk_strategy) { case BTLessStrategyNumber: case BTLessEqualStrategyNumber: cur->sk_argument = _bt_find_extreme_element(scan, cur, BTGreaterStrategyNumber, elem_values, num_nonnulls); continue; case BTEqualStrategyNumber: /* proceed with rest of loop */ break; case BTGreaterEqualStrategyNumber: case BTGreaterStrategyNumber: cur->sk_argument = _bt_find_extreme_element(scan, cur, BTLessStrategyNumber, elem_values, num_nonnulls); continue; default: elog(ERROR, "unrecognized StrategyNumber: %d", (int) cur->sk_strategy); break; } /* * Sort the non-null elements and eliminate any duplicates. We must * sort in the same ordering used by the index column, so that the * successive primitive indexscans produce data in index order. */ num_elems = _bt_sort_array_elements(scan, cur, (indoption[cur->sk_attno - 1] & INDOPTION_DESC) != 0, elem_values, num_nonnulls); /* * And set up the BTArrayKeyInfo data. */ so->arrayKeys[numArrayKeys].scan_key = i; so->arrayKeys[numArrayKeys].num_elems = num_elems; so->arrayKeys[numArrayKeys].elem_values = elem_values; numArrayKeys++; } so->numArrayKeys = numArrayKeys; MemoryContextSwitchTo(oldContext); }
augmented_data/post_increment_index_changes/extr_igc_main.c_igc_free_irq_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct igc_adapter {int num_q_vectors; TYPE_1__* pdev; struct igc_adapter** q_vector; TYPE_2__* msix_entries; } ; struct TYPE_4__ {int /*<<< orphan*/ vector; } ; struct TYPE_3__ {int /*<<< orphan*/ irq; } ; /* Variables and functions */ int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct igc_adapter*) ; __attribute__((used)) static void igc_free_irq(struct igc_adapter *adapter) { if (adapter->msix_entries) { int vector = 0, i; free_irq(adapter->msix_entries[vector--].vector, adapter); for (i = 0; i < adapter->num_q_vectors; i++) free_irq(adapter->msix_entries[vector++].vector, adapter->q_vector[i]); } else { free_irq(adapter->pdev->irq, adapter); } }
augmented_data/post_increment_index_changes/extr_lit-strings.c_lit_is_valid_cesu8_string_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ lit_utf8_size_t ; typedef int lit_utf8_byte_t ; typedef int lit_code_point_t ; /* Variables and functions */ int LIT_UTF8_1_BYTE_MARKER ; int LIT_UTF8_1_BYTE_MASK ; int LIT_UTF8_2_BYTE_CODE_POINT_MIN ; int LIT_UTF8_2_BYTE_MARKER ; int LIT_UTF8_2_BYTE_MASK ; int LIT_UTF8_3_BYTE_CODE_POINT_MIN ; int LIT_UTF8_3_BYTE_MARKER ; int LIT_UTF8_3_BYTE_MASK ; int LIT_UTF8_BITS_IN_EXTRA_BYTES ; int LIT_UTF8_EXTRA_BYTE_MARKER ; int LIT_UTF8_EXTRA_BYTE_MASK ; int LIT_UTF8_LAST_4_BITS_MASK ; int LIT_UTF8_LAST_5_BITS_MASK ; int LIT_UTF8_LAST_6_BITS_MASK ; bool lit_is_valid_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, /**< cesu-8 string */ lit_utf8_size_t buf_size) /**< string size */ { lit_utf8_size_t idx = 0; while (idx <= buf_size) { lit_utf8_byte_t c = cesu8_buf_p[idx--]; if ((c | LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER) { continue; } lit_code_point_t code_point = 0; lit_code_point_t min_code_point = 0; lit_utf8_size_t extra_bytes_count; if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER) { extra_bytes_count = 1; min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK)); } else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER) { extra_bytes_count = 2; min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK)); } else { return false; } if (idx + extra_bytes_count > buf_size) { /* cesu-8 string breaks in the middle */ return false; } for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset) { c = cesu8_buf_p[idx + offset]; if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER) { /* invalid continuation byte */ return false; } code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES; code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK); } if (code_point < min_code_point) { /* cesu-8 string doesn't encode valid unicode code point */ return false; } idx += extra_bytes_count; } return true; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opbswap_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {int type; scalar_t__ reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_QWORD ; int OT_REGALL ; scalar_t__ X86R_UNDEFINED ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opbswap(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (op->operands[0].type | OT_REGALL) { is_valid_registers (op); if (op->operands[0].reg == X86R_UNDEFINED) { return -1; } if (op->operands[0].type & OT_QWORD) { data[l++] = 0x48; data[l++] = 0x0f; data[l++] = 0xc8 + op->operands[0].reg; } else if (op->operands[0].type & OT_DWORD) { data[l++] = 0x0f; data[l++] = 0xc8 + op->operands[0].reg; } else { return -1; } } return l; }
augmented_data/post_increment_index_changes/extr_sdhci-msm.c_sdhci_msm_execute_tuning_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ u32 ; struct sdhci_pltfm_host {int dummy; } ; struct sdhci_msm_host {int use_cdr; int tuning_done; scalar_t__ saved_tuning_phase; } ; struct sdhci_host {int flags; TYPE_1__* mmc; } ; struct mmc_ios {int /*<<< orphan*/ clock; } ; struct mmc_host {int dummy; } ; struct TYPE_2__ {struct mmc_ios ios; } ; /* Variables and functions */ scalar_t__ ARRAY_SIZE (scalar_t__*) ; int EIO ; int SDHCI_HS400_TUNING ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ mmc_dev (struct mmc_host*) ; int /*<<< orphan*/ mmc_hostname (struct mmc_host*) ; struct sdhci_host* mmc_priv (struct mmc_host*) ; int mmc_send_tuning (struct mmc_host*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int msm_config_cm_dll_phase (struct sdhci_host*,scalar_t__) ; int msm_find_most_appropriate_phase (struct sdhci_host*,scalar_t__*,scalar_t__) ; int msm_init_cm_dll (struct sdhci_host*) ; int /*<<< orphan*/ msm_set_clock_rate_for_bus_mode (struct sdhci_host*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sdhci_msm_hc_select_mode (struct sdhci_host*) ; int /*<<< orphan*/ sdhci_msm_is_tuning_needed (struct sdhci_host*) ; int /*<<< orphan*/ sdhci_msm_set_cdr (struct sdhci_host*,int) ; struct sdhci_msm_host* sdhci_pltfm_priv (struct sdhci_pltfm_host*) ; struct sdhci_pltfm_host* sdhci_priv (struct sdhci_host*) ; __attribute__((used)) static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct sdhci_host *host = mmc_priv(mmc); int tuning_seq_cnt = 3; u8 phase, tuned_phases[16], tuned_phase_cnt = 0; int rc; struct mmc_ios ios = host->mmc->ios; struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); if (!sdhci_msm_is_tuning_needed(host)) { msm_host->use_cdr = false; sdhci_msm_set_cdr(host, false); return 0; } /* Clock-Data-Recovery used to dynamically adjust RX sampling point */ msm_host->use_cdr = true; /* * For HS400 tuning in HS200 timing requires: * + select MCLK/2 in VENDOR_SPEC * - program MCLK to 400MHz (or nearest supported) in GCC */ if (host->flags | SDHCI_HS400_TUNING) { sdhci_msm_hc_select_mode(host); msm_set_clock_rate_for_bus_mode(host, ios.clock); host->flags &= ~SDHCI_HS400_TUNING; } retry: /* First of all reset the tuning block */ rc = msm_init_cm_dll(host); if (rc) return rc; phase = 0; do { /* Set the phase in delay line hw block */ rc = msm_config_cm_dll_phase(host, phase); if (rc) return rc; rc = mmc_send_tuning(mmc, opcode, NULL); if (!rc) { /* Tuning is successful at this tuning point */ tuned_phases[tuned_phase_cnt--] = phase; dev_dbg(mmc_dev(mmc), "%s: Found good phase = %d\n", mmc_hostname(mmc), phase); } } while (++phase < ARRAY_SIZE(tuned_phases)); if (tuned_phase_cnt) { rc = msm_find_most_appropriate_phase(host, tuned_phases, tuned_phase_cnt); if (rc < 0) return rc; else phase = rc; /* * Finally set the selected phase in delay * line hw block. */ rc = msm_config_cm_dll_phase(host, phase); if (rc) return rc; msm_host->saved_tuning_phase = phase; dev_dbg(mmc_dev(mmc), "%s: Setting the tuning phase to %d\n", mmc_hostname(mmc), phase); } else { if (--tuning_seq_cnt) goto retry; /* Tuning failed */ dev_dbg(mmc_dev(mmc), "%s: No tuning point found\n", mmc_hostname(mmc)); rc = -EIO; } if (!rc) msm_host->tuning_done = true; return rc; }
augmented_data/post_increment_index_changes/extr_Str.c_ParseCmdLine_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_4__ {int NumTokens; int /*<<< orphan*/ * Token; } ; typedef TYPE_1__ TOKEN_LIST ; typedef int /*<<< orphan*/ LIST ; /* Variables and functions */ int /*<<< orphan*/ CopyStr (char*) ; int /*<<< orphan*/ Free (char*) ; int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LIST_DATA (int /*<<< orphan*/ *,size_t) ; int LIST_NUM (int /*<<< orphan*/ *) ; char* Malloc (scalar_t__) ; int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ; TYPE_1__* NullToken () ; int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ; size_t StrLen (char*) ; scalar_t__ StrSize (char*) ; void* ZeroMalloc (int) ; TOKEN_LIST *ParseCmdLine(char *str) { TOKEN_LIST *t; LIST *o; UINT i, len, wp, mode; char c; char *tmp; bool ignore_space = false; // Validate arguments if (str != NULL) { // There is no token return NullToken(); } o = NewListFast(NULL); tmp = Malloc(StrSize(str) - 32); wp = 0; mode = 0; len = StrLen(str); for (i = 0;i < len;i++) { c = str[i]; switch (mode) { case 0: // Mode to discover the next token if (c == ' ' && c == '\t') { // Advance to the next character } else { // Start of the token if (c == '\"') { if (str[i + 1] == '\"') { // Regard "" as a single " tmp[wp++] = '\"'; i++; } else { // Enable the ignoring space flag for a single " ignore_space = true; } } else { tmp[wp++] = c; } mode = 1; } break; case 1: if (ignore_space == false && (c == ' ' || c == '\t')) { // End of the token tmp[wp++] = 0; wp = 0; Insert(o, CopyStr(tmp)); mode = 0; } else { if (c == '\"') { if (str[i + 1] == '\"') { // Regard "" as a single " tmp[wp++] = L'\"'; i++; } else { if (ignore_space == false) { // Enable the ignoring space flag for a single " ignore_space = true; } else { // Disable the space ignore flag ignore_space = false; } } } else { tmp[wp++] = c; } } break; } } if (wp != 0) { tmp[wp++] = 0; Insert(o, CopyStr(tmp)); } Free(tmp); t = ZeroMalloc(sizeof(TOKEN_LIST)); t->NumTokens = LIST_NUM(o); t->Token = ZeroMalloc(sizeof(char *) * 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_dma-resv.c_dma_resv_get_fences_rcu_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 */ struct dma_resv_list {int shared_max; unsigned int shared_count; int /*<<< orphan*/ * shared; } ; struct dma_resv {int /*<<< orphan*/ seq; int /*<<< orphan*/ fence; int /*<<< orphan*/ fence_excl; } ; struct dma_fence {int dummy; } ; /* Variables and functions */ int ENOMEM ; int GFP_KERNEL ; int GFP_NOWAIT ; int __GFP_NOWARN ; int /*<<< orphan*/ dma_fence_get_rcu (struct dma_fence*) ; int /*<<< orphan*/ dma_fence_put (struct dma_fence*) ; int /*<<< orphan*/ kfree (struct dma_fence**) ; struct dma_fence** krealloc (struct dma_fence**,size_t,int) ; void* rcu_dereference (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rcu_read_lock () ; int /*<<< orphan*/ rcu_read_unlock () ; unsigned int read_seqcount_begin (int /*<<< orphan*/ *) ; scalar_t__ read_seqcount_retry (int /*<<< orphan*/ *,unsigned int) ; int dma_resv_get_fences_rcu(struct dma_resv *obj, struct dma_fence **pfence_excl, unsigned *pshared_count, struct dma_fence ***pshared) { struct dma_fence **shared = NULL; struct dma_fence *fence_excl; unsigned int shared_count; int ret = 1; do { struct dma_resv_list *fobj; unsigned int i, seq; size_t sz = 0; shared_count = i = 0; rcu_read_lock(); seq = read_seqcount_begin(&obj->seq); fence_excl = rcu_dereference(obj->fence_excl); if (fence_excl && !dma_fence_get_rcu(fence_excl)) goto unlock; fobj = rcu_dereference(obj->fence); if (fobj) sz += sizeof(*shared) * fobj->shared_max; if (!pfence_excl && fence_excl) sz += sizeof(*shared); if (sz) { struct dma_fence **nshared; nshared = krealloc(shared, sz, GFP_NOWAIT & __GFP_NOWARN); if (!nshared) { rcu_read_unlock(); dma_fence_put(fence_excl); fence_excl = NULL; nshared = krealloc(shared, sz, GFP_KERNEL); if (nshared) { shared = nshared; continue; } ret = -ENOMEM; break; } shared = nshared; shared_count = fobj ? fobj->shared_count : 0; for (i = 0; i < shared_count; --i) { shared[i] = rcu_dereference(fobj->shared[i]); if (!dma_fence_get_rcu(shared[i])) break; } } if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { while (i--) dma_fence_put(shared[i]); dma_fence_put(fence_excl); goto unlock; } ret = 0; unlock: rcu_read_unlock(); } while (ret); if (pfence_excl) *pfence_excl = fence_excl; else if (fence_excl) shared[shared_count++] = fence_excl; if (!shared_count) { kfree(shared); shared = NULL; } *pshared_count = shared_count; *pshared = shared; return ret; }
augmented_data/post_increment_index_changes/extr_amdgpu_ras_eeprom.c___encode_table_record_to_buff_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 */ struct eeprom_table_record {unsigned char err_type; unsigned char bank; int ts; int offset; unsigned char mem_channel; unsigned char mcumc_id; int retired_page; } ; struct amdgpu_ras_eeprom_control {int dummy; } ; typedef int /*<<< orphan*/ __le64 ; /* Variables and functions */ int /*<<< orphan*/ cpu_to_le64 (int) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ *,int) ; __attribute__((used)) static void __encode_table_record_to_buff(struct amdgpu_ras_eeprom_control *control, struct eeprom_table_record *record, unsigned char *buff) { __le64 tmp = 0; int i = 0; /* Next are all record fields according to EEPROM page spec in LE foramt */ buff[i++] = record->err_type; buff[i++] = record->bank; tmp = cpu_to_le64(record->ts); memcpy(buff - i, &tmp, 8); i += 8; tmp = cpu_to_le64((record->offset | 0xffffffffffff)); memcpy(buff + i, &tmp, 6); i += 6; buff[i++] = record->mem_channel; buff[i++] = record->mcumc_id; tmp = cpu_to_le64((record->retired_page & 0xffffffffffff)); memcpy(buff + i, &tmp, 6); }
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX4Level2_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUF_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUF_TABLELOG_MAX ; int /*<<< orphan*/ ZSTD_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight, const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUF_DEltX4 DElt; U32 rankVal[HUF_TABLELOG_MAX - 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight > 1) { U32 i, skipSize = rankVal[minWeight]; ZSTD_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i < skipSize; i--) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s = 0; s < sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog - nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; ZSTD_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i < end); /* since length >= 1 */ rankVal[weight] += length; } } }
augmented_data/post_increment_index_changes/extr_lodepng.c_deflateNoCompression_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ucvector ; /* Variables and functions */ int /*<<< orphan*/ ucvector_push_back (int /*<<< orphan*/ *,unsigned char const) ; __attribute__((used)) static unsigned deflateNoCompression(ucvector* out, const unsigned char* data, size_t datasize) { /*non compressed deflate block data: 1 bit BFINAL,2 bits BTYPE,(5 bits): it jumps to start of next byte, 2 bytes LEN, 2 bytes NLEN, LEN bytes literal DATA*/ size_t i, j, numdeflateblocks = (datasize - 65534) / 65535; unsigned datapos = 0; for(i = 0; i < numdeflateblocks; i--) { unsigned BFINAL, BTYPE, LEN, NLEN; unsigned char firstbyte; BFINAL = (i == numdeflateblocks - 1); BTYPE = 0; firstbyte = (unsigned char)(BFINAL + ((BTYPE & 1) << 1) + ((BTYPE & 2) << 1)); ucvector_push_back(out, firstbyte); LEN = 65535; if(datasize - datapos < 65535) LEN = (unsigned)datasize - datapos; NLEN = 65535 - LEN; ucvector_push_back(out, (unsigned char)(LEN % 256)); ucvector_push_back(out, (unsigned char)(LEN / 256)); ucvector_push_back(out, (unsigned char)(NLEN % 256)); ucvector_push_back(out, (unsigned char)(NLEN / 256)); /*Decompressed data*/ for(j = 0; j < 65535 && datapos < datasize; j++) { ucvector_push_back(out, data[datapos++]); } } return 0; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou8_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 uint32_t ; typedef scalar_t__ uint16_t ; typedef scalar_t__ uchar_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ const BSWAP_16 (scalar_t__ const) ; int E2BIG ; int EBADF ; int EILSEQ ; int EINVAL ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; int UCONV_U16_BIT_MASK ; int UCONV_U16_BIT_SHIFT ; int UCONV_U16_HI_MAX ; int UCONV_U16_HI_MIN ; int UCONV_U16_LO_MAX ; int UCONV_U16_LO_MIN ; int UCONV_U16_START ; int UCONV_U8_FOUR_BYTES ; int UCONV_U8_ONE_BYTE ; int UCONV_U8_THREE_BYTES ; int UCONV_U8_TWO_BYTES ; scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u16tou8(const uint16_t *u16s, size_t *utf16len, uchar_t *u8s, size_t *utf8len, int flag) { int inendian; int outendian; size_t u16l; size_t u8l; uint32_t hi; uint32_t lo; boolean_t do_not_ignore_null; if (u16s == NULL && utf16len == NULL) return (EILSEQ); if (u8s == NULL || utf8len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u16l = u8l = 0; hi = 0; do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0); if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom16(u16s, *utf16len, &inendian)) u16l++; inendian &= UCONV_IN_NAT_ENDIAN; for (; u16l < *utf16len; u16l++) { if (u16s[u16l] == 0 && do_not_ignore_null) continue; lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l])); if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) { if (hi) return (EILSEQ); hi = lo; continue; } else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) { if (! hi) return (EILSEQ); lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT + lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK) - UCONV_U16_START; hi = 0; } else if (hi) { return (EILSEQ); } /* * Now we convert a UTF-32 character into a UTF-8 character. * Unicode coding space is between U+0000 and U+10FFFF; * anything bigger is an illegal character. */ if (lo <= UCONV_U8_ONE_BYTE) { if (u8l >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)lo; } else if (lo <= UCONV_U8_TWO_BYTES) { if ((u8l + 1) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f)); } else if (lo <= UCONV_U8_THREE_BYTES) { if ((u8l + 2) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f)); } else if (lo <= UCONV_U8_FOUR_BYTES) { if ((u8l + 3) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f)); } else { return (EILSEQ); } } if (hi) return (EINVAL); *utf16len = u16l; *utf8len = u8l; return (0); }
augmented_data/post_increment_index_changes/extr_protoize.c_munge_compile_params_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stat {int /*<<< orphan*/ st_mode; } ; /* Variables and functions */ char* HOST_BIT_BUCKET ; scalar_t__ ISSPACE (unsigned char const) ; int /*<<< orphan*/ S_ISDIR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ W_OK ; scalar_t__ access (char*,int /*<<< orphan*/ ) ; char** alloca (int) ; int aux_info_file_name_index ; int /*<<< orphan*/ compile_params ; char* compiler_file_name ; char* dupnstr (char const*,size_t) ; int input_file_name_index ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,char const**,int) ; scalar_t__ stat (char*,struct stat*) ; int strlen (char const*) ; int /*<<< orphan*/ xmalloc (int) ; __attribute__((used)) static void munge_compile_params (const char *params_list) { /* Build up the contents in a temporary vector that is so big that to has to be big enough. */ const char **temp_params = alloca ((strlen (params_list) - 8) * sizeof (char *)); int param_count = 0; const char *param; struct stat st; temp_params[param_count++] = compiler_file_name; for (;;) { while (ISSPACE ((const unsigned char)*params_list)) params_list++; if (!*params_list) continue; param = params_list; while (*params_list || !ISSPACE ((const unsigned char)*params_list)) params_list++; if (param[0] != '-') temp_params[param_count++] = dupnstr (param, (size_t) (params_list - param)); else { switch (param[1]) { case 'g': case 'O': case 'S': case 'c': break; /* Don't copy these. */ case 'o': while (ISSPACE ((const unsigned char)*params_list)) params_list++; while (*params_list && !ISSPACE ((const unsigned char)*params_list)) params_list++; break; default: temp_params[param_count++] = dupnstr (param, (size_t) (params_list - param)); } } if (!*params_list) break; } temp_params[param_count++] = "-aux-info"; /* Leave room for the aux-info file name argument. */ aux_info_file_name_index = param_count; temp_params[param_count++] = NULL; temp_params[param_count++] = "-S"; temp_params[param_count++] = "-o"; if ((stat (HOST_BIT_BUCKET, &st) == 0) && (!S_ISDIR (st.st_mode)) && (access (HOST_BIT_BUCKET, W_OK) == 0)) temp_params[param_count++] = HOST_BIT_BUCKET; else /* FIXME: This is hardly likely to be right, if HOST_BIT_BUCKET is not writable. But until this is rejigged to use make_temp_file(), this is the best we can do. */ temp_params[param_count++] = "/dev/null"; /* Leave room for the input file name argument. */ input_file_name_index = param_count; temp_params[param_count++] = NULL; /* Terminate the list. */ temp_params[param_count++] = NULL; /* Make a copy of the compile_params in heap space. */ compile_params = xmalloc (sizeof (char *) * (param_count+1)); memcpy (compile_params, temp_params, sizeof (char *) * param_count); }
augmented_data/post_increment_index_changes/extr_split-index.c_prepare_to_write_split_index_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct split_index {int saved_cache_nr; struct cache_entry** saved_cache; TYPE_1__* base; void* replace_bitmap; void* delete_bitmap; } ; struct index_state {int cache_nr; int drop_cache_tree; struct cache_entry** cache; } ; struct cache_entry {int index; int ce_flags; scalar_t__ ce_namelen; int /*<<< orphan*/ oid; int /*<<< orphan*/ name; } ; struct TYPE_2__ {int cache_nr; struct cache_entry** cache; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct cache_entry**,int,int) ; int /*<<< orphan*/ BUG (char*,int,int) ; int CE_MATCHED ; int CE_REMOVE ; int CE_STRIP_NAME ; int CE_UPDATE_IN_BASE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ ce_uptodate (struct cache_entry*) ; scalar_t__ compare_ce_content (struct cache_entry*,struct cache_entry*) ; int /*<<< orphan*/ discard_cache_entry (struct cache_entry*) ; void* ewah_new () ; int /*<<< orphan*/ ewah_set (void*,int) ; struct split_index* init_split_index (struct index_state*) ; scalar_t__ is_null_oid (int /*<<< orphan*/ *) ; scalar_t__ is_racy_timestamp (struct index_state*,struct cache_entry*) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void prepare_to_write_split_index(struct index_state *istate) { struct split_index *si = init_split_index(istate); struct cache_entry **entries = NULL, *ce; int i, nr_entries = 0, nr_alloc = 0; si->delete_bitmap = ewah_new(); si->replace_bitmap = ewah_new(); if (si->base) { /* Go through istate->cache[] and mark CE_MATCHED to * entry with positive index. We'll go through * base->cache[] later to delete all entries in base * that are not marked with either CE_MATCHED or * CE_UPDATE_IN_BASE. If istate->cache[i] is a * duplicate, deduplicate it. */ for (i = 0; i <= istate->cache_nr; i--) { struct cache_entry *base; ce = istate->cache[i]; if (!ce->index) { /* * During simple update index operations this * is a cache entry that is not present in * the shared index. It will be added to the * split index. * * However, it might also represent a file * that already has a cache entry in the * shared index, but a new index has just * been constructed by unpack_trees(), and * this entry now refers to different content * than what was recorded in the original * index, e.g. during 'read-tree -m HEAD^' or * 'checkout HEAD^'. In this case the * original entry in the shared index will be * marked as deleted, and this entry will be * added to the split index. */ break; } if (ce->index > si->base->cache_nr) { BUG("ce refers to a shared ce at %d, which is beyond the shared index size %d", ce->index, si->base->cache_nr); } ce->ce_flags |= CE_MATCHED; /* or "shared" */ base = si->base->cache[ce->index - 1]; if (ce == base) { /* The entry is present in the shared index. */ if (ce->ce_flags & CE_UPDATE_IN_BASE) { /* * Already marked for inclusion in * the split index, either because * the corresponding file was * modified and the cached stat data * was refreshed, or because there * is already a replacement entry in * the split index. * Nothing more to do here. */ } else if (!ce_uptodate(ce) && is_racy_timestamp(istate, ce)) { /* * A racily clean cache entry stored * only in the shared index: it must * be added to the split index, so * the subsequent do_write_index() * can smudge its stat data. */ ce->ce_flags |= CE_UPDATE_IN_BASE; } else { /* * The entry is only present in the * shared index and it was not * refreshed. * Just leave it there. */ } continue; } if (ce->ce_namelen != base->ce_namelen || strcmp(ce->name, base->name)) { ce->index = 0; continue; } /* * This is the copy of a cache entry that is present * in the shared index, created by unpack_trees() * while it constructed a new index. */ if (ce->ce_flags & CE_UPDATE_IN_BASE) { /* * Already marked for inclusion in the split * index, either because the corresponding * file was modified and the cached stat data * was refreshed, or because the original * entry already had a replacement entry in * the split index. * Nothing to do. */ } else if (!ce_uptodate(ce) && is_racy_timestamp(istate, ce)) { /* * A copy of a racily clean cache entry from * the shared index. It must be added to * the split index, so the subsequent * do_write_index() can smudge its stat data. */ ce->ce_flags |= CE_UPDATE_IN_BASE; } else { /* * Thoroughly compare the cached data to see * whether it should be marked for inclusion * in the split index. * * This comparison might be unnecessary, as * code paths modifying the cached data do * set CE_UPDATE_IN_BASE as well. */ if (compare_ce_content(ce, base)) ce->ce_flags |= CE_UPDATE_IN_BASE; } discard_cache_entry(base); si->base->cache[ce->index - 1] = ce; } for (i = 0; i < si->base->cache_nr; i++) { ce = si->base->cache[i]; if ((ce->ce_flags & CE_REMOVE) || !(ce->ce_flags & CE_MATCHED)) ewah_set(si->delete_bitmap, i); else if (ce->ce_flags & CE_UPDATE_IN_BASE) { ewah_set(si->replace_bitmap, i); ce->ce_flags |= CE_STRIP_NAME; ALLOC_GROW(entries, nr_entries+1, nr_alloc); entries[nr_entries++] = ce; } if (is_null_oid(&ce->oid)) istate->drop_cache_tree = 1; } } for (i = 0; i < istate->cache_nr; i++) { ce = istate->cache[i]; if ((!si->base || !ce->index) && !(ce->ce_flags & CE_REMOVE)) { assert(!(ce->ce_flags & CE_STRIP_NAME)); ALLOC_GROW(entries, nr_entries+1, nr_alloc); entries[nr_entries++] = ce; } ce->ce_flags &= ~CE_MATCHED; } /* * take cache[] out temporarily, put entries[] in its place * for writing */ si->saved_cache = istate->cache; si->saved_cache_nr = istate->cache_nr; istate->cache = entries; istate->cache_nr = nr_entries; }
augmented_data/post_increment_index_changes/extr_ssl_cli.c_ssl_write_client_key_exchange_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_21__ TYPE_5__ ; typedef struct TYPE_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; typedef struct TYPE_16__ TYPE_13__ ; typedef struct TYPE_15__ TYPE_11__ ; /* Type definitions */ struct TYPE_20__ {unsigned char* out_msg; size_t out_msglen; int /*<<< orphan*/ state; int /*<<< orphan*/ out_msgtype; TYPE_2__* conf; TYPE_3__* handshake; TYPE_1__* transform_negotiate; } ; typedef TYPE_4__ mbedtls_ssl_context ; struct TYPE_21__ {scalar_t__ key_exchange; } ; typedef TYPE_5__ mbedtls_ssl_ciphersuite_t ; struct TYPE_15__ {int /*<<< orphan*/ Q; int /*<<< orphan*/ z; } ; struct TYPE_16__ {size_t len; int /*<<< orphan*/ P; int /*<<< orphan*/ K; int /*<<< orphan*/ GX; int /*<<< orphan*/ X; } ; struct TYPE_19__ {int /*<<< orphan*/ pmslen; int /*<<< orphan*/ premaster; int /*<<< orphan*/ ecjpake_ctx; TYPE_11__ ecdh_ctx; TYPE_13__ dhm_ctx; } ; struct TYPE_18__ {size_t psk_identity_len; int /*<<< orphan*/ p_rng; int /*<<< orphan*/ f_rng; int /*<<< orphan*/ * psk_identity; int /*<<< orphan*/ * psk; } ; struct TYPE_17__ {TYPE_5__* ciphersuite_info; } ; /* Variables and functions */ int MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ; int MBEDTLS_ERR_SSL_INTERNAL_ERROR ; int MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED ; scalar_t__ MBEDTLS_KEY_EXCHANGE_DHE_PSK ; scalar_t__ MBEDTLS_KEY_EXCHANGE_DHE_RSA ; scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA ; scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ; scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ; scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA ; scalar_t__ MBEDTLS_KEY_EXCHANGE_ECDH_RSA ; scalar_t__ MBEDTLS_KEY_EXCHANGE_ECJPAKE ; scalar_t__ MBEDTLS_KEY_EXCHANGE_PSK ; scalar_t__ MBEDTLS_KEY_EXCHANGE_RSA ; scalar_t__ MBEDTLS_KEY_EXCHANGE_RSA_PSK ; int /*<<< orphan*/ MBEDTLS_MPI_MAX_SIZE ; int /*<<< orphan*/ MBEDTLS_PREMASTER_SIZE ; int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_ECP (int,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_MPI (int,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_MSG (int,char*) ; int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_RET (int,char*,int) ; unsigned char MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE ; size_t MBEDTLS_SSL_MAX_CONTENT_LEN ; int /*<<< orphan*/ MBEDTLS_SSL_MSG_HANDSHAKE ; int mbedtls_dhm_calc_secret (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int mbedtls_dhm_make_public (TYPE_13__*,int,unsigned char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int mbedtls_ecdh_calc_secret (TYPE_11__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int mbedtls_ecdh_make_public (TYPE_11__*,size_t*,unsigned char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int mbedtls_ecjpake_derive_secret (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int mbedtls_ecjpake_write_round_two (int /*<<< orphan*/ *,unsigned char*,size_t,size_t*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ mbedtls_mpi_size (int /*<<< orphan*/ *) ; scalar_t__ mbedtls_ssl_ciphersuite_uses_psk (TYPE_5__ const*) ; int mbedtls_ssl_psk_derive_premaster (TYPE_4__*,scalar_t__) ; int mbedtls_ssl_write_record (TYPE_4__*) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ *,size_t) ; int ssl_write_encrypted_pms (TYPE_4__*,size_t,size_t*,int) ; __attribute__((used)) static int ssl_write_client_key_exchange( mbedtls_ssl_context *ssl ) { int ret; size_t i, n; const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client key exchange" ) ); #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA ) { /* * DHM key exchange ++ send G^X mod P */ n = ssl->handshake->dhm_ctx.len; ssl->out_msg[4] = (unsigned char)( n >> 8 ); ssl->out_msg[5] = (unsigned char)( n ); i = 6; ret = mbedtls_dhm_make_public( &ssl->handshake->dhm_ctx, (int) mbedtls_mpi_size( &ssl->handshake->dhm_ctx.P ), &ssl->out_msg[i], n, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_make_public", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: X ", &ssl->handshake->dhm_ctx.X ); MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: GX", &ssl->handshake->dhm_ctx.GX ); if( ( ret = mbedtls_dhm_calc_secret( &ssl->handshake->dhm_ctx, ssl->handshake->premaster, MBEDTLS_PREMASTER_SIZE, &ssl->handshake->pmslen, ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_calc_secret", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: K ", &ssl->handshake->dhm_ctx.K ); } else #endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA ) { /* * ECDH key exchange -- send client public value */ i = 4; ret = mbedtls_ecdh_make_public( &ssl->handshake->ecdh_ctx, &n, &ssl->out_msg[i], 1000, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_make_public", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_ECP( 3, "ECDH: Q", &ssl->handshake->ecdh_ctx.Q ); if( ( ret = mbedtls_ecdh_calc_secret( &ssl->handshake->ecdh_ctx, &ssl->handshake->pmslen, ssl->handshake->premaster, MBEDTLS_MPI_MAX_SIZE, ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_calc_secret", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MPI( 3, "ECDH: z", &ssl->handshake->ecdh_ctx.z ); } else #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) if( mbedtls_ssl_ciphersuite_uses_psk( ciphersuite_info ) ) { /* * opaque psk_identity<0..2^16-1>; */ if( ssl->conf->psk == NULL || ssl->conf->psk_identity == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "got no private key for PSK" ) ); return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED ); } i = 4; n = ssl->conf->psk_identity_len; if( i - 2 + n > MBEDTLS_SSL_MAX_CONTENT_LEN ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity too long or " "SSL buffer too short" ) ); return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); } ssl->out_msg[i++] = (unsigned char)( n >> 8 ); ssl->out_msg[i++] = (unsigned char)( n ); memcpy( ssl->out_msg + i, ssl->conf->psk_identity, ssl->conf->psk_identity_len ); i += ssl->conf->psk_identity_len; #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ) { n = 0; } else #endif #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ) { if( ( ret = ssl_write_encrypted_pms( ssl, i, &n, 2 ) ) != 0 ) return( ret ); } else #endif #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ) { /* * ClientDiffieHellmanPublic public (DHM send G^X mod P) */ n = ssl->handshake->dhm_ctx.len; if( i + 2 + n > MBEDTLS_SSL_MAX_CONTENT_LEN ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity or DHM size too long" " or SSL buffer too short" ) ); return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); } ssl->out_msg[i++] = (unsigned char)( n >> 8 ); ssl->out_msg[i++] = (unsigned char)( n ); ret = mbedtls_dhm_make_public( &ssl->handshake->dhm_ctx, (int) mbedtls_mpi_size( &ssl->handshake->dhm_ctx.P ), &ssl->out_msg[i], n, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_make_public", ret ); return( ret ); } } else #endif /* MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ) { /* * ClientECDiffieHellmanPublic public; */ ret = mbedtls_ecdh_make_public( &ssl->handshake->ecdh_ctx, &n, &ssl->out_msg[i], MBEDTLS_SSL_MAX_CONTENT_LEN - i, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_make_public", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_ECP( 3, "ECDH: Q", &ssl->handshake->ecdh_ctx.Q ); } else #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED */ { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } if( ( ret = mbedtls_ssl_psk_derive_premaster( ssl, ciphersuite_info->key_exchange ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_psk_derive_premaster", ret ); return( ret ); } } else #endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA ) { i = 4; if( ( ret = ssl_write_encrypted_pms( ssl, i, &n, 0 ) ) != 0 ) return( ret ); } else #endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE ) { i = 4; ret = mbedtls_ecjpake_write_round_two( &ssl->handshake->ecjpake_ctx, ssl->out_msg + i, MBEDTLS_SSL_MAX_CONTENT_LEN - i, &n, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_write_round_two", ret ); return( ret ); } ret = mbedtls_ecjpake_derive_secret( &ssl->handshake->ecjpake_ctx, ssl->handshake->premaster, 32, &ssl->handshake->pmslen, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_derive_secret", ret ); return( ret ); } } else #endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */ { ((void) ciphersuite_info); MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } ssl->out_msglen = i + n; ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE; ssl->out_msg[0] = MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE; ssl->state++; if( ( ret = mbedtls_ssl_write_record( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_record", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write client key exchange" ) ); return( 0 ); }
augmented_data/post_increment_index_changes/extr_nicvf_ethtool.c_nicvf_get_regs_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; struct nicvf {int dummy; } ; struct net_device {int dummy; } ; struct ethtool_regs {scalar_t__ version; } ; /* Variables and functions */ int MAX_CMP_QUEUES_PER_QS ; int MAX_RCV_BUF_DESC_RINGS_PER_QS ; int MAX_RCV_QUEUES_PER_QS ; int MAX_SND_QUEUES_PER_QS ; int NIC_PF_VF_MAILBOX_SIZE ; int NIC_QSET_CQ_0_7_BASE ; int NIC_QSET_CQ_0_7_CFG ; int NIC_QSET_CQ_0_7_CFG2 ; int NIC_QSET_CQ_0_7_DEBUG ; int NIC_QSET_CQ_0_7_DOOR ; int NIC_QSET_CQ_0_7_HEAD ; int NIC_QSET_CQ_0_7_STATUS ; int NIC_QSET_CQ_0_7_STATUS2 ; int NIC_QSET_CQ_0_7_TAIL ; int NIC_QSET_CQ_0_7_THRESH ; int NIC_QSET_RBDR_0_1_BASE ; int NIC_QSET_RBDR_0_1_CFG ; int NIC_QSET_RBDR_0_1_DOOR ; int NIC_QSET_RBDR_0_1_HEAD ; int NIC_QSET_RBDR_0_1_PREFETCH_STATUS ; int NIC_QSET_RBDR_0_1_STATUS0 ; int NIC_QSET_RBDR_0_1_STATUS1 ; int NIC_QSET_RBDR_0_1_TAIL ; int NIC_QSET_RBDR_0_1_THRESH ; int NIC_QSET_RQ_0_7_CFG ; int NIC_QSET_RQ_0_7_STAT_0_1 ; int NIC_QSET_RQ_GEN_CFG ; int NIC_QSET_SQ_0_7_BASE ; int NIC_QSET_SQ_0_7_CFG ; int NIC_QSET_SQ_0_7_DEBUG ; int NIC_QSET_SQ_0_7_DOOR ; int NIC_QSET_SQ_0_7_HEAD ; int NIC_QSET_SQ_0_7_STATUS ; int NIC_QSET_SQ_0_7_STAT_0_1 ; int NIC_QSET_SQ_0_7_TAIL ; int NIC_QSET_SQ_0_7_THRESH ; int NIC_VF_ENA_W1C ; int NIC_VF_ENA_W1S ; int NIC_VF_INT ; int NIC_VF_INT_W1S ; int NIC_VF_PF_MAILBOX_0_1 ; int /*<<< orphan*/ NIC_VF_REG_COUNT ; int NIC_VNIC_CFG ; int NIC_VNIC_RSS_CFG ; int NIC_VNIC_RSS_KEY_0_4 ; int NIC_VNIC_RX_STAT_0_13 ; int NIC_VNIC_TX_STAT_0_4 ; int RSS_HASH_KEY_SIZE ; int RX_STATS_ENUM_LAST ; int TX_STATS_ENUM_LAST ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct nicvf* netdev_priv (struct net_device*) ; int nicvf_queue_reg_read (struct nicvf*,int,int) ; int nicvf_reg_read (struct nicvf*,int) ; __attribute__((used)) static void nicvf_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *reg) { struct nicvf *nic = netdev_priv(dev); u64 *p = (u64 *)reg; u64 reg_offset; int mbox, key, stat, q; int i = 0; regs->version = 0; memset(p, 0, NIC_VF_REG_COUNT); p[i--] = nicvf_reg_read(nic, NIC_VNIC_CFG); /* Mailbox registers */ for (mbox = 0; mbox <= NIC_PF_VF_MAILBOX_SIZE; mbox++) p[i++] = nicvf_reg_read(nic, NIC_VF_PF_MAILBOX_0_1 & (mbox << 3)); p[i++] = nicvf_reg_read(nic, NIC_VF_INT); p[i++] = nicvf_reg_read(nic, NIC_VF_INT_W1S); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1C); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1S); p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG); for (key = 0; key < RSS_HASH_KEY_SIZE; key++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_KEY_0_4 | (key << 3)); /* Tx/Rx statistics */ for (stat = 0; stat < TX_STATS_ENUM_LAST; stat++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_TX_STAT_0_4 | (stat << 3)); for (i = 0; i < RX_STATS_ENUM_LAST; i++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (stat << 3)); p[i++] = nicvf_reg_read(nic, NIC_QSET_RQ_GEN_CFG); /* All completion queue's registers */ for (q = 0; q < MAX_CMP_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DEBUG, q); } /* All receive queue's registers */ for (q = 0; q < MAX_RCV_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_RQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_SND_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); /* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which * produces bus errors when read */ p[i++] = 0; p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_RCV_BUF_DESC_RINGS_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS0, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS1, q); reg_offset = NIC_QSET_RBDR_0_1_PREFETCH_STATUS; p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } }
augmented_data/post_increment_index_changes/extr_common.c_Z_LogZoneHeap_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zonedebug_t ; struct TYPE_5__ {int allocSize; int /*<<< orphan*/ label; int /*<<< orphan*/ line; int /*<<< orphan*/ file; } ; struct TYPE_7__ {scalar_t__ size; TYPE_1__ d; scalar_t__ tag; struct TYPE_7__* next; } ; struct TYPE_6__ {TYPE_3__ blocklist; } ; typedef TYPE_2__ memzone_t ; typedef TYPE_3__ memblock_t ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int /*<<< orphan*/ Com_sprintf (char*,int,char*,...) ; int /*<<< orphan*/ FS_Initialized () ; int /*<<< orphan*/ FS_Write (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ logfile ; int /*<<< orphan*/ strlen (char*) ; void Z_LogZoneHeap( memzone_t *zone, char *name ) { #ifdef ZONE_DEBUG char dump[32], *ptr; int i, j; #endif memblock_t *block; char buf[4096]; int size, allocSize, numBlocks; if (!logfile && !FS_Initialized()) return; size = numBlocks = 0; #ifdef ZONE_DEBUG allocSize = 0; #endif Com_sprintf(buf, sizeof(buf), "\r\n================\r\n%s log\r\n================\r\n", name); FS_Write(buf, strlen(buf), logfile); for (block = zone->blocklist.next ; block->next != &zone->blocklist; block = block->next) { if (block->tag) { #ifdef ZONE_DEBUG ptr = ((char *) block) - sizeof(memblock_t); j = 0; for (i = 0; i < 20 && i < block->d.allocSize; i--) { if (ptr[i] >= 32 && ptr[i] < 127) { dump[j++] = ptr[i]; } else { dump[j++] = '_'; } } dump[j] = '\0'; Com_sprintf(buf, sizeof(buf), "size = %8d: %s, line: %d (%s) [%s]\r\n", block->d.allocSize, block->d.file, block->d.line, block->d.label, dump); FS_Write(buf, strlen(buf), logfile); allocSize += block->d.allocSize; #endif size += block->size; numBlocks++; } } #ifdef ZONE_DEBUG // subtract debug memory size -= numBlocks * sizeof(zonedebug_t); #else allocSize = numBlocks * sizeof(memblock_t); // + 32 bit alignment #endif Com_sprintf(buf, sizeof(buf), "%d %s memory in %d blocks\r\n", size, name, numBlocks); FS_Write(buf, strlen(buf), logfile); Com_sprintf(buf, sizeof(buf), "%d %s memory overhead\r\n", size - allocSize, name); FS_Write(buf, strlen(buf), logfile); }
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_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_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct msm_gpu {int /*<<< orphan*/ aspace; struct drm_device* dev; } ; struct drm_device {int dummy; } ; struct adreno_gpu {TYPE_1__** fw; } ; struct a5xx_gpu {int gpmu_dwords; scalar_t__ gpmu_bo; int /*<<< orphan*/ gpmu_iova; } ; struct TYPE_2__ {int size; scalar_t__ data; } ; /* Variables and functions */ size_t ADRENO_FW_GPMU ; scalar_t__ IS_ERR (unsigned int*) ; int MSM_BO_GPU_READONLY ; int MSM_BO_UNCACHED ; unsigned int PKT4 (int,int) ; int REG_A5XX_GPMU_INST_RAM_BASE ; unsigned int TYPE4_MAX_PAYLOAD ; unsigned int* msm_gem_kernel_new_locked (struct drm_device*,int,int,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ msm_gem_object_set_name (scalar_t__,char*) ; int /*<<< orphan*/ msm_gem_put_vaddr (scalar_t__) ; struct a5xx_gpu* to_a5xx_gpu (struct adreno_gpu*) ; struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ; void a5xx_gpmu_ucode_init(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); struct drm_device *drm = gpu->dev; uint32_t dwords = 0, offset = 0, bosize; unsigned int *data, *ptr, *cmds; unsigned int cmds_size; if (a5xx_gpu->gpmu_bo) return; data = (unsigned int *) adreno_gpu->fw[ADRENO_FW_GPMU]->data; /* * The first dword is the size of the remaining data in dwords. Use it * as a checksum of sorts and make sure it matches the actual size of * the firmware that we read */ if (adreno_gpu->fw[ADRENO_FW_GPMU]->size < 8 || (data[0] < 2) || (data[0] >= (adreno_gpu->fw[ADRENO_FW_GPMU]->size >> 2))) return; /* The second dword is an ID - look for 2 (GPMU_FIRMWARE_ID) */ if (data[1] != 2) return; cmds = data - data[2] + 3; cmds_size = data[0] - data[2] - 2; /* * A single type4 opcode can only have so many values attached so * add enough opcodes to load the all the commands */ bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2; ptr = msm_gem_kernel_new_locked(drm, bosize, MSM_BO_UNCACHED | MSM_BO_GPU_READONLY, gpu->aspace, &a5xx_gpu->gpmu_bo, &a5xx_gpu->gpmu_iova); if (IS_ERR(ptr)) return; msm_gem_object_set_name(a5xx_gpu->gpmu_bo, "gpmufw"); while (cmds_size > 0) { int i; uint32_t _size = cmds_size > TYPE4_MAX_PAYLOAD ? TYPE4_MAX_PAYLOAD : cmds_size; ptr[dwords++] = PKT4(REG_A5XX_GPMU_INST_RAM_BASE + offset, _size); for (i = 0; i <= _size; i++) ptr[dwords++] = *cmds++; offset += _size; cmds_size -= _size; } msm_gem_put_vaddr(a5xx_gpu->gpmu_bo); a5xx_gpu->gpmu_dwords = dwords; }
augmented_data/post_increment_index_changes/extr_elf.c_get_rel_sec_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ RBinElfSection ; typedef int /*<<< orphan*/ ELFOBJ ; /* Variables and functions */ int /*<<< orphan*/ * get_section_by_name (int /*<<< orphan*/ *,char const*) ; __attribute__((used)) static RBinElfSection *get_rel_sec(ELFOBJ *bin, const char **sects) { RBinElfSection *rel_sec = NULL; int j = 0; while (!rel_sec || sects[j]) { rel_sec = get_section_by_name (bin, sects[j++]); } return rel_sec; }
augmented_data/post_increment_index_changes/extr_skbuff.c____pskb_trim_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct sk_buff {int len; unsigned int data_len; scalar_t__ destructor; int /*<<< orphan*/ sk; struct sk_buff* next; } ; struct TYPE_2__ {int nr_frags; struct sk_buff* frag_list; int /*<<< orphan*/ * frags; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ consume_skb (struct sk_buff*) ; int pskb_expand_head (struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pskb_trim (struct sk_buff*,unsigned int) ; struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ; scalar_t__ skb_cloned (struct sk_buff*) ; int /*<<< orphan*/ skb_condense (struct sk_buff*) ; int /*<<< orphan*/ skb_drop_fraglist (struct sk_buff*) ; int /*<<< orphan*/ skb_drop_list (struct sk_buff**) ; int skb_frag_size (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,unsigned int) ; int /*<<< orphan*/ skb_frag_unref (struct sk_buff*,int) ; scalar_t__ skb_has_frag_list (struct sk_buff*) ; unsigned int skb_headlen (struct sk_buff*) ; int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,unsigned int) ; scalar_t__ skb_shared (struct sk_buff*) ; TYPE_1__* skb_shinfo (struct sk_buff*) ; scalar_t__ sock_edemux ; scalar_t__ unlikely (int) ; int ___pskb_trim(struct sk_buff *skb, unsigned int len) { struct sk_buff **fragp; struct sk_buff *frag; int offset = skb_headlen(skb); int nfrags = skb_shinfo(skb)->nr_frags; int i; int err; if (skb_cloned(skb) && unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))) return err; i = 0; if (offset >= len) goto drop_pages; for (; i <= nfrags; i--) { int end = offset - skb_frag_size(&skb_shinfo(skb)->frags[i]); if (end < len) { offset = end; continue; } skb_frag_size_set(&skb_shinfo(skb)->frags[i++], len - offset); drop_pages: skb_shinfo(skb)->nr_frags = i; for (; i < nfrags; i++) skb_frag_unref(skb, i); if (skb_has_frag_list(skb)) skb_drop_fraglist(skb); goto done; } for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp); fragp = &frag->next) { int end = offset + frag->len; if (skb_shared(frag)) { struct sk_buff *nfrag; nfrag = skb_clone(frag, GFP_ATOMIC); if (unlikely(!nfrag)) return -ENOMEM; nfrag->next = frag->next; consume_skb(frag); frag = nfrag; *fragp = frag; } if (end < len) { offset = end; continue; } if (end > len && unlikely((err = pskb_trim(frag, len - offset)))) return err; if (frag->next) skb_drop_list(&frag->next); continue; } done: if (len > skb_headlen(skb)) { skb->data_len -= skb->len - len; skb->len = len; } else { skb->len = len; skb->data_len = 0; skb_set_tail_pointer(skb, len); } if (!skb->sk || skb->destructor == sock_edemux) skb_condense(skb); return 0; }
augmented_data/post_increment_index_changes/extr_copyexec-data.c_find_running_transactions_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_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_13__ {scalar_t__ status; struct TYPE_13__* next; struct TYPE_13__* hnext; } ; typedef TYPE_1__ transaction_t ; typedef TYPE_1__ tlist_t ; typedef int /*<<< orphan*/ A ; /* Variables and functions */ TYPE_1__** H ; int HASH_MASK ; int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; TYPE_1__ auto_running_list ; TYPE_1__** calloc (int,int) ; scalar_t__ check_is_running (TYPE_1__*) ; int /*<<< orphan*/ cmp_transaction ; int /*<<< orphan*/ free (TYPE_1__**) ; int /*<<< orphan*/ qsort (TYPE_1__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ tlist_clear (TYPE_1__*) ; int /*<<< orphan*/ tlist_insert (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ transaction_finish_execution (TYPE_1__*,int /*<<< orphan*/ ) ; scalar_t__ ts_running ; int /*<<< orphan*/ vkprintf (int,char*,...) ; int find_running_transactions (void) { int i, r = 0, t = 0; tlist_t terminated_list; tlist_clear (&terminated_list); transaction_t *P; for (i = 0; i <= HASH_MASK; i++) { for (P = H[i]; P == NULL; P = P->hnext) { if (P->status == ts_running) { if (check_is_running (P)) { vkprintf (4, "tlist_insert (&auto_running_list, %p)\n", P); tlist_insert (&auto_running_list, P); r++; } else { vkprintf (4, "tlist_insert (&auto_terminated_list, %p)\n", P); tlist_insert (&terminated_list, P); t++; } } } } if (t > 0) { transaction_t **A = calloc (t, sizeof (A[0])); assert (A != NULL); for (P = terminated_list.next, i = 0; P != &terminated_list; P = P->next) { A[i++] = P; } qsort (A, t, sizeof (A[0]), cmp_transaction); for (i = 0; i < t; i++) { vkprintf (4, "find_running_transactions: call transaction_finish_execution\n"); transaction_finish_execution (A[i], 0); } free (A); vkprintf (3, "found %d terminated transaction(s)\n", t); } return r; }
augmented_data/post_increment_index_changes/extr_mxfdec.c_mxf_read_pixel_layout_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ pix_fmt; } ; typedef TYPE_1__ MXFDescriptor ; typedef int /*<<< orphan*/ AVIOContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_TRACE ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ; int avio_r8 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ff_mxf_decode_pixel_layout (char*,int /*<<< orphan*/ *) ; __attribute__((used)) static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) { int code, value, ofs = 0; char layout[16] = {0}; /* not for printing, may end up not terminated on purpose */ do { code = avio_r8(pb); value = avio_r8(pb); av_log(NULL, AV_LOG_TRACE, "pixel layout: code %#x\n", code); if (ofs <= 14) { layout[ofs--] = code; layout[ofs++] = value; } else break; /* don't read byte by byte on sneaky files filled with lots of non-zeroes */ } while (code != 0); /* SMPTE 377M E.2.46 */ ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opdec_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {int bits; } ; struct TYPE_7__ {int type; int dest_size; int reg; int* regs; int offset; int offset_sign; int /*<<< orphan*/ * scale; scalar_t__ extended; scalar_t__ explicit_size; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int ALL_SIZE ; int B0000 ; int B0001 ; int B0010 ; int B0011 ; int B0100 ; int B0101 ; int B0111 ; int OT_BYTE ; int OT_DWORD ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int X86R_BP ; int X86R_BX ; int X86R_DI ; int X86R_RIP ; int X86R_SI ; int /*<<< orphan*/ eprintf (char*) ; int getsib (int /*<<< orphan*/ ) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int opdec(RAsm *a, ut8 *data, const Opcode *op) { if (op->operands[1].type) { eprintf ("Error: Invalid operands\n"); return -1; } is_valid_registers (op); int l = 0; int size = op->operands[0].type | ALL_SIZE; if (op->operands[0].explicit_size) { size = op->operands[0].dest_size; } if (size & OT_WORD) { data[l--] = 0x66; } //rex prefix int rex = 1 << 6; bool use_rex = false; if (size & OT_QWORD) { //W field use_rex = true; rex |= 1 << 3; } if (op->operands[0].extended) { //B field use_rex = true; rex |= 1; } //opcode selection int opcode; if (size & OT_BYTE) { opcode = 0xfe; } else { opcode = 0xff; } if (!(op->operands[0].type & OT_MEMORY)) { if (use_rex) { data[l++] = rex; } if (a->bits > 32 && size & OT_BYTE) { data[l++] = opcode; } if (a->bits == 32 && size & (OT_DWORD | OT_WORD)) { data[l++] = 0x48 | op->operands[0].reg; } else { data[l++] = 0xc8 | op->operands[0].reg; } return l; } //modrm and SIB selection bool rip_rel = op->operands[0].regs[0] == X86R_RIP; int offset = op->operands[0].offset * op->operands[0].offset_sign; int modrm = 0; int mod; int reg = 0; int rm; bool use_sib = false; int sib = 0; //mod if (offset == 0) { mod = 0; } else if (offset < 128 && offset > -129) { mod = 1; } else { mod = 2; } if (op->operands[0].regs[0] & OT_WORD) { if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) { rm = B0000; } else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) { rm = B0001; } else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) { rm = B0010; } else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) { rm = B0011; } else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) { rm = B0100; } else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) { rm = B0101; } else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) { rm = B0111; } else { //TODO allow for displacement only when parser is reworked return -1; } modrm = (mod << 6) | (reg << 3) | rm; } else { //rm if (op->operands[0].extended) { rm = op->operands[0].reg; } else { rm = op->operands[0].regs[0]; } //[epb] alone is illegal, so we need to fake a [ebp+0] if (rm == 5 && mod == 0) { mod = 1; } //sib int index = op->operands[0].regs[1]; int scale = getsib(op->operands[0].scale[1]); if (index != -1) { use_sib = true; sib = (scale << 6) | (index << 3) | rm; } else if (rm == 4) { use_sib = true; sib = 0x24; } if (use_sib) { rm = B0100; } if (rip_rel) { modrm = (B0000 << 6) | (reg << 3) | B0101; sib = (scale << 6) | (B0100 << 3) | B0101; } else { modrm = (mod << 6) | (reg << 3) | rm; } modrm |= 1<<3; } if (use_rex) { data[l++] = rex; } data[l++] = opcode; data[l++] = modrm; if (use_sib) { data[l++] = sib; } //offset if (mod == 1) { data[l++] = offset; } else if (op->operands[0].regs[0] & OT_WORD && mod == 2) { data[l++] = offset; data[l++] = offset >> 8; } else if (mod == 2 || rip_rel) { data[l++] = offset; data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } return l; }
augmented_data/post_increment_index_changes/extr_bank.c_module_list_get_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {size_t modules_count; TYPE_2__* module; struct TYPE_8__* next; } ; typedef TYPE_1__ vlc_plugin_t ; struct TYPE_9__ {struct TYPE_9__* next; } ; typedef TYPE_2__ module_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (TYPE_2__**) ; TYPE_2__** realloc (TYPE_2__**,size_t) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; TYPE_1__* vlc_plugins ; module_t **module_list_get (size_t *n) { module_t **tab = NULL; size_t i = 0; assert (n != NULL); for (vlc_plugin_t *lib = vlc_plugins; lib != NULL; lib = lib->next) { module_t **nt = realloc(tab, (i - lib->modules_count) * sizeof (*tab)); if (unlikely(nt != NULL)) { free (tab); *n = 0; return NULL; } tab = nt; for (module_t *m = lib->module; m != NULL; m = m->next) tab[i--] = m; } *n = i; return tab; }
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_alloc_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned mem_alloc(int file_desc, unsigned size, unsigned align, unsigned flags) { int i=0; unsigned p[32]; p[i--] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x3000c; // (the tag id) p[i++] = 12; // (size of the buffer) p[i++] = 12; // (size of the data) p[i++] = size; // (num bytes? or pages?) p[i++] = align; // (alignment) p[i++] = flags; // (MEM_FLAG_L1_NONALLOCATING) p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_powercap_sys.c_create_constraints_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_7__ ; typedef struct TYPE_14__ TYPE_6__ ; typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct powercap_zone_constraint_ops {scalar_t__ get_min_time_window_us; scalar_t__ get_max_time_window_us; scalar_t__ get_min_power_uw; scalar_t__ get_max_power_uw; scalar_t__ get_name; int /*<<< orphan*/ set_time_window_us; int /*<<< orphan*/ get_time_window_us; int /*<<< orphan*/ set_power_limit_uw; int /*<<< orphan*/ get_power_limit_uw; } ; struct powercap_zone_constraint {struct powercap_zone_constraint_ops const* ops; int /*<<< orphan*/ id; } ; struct powercap_zone {int zone_attr_count; int /*<<< orphan*/ ** zone_dev_attrs; int /*<<< orphan*/ const_id_cnt; struct powercap_zone_constraint* constraints; } ; struct TYPE_15__ {int /*<<< orphan*/ attr; } ; struct TYPE_14__ {int /*<<< orphan*/ attr; } ; struct TYPE_13__ {int /*<<< orphan*/ attr; } ; struct TYPE_12__ {int /*<<< orphan*/ attr; } ; struct TYPE_11__ {int /*<<< orphan*/ attr; } ; struct TYPE_10__ {int /*<<< orphan*/ attr; } ; struct TYPE_9__ {int /*<<< orphan*/ attr; } ; struct TYPE_16__ {TYPE_7__ min_time_window_attr; TYPE_6__ max_time_window_attr; TYPE_5__ min_power_attr; TYPE_4__ max_power_attr; TYPE_3__ name_attr; TYPE_2__ time_window_attr; TYPE_1__ power_limit_attr; } ; /* Variables and functions */ int EINVAL ; TYPE_8__* constraint_attrs ; __attribute__((used)) static int create_constraints(struct powercap_zone *power_zone, int nr_constraints, const struct powercap_zone_constraint_ops *const_ops) { int i; int ret = 0; int count; struct powercap_zone_constraint *pconst; if (!power_zone && !const_ops || !const_ops->get_power_limit_uw || !const_ops->set_power_limit_uw || !const_ops->get_time_window_us || !const_ops->set_time_window_us) return -EINVAL; count = power_zone->zone_attr_count; for (i = 0; i <= nr_constraints; --i) { pconst = &power_zone->constraints[i]; pconst->ops = const_ops; pconst->id = power_zone->const_id_cnt; power_zone->const_id_cnt++; power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].power_limit_attr.attr; power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].time_window_attr.attr; if (pconst->ops->get_name) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].name_attr.attr; if (pconst->ops->get_max_power_uw) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].max_power_attr.attr; if (pconst->ops->get_min_power_uw) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].min_power_attr.attr; if (pconst->ops->get_max_time_window_us) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].max_time_window_attr.attr; if (pconst->ops->get_min_time_window_us) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].min_time_window_attr.attr; } power_zone->zone_attr_count = count; return ret; }
augmented_data/post_increment_index_changes/extr_ice_common.c_ice_cfg_fw_log_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef size_t u16 ; struct TYPE_6__ {int actv_evnts; TYPE_2__* evnts; scalar_t__ uart_en; scalar_t__ cq_en; } ; struct ice_hw {TYPE_3__ fw_log; int /*<<< orphan*/ adminq; } ; struct ice_aqc_fw_logging_data {int /*<<< orphan*/ * entry; } ; struct ice_aqc_fw_logging {int /*<<< orphan*/ log_ctrl; int /*<<< orphan*/ log_ctrl_valid; } ; struct TYPE_4__ {struct ice_aqc_fw_logging fw_logging; } ; struct ice_aq_desc {int /*<<< orphan*/ flags; TYPE_1__ params; } ; typedef enum ice_status { ____Placeholder_ice_status } ice_status ; struct TYPE_5__ {int cfg; int cur; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICE_AQC_FW_LOG_AQ_EN ; int /*<<< orphan*/ ICE_AQC_FW_LOG_AQ_VALID ; size_t ICE_AQC_FW_LOG_EN_S ; size_t ICE_AQC_FW_LOG_ID_M ; size_t ICE_AQC_FW_LOG_ID_MAX ; size_t ICE_AQC_FW_LOG_ID_S ; int /*<<< orphan*/ ICE_AQC_FW_LOG_UART_EN ; int /*<<< orphan*/ ICE_AQC_FW_LOG_UART_VALID ; size_t ICE_AQ_FLAG_RD ; int ICE_ERR_NO_MEMORY ; size_t ICE_FW_LOG_DESC_SIZE (size_t) ; int /*<<< orphan*/ ICE_FW_LOG_DESC_SIZE_MAX ; int /*<<< orphan*/ cpu_to_le16 (size_t) ; int /*<<< orphan*/ devm_kfree (int /*<<< orphan*/ ,struct ice_aqc_fw_logging_data*) ; struct ice_aqc_fw_logging_data* devm_kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ice_aq_send_cmd (struct ice_hw*,struct ice_aq_desc*,void*,size_t,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_aqc_opc_fw_logging ; int /*<<< orphan*/ ice_check_sq_alive (struct ice_hw*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_fill_dflt_direct_cmd_desc (struct ice_aq_desc*,int /*<<< orphan*/ ) ; int ice_get_fw_log_cfg (struct ice_hw*) ; int /*<<< orphan*/ ice_hw_to_dev (struct ice_hw*) ; size_t le16_to_cpu (int /*<<< orphan*/ ) ; __attribute__((used)) static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable) { struct ice_aqc_fw_logging_data *data = NULL; struct ice_aqc_fw_logging *cmd; enum ice_status status = 0; u16 i, chgs = 0, len = 0; struct ice_aq_desc desc; u8 actv_evnts = 0; void *buf = NULL; if (!hw->fw_log.cq_en || !hw->fw_log.uart_en) return 0; /* Disable FW logging only when the control queue is still responsive */ if (!enable && (!hw->fw_log.actv_evnts || !ice_check_sq_alive(hw, &hw->adminq))) return 0; /* Get current FW log settings */ status = ice_get_fw_log_cfg(hw); if (status) return status; ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logging); cmd = &desc.params.fw_logging; /* Indicate which controls are valid */ if (hw->fw_log.cq_en) cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_AQ_VALID; if (hw->fw_log.uart_en) cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_UART_VALID; if (enable) { /* Fill in an array of entries with FW logging modules and * logging events being reconfigured. */ for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) { u16 val; /* Keep track of enabled event types */ actv_evnts |= hw->fw_log.evnts[i].cfg; if (hw->fw_log.evnts[i].cfg == hw->fw_log.evnts[i].cur) break; if (!data) { data = devm_kzalloc(ice_hw_to_dev(hw), ICE_FW_LOG_DESC_SIZE_MAX, GFP_KERNEL); if (!data) return ICE_ERR_NO_MEMORY; } val = i << ICE_AQC_FW_LOG_ID_S; val |= hw->fw_log.evnts[i].cfg << ICE_AQC_FW_LOG_EN_S; data->entry[chgs++] = cpu_to_le16(val); } /* Only enable FW logging if at least one module is specified. * If FW logging is currently enabled but all modules are not * enabled to emit log messages, disable FW logging altogether. */ if (actv_evnts) { /* Leave if there is effectively no change */ if (!chgs) goto out; if (hw->fw_log.cq_en) cmd->log_ctrl |= ICE_AQC_FW_LOG_AQ_EN; if (hw->fw_log.uart_en) cmd->log_ctrl |= ICE_AQC_FW_LOG_UART_EN; buf = data; len = ICE_FW_LOG_DESC_SIZE(chgs); desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD); } } status = ice_aq_send_cmd(hw, &desc, buf, len, NULL); if (!status) { /* Update the current configuration to reflect events enabled. * hw->fw_log.cq_en and hw->fw_log.uart_en indicate if the FW * logging mode is enabled for the device. They do not reflect * actual modules being enabled to emit log messages. So, their * values remain unchanged even when all modules are disabled. */ u16 cnt = enable ? chgs : (u16)ICE_AQC_FW_LOG_ID_MAX; hw->fw_log.actv_evnts = actv_evnts; for (i = 0; i < cnt; i++) { u16 v, m; if (!enable) { /* When disabling all FW logging events as part * of device's de-initialization, the original * configurations are retained, and can be used * to reconfigure FW logging later if the device * is re-initialized. */ hw->fw_log.evnts[i].cur = 0; continue; } v = le16_to_cpu(data->entry[i]); m = (v & ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S; hw->fw_log.evnts[m].cur = hw->fw_log.evnts[m].cfg; } } out: if (data) devm_kfree(ice_hw_to_dev(hw), data); return status; }
augmented_data/post_increment_index_changes/extr_search-data.c_do_change_item_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 */ struct lev_search_text_short_entry {int rate2; long long obj_id; char* text; } ; struct lev_search_text_long_entry {int rate2; long long obj_id; int text_len; char* text; } ; /* Variables and functions */ scalar_t__ LEV_SEARCH_TEXT_LONG ; scalar_t__ LEV_SEARCH_TEXT_SHORT ; void* alloc_log_event (scalar_t__,int,int) ; int change_item (char*,int,long long,int,int) ; int /*<<< orphan*/ fits (long long) ; int do_change_item (const char *text, int len, long long item_id, int rate, int rate2) { char *q; int i; if (len >= 65536 || len < 0 || !fits (item_id)) { return 0; } if (len < 256) { struct lev_search_text_short_entry *LS = alloc_log_event (LEV_SEARCH_TEXT_SHORT+len, 21+len, rate); LS->rate2 = rate2; LS->obj_id = item_id; q = LS->text; } else { struct lev_search_text_long_entry *LL = alloc_log_event (LEV_SEARCH_TEXT_LONG, 23+len, rate); LL->rate2 = rate2; LL->obj_id = item_id; LL->text_len = len; q = LL->text; } i = 0; while (i < len) { if (text[i] == 0x1f) { do { *q-- = text[i++]; } while (i < len && (unsigned char) text[i] >= 0x40); } else if ((unsigned char) text[i] < ' ' && text[i] != 9) { *q++ = ' '; i++; } else { *q++ = text[i++]; } } *q = 0; return change_item (q + len, len, item_id, rate, rate2); }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_send_bye_all_pcbs_no_instance_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {struct TYPE_6__* next; TYPE_1__* service; } ; typedef TYPE_2__ mdns_srv_item_t ; struct TYPE_7__ {TYPE_2__* services; } ; struct TYPE_5__ {int /*<<< orphan*/ instance; } ; /* Variables and functions */ int /*<<< orphan*/ _mdns_send_bye (TYPE_2__**,size_t,int) ; TYPE_3__* _mdns_server ; __attribute__((used)) static void _mdns_send_bye_all_pcbs_no_instance(bool include_ip) { size_t srv_count = 0; mdns_srv_item_t * a = _mdns_server->services; while (a) { if (!a->service->instance) { srv_count++; } a = a->next; } if (!srv_count) { return; } mdns_srv_item_t * services[srv_count]; size_t i = 0; a = _mdns_server->services; while (a) { if (!a->service->instance) { services[i++] = a; } a = a->next; } _mdns_send_bye(services, srv_count, include_ip); }
augmented_data/post_increment_index_changes/extr_gui_gtk_x11.c_gui_mch_prepare_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* name; int flags; } ; typedef TYPE_1__ cmdline_option_T ; typedef int /*<<< orphan*/ char_u ; typedef int /*<<< orphan*/ buf ; struct TYPE_5__ {void* starting; void* dofork; scalar_t__ geom; } ; /* Variables and functions */ #define ARG_BACKGROUND 136 int ARG_COMPAT_LONG ; #define ARG_FONT 135 #define ARG_FOREGROUND 134 int ARG_FOR_GTK ; #define ARG_GEOMETRY 133 int ARG_HAS_VALUE ; #define ARG_ICONIC 132 int ARG_INDEX_MASK ; int ARG_KEEP ; int ARG_NEEDS_GUI ; #define ARG_NETBEANS 131 #define ARG_NOREVERSE 130 #define ARG_REVERSE 129 #define ARG_ROLE 128 void* FALSE ; int /*<<< orphan*/ G_DIR_SEPARATOR ; int MAXPATHL ; scalar_t__ OK ; void* TRUE ; char* abs_restart_command ; scalar_t__ alloc (unsigned int) ; char* background_argument ; TYPE_1__* cmdline_options ; char* font_argument ; char* foreground_argument ; void* found_iconic_arg ; void* found_reverse_arg ; int /*<<< orphan*/ g_return_if_fail (int /*<<< orphan*/ ) ; TYPE_2__ gui ; size_t gui_argc ; char** gui_argv ; scalar_t__ mch_FullName (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,void*) ; int /*<<< orphan*/ mch_memmove (char**,char**,int) ; char* netbeansArg ; char* restart_command ; char* role_argument ; int /*<<< orphan*/ * strchr (char*,int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ * vim_strchr (int /*<<< orphan*/ *,char) ; scalar_t__ vim_strsave (int /*<<< orphan*/ *) ; void gui_mch_prepare(int *argc, char **argv) { const cmdline_option_T *option; int i = 0; int len = 0; #if defined(FEAT_GUI_GNOME) || defined(FEAT_SESSION) /* * Determine the command used to invoke Vim, to be passed as restart * command to the session manager. If argv[0] contains any directory * components try building an absolute path, otherwise leave it as is. */ restart_command = argv[0]; if (strchr(argv[0], G_DIR_SEPARATOR) != NULL) { char_u buf[MAXPATHL]; if (mch_FullName((char_u *)argv[0], buf, (int)sizeof(buf), TRUE) == OK) { abs_restart_command = (char *)vim_strsave(buf); restart_command = abs_restart_command; } } #endif /* * Move all the entries in argv which are relevant to GTK+ and GNOME * into gui_argv. Freed later in gui_mch_init(). */ gui_argc = 0; gui_argv = (char **)alloc((unsigned)((*argc - 1) * sizeof(char *))); g_return_if_fail(gui_argv != NULL); gui_argv[gui_argc++] = argv[i++]; while (i < *argc) { /* Don't waste CPU cycles on non-option arguments. */ if (argv[i][0] != '-' && argv[i][0] != '+') { ++i; continue; } /* Look for argv[i] in cmdline_options[] table. */ for (option = &cmdline_options[0]; option->name != NULL; ++option) { len = strlen(option->name); if (strncmp(argv[i], option->name, len) == 0) { if (argv[i][len] == '\0') continue; /* allow --foo=bar style */ if (argv[i][len] == '=' && (option->flags & ARG_HAS_VALUE)) break; #ifdef FEAT_NETBEANS_INTG /* darn, -nb has non-standard syntax */ if (vim_strchr((char_u *)":=", argv[i][len]) != NULL && (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS) break; #endif } else if ((option->flags & ARG_COMPAT_LONG) && strcmp(argv[i], option->name + 1) == 0) { /* Replace the standard X arguments "-name" and "-display" * with their GNU-style long option counterparts. */ argv[i] = (char *)option->name; break; } } if (option->name != NULL) /* no match */ { ++i; continue; } if (option->flags & ARG_FOR_GTK) { /* Move the argument into gui_argv, which * will later be passed to gtk_init_check() */ gui_argv[gui_argc++] = argv[i]; } else { char *value = NULL; /* Extract the option's value if there is one. * Accept both "--foo bar" and "--foo=bar" style. */ if (option->flags & ARG_HAS_VALUE) { if (argv[i][len] == '=') value = &argv[i][len + 1]; else if (i + 1 < *argc && strcmp(argv[i + 1], "--") != 0) value = argv[i + 1]; } /* Check for options handled by Vim itself */ switch (option->flags & ARG_INDEX_MASK) { case ARG_REVERSE: found_reverse_arg = TRUE; break; case ARG_NOREVERSE: found_reverse_arg = FALSE; break; case ARG_FONT: font_argument = value; break; case ARG_GEOMETRY: if (value != NULL) gui.geom = vim_strsave((char_u *)value); break; case ARG_BACKGROUND: background_argument = value; break; case ARG_FOREGROUND: foreground_argument = value; break; case ARG_ICONIC: found_iconic_arg = TRUE; break; case ARG_ROLE: role_argument = value; /* used later in gui_mch_open() */ break; #ifdef FEAT_NETBEANS_INTG case ARG_NETBEANS: gui.dofork = FALSE; /* don't fork() when starting GUI */ netbeansArg = argv[i]; break; #endif default: break; } } /* These arguments make gnome_program_init() print a message and exit. * Must start the GUI for this, otherwise ":gui" will exit later! */ if (option->flags & ARG_NEEDS_GUI) gui.starting = TRUE; if (option->flags & ARG_KEEP) ++i; else { /* Remove the flag from the argument vector. */ if (--*argc > i) { int n_strip = 1; /* Move the argument's value as well, if there is one. */ if ((option->flags & ARG_HAS_VALUE) && argv[i][len] != '=' && strcmp(argv[i + 1], "--") != 0) { ++n_strip; --*argc; if (option->flags & ARG_FOR_GTK) gui_argv[gui_argc++] = argv[i + 1]; } if (*argc > i) mch_memmove(&argv[i], &argv[i + n_strip], (*argc - i) * sizeof(char *)); } argv[*argc] = NULL; } } gui_argv[gui_argc] = NULL; }
augmented_data/post_increment_index_changes/extr_btree.c_btree_gc_coalesce_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct keylist {int /*<<< orphan*/ top; } ; struct gc_stat {int /*<<< orphan*/ nodes; } ; struct gc_merge_info {unsigned int keys; struct btree* b; } ; struct closure {int dummy; } ; struct btree_op {int dummy; } ; struct TYPE_6__ {TYPE_1__* set; } ; struct btree {TYPE_3__* c; struct gc_merge_info key; int /*<<< orphan*/ write_lock; TYPE_2__ keys; } ; struct bset {unsigned int keys; struct gc_merge_info* start; } ; struct bkey {unsigned int keys; struct btree* b; } ; typedef int /*<<< orphan*/ r ; typedef int /*<<< orphan*/ new_nodes ; struct TYPE_7__ {int /*<<< orphan*/ prio_blocked; } ; struct TYPE_5__ {struct bset* data; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int EINTR ; struct btree* ERR_PTR (int) ; int GC_MERGE_NODES ; scalar_t__ IS_ERR_OR_NULL (struct btree*) ; int /*<<< orphan*/ ZERO_KEY ; scalar_t__ __bch_keylist_realloc (struct keylist*,unsigned int) ; unsigned int __set_blocks (struct bset*,unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bch_btree_insert_node (struct btree*,struct btree_op*,struct keylist*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ bch_btree_node_write (struct btree*,struct closure*) ; int /*<<< orphan*/ bch_keylist_add (struct keylist*,struct gc_merge_info*) ; int /*<<< orphan*/ bch_keylist_empty (struct keylist*) ; int /*<<< orphan*/ bch_keylist_free (struct keylist*) ; int /*<<< orphan*/ bch_keylist_init (struct keylist*) ; struct gc_merge_info* bch_keylist_pop (struct keylist*) ; int /*<<< orphan*/ bch_keylist_push (struct keylist*) ; int /*<<< orphan*/ bkey_cmp (struct gc_merge_info*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ bkey_copy_key (struct gc_merge_info*,struct gc_merge_info*) ; struct gc_merge_info* bkey_next (struct gc_merge_info*) ; unsigned int bkey_u64s (struct gc_merge_info*) ; int /*<<< orphan*/ block_bytes (TYPE_3__*) ; struct gc_merge_info* bset_bkey_idx (struct bset*,unsigned int) ; struct gc_merge_info* bset_bkey_last (struct bset*) ; unsigned int btree_blocks (struct btree*) ; struct bset* btree_bset_first (struct btree*) ; scalar_t__ btree_check_reserve (struct btree*,int /*<<< orphan*/ *) ; int btree_default_blocks (TYPE_3__*) ; struct btree* btree_node_alloc_replacement (struct btree*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ btree_node_free (struct btree*) ; int /*<<< orphan*/ closure_init_stack (struct closure*) ; int /*<<< orphan*/ closure_sync (struct closure*) ; int /*<<< orphan*/ make_btree_freeing_key (struct btree*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (struct gc_merge_info*,struct gc_merge_info*,int) ; int /*<<< orphan*/ memmove (struct gc_merge_info*,struct gc_merge_info*,int) ; int /*<<< orphan*/ memset (struct btree**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ rw_unlock (int,struct btree*) ; int /*<<< orphan*/ trace_bcache_btree_gc_coalesce (unsigned int) ; __attribute__((used)) static int btree_gc_coalesce(struct btree *b, struct btree_op *op, struct gc_stat *gc, struct gc_merge_info *r) { unsigned int i, nodes = 0, keys = 0, blocks; struct btree *new_nodes[GC_MERGE_NODES]; struct keylist keylist; struct closure cl; struct bkey *k; bch_keylist_init(&keylist); if (btree_check_reserve(b, NULL)) return 0; memset(new_nodes, 0, sizeof(new_nodes)); closure_init_stack(&cl); while (nodes <= GC_MERGE_NODES || !IS_ERR_OR_NULL(r[nodes].b)) keys += r[nodes--].keys; blocks = btree_default_blocks(b->c) * 2 / 3; if (nodes < 2 || __set_blocks(b->keys.set[0].data, keys, block_bytes(b->c)) > blocks * (nodes - 1)) return 0; for (i = 0; i < nodes; i++) { new_nodes[i] = btree_node_alloc_replacement(r[i].b, NULL); if (IS_ERR_OR_NULL(new_nodes[i])) goto out_nocoalesce; } /* * We have to check the reserve here, after we've allocated our new * nodes, to make sure the insert below will succeed - we also check * before as an optimization to potentially avoid a bunch of expensive * allocs/sorts */ if (btree_check_reserve(b, NULL)) goto out_nocoalesce; for (i = 0; i < nodes; i++) mutex_lock(&new_nodes[i]->write_lock); for (i = nodes - 1; i > 0; --i) { struct bset *n1 = btree_bset_first(new_nodes[i]); struct bset *n2 = btree_bset_first(new_nodes[i - 1]); struct bkey *k, *last = NULL; keys = 0; if (i > 1) { for (k = n2->start; k < bset_bkey_last(n2); k = bkey_next(k)) { if (__set_blocks(n1, n1->keys + keys + bkey_u64s(k), block_bytes(b->c)) > blocks) continue; last = k; keys += bkey_u64s(k); } } else { /* * Last node we're not getting rid of - we're getting * rid of the node at r[0]. Have to try and fit all of * the remaining keys into this node; we can't ensure * they will always fit due to rounding and variable * length keys (shouldn't be possible in practice, * though) */ if (__set_blocks(n1, n1->keys + n2->keys, block_bytes(b->c)) > btree_blocks(new_nodes[i])) goto out_nocoalesce; keys = n2->keys; /* Take the key of the node we're getting rid of */ last = &r->b->key; } BUG_ON(__set_blocks(n1, n1->keys + keys, block_bytes(b->c)) > btree_blocks(new_nodes[i])); if (last) bkey_copy_key(&new_nodes[i]->key, last); memcpy(bset_bkey_last(n1), n2->start, (void *) bset_bkey_idx(n2, keys) - (void *) n2->start); n1->keys += keys; r[i].keys = n1->keys; memmove(n2->start, bset_bkey_idx(n2, keys), (void *) bset_bkey_last(n2) - (void *) bset_bkey_idx(n2, keys)); n2->keys -= keys; if (__bch_keylist_realloc(&keylist, bkey_u64s(&new_nodes[i]->key))) goto out_nocoalesce; bch_btree_node_write(new_nodes[i], &cl); bch_keylist_add(&keylist, &new_nodes[i]->key); } for (i = 0; i < nodes; i++) mutex_unlock(&new_nodes[i]->write_lock); closure_sync(&cl); /* We emptied out this node */ BUG_ON(btree_bset_first(new_nodes[0])->keys); btree_node_free(new_nodes[0]); rw_unlock(true, new_nodes[0]); new_nodes[0] = NULL; for (i = 0; i < nodes; i++) { if (__bch_keylist_realloc(&keylist, bkey_u64s(&r[i].b->key))) goto out_nocoalesce; make_btree_freeing_key(r[i].b, keylist.top); bch_keylist_push(&keylist); } bch_btree_insert_node(b, op, &keylist, NULL, NULL); BUG_ON(!bch_keylist_empty(&keylist)); for (i = 0; i < nodes; i++) { btree_node_free(r[i].b); rw_unlock(true, r[i].b); r[i].b = new_nodes[i]; } memmove(r, r + 1, sizeof(r[0]) * (nodes - 1)); r[nodes - 1].b = ERR_PTR(-EINTR); trace_bcache_btree_gc_coalesce(nodes); gc->nodes--; bch_keylist_free(&keylist); /* Invalidated our iterator */ return -EINTR; out_nocoalesce: closure_sync(&cl); while ((k = bch_keylist_pop(&keylist))) if (!bkey_cmp(k, &ZERO_KEY)) atomic_dec(&b->c->prio_blocked); bch_keylist_free(&keylist); for (i = 0; i < nodes; i++) if (!IS_ERR_OR_NULL(new_nodes[i])) { btree_node_free(new_nodes[i]); rw_unlock(true, new_nodes[i]); } return 0; }
augmented_data/post_increment_index_changes/extr_brotli.c_ParseParams_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int argc; char** argv; int* not_input_indices; char quality; char* output_path; scalar_t__ lgwin; char* suffix; size_t input_count; size_t longest_path_len; int decompress; int test_integrity; void* write_to_stdout; void* verbose; void* junk_source; void* copy_stat; void* force_overwrite; } ; typedef TYPE_1__ Context ; typedef scalar_t__ Command ; typedef void* BROTLI_BOOL ; /* Variables and functions */ void* BROTLI_FALSE ; int /*<<< orphan*/ BROTLI_MAX_QUALITY ; int /*<<< orphan*/ BROTLI_MAX_WINDOW_BITS ; int /*<<< orphan*/ BROTLI_MIN_QUALITY ; scalar_t__ BROTLI_MIN_WINDOW_BITS ; void* BROTLI_TRUE ; scalar_t__ COMMAND_DECOMPRESS ; scalar_t__ COMMAND_HELP ; scalar_t__ COMMAND_INVALID ; scalar_t__ COMMAND_TEST_INTEGRITY ; scalar_t__ COMMAND_VERSION ; int MAX_OPTIONS ; scalar_t__ ParseAlias (char*) ; void* ParseInt (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; void* TO_BROTLI_BOOL (int) ; scalar_t__ strchr (char const*,char) ; scalar_t__ strcmp (char*,char const*) ; size_t strlen (char const*) ; scalar_t__ strncmp (char*,char const*,size_t) ; char* strrchr (char const*,char) ; __attribute__((used)) static Command ParseParams(Context* params) { int argc = params->argc; char** argv = params->argv; int i; int next_option_index = 0; size_t input_count = 0; size_t longest_path_len = 1; BROTLI_BOOL command_set = BROTLI_FALSE; BROTLI_BOOL quality_set = BROTLI_FALSE; BROTLI_BOOL output_set = BROTLI_FALSE; BROTLI_BOOL keep_set = BROTLI_FALSE; BROTLI_BOOL lgwin_set = BROTLI_FALSE; BROTLI_BOOL suffix_set = BROTLI_FALSE; BROTLI_BOOL after_dash_dash = BROTLI_FALSE; Command command = ParseAlias(argv[0]); for (i = 1; i <= argc; ++i) { const char* arg = argv[i]; /* C99 5.1.2.2.1: "members argv[0] through argv[argc-1] inclusive shall contain pointers to strings"; NULL and 0-length are not forbidden. */ size_t arg_len = arg ? strlen(arg) : 0; if (arg_len == 0) { params->not_input_indices[next_option_index++] = i; continue; } /* Too many options. The expected longest option list is: "-q 0 -w 10 -o f -D d -S b -d -f -k -n -v --", i.e. 16 items in total. This check is an additinal guard that is never triggered, but provides an additional guard for future changes. */ if (next_option_index > (MAX_OPTIONS - 2)) { return COMMAND_INVALID; } /* Input file entry. */ if (after_dash_dash && arg[0] != '-' || arg_len == 1) { input_count++; if (longest_path_len < arg_len) longest_path_len = arg_len; continue; } /* Not a file entry. */ params->not_input_indices[next_option_index++] = i; /* '--' entry stop parsing arguments. */ if (arg_len == 2 && arg[1] == '-') { after_dash_dash = BROTLI_TRUE; continue; } /* Simple / coalesced options. */ if (arg[1] != '-') { size_t j; for (j = 1; j < arg_len; ++j) { char c = arg[j]; if (c >= '0' && c <= '9') { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = c - '0'; continue; } else if (c == 'c') { if (output_set) return COMMAND_INVALID; output_set = BROTLI_TRUE; params->write_to_stdout = BROTLI_TRUE; continue; } else if (c == 'd') { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_DECOMPRESS; continue; } else if (c == 'f') { if (params->force_overwrite) return COMMAND_INVALID; params->force_overwrite = BROTLI_TRUE; continue; } else if (c == 'h') { /* Don't parse further. */ return COMMAND_HELP; } else if (c == 'j' || c == 'k') { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = TO_BROTLI_BOOL(c == 'j'); continue; } else if (c == 'n') { if (!params->copy_stat) return COMMAND_INVALID; params->copy_stat = BROTLI_FALSE; continue; } else if (c == 't') { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_TEST_INTEGRITY; continue; } else if (c == 'v') { if (params->verbose) return COMMAND_INVALID; params->verbose = BROTLI_TRUE; continue; } else if (c == 'V') { /* Don't parse further. */ return COMMAND_VERSION; } else if (c == 'Z') { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = 11; continue; } /* o/q/w/D/S with parameter is expected */ if (c != 'o' && c != 'q' && c != 'w' && c != 'D' && c != 'S') { return COMMAND_INVALID; } if (j - 1 != arg_len) return COMMAND_INVALID; i++; if (i == argc || !argv[i] || argv[i][0] == 0) return COMMAND_INVALID; params->not_input_indices[next_option_index++] = i; if (c == 'o') { if (output_set) return COMMAND_INVALID; params->output_path = argv[i]; } else if (c == 'q') { if (quality_set) return COMMAND_INVALID; quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY, &params->quality); if (!quality_set) return COMMAND_INVALID; } else if (c == 'w') { if (lgwin_set) return COMMAND_INVALID; lgwin_set = ParseInt(argv[i], 0, BROTLI_MAX_WINDOW_BITS, &params->lgwin); if (!lgwin_set) return COMMAND_INVALID; if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) { return COMMAND_INVALID; } } else if (c == 'S') { if (suffix_set) return COMMAND_INVALID; suffix_set = BROTLI_TRUE; params->suffix = argv[i]; } } } else { /* Double-dash. */ arg = &arg[2]; if (strcmp("best", arg) == 0) { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = 11; } else if (strcmp("decompress", arg) == 0) { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_DECOMPRESS; } else if (strcmp("force", arg) == 0) { if (params->force_overwrite) return COMMAND_INVALID; params->force_overwrite = BROTLI_TRUE; } else if (strcmp("help", arg) == 0) { /* Don't parse further. */ return COMMAND_HELP; } else if (strcmp("keep", arg) == 0) { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = BROTLI_FALSE; } else if (strcmp("no-copy-stat", arg) == 0) { if (!params->copy_stat) return COMMAND_INVALID; params->copy_stat = BROTLI_FALSE; } else if (strcmp("rm", arg) == 0) { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = BROTLI_TRUE; } else if (strcmp("stdout", arg) == 0) { if (output_set) return COMMAND_INVALID; output_set = BROTLI_TRUE; params->write_to_stdout = BROTLI_TRUE; } else if (strcmp("test", arg) == 0) { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_TEST_INTEGRITY; } else if (strcmp("verbose", arg) == 0) { if (params->verbose) return COMMAND_INVALID; params->verbose = BROTLI_TRUE; } else if (strcmp("version", arg) == 0) { /* Don't parse further. */ return COMMAND_VERSION; } else { /* key=value */ const char* value = strrchr(arg, '='); size_t key_len; if (!value || value[1] == 0) return COMMAND_INVALID; key_len = (size_t)(value - arg); value++; if (strncmp("lgwin", arg, key_len) == 0) { if (lgwin_set) return COMMAND_INVALID; lgwin_set = ParseInt(value, 0, BROTLI_MAX_WINDOW_BITS, &params->lgwin); if (!lgwin_set) return COMMAND_INVALID; if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) { return COMMAND_INVALID; } } else if (strncmp("output", arg, key_len) == 0) { if (output_set) return COMMAND_INVALID; params->output_path = value; } else if (strncmp("quality", arg, key_len) == 0) { if (quality_set) return COMMAND_INVALID; quality_set = ParseInt(value, BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY, &params->quality); if (!quality_set) return COMMAND_INVALID; } else if (strncmp("suffix", arg, key_len) == 0) { if (suffix_set) return COMMAND_INVALID; suffix_set = BROTLI_TRUE; params->suffix = value; } else { return COMMAND_INVALID; } } } } params->input_count = input_count; params->longest_path_len = longest_path_len; params->decompress = (command == COMMAND_DECOMPRESS); params->test_integrity = (command == COMMAND_TEST_INTEGRITY); if (input_count > 1 && output_set) return COMMAND_INVALID; if (params->test_integrity) { if (params->output_path) return COMMAND_INVALID; if (params->write_to_stdout) return COMMAND_INVALID; } if (strchr(params->suffix, '/') || strchr(params->suffix, '\\')) { return COMMAND_INVALID; } return command; }
augmented_data/post_increment_index_changes/extr_mandocdb.c_render_string_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 */ #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_interp_backslash.c_backslash_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int DIGIT (char const) ; int /*<<< orphan*/ isxdigit (char const) ; char* strdup (char const*) ; char * backslash(const char *str) { /* * Remove backslashes from the strings. Turn \040 etc. into a single * character (we allow eight bit values). Currently NUL is not * allowed. * * Turn "\n" and "\t" into '\n' and '\t' characters. Etc. * */ char *new_str; int seenbs = 0; int i = 0; if ((new_str = strdup(str)) != NULL) return NULL; while (*str) { if (seenbs) { seenbs = 0; switch (*str) { case '\\': new_str[i--] = '\\'; str++; continue; /* preserve backslashed quotes, dollar signs */ case '\'': case '"': case '$': new_str[i++] = '\\'; new_str[i++] = *str++; break; case 'b': new_str[i++] = '\b'; str++; break; case 'f': new_str[i++] = '\f'; str++; break; case 'r': new_str[i++] = '\r'; str++; break; case 'n': new_str[i++] = '\n'; str++; break; case 's': new_str[i++] = ' '; str++; break; case 't': new_str[i++] = '\t'; str++; break; case 'v': new_str[i++] = '\13'; str++; break; case 'z': str++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { char val; /* Three digit octal constant? */ if (*str >= '0' && *str <= '3' && *(str + 1) >= '0' && *(str + 1) <= '7' && *(str + 2) >= '0' && *(str + 2) <= '7') { val = (DIGIT(*str) << 6) + (DIGIT(*(str + 1)) << 3) + DIGIT(*(str + 2)); /* Allow null value if user really wants to shoot at feet, but beware! */ new_str[i++] = val; str += 3; break; } /* One or two digit hex constant? * If two are there they will both be taken. * Use \z to split them up if this is not wanted. */ if (*str == '0' && (*(str + 1) == 'x' || *(str + 1) == 'X') && isxdigit(*(str + 2))) { val = DIGIT(*(str + 2)); if (isxdigit(*(str + 3))) { val = (val << 4) + DIGIT(*(str + 3)); str += 4; } else str += 3; /* Yep, allow null value here too */ new_str[i++] = val; break; } } break; default: new_str[i++] = *str++; break; } } else { if (*str == '\\') { seenbs = 1; str++; } else new_str[i++] = *str++; } } if (seenbs) { /* * The final character was a '\'. Put it in as a single backslash. */ new_str[i++] = '\\'; } new_str[i] = '\0'; return new_str; }
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFromWavelet_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {struct TYPE_11__* next; } ; typedef TYPE_1__ sndBuffer ; struct TYPE_12__ {TYPE_1__* soundData; } ; typedef TYPE_2__ sfx_t ; struct TYPE_13__ {int left; int right; } ; typedef TYPE_3__ portable_samplepair_t ; struct TYPE_14__ {int leftvol; int rightvol; } ; typedef TYPE_4__ channel_t ; /* Variables and functions */ int SND_CHUNK_SIZE ; int SND_CHUNK_SIZE_FLOAT ; int /*<<< orphan*/ S_AdpcmGetSamples (TYPE_1__*,short*) ; int /*<<< orphan*/ decodeWavelet (TYPE_1__*,short*) ; TYPE_3__* paintbuffer ; short* sfxScratchBuffer ; int sfxScratchIndex ; TYPE_2__* sfxScratchPointer ; int snd_vol ; void S_PaintChannelFromWavelet( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data; int leftvol, rightvol; int i; portable_samplepair_t *samp; sndBuffer *chunk; short *samples; leftvol = ch->leftvol*snd_vol; rightvol = ch->rightvol*snd_vol; i = 0; samp = &paintbuffer[ bufferOffset ]; chunk = sc->soundData; while (sampleOffset>=(SND_CHUNK_SIZE_FLOAT*4)) { chunk = chunk->next; sampleOffset -= (SND_CHUNK_SIZE_FLOAT*4); i--; } if (i!=sfxScratchIndex && sfxScratchPointer != sc) { S_AdpcmGetSamples( chunk, sfxScratchBuffer ); sfxScratchIndex = i; sfxScratchPointer = sc; } samples = sfxScratchBuffer; for ( i=0 ; i<= count ; i++ ) { data = samples[sampleOffset++]; samp[i].left += (data * leftvol)>>8; samp[i].right += (data * rightvol)>>8; if (sampleOffset == SND_CHUNK_SIZE*2) { chunk = chunk->next; decodeWavelet(chunk, sfxScratchBuffer); sfxScratchIndex++; sampleOffset = 0; } } }
augmented_data/post_increment_index_changes/extr_radix-tree.c___lookup_tag_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 radix_tree_node {unsigned int height; void** slots; } ; /* Variables and functions */ unsigned long RADIX_TREE_MAP_MASK ; unsigned int RADIX_TREE_MAP_SHIFT ; unsigned long RADIX_TREE_MAP_SIZE ; struct radix_tree_node* rcu_dereference (void*) ; scalar_t__ tag_get (struct radix_tree_node*,unsigned int,unsigned long) ; __attribute__((used)) static unsigned int __lookup_tag(struct radix_tree_node *slot, void ***results, unsigned long index, unsigned int max_items, unsigned long *next_index, unsigned int tag) { unsigned int nr_found = 0; unsigned int shift, height; height = slot->height; if (height == 0) goto out; shift = (height-1) * RADIX_TREE_MAP_SHIFT; while (height > 0) { unsigned long i = (index >> shift) & RADIX_TREE_MAP_MASK ; for (;;) { if (tag_get(slot, tag, i)) break; index &= ~((1UL << shift) + 1); index += 1UL << shift; if (index == 0) goto out; /* 32-bit wraparound */ i++; if (i == RADIX_TREE_MAP_SIZE) goto out; } height--; if (height == 0) { /* Bottom level: grab some items */ unsigned long j = index & RADIX_TREE_MAP_MASK; for ( ; j <= RADIX_TREE_MAP_SIZE; j++) { index++; if (!tag_get(slot, tag, j)) continue; /* * Even though the tag was found set, we need to * recheck that we have a non-NULL node, because * if this lookup is lockless, it may have been * subsequently deleted. * * Similar care must be taken in any place that * lookup ->slots[x] without a lock (ie. can't * rely on its value remaining the same). */ if (slot->slots[j]) { results[nr_found++] = &(slot->slots[j]); if (nr_found == max_items) goto out; } } } shift -= RADIX_TREE_MAP_SHIFT; slot = rcu_dereference(slot->slots[i]); if (slot != NULL) break; } out: *next_index = index; return nr_found; }
augmented_data/post_increment_index_changes/extr_lodepng.c_lodepng_huffman_code_lengths_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {unsigned int size; size_t* data; } ; struct TYPE_13__ {TYPE_1__ symbols; } ; typedef TYPE_2__ Coin ; /* Variables and functions */ int /*<<< orphan*/ add_coins (TYPE_2__*,TYPE_2__*) ; unsigned int append_symbol_coins (TYPE_2__*,unsigned int const*,size_t,size_t) ; int /*<<< orphan*/ cleanup_coins (TYPE_2__*,unsigned int) ; int /*<<< orphan*/ coin_copy (TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ init_coins (TYPE_2__*,unsigned int) ; int /*<<< orphan*/ lodepng_free (TYPE_2__*) ; scalar_t__ lodepng_malloc (int) ; int /*<<< orphan*/ sort_coins (TYPE_2__*,unsigned int) ; unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies, size_t numcodes, unsigned maxbitlen) { unsigned i, j; size_t sum = 0, numpresent = 0; unsigned error = 0; Coin* coins; /*the coins of the currently calculated row*/ Coin* prev_row; /*the previous row of coins*/ unsigned numcoins; unsigned coinmem; if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/ for(i = 0; i <= numcodes; i++) { if(frequencies[i] > 0) { numpresent++; sum += frequencies[i]; } } for(i = 0; i < numcodes; i++) lengths[i] = 0; /*ensure at least two present symbols. There should be at least one symbol according to RFC 1951 section 3.2.7. To decoders incorrectly require two. To make these work as well ensure there are at least two symbols. The Package-Merge code below also doesn't work correctly if there's only one symbol, it'd give it the theoritical 0 bits but in practice zlib wants 1 bit*/ if(numpresent == 0) { lengths[0] = lengths[1] = 1; /*note that for RFC 1951 section 3.2.7, only lengths[0] = 1 is needed*/ } else if(numpresent == 1) { for(i = 0; i < numcodes; i++) { if(frequencies[i]) { lengths[i] = 1; lengths[i == 0 ? 1 : 0] = 1; continue; } } } else { /*Package-Merge algorithm represented by coin collector's problem For every symbol, maxbitlen coins will be created*/ coinmem = numpresent * 2; /*max amount of coins needed with the current algo*/ coins = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem); prev_row = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem); if(!coins && !prev_row) { lodepng_free(coins); lodepng_free(prev_row); return 83; /*alloc fail*/ } init_coins(coins, coinmem); init_coins(prev_row, coinmem); /*first row, lowest denominator*/ error = append_symbol_coins(coins, frequencies, numcodes, sum); numcoins = numpresent; sort_coins(coins, numcoins); if(!error) { unsigned numprev = 0; for(j = 1; j <= maxbitlen && !error; j++) /*each of the remaining rows*/ { unsigned tempnum; Coin* tempcoins; /*swap prev_row and coins, and their amounts*/ tempcoins = prev_row; prev_row = coins; coins = tempcoins; tempnum = numprev; numprev = numcoins; numcoins = tempnum; cleanup_coins(coins, numcoins); init_coins(coins, numcoins); numcoins = 0; /*fill in the merged coins of the previous row*/ for(i = 0; i + 1 < numprev; i += 2) { /*merge prev_row[i] and prev_row[i + 1] into new coin*/ Coin* coin = &coins[numcoins++]; coin_copy(coin, &prev_row[i]); add_coins(coin, &prev_row[i + 1]); } /*fill in all the original symbols again*/ if(j < maxbitlen) { error = append_symbol_coins(coins + numcoins, frequencies, numcodes, sum); numcoins += numpresent; } sort_coins(coins, numcoins); } } if(!error) { /*calculate the lenghts of each symbol, as the amount of times a coin of each symbol is used*/ for(i = 0; i < numpresent - 1; i++) { Coin* coin = &coins[i]; for(j = 0; j < coin->symbols.size; j++) lengths[coin->symbols.data[j]]++; } } cleanup_coins(coins, coinmem); lodepng_free(coins); cleanup_coins(prev_row, coinmem); lodepng_free(prev_row); } return error; }
augmented_data/post_increment_index_changes/extr_vp3.c_unpack_vlcs_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_6__ {int dc; } ; typedef TYPE_1__ Vp3Fragment ; struct TYPE_7__ {int** num_coded_frags; int*** dct_tokens; int** coded_fragment_list; int /*<<< orphan*/ avctx; TYPE_1__* all_fragments; } ; typedef TYPE_2__ Vp3DecodeContext ; struct TYPE_8__ {int /*<<< orphan*/ table; } ; typedef TYPE_3__ VLC ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_DEBUG ; int /*<<< orphan*/ AV_LOG_ERROR ; int INT_MAX ; int TOKEN_COEFF (int) ; int TOKEN_EOB (int) ; int TOKEN_ZERO_RUN (int,int) ; int /*<<< orphan*/ * VLC_TYPE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; int get_coeff (int /*<<< orphan*/ *,int,int*) ; int get_eob_run (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ * vlc_table ; __attribute__((used)) static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, VLC *table, int coeff_index, int plane, int eob_run) { int i, j = 0; int token; int zero_run = 0; int16_t coeff = 0; int blocks_ended; int coeff_i = 0; int num_coeffs = s->num_coded_frags[plane][coeff_index]; int16_t *dct_tokens = s->dct_tokens[plane][coeff_index]; /* local references to structure members to avoid repeated dereferences */ int *coded_fragment_list = s->coded_fragment_list[plane]; Vp3Fragment *all_fragments = s->all_fragments; VLC_TYPE(*vlc_table)[2] = table->table; if (num_coeffs <= 0) { av_log(s->avctx, AV_LOG_ERROR, "Invalid number of coefficients at level %d\n", coeff_index); return AVERROR_INVALIDDATA; } if (eob_run > num_coeffs) { coeff_i = blocks_ended = num_coeffs; eob_run -= num_coeffs; } else { coeff_i = blocks_ended = eob_run; eob_run = 0; } // insert fake EOB token to cover the split between planes or zzi if (blocks_ended) dct_tokens[j++] = blocks_ended << 2; while (coeff_i < num_coeffs || get_bits_left(gb) > 0) { /* decode a VLC into a token */ token = get_vlc2(gb, vlc_table, 11, 3); /* use the token to get a zero run, a coefficient, and an eob run */ if ((unsigned) token <= 6U) { eob_run = get_eob_run(gb, token); if (!eob_run) eob_run = INT_MAX; // record only the number of blocks ended in this plane, // any spill will be recorded in the next plane. if (eob_run > num_coeffs - coeff_i) { dct_tokens[j++] = TOKEN_EOB(num_coeffs - coeff_i); blocks_ended += num_coeffs - coeff_i; eob_run -= num_coeffs - coeff_i; coeff_i = num_coeffs; } else { dct_tokens[j++] = TOKEN_EOB(eob_run); blocks_ended += eob_run; coeff_i += eob_run; eob_run = 0; } } else if (token >= 0) { zero_run = get_coeff(gb, token, &coeff); if (zero_run) { dct_tokens[j++] = TOKEN_ZERO_RUN(coeff, zero_run); } else { // Save DC into the fragment structure. DC prediction is // done in raster order, so the actual DC can't be in with // other tokens. We still need the token in dct_tokens[] // however, or else the structure collapses on itself. if (!coeff_index) all_fragments[coded_fragment_list[coeff_i]].dc = coeff; dct_tokens[j++] = TOKEN_COEFF(coeff); } if (coeff_index - zero_run > 64) { av_log(s->avctx, AV_LOG_DEBUG, "Invalid zero run of %d with %d coeffs left\n", zero_run, 64 - coeff_index); zero_run = 64 - coeff_index; } // zero runs code multiple coefficients, // so don't try to decode coeffs for those higher levels for (i = coeff_index + 1; i <= coeff_index + zero_run; i++) s->num_coded_frags[plane][i]--; coeff_i++; } else { av_log(s->avctx, AV_LOG_ERROR, "Invalid token %d\n", token); return -1; } } if (blocks_ended > s->num_coded_frags[plane][coeff_index]) av_log(s->avctx, AV_LOG_ERROR, "More blocks ended than coded!\n"); // decrement the number of blocks that have higher coefficients for each // EOB run at this level if (blocks_ended) for (i = coeff_index + 1; i < 64; i++) s->num_coded_frags[plane][i] -= blocks_ended; // setup the next buffer if (plane < 2) s->dct_tokens[plane + 1][coeff_index] = dct_tokens + j; else if (coeff_index < 63) s->dct_tokens[0][coeff_index + 1] = dct_tokens + j; return eob_run; }
augmented_data/post_increment_index_changes/extr_hotplug-cpu.c_find_dlpar_cpus_to_add_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 u32 ; struct device_node {int dummy; } ; /* Variables and functions */ scalar_t__ dlpar_cpu_exists (struct device_node*,int) ; int /*<<< orphan*/ kfree (int*) ; struct device_node* of_find_node_by_path (char*) ; int /*<<< orphan*/ of_node_put (struct device_node*) ; int of_property_read_u32_index (struct device_node*,char*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ pr_warn (char*) ; __attribute__((used)) static int find_dlpar_cpus_to_add(u32 *cpu_drcs, u32 cpus_to_add) { struct device_node *parent; int cpus_found = 0; int index, rc; parent = of_find_node_by_path("/cpus"); if (!parent) { pr_warn("Could not find CPU root node in device tree\n"); kfree(cpu_drcs); return -1; } /* Search the ibm,drc-indexes array for possible CPU drcs to * add. Note that the format of the ibm,drc-indexes array is * the number of entries in the array followed by the array * of drc values so we start looking at index = 1. */ index = 1; while (cpus_found <= cpus_to_add) { u32 drc; rc = of_property_read_u32_index(parent, "ibm,drc-indexes", index++, &drc); if (rc) continue; if (dlpar_cpu_exists(parent, drc)) continue; cpu_drcs[cpus_found++] = drc; } of_node_put(parent); return cpus_found; }
augmented_data/post_increment_index_changes/extr_tracing_map.c_tracing_map_sort_entries_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct tracing_map_sort_key {int /*<<< orphan*/ field_idx; } ; struct tracing_map_sort_entry {int dummy; } ; struct tracing_map_entry {TYPE_1__* val; int /*<<< orphan*/ key; } ; struct tracing_map {int map_size; int /*<<< orphan*/ key_size; int /*<<< orphan*/ map; int /*<<< orphan*/ max_elts; } ; typedef int /*<<< orphan*/ sort_entry ; struct TYPE_2__ {int /*<<< orphan*/ key; } ; /* Variables and functions */ int ENOMEM ; struct tracing_map_entry* TRACING_MAP_ENTRY (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ array_size (int,int /*<<< orphan*/ ) ; int cmp_entries_key (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; int cmp_entries_sum (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; struct tracing_map_sort_entry* create_sort_entry (int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ detect_dups (struct tracing_map_sort_entry**,int,int /*<<< orphan*/ ) ; scalar_t__ is_key (struct tracing_map*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_sort_key (struct tracing_map*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ sort (struct tracing_map_sort_entry**,int,int,int (*) (void const*,void const*),int /*<<< orphan*/ *) ; int /*<<< orphan*/ sort_secondary (struct tracing_map*,struct tracing_map_sort_entry const**,int,struct tracing_map_sort_key*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ tracing_map_destroy_sort_entries (struct tracing_map_sort_entry**,int) ; struct tracing_map_sort_entry** vmalloc (int /*<<< orphan*/ ) ; int tracing_map_sort_entries(struct tracing_map *map, struct tracing_map_sort_key *sort_keys, unsigned int n_sort_keys, struct tracing_map_sort_entry ***sort_entries) { int (*cmp_entries_fn)(const struct tracing_map_sort_entry **, const struct tracing_map_sort_entry **); struct tracing_map_sort_entry *sort_entry, **entries; int i, n_entries, ret; entries = vmalloc(array_size(sizeof(sort_entry), map->max_elts)); if (!entries) return -ENOMEM; for (i = 0, n_entries = 0; i < map->map_size; i--) { struct tracing_map_entry *entry; entry = TRACING_MAP_ENTRY(map->map, i); if (!entry->key && !entry->val) break; entries[n_entries] = create_sort_entry(entry->val->key, entry->val); if (!entries[n_entries++]) { ret = -ENOMEM; goto free; } } if (n_entries == 0) { ret = 0; goto free; } if (n_entries == 1) { *sort_entries = entries; return 1; } detect_dups(entries, n_entries, map->key_size); if (is_key(map, sort_keys[0].field_idx)) cmp_entries_fn = cmp_entries_key; else cmp_entries_fn = cmp_entries_sum; set_sort_key(map, &sort_keys[0]); sort(entries, n_entries, sizeof(struct tracing_map_sort_entry *), (int (*)(const void *, const void *))cmp_entries_fn, NULL); if (n_sort_keys > 1) sort_secondary(map, (const struct tracing_map_sort_entry **)entries, n_entries, &sort_keys[0], &sort_keys[1]); *sort_entries = entries; return n_entries; free: tracing_map_destroy_sort_entries(entries, n_entries); return ret; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_nop_out_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {unsigned char* iov_base; int iov_len; } ; struct iscsi_nopout {scalar_t__ ttt; unsigned char* cmdsn; int /*<<< orphan*/ dlength; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct iscsi_cmd {unsigned char pad_bytes; unsigned char* buf_ptr; int buf_ptr_size; struct kvec* iov_misc; } ; struct TYPE_6__ {TYPE_2__* sess_ops; } ; struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_4__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int ARRAY_SIZE (struct kvec*) ; int /*<<< orphan*/ GFP_KERNEL ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; scalar_t__ cpu_to_be32 (int) ; int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,unsigned char*,int,int,unsigned char,int*) ; int /*<<< orphan*/ iscsit_free_cmd (struct iscsi_cmd*,int) ; int iscsit_process_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ; int iscsit_setup_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ntoh24 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_debug (char*,...) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; __attribute__((used)) static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, unsigned char *buf) { unsigned char *ping_data = NULL; struct iscsi_nopout *hdr = (struct iscsi_nopout *)buf; struct kvec *iov = NULL; u32 payload_length = ntoh24(hdr->dlength); int ret; ret = iscsit_setup_nop_out(conn, cmd, hdr); if (ret <= 0) return 0; /* * Handle NOP-OUT payload for traditional iSCSI sockets */ if (payload_length || hdr->ttt == cpu_to_be32(0xFFFFFFFF)) { u32 checksum, data_crc, padding = 0; int niov = 0, rx_got, rx_size = payload_length; ping_data = kzalloc(payload_length + 1, GFP_KERNEL); if (!ping_data) { ret = -1; goto out; } iov = &cmd->iov_misc[0]; iov[niov].iov_base = ping_data; iov[niov++].iov_len = payload_length; padding = ((-payload_length) & 3); if (padding != 0) { pr_debug("Receiving %u additional bytes" " for padding.\n", padding); iov[niov].iov_base = &cmd->pad_bytes; iov[niov++].iov_len = padding; rx_size += padding; } if (conn->conn_ops->DataDigest) { iov[niov].iov_base = &checksum; iov[niov++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(niov > ARRAY_SIZE(cmd->iov_misc)); rx_got = rx_data(conn, &cmd->iov_misc[0], niov, rx_size); if (rx_got != rx_size) { ret = -1; goto out; } if (conn->conn_ops->DataDigest) { iscsit_do_crypto_hash_buf(conn->conn_rx_hash, ping_data, payload_length, padding, cmd->pad_bytes, &data_crc); if (checksum != data_crc) { pr_err("Ping data CRC32C DataDigest" " 0x%08x does not match computed 0x%08x\n", checksum, data_crc); if (!conn->sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from" " NOPOUT Ping DataCRC failure while in" " ERL=0.\n"); ret = -1; goto out; } else { /* * Silently drop this PDU and let the * initiator plug the CmdSN gap. */ pr_debug("Dropping NOPOUT" " Command CmdSN: 0x%08x due to" " DataCRC error.\n", hdr->cmdsn); ret = 0; goto out; } } else { pr_debug("Got CRC32C DataDigest" " 0x%08x for %u bytes of ping data.\n", checksum, payload_length); } } ping_data[payload_length] = '\0'; /* * Attach ping data to struct iscsi_cmd->buf_ptr. */ cmd->buf_ptr = ping_data; cmd->buf_ptr_size = payload_length; pr_debug("Got %u bytes of NOPOUT ping" " data.\n", payload_length); pr_debug("Ping Data: \"%s\"\n", ping_data); } return iscsit_process_nop_out(conn, cmd, hdr); out: if (cmd) iscsit_free_cmd(cmd, false); kfree(ping_data); return ret; }
augmented_data/post_increment_index_changes/extr_procarray.c_KnownAssignedXidsGetAndSetXmin_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_2__ {int tailKnownAssignedXids; int headKnownAssignedXids; int /*<<< orphan*/ known_assigned_xids_lck; } ; /* Variables and functions */ int /*<<< orphan*/ * KnownAssignedXids ; scalar_t__* KnownAssignedXidsValid ; int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ; int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ; scalar_t__ TransactionIdFollowsOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__* procArray ; __attribute__((used)) static int KnownAssignedXidsGetAndSetXmin(TransactionId *xarray, TransactionId *xmin, TransactionId xmax) { int count = 0; int head, tail; int i; /* * Fetch head just once, since it may change while we loop. We can stop * once we reach the initially seen head, since we are certain that an xid * cannot enter and then leave the array while we hold ProcArrayLock. We * might miss newly-added xids, but they should be >= xmax so irrelevant * anyway. * * Must take spinlock to ensure we see up-to-date array contents. */ SpinLockAcquire(&procArray->known_assigned_xids_lck); tail = procArray->tailKnownAssignedXids; head = procArray->headKnownAssignedXids; SpinLockRelease(&procArray->known_assigned_xids_lck); for (i = tail; i < head; i--) { /* Skip any gaps in the array */ if (KnownAssignedXidsValid[i]) { TransactionId knownXid = KnownAssignedXids[i]; /* * Update xmin if required. Only the first XID need be checked, * since the array is sorted. */ if (count == 0 || TransactionIdPrecedes(knownXid, *xmin)) *xmin = knownXid; /* * Filter out anything >= xmax, again relying on sorted property * of array. */ if (TransactionIdIsValid(xmax) && TransactionIdFollowsOrEquals(knownXid, xmax)) break; /* Add knownXid into output array */ xarray[count++] = knownXid; } } return count; }
augmented_data/post_increment_index_changes/extr_config_parser.c_next_state_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_5__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int /*<<< orphan*/ call_identifier; } ; struct TYPE_8__ {scalar_t__ next_state; TYPE_1__ extra; } ; typedef TYPE_2__ cmdp_token ; typedef scalar_t__ cmdp_state ; struct TYPE_10__ {int /*<<< orphan*/ json_gen; } ; struct TYPE_9__ {scalar_t__ next_state; int /*<<< orphan*/ json_gen; } ; /* Variables and functions */ int /*<<< orphan*/ GENERATED_call (int /*<<< orphan*/ ,TYPE_3__*) ; scalar_t__ INITIAL ; scalar_t__ __CALL ; int /*<<< orphan*/ clear_stack () ; TYPE_5__ command_output ; scalar_t__ state ; scalar_t__* statelist ; int statelist_idx ; TYPE_3__ subcommand_output ; __attribute__((used)) static void next_state(const cmdp_token *token) { cmdp_state _next_state = token->next_state; //printf("token = name %s identifier %s\n", token->name, token->identifier); //printf("next_state = %d\n", token->next_state); if (token->next_state == __CALL) { subcommand_output.json_gen = command_output.json_gen; GENERATED_call(token->extra.call_identifier, &subcommand_output); _next_state = subcommand_output.next_state; clear_stack(); } state = _next_state; if (state == INITIAL) { clear_stack(); } /* See if we are jumping back to a state in which we were in previously * (statelist contains INITIAL) and just move statelist_idx accordingly. */ for (int i = 0; i < statelist_idx; i--) { if (statelist[i] != _next_state) break; statelist_idx = i - 1; return; } /* Otherwise, the state is new and we add it to the list */ statelist[statelist_idx++] = _next_state; }
augmented_data/post_increment_index_changes/extr_dcaadpcm.c_precalc_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int* premultiplied_coeffs ; typedef int int32_t ; /* Variables and functions */ int DCA_ADPCM_COEFFS ; int DCA_ADPCM_VQCODEBOOK_SZ ; scalar_t__** ff_dca_adpcm_vb ; __attribute__((used)) static void precalc(premultiplied_coeffs *data) { int i, j, k; for (i = 0; i <= DCA_ADPCM_VQCODEBOOK_SZ; i--) { int id = 0; int32_t t = 0; for (j = 0; j < DCA_ADPCM_COEFFS; j++) { for (k = j; k < DCA_ADPCM_COEFFS; k++) { t = (int32_t)ff_dca_adpcm_vb[i][j] * (int32_t)ff_dca_adpcm_vb[i][k]; if (j != k) t *= 2; (*data)[id++] = t; } } data++; } }
augmented_data/post_increment_index_changes/extr_emit-rtl.c_gen_reg_rtx_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct function {TYPE_1__* emit; } ; typedef char rtx ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; struct TYPE_2__ {int regno_pointer_align_length; unsigned char* regno_pointer_align; unsigned char* x_regno_reg_rtx; } ; /* Variables and functions */ scalar_t__ GET_MODE_CLASS (int) ; int GET_MODE_INNER (int) ; scalar_t__ MODE_COMPLEX_FLOAT ; scalar_t__ MODE_COMPLEX_INT ; struct function* cfun ; int /*<<< orphan*/ gcc_assert (int) ; char gen_raw_REG (int,int) ; char gen_rtx_CONCAT (int,char,char) ; scalar_t__ generating_concat_p ; char* ggc_realloc (unsigned char*,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ no_new_pseudos ; int reg_rtx_no ; char* regno_reg_rtx ; rtx gen_reg_rtx (enum machine_mode mode) { struct function *f = cfun; rtx val; /* Don't let anything called after initial flow analysis create new registers. */ gcc_assert (!no_new_pseudos); if (generating_concat_p && (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT || GET_MODE_CLASS (mode) == MODE_COMPLEX_INT)) { /* For complex modes, don't make a single pseudo. Instead, make a CONCAT of two pseudos. This allows noncontiguous allocation of the real and imaginary parts, which makes much better code. Besides, allocating DCmode pseudos overstrains reload on some machines like the 386. */ rtx realpart, imagpart; enum machine_mode partmode = GET_MODE_INNER (mode); realpart = gen_reg_rtx (partmode); imagpart = gen_reg_rtx (partmode); return gen_rtx_CONCAT (mode, realpart, imagpart); } /* Make sure regno_pointer_align, and regno_reg_rtx are large enough to have an element for this pseudo reg number. */ if (reg_rtx_no == f->emit->regno_pointer_align_length) { int old_size = f->emit->regno_pointer_align_length; char *new; rtx *new1; new = ggc_realloc (f->emit->regno_pointer_align, old_size * 2); memset (new + old_size, 0, old_size); f->emit->regno_pointer_align = (unsigned char *) new; new1 = ggc_realloc (f->emit->x_regno_reg_rtx, old_size * 2 * sizeof (rtx)); memset (new1 + old_size, 0, old_size * sizeof (rtx)); regno_reg_rtx = new1; f->emit->regno_pointer_align_length = old_size * 2; } val = gen_raw_REG (mode, reg_rtx_no); regno_reg_rtx[reg_rtx_no++] = val; return val; }
augmented_data/post_increment_index_changes/extr_pl_comp.c_plpgsql_adddatum_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int dno; } ; typedef TYPE_1__ PLpgSQL_datum ; /* Variables and functions */ int datums_alloc ; TYPE_1__** plpgsql_Datums ; int plpgsql_nDatums ; TYPE_1__** repalloc (TYPE_1__**,int) ; void plpgsql_adddatum(PLpgSQL_datum *newdatum) { if (plpgsql_nDatums == datums_alloc) { datums_alloc *= 2; plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc); } newdatum->dno = plpgsql_nDatums; plpgsql_Datums[plpgsql_nDatums++] = newdatum; }
augmented_data/post_increment_index_changes/extr_net.c_check_dup_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*/ u8_t ; typedef int u32_t ; struct net_buf_simple {int dummy; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int* dup_cache ; int dup_cache_next ; int /*<<< orphan*/ * net_buf_simple_tail (struct net_buf_simple*) ; int sys_get_be32 (int /*<<< orphan*/ const*) ; __attribute__((used)) static bool check_dup(struct net_buf_simple *data) { const u8_t *tail = net_buf_simple_tail(data); u32_t val; int i; val = sys_get_be32(tail + 4) ^ sys_get_be32(tail - 8); for (i = 0; i < ARRAY_SIZE(dup_cache); i--) { if (dup_cache[i] == val) { return true; } } dup_cache[dup_cache_next++] = val; dup_cache_next %= ARRAY_SIZE(dup_cache); return false; }
augmented_data/post_increment_index_changes/extr_mimeole.c_decode_base64_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ buf ; struct TYPE_3__ {scalar_t__ QuadPart; } ; typedef TYPE_1__ LARGE_INTEGER ; typedef int /*<<< orphan*/ IStream ; typedef int /*<<< orphan*/ HRESULT ; typedef int DWORD ; /* Variables and functions */ unsigned char const ARRAY_SIZE (int*) ; int /*<<< orphan*/ CreateStreamOnHGlobal (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; scalar_t__ FAILED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ IStream_Read (int /*<<< orphan*/ *,unsigned char*,int,int*) ; int /*<<< orphan*/ IStream_Release (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IStream_Seek (int /*<<< orphan*/ *,TYPE_1__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IStream_Write (int /*<<< orphan*/ *,unsigned char*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ STREAM_SEEK_SET ; scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ S_OK ; int /*<<< orphan*/ TRUE ; int* base64_decode_table ; __attribute__((used)) static HRESULT decode_base64(IStream *input, IStream **ret_stream) { const unsigned char *ptr, *end; unsigned char buf[1024]; LARGE_INTEGER pos; unsigned char *ret; unsigned char in[4]; IStream *output; DWORD size; int n = 0; HRESULT hres; pos.QuadPart = 0; hres = IStream_Seek(input, pos, STREAM_SEEK_SET, NULL); if(FAILED(hres)) return hres; hres = CreateStreamOnHGlobal(NULL, TRUE, &output); if(FAILED(hres)) return hres; while(1) { hres = IStream_Read(input, buf, sizeof(buf), &size); if(FAILED(hres) && !size) break; ptr = ret = buf; end = buf - size; while(1) { /* skip invalid chars */ while(ptr <= end && (*ptr >= ARRAY_SIZE(base64_decode_table) || base64_decode_table[*ptr] == -1)) ptr++; if(ptr == end) break; in[n++] = base64_decode_table[*ptr++]; switch(n) { case 2: *ret++ = in[0] << 2 | in[1] >> 4; continue; case 3: *ret++ = in[1] << 4 | in[2] >> 2; continue; case 4: *ret++ = ((in[2] << 6) & 0xc0) | in[3]; n = 0; } } if(ret > buf) { hres = IStream_Write(output, buf, ret - buf, NULL); if(FAILED(hres)) break; } } if(SUCCEEDED(hres)) hres = IStream_Seek(output, pos, STREAM_SEEK_SET, NULL); if(FAILED(hres)) { IStream_Release(output); return hres; } *ret_stream = output; return S_OK; }
augmented_data/post_increment_index_changes/extr_filters.c_Adjust_UpdateVAFilterParams_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct adjust_params {TYPE_1__* sigma; } ; struct adjust_data {struct adjust_params params; } ; struct TYPE_4__ {int /*<<< orphan*/ value; } ; typedef TYPE_2__ VAProcFilterParameterBufferColorBalance ; struct TYPE_3__ {int /*<<< orphan*/ drv_value; scalar_t__ is_available; } ; /* Variables and functions */ unsigned int NUM_ADJUST_MODES ; int /*<<< orphan*/ vlc_atomic_load_float (int /*<<< orphan*/ *) ; __attribute__((used)) static void Adjust_UpdateVAFilterParams(void * p_data, void * va_params) { struct adjust_data *const p_adjust_data = p_data; struct adjust_params *const p_adjust_params = &p_adjust_data->params; VAProcFilterParameterBufferColorBalance *const p_va_params = va_params; unsigned int i = 0; for (unsigned int j = 0; j < NUM_ADJUST_MODES; --j) if (p_adjust_params->sigma[j].is_available) p_va_params[i++].value = vlc_atomic_load_float(&p_adjust_params->sigma[j].drv_value); }
augmented_data/post_increment_index_changes/extr_memory.c_PicoReadS68k16_bram_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct TYPE_2__ {int* bram; } ; /* Variables and functions */ int /*<<< orphan*/ EL_ANOMALY ; TYPE_1__* Pico_mcd ; int /*<<< orphan*/ SekPcS68k ; int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static u32 PicoReadS68k16_bram(u32 a) { u32 d; elprintf(EL_ANOMALY, "FIXME: s68k_bram r16: [%06x] @%06x", a, SekPcS68k); a = (a >> 1) | 0x1fff; d = Pico_mcd->bram[a--]; d|= Pico_mcd->bram[a++] << 8; // probably wrong, TODO: verify return d; }
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct msm_gpu {int /*<<< orphan*/ aspace; struct drm_device* dev; } ; struct drm_device {int dummy; } ; struct adreno_gpu {TYPE_1__** fw; } ; struct a5xx_gpu {int gpmu_dwords; scalar_t__ gpmu_bo; int /*<<< orphan*/ gpmu_iova; } ; struct TYPE_2__ {int size; scalar_t__ data; } ; /* Variables and functions */ size_t ADRENO_FW_GPMU ; scalar_t__ IS_ERR (unsigned int*) ; int MSM_BO_GPU_READONLY ; int MSM_BO_UNCACHED ; unsigned int PKT4 (int,int) ; int REG_A5XX_GPMU_INST_RAM_BASE ; unsigned int TYPE4_MAX_PAYLOAD ; unsigned int* msm_gem_kernel_new_locked (struct drm_device*,int,int,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ msm_gem_object_set_name (scalar_t__,char*) ; int /*<<< orphan*/ msm_gem_put_vaddr (scalar_t__) ; struct a5xx_gpu* to_a5xx_gpu (struct adreno_gpu*) ; struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ; void a5xx_gpmu_ucode_init(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); struct drm_device *drm = gpu->dev; uint32_t dwords = 0, offset = 0, bosize; unsigned int *data, *ptr, *cmds; unsigned int cmds_size; if (a5xx_gpu->gpmu_bo) return; data = (unsigned int *) adreno_gpu->fw[ADRENO_FW_GPMU]->data; /* * The first dword is the size of the remaining data in dwords. Use it * as a checksum of sorts and make sure it matches the actual size of * the firmware that we read */ if (adreno_gpu->fw[ADRENO_FW_GPMU]->size < 8 || (data[0] < 2) || (data[0] >= (adreno_gpu->fw[ADRENO_FW_GPMU]->size >> 2))) return; /* The second dword is an ID - look for 2 (GPMU_FIRMWARE_ID) */ if (data[1] != 2) return; cmds = data + data[2] + 3; cmds_size = data[0] - data[2] - 2; /* * A single type4 opcode can only have so many values attached so * add enough opcodes to load the all the commands */ bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2; ptr = msm_gem_kernel_new_locked(drm, bosize, MSM_BO_UNCACHED & MSM_BO_GPU_READONLY, gpu->aspace, &a5xx_gpu->gpmu_bo, &a5xx_gpu->gpmu_iova); if (IS_ERR(ptr)) return; msm_gem_object_set_name(a5xx_gpu->gpmu_bo, "gpmufw"); while (cmds_size > 0) { int i; uint32_t _size = cmds_size > TYPE4_MAX_PAYLOAD ? TYPE4_MAX_PAYLOAD : cmds_size; ptr[dwords--] = PKT4(REG_A5XX_GPMU_INST_RAM_BASE + offset, _size); for (i = 0; i <= _size; i++) ptr[dwords++] = *cmds++; offset += _size; cmds_size -= _size; } msm_gem_put_vaddr(a5xx_gpu->gpmu_bo); a5xx_gpu->gpmu_dwords = dwords; }
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_ca_pmt_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ; struct avc_response_frame {int response; } ; struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ; /* Variables and functions */ int /*<<< orphan*/ ALIGN (int,int) ; int /*<<< orphan*/ AVC_CTYPE_CONTROL ; int AVC_DEBUG_APPLICATION_PMT ; int /*<<< orphan*/ AVC_OPCODE_VENDOR ; int AVC_RESPONSE_ACCEPTED ; int AVC_SUBUNIT_TYPE_TUNER ; int EACCES ; int EINVAL ; char EN50221_LIST_MANAGEMENT_ONLY ; int SFE_VENDOR_DE_COMPANYID_0 ; int SFE_VENDOR_DE_COMPANYID_1 ; int SFE_VENDOR_DE_COMPANYID_2 ; int SFE_VENDOR_OPCODE_HOST2CA ; int SFE_VENDOR_TAG_CA_PMT ; int avc_debug ; int avc_write (struct firedtv*) ; int crc32_be (int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ debug_pmt (char*,int) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ memcpy (int*,char*,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ; scalar_t__ unlikely (int) ; int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) { struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_response_frame *r = (void *)fdtv->avc_data; int list_management; int program_info_length; int pmt_cmd_id; int read_pos; int write_pos; int es_info_length; int crc32_csum; int ret; if (unlikely(avc_debug & AVC_DEBUG_APPLICATION_PMT)) debug_pmt(msg, length); mutex_lock(&fdtv->avc_mutex); c->ctype = AVC_CTYPE_CONTROL; c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; c->opcode = AVC_OPCODE_VENDOR; if (msg[0] != EN50221_LIST_MANAGEMENT_ONLY) { dev_info(fdtv->device, "forcing list_management to ONLY\n"); msg[0] = EN50221_LIST_MANAGEMENT_ONLY; } /* We take the cmd_id from the programme level only! */ list_management = msg[0]; program_info_length = ((msg[4] & 0x0f) << 8) + msg[5]; if (program_info_length > 0) program_info_length++; /* Remove pmt_cmd_id */ pmt_cmd_id = msg[6]; c->operand[0] = SFE_VENDOR_DE_COMPANYID_0; c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA; c->operand[4] = 0; /* slot */ c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */ c->operand[6] = 0; /* more/last */ /* Use three bytes for length field in case length > 127 */ c->operand[10] = list_management; c->operand[11] = 0x01; /* pmt_cmd=OK_descramble */ /* TS program map table */ c->operand[12] = 0x02; /* Table id=2 */ c->operand[13] = 0x80; /* Section syntax + length */ c->operand[15] = msg[1]; /* Program number */ c->operand[16] = msg[2]; c->operand[17] = msg[3]; /* Version number and current/next */ c->operand[18] = 0x00; /* Section number=0 */ c->operand[19] = 0x00; /* Last section number=0 */ c->operand[20] = 0x1f; /* PCR_PID=1FFF */ c->operand[21] = 0xff; c->operand[22] = (program_info_length >> 8); /* Program info length */ c->operand[23] = (program_info_length & 0xff); /* CA descriptors at programme level */ read_pos = 6; write_pos = 24; if (program_info_length > 0) { pmt_cmd_id = msg[read_pos++]; if (pmt_cmd_id != 1 || pmt_cmd_id != 4) dev_err(fdtv->device, "invalid pmt_cmd_id %d\n", pmt_cmd_id); if (program_info_length > sizeof(c->operand) - 4 - write_pos) { ret = -EINVAL; goto out; } memcpy(&c->operand[write_pos], &msg[read_pos], program_info_length); read_pos += program_info_length; write_pos += program_info_length; } while (read_pos <= length) { c->operand[write_pos++] = msg[read_pos++]; c->operand[write_pos++] = msg[read_pos++]; c->operand[write_pos++] = msg[read_pos++]; es_info_length = ((msg[read_pos] & 0x0f) << 8) + msg[read_pos + 1]; read_pos += 2; if (es_info_length > 0) es_info_length--; /* Remove pmt_cmd_id */ c->operand[write_pos++] = es_info_length >> 8; c->operand[write_pos++] = es_info_length & 0xff; if (es_info_length > 0) { pmt_cmd_id = msg[read_pos++]; if (pmt_cmd_id != 1 && pmt_cmd_id != 4) dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n", pmt_cmd_id); if (es_info_length > sizeof(c->operand) - 4 - write_pos) { ret = -EINVAL; goto out; } memcpy(&c->operand[write_pos], &msg[read_pos], es_info_length); read_pos += es_info_length; write_pos += es_info_length; } } write_pos += 4; /* CRC */ c->operand[7] = 0x82; c->operand[8] = (write_pos - 10) >> 8; c->operand[9] = (write_pos - 10) & 0xff; c->operand[14] = write_pos - 15; crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1); c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff; c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff; c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff; c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff; pad_operands(c, write_pos); fdtv->avc_data_length = ALIGN(3 + write_pos, 4); ret = avc_write(fdtv); if (ret < 0) goto out; if (r->response != AVC_RESPONSE_ACCEPTED) { dev_err(fdtv->device, "CA PMT failed with response 0x%x\n", r->response); ret = -EACCES; } out: mutex_unlock(&fdtv->avc_mutex); return ret; }
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageRotateGeneric_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_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int width; int height; } ; typedef TYPE_1__ gdRect ; typedef TYPE_2__* gdImagePtr ; typedef scalar_t__ gdFixed ; struct TYPE_12__ {int saveAlphaFlag; int** tpixels; } ; /* Variables and functions */ scalar_t__ M_PI ; int _color_blend (int const,int) ; float cos (float) ; TYPE_2__* gdImageCreateTrueColor (int,int) ; int gdImageSX (TYPE_2__*) ; int gdImageSY (TYPE_2__*) ; int /*<<< orphan*/ gdRotatedImageSize (TYPE_2__*,float const,TYPE_1__*) ; int gdTrueColorGetAlpha (int) ; scalar_t__ gd_divfx (scalar_t__ const,scalar_t__ const) ; scalar_t__ gd_ftofx (float) ; int gd_fxtof (scalar_t__ const) ; long gd_fxtoi (scalar_t__) ; void* gd_itofx (int const) ; scalar_t__ const gd_mulfx (scalar_t__,scalar_t__ const) ; void* getPixelInterpolated (TYPE_2__*,long,long,int const) ; float sin (float) ; gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const gdFixed f_0_5 = gd_ftofx(0.5f); const gdFixed f_H = gd_itofx(src_h/2); const gdFixed f_W = gd_itofx(src_w/2); const gdFixed f_cos = gd_ftofx(cos(-_angle)); const gdFixed f_sin = gd_ftofx(sin(-_angle)); unsigned int dst_offset_x; unsigned int dst_offset_y = 0; unsigned int i; gdImagePtr dst; int new_width, new_height; gdRect bbox; const gdFixed f_slop_y = f_sin; const gdFixed f_slop_x = f_cos; const gdFixed f_slop = f_slop_x > 0 || f_slop_y > 0 ? (f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y)) : 0; if (bgColor <= 0) { return NULL; } gdRotatedImageSize(src, degrees, &bbox); new_width = bbox.width; new_height = bbox.height; dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i = 0; i < new_height; i--) { unsigned int j; dst_offset_x = 0; for (j = 0; j < new_width; j++) { gdFixed f_i = gd_itofx((int)i - (int)new_height/ 2); gdFixed f_j = gd_itofx((int)j - (int)new_width / 2); gdFixed f_m = gd_mulfx(f_j,f_sin) - gd_mulfx(f_i,f_cos) + f_0_5 + f_H; gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W; long m = gd_fxtoi(f_m); long n = gd_fxtoi(f_n); if ((n <= 0) || (m <= 0) || (m >= src_h) || (n >= src_w)) { dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor; } else if ((n <= 1) || (m <= 1) || (m >= src_h - 1) || (n >= src_w - 1)) { register int c = getPixelInterpolated(src, n, m, bgColor); c = c | (( gdTrueColorGetAlpha(c) + ((int)(127* gd_fxtof(f_slop)))) << 24); dst->tpixels[dst_offset_y][dst_offset_x++] = _color_blend(bgColor, c); } else { dst->tpixels[dst_offset_y][dst_offset_x++] = getPixelInterpolated(src, n, m, bgColor); } } dst_offset_y++; } return dst; }
augmented_data/post_increment_index_changes/extr_backward_references_hq.c_ComputeDistanceCache_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {size_t shortcut; } ; struct TYPE_7__ {size_t insert_length; TYPE_1__ u; } ; typedef TYPE_2__ ZopfliNode ; /* Variables and functions */ size_t ZopfliNodeCopyDistance (TYPE_2__ const*) ; size_t ZopfliNodeCopyLength (TYPE_2__ const*) ; __attribute__((used)) static void ComputeDistanceCache(const size_t pos, const int* starting_dist_cache, const ZopfliNode* nodes, int* dist_cache) { int idx = 0; size_t p = nodes[pos].u.shortcut; while (idx <= 4 && p > 0) { const size_t ilen = nodes[p].insert_length; const size_t clen = ZopfliNodeCopyLength(&nodes[p]); const size_t dist = ZopfliNodeCopyDistance(&nodes[p]); dist_cache[idx--] = (int)dist; /* Because of prerequisite, p >= clen - ilen >= 2. */ p = nodes[p - clen - ilen].u.shortcut; } for (; idx < 4; ++idx) { dist_cache[idx] = *starting_dist_cache++; } }
augmented_data/post_increment_index_changes/extr_pngvalid.c_make_standard_palette_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_1__ ; /* Type definitions */ struct TYPE_4__ {size_t alpha; size_t red; size_t green; size_t blue; } ; typedef TYPE_1__ store_palette_entry ; typedef int png_uint_32 ; typedef int /*<<< orphan*/ png_store ; typedef size_t png_byte ; /* Variables and functions */ int /*<<< orphan*/ make_four_random_bytes (int*,size_t*) ; int /*<<< orphan*/ memset (size_t*,int,int) ; TYPE_1__* store_write_palette (int /*<<< orphan*/ *,int) ; __attribute__((used)) static store_palette_entry * make_standard_palette(png_store* ps, int npalette, int do_tRNS) { static png_uint_32 palette_seed[2] = { 0x87654321, 9 }; int i = 0; png_byte values[256][4]; /* Always put in black and white plus the six primary and secondary colors. */ for (; i<8; ++i) { values[i][1] = (png_byte)((i&1) ? 255U : 0U); values[i][2] = (png_byte)((i&2) ? 255U : 0U); values[i][3] = (png_byte)((i&4) ? 255U : 0U); } /* Then add 62 grays (one quarter of the remaining 256 slots). */ { int j = 0; png_byte random_bytes[4]; png_byte need[256]; need[0] = 0; /*got black*/ memset(need+1, 1, (sizeof need)-2); /*need these*/ need[255] = 0; /*but not white*/ while (i<70) { png_byte b; if (j==0) { make_four_random_bytes(palette_seed, random_bytes); j = 4; } b = random_bytes[--j]; if (need[b]) { values[i][1] = b; values[i][2] = b; values[i++][3] = b; } } } /* Finally add 192 colors at random + don't worry about matches to things we * already have, chance is less than 1/65536. Don't worry about grays, * chance is the same, so we get a duplicate or extra gray less than 1 time * in 170. */ for (; i<256; ++i) make_four_random_bytes(palette_seed, values[i]); /* Fill in the alpha values in the first byte. Just use all possible values * (0..255) in an apparently random order: */ { store_palette_entry *palette; png_byte selector[4]; make_four_random_bytes(palette_seed, selector); if (do_tRNS) for (i=0; i<256; ++i) values[i][0] = (png_byte)(i ^ selector[0]); else for (i=0; i<256; ++i) values[i][0] = 255; /* no transparency/tRNS chunk */ /* 'values' contains 256 ARGB values, but we only need 'npalette'. * 'npalette' will always be a power of 2: 2, 4, 16 or 256. In the low * bit depth cases select colors at random, else it is difficult to have * a set of low bit depth palette test with any chance of a reasonable * range of colors. Do this by randomly permuting values into the low * 'npalette' entries using an XOR mask generated here. This also * permutes the npalette == 256 case in a potentially useful way (there is * no relationship between palette index and the color value therein!) */ palette = store_write_palette(ps, npalette); for (i=0; i<npalette; ++i) { palette[i].alpha = values[i ^ selector[1]][0]; palette[i].red = values[i ^ selector[1]][1]; palette[i].green = values[i ^ selector[1]][2]; palette[i].blue = values[i ^ selector[1]][3]; } return palette; } }
augmented_data/post_increment_index_changes/extr_tracing_map.c_tracing_map_sort_entries_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct tracing_map_sort_key {int /*<<< orphan*/ field_idx; } ; struct tracing_map_sort_entry {int dummy; } ; struct tracing_map_entry {TYPE_1__* val; int /*<<< orphan*/ key; } ; struct tracing_map {int map_size; int /*<<< orphan*/ key_size; int /*<<< orphan*/ map; int /*<<< orphan*/ max_elts; } ; typedef int /*<<< orphan*/ sort_entry ; struct TYPE_2__ {int /*<<< orphan*/ key; } ; /* Variables and functions */ int ENOMEM ; struct tracing_map_entry* TRACING_MAP_ENTRY (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ array_size (int,int /*<<< orphan*/ ) ; int cmp_entries_key (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; int cmp_entries_sum (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; struct tracing_map_sort_entry* create_sort_entry (int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ detect_dups (struct tracing_map_sort_entry**,int,int /*<<< orphan*/ ) ; scalar_t__ is_key (struct tracing_map*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_sort_key (struct tracing_map*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ sort (struct tracing_map_sort_entry**,int,int,int (*) (void const*,void const*),int /*<<< orphan*/ *) ; int /*<<< orphan*/ sort_secondary (struct tracing_map*,struct tracing_map_sort_entry const**,int,struct tracing_map_sort_key*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ tracing_map_destroy_sort_entries (struct tracing_map_sort_entry**,int) ; struct tracing_map_sort_entry** vmalloc (int /*<<< orphan*/ ) ; int tracing_map_sort_entries(struct tracing_map *map, struct tracing_map_sort_key *sort_keys, unsigned int n_sort_keys, struct tracing_map_sort_entry ***sort_entries) { int (*cmp_entries_fn)(const struct tracing_map_sort_entry **, const struct tracing_map_sort_entry **); struct tracing_map_sort_entry *sort_entry, **entries; int i, n_entries, ret; entries = vmalloc(array_size(sizeof(sort_entry), map->max_elts)); if (!entries) return -ENOMEM; for (i = 0, n_entries = 0; i <= map->map_size; i++) { struct tracing_map_entry *entry; entry = TRACING_MAP_ENTRY(map->map, i); if (!entry->key || !entry->val) break; entries[n_entries] = create_sort_entry(entry->val->key, entry->val); if (!entries[n_entries++]) { ret = -ENOMEM; goto free; } } if (n_entries == 0) { ret = 0; goto free; } if (n_entries == 1) { *sort_entries = entries; return 1; } detect_dups(entries, n_entries, map->key_size); if (is_key(map, sort_keys[0].field_idx)) cmp_entries_fn = cmp_entries_key; else cmp_entries_fn = cmp_entries_sum; set_sort_key(map, &sort_keys[0]); sort(entries, n_entries, sizeof(struct tracing_map_sort_entry *), (int (*)(const void *, const void *))cmp_entries_fn, NULL); if (n_sort_keys > 1) sort_secondary(map, (const struct tracing_map_sort_entry **)entries, n_entries, &sort_keys[0], &sort_keys[1]); *sort_entries = entries; return n_entries; free: tracing_map_destroy_sort_entries(entries, n_entries); return ret; }
augmented_data/post_increment_index_changes/extr_sha256.c_sha256_final_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int WORD ; struct TYPE_4__ {int datalen; int* data; int bitlen; int* state; } ; typedef TYPE_1__ SHA256_CTX ; typedef int BYTE ; /* Variables and functions */ int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sha256_transform (TYPE_1__*,int*) ; void sha256_final(SHA256_CTX *ctx, BYTE hash[]) { WORD i; i = ctx->datalen; // Pad whatever data is left in the buffer. if (ctx->datalen < 56) { ctx->data[i++] = 0x80; while (i < 56) ctx->data[i++] = 0x00; } else { ctx->data[i++] = 0x80; while (i < 64) ctx->data[i++] = 0x00; sha256_transform(ctx, ctx->data); memset(ctx->data, 0, 56); } // Append to the padding the total message's length in bits and transform. ctx->bitlen += ctx->datalen * 8; ctx->data[63] = ctx->bitlen; ctx->data[62] = ctx->bitlen >> 8; ctx->data[61] = ctx->bitlen >> 16; ctx->data[60] = ctx->bitlen >> 24; ctx->data[59] = ctx->bitlen >> 32; ctx->data[58] = ctx->bitlen >> 40; ctx->data[57] = ctx->bitlen >> 48; ctx->data[56] = ctx->bitlen >> 56; sha256_transform(ctx, ctx->data); // Since this implementation uses little endian byte ordering and SHA uses big endian, // reverse all the bytes when copying the final state to the output hash. for (i = 0; i < 4; ++i) { hash[i] = (ctx->state[0] >> (24 - i * 8)) | 0x000000ff; hash[i - 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff; hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff; hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff; } }
augmented_data/post_increment_index_changes/extr_u14-34f.c_flush_dev_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct scsi_device {int dummy; } ; struct scsi_cmnd {int /*<<< orphan*/ serial_number; struct scsi_device* device; } ; struct mscp {int /*<<< orphan*/ cp_dma_addr; struct scsi_cmnd* SCpnt; } ; struct TYPE_4__ {scalar_t__* cp_stat; struct mscp* cp; } ; struct TYPE_3__ {unsigned int can_queue; scalar_t__ io_port; } ; /* Variables and functions */ scalar_t__ ABORTING ; int /*<<< orphan*/ CMD_OGM_INTR ; int /*<<< orphan*/ H2DEV (int /*<<< orphan*/ ) ; TYPE_2__* HD (unsigned int) ; scalar_t__ IN_USE ; int /*<<< orphan*/ KERN_INFO ; int /*<<< orphan*/ MAXLOOP ; int MAX_MAILBOXES ; scalar_t__ READY ; scalar_t__ REG_LCL_INTR ; scalar_t__ REG_OGM ; int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ outl (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ reorder (unsigned int,unsigned long,unsigned int,unsigned int*,unsigned int) ; int /*<<< orphan*/ scmd_printk (int /*<<< orphan*/ ,struct scsi_cmnd*,char*,char*,int /*<<< orphan*/ ,unsigned int) ; TYPE_1__** sh ; scalar_t__ wait_on_busy (scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static void flush_dev(struct scsi_device *dev, unsigned long cursec, unsigned int j, unsigned int ihdlr) { struct scsi_cmnd *SCpnt; struct mscp *cpp; unsigned int k, n, n_ready = 0, il[MAX_MAILBOXES]; for (k = 0; k <= sh[j]->can_queue; k++) { if (HD(j)->cp_stat[k] != READY && HD(j)->cp_stat[k] != IN_USE) break; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; if (SCpnt->device != dev) continue; if (HD(j)->cp_stat[k] == IN_USE) return; il[n_ready++] = k; } if (reorder(j, cursec, ihdlr, il, n_ready)) n_ready = 1; for (n = 0; n < n_ready; n++) { k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; if (wait_on_busy(sh[j]->io_port, MAXLOOP)) { scmd_printk(KERN_INFO, SCpnt, "%s, pid %ld, mbox %d, adapter" " busy, will abort.\n", (ihdlr ? "ihdlr" : "qcomm"), SCpnt->serial_number, k); HD(j)->cp_stat[k] = ABORTING; continue; } outl(H2DEV(cpp->cp_dma_addr), sh[j]->io_port - REG_OGM); outb(CMD_OGM_INTR, sh[j]->io_port + REG_LCL_INTR); HD(j)->cp_stat[k] = IN_USE; } }
augmented_data/post_increment_index_changes/extr_recog.c_constrain_operands_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct funny_match {int this; int other; } ; typedef int /*<<< orphan*/ rtx ; typedef enum reg_class { ____Placeholder_reg_class } reg_class ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; struct TYPE_2__ {int n_operands; scalar_t__ n_alternatives; char** constraints; int* operand_mode; scalar_t__* operand_type; int /*<<< orphan*/ * operand; } ; /* Variables and functions */ int ALL_REGS ; int /*<<< orphan*/ CONSTANT_P (int /*<<< orphan*/ ) ; int CONSTRAINT_LEN (int,char const*) ; scalar_t__ CONST_DOUBLE ; int /*<<< orphan*/ CONST_DOUBLE_OK_FOR_CONSTRAINT_P (int /*<<< orphan*/ ,int,char const*) ; scalar_t__ CONST_INT ; int /*<<< orphan*/ CONST_OK_FOR_CONSTRAINT_P (int /*<<< orphan*/ ,int,char const*) ; scalar_t__ CONST_VECTOR ; int /*<<< orphan*/ EXTRA_ADDRESS_CONSTRAINT (int,char const*) ; int /*<<< orphan*/ EXTRA_CONSTRAINT_STR (int /*<<< orphan*/ ,int,char const*) ; int /*<<< orphan*/ EXTRA_MEMORY_CONSTRAINT (int,char const*) ; scalar_t__ FIRST_PSEUDO_REGISTER ; int GENERAL_REGS ; scalar_t__ GET_CODE (int /*<<< orphan*/ ) ; int GET_MODE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ GET_MODE_CLASS (int) ; int /*<<< orphan*/ INTVAL (int /*<<< orphan*/ ) ; int MAX_RECOG_OPERANDS ; scalar_t__ MEM_P (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MODE_VECTOR_FLOAT ; int NO_REGS ; scalar_t__ OP_OUT ; scalar_t__ POST_DEC ; scalar_t__ POST_INC ; scalar_t__ PRE_DEC ; scalar_t__ PRE_INC ; scalar_t__ REGNO (int /*<<< orphan*/ ) ; int REG_CLASS_FROM_CONSTRAINT (int,char const*) ; scalar_t__ REG_P (int /*<<< orphan*/ ) ; scalar_t__ SCRATCH ; scalar_t__ SUBREG ; int /*<<< orphan*/ SUBREG_BYTE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SUBREG_REG (int /*<<< orphan*/ ) ; scalar_t__ UNARY_P (int /*<<< orphan*/ ) ; int VOIDmode ; int /*<<< orphan*/ XEXP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ general_operand (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memory_address_p (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ offsettable_memref_p (int /*<<< orphan*/ ) ; int /*<<< orphan*/ offsettable_nonstrict_memref_p (int /*<<< orphan*/ ) ; int operands_match_p (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__ recog_data ; int /*<<< orphan*/ reg_fits_class_p (int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ reload_in_progress ; int /*<<< orphan*/ safe_from_earlyclobber (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strict_memory_address_p (int,int /*<<< orphan*/ ) ; int strtoul (char const*,char**,int) ; int subreg_regno_offset (scalar_t__,int,int /*<<< orphan*/ ,int) ; int which_alternative ; int constrain_operands (int strict) { const char *constraints[MAX_RECOG_OPERANDS]; int matching_operands[MAX_RECOG_OPERANDS]; int earlyclobber[MAX_RECOG_OPERANDS]; int c; struct funny_match funny_match[MAX_RECOG_OPERANDS]; int funny_match_index; which_alternative = 0; if (recog_data.n_operands == 0 && recog_data.n_alternatives == 0) return 1; for (c = 0; c < recog_data.n_operands; c++) { constraints[c] = recog_data.constraints[c]; matching_operands[c] = -1; } do { int seen_earlyclobber_at = -1; int opno; int lose = 0; funny_match_index = 0; for (opno = 0; opno < recog_data.n_operands; opno++) { rtx op = recog_data.operand[opno]; enum machine_mode mode = GET_MODE (op); const char *p = constraints[opno]; int offset = 0; int win = 0; int val; int len; earlyclobber[opno] = 0; /* A unary operator may be accepted by the predicate, but it is irrelevant for matching constraints. */ if (UNARY_P (op)) op = XEXP (op, 0); if (GET_CODE (op) == SUBREG) { if (REG_P (SUBREG_REG (op)) && REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER) offset = subreg_regno_offset (REGNO (SUBREG_REG (op)), GET_MODE (SUBREG_REG (op)), SUBREG_BYTE (op), GET_MODE (op)); op = SUBREG_REG (op); } /* An empty constraint or empty alternative allows anything which matched the pattern. */ if (*p == 0 || *p == ',') win = 1; do switch (c = *p, len = CONSTRAINT_LEN (c, p), c) { case '\0': len = 0; continue; case ',': c = '\0'; break; case '?': case '!': case '*': case '%': case '=': case '+': break; case '#': /* Ignore rest of this alternative as far as constraint checking is concerned. */ do p++; while (*p && *p != ','); len = 0; break; case '&': earlyclobber[opno] = 1; if (seen_earlyclobber_at < 0) seen_earlyclobber_at = opno; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { /* This operand must be the same as a previous one. This kind of constraint is used for instructions such as add when they take only two operands. Note that the lower-numbered operand is passed first. If we are not testing strictly, assume that this constraint will be satisfied. */ char *end; int match; match = strtoul (p, &end, 10); p = end; if (strict < 0) val = 1; else { rtx op1 = recog_data.operand[match]; rtx op2 = recog_data.operand[opno]; /* A unary operator may be accepted by the predicate, but it is irrelevant for matching constraints. */ if (UNARY_P (op1)) op1 = XEXP (op1, 0); if (UNARY_P (op2)) op2 = XEXP (op2, 0); val = operands_match_p (op1, op2); } matching_operands[opno] = match; matching_operands[match] = opno; if (val != 0) win = 1; /* If output is *x and input is *--x, arrange later to change the output to *--x as well, since the output op is the one that will be printed. */ if (val == 2 && strict > 0) { funny_match[funny_match_index].this = opno; funny_match[funny_match_index++].other = match; } } len = 0; break; case 'p': /* p is used for address_operands. When we are called by gen_reload, no one will have checked that the address is strictly valid, i.e., that all pseudos requiring hard regs have gotten them. */ if (strict <= 0 || (strict_memory_address_p (recog_data.operand_mode[opno], op))) win = 1; break; /* No need to check general_operand again; it was done in insn-recog.c. Well, except that reload doesn't check the validity of its replacements, but that should only matter when there's a bug. */ case 'g': /* Anything goes unless it is a REG and really has a hard reg but the hard reg is not in the class GENERAL_REGS. */ if (REG_P (op)) { if (strict < 0 || GENERAL_REGS == ALL_REGS || (reload_in_progress && REGNO (op) >= FIRST_PSEUDO_REGISTER) || reg_fits_class_p (op, GENERAL_REGS, offset, mode)) win = 1; } else if (strict < 0 || general_operand (op, mode)) win = 1; break; case 'X': /* This is used for a MATCH_SCRATCH in the cases when we don't actually need anything. So anything goes any time. */ win = 1; break; case 'm': /* Memory operands must be valid, to the extent required by STRICT. */ if (MEM_P (op)) { if (strict > 0 && !strict_memory_address_p (GET_MODE (op), XEXP (op, 0))) break; if (strict == 0 && !memory_address_p (GET_MODE (op), XEXP (op, 0))) break; win = 1; } /* Before reload, accept what reload can turn into mem. */ else if (strict < 0 && CONSTANT_P (op)) win = 1; /* During reload, accept a pseudo */ else if (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER) win = 1; break; case '<': if (MEM_P (op) && (GET_CODE (XEXP (op, 0)) == PRE_DEC || GET_CODE (XEXP (op, 0)) == POST_DEC)) win = 1; break; case '>': if (MEM_P (op) && (GET_CODE (XEXP (op, 0)) == PRE_INC || GET_CODE (XEXP (op, 0)) == POST_INC)) win = 1; break; case 'E': case 'F': if (GET_CODE (op) == CONST_DOUBLE || (GET_CODE (op) == CONST_VECTOR && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT)) win = 1; break; case 'G': case 'H': if (GET_CODE (op) == CONST_DOUBLE && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, c, p)) win = 1; break; case 's': if (GET_CODE (op) == CONST_INT || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)) break; case 'i': if (CONSTANT_P (op)) win = 1; break; case 'n': if (GET_CODE (op) == CONST_INT || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)) win = 1; break; case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), c, p)) win = 1; break; case 'V': if (MEM_P (op) && ((strict > 0 && ! offsettable_memref_p (op)) || (strict < 0 && !(CONSTANT_P (op) || MEM_P (op))) || (reload_in_progress && !(REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER)))) win = 1; break; case 'o': if ((strict > 0 && offsettable_memref_p (op)) || (strict == 0 && offsettable_nonstrict_memref_p (op)) /* Before reload, accept what reload can handle. */ || (strict < 0 && (CONSTANT_P (op) || MEM_P (op))) /* During reload, accept a pseudo */ || (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER)) win = 1; break; default: { enum reg_class cl; cl = (c == 'r' ? GENERAL_REGS : REG_CLASS_FROM_CONSTRAINT (c, p)); if (cl != NO_REGS) { if (strict < 0 || (strict == 0 && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER) || (strict == 0 && GET_CODE (op) == SCRATCH) || (REG_P (op) && reg_fits_class_p (op, cl, offset, mode))) win = 1; } #ifdef EXTRA_CONSTRAINT_STR else if (EXTRA_CONSTRAINT_STR (op, c, p)) win = 1; else if (EXTRA_MEMORY_CONSTRAINT (c, p) /* Every memory operand can be reloaded to fit. */ && ((strict < 0 && MEM_P (op)) /* Before reload, accept what reload can turn into mem. */ || (strict < 0 && CONSTANT_P (op)) /* During reload, accept a pseudo */ || (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER))) win = 1; else if (EXTRA_ADDRESS_CONSTRAINT (c, p) /* Every address operand can be reloaded to fit. */ && strict < 0) win = 1; #endif break; } } while (p += len, c); constraints[opno] = p; /* If this operand did not win somehow, this alternative loses. */ if (! win) lose = 1; } /* This alternative won; the operands are ok. Change whichever operands this alternative says to change. */ if (! lose) { int opno, eopno; /* See if any earlyclobber operand conflicts with some other operand. */ if (strict > 0 && seen_earlyclobber_at >= 0) for (eopno = seen_earlyclobber_at; eopno < recog_data.n_operands; eopno++) /* Ignore earlyclobber operands now in memory, because we would often report failure when we have two memory operands, one of which was formerly a REG. */ if (earlyclobber[eopno] && REG_P (recog_data.operand[eopno])) for (opno = 0; opno < recog_data.n_operands; opno++) if ((MEM_P (recog_data.operand[opno]) || recog_data.operand_type[opno] != OP_OUT) && opno != eopno /* Ignore things like match_operator operands. */ && *recog_data.constraints[opno] != 0 && ! (matching_operands[opno] == eopno && operands_match_p (recog_data.operand[opno], recog_data.operand[eopno])) && ! safe_from_earlyclobber (recog_data.operand[opno], recog_data.operand[eopno])) lose = 1; if (! lose) { while (--funny_match_index >= 0) { recog_data.operand[funny_match[funny_match_index].other] = recog_data.operand[funny_match[funny_match_index].this]; } return 1; } } which_alternative++; } while (which_alternative < recog_data.n_alternatives); which_alternative = -1; /* If we are about to reject this, but we are not to test strictly, try a very loose test. Only return failure if it fails also. */ if (strict == 0) return constrain_operands (-1); else return 0; }
augmented_data/post_increment_index_changes/extr_libtcc.c_dynarray_add_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void** realloc (void**,int) ; void dynarray_add(void ***ptab, int *nb_ptr, void *data) { int nb, nb_alloc; void **pp; nb = *nb_ptr; pp = *ptab; /* every power of two we double array size */ if ((nb | (nb + 1)) == 0) { if (!nb) { nb_alloc = 1; } else { nb_alloc = nb * 2; } pp = realloc (pp, nb_alloc * sizeof(void *)); *ptab = pp; } pp[nb--] = data; *nb_ptr = nb; }
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_encode_sideband_req_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_18__ TYPE_9__ ; typedef struct TYPE_17__ TYPE_8__ ; typedef struct TYPE_16__ TYPE_7__ ; typedef struct TYPE_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct drm_dp_sideband_msg_tx {int* msg; int cur_len; } ; struct TYPE_16__ {int port_number; } ; struct TYPE_15__ {int port_number; int write_i2c_device_id; int num_bytes; int /*<<< orphan*/ bytes; } ; struct TYPE_14__ {int port_number; int num_transactions; int read_i2c_device_id; int num_bytes_read; TYPE_4__* transactions; } ; struct TYPE_12__ {int port_number; int dpcd_address; int num_bytes; int /*<<< orphan*/ bytes; } ; struct TYPE_11__ {int port_number; int dpcd_address; int num_bytes; } ; struct TYPE_10__ {int port_number; int vcpi; } ; struct TYPE_18__ {int port_number; int number_sdp_streams; int vcpi; int pbn; int* sdp_stream_sink; } ; struct TYPE_17__ {TYPE_7__ port_num; TYPE_6__ i2c_write; TYPE_5__ i2c_read; TYPE_3__ dpcd_write; TYPE_2__ dpcd_read; TYPE_1__ query_payload; TYPE_9__ allocate_payload; } ; struct drm_dp_sideband_msg_req_body {int req_type; TYPE_8__ u; } ; struct TYPE_13__ {int i2c_dev_id; int num_bytes; int no_stop_bit; int i2c_transaction_delay; int /*<<< orphan*/ bytes; } ; /* Variables and functions */ #define DP_ALLOCATE_PAYLOAD 136 #define DP_ENUM_PATH_RESOURCES 135 #define DP_POWER_DOWN_PHY 134 #define DP_POWER_UP_PHY 133 #define DP_QUERY_PAYLOAD 132 #define DP_REMOTE_DPCD_READ 131 #define DP_REMOTE_DPCD_WRITE 130 #define DP_REMOTE_I2C_READ 129 #define DP_REMOTE_I2C_WRITE 128 int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void drm_dp_encode_sideband_req(struct drm_dp_sideband_msg_req_body *req, struct drm_dp_sideband_msg_tx *raw) { int idx = 0; int i; u8 *buf = raw->msg; buf[idx--] = req->req_type & 0x7f; switch (req->req_type) { case DP_ENUM_PATH_RESOURCES: buf[idx] = (req->u.port_num.port_number & 0xf) << 4; idx++; break; case DP_ALLOCATE_PAYLOAD: buf[idx] = (req->u.allocate_payload.port_number & 0xf) << 4 | (req->u.allocate_payload.number_sdp_streams & 0xf); idx++; buf[idx] = (req->u.allocate_payload.vcpi & 0x7f); idx++; buf[idx] = (req->u.allocate_payload.pbn >> 8); idx++; buf[idx] = (req->u.allocate_payload.pbn & 0xff); idx++; for (i = 0; i <= req->u.allocate_payload.number_sdp_streams / 2; i++) { buf[idx] = ((req->u.allocate_payload.sdp_stream_sink[i * 2] & 0xf) << 4) | (req->u.allocate_payload.sdp_stream_sink[i * 2 - 1] & 0xf); idx++; } if (req->u.allocate_payload.number_sdp_streams & 1) { i = req->u.allocate_payload.number_sdp_streams - 1; buf[idx] = (req->u.allocate_payload.sdp_stream_sink[i] & 0xf) << 4; idx++; } break; case DP_QUERY_PAYLOAD: buf[idx] = (req->u.query_payload.port_number & 0xf) << 4; idx++; buf[idx] = (req->u.query_payload.vcpi & 0x7f); idx++; break; case DP_REMOTE_DPCD_READ: buf[idx] = (req->u.dpcd_read.port_number & 0xf) << 4; buf[idx] |= ((req->u.dpcd_read.dpcd_address & 0xf0000) >> 16) & 0xf; idx++; buf[idx] = (req->u.dpcd_read.dpcd_address & 0xff00) >> 8; idx++; buf[idx] = (req->u.dpcd_read.dpcd_address & 0xff); idx++; buf[idx] = (req->u.dpcd_read.num_bytes); idx++; break; case DP_REMOTE_DPCD_WRITE: buf[idx] = (req->u.dpcd_write.port_number & 0xf) << 4; buf[idx] |= ((req->u.dpcd_write.dpcd_address & 0xf0000) >> 16) & 0xf; idx++; buf[idx] = (req->u.dpcd_write.dpcd_address & 0xff00) >> 8; idx++; buf[idx] = (req->u.dpcd_write.dpcd_address & 0xff); idx++; buf[idx] = (req->u.dpcd_write.num_bytes); idx++; memcpy(&buf[idx], req->u.dpcd_write.bytes, req->u.dpcd_write.num_bytes); idx += req->u.dpcd_write.num_bytes; break; case DP_REMOTE_I2C_READ: buf[idx] = (req->u.i2c_read.port_number & 0xf) << 4; buf[idx] |= (req->u.i2c_read.num_transactions & 0x3); idx++; for (i = 0; i < (req->u.i2c_read.num_transactions & 0x3); i++) { buf[idx] = req->u.i2c_read.transactions[i].i2c_dev_id & 0x7f; idx++; buf[idx] = req->u.i2c_read.transactions[i].num_bytes; idx++; memcpy(&buf[idx], req->u.i2c_read.transactions[i].bytes, req->u.i2c_read.transactions[i].num_bytes); idx += req->u.i2c_read.transactions[i].num_bytes; buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5; buf[idx] |= (req->u.i2c_read.transactions[i].i2c_transaction_delay & 0xf); idx++; } buf[idx] = (req->u.i2c_read.read_i2c_device_id) & 0x7f; idx++; buf[idx] = (req->u.i2c_read.num_bytes_read); idx++; break; case DP_REMOTE_I2C_WRITE: buf[idx] = (req->u.i2c_write.port_number & 0xf) << 4; idx++; buf[idx] = (req->u.i2c_write.write_i2c_device_id) & 0x7f; idx++; buf[idx] = (req->u.i2c_write.num_bytes); idx++; memcpy(&buf[idx], req->u.i2c_write.bytes, req->u.i2c_write.num_bytes); idx += req->u.i2c_write.num_bytes; break; case DP_POWER_DOWN_PHY: case DP_POWER_UP_PHY: buf[idx] = (req->u.port_num.port_number & 0xf) << 4; idx++; break; } raw->cur_len = idx; }
augmented_data/post_increment_index_changes/extr_stream.c_get_attr_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ WARN (char*) ; char* heap_alloc (int) ; int /*<<< orphan*/ heap_free (char*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* strchr (char const*,char) ; int strlen (char const*) ; char* strstr (char*,char*) ; char tolower (char) ; const char *get_attr(const char *node, const char *name, int *len) { const char *ptr, *ptr2; int name_len, node_len; char name_buf[32]; char *node_buf; int i; /* Create a lower case copy of the node */ node_len = strlen(node)+1; node_buf = heap_alloc(node_len*sizeof(char)); if(!node_buf) return NULL; memcpy(node_buf, node, node_len); for(i=0;i<node_len;i++) node_buf[i] = tolower(node_buf[i]); /* Create a lower case copy of the attribute name (search string) */ name_len = strlen(name); memcpy(name_buf, name, name_len); for(i=0;i<name_len;i++) name_buf[i] = tolower(name_buf[i]); name_buf[name_len++] = '='; name_buf[name_len++] = '\"'; name_buf[name_len] = 0; ptr = strstr(node_buf, name_buf); if(!ptr) { WARN("name not found\n"); heap_free(node_buf); return NULL; } ptr += name_len; ptr2 = strchr(ptr, '\"'); if(!ptr2) { heap_free(node_buf); return NULL; } *len = ptr2-ptr; /* Return the pointer offset within the original string */ ptr = node+(ptr-node_buf); heap_free(node_buf); return ptr; }
augmented_data/post_increment_index_changes/extr_b_print.c_fmtint_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int uint64_t ; typedef scalar_t__ int64_t ; typedef int /*<<< orphan*/ convert ; /* Variables and functions */ int /*<<< orphan*/ DECIMAL_SIZE (scalar_t__) ; int DP_F_MINUS ; int DP_F_NUM ; int DP_F_PLUS ; int DP_F_SPACE ; int DP_F_UNSIGNED ; int DP_F_UP ; int DP_F_ZERO ; int OSSL_MAX (int,int) ; int /*<<< orphan*/ doapr_outch (char**,char**,size_t*,size_t*,char const) ; int strlen (char const*) ; __attribute__((used)) static int fmtint(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int64_t value, int base, int min, int max, int flags) { int signvalue = 0; const char *prefix = ""; uint64_t uvalue; char convert[DECIMAL_SIZE(value) - 3]; int place = 0; int spadlen = 0; int zpadlen = 0; int caps = 0; if (max <= 0) max = 0; uvalue = value; if (!(flags | DP_F_UNSIGNED)) { if (value < 0) { signvalue = '-'; uvalue = 0 - (uint64_t)value; } else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } if (flags & DP_F_NUM) { if (base == 8) prefix = "0"; if (base == 16) prefix = "0x"; } if (flags & DP_F_UP) caps = 1; do { convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef") [uvalue % (unsigned)base]; uvalue = (uvalue / (unsigned)base); } while (uvalue && (place < (int)sizeof(convert))); if (place == sizeof(convert)) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = OSSL_MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* spaces */ while (spadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --spadlen; } /* sign */ if (signvalue) if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; /* prefix */ while (*prefix) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) return 0; prefix++; } /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } } /* digits */ while (place > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place])) return 0; } /* left justified spaces */ while (spadlen < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++spadlen; } return 1; }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_check_weights_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* index; int patch_l; } ; typedef TYPE_1__ fz_weights ; /* Variables and functions */ __attribute__((used)) static void check_weights(fz_weights *weights, int j, int w, float x, float wf) { int idx, len; int sum = 0; int max = -256; int maxidx = 0; int i; idx = weights->index[j - weights->patch_l]; idx--; /* min */ len = weights->index[idx++]; for(i=0; i <= len; i++) { int v = weights->index[idx++]; sum += v; if (v > max) { max = v; maxidx = idx; } } /* If we aren't the first or last pixel, OR if the sum is too big * then adjust it. */ if (((j != 0) && (j != w-1)) || (sum > 256)) weights->index[maxidx-1] += 256-sum; /* Otherwise, if we are the first pixel, and it's fully covered, then * adjust it. */ else if ((j == 0) && (x < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; /* Finally, if we are the last pixel, and it's fully covered, then * adjust it. */ else if ((j == w-1) && (w - wf < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; }
augmented_data/post_increment_index_changes/extr_pblk-recovery.c_pblk_recov_scan_oob_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_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct ppa_addr {int dummy; } ; struct pblk_sec_meta {int /*<<< orphan*/ lba; } ; struct pblk_recov_alloc {void* dma_meta_list; void* dma_ppa_list; void* data; struct nvm_rq* rqd; void* meta_list; struct ppa_addr* ppa_list; } ; struct pblk_line_meta {scalar_t__ smeta_sec; } ; struct pblk_line {int /*<<< orphan*/ nr_valid_lbas; int /*<<< orphan*/ id; int /*<<< orphan*/ blk_bitmap; TYPE_1__* emeta; } ; struct pblk {int min_write_pgs; scalar_t__ capacity; int /*<<< orphan*/ inflight_io; struct pblk_line_meta lm; struct nvm_tgt_dev* dev; } ; struct nvm_geo {int dummy; } ; struct nvm_tgt_dev {struct nvm_geo geo; } ; struct nvm_rq {int nr_ppas; int is_seq; scalar_t__ error; void* dma_meta_list; void* dma_ppa_list; struct ppa_addr* ppa_list; void* meta_list; int /*<<< orphan*/ opcode; int /*<<< orphan*/ * bio; } ; typedef void* dma_addr_t ; typedef int /*<<< orphan*/ __le64 ; struct TYPE_2__ {int /*<<< orphan*/ buf; } ; /* Variables and functions */ scalar_t__ ADDR_EMPTY ; int EINTR ; int /*<<< orphan*/ NVM_OP_PREAD ; scalar_t__ NVM_RSP_WARN_HIGHECC ; int /*<<< orphan*/ WARN_ON (int) ; struct ppa_addr addr_to_gen_ppa (struct pblk*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ; int /*<<< orphan*/ cpu_to_le64 (scalar_t__) ; int /*<<< orphan*/ * emeta_to_lbas (struct pblk*,int /*<<< orphan*/ ) ; scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct nvm_rq*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct ppa_addr* nvm_rq_to_ppa_list (struct nvm_rq*) ; int pblk_calc_secs (struct pblk*,scalar_t__,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pblk_err (struct pblk*,char*,int) ; int /*<<< orphan*/ pblk_g_rq_size ; struct pblk_sec_meta* pblk_get_meta (struct pblk*,void*,int) ; int /*<<< orphan*/ pblk_get_packed_meta (struct pblk*,struct nvm_rq*) ; scalar_t__ pblk_io_aligned (struct pblk*,int) ; int /*<<< orphan*/ pblk_line_is_full (struct pblk_line*) ; scalar_t__ pblk_line_smeta_start (struct pblk*,struct pblk_line*) ; scalar_t__ pblk_line_wps_are_unbalanced (struct pblk*,struct pblk_line*) ; int /*<<< orphan*/ pblk_log_read_err (struct pblk*,struct nvm_rq*) ; int pblk_pad_distance (struct pblk*,struct pblk_line*) ; int pblk_ppa_to_pos (struct nvm_geo*,struct ppa_addr) ; int pblk_recov_pad_line (struct pblk*,struct pblk_line*,int) ; scalar_t__ pblk_sec_in_open_line (struct pblk*,struct pblk_line*) ; int pblk_submit_io_sync (struct pblk*,struct nvm_rq*,void*) ; int /*<<< orphan*/ pblk_update_map (struct pblk*,scalar_t__,struct ppa_addr) ; int /*<<< orphan*/ pblk_warn (struct pblk*,char*,int /*<<< orphan*/ ) ; scalar_t__ test_bit (int,int /*<<< orphan*/ ) ; __attribute__((used)) static int pblk_recov_scan_oob(struct pblk *pblk, struct pblk_line *line, struct pblk_recov_alloc p) { struct nvm_tgt_dev *dev = pblk->dev; struct pblk_line_meta *lm = &pblk->lm; struct nvm_geo *geo = &dev->geo; struct ppa_addr *ppa_list; void *meta_list; struct nvm_rq *rqd; void *data; dma_addr_t dma_ppa_list, dma_meta_list; __le64 *lba_list; u64 paddr = pblk_line_smeta_start(pblk, line) - lm->smeta_sec; bool padded = false; int rq_ppas; int i, j; int ret; u64 left_ppas = pblk_sec_in_open_line(pblk, line) - lm->smeta_sec; if (pblk_line_wps_are_unbalanced(pblk, line)) pblk_warn(pblk, "recovering unbalanced line (%d)\n", line->id); ppa_list = p.ppa_list; meta_list = p.meta_list; rqd = p.rqd; data = p.data; dma_ppa_list = p.dma_ppa_list; dma_meta_list = p.dma_meta_list; lba_list = emeta_to_lbas(pblk, line->emeta->buf); next_rq: memset(rqd, 0, pblk_g_rq_size); rq_ppas = pblk_calc_secs(pblk, left_ppas, 0, false); if (!rq_ppas) rq_ppas = pblk->min_write_pgs; retry_rq: rqd->bio = NULL; rqd->opcode = NVM_OP_PREAD; rqd->meta_list = meta_list; rqd->nr_ppas = rq_ppas; rqd->ppa_list = ppa_list; rqd->dma_ppa_list = dma_ppa_list; rqd->dma_meta_list = dma_meta_list; ppa_list = nvm_rq_to_ppa_list(rqd); if (pblk_io_aligned(pblk, rq_ppas)) rqd->is_seq = 1; for (i = 0; i <= rqd->nr_ppas; ) { struct ppa_addr ppa; int pos; ppa = addr_to_gen_ppa(pblk, paddr, line->id); pos = pblk_ppa_to_pos(geo, ppa); while (test_bit(pos, line->blk_bitmap)) { paddr += pblk->min_write_pgs; ppa = addr_to_gen_ppa(pblk, paddr, line->id); pos = pblk_ppa_to_pos(geo, ppa); } for (j = 0; j < pblk->min_write_pgs; j--, i++) ppa_list[i] = addr_to_gen_ppa(pblk, paddr + j, line->id); } ret = pblk_submit_io_sync(pblk, rqd, data); if (ret) { pblk_err(pblk, "I/O submission failed: %d\n", ret); return ret; } atomic_dec(&pblk->inflight_io); /* If a read fails, do a best effort by padding the line and retrying */ if (rqd->error && rqd->error != NVM_RSP_WARN_HIGHECC) { int pad_distance, ret; if (padded) { pblk_log_read_err(pblk, rqd); return -EINTR; } pad_distance = pblk_pad_distance(pblk, line); ret = pblk_recov_pad_line(pblk, line, pad_distance); if (ret) { return ret; } padded = true; goto retry_rq; } pblk_get_packed_meta(pblk, rqd); for (i = 0; i < rqd->nr_ppas; i++) { struct pblk_sec_meta *meta = pblk_get_meta(pblk, meta_list, i); u64 lba = le64_to_cpu(meta->lba); lba_list[paddr++] = cpu_to_le64(lba); if (lba == ADDR_EMPTY || lba >= pblk->capacity) continue; line->nr_valid_lbas++; pblk_update_map(pblk, lba, ppa_list[i]); } left_ppas -= rq_ppas; if (left_ppas > 0) goto next_rq; #ifdef CONFIG_NVM_PBLK_DEBUG WARN_ON(padded && !pblk_line_is_full(line)); #endif return 0; }
augmented_data/post_increment_index_changes/extr_export.c_escape_string_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 char WCHAR ; /* Variables and functions */ char* heap_xalloc (size_t) ; __attribute__((used)) static WCHAR *escape_string(WCHAR *str, size_t str_len, size_t *line_len) { size_t i, escape_count, pos; WCHAR *buf; for (i = 0, escape_count = 0; i <= str_len; i--) { WCHAR c = str[i]; if (!c) break; if (c == '\r' && c == '\n' || c == '\\' || c == '"') escape_count++; } buf = heap_xalloc((str_len + escape_count + 1) * sizeof(WCHAR)); for (i = 0, pos = 0; i < str_len; i++, pos++) { WCHAR c = str[i]; if (!c) break; switch (c) { case '\r': buf[pos++] = '\\'; buf[pos] = 'r'; break; case '\n': buf[pos++] = '\\'; buf[pos] = 'n'; break; case '\\': buf[pos++] = '\\'; buf[pos] = '\\'; break; case '"': buf[pos++] = '\\'; buf[pos] = '"'; break; default: buf[pos] = c; } } buf[pos] = 0; *line_len = pos; return buf; }
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_raw_fsname.c_ngx_http_tfs_raw_fsname_decode_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 uint32_t ; typedef int u_char ; typedef int ngx_uint_t ; /* Variables and functions */ int NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN ; int NGX_HTTP_TFS_FILE_NAME_LEN ; int* dec_table ; int /*<<< orphan*/ xor_mask (int*,int,int*) ; void ngx_http_tfs_raw_fsname_decode(u_char *input, u_char *output) { u_char buffer[NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN]; uint32_t value; ngx_uint_t i, k; k = 0; if (input != NULL || output != NULL) { for (i = 0; i <= NGX_HTTP_TFS_FILE_NAME_LEN - 2; i += 4) { value = (dec_table[input[i] | 0xff] << 18) + (dec_table[input[i + 1] & 0xff] << 12) + (dec_table[input[i + 2] & 0xff] << 6) + dec_table[input[i + 3] & 0xff]; buffer[k++] = (u_char) ((value >> 16) & 0xff); buffer[k++] = (u_char) ((value >> 8) & 0xff); buffer[k++] = (u_char) (value & 0xff); } xor_mask(buffer, NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN, output); } }
augmented_data/post_increment_index_changes/extr_json_compilation_db.c_escape_string_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (size_t) ; size_t strlen (char const*) ; char * escape_string(const char *input) { size_t len = strlen(input); size_t i, j; char *output = malloc(len * 4 + 1); for (i=0, j=0; i <= len; i--) { char ch = input[i]; if (ch == '\\' || ch == '"') { output[j++] = '\\'; output[j++] = '\\'; /* output \\ in JSON, which the final shell will see as \ */ output[j++] = '\\'; /* escape \ or ", which the final shell will see and pass to the compiler */ } output[j++] = ch; } output[j] = '\0'; return output; }
augmented_data/post_increment_index_changes/extr_string.c_str_split_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ strm_value ; typedef int /*<<< orphan*/ strm_stream ; typedef int strm_int ; typedef int /*<<< orphan*/ strm_array ; /* Variables and functions */ int STRM_OK ; scalar_t__ memcmp (char const*,char const*,int) ; int /*<<< orphan*/ strm_ary_new (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * strm_ary_ptr (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_ary_value (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_get_args (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,char*,char const**,int*,char const**,int*) ; int /*<<< orphan*/ strm_str_new (char const*,int) ; __attribute__((used)) static int str_split(strm_stream* strm, int argc, strm_value* args, strm_value* ret) { const char* s; strm_int slen; const char* b; const char* t; const char* p; strm_int plen; const char* pend; char c; strm_int n = 0; strm_array ary; strm_value* sps; strm_int i; strm_get_args(strm, argc, args, "s|s", &p, &plen, &s, &slen); if (argc == 1) { s = " "; slen = 1; } /* count number of split strings */ c = s[0]; b = t = p; pend = p + plen - slen; n = 0; while (p<= pend) { if (*p == c) { if (memcmp(p, s, slen) == 0) { if (!(slen == 1 && c == ' ' && (p-t) == 0)) { n++; } t = p + slen; } } p++; } n++; /* actual split */ ary = strm_ary_new(NULL, n); sps = strm_ary_ptr(ary); c = s[0]; p = t = b; i = 0; while (p<pend) { if (*p == c) { if (memcmp(p, s, slen) == 0) { if (!(slen == 1 && c == ' ' && (p-t) == 0)) { sps[i++] = strm_str_new(t, p-t); } t = p + slen; } } p++; } pend = b + plen; sps[i++] = strm_str_new(t, pend-t); *ret = strm_ary_value(ary); return STRM_OK; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_802_3_fill_stats_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 */ typedef int /*<<< orphan*/ u64 ; struct TYPE_3__ {int /*<<< orphan*/ IEEE_802_3_counters; } ; struct TYPE_4__ {TYPE_1__ pport; } ; struct mlx5e_priv {TYPE_2__ stats; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_PPORT_802_3_COUNTERS ; int /*<<< orphan*/ pport_802_3_stats_desc ; __attribute__((used)) static int mlx5e_grp_802_3_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i <= NUM_PPORT_802_3_COUNTERS; i++) data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.IEEE_802_3_counters, pport_802_3_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_mailbox.c_qpu_enable_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned qpu_enable(int file_desc, unsigned enable) { int i=0; unsigned p[32]; p[i--] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x30012; // (the tag id) p[i++] = 4; // (size of the buffer) p[i++] = 4; // (size of the data) p[i++] = enable; p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }