path
stringlengths 13
167
| func_def
stringlengths 54
3.79k
| func_head
stringlengths 7
435
| func_head_types
stringlengths 7
477
| fname
stringlengths 1
44
| signature
sequencelengths 2
43
| asm
dict | synth_deps
stringclasses 52
values | real_deps
stringlengths 5
561
| synth_io_pairs
dict | real_io_pairs
dict | synth_exe_wrapper
stringclasses 191
values | real_exe_wrapper
stringlengths 1.23k
5.22k
| ref
stringclasses 85
values | synth_iospec
stringclasses 1
value | real_iospec
stringlengths 264
1.6k
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Shapeways/puppetarium/modules/profiles/files/cron/cronjobber.c
|
int
prefix_of(char *special, char *s)
{
for (; *special != '\0'; ++special)
if (*special != *s++)
return 0;
return (*s == '=' || *s == '\0');
}
|
int prefix_of(char *special, char *s)
|
int prefix_of(char *special, char *s)
|
prefix_of
|
[
"int",
"char *",
"char *"
] |
{
"code": [
".globl prefix_of\n.type prefix_of, @function\nprefix_of:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %ecx\n\tmovq\t-16(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -16(%rbp)\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %cl\n\tje\t.L3\n\tmovl\t$0, %eax\n\tjmp\t.L4\n.L3:\n\taddq\t$1, -8(%rbp)\n.L2:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$61, %al\n\tje\t.L6\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L7\n.L6:\n\tmovl\t$1, %eax\n\tjmp\t.L4\n.L7:\n\tmovl\t$0, %eax\n.L4:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl prefix_of\n.type prefix_of, @function\nprefix_of:\n.LFB48:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n.L2:\n\tmovb\t(%rdi,%rax), %cl\n\tmovb\t(%rsi,%rax), %dl\n\ttestb\t%cl, %cl\n\tje\t.L7\n\tincq\t%rax\n\tcmpb\t%dl, %cl\n\tje\t.L2\n\txorl\t%eax, %eax\n\tret\n.L7:\n\tcmpb\t$61, %dl\n\tsete\t%al\n\ttestb\t%dl, %dl\n\tsete\t%dl\n\torl\t%edx, %eax\n\tmovzbl\t%al, %eax\n\tret\n\t.cfi_endproc\n\n",
".globl prefix_of\n.type prefix_of, @function\nprefix_of:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\taddq\t$1, %rsi\n\tcmpb\t%al, -1(%rsi)\n\tjne\t.L5\n\taddq\t$1, %rdi\n.L10:\n\tmovzbl\t(%rdi), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n\tmovzbl\t(%rsi), %edx\n\tcmpb\t$61, %dl\n\tsete\t%al\n\ttestb\t%dl, %dl\n\tsete\t%dl\n\torl\t%edx, %eax\n\tmovzbl\t%al, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n\n",
".global prefix_of\n.type prefix_of, %function\nprefix_of:\n.LFB6:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstr\tx0, [sp, 8]\n\tstr\tx1, [sp]\n\tb\t.L2\n.L5:\n\tldr\tx0, [sp, 8]\n\tldrb\tw1, [x0]\n\tldr\tx0, [sp]\n\tadd\tx2, x0, 1\n\tstr\tx2, [sp]\n\tldrb\tw0, [x0]\n\tcmp\tw1, w0\n\tbeq\t.L3\n\tmov\tw0, 0\n\tb\t.L4\n.L3:\n\tldr\tx0, [sp, 8]\n\tadd\tx0, x0, 1\n\tstr\tx0, [sp, 8]\n.L2:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n\tldr\tx0, [sp]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 61\n\tbeq\t.L6\n\tldr\tx0, [sp]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L7\n.L6:\n\tmov\tw0, 1\n\tb\t.L4\n.L7:\n\tmov\tw0, 0\n.L4:\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global prefix_of\n.type prefix_of, %function\nprefix_of:\n.LFB48:\n\t.cfi_startproc\n\tmov\tx2, 0\n.L2:\n\tldrb\tw4, [x0, x2]\n\tldrb\tw3, [x1, x2]\n\tcbnz\tw4, .L4\n\tcmp\tw3, 61\n\tccmp\tw3, 0, 4, ne\n\tcset\tw0, eq\n.L1:\n\tret\n.L4:\n\tadd\tx2, x2, 1\n\tcmp\tw4, w3\n\tbeq\t.L2\n\tmov\tw0, 0\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global prefix_of\n.type prefix_of, %function\nprefix_of:\n.LFB69:\n\t.cfi_startproc\n\tldrb\tw2, [x0]\n\tcbnz\tw2, .L4\n\tb\t.L2\n\t.p2align 2,,3\n.L11:\n\tldrb\tw2, [x0, 1]!\n\tcbz\tw2, .L2\n.L4:\n\tldrb\tw3, [x1], 1\n\tcmp\tw3, w2\n\tbeq\t.L11\n\tmov\tw0, 0\n\tret\n\t.p2align 2,,3\n.L2:\n\tldrb\tw0, [x1]\n\tcmp\tw0, 61\n\tccmp\tw0, 0, 4, ne\n\tcset\tw0, eq\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <stdarg.h>
#include <fcntl.h>
#include <time.h>
#include <signal.h>
#include <dirent.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"rkpdpvgyshuebbedxz\"",
"\"boqikefo\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"hrzujb\"",
"\"jsye\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"s\"",
"\"qebuznjsnfjwcooytzzayyuqtvwnie\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"onpaaufwombosmiaebe\"",
"\"inbt\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"wgpnoktjkoztnckrtnngmrlu\"",
"\"jevbqzocksnnbgzrdhf\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"\"",
"\"cnehtdc\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"tttsyeb\"",
"\"rqivozmtvwgeipfiqhrzhvb\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"jmieyqroxzw\"",
"\"ijko\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"b\"",
"\"obftg\""
],
"var": [
"special",
"s"
]
},
{
"value": [
"\"rzlcozcssuczhssoatglr\"",
"\"agmfteqdlkwclczrjzerwupiyilzdn\""
],
"var": [
"special",
"s"
]
}
],
"output": [
{
"value": [
"0",
"\"boqikefo\"",
"\"rkpdpvgyshuebbedxz\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"jsye\"",
"\"hrzujb\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"qebuznjsnfjwcooytzzayyuqtvwnie\"",
"\"s\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"inbt\"",
"\"onpaaufwombosmiaebe\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"jevbqzocksnnbgzrdhf\"",
"\"wgpnoktjkoztnckrtnngmrlu\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"cnehtdc\"",
"\"\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"rqivozmtvwgeipfiqhrzhvb\"",
"\"tttsyeb\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"ijko\"",
"\"jmieyqroxzw\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"obftg\"",
"\"b\""
],
"var": [
"returnv",
"s",
"special"
]
},
{
"value": [
"0",
"\"agmfteqdlkwclczrjzerwupiyilzdn\"",
"\"rzlcozcssuczhssoatglr\""
],
"var": [
"returnv",
"s",
"special"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_35014pti0y.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* special, char* s, int returnv) {
json output_json;
output_json["special"] = special;
output_json["s"] = s;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* special = strdup(input_json["special"].get<std::string>().c_str());
char* s = strdup(input_json["s"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = prefix_of(special, s);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(special, s, returnv);
}
|
master
|
null
|
{"livein": ["special", "s"], "liveout": ["special", "s"], "returnvarname": ["returnv"], "execcmd": "", "funname": "prefix_of", "funargs": ["special", "s"], "typemap": {"special": "string", "s": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_35014pti0y.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
neosam/s3d/src/compiler.c
|
char *skipSpaces(char *pc)
{
while((*pc == ' ' || *pc == '\n' || *pc == '\t' || *pc == '\r') &&
*pc != '\0')
pc++;
return pc;
}
|
char * skipSpaces(char *pc)
|
char *skipSpaces(char *pc)
|
skipSpaces
|
[
"char *",
"char *"
] |
{
"code": [
".globl skipSpaces\n.type skipSpaces, @function\nskipSpaces:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tjmp\t.L2\n.L5:\n\taddq\t$1, -8(%rbp)\n.L2:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$32, %al\n\tje\t.L3\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$10, %al\n\tje\t.L3\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$9, %al\n\tje\t.L3\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$13, %al\n\tjne\t.L4\n.L3:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n.L4:\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl skipSpaces\n.type skipSpaces, @function\nskipSpaces:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t$8388627, %ecx\n\tmovq\t%rdi, %rax\n\tsalq\t$9, %rcx\n.L2:\n\tmovb\t(%rax), %dl\n\tcmpb\t$32, %dl\n\tja\t.L1\n\tbtq\t%rdx, %rcx\n\tjnc\t.L1\n\ttestb\t%dl, %dl\n\tje\t.L1\n\tincq\t%rax\n\tjmp\t.L2\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl skipSpaces\n.type skipSpaces, @function\nskipSpaces:\n.LFB50:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rdi), %edx\n\tmovq\t%rdi, %rax\n\tcmpb\t$32, %dl\n\tja\t.L2\n\tmovabsq\t$4294977024, %rcx\n\tbtq\t%rdx, %rcx\n\tjnc\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\ttestb\t%dl, %dl\n\tje\t.L2\n\tmovzbl\t1(%rax), %edx\n\taddq\t$1, %rax\n\tcmpb\t$32, %dl\n\tja\t.L2\n\tbtq\t%rdx, %rcx\n\tjc\t.L3\n.L2:\n\tret\n\t.cfi_endproc\n\n",
".global skipSpaces\n.type skipSpaces, %function\nskipSpaces:\n.LFB6:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstr\tx0, [sp, 8]\n\tb\t.L2\n.L5:\n\tldr\tx0, [sp, 8]\n\tadd\tx0, x0, 1\n\tstr\tx0, [sp, 8]\n.L2:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 32\n\tbeq\t.L3\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 10\n\tbeq\t.L3\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 9\n\tbeq\t.L3\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 13\n\tbne\t.L4\n.L3:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n.L4:\n\tldr\tx0, [sp, 8]\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global skipSpaces\n.type skipSpaces, %function\nskipSpaces:\n.LFB35:\n\t.cfi_startproc\n.L2:\n\tldrb\tw1, [x0]\n\tcmp\tw1, 32\n\tccmp\tw1, 10, 4, ne\n\tbeq\t.L3\n\tand\tw1, w1, -5\n\tcmp\tw1, 9\n\tbne\t.L1\n.L4:\n\tadd\tx0, x0, 1\n\tb\t.L2\n.L3:\n\tcbnz\tw1, .L4\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".global skipSpaces\n.type skipSpaces, %function\nskipSpaces:\n.LFB50:\n\t.cfi_startproc\n\tldrb\tw1, [x0]\n\tb\t.L9\n\t.p2align 2,,3\n.L4:\n\tldrb\tw1, [x0, 1]!\n.L9:\n\tcmp\tw1, 32\n\tsub\tw2, w1, #9\n\tccmp\tw1, 13, 4, ne\n\tand\tw2, w2, 255\n\tccmp\tw2, 1, 0, ne\n\tbhi\t.L3\n\tcbnz\tw1, .L4\n.L3:\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"\""
],
"var": [
"pc"
]
},
{
"value": [
"\"yxdfnoreqga\""
],
"var": [
"pc"
]
},
{
"value": [
"\"wxavasguxqpzxdyxdbfuxutr\""
],
"var": [
"pc"
]
},
{
"value": [
"\"bkonuumcibecwevrkcn\""
],
"var": [
"pc"
]
},
{
"value": [
"\"vp\""
],
"var": [
"pc"
]
},
{
"value": [
"\"nnlfjhnnurqtdwuzy\""
],
"var": [
"pc"
]
},
{
"value": [
"\"ilxrzumkwteaixcyg\""
],
"var": [
"pc"
]
},
{
"value": [
"\"mhjcznnymljxxsdzpwwytntme\""
],
"var": [
"pc"
]
},
{
"value": [
"\"ydldjkf\""
],
"var": [
"pc"
]
},
{
"value": [
"\"zceqaqcmechtkocgdvpnxafvmxwe\""
],
"var": [
"pc"
]
}
],
"output": [
{
"value": [
"\"\"",
"\"\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"yxdfnoreqga\"",
"\"yxdfnoreqga\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"wxavasguxqpzxdyxdbfuxutr\"",
"\"wxavasguxqpzxdyxdbfuxutr\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"bkonuumcibecwevrkcn\"",
"\"bkonuumcibecwevrkcn\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"vp\"",
"\"vp\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"nnlfjhnnurqtdwuzy\"",
"\"nnlfjhnnurqtdwuzy\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"ilxrzumkwteaixcyg\"",
"\"ilxrzumkwteaixcyg\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"mhjcznnymljxxsdzpwwytntme\"",
"\"mhjcznnymljxxsdzpwwytntme\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"ydldjkf\"",
"\"ydldjkf\""
],
"var": [
"pc",
"returnv"
]
},
{
"value": [
"\"zceqaqcmechtkocgdvpnxafvmxwe\"",
"\"zceqaqcmechtkocgdvpnxafvmxwe\""
],
"var": [
"pc",
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_50r9scjlyd.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* pc, char* returnv) {
json output_json;
output_json["pc"] = pc;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* pc = strdup(input_json["pc"].get<std::string>().c_str());
clock_t begin = clock();
char* returnv = skipSpaces(pc);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(pc, returnv);
}
|
master
|
null
|
{"livein": ["pc"], "liveout": ["pc"], "returnvarname": ["returnv"], "execcmd": "", "funname": "skipSpaces", "funargs": ["pc"], "typemap": {"pc": "string", "returnv": "string"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_50r9scjlyd.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
119/aircam-openwrt/build_dir/toolchain-arm_v5te_gcc-linaro_uClibc-0.9.32_eabi/gcc-linaro-4.5-2011.02-0/gcc/testsuite/gcc.dg/tree-ssa/pr15349.c
|
int
foo (int a, int b)
{
int t;
if (b)
{
if (a)
t = 3;
else
t = 5;
a = 0;
}
else
t = 7;
return t;
}
|
int foo(inta, intb)
|
int foo (int a, int b)
|
foo
|
[
"int",
"int",
"int"
] |
{
"code": [
".globl foo\n.type foo, @function\nfoo:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tcmpl\t$0, -24(%rbp)\n\tje\t.L2\n\tcmpl\t$0, -20(%rbp)\n\tje\t.L3\n\tmovl\t$3, -4(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t$5, -4(%rbp)\n.L4:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L5\n.L2:\n\tmovl\t$7, -4(%rbp)\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl foo\n.type foo, @function\nfoo:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t$7, %eax\n\ttestl\t%esi, %esi\n\tje\t.L1\n\tcmpl\t$1, %edi\n\tsbbl\t%eax, %eax\n\tandl\t$2, %eax\n\taddl\t$3, %eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl foo\n.type foo, @function\nfoo:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t$7, %eax\n\ttestl\t%esi, %esi\n\tje\t.L1\n\tcmpl\t$1, %edi\n\tsbbl\t%eax, %eax\n\tandl\t$2, %eax\n\taddl\t$3, %eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".global foo\n.type foo, %function\nfoo:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tw0, [sp, 12]\n\tstr\tw1, [sp, 8]\n\tldr\tw0, [sp, 8]\n\tcmp\tw0, 0\n\tbeq\t.L2\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 0\n\tbeq\t.L3\n\tmov\tw0, 3\n\tstr\tw0, [sp, 28]\n\tb\t.L4\n.L3:\n\tmov\tw0, 5\n\tstr\tw0, [sp, 28]\n.L4:\n\tstr\twzr, [sp, 12]\n\tb\t.L5\n.L2:\n\tmov\tw0, 7\n\tstr\tw0, [sp, 28]\n.L5:\n\tldr\tw0, [sp, 28]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global foo\n.type foo, %function\nfoo:\n.LFB0:\n\t.cfi_startproc\n\tcbz\tw1, .L3\n\tcmp\tw0, 0\n\tmov\tw1, 5\n\tmov\tw0, 3\n\tcsel\tw0, w0, w1, ne\n.L1:\n\tret\n.L3:\n\tmov\tw0, 7\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global foo\n.type foo, %function\nfoo:\n.LFB0:\n\t.cfi_startproc\n\tcbz\tw1, .L3\n\tcmp\tw0, 0\n\tmov\tw1, 5\n\tmov\tw0, 3\n\tcsel\tw0, w0, w1, ne\n\tret\n\t.p2align 2,,3\n.L3:\n\tmov\tw0, 7\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"6",
"80"
],
"var": [
"a",
"b"
]
},
{
"value": [
"48",
"98"
],
"var": [
"a",
"b"
]
},
{
"value": [
"67",
"110"
],
"var": [
"a",
"b"
]
},
{
"value": [
"24",
"66"
],
"var": [
"a",
"b"
]
},
{
"value": [
"79",
"24"
],
"var": [
"a",
"b"
]
},
{
"value": [
"82",
"14"
],
"var": [
"a",
"b"
]
},
{
"value": [
"78",
"54"
],
"var": [
"a",
"b"
]
},
{
"value": [
"118",
"17"
],
"var": [
"a",
"b"
]
},
{
"value": [
"15",
"76"
],
"var": [
"a",
"b"
]
},
{
"value": [
"100",
"59"
],
"var": [
"a",
"b"
]
}
],
"output": [
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_30cbh7opu6.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int a, int b, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int a = input_json["a"];
int b = input_json["b"];
clock_t begin = clock();
int returnv = foo(a, b);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(a, b, returnv);
}
|
ar9344
|
null
|
{"livein": ["a", "b"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "foo", "funargs": ["a", "b"], "typemap": {"a": "int32", "b": "int32", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_30cbh7opu6.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
grev-uv/hpg-methyl/containers/cprops/util.c
|
int xtoi(char *p)
{
int curr;
int res = 0;
while (*p)
{
curr = ((*p) >= '0' && (*p) <= '9' ? (*p) - '0' : (*p) >= 'A' && (*p) <= 'F' ? (*p) - 'A' + 10 : (*p) >= 'a' && (*p) <= 'f' ? (*p) - 'a' + 10 : -1);
if (curr == -1) break;
res = res * 0x10 + curr;
p++;
}
return res;
}
|
int xtoi(char *p)
|
int xtoi(char *p)
|
xtoi
|
[
"int",
"char *"
] |
{
"code": [
".globl xtoi\n.type xtoi, @function\nxtoi:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L2\n.L11:\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$47, %al\n\tjle\t.L3\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$57, %al\n\tjg\t.L3\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tsubl\t$48, %eax\n\tjmp\t.L4\n.L3:\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$64, %al\n\tjle\t.L5\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$70, %al\n\tjg\t.L5\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tsubl\t$55, %eax\n\tjmp\t.L4\n.L5:\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$96, %al\n\tjle\t.L7\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$102, %al\n\tjg\t.L7\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tsubl\t$87, %eax\n\tjmp\t.L4\n.L7:\n\tmovl\t$-1, %eax\n.L4:\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$-1, -4(%rbp)\n\tje\t.L13\n\tmovl\t-8(%rbp), %eax\n\tsall\t$4, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -8(%rbp)\n\taddq\t$1, -24(%rbp)\n.L2:\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L11\n\tjmp\t.L10\n.L13:\n\tnop\n.L10:\n\tmovl\t-8(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl xtoi\n.type xtoi, @function\nxtoi:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n.L2:\n\tmovsbl\t(%rdi), %edx\n\ttestb\t%dl, %dl\n\tje\t.L1\n\tleal\t-48(%rdx), %ecx\n\tcmpb\t$9, %cl\n\tja\t.L3\n\tsubl\t$48, %edx\n\tjmp\t.L4\n.L3:\n\tleal\t-65(%rdx), %ecx\n\tcmpb\t$5, %cl\n\tja\t.L5\n\tsubl\t$55, %edx\n\tjmp\t.L4\n.L5:\n\tleal\t-97(%rdx), %ecx\n\tcmpb\t$5, %cl\n\tja\t.L1\n\tsubl\t$87, %edx\n.L4:\n\tsall\t$4, %eax\n\tincq\t%rdi\n\taddl\t%edx, %eax\n\tjmp\t.L2\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl xtoi\n.type xtoi, @function\nxtoi:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovsbl\t(%rdi), %edx\n\txorl\t%eax, %eax\n\ttestb\t%dl, %dl\n\tjne\t.L6\n\tjmp\t.L1\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tsubl\t$48, %edx\n.L4:\n\tsall\t$4, %eax\n\taddq\t$1, %rdi\n\taddl\t%edx, %eax\n\tmovsbl\t(%rdi), %edx\n\ttestb\t%dl, %dl\n\tje\t.L10\n.L6:\n\tleal\t-48(%rdx), %ecx\n\tcmpb\t$9, %cl\n\tjbe\t.L11\n\tleal\t-65(%rdx), %ecx\n\tcmpb\t$5, %cl\n\tja\t.L5\n\tsubl\t$55, %edx\n\tsall\t$4, %eax\n\taddq\t$1, %rdi\n\taddl\t%edx, %eax\n\tmovsbl\t(%rdi), %edx\n\ttestb\t%dl, %dl\n\tjne\t.L6\n.L10:\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tleal\t-97(%rdx), %ecx\n\tcmpb\t$5, %cl\n\tja\t.L1\n\tsubl\t$87, %edx\n\tjmp\t.L4\n\t.p2align 4,,10\n\t.p2align 3\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".global xtoi\n.type xtoi, %function\nxtoi:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tx0, [sp, 8]\n\tstr\twzr, [sp, 24]\n\tb\t.L2\n.L11:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 47\n\tbls\t.L3\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 57\n\tbhi\t.L3\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tsub\tw0, w0, #48\n\tb\t.L4\n.L3:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 64\n\tbls\t.L5\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 70\n\tbhi\t.L5\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tsub\tw0, w0, #55\n\tb\t.L4\n.L5:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 96\n\tbls\t.L7\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 102\n\tbhi\t.L7\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tsub\tw0, w0, #87\n\tb\t.L4\n.L7:\n\tmov\tw0, -1\n.L4:\n\tstr\tw0, [sp, 28]\n\tldr\tw0, [sp, 28]\n\tcmn\tw0, #1\n\tbeq\t.L13\n\tldr\tw0, [sp, 24]\n\tlsl\tw0, w0, 4\n\tldr\tw1, [sp, 28]\n\tadd\tw0, w1, w0\n\tstr\tw0, [sp, 24]\n\tldr\tx0, [sp, 8]\n\tadd\tx0, x0, 1\n\tstr\tx0, [sp, 8]\n.L2:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L11\n\tb\t.L10\n.L13:\n\tnop\n.L10:\n\tldr\tw0, [sp, 24]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global xtoi\n.type xtoi, %function\nxtoi:\n.LFB0:\n\t.cfi_startproc\n\tmov\tx3, x0\n\tmov\tw0, 0\n.L2:\n\tldrb\tw1, [x3]\n\tcbnz\tw1, .L7\n.L1:\n\tret\n.L7:\n\tsub\tw2, w1, #48\n\tand\tw4, w2, 255\n\tcmp\tw4, 9\n\tbhi\t.L3\n\tmov\tw1, w2\n.L4:\n\tadd\tw0, w1, w0, lsl 4\n\tadd\tx3, x3, 1\n\tb\t.L2\n.L3:\n\tsub\tw2, w1, #65\n\tand\tw2, w2, 255\n\tcmp\tw2, 5\n\tbhi\t.L5\n\tsub\tw1, w1, #55\n\tb\t.L4\n.L5:\n\tsub\tw2, w1, #97\n\tand\tw2, w2, 255\n\tcmp\tw2, 5\n\tbhi\t.L1\n\tsub\tw1, w1, #87\n\tb\t.L4\n\t.cfi_endproc\n\n",
".global xtoi\n.type xtoi, %function\nxtoi:\n.LFB0:\n\t.cfi_startproc\n\tldrb\tw2, [x0]\n\tmov\tx4, x0\n\tmov\tw0, 0\n\tcbnz\tw2, .L6\n\tb\t.L1\n\t.p2align 2,,3\n.L10:\n\tsub\tw3, w2, #55\n.L4:\n\tldrb\tw2, [x4, 1]!\n\tadd\tw0, w3, w0, lsl 4\n\tcbz\tw2, .L1\n.L6:\n\tsub\tw3, w2, #48\n\tsub\tw1, w2, #65\n\tand\tw5, w3, 255\n\tand\tw1, w1, 255\n\tcmp\tw5, 9\n\tbls\t.L4\n\tsub\tw5, w2, #97\n\tsub\tw3, w2, #87\n\tand\tw5, w5, 255\n\tcmp\tw1, 5\n\tbls\t.L10\n\tcmp\tw5, 5\n\tbls\t.L4\n.L1:\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"blnyowntfwxpqul\""
],
"var": [
"p"
]
},
{
"value": [
"\"hsnwlgdkvzrljdpvcwp\""
],
"var": [
"p"
]
},
{
"value": [
"\"nqgsgphxzoavusxaihal\""
],
"var": [
"p"
]
},
{
"value": [
"\"hobbaovyewzcnavmmqcdwppa\""
],
"var": [
"p"
]
},
{
"value": [
"\"xbntfkulfoqcvaig\""
],
"var": [
"p"
]
},
{
"value": [
"\"dhaoztwfug\""
],
"var": [
"p"
]
},
{
"value": [
"\"slespfuhzfwo\""
],
"var": [
"p"
]
},
{
"value": [
"\"wkucjyawocamdd\""
],
"var": [
"p"
]
},
{
"value": [
"\"ccyyrpjhw\""
],
"var": [
"p"
]
},
{
"value": [
"\"pknyytmvhrypajaphyfcn\""
],
"var": [
"p"
]
}
],
"output": [
{
"value": [
"\"blnyowntfwxpqul\"",
"11"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"hsnwlgdkvzrljdpvcwp\"",
"0"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"nqgsgphxzoavusxaihal\"",
"0"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"hobbaovyewzcnavmmqcdwppa\"",
"0"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"xbntfkulfoqcvaig\"",
"0"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"dhaoztwfug\"",
"13"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"slespfuhzfwo\"",
"0"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"wkucjyawocamdd\"",
"0"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"ccyyrpjhw\"",
"204"
],
"var": [
"p",
"returnv"
]
},
{
"value": [
"\"pknyytmvhrypajaphyfcn\"",
"0"
],
"var": [
"p",
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_366iymz6nn.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* p, int returnv) {
json output_json;
output_json["p"] = p;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* p = strdup(input_json["p"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = xtoi(p);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(p, returnv);
}
|
develop
|
null
|
{"livein": ["p"], "liveout": ["p"], "returnvarname": ["returnv"], "execcmd": "", "funname": "xtoi", "funargs": ["p"], "typemap": {"p": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_366iymz6nn.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
jpmrno/ITBA-PI/TP07/Encripta.c
|
int retPosVector(char letra, char alfabeto[]) {
int i;
for( i = 0; alfabeto[i]; i++) {
if(alfabeto[i] == letra) {
return i;
}
}
}
|
int retPosVector(charletra, char *alfabeto)
|
int retPosVector(char letra, char alfabeto[])
|
retPosVector
|
[
"int",
"char",
"char *"
] |
{
"code": [
".globl retPosVector\n.type retPosVector, @function\nretPosVector:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, %eax\n\tmovq\t%rsi, -32(%rbp)\n\tmovb\t%al, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, -20(%rbp)\n\tjne\t.L3\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L1\n.L3:\n\taddl\t$1, -4(%rbp)\n.L2:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n.L1:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl retPosVector\n.type retPosVector, @function\nretPosVector:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n.L2:\n\tmovb\t(%rsi,%rax), %dl\n\tmovl\t%eax, %r8d\n\ttestb\t%dl, %dl\n\tje\t.L1\n\tincq\t%rax\n\tcmpb\t%dil, %dl\n\tjne\t.L2\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".globl retPosVector\n.type retPosVector, @function\nretPosVector:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %edx\n\ttestb\t%dl, %dl\n\tje\t.L1\n\txorl\t%eax, %eax\n\tjmp\t.L4\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\taddq\t$1, %rax\n\tmovzbl\t(%rsi,%rax), %edx\n\ttestb\t%dl, %dl\n\tje\t.L1\n.L4:\n\tmovl\t%eax, %r8d\n\tcmpb\t%dl, %dil\n\tjne\t.L10\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".global retPosVector\n.type retPosVector, %function\nretPosVector:\n.LFB6:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstrb\tw0, [sp, 15]\n\tstr\tx1, [sp]\n\tstr\twzr, [sp, 28]\n\tb\t.L2\n.L5:\n\tldrsw\tx0, [sp, 28]\n\tldr\tx1, [sp]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tldrb\tw1, [sp, 15]\n\tcmp\tw1, w0\n\tbne\t.L3\n\tldr\tw0, [sp, 28]\n\tb\t.L1\n.L3:\n\tldr\tw0, [sp, 28]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 28]\n.L2:\n\tldrsw\tx0, [sp, 28]\n\tldr\tx1, [sp]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n.L1:\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global retPosVector\n.type retPosVector, %function\nretPosVector:\n.LFB24:\n\t.cfi_startproc\n\tand\tw4, w0, 255\n\tmov\tx2, 0\n.L2:\n\tldrb\tw3, [x1, x2]\n\tmov\tw0, w2\n\tcbz\tw3, .L1\n\tadd\tx2, x2, 1\n\tcmp\tw3, w4\n\tbne\t.L2\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".global retPosVector\n.type retPosVector, %function\nretPosVector:\n.LFB41:\n\t.cfi_startproc\n\tldrb\tw3, [x1]\n\tand\tw4, w0, 255\n\tcbz\tw3, .L1\n\tmov\tx2, 0\n\tb\t.L4\n\t.p2align 2,,3\n.L10:\n\tldrb\tw3, [x1, x2]\n\tcbz\tw3, .L1\n.L4:\n\tmov\tw0, w2\n\tcmp\tw4, w3\n\tadd\tx2, x2, 1\n\tbne\t.L10\n.L1:\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <ctype.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"106",
"\"ptaqhvndi\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"99",
"\"jurqsxuesmjlmwlc\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"17",
"\"mmoszdvagdxqayyhyajkfzdhsx\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"41",
"\"znjojsqtz\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"16",
"\"oixivofxqfcmaaoevtbxdmlp\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"41",
"\"dsfysbai\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"74",
"\"lofbchkxjyoayaclznxiellufkqjjmu\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"68",
"\"mehyidijhagahxqm\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"0",
"\"voavbhynavqjnui\""
],
"var": [
"letra",
"alfabeto"
]
},
{
"value": [
"11",
"\"pjanmmdo\""
],
"var": [
"letra",
"alfabeto"
]
}
],
"output": [
{
"value": [
"\"ptaqhvndi\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"jurqsxuesmjlmwlc\"",
"15"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"mmoszdvagdxqayyhyajkfzdhsx\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"znjojsqtz\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"oixivofxqfcmaaoevtbxdmlp\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"dsfysbai\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"lofbchkxjyoayaclznxiellufkqjjmu\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"mehyidijhagahxqm\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"voavbhynavqjnui\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
},
{
"value": [
"\"pjanmmdo\"",
"0"
],
"var": [
"alfabeto",
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_42xwvm1t5e.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char letra, char* alfabeto, int returnv) {
json output_json;
output_json["alfabeto"] = alfabeto;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char letra = input_json["letra"].get<char>();
char* alfabeto = strdup(input_json["alfabeto"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = retPosVector(letra, alfabeto);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(letra, alfabeto, returnv);
}
|
master
|
null
|
{"livein": ["letra", "alfabeto"], "liveout": ["alfabeto"], "returnvarname": ["returnv"], "execcmd": "", "funname": "retPosVector", "funargs": ["letra", "alfabeto"], "typemap": {"letra": "int8", "alfabeto": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_42xwvm1t5e.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
patholden/linux/drivers/CgosLib/Cgos.c
|
unsigned int CgosStrLen(const char *s)
{
const char *ss=s;
if (!s) return 0;
while (*s++);
return s-ss-1;
}
|
unsigned int CgosStrLen(const char *s)
|
unsigned int CgosStrLen(const char *s)
|
CgosStrLen
|
[
"unsigned int",
"const char *"
] |
{
"code": [
".globl CgosStrLen\n.type CgosStrLen, @function\nCgosStrLen:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L5\n\tmovl\t$0, %eax\n\tjmp\t.L3\n.L5:\n\tnop\n.L4:\n\tmovq\t-24(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -24(%rbp)\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n\tmovq\t-24(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n\tsubl\t$1, %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl CgosStrLen\n.type CgosStrLen, @function\nCgosStrLen:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L1\n\tmovq\t%rdi, %rax\n.L3:\n\tincq\t%rax\n\tcmpb\t$0, -1(%rax)\n\tjne\t.L3\n\tsubq\t%rdi, %rax\n\tdecl\t%eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl CgosStrLen\n.type CgosStrLen, @function\nCgosStrLen:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rdi, %rdi\n\tje\t.L4\n\tmovq\t%rdi, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddq\t$1, %rax\n\tcmpb\t$0, -1(%rax)\n\tjne\t.L3\n\tsubq\t%rdi, %rax\n\tsubl\t$1, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n\n",
".global CgosStrLen\n.type CgosStrLen, %function\nCgosStrLen:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tx0, [sp, 8]\n\tldr\tx0, [sp, 8]\n\tstr\tx0, [sp, 24]\n\tldr\tx0, [sp, 8]\n\tcmp\tx0, 0\n\tbne\t.L5\n\tmov\tw0, 0\n\tb\t.L3\n.L5:\n\tnop\n.L4:\n\tldr\tx0, [sp, 8]\n\tadd\tx1, x0, 1\n\tstr\tx1, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L4\n\tldr\tx1, [sp, 8]\n\tldr\tx0, [sp, 24]\n\tsub\tx0, x1, x0\n\tsub\tw0, w0, #1\n.L3:\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global CgosStrLen\n.type CgosStrLen, %function\nCgosStrLen:\n.LFB0:\n\t.cfi_startproc\n\tcbz\tx0, .L4\n\tmov\tx1, x0\n.L3:\n\tldrb\tw2, [x1], 1\n\tcbnz\tw2, .L3\n\tsub\tx0, x1, x0\n\tsub\tw0, w0, #1\n.L1:\n\tret\n.L4:\n\tmov\tw0, 0\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global CgosStrLen\n.type CgosStrLen, %function\nCgosStrLen:\n.LFB0:\n\t.cfi_startproc\n\tcbz\tx0, .L4\n\tmov\tx1, x0\n\t.p2align 3,,7\n.L3:\n\tldrb\tw2, [x1], 1\n\tcbnz\tw2, .L3\n\tsub\tx0, x1, x0\n\tsub\tw0, w0, #1\n\tret\n\t.p2align 2,,3\n.L4:\n\tmov\tw0, 0\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"zyhvcma\""
],
"var": [
"s"
]
},
{
"value": [
"\"xrkcjmjnwgti\""
],
"var": [
"s"
]
},
{
"value": [
"\"wyufmgwdyjtoivwda\""
],
"var": [
"s"
]
},
{
"value": [
"\"ynj\""
],
"var": [
"s"
]
},
{
"value": [
"\"\""
],
"var": [
"s"
]
},
{
"value": [
"\"pnugbokhleroshkispjohjezaheimkt\""
],
"var": [
"s"
]
},
{
"value": [
"\"bn\""
],
"var": [
"s"
]
},
{
"value": [
"\"t\""
],
"var": [
"s"
]
},
{
"value": [
"\"ooskqiwlvhcaryz\""
],
"var": [
"s"
]
},
{
"value": [
"\"ewgaqsuvpfy\""
],
"var": [
"s"
]
}
],
"output": [
{
"value": [
"7",
"\"zyhvcma\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"12",
"\"xrkcjmjnwgti\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"17",
"\"wyufmgwdyjtoivwda\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"3",
"\"ynj\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"0",
"\"\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"31",
"\"pnugbokhleroshkispjohjezaheimkt\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"2",
"\"bn\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"1",
"\"t\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"15",
"\"ooskqiwlvhcaryz\""
],
"var": [
"returnv",
"s"
]
},
{
"value": [
"11",
"\"ewgaqsuvpfy\""
],
"var": [
"returnv",
"s"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_36p06yur55.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* s, unsigned int returnv) {
json output_json;
output_json["s"] = s;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* s = strdup(input_json["s"].get<std::string>().c_str());
clock_t begin = clock();
unsigned int returnv = CgosStrLen(s);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(s, returnv);
}
|
master
|
null
|
{"livein": ["s"], "liveout": ["s"], "returnvarname": ["returnv"], "execcmd": "", "funname": "CgosStrLen", "funargs": ["s"], "typemap": {"s": "string", "returnv": "uint32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_36p06yur55.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
Cnidarias/al-go-rithms/cryptography/atbash_cipher/c/atbash_cipher.c
|
char cipher (char c){
if(c >= 65 && c<= 90){
c = c - 65;
c = 90 - c;
}else if( c >= 97 && c<= 122){
c = c-97;
c = 122 - c;
}
return c;
}
|
char cipher(charc)
|
char cipher (char c)
|
cipher
|
[
"char",
"char"
] |
{
"code": [
".globl cipher\n.type cipher, @function\ncipher:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, %eax\n\tmovb\t%al, -4(%rbp)\n\tcmpb\t$64, -4(%rbp)\n\tjle\t.L2\n\tcmpb\t$90, -4(%rbp)\n\tjg\t.L2\n\tmovzbl\t-4(%rbp), %eax\n\tsubl\t$65, %eax\n\tmovb\t%al, -4(%rbp)\n\tmovzbl\t-4(%rbp), %eax\n\tmovl\t$90, %edx\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tmovb\t%al, -4(%rbp)\n\tjmp\t.L3\n.L2:\n\tcmpb\t$96, -4(%rbp)\n\tjle\t.L3\n\tcmpb\t$122, -4(%rbp)\n\tjg\t.L3\n\tmovzbl\t-4(%rbp), %eax\n\tsubl\t$97, %eax\n\tmovb\t%al, -4(%rbp)\n\tmovzbl\t-4(%rbp), %eax\n\tmovl\t$122, %edx\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tmovb\t%al, -4(%rbp)\n.L3:\n\tmovzbl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl cipher\n.type cipher, @function\ncipher:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tleal\t-65(%rdi), %edx\n\tmovl\t%edi, %eax\n\tcmpb\t$25, %dl\n\tja\t.L2\n\tmovb\t$90, %al\n\tsubl\t%edx, %eax\n\tret\n.L2:\n\tsubl\t$97, %edi\n\tcmpb\t$25, %dil\n\tja\t.L3\n\tmovb\t$122, %al\n\tsubl\t%edi, %eax\n.L3:\n\tret\n\t.cfi_endproc\n\n",
".globl cipher\n.type cipher, @function\ncipher:\n.LFB34:\n\t.cfi_startproc\n\tendbr64\n\tleal\t-65(%rdi), %eax\n\tcmpb\t$25, %al\n\tja\t.L2\n\tmovl\t$90, %edi\n\tsubl\t%eax, %edi\n\tmovl\t%edi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tleal\t-97(%rdi), %edx\n\tmovl\t$122, %eax\n\tsubl\t%edx, %eax\n\tcmpb\t$26, %dl\n\tcmovnb\t%edi, %eax\n\tret\n\t.cfi_endproc\n\n",
".global cipher\n.type cipher, %function\ncipher:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstrb\tw0, [sp, 15]\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 64\n\tbls\t.L2\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 90\n\tbhi\t.L2\n\tldrb\tw0, [sp, 15]\n\tsub\tw0, w0, #65\n\tstrb\tw0, [sp, 15]\n\tldrb\tw0, [sp, 15]\n\tmov\tw1, 90\n\tsub\tw0, w1, w0\n\tstrb\tw0, [sp, 15]\n\tb\t.L3\n.L2:\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 96\n\tbls\t.L3\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 122\n\tbhi\t.L3\n\tldrb\tw0, [sp, 15]\n\tsub\tw0, w0, #97\n\tstrb\tw0, [sp, 15]\n\tldrb\tw0, [sp, 15]\n\tmov\tw1, 122\n\tsub\tw0, w1, w0\n\tstrb\tw0, [sp, 15]\n.L3:\n\tldrb\tw0, [sp, 15]\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global cipher\n.type cipher, %function\ncipher:\n.LFB24:\n\t.cfi_startproc\n\tand\tw0, w0, 255\n\tsub\tw1, w0, #65\n\tand\tw1, w1, 255\n\tcmp\tw1, 25\n\tbhi\t.L2\n\tmov\tw0, 90\n.L4:\n\tsub\tw0, w0, w1\n\tand\tw0, w0, 255\n.L3:\n\tret\n.L2:\n\tsub\tw1, w0, #97\n\tand\tw1, w1, 255\n\tcmp\tw1, 25\n\tbhi\t.L3\n\tmov\tw0, 122\n\tb\t.L4\n\t.cfi_endproc\n\n",
".global cipher\n.type cipher, %function\ncipher:\n.LFB34:\n\t.cfi_startproc\n\tand\tw0, w0, 255\n\tsub\tw1, w0, #65\n\tand\tw1, w1, 255\n\tcmp\tw1, 25\n\tbhi\t.L2\n\tmov\tw0, 90\n\tsub\tw0, w0, w1\n\tand\tw0, w0, 255\n\tret\n\t.p2align 2,,3\n.L2:\n\tsub\tw2, w0, #97\n\tmov\tw1, 122\n\tand\tw3, w2, 255\n\tsub\tw1, w1, w2, uxtb\n\tcmp\tw3, 26\n\tand\tw1, w1, 255\n\tcsel\tw0, w1, w0, cc\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <string.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"124"
],
"var": [
"c"
]
},
{
"value": [
"106"
],
"var": [
"c"
]
},
{
"value": [
"48"
],
"var": [
"c"
]
},
{
"value": [
"94"
],
"var": [
"c"
]
},
{
"value": [
"92"
],
"var": [
"c"
]
},
{
"value": [
"84"
],
"var": [
"c"
]
},
{
"value": [
"17"
],
"var": [
"c"
]
},
{
"value": [
"75"
],
"var": [
"c"
]
},
{
"value": [
"79"
],
"var": [
"c"
]
},
{
"value": [
"20"
],
"var": [
"c"
]
}
],
"output": [
{
"value": [
"124"
],
"var": [
"returnv"
]
},
{
"value": [
"113"
],
"var": [
"returnv"
]
},
{
"value": [
"48"
],
"var": [
"returnv"
]
},
{
"value": [
"94"
],
"var": [
"returnv"
]
},
{
"value": [
"92"
],
"var": [
"returnv"
]
},
{
"value": [
"71"
],
"var": [
"returnv"
]
},
{
"value": [
"17"
],
"var": [
"returnv"
]
},
{
"value": [
"80"
],
"var": [
"returnv"
]
},
{
"value": [
"76"
],
"var": [
"returnv"
]
},
{
"value": [
"20"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_42ecrm7t2u.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char c, char returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char c = input_json["c"].get<char>();
clock_t begin = clock();
char returnv = cipher(c);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(c, returnv);
}
|
master
|
null
|
{"livein": ["c"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "cipher", "funargs": ["c"], "typemap": {"c": "int8", "returnv": "int8"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_42ecrm7t2u.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
paxromana96/LispCompiler/src/syntax.c
|
char * getTokenTypeName(int type){
switch(type){
case 1:
return "<LParen>";
case 2:
return "<RParen>";
case 3:
return "<Number>";
case 8:
return "<ID>";
case 6:
return "<Plus>";
case 7:
return "<Minus>";
case -2:
return "<EOF>";
case -1:
return "<Error!>";
default:
return "<Unknown token type!>";
}
}
|
char * getTokenTypeName(inttype)
|
char * getTokenTypeName(int type)
|
getTokenTypeName
|
[
"char *",
"int"
] |
{
"code": [
".globl getTokenTypeName\n.type getTokenTypeName, @function\ngetTokenTypeName:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\taddl\t$2, %eax\n\tcmpl\t$10, %eax\n\tja\t.L2\n\tmovl\t%eax, %eax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\t.L4(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t.L4(%rip), %rdx\n\taddq\t%rdx, %rax\n\tnotrack jmp\t*%rax\n\t.section\t.rodata\n\t.align 4\n\t.align 4\n.L4:\n\t.long\t.L11-.L4\n\t.long\t.L10-.L4\n\t.long\t.L2-.L4\n\t.long\t.L9-.L4\n\t.long\t.L8-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L6-.L4\n\t.long\t.L5-.L4\n\t.long\t.L3-.L4\n\t.text\n.L9:\n\tleaq\t.LC0(%rip), %rax\n\tjmp\t.L12\n.L8:\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L12\n.L7:\n\tleaq\t.LC2(%rip), %rax\n\tjmp\t.L12\n.L3:\n\tleaq\t.LC3(%rip), %rax\n\tjmp\t.L12\n.L6:\n\tleaq\t.LC4(%rip), %rax\n\tjmp\t.L12\n.L5:\n\tleaq\t.LC5(%rip), %rax\n\tjmp\t.L12\n.L11:\n\tleaq\t.LC6(%rip), %rax\n\tjmp\t.L12\n.L10:\n\tleaq\t.LC7(%rip), %rax\n\tjmp\t.L12\n.L2:\n\tleaq\t.LC8(%rip), %rax\n.L12:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LC4: \t.string\t\"<Plus>\"\n.LC2: \t.string\t\"<Number>\"\n.LC3: \t.string\t\"<ID>\"\n.LC5: \t.string\t\"<Minus>\"\n.LC6: \t.string\t\"<EOF>\"\n.LC7: \t.string\t\"<Error!>\"\n.LC1: \t.string\t\"<RParen>\"\n.LC0: \t.string\t\"<LParen>\"\n.LC8: \t.string\t\"<Unknown token type!>\"\n",
".globl getTokenTypeName\n.type getTokenTypeName, @function\ngetTokenTypeName:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\taddl\t$2, %edi\n\tcmpl\t$10, %edi\n\tja\t.L2\n\tleaq\t.L4(%rip), %rdx\n\tmovslq\t(%rdx,%rdi,4), %rax\n\taddq\t%rdx, %rax\n\tnotrack jmp\t*%rax\n\t.section\t.rodata\n\t.align 4\n\t.align 4\n.L4:\n\t.long\t.L11-.L4\n\t.long\t.L10-.L4\n\t.long\t.L2-.L4\n\t.long\t.L12-.L4\n\t.long\t.L8-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L6-.L4\n\t.long\t.L5-.L4\n\t.long\t.L3-.L4\n\t.text\n.L8:\n\tleaq\t.LC8(%rip), %rax\n\tret\n.L7:\n\tleaq\t.LC2(%rip), %rax\n\tret\n.L3:\n\tleaq\t.LC3(%rip), %rax\n\tret\n.L6:\n\tleaq\t.LC4(%rip), %rax\n\tret\n.L5:\n\tleaq\t.LC5(%rip), %rax\n\tret\n.L11:\n\tleaq\t.LC6(%rip), %rax\n\tret\n.L10:\n\tleaq\t.LC7(%rip), %rax\n\tret\n.L2:\n\tleaq\t.LC0(%rip), %rax\n\tret\n.L12:\n\tleaq\t.LC1(%rip), %rax\n\tret\n\t.cfi_endproc\n.LC4: \t.string\t\"<Plus>\"\n.LC2: \t.string\t\"<Number>\"\n.LC3: \t.string\t\"<ID>\"\n.LC5: \t.string\t\"<Minus>\"\n.LC6: \t.string\t\"<EOF>\"\n.LC7: \t.string\t\"<Error!>\"\n.LC1: \t.string\t\"<LParen>\"\n.LC0: \t.string\t\"<Unknown token type!>\"\n.LC8: \t.string\t\"<RParen>\"\n",
".globl getTokenTypeName\n.type getTokenTypeName, @function\ngetTokenTypeName:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\taddl\t$2, %edi\n\tcmpl\t$10, %edi\n\tja\t.L2\n\tleaq\t.L4(%rip), %rdx\n\tmovslq\t(%rdx,%rdi,4), %rax\n\taddq\t%rdx, %rax\n\tnotrack jmp\t*%rax\n\t.section\t.rodata\n\t.align 4\n\t.align 4\n.L4:\n\t.long\t.L11-.L4\n\t.long\t.L10-.L4\n\t.long\t.L2-.L4\n\t.long\t.L12-.L4\n\t.long\t.L8-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L6-.L4\n\t.long\t.L5-.L4\n\t.long\t.L3-.L4\n\t.text\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tleaq\t.LC0(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tleaq\t.LC6(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tleaq\t.LC7(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tleaq\t.LC2(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tleaq\t.LC4(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tleaq\t.LC5(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tleaq\t.LC3(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tleaq\t.LC1(%rip), %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tleaq\t.LC8(%rip), %rax\n\tret\n\t.cfi_endproc\n.LC4: \t.string\t\"<Plus>\"\n.LC2: \t.string\t\"<Number>\"\n.LC6: \t.string\t\"<EOF>\"\n.LC5: \t.string\t\"<Minus>\"\n.LC3: \t.string\t\"<ID>\"\n.LC7: \t.string\t\"<Error!>\"\n.LC1: \t.string\t\"<LParen>\"\n.LC0: \t.string\t\"<Unknown token type!>\"\n.LC8: \t.string\t\"<RParen>\"\n",
".global getTokenTypeName\n.type getTokenTypeName, %function\ngetTokenTypeName:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstr\tw0, [sp, 12]\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 8\n\tbeq\t.L2\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 8\n\tbgt\t.L3\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 7\n\tbeq\t.L4\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 7\n\tbgt\t.L3\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 6\n\tbeq\t.L5\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 6\n\tbgt\t.L3\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 3\n\tbeq\t.L6\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 3\n\tbgt\t.L3\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 2\n\tbeq\t.L7\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 2\n\tbgt\t.L3\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 1\n\tbeq\t.L8\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 1\n\tbgt\t.L3\n\tldr\tw0, [sp, 12]\n\tcmn\tw0, #2\n\tbeq\t.L9\n\tldr\tw0, [sp, 12]\n\tcmn\tw0, #1\n\tbeq\t.L10\n\tb\t.L3\n.L8:\n\tadrp\tx0, .LC0\n\tadd\tx0, x0, :lo12:.LC0\n\tb\t.L11\n.L7:\n\tadrp\tx0, .LC1\n\tadd\tx0, x0, :lo12:.LC1\n\tb\t.L11\n.L6:\n\tadrp\tx0, .LC2\n\tadd\tx0, x0, :lo12:.LC2\n\tb\t.L11\n.L2:\n\tadrp\tx0, .LC3\n\tadd\tx0, x0, :lo12:.LC3\n\tb\t.L11\n.L5:\n\tadrp\tx0, .LC4\n\tadd\tx0, x0, :lo12:.LC4\n\tb\t.L11\n.L4:\n\tadrp\tx0, .LC5\n\tadd\tx0, x0, :lo12:.LC5\n\tb\t.L11\n.L9:\n\tadrp\tx0, .LC6\n\tadd\tx0, x0, :lo12:.LC6\n\tb\t.L11\n.L10:\n\tadrp\tx0, .LC7\n\tadd\tx0, x0, :lo12:.LC7\n\tb\t.L11\n.L3:\n\tadrp\tx0, .LC8\n\tadd\tx0, x0, :lo12:.LC8\n.L11:\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n.LC4: \t.string\t\"<Plus>\"\n.LC2: \t.string\t\"<Number>\"\n.LC3: \t.string\t\"<ID>\"\n.LC5: \t.string\t\"<Minus>\"\n.LC6: \t.string\t\"<EOF>\"\n.LC7: \t.string\t\"<Error!>\"\n.LC1: \t.string\t\"<RParen>\"\n.LC0: \t.string\t\"<LParen>\"\n.LC8: \t.string\t\"<Unknown token type!>\"\n",
".global getTokenTypeName\n.type getTokenTypeName, %function\ngetTokenTypeName:\n.LFB0:\n\t.cfi_startproc\n\tadd\tw0, w0, 2\n\tcmp\tw0, 10\n\tbhi\t.L2\n\tadrp\tx1, .L4\n\tadd\tx1, x1, :lo12:.L4\n\tldrb\tw0, [x1,w0,uxtw]\n\tadr\tx1, .Lrtx4\n\tadd\tx0, x1, w0, sxtb #2\n\tbr\tx0\n.Lrtx4:\n\t.section\t.rodata\n\t.align\t0\n\t.align\t2\n.L4:\n\t.byte\t(.L11 - .Lrtx4) / 4\n\t.byte\t(.L10 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L12 - .Lrtx4) / 4\n\t.byte\t(.L8 - .Lrtx4) / 4\n\t.byte\t(.L7 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L6 - .Lrtx4) / 4\n\t.byte\t(.L5 - .Lrtx4) / 4\n\t.byte\t(.L3 - .Lrtx4) / 4\n\t.text\n.L8:\n\tadrp\tx0, .LC8\n\tadd\tx0, x0, :lo12:.LC8\n.L1:\n\tret\n.L7:\n\tadrp\tx0, .LC2\n\tadd\tx0, x0, :lo12:.LC2\n\tb\t.L1\n.L3:\n\tadrp\tx0, .LC3\n\tadd\tx0, x0, :lo12:.LC3\n\tb\t.L1\n.L6:\n\tadrp\tx0, .LC4\n\tadd\tx0, x0, :lo12:.LC4\n\tb\t.L1\n.L5:\n\tadrp\tx0, .LC5\n\tadd\tx0, x0, :lo12:.LC5\n\tb\t.L1\n.L11:\n\tadrp\tx0, .LC6\n\tadd\tx0, x0, :lo12:.LC6\n\tb\t.L1\n.L10:\n\tadrp\tx0, .LC7\n\tadd\tx0, x0, :lo12:.LC7\n\tb\t.L1\n.L2:\n\tadrp\tx0, .LC0\n\tadd\tx0, x0, :lo12:.LC0\n\tb\t.L1\n.L12:\n\tadrp\tx0, .LC1\n\tadd\tx0, x0, :lo12:.LC1\n\tb\t.L1\n\t.cfi_endproc\n.LC4: \t.string\t\"<Plus>\"\n.LC2: \t.string\t\"<Number>\"\n.LC3: \t.string\t\"<ID>\"\n.LC5: \t.string\t\"<Minus>\"\n.LC6: \t.string\t\"<EOF>\"\n.LC7: \t.string\t\"<Error!>\"\n.LC1: \t.string\t\"<LParen>\"\n.LC0: \t.string\t\"<Unknown token type!>\"\n.LC8: \t.string\t\"<RParen>\"\n",
".global getTokenTypeName\n.type getTokenTypeName, %function\ngetTokenTypeName:\n.LFB0:\n\t.cfi_startproc\n\tcmp\tw0, 3\n\tbeq\t.L4\n\tbgt\t.L3\n\tcmp\tw0, 1\n\tbeq\t.L5\n\tcmp\tw0, 2\n\tbne\t.L13\n\tadrp\tx0, .LC5\n\tadd\tx0, x0, :lo12:.LC5\n\tret\n\t.p2align 2,,3\n.L13:\n\tcmn\tw0, #2\n\tbeq\t.L7\n\tcmn\tw0, #1\n\tbne\t.L11\n\tadrp\tx0, .LC4\n\tadd\tx0, x0, :lo12:.LC4\n\tret\n\t.p2align 2,,3\n.L3:\n\tcmp\tw0, 7\n\tbeq\t.L9\n\tcmp\tw0, 8\n\tbne\t.L14\n\tadrp\tx0, .LC3\n\tadd\tx0, x0, :lo12:.LC3\n\tret\n.L14:\n\tcmp\tw0, 6\n\tbne\t.L11\n\tadrp\tx0, .LC8\n\tadd\tx0, x0, :lo12:.LC8\n\tret\n\t.p2align 2,,3\n.L7:\n\tadrp\tx0, .LC6\n\tadd\tx0, x0, :lo12:.LC6\n\tret\n\t.p2align 2,,3\n.L9:\n\tadrp\tx0, .LC2\n\tadd\tx0, x0, :lo12:.LC2\n\tret\n\t.p2align 2,,3\n.L5:\n\tadrp\tx0, .LC1\n\tadd\tx0, x0, :lo12:.LC1\n\tret\n\t.p2align 2,,3\n.L4:\n\tadrp\tx0, .LC7\n\tadd\tx0, x0, :lo12:.LC7\n\tret\n.L11:\n\tadrp\tx0, .LC0\n\tadd\tx0, x0, :lo12:.LC0\n\tret\n\t.cfi_endproc\n.LC4: \t.string\t\"<Error!>\"\n.LC2: \t.string\t\"<Minus>\"\n.LC5: \t.string\t\"<RParen>\"\n.LC6: \t.string\t\"<EOF>\"\n.LC3: \t.string\t\"<ID>\"\n.LC7: \t.string\t\"<Number>\"\n.LC1: \t.string\t\"<LParen>\"\n.LC0: \t.string\t\"<Unknown token type!>\"\n.LC8: \t.string\t\"<Plus>\"\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"13"
],
"var": [
"type"
]
},
{
"value": [
"54"
],
"var": [
"type"
]
},
{
"value": [
"102"
],
"var": [
"type"
]
},
{
"value": [
"14"
],
"var": [
"type"
]
},
{
"value": [
"124"
],
"var": [
"type"
]
},
{
"value": [
"121"
],
"var": [
"type"
]
},
{
"value": [
"121"
],
"var": [
"type"
]
},
{
"value": [
"108"
],
"var": [
"type"
]
},
{
"value": [
"12"
],
"var": [
"type"
]
},
{
"value": [
"108"
],
"var": [
"type"
]
}
],
"output": [
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
},
{
"value": [
"\"<Unknown token type!>\""
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_64leyo_aie.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int type, char* returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int type = input_json["type"];
clock_t begin = clock();
char* returnv = getTokenTypeName(type);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(type, returnv);
}
|
master
|
null
|
{"livein": ["type"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "getTokenTypeName", "funargs": ["type"], "typemap": {"type": "int32", "returnv": "string"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_64leyo_aie.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
kanner/KnR_solutions/Chapter3/3-03/expand.c
|
int checkrange(char c1, char c2)
{
if (('a' <= c1 && c1 <= 'z') && (c1 <= c2 && c2 <= 'z'))
return 1;
if (('A' <= c1 && c1 <= 'Z') && (c1 <= c2 && c2 <= 'Z'))
return 1;
if (('0' <= c1 && c1 <= '9') && (c1 <= c2 && c2 <= '9'))
return 1;
return 0;
}
|
int checkrange(charc1, charc2)
|
int checkrange(char c1, char c2)
|
checkrange
|
[
"int",
"char",
"char"
] |
{
"code": [
".globl checkrange\n.type checkrange, @function\ncheckrange:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %eax\n\tmovb\t%dl, -4(%rbp)\n\tmovb\t%al, -8(%rbp)\n\tcmpb\t$96, -4(%rbp)\n\tjle\t.L2\n\tcmpb\t$122, -4(%rbp)\n\tjg\t.L2\n\tmovzbl\t-4(%rbp), %eax\n\tcmpb\t-8(%rbp), %al\n\tjg\t.L2\n\tcmpb\t$122, -8(%rbp)\n\tjg\t.L2\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L2:\n\tcmpb\t$64, -4(%rbp)\n\tjle\t.L4\n\tcmpb\t$90, -4(%rbp)\n\tjg\t.L4\n\tmovzbl\t-4(%rbp), %eax\n\tcmpb\t-8(%rbp), %al\n\tjg\t.L4\n\tcmpb\t$90, -8(%rbp)\n\tjg\t.L4\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L4:\n\tcmpb\t$47, -4(%rbp)\n\tjle\t.L5\n\tcmpb\t$57, -4(%rbp)\n\tjg\t.L5\n\tmovzbl\t-4(%rbp), %eax\n\tcmpb\t-8(%rbp), %al\n\tjg\t.L5\n\tcmpb\t$57, -8(%rbp)\n\tjg\t.L5\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L5:\n\tmovl\t$0, %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl checkrange\n.type checkrange, @function\ncheckrange:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tleal\t-97(%rdi), %eax\n\tcmpb\t$25, %al\n\tja\t.L2\n\tcmpb\t%sil, %dil\n\tsetle\t%dl\n\tcmpb\t$122, %sil\n\tjmp\t.L6\n.L2:\n\tleal\t-65(%rdi), %eax\n\tcmpb\t$25, %al\n\tja\t.L4\n\tcmpb\t%sil, %dil\n\tsetle\t%dl\n\tcmpb\t$90, %sil\n\tjmp\t.L6\n.L4:\n\tleal\t-48(%rdi), %edx\n\txorl\t%eax, %eax\n\tcmpb\t$9, %dl\n\tja\t.L1\n\tcmpb\t%sil, %dil\n\tsetle\t%dl\n\tcmpb\t$57, %sil\n.L6:\n\tsetle\t%al\n\tmovzbl\t%al, %eax\n\tandl\t%edx, %eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl checkrange\n.type checkrange, @function\ncheckrange:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tleal\t-97(%rdi), %eax\n\tcmpb\t$25, %al\n\tja\t.L2\n\tcmpb\t%sil, %dil\n\tsetle\t%dl\n\txorl\t%eax, %eax\n\tcmpb\t$122, %sil\n\tsetle\t%al\n\tandl\t%edx, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tleal\t-65(%rdi), %eax\n\tcmpb\t$25, %al\n\tja\t.L4\n\tcmpb\t%sil, %dil\n\tsetle\t%dl\n\txorl\t%eax, %eax\n\tcmpb\t$90, %sil\n\tsetle\t%al\n\tandl\t%edx, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleal\t-48(%rdi), %eax\n\tcmpb\t$9, %al\n\tja\t.L5\n\tcmpb\t%sil, %dil\n\tsetle\t%dl\n\txorl\t%eax, %eax\n\tcmpb\t$57, %sil\n\tsetle\t%al\n\tandl\t%edx, %eax\n\tret\n.L5:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n\n",
".global checkrange\n.type checkrange, %function\ncheckrange:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstrb\tw0, [sp, 15]\n\tstrb\tw1, [sp, 14]\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 96\n\tbls\t.L2\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 122\n\tbhi\t.L2\n\tldrb\tw1, [sp, 15]\n\tldrb\tw0, [sp, 14]\n\tcmp\tw1, w0\n\tbhi\t.L2\n\tldrb\tw0, [sp, 14]\n\tcmp\tw0, 122\n\tbhi\t.L2\n\tmov\tw0, 1\n\tb\t.L3\n.L2:\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 64\n\tbls\t.L4\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 90\n\tbhi\t.L4\n\tldrb\tw1, [sp, 15]\n\tldrb\tw0, [sp, 14]\n\tcmp\tw1, w0\n\tbhi\t.L4\n\tldrb\tw0, [sp, 14]\n\tcmp\tw0, 90\n\tbhi\t.L4\n\tmov\tw0, 1\n\tb\t.L3\n.L4:\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 47\n\tbls\t.L5\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 57\n\tbhi\t.L5\n\tldrb\tw1, [sp, 15]\n\tldrb\tw0, [sp, 14]\n\tcmp\tw1, w0\n\tbhi\t.L5\n\tldrb\tw0, [sp, 14]\n\tcmp\tw0, 57\n\tbhi\t.L5\n\tmov\tw0, 1\n\tb\t.L3\n.L5:\n\tmov\tw0, 0\n.L3:\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global checkrange\n.type checkrange, %function\ncheckrange:\n.LFB13:\n\t.cfi_startproc\n\tand\tw0, w0, 255\n\tand\tw1, w1, 255\n\tsub\tw2, w0, #97\n\tand\tw2, w2, 255\n\tcmp\tw2, 25\n\tbhi\t.L2\n\tcmp\tw1, 122\n.L6:\n\tccmp\tw0, w1, 2, ls\n\tcset\tw0, ls\n.L1:\n\tret\n.L2:\n\tsub\tw2, w0, #65\n\tand\tw2, w2, 255\n\tcmp\tw2, 25\n\tbhi\t.L4\n\tcmp\tw1, 90\n\tb\t.L6\n.L4:\n\tsub\tw2, w0, #48\n\tand\tw2, w2, 255\n\tcmp\tw2, 9\n\tbhi\t.L5\n\tcmp\tw1, 57\n\tb\t.L6\n.L5:\n\tmov\tw0, 0\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global checkrange\n.type checkrange, %function\ncheckrange:\n.LFB23:\n\t.cfi_startproc\n\tand\tw0, w0, 255\n\tand\tw1, w1, 255\n\tsub\tw2, w0, #97\n\tand\tw2, w2, 255\n\tcmp\tw2, 25\n\tbhi\t.L2\n\tcmp\tw1, 122\n\tccmp\tw0, w1, 2, ls\n\tcset\tw0, ls\n\tret\n\t.p2align 2,,3\n.L2:\n\tsub\tw2, w0, #65\n\tand\tw2, w2, 255\n\tcmp\tw2, 25\n\tbhi\t.L4\n\tcmp\tw1, 90\n\tccmp\tw0, w1, 2, ls\n\tcset\tw0, ls\n\tret\n\t.p2align 2,,3\n.L4:\n\tsub\tw2, w0, #48\n\tand\tw2, w2, 255\n\tcmp\tw2, 9\n\tbhi\t.L5\n\tcmp\tw1, 57\n\tccmp\tw0, w1, 2, ls\n\tcset\tw0, ls\n\tret\n.L5:\n\tmov\tw0, 0\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"4",
"5"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"0",
"54"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"91",
"99"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"126",
"103"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"2",
"50"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"103",
"18"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"73",
"68"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"93",
"25"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"47",
"20"
],
"var": [
"c1",
"c2"
]
},
{
"value": [
"89",
"54"
],
"var": [
"c1",
"c2"
]
}
],
"output": [
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_384w2203gi.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char c1, char c2, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char c1 = input_json["c1"].get<char>();
char c2 = input_json["c2"].get<char>();
clock_t begin = clock();
int returnv = checkrange(c1, c2);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(c1, c2, returnv);
}
|
master
|
null
|
{"livein": ["c1", "c2"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "checkrange", "funargs": ["c1", "c2"], "typemap": {"c1": "int8", "c2": "int8", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_384w2203gi.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
mspenceree/Versa-Filter/firmware/recover.c
|
int valid_serial(char *carray)
{
int i, code, num[10], sumo=0, sume=0, sumss=0;
for(i=0;i<10;i++){
code = carray[i];
num[i] = code - 0x30;
if((code<0x30)||(code>0x39)){
return 0;
}
}
sumo = num[0]+num[2]+num[4];
sumo = sumo - (sumo/10)*10;
sume = num[1]+num[3]+num[5];
sume = sume - (sume/10)*10;
sumss = num[0]+num[1]+num[2]+num[3]+num[4]+num[5]+sumo+sume;
if((sumo!=num[6])||(sume!=num[7])||(sumss!=(10*num[8]+num[9]))){
return 0;
}
return 1;
}
|
int valid_serial(char *carray)
|
int valid_serial(char *carray)
|
valid_serial
|
[
"int",
"char *"
] |
{
"code": [
".globl valid_serial\n.type valid_serial, @function\nvalid_serial:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t%rdi, -88(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -64(%rbp)\n\tmovl\t$0, -60(%rbp)\n\tmovl\t$0, -56(%rbp)\n\tmovl\t$0, -68(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-68(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, -52(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tleal\t-48(%rax), %edx\n\tmovl\t-68(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -48(%rbp,%rax,4)\n\tcmpl\t$47, -52(%rbp)\n\tjle\t.L3\n\tcmpl\t$57, -52(%rbp)\n\tjle\t.L4\n.L3:\n\tmovl\t$0, %eax\n\tjmp\t.L9\n.L4:\n\taddl\t$1, -68(%rbp)\n.L2:\n\tcmpl\t$9, -68(%rbp)\n\tjle\t.L6\n\tmovl\t-48(%rbp), %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-32(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -64(%rbp)\n\tmovl\t-64(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%eax, %ecx\n\tsarl\t$2, %ecx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tmovl\t%eax, -64(%rbp)\n\tmovl\t-44(%rbp), %edx\n\tmovl\t-36(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-28(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -60(%rbp)\n\tmovl\t-60(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%eax, %ecx\n\tsarl\t$2, %ecx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tmovl\t%eax, -60(%rbp)\n\tmovl\t-48(%rbp), %edx\n\tmovl\t-44(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-36(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-32(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-28(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-64(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-60(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -56(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -64(%rbp)\n\tjne\t.L7\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -60(%rbp)\n\tjne\t.L7\n\tmovl\t-16(%rbp), %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -56(%rbp)\n\tje\t.L8\n.L7:\n\tmovl\t$0, %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$1, %eax\n.L9:\n\tmovq\t-8(%rbp), %rsi\n\txorq\t%fs:40, %rsi\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl valid_serial\n.type valid_serial, @function\nvalid_serial:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n.L3:\n\tmovsbl\t(%rdi,%rax), %edx\n\tsubl\t$48, %edx\n\tmovl\t%edx, (%rsp,%rax,4)\n\tcmpl\t$9, %edx\n\tja\t.L5\n\tincq\t%rax\n\tcmpq\t$10, %rax\n\tjne\t.L3\n\tmovl\t(%rsp), %ecx\n\tmovl\t8(%rsp), %r10d\n\tmovl\t$10, %esi\n\txorl\t%r12d, %r12d\n\tmovl\t16(%rsp), %r8d\n\tleal\t(%rcx,%r10), %eax\n\taddl\t%r8d, %eax\n\tcltd\n\tidivl\t%esi\n\tmovl\t%edx, %edi\n\tcmpl\t%edx, 24(%rsp)\n\tjne\t.L1\n\tmovl\t4(%rsp), %ebx\n\tmovl\t12(%rsp), %r11d\n\tmovl\t20(%rsp), %r9d\n\tleal\t(%rbx,%r11), %eax\n\taddl\t%r9d, %eax\n\tcltd\n\tidivl\t%esi\n\tcmpl\t%edx, 28(%rsp)\n\tjne\t.L1\n\taddl\t%ebx, %ecx\n\timull\t$10, 32(%rsp), %eax\n\taddl\t36(%rsp), %eax\n\txorl\t%r12d, %r12d\n\taddl\t%r10d, %ecx\n\taddl\t%r11d, %ecx\n\taddl\t%r8d, %ecx\n\taddl\t%r9d, %ecx\n\taddl\t%edi, %ecx\n\taddl\t%edx, %ecx\n\tcmpl\t%eax, %ecx\n\tsete\t%r12b\n\tjmp\t.L1\n.L5:\n\txorl\t%r12d, %r12d\n.L1:\n\tmovq\t40(%rsp), %rax\n\txorq\t%fs:40, %rax\n\tje\t.L4\n\tcall\t__stack_chk_fail@PLT\n.L4:\n\taddq\t$56, %rsp\n\t.cfi_def_cfa_offset 24\n\tmovl\t%r12d, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n\n",
".globl valid_serial\n.type valid_serial, @function\nvalid_serial:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tmovsbl\t(%rdi), %edx\n\tsubl\t$48, %edx\n\tcmpl\t$9, %edx\n\tja\t.L6\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovsbl\t1(%rdi), %ebx\n\tsubl\t$48, %ebx\n\tcmpl\t$9, %ebx\n\tja\t.L2\n\tmovsbl\t2(%rdi), %eax\n\tleal\t-48(%rax), %ecx\n\tcmpl\t$9, %ecx\n\tja\t.L2\n\tmovsbl\t3(%rdi), %eax\n\tleal\t-48(%rax), %r11d\n\tcmpl\t$9, %r11d\n\tja\t.L2\n\tmovsbl\t4(%rdi), %eax\n\tleal\t-48(%rax), %esi\n\tcmpl\t$9, %esi\n\tja\t.L2\n\tmovsbl\t5(%rdi), %eax\n\tleal\t-48(%rax), %r10d\n\tcmpl\t$9, %r10d\n\tja\t.L2\n\tmovsbl\t6(%rdi), %eax\n\tleal\t-48(%rax), %r9d\n\tcmpl\t$9, %r9d\n\tja\t.L2\n\tmovsbl\t7(%rdi), %eax\n\tleal\t-48(%rax), %r8d\n\tcmpl\t$9, %r8d\n\tja\t.L2\n\tmovsbl\t8(%rdi), %ebp\n\tsubl\t$48, %ebp\n\tcmpl\t$9, %ebp\n\tja\t.L2\n\tmovsbl\t9(%rdi), %r12d\n\tsubl\t$48, %r12d\n\tcmpl\t$9, %r12d\n\tja\t.L2\n\tleal\t(%rdx,%rcx), %edi\n\taddl\t%esi, %edi\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %r13d\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %r13d\n\tsarq\t$34, %rax\n\tsubl\t%r13d, %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %edi\n\tcmpl\t%r9d, %edi\n\tje\t.L11\n.L2:\n\txorl\t%eax, %eax\n.L1:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\tleal\t(%rbx,%r11), %edi\n\taddl\t%r10d, %edi\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %r13d\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %r13d\n\tsarq\t$34, %rax\n\tsubl\t%r13d, %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %edi\n\tcmpl\t%r8d, %edi\n\tjne\t.L2\n\tleal\t0(%rbp,%rbp,4), %eax\n\taddl\t%ebx, %edx\n\tleal\t(%r12,%rax,2), %edi\n\tleal\t(%rdx,%rcx), %eax\n\taddl\t%r11d, %eax\n\taddl\t%esi, %eax\n\taddl\t%r10d, %eax\n\taddl\t%r9d, %eax\n\tleal\t(%rax,%r8), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, %edi\n\tje\t.L1\n\tjmp\t.L2\n.L6:\n\t.cfi_def_cfa_offset 8\n\t.cfi_restore 3\n\t.cfi_restore 6\n\t.cfi_restore 12\n\t.cfi_restore 13\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n\n",
".global valid_serial\n.type valid_serial, %function\nvalid_serial:\n.LFB6:\n\t.cfi_startproc\n\tstp\tx29, x30, [sp, -112]!\n\t.cfi_def_cfa_offset 112\n\t.cfi_offset 29, -112\n\t.cfi_offset 30, -104\n\tmov\tx29, sp\n\tstr\tx0, [sp, 24]\n\tadrp\tx0, :got:__stack_chk_guard\n\tldr\tx0, [x0, #:got_lo12:__stack_chk_guard]\n\tldr\tx1, [x0]\n\tstr\tx1, [sp, 104]\n\tmov\tx1,0\n\tstr\twzr, [sp, 48]\n\tstr\twzr, [sp, 52]\n\tstr\twzr, [sp, 56]\n\tstr\twzr, [sp, 44]\n\tb\t.L2\n.L6:\n\tldrsw\tx0, [sp, 44]\n\tldr\tx1, [sp, 24]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tstr\tw0, [sp, 60]\n\tldr\tw0, [sp, 60]\n\tsub\tw2, w0, #48\n\tldrsw\tx0, [sp, 44]\n\tlsl\tx0, x0, 2\n\tadd\tx1, sp, 64\n\tstr\tw2, [x1, x0]\n\tldr\tw0, [sp, 60]\n\tcmp\tw0, 47\n\tble\t.L3\n\tldr\tw0, [sp, 60]\n\tcmp\tw0, 57\n\tble\t.L4\n.L3:\n\tmov\tw0, 0\n\tb\t.L9\n.L4:\n\tldr\tw0, [sp, 44]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 44]\n.L2:\n\tldr\tw0, [sp, 44]\n\tcmp\tw0, 9\n\tble\t.L6\n\tldr\tw1, [sp, 64]\n\tldr\tw0, [sp, 72]\n\tadd\tw1, w1, w0\n\tldr\tw0, [sp, 80]\n\tadd\tw0, w1, w0\n\tstr\tw0, [sp, 48]\n\tldr\tw1, [sp, 48]\n\tmov\tw0, 26215\n\tmovk\tw0, 0x6666, lsl 16\n\tsmull\tx0, w1, w0\n\tlsr\tx0, x0, 32\n\tasr\tw2, w0, 2\n\tasr\tw0, w1, 31\n\tsub\tw2, w2, w0\n\tmov\tw0, w2\n\tlsl\tw0, w0, 2\n\tadd\tw0, w0, w2\n\tlsl\tw0, w0, 1\n\tsub\tw0, w1, w0\n\tstr\tw0, [sp, 48]\n\tldr\tw1, [sp, 68]\n\tldr\tw0, [sp, 76]\n\tadd\tw1, w1, w0\n\tldr\tw0, [sp, 84]\n\tadd\tw0, w1, w0\n\tstr\tw0, [sp, 52]\n\tldr\tw1, [sp, 52]\n\tmov\tw0, 26215\n\tmovk\tw0, 0x6666, lsl 16\n\tsmull\tx0, w1, w0\n\tlsr\tx0, x0, 32\n\tasr\tw2, w0, 2\n\tasr\tw0, w1, 31\n\tsub\tw2, w2, w0\n\tmov\tw0, w2\n\tlsl\tw0, w0, 2\n\tadd\tw0, w0, w2\n\tlsl\tw0, w0, 1\n\tsub\tw0, w1, w0\n\tstr\tw0, [sp, 52]\n\tldr\tw1, [sp, 64]\n\tldr\tw0, [sp, 68]\n\tadd\tw1, w1, w0\n\tldr\tw0, [sp, 72]\n\tadd\tw1, w1, w0\n\tldr\tw0, [sp, 76]\n\tadd\tw1, w1, w0\n\tldr\tw0, [sp, 80]\n\tadd\tw1, w1, w0\n\tldr\tw0, [sp, 84]\n\tadd\tw1, w1, w0\n\tldr\tw0, [sp, 48]\n\tadd\tw0, w1, w0\n\tldr\tw1, [sp, 52]\n\tadd\tw0, w1, w0\n\tstr\tw0, [sp, 56]\n\tldr\tw0, [sp, 88]\n\tldr\tw1, [sp, 48]\n\tcmp\tw1, w0\n\tbne\t.L7\n\tldr\tw0, [sp, 92]\n\tldr\tw1, [sp, 52]\n\tcmp\tw1, w0\n\tbne\t.L7\n\tldr\tw1, [sp, 96]\n\tmov\tw0, w1\n\tlsl\tw0, w0, 2\n\tadd\tw0, w0, w1\n\tlsl\tw0, w0, 1\n\tmov\tw1, w0\n\tldr\tw0, [sp, 100]\n\tadd\tw0, w1, w0\n\tldr\tw1, [sp, 56]\n\tcmp\tw1, w0\n\tbeq\t.L8\n.L7:\n\tmov\tw0, 0\n\tb\t.L9\n.L8:\n\tmov\tw0, 1\n.L9:\n\tmov\tw1, w0\n\tadrp\tx0, :got:__stack_chk_guard\n\tldr\tx0, [x0, #:got_lo12:__stack_chk_guard]\n\tldr\tx2, [sp, 104]\n\tldr\tx3, [x0]\n\tsubs\tx2, x2, x3\n\tmov\tx3, 0\n\tbeq\t.L10\n\tbl\t__stack_chk_fail\n.L10:\n\tmov\tw0, w1\n\tldp\tx29, x30, [sp], 112\n\t.cfi_restore 30\n\t.cfi_restore 29\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global valid_serial\n.type valid_serial, %function\nvalid_serial:\n.LFB22:\n\t.cfi_startproc\n\tstp\tx29, x30, [sp, -64]!\n\t.cfi_def_cfa_offset 64\n\t.cfi_offset 29, -64\n\t.cfi_offset 30, -56\n\tadrp\tx3, :got:__stack_chk_guard\n\tmov\tx29, sp\n\tldr\tx1, [x3, #:got_lo12:__stack_chk_guard]\n\tadd\tx4, sp, 16\n\tldr\tx2, [x1]\n\tstr\tx2, [sp, 56]\n\tmov\tx2,0\n\tmov\tx1, 0\n.L3:\n\tldrb\tw2, [x0, x1]\n\tsub\tw2, w2, #48\n\tstr\tw2, [x4, x1, lsl 2]\n\tcmp\tw2, 9\n\tbhi\t.L7\n\tadd\tx1, x1, 1\n\tcmp\tx1, 10\n\tbne\t.L3\n\tldr\tw0, [sp, 16]\n\tmov\tw11, w1\n\tldr\tw9, [sp, 24]\n\tldr\tw7, [sp, 32]\n\tadd\tw2, w0, w9\n\tldr\tw5, [sp, 40]\n\tadd\tw2, w2, w7\n\tsdiv\tw4, w2, w1\n\tmsub\tw2, w4, w1, w2\n\tcmp\tw5, w2\n\tbne\t.L7\n\tldr\tw10, [sp, 20]\n\tldr\tw8, [sp, 28]\n\tldr\tw6, [sp, 36]\n\tadd\tw2, w10, w8\n\tadd\tw2, w2, w6\n\tsdiv\tw4, w2, w1\n\tmsub\tw1, w4, w1, w2\n\tldr\tw2, [sp, 44]\n\tcmp\tw2, w1\n\tbne\t.L7\n\tadd\tw0, w0, w10\n\tadd\tw0, w0, w9\n\tadd\tw0, w0, w8\n\tadd\tw0, w0, w7\n\tadd\tw0, w0, w6\n\tadd\tw0, w0, w5\n\tadd\tw0, w0, w2\n\tldp\tw1, w2, [sp, 48]\n\tmadd\tw1, w1, w11, w2\n\tcmp\tw0, w1\n\tcset\tw0, eq\n.L1:\n\tldr\tx1, [x3, #:got_lo12:__stack_chk_guard]\n\tldr\tx2, [sp, 56]\n\tldr\tx3, [x1]\n\tsubs\tx2, x2, x3\n\tmov\tx3, 0\n\tbeq\t.L4\n\tbl\t__stack_chk_fail\n.L7:\n\tmov\tw0, 0\n\tb\t.L1\n.L4:\n\tldp\tx29, x30, [sp], 64\n\t.cfi_restore 30\n\t.cfi_restore 29\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global valid_serial\n.type valid_serial, %function\nvalid_serial:\n.LFB29:\n\t.cfi_startproc\n\tldrb\tw1, [x0]\n\tsub\tw1, w1, #48\n\tcmp\tw1, 9\n\tbhi\t.L2\n\tldrb\tw5, [x0, 1]\n\tsub\tw5, w5, #48\n\tcmp\tw5, 9\n\tbhi\t.L2\n\tldrb\tw4, [x0, 2]\n\tsub\tw4, w4, #48\n\tcmp\tw4, 9\n\tbhi\t.L2\n\tldrb\tw12, [x0, 3]\n\tsub\tw12, w12, #48\n\tcmp\tw12, 9\n\tbhi\t.L2\n\tldrb\tw11, [x0, 4]\n\tsub\tw11, w11, #48\n\tcmp\tw11, 9\n\tbhi\t.L2\n\tldrb\tw10, [x0, 5]\n\tsub\tw10, w10, #48\n\tcmp\tw10, 9\n\tbhi\t.L2\n\tldrb\tw9, [x0, 6]\n\tsub\tw9, w9, #48\n\tcmp\tw9, 9\n\tbhi\t.L2\n\tldrb\tw8, [x0, 7]\n\tsub\tw8, w8, #48\n\tcmp\tw8, 9\n\tbhi\t.L2\n\tldrb\tw6, [x0, 8]\n\tsub\tw6, w6, #48\n\tcmp\tw6, 9\n\tbhi\t.L2\n\tldrb\tw2, [x0, 9]\n\tsub\tw7, w2, #48\n\tcmp\tw7, 9\n\tbhi\t.L2\n\tadd\tw3, w1, w4\n\tmov\tw2, 26215\n\tadd\tw3, w3, w11\n\tmovk\tw2, 0x6666, lsl 16\n\tsmull\tx0, w3, w2\n\tasr\tx0, x0, 34\n\tsub\tw0, w0, w3, asr 31\n\tadd\tw0, w0, w0, lsl 2\n\tsub\tw0, w3, w0, lsl 1\n\tcmp\tw0, w9\n\tbeq\t.L6\n.L2:\n\tmov\tw0, 0\n.L1:\n\tret\n\t.p2align 2,,3\n.L6:\n\tadd\tw3, w5, w12\n\tadd\tw3, w3, w10\n\tsmull\tx0, w3, w2\n\tasr\tx0, x0, 34\n\tsub\tw0, w0, w3, asr 31\n\tadd\tw0, w0, w0, lsl 2\n\tsub\tw0, w3, w0, lsl 1\n\tcmp\tw0, w8\n\tbne\t.L2\n\tadd\tw1, w1, w5\n\tadd\tw6, w6, w6, lsl 2\n\tadd\tw1, w1, w4\n\tmov\tw0, 1\n\tadd\tw1, w1, w12\n\tadd\tw2, w7, w6, lsl 1\n\tadd\tw1, w1, w11\n\tadd\tw1, w1, w10\n\tadd\tw1, w1, w9\n\tadd\tw1, w1, w8\n\tcmp\tw2, w1\n\tbeq\t.L1\n\tmov\tw0, 0\n\tb\t.L1\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdlib.h> /* Include standard library header */
#include <math.h> /* Include math library header */
#include <string.h> /* Include string function header */
#include <ctype.h> /* Include character function header */
#include <limits.h> /* define LONG_MIN and LONG_MAX */
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"uvrujj\""
],
"var": [
"carray"
]
},
{
"value": [
"\"ekxtwcrmt\""
],
"var": [
"carray"
]
},
{
"value": [
"\"h\""
],
"var": [
"carray"
]
},
{
"value": [
"\"kbpcqcckkuwrzqeaubfwvc\""
],
"var": [
"carray"
]
},
{
"value": [
"\"op\""
],
"var": [
"carray"
]
},
{
"value": [
"\"cdirdoqzqi\""
],
"var": [
"carray"
]
},
{
"value": [
"\"eoolbcjbrcitcqezfewgpj\""
],
"var": [
"carray"
]
},
{
"value": [
"\"imxe\""
],
"var": [
"carray"
]
},
{
"value": [
"\"jivzgiuvedbvaokylgktlpj\""
],
"var": [
"carray"
]
},
{
"value": [
"\"dnzrsnualqeabktaaapdrll\""
],
"var": [
"carray"
]
}
],
"output": [
{
"value": [
"\"uvrujj\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"ekxtwcrmt\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"h\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"kbpcqcckkuwrzqeaubfwvc\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"op\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"cdirdoqzqi\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"eoolbcjbrcitcqezfewgpj\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"imxe\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"jivzgiuvedbvaokylgktlpj\"",
"0"
],
"var": [
"carray",
"returnv"
]
},
{
"value": [
"\"dnzrsnualqeabktaaapdrll\"",
"0"
],
"var": [
"carray",
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_44tyhg3423.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* carray, int returnv) {
json output_json;
output_json["carray"] = carray;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* carray = strdup(input_json["carray"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = valid_serial(carray);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(carray, returnv);
}
|
master
|
null
|
{"livein": ["carray"], "liveout": ["carray"], "returnvarname": ["returnv"], "execcmd": "", "funname": "valid_serial", "funargs": ["carray"], "typemap": {"carray": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_44tyhg3423.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
NEWPLAN/books/osask/omake/tolsrc/go_0023s/go_lib/strcmp.c
|
int GO_strcmp (char *d, char *s)
{
while ('\0' != *d) {
if (*d != *s)
return *d - *s;
d++;
s++;
}
return *d - *s;
}
|
int GO_strcmp(char *d, char *s)
|
int GO_strcmp (char *d, char *s)
|
GO_strcmp
|
[
"int",
"char *",
"char *"
] |
{
"code": [
".globl GO_strcmp\n.type GO_strcmp, @function\nGO_strcmp:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L3\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tjmp\t.L4\n.L3:\n\taddq\t$1, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L2:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n.L4:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl GO_strcmp\n.type GO_strcmp, @function\nGO_strcmp:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%ecx, %ecx\n.L2:\n\tmovsbl\t(%rdi,%rcx), %eax\n\tmovsbl\t(%rsi,%rcx), %edx\n\ttestb\t%al, %al\n\tje\t.L7\n\tincq\t%rcx\n\tcmpb\t%dl, %al\n\tje\t.L2\n\tsubl\t%edx, %eax\n\tret\n.L7:\n\tmovsbl\t%dl, %eax\n\tnegl\t%eax\n\tret\n\t.cfi_endproc\n\n",
".globl GO_strcmp\n.type GO_strcmp, @function\nGO_strcmp:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovsbl\t(%rsi), %edx\n\tcmpb\t%al, %dl\n\tjne\t.L12\n\taddq\t$1, %rdi\n\taddq\t$1, %rsi\n.L10:\n\tmovsbl\t(%rdi), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n\tmovsbl\t(%rsi), %eax\n\tnegl\t%eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tsubl\t%edx, %eax\n\tret\n\t.cfi_endproc\n\n",
".global GO_strcmp\n.type GO_strcmp, %function\nGO_strcmp:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstr\tx0, [sp, 8]\n\tstr\tx1, [sp]\n\tb\t.L2\n.L5:\n\tldr\tx0, [sp, 8]\n\tldrb\tw1, [x0]\n\tldr\tx0, [sp]\n\tldrb\tw0, [x0]\n\tcmp\tw1, w0\n\tbeq\t.L3\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tmov\tw1, w0\n\tldr\tx0, [sp]\n\tldrb\tw0, [x0]\n\tsub\tw0, w1, w0\n\tb\t.L4\n.L3:\n\tldr\tx0, [sp, 8]\n\tadd\tx0, x0, 1\n\tstr\tx0, [sp, 8]\n\tldr\tx0, [sp]\n\tadd\tx0, x0, 1\n\tstr\tx0, [sp]\n.L2:\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tmov\tw1, w0\n\tldr\tx0, [sp]\n\tldrb\tw0, [x0]\n\tsub\tw0, w1, w0\n.L4:\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global GO_strcmp\n.type GO_strcmp, %function\nGO_strcmp:\n.LFB0:\n\t.cfi_startproc\n\tmov\tx3, 0\n.L2:\n\tldrb\tw4, [x0, x3]\n\tldrb\tw2, [x1, x3]\n\tcbnz\tw4, .L4\n\tneg\tw0, w2\n\tb\t.L1\n.L4:\n\tadd\tx3, x3, 1\n\tcmp\tw4, w2\n\tbeq\t.L2\n\tsub\tw0, w4, w2\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".global GO_strcmp\n.type GO_strcmp, %function\nGO_strcmp:\n.LFB0:\n\t.cfi_startproc\n\tldrb\tw2, [x0]\n\tcbnz\tw2, .L5\n\tb\t.L2\n\t.p2align 2,,3\n.L3:\n\tldrb\tw2, [x0, 1]!\n\tcbz\tw2, .L2\n.L5:\n\tldrb\tw3, [x1]\n\tadd\tx1, x1, 1\n\tcmp\tw3, w2\n\tbeq\t.L3\n\tsub\tw0, w2, w3\n\tret\n\t.p2align 2,,3\n.L2:\n\tldrb\tw0, [x1]\n\tneg\tw0, w0\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stddef.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"rcabex\"",
"\"ortuoehlizvtqbrvo\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"yaqgwocdfiahmxutmxbkbtume\"",
"\"yosxpfiliyektikrwgsvwjarpjecwf\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"kaianwqmftpcpckzx\"",
"\"cikjhswipbxr\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"psyhbwfjqymhrnekd\"",
"\"fsvmjqtzqobcfczscvkoqsh\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"hbdjynacwvbvlhhvtztoqzsudamflf\"",
"\"rvxsvefsnidg\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"\"",
"\"cvlxmyawolddjmuofptilsnk\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"owjnkc\"",
"\"sbirdjjmmsaphnmpon\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"romcbbn\"",
"\"x\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"yzukjvrwqwcfhsbmmkg\"",
"\"biyozarirepqq\""
],
"var": [
"d",
"s"
]
},
{
"value": [
"\"dfvgn\"",
"\"pwqgwgzdwtcf\""
],
"var": [
"d",
"s"
]
}
],
"output": [
{
"value": [
"\"rcabex\"",
"3",
"\"ortuoehlizvtqbrvo\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"yaqgwocdfiahmxutmxbkbtume\"",
"-14",
"\"yosxpfiliyektikrwgsvwjarpjecwf\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"kaianwqmftpcpckzx\"",
"8",
"\"cikjhswipbxr\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"psyhbwfjqymhrnekd\"",
"10",
"\"fsvmjqtzqobcfczscvkoqsh\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"hbdjynacwvbvlhhvtztoqzsudamflf\"",
"-10",
"\"rvxsvefsnidg\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"\"",
"-99",
"\"cvlxmyawolddjmuofptilsnk\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"owjnkc\"",
"-4",
"\"sbirdjjmmsaphnmpon\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"romcbbn\"",
"-6",
"\"x\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"yzukjvrwqwcfhsbmmkg\"",
"23",
"\"biyozarirepqq\""
],
"var": [
"d",
"returnv",
"s"
]
},
{
"value": [
"\"dfvgn\"",
"-12",
"\"pwqgwgzdwtcf\""
],
"var": [
"d",
"returnv",
"s"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_51fz277x0t.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* d, char* s, int returnv) {
json output_json;
output_json["d"] = d;
output_json["s"] = s;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* d = strdup(input_json["d"].get<std::string>().c_str());
char* s = strdup(input_json["s"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = GO_strcmp(d, s);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(d, s, returnv);
}
|
master
|
null
|
{"livein": ["d", "s"], "liveout": ["d", "s"], "returnvarname": ["returnv"], "execcmd": "", "funname": "GO_strcmp", "funargs": ["d", "s"], "typemap": {"d": "string", "s": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_51fz277x0t.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
gdarko/CProgrammingExercises/zbirka_2/datoteki/zad_383.c
|
int isspec(char c)
{
return (((c >= '!') && (c <= '/')) || (c >= ':' && c <= '@') || ((c >= '[') && (c <= '`')) || ((c >= '{') && (c <= 'DEL')));
}
|
int isspec(charc)
|
int isspec(char c)
|
isspec
|
[
"int",
"char"
] |
{
"code": [
".globl isspec\n.type isspec, @function\nisspec:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, %eax\n\tmovb\t%al, -4(%rbp)\n\tcmpb\t$32, -4(%rbp)\n\tjle\t.L2\n\tcmpb\t$47, -4(%rbp)\n\tjle\t.L3\n.L2:\n\tcmpb\t$57, -4(%rbp)\n\tjle\t.L4\n\tcmpb\t$64, -4(%rbp)\n\tjle\t.L3\n.L4:\n\tcmpb\t$90, -4(%rbp)\n\tjle\t.L5\n\tcmpb\t$96, -4(%rbp)\n\tjle\t.L3\n.L5:\n\tcmpb\t$122, -4(%rbp)\n\tjle\t.L6\n.L3:\n\tmovl\t$1, %eax\n\tjmp\t.L8\n.L6:\n\tmovl\t$0, %eax\n.L8:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl isspec\n.type isspec, @function\nisspec:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tleal\t-33(%rdi), %edx\n\tcmpb\t$63, %dl\n\tja\t.L2\n\tmovabsq\t$-288230371890266113, %rcx\n\tmovl\t$1, %eax\n\tbtq\t%rdx, %rcx\n\tjc\t.L1\n.L2:\n\txorl\t%eax, %eax\n\tcmpb\t$122, %dil\n\tsetg\t%al\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl isspec\n.type isspec, @function\nisspec:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tleal\t-33(%rdi), %eax\n\tcmpb\t$63, %al\n\tja\t.L2\n\tmovabsq\t$-288230371890266113, %rdx\n\tmovl\t$1, %r8d\n\tbtq\t%rax, %rdx\n\tjnc\t.L2\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\txorl\t%r8d, %r8d\n\tcmpb\t$122, %dil\n\tsetg\t%r8b\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".global isspec\n.type isspec, %function\nisspec:\n.LFB6:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstrb\tw0, [sp, 15]\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 32\n\tbls\t.L2\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 47\n\tbls\t.L3\n.L2:\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 57\n\tbls\t.L4\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 64\n\tbls\t.L3\n.L4:\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 90\n\tbls\t.L5\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 96\n\tbls\t.L3\n.L5:\n\tldrb\tw0, [sp, 15]\n\tcmp\tw0, 122\n\tbls\t.L6\n.L3:\n\tmov\tw0, 1\n\tb\t.L8\n.L6:\n\tmov\tw0, 0\n.L8:\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global isspec\n.type isspec, %function\nisspec:\n.LFB35:\n\t.cfi_startproc\n\tand\tw0, w0, 255\n\tsub\tw1, w0, #33\n\tand\tw1, w1, 255\n\tcmp\tw1, 63\n\tbhi\t.L2\n\tmov\tw2, 4261445631\n\tmovk\tx2, 0xfc00, lsl 48\n\tlsr\tx1, x2, x1\n\ttbnz\tx1, 0, .L4\n.L2:\n\tcmp\tw0, 122\n\tcset\tw0, hi\n.L1:\n\tret\n.L4:\n\tmov\tw0, 1\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global isspec\n.type isspec, %function\nisspec:\n.LFB52:\n\t.cfi_startproc\n\tand\tw0, w0, 255\n\tsub\tw2, w0, #33\n\tsub\tw1, w0, #58\n\tand\tw2, w2, 255\n\tand\tw1, w1, 255\n\tcmp\tw2, 14\n\tccmp\tw1, 6, 0, hi\n\tbls\t.L3\n\tsub\tw1, w0, #91\n\tcmp\tw0, 122\n\tand\tw1, w1, 255\n\tccmp\tw1, 5, 0, ls\n\tcset\tw0, ls\n\tret\n\t.p2align 2,,3\n.L3:\n\tmov\tw0, 1\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"69"
],
"var": [
"c"
]
},
{
"value": [
"82"
],
"var": [
"c"
]
},
{
"value": [
"100"
],
"var": [
"c"
]
},
{
"value": [
"108"
],
"var": [
"c"
]
},
{
"value": [
"119"
],
"var": [
"c"
]
},
{
"value": [
"109"
],
"var": [
"c"
]
},
{
"value": [
"91"
],
"var": [
"c"
]
},
{
"value": [
"83"
],
"var": [
"c"
]
},
{
"value": [
"108"
],
"var": [
"c"
]
},
{
"value": [
"91"
],
"var": [
"c"
]
}
],
"output": [
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_35bvkd2_kn.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char c, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char c = input_json["c"].get<char>();
clock_t begin = clock();
int returnv = isspec(c);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(c, returnv);
}
|
master
|
null
|
{"livein": ["c"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "isspec", "funargs": ["c"], "typemap": {"c": "int8", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_35bvkd2_kn.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
joa-quim/GMT5SAR/preproc/S1A_preproc/lib/xml.c
|
int cat_nums(char *str_out, char *str){
int i=0,j=0;
while(str[i]!='\0'){
if(str[i] >= '0' && str[i] <= '9'){
str_out[j++] = str[i];
}
i++;
}
str_out[j] = '\0';
return(j);
}
|
int cat_nums(char *str_out, char *str)
|
int cat_nums(char *str_out, char *str)
|
cat_nums
|
[
"int",
"char *",
"char *"
] |
{
"code": [
".globl cat_nums\n.type cat_nums, @function\ncat_nums:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$47, %al\n\tjle\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$57, %al\n\tjg\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovzbl\t(%rcx), %eax\n\tmovb\t%al, (%rdx)\n.L3:\n\taddl\t$1, -8(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovb\t$0, (%rax)\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl cat_nums\n.type cat_nums, @function\ncat_nums:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n.L2:\n\tmovb\t(%rsi), %cl\n\tmovslq\t%eax, %rdx\n\taddq\t%rdi, %rdx\n\ttestb\t%cl, %cl\n\tje\t.L6\n\tleal\t-48(%rcx), %r8d\n\tcmpb\t$9, %r8b\n\tja\t.L3\n\tmovb\t%cl, (%rdx)\n\tincl\t%eax\n.L3:\n\tincq\t%rsi\n\tjmp\t.L2\n.L6:\n\tmovb\t$0, (%rdx)\n\tret\n\t.cfi_endproc\n\n",
".globl cat_nums\n.type cat_nums, @function\ncat_nums:\n.LFB50:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %eax\n\ttestb\t%al, %al\n\tje\t.L7\n\taddq\t$1, %rsi\n\txorl\t%r9d, %r9d\n\txorl\t%ecx, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tleal\t-48(%rax), %r8d\n\tleaq\t(%rdi,%rcx), %rdx\n\tcmpb\t$9, %r8b\n\tja\t.L3\n\taddq\t$1, %rsi\n\tmovb\t%al, (%rdx)\n\taddl\t$1, %r9d\n\tmovzbl\t-1(%rsi), %eax\n\tmovslq\t%r9d, %rcx\n\tleaq\t(%rdi,%rcx), %rdx\n\ttestb\t%al, %al\n\tjne\t.L6\n\tmovb\t$0, (%rdx)\n\tmovl\t%r9d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovzbl\t(%rsi), %eax\n\taddq\t$1, %rsi\n\ttestb\t%al, %al\n\tjne\t.L6\n\tmovb\t$0, (%rdx)\n\tmovl\t%r9d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovq\t%rdi, %rdx\n\txorl\t%r9d, %r9d\n\tmovb\t$0, (%rdx)\n\tmovl\t%r9d, %eax\n\tret\n\t.cfi_endproc\n\n",
".global cat_nums\n.type cat_nums, %function\ncat_nums:\n.LFB6:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tx0, [sp, 8]\n\tstr\tx1, [sp]\n\tstr\twzr, [sp, 24]\n\tstr\twzr, [sp, 28]\n\tb\t.L2\n.L4:\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 47\n\tbls\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 57\n\tbhi\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp]\n\tadd\tx1, x1, x0\n\tldr\tw0, [sp, 28]\n\tadd\tw2, w0, 1\n\tstr\tw2, [sp, 28]\n\tsxtw\tx0, w0\n\tldr\tx2, [sp, 8]\n\tadd\tx0, x2, x0\n\tldrb\tw1, [x1]\n\tstrb\tw1, [x0]\n.L3:\n\tldr\tw0, [sp, 24]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 24]\n.L2:\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L4\n\tldrsw\tx0, [sp, 28]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tstrb\twzr, [x0]\n\tldr\tw0, [sp, 28]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global cat_nums\n.type cat_nums, %function\ncat_nums:\n.LFB35:\n\t.cfi_startproc\n\tmov\tx2, x0\n\tmov\tw0, 0\n.L2:\n\tldrb\tw3, [x1]\n\tsxtw\tx5, w0\n\tadd\tx4, x2, x0, sxtw\n\tcbnz\tw3, .L4\n\tstrb\twzr, [x4]\n\tret\n.L4:\n\tsub\tw4, w3, #48\n\tand\tw4, w4, 255\n\tcmp\tw4, 9\n\tbhi\t.L3\n\tadd\tw0, w0, 1\n\tstrb\tw3, [x2, x5]\n.L3:\n\tadd\tx1, x1, 1\n\tb\t.L2\n\t.cfi_endproc\n\n",
".global cat_nums\n.type cat_nums, %function\ncat_nums:\n.LFB50:\n\t.cfi_startproc\n\tldrb\tw2, [x1]\n\tmov\tx5, x0\n\tcbz\tw2, .L7\n\tadd\tx3, x1, 1\n\tmov\tw0, 0\n\tmov\tx4, 0\n\t.p2align 3,,7\n.L6:\n\tsub\tw1, w2, #48\n\tadd\tx6, x5, x4\n\tand\tw1, w1, 255\n\tcmp\tw1, 9\n\tbhi\t.L3\n\tstrb\tw2, [x5, x4]\n\tadd\tw0, w0, 1\n\tldrb\tw2, [x3], 1\n\tsxtw\tx4, w0\n\tadd\tx6, x5, x4\n\tcbnz\tw2, .L6\n\tstrb\twzr, [x6]\n\tret\n\t.p2align 2,,3\n.L3:\n\tldrb\tw2, [x3], 1\n\tcbnz\tw2, .L6\n\tstrb\twzr, [x6]\n\tret\n\t.p2align 2,,3\n.L7:\n\tmov\tx6, x0\n\tmov\tw0, 0\n\tstrb\twzr, [x6]\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"igbdxnvcqjzqy\"",
"\"ulyyofluc\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"fjpbfigoejdhxfzzz\"",
"\"lyiswmdcufuigvbrhjkclapg\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"qeuebuxwmhjgsonhmj\"",
"\"ebzxwnbl\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"rhwrftrituavguzufitookasrr\"",
"\"flwyfiubmbznlgyuhfsbsrwd\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"vdtwgx\"",
"\"wmqtpbfuilklmhobyrxmuchtvq\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"tbchmjdkaaupaxmazvxmpgcbmb\"",
"\"cquyipqnhgm\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"ncpzauvgyckgvxhheqirzwlkzxpcd\"",
"\"zlkfb\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"ybyuersmlrnltwbffqddqmqgm\"",
"\"qplbzbgmqjwrflsyzfo\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"xcgsrvlsouwphegscfcwnz\"",
"\"bbysvkwookldfluweclqbaccullvufg\""
],
"var": [
"str_out",
"str"
]
},
{
"value": [
"\"\"",
"\"gtuqtorspijbyn\""
],
"var": [
"str_out",
"str"
]
}
],
"output": [
{
"value": [
"0",
"\"ulyyofluc\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"lyiswmdcufuigvbrhjkclapg\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"ebzxwnbl\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"flwyfiubmbznlgyuhfsbsrwd\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"wmqtpbfuilklmhobyrxmuchtvq\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"cquyipqnhgm\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"zlkfb\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"qplbzbgmqjwrflsyzfo\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"bbysvkwookldfluweclqbaccullvufg\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
},
{
"value": [
"0",
"\"gtuqtorspijbyn\"",
"\"\""
],
"var": [
"returnv",
"str",
"str_out"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_59v8yufbak.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* str_out, char* str, int returnv) {
json output_json;
output_json["str_out"] = str_out;
output_json["str"] = str;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* str_out = strdup(input_json["str_out"].get<std::string>().c_str());
char* str = strdup(input_json["str"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = cat_nums(str_out, str);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(str_out, str, returnv);
}
|
master
|
null
|
{"livein": ["str_out", "str"], "liveout": ["str_out", "str"], "returnvarname": ["returnv"], "execcmd": "", "funname": "cat_nums", "funargs": ["str_out", "str"], "typemap": {"str_out": "string", "str": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_59v8yufbak.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
shehan492/C_programs/pdslab/day1/cs1803-day1-prog1.c
|
int countVowels(char *str)
{
int i,count=0;
for(i=0;str[i]!='\0';++i)
if('a' == str[i] ||
'e' == str[i] ||
'i' == str[i] ||
'o' == str[i] ||
'u' == str[i] ||
'A' == str[i] ||
'E' == str[i] ||
'I' == str[i] ||
'O' == str[i] ||
'U' == str[i] )
count++;
return count;
}
|
int countVowels(char *str)
|
int countVowels(char *str)
|
countVowels
|
[
"int",
"char *"
] |
{
"code": [
".globl countVowels\n.type countVowels, @function\ncountVowels:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$97, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$101, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$105, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$111, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$117, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$65, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$69, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$73, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$79, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$85, %al\n\tjne\t.L4\n.L3:\n\taddl\t$1, -4(%rbp)\n.L4:\n\taddl\t$1, -8(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl countVowels\n.type countVowels, @function\ncountVowels:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tmovabsq\t$4575140898685201, %rdx\n\txorl\t%r8d, %r8d\n.L2:\n\tmovb\t(%rdi), %cl\n\ttestb\t%cl, %cl\n\tje\t.L6\n\tsubl\t$65, %ecx\n\tcmpb\t$52, %cl\n\tja\t.L3\n\tmovq\t%rdx, %rax\n\tshrq\t%cl, %rax\n\tnotq\t%rax\n\tandl\t$1, %eax\n\tcmpb\t$1, %al\n\tadcl\t$0, %r8d\n.L3:\n\tincq\t%rdi\n\tjmp\t.L2\n.L6:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".globl countVowels\n.type countVowels, @function\ncountVowels:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rdi), %ecx\n\ttestb\t%cl, %cl\n\tje\t.L5\n\taddq\t$1, %rdi\n\txorl\t%r8d, %r8d\n\tmovabsq\t$4575140898685201, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tsubl\t$65, %ecx\n\tcmpb\t$52, %cl\n\tja\t.L3\n\tmovq\t%rdx, %rax\n\tshrq\t%cl, %rax\n\tnotq\t%rax\n\tandl\t$1, %eax\n\tcmpb\t$1, %al\n\tadcl\t$0, %r8d\n.L3:\n\tmovzbl\t(%rdi), %ecx\n\taddq\t$1, %rdi\n\ttestb\t%cl, %cl\n\tjne\t.L4\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\txorl\t%r8d, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".global countVowels\n.type countVowels, %function\ncountVowels:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tx0, [sp, 8]\n\tstr\twzr, [sp, 28]\n\tstr\twzr, [sp, 24]\n\tb\t.L2\n.L5:\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 97\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 101\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 105\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 111\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 117\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 65\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 69\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 73\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 79\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 85\n\tbne\t.L4\n.L3:\n\tldr\tw0, [sp, 28]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 28]\n.L4:\n\tldr\tw0, [sp, 24]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 24]\n.L2:\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n\tldr\tw0, [sp, 28]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global countVowels\n.type countVowels, %function\ncountVowels:\n.LFB13:\n\t.cfi_startproc\n\tmov\tx3, 16657\n\tmov\tx2, x0\n\tmovk\tx3, 0x10, lsl 16\n\tmov\tw0, 0\n\tmovk\tx3, 0x4111, lsl 32\n\tmovk\tx3, 0x10, lsl 48\n.L2:\n\tldrb\tw1, [x2]\n\tcbnz\tw1, .L4\n\tret\n.L4:\n\tsub\tw1, w1, #65\n\tand\tw1, w1, 255\n\tcmp\tw1, 52\n\tbhi\t.L3\n\tlsr\tx1, x3, x1\n\tand\tw1, w1, 1\n\tadd\tw0, w0, w1\n.L3:\n\tadd\tx2, x2, 1\n\tb\t.L2\n\t.cfi_endproc\n\n",
".global countVowels\n.type countVowels, %function\ncountVowels:\n.LFB23:\n\t.cfi_startproc\n\tldrb\tw1, [x0]\n\tcbz\tw1, .L5\n\tadd\tx4, x0, 1\n\tmov\tw7, -37\n\tmov\tw0, 0\n\tmov\tw6, 73\n\tmov\tw5, 79\n\t.p2align 3,,7\n.L4:\n\tand\tw2, w1, w7\n\tand\tw3, w1, -33\n\tcmp\tw2, 65\n\tldrb\tw1, [x4], 1\n\tccmp\tw3, w6, 4, ne\n\tcset\tw2, eq\n\tcmp\tw3, 85\n\tccmp\tw3, w5, 4, ne\n\tcsinc\tw2, w2, wzr, ne\n\tadd\tw0, w0, w2\n\tcbnz\tw1, .L4\n\tret\n\t.p2align 2,,3\n.L5:\n\tmov\tw0, 0\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"zxwcljdbsyizzobsjazqoqnmmfmh\""
],
"var": [
"str"
]
},
{
"value": [
"\"tdyotmzhvkzhyzcfipwsgeu\""
],
"var": [
"str"
]
},
{
"value": [
"\"inunekttlofermfetrmhjwsjabpur\""
],
"var": [
"str"
]
},
{
"value": [
"\"jraqhhzaboagm\""
],
"var": [
"str"
]
},
{
"value": [
"\"ucaopzsdbjhergblzxxmrwxyrgosn\""
],
"var": [
"str"
]
},
{
"value": [
"\"pesoxuparbswrbnvheouj\""
],
"var": [
"str"
]
},
{
"value": [
"\"ozzodlvcg\""
],
"var": [
"str"
]
},
{
"value": [
"\"qechnidrhkenfx\""
],
"var": [
"str"
]
},
{
"value": [
"\"lyqqbjjygivquqdgsgp\""
],
"var": [
"str"
]
},
{
"value": [
"\"zvjcouevfwwhpzrmimvtkxcxpqcduyv\""
],
"var": [
"str"
]
}
],
"output": [
{
"value": [
"4",
"\"zxwcljdbsyizzobsjazqoqnmmfmh\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"4",
"\"tdyotmzhvkzhyzcfipwsgeu\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"8",
"\"inunekttlofermfetrmhjwsjabpur\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"4",
"\"jraqhhzaboagm\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"5",
"\"ucaopzsdbjhergblzxxmrwxyrgosn\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"7",
"\"pesoxuparbswrbnvheouj\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"2",
"\"ozzodlvcg\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"3",
"\"qechnidrhkenfx\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"2",
"\"lyqqbjjygivquqdgsgp\""
],
"var": [
"returnv",
"str"
]
},
{
"value": [
"5",
"\"zvjcouevfwwhpzrmimvtkxcxpqcduyv\""
],
"var": [
"returnv",
"str"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_61heo1kpe_.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* str, int returnv) {
json output_json;
output_json["str"] = str;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* str = strdup(input_json["str"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = countVowels(str);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(str, returnv);
}
|
master
|
null
|
{"livein": ["str"], "liveout": ["str"], "returnvarname": ["returnv"], "execcmd": "", "funname": "countVowels", "funargs": ["str"], "typemap": {"str": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_61heo1kpe_.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
IAmAnubhavSaini/blog-posts/c/hcf_via_euclids_division_algorithm.c
|
int hcf_iterative(int a, int b){
int q, r;
if(a > 0 && b > 0){
if(a < b)
return hcf_iterative(b, a);
q = a / b;
r = a % b;
while(r != 0 && r != 1){
a = b;
b = r;
q = a / b;
r = a % b;
}
if(r == 0)
return b;
else if(r == 1)
return 1;
}
return -1;
}
|
int hcf_iterative(inta, intb)
|
int hcf_iterative(int a, int b)
|
hcf_iterative
|
[
"int",
"int",
"int"
] |
{
"code": [
".globl hcf_iterative\n.type hcf_iterative, @function\nhcf_iterative:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tcmpl\t$0, -20(%rbp)\n\tjle\t.L2\n\tcmpl\t$0, -24(%rbp)\n\tjle\t.L2\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjge\t.L3\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\thcf_iterative\n\tjmp\t.L4\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -8(%rbp)\n\tjmp\t.L5\n.L7:\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -8(%rbp)\n.L5:\n\tcmpl\t$0, -8(%rbp)\n\tje\t.L6\n\tcmpl\t$1, -8(%rbp)\n\tjne\t.L7\n.L6:\n\tcmpl\t$0, -8(%rbp)\n\tjne\t.L8\n\tmovl\t-24(%rbp), %eax\n\tjmp\t.L4\n.L8:\n\tcmpl\t$1, -8(%rbp)\n\tjne\t.L2\n\tmovl\t$1, %eax\n\tjmp\t.L4\n.L2:\n\tmovl\t$-1, %eax\n.L4:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl hcf_iterative\n.type hcf_iterative, @function\nhcf_iterative:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %r8d\n.L3:\n\ttestl\t%eax, %eax\n\tjle\t.L6\n\ttestl\t%r8d, %r8d\n\tjle\t.L6\n\tcmpl\t%r8d, %eax\n\tjge\t.L18\n\tmovl\t%eax, %edx\n\tmovl\t%r8d, %eax\n\tmovl\t%edx, %r8d\n\tjmp\t.L3\n.L18:\n\tcltd\n\tidivl\t%r8d\n.L16:\n\tmovl\t%edx, %edi\n\tcmpl\t$1, %edx\n\tjle\t.L19\n\tmovl\t%r8d, %eax\n\tmovl\t%edi, %r8d\n\tcltd\n\tidivl\t%edi\n\tjmp\t.L16\n.L19:\n\ttestl\t%edx, %edx\n\tmovl\t$1, %eax\n\tcmovne\t%eax, %r8d\n\tjmp\t.L1\n.L6:\n\torl\t$-1, %r8d\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".globl hcf_iterative\n.type hcf_iterative, @function\nhcf_iterative:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %edi\n\tmovl\t%edx, %esi\n.L3:\n\ttestl\t%edi, %edi\n\tjle\t.L6\n\ttestl\t%esi, %esi\n\tjle\t.L6\n\tcmpl\t%esi, %edi\n\tjl\t.L7\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\tcmpl\t$1, %edx\n\tjle\t.L8\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t%esi, %eax\n\tmovl\t%edx, %r8d\n\tcltd\n\tmovl\t%r8d, %esi\n\tidivl\t%r8d\n\tcmpl\t$1, %edx\n\tjg\t.L5\n.L4:\n\ttestl\t%edx, %edx\n\tcmovne\t%edx, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovl\t$-1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n.L8:\n\tmovl\t%esi, %r8d\n\tjmp\t.L4\n\t.cfi_endproc\n\n",
".global hcf_iterative\n.type hcf_iterative, %function\nhcf_iterative:\n.LFB0:\n\t.cfi_startproc\n\tstp\tx29, x30, [sp, -48]!\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 29, -48\n\t.cfi_offset 30, -40\n\tmov\tx29, sp\n\tstr\tw0, [sp, 28]\n\tstr\tw1, [sp, 24]\n\tldr\tw0, [sp, 28]\n\tcmp\tw0, 0\n\tble\t.L2\n\tldr\tw0, [sp, 24]\n\tcmp\tw0, 0\n\tble\t.L2\n\tldr\tw1, [sp, 28]\n\tldr\tw0, [sp, 24]\n\tcmp\tw1, w0\n\tbge\t.L3\n\tldr\tw1, [sp, 28]\n\tldr\tw0, [sp, 24]\n\tbl\thcf_iterative\n\tb\t.L4\n.L3:\n\tldr\tw1, [sp, 28]\n\tldr\tw0, [sp, 24]\n\tsdiv\tw0, w1, w0\n\tstr\tw0, [sp, 44]\n\tldr\tw0, [sp, 28]\n\tldr\tw1, [sp, 24]\n\tsdiv\tw2, w0, w1\n\tldr\tw1, [sp, 24]\n\tmul\tw1, w2, w1\n\tsub\tw0, w0, w1\n\tstr\tw0, [sp, 40]\n\tb\t.L5\n.L7:\n\tldr\tw0, [sp, 24]\n\tstr\tw0, [sp, 28]\n\tldr\tw0, [sp, 40]\n\tstr\tw0, [sp, 24]\n\tldr\tw1, [sp, 28]\n\tldr\tw0, [sp, 24]\n\tsdiv\tw0, w1, w0\n\tstr\tw0, [sp, 44]\n\tldr\tw0, [sp, 28]\n\tldr\tw1, [sp, 24]\n\tsdiv\tw2, w0, w1\n\tldr\tw1, [sp, 24]\n\tmul\tw1, w2, w1\n\tsub\tw0, w0, w1\n\tstr\tw0, [sp, 40]\n.L5:\n\tldr\tw0, [sp, 40]\n\tcmp\tw0, 0\n\tbeq\t.L6\n\tldr\tw0, [sp, 40]\n\tcmp\tw0, 1\n\tbne\t.L7\n.L6:\n\tldr\tw0, [sp, 40]\n\tcmp\tw0, 0\n\tbne\t.L8\n\tldr\tw0, [sp, 24]\n\tb\t.L4\n.L8:\n\tldr\tw0, [sp, 40]\n\tcmp\tw0, 1\n\tbne\t.L2\n\tmov\tw0, 1\n\tb\t.L4\n.L2:\n\tmov\tw0, -1\n.L4:\n\tldp\tx29, x30, [sp], 48\n\t.cfi_restore 30\n\t.cfi_restore 29\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global hcf_iterative\n.type hcf_iterative, %function\nhcf_iterative:\n.LFB13:\n\t.cfi_startproc\n.L10:\n\tmov\tw2, w0\n\tmov\tw0, w1\n\tcmp\tw2, 0\n\tccmp\tw1, 0, 4, gt\n\tble\t.L6\n\tcmp\tw2, w1\n\tblt\t.L7\n\tsdiv\tw1, w2, w1\n\tmsub\tw1, w1, w0, w2\n.L4:\n\tcmp\tw1, 1\n\tbgt\t.L5\n\tcmp\tw1, 0\n\tcsinc\tw0, w0, wzr, eq\n.L1:\n\tret\n.L7:\n\tmov\tw1, w2\n\tb\t.L10\n.L5:\n\tudiv\tw2, w0, w1\n\tmsub\tw2, w2, w1, w0\n\tmov\tw0, w1\n\tmov\tw1, w2\n\tb\t.L4\n.L6:\n\tmov\tw0, -1\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global hcf_iterative\n.type hcf_iterative, %function\nhcf_iterative:\n.LFB23:\n\t.cfi_startproc\n\tb\t.L3\n\t.p2align 2,,3\n.L14:\n\tcmp\tw0, w1\n\tbge\t.L13\n\tmov\tw0, w1\n\tmov\tw1, w2\n.L3:\n\tcmp\tw0, 0\n\tmov\tw2, w0\n\tccmp\tw1, 0, 4, gt\n\tbgt\t.L14\n\tmov\tw0, -1\n\tret\n\t.p2align 2,,3\n.L13:\n\tsdiv\tw2, w0, w1\n\tmsub\tw2, w2, w1, w0\n\tcmp\tw2, 1\n\tble\t.L8\n\t.p2align 3,,7\n.L5:\n\tudiv\tw3, w1, w2\n\tmov\tw0, w2\n\tmsub\tw2, w3, w2, w1\n\tmov\tw1, w0\n\tcmp\tw2, 1\n\tbgt\t.L5\n.L4:\n\tcmp\tw2, 0\n\tcsel\tw0, w0, w2, eq\n\tret\n.L8:\n\tmov\tw0, w1\n\tb\t.L4\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"23",
"55"
],
"var": [
"a",
"b"
]
},
{
"value": [
"67",
"93"
],
"var": [
"a",
"b"
]
},
{
"value": [
"87",
"6"
],
"var": [
"a",
"b"
]
},
{
"value": [
"87",
"5"
],
"var": [
"a",
"b"
]
},
{
"value": [
"98",
"107"
],
"var": [
"a",
"b"
]
},
{
"value": [
"106",
"84"
],
"var": [
"a",
"b"
]
},
{
"value": [
"118",
"108"
],
"var": [
"a",
"b"
]
},
{
"value": [
"122",
"84"
],
"var": [
"a",
"b"
]
},
{
"value": [
"91",
"4"
],
"var": [
"a",
"b"
]
},
{
"value": [
"69",
"88"
],
"var": [
"a",
"b"
]
}
],
"output": [
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"2"
],
"var": [
"returnv"
]
},
{
"value": [
"2"
],
"var": [
"returnv"
]
},
{
"value": [
"2"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_45dbgpeq0i.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int a, int b, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int a = input_json["a"];
int b = input_json["b"];
clock_t begin = clock();
int returnv = hcf_iterative(a, b);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(a, b, returnv);
}
|
master
|
null
|
{"livein": ["a", "b"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "hcf_iterative", "funargs": ["a", "b"], "typemap": {"a": "int32", "b": "int32", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_45dbgpeq0i.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
michalis-/rcu/valtree/v3.19/fake_sched.h
|
unsigned long int_sqrt(unsigned long x)
{
unsigned long b, m, y = 0;
if (x <= 1)
return x;
m = 1UL << ((sizeof(long) * 8) - 2);
while (m != 0) {
b = y + m;
y >>= 1;
if (x >= b) {
x -= b;
y += m;
}
m >>= 2;
}
return y;
}
|
unsigned long int_sqrt(unsigned longx)
|
unsigned long int_sqrt(unsigned long x)
|
int_sqrt
|
[
"unsigned long",
"unsigned long"
] |
{
"code": [
".globl int_sqrt\n.type int_sqrt, @function\nint_sqrt:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t$0, -16(%rbp)\n\tcmpq\t$1, -40(%rbp)\n\tja\t.L2\n\tmovq\t-40(%rbp), %rax\n\tjmp\t.L3\n.L2:\n\tmovabsq\t$4611686018427387904, %rax\n\tmovq\t%rax, -24(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tshrq\t-16(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjb\t.L5\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%rax, -40(%rbp)\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, -16(%rbp)\n.L5:\n\tshrq\t$2, -24(%rbp)\n.L4:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L6\n\tmovq\t-16(%rbp), %rax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl int_sqrt\n.type int_sqrt, @function\nint_sqrt:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcmpq\t$1, %rdi\n\tjbe\t.L2\n\tmovl\t$1, %edx\n\tmovq\t%rdi, %rsi\n\tmovl\t$32, %ecx\n\txorl\t%eax, %eax\n\tsalq\t$62, %rdx\n.L4:\n\tleaq\t(%rdx,%rax), %rdi\n\tshrq\t%rax\n\tcmpq\t%rsi, %rdi\n\tja\t.L3\n\tsubq\t%rdi, %rsi\n\taddq\t%rdx, %rax\n.L3:\n\tshrq\t$2, %rdx\n\tdecl\t%ecx\n\tjne\t.L4\n.L2:\n\tret\n\t.cfi_endproc\n\n",
".globl int_sqrt\n.type int_sqrt, @function\nint_sqrt:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcmpq\t$1, %rdi\n\tjbe\t.L1\n\tmovl\t$32, %ecx\n\txorl\t%eax, %eax\n\tmovabsq\t$4611686018427387904, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleaq\t(%rdx,%rax), %rsi\n\tshrq\t%rax\n\tcmpq\t%rsi, %rdi\n\tjb\t.L3\n\tsubq\t%rsi, %rdi\n\taddq\t%rdx, %rax\n.L3:\n\tshrq\t$2, %rdx\n\tsubl\t$1, %ecx\n\tjne\t.L4\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".global int_sqrt\n.type int_sqrt, %function\nint_sqrt:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #48\n\t.cfi_def_cfa_offset 48\n\tstr\tx0, [sp, 8]\n\tstr\txzr, [sp, 32]\n\tldr\tx0, [sp, 8]\n\tcmp\tx0, 1\n\tbhi\t.L2\n\tldr\tx0, [sp, 8]\n\tb\t.L3\n.L2:\n\tmov\tx0, 4611686018427387904\n\tstr\tx0, [sp, 24]\n\tb\t.L4\n.L6:\n\tldr\tx1, [sp, 32]\n\tldr\tx0, [sp, 24]\n\tadd\tx0, x1, x0\n\tstr\tx0, [sp, 40]\n\tldr\tx0, [sp, 32]\n\tlsr\tx0, x0, 1\n\tstr\tx0, [sp, 32]\n\tldr\tx1, [sp, 8]\n\tldr\tx0, [sp, 40]\n\tcmp\tx1, x0\n\tbcc\t.L5\n\tldr\tx1, [sp, 8]\n\tldr\tx0, [sp, 40]\n\tsub\tx0, x1, x0\n\tstr\tx0, [sp, 8]\n\tldr\tx1, [sp, 32]\n\tldr\tx0, [sp, 24]\n\tadd\tx0, x1, x0\n\tstr\tx0, [sp, 32]\n.L5:\n\tldr\tx0, [sp, 24]\n\tlsr\tx0, x0, 2\n\tstr\tx0, [sp, 24]\n.L4:\n\tldr\tx0, [sp, 24]\n\tcmp\tx0, 0\n\tbne\t.L6\n\tldr\tx0, [sp, 32]\n.L3:\n\tadd\tsp, sp, 48\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global int_sqrt\n.type int_sqrt, %function\nint_sqrt:\n.LFB0:\n\t.cfi_startproc\n\tcmp\tx0, 1\n\tbls\t.L2\n\tmov\tx3, x0\n\tmov\tw2, 32\n\tmov\tx0, 0\n\tmov\tx1, 4611686018427387904\n.L4:\n\tadd\tx4, x1, x0\n\tlsr\tx0, x0, 1\n\tcmp\tx4, x3\n\tbhi\t.L3\n\tsub\tx3, x3, x4\n\tadd\tx0, x0, x1\n.L3:\n\tlsr\tx1, x1, 2\n\tsubs\tw2, w2, #1\n\tbne\t.L4\n.L2:\n\tret\n\t.cfi_endproc\n\n",
".global int_sqrt\n.type int_sqrt, %function\nint_sqrt:\n.LFB0:\n\t.cfi_startproc\n\tmov\tx4, x0\n\tcmp\tx0, 1\n\tbls\t.L1\n\tmov\tw2, 32\n\tmov\tx0, 0\n\tmov\tx1, 4611686018427387904\n\t.p2align 3,,7\n.L4:\n\tadd\tx3, x1, x0\n\tlsr\tx0, x0, 1\n\tcmp\tx4, x3\n\tbcc\t.L3\n\tsub\tx4, x4, x3\n\tadd\tx0, x0, x1\n.L3:\n\tlsr\tx1, x1, 2\n\tsubs\tw2, w2, #1\n\tbne\t.L4\n.L1:\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"21"
],
"var": [
"x"
]
},
{
"value": [
"643"
],
"var": [
"x"
]
},
{
"value": [
"636"
],
"var": [
"x"
]
},
{
"value": [
"315"
],
"var": [
"x"
]
},
{
"value": [
"616"
],
"var": [
"x"
]
},
{
"value": [
"889"
],
"var": [
"x"
]
},
{
"value": [
"135"
],
"var": [
"x"
]
},
{
"value": [
"137"
],
"var": [
"x"
]
},
{
"value": [
"334"
],
"var": [
"x"
]
},
{
"value": [
"239"
],
"var": [
"x"
]
}
],
"output": [
{
"value": [
"4"
],
"var": [
"returnv"
]
},
{
"value": [
"25"
],
"var": [
"returnv"
]
},
{
"value": [
"25"
],
"var": [
"returnv"
]
},
{
"value": [
"17"
],
"var": [
"returnv"
]
},
{
"value": [
"24"
],
"var": [
"returnv"
]
},
{
"value": [
"29"
],
"var": [
"returnv"
]
},
{
"value": [
"11"
],
"var": [
"returnv"
]
},
{
"value": [
"11"
],
"var": [
"returnv"
]
},
{
"value": [
"18"
],
"var": [
"returnv"
]
},
{
"value": [
"15"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_54il_hk1o2.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(unsigned long int x, unsigned long int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
unsigned long int x = input_json["x"];
clock_t begin = clock();
unsigned long int returnv = int_sqrt(x);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(x, returnv);
}
|
master
|
null
|
{"livein": ["x"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "int_sqrt", "funargs": ["x"], "typemap": {"x": "uint64", "returnv": "uint64"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_54il_hk1o2.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
NutshellySima/cpp/SYSU/matrix-C/Calculate the day.c
|
int leapyear(int year) {
if (year % 400 == 0)
return 1;
else if (year % 4 == 0 && year % 100 != 0)
return 1;
else
return 0;
}
|
int leapyear(intyear)
|
int leapyear(int year)
|
leapyear
|
[
"int",
"int"
] |
{
"code": [
".globl leapyear\n.type leapyear, @function\nleapyear:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t-4(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1374389535, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%eax, %ecx\n\tsarl\t$7, %ecx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\timull\t$400, %eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L2\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L2:\n\tmovl\t-4(%rbp), %eax\n\tandl\t$3, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L4\n\tmovl\t-4(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1374389535, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%eax, %ecx\n\tsarl\t$5, %ecx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\timull\t$100, %eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tje\t.L4\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L4:\n\tmovl\t$0, %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl leapyear\n.type leapyear, @function\nleapyear:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t$400, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t$1, %eax\n\ttestl\t%edx, %edx\n\tje\t.L1\n\txorl\t%eax, %eax\n\ttestb\t$3, %dil\n\tjne\t.L1\n\tmovl\t%edi, %eax\n\tmovl\t$100, %ecx\n\tcltd\n\tidivl\t%ecx\n\txorl\t%eax, %eax\n\ttestl\t%edx, %edx\n\tsetne\t%al\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl leapyear\n.type leapyear, @function\nleapyear:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\timull\t$-1030792151, %edi, %eax\n\tmovl\t$1, %r8d\n\taddl\t$85899344, %eax\n\tmovl\t%eax, %edx\n\trorl\t$4, %edx\n\tcmpl\t$10737418, %edx\n\tjbe\t.L1\n\txorl\t%r8d, %r8d\n\tandl\t$3, %edi\n\tjne\t.L1\n\trorl\t$2, %eax\n\txorl\t%r8d, %r8d\n\tcmpl\t$42949672, %eax\n\tseta\t%r8b\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".global leapyear\n.type leapyear, %function\nleapyear:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstr\tw0, [sp, 12]\n\tldr\tw1, [sp, 12]\n\tmov\tw0, 34079\n\tmovk\tw0, 0x51eb, lsl 16\n\tsmull\tx0, w1, w0\n\tlsr\tx0, x0, 32\n\tasr\tw2, w0, 7\n\tasr\tw0, w1, 31\n\tsub\tw0, w2, w0\n\tmov\tw2, 400\n\tmul\tw0, w0, w2\n\tsub\tw0, w1, w0\n\tcmp\tw0, 0\n\tbne\t.L2\n\tmov\tw0, 1\n\tb\t.L3\n.L2:\n\tldr\tw0, [sp, 12]\n\tand\tw0, w0, 3\n\tcmp\tw0, 0\n\tbne\t.L4\n\tldr\tw1, [sp, 12]\n\tmov\tw0, 34079\n\tmovk\tw0, 0x51eb, lsl 16\n\tsmull\tx0, w1, w0\n\tlsr\tx0, x0, 32\n\tasr\tw2, w0, 5\n\tasr\tw0, w1, 31\n\tsub\tw0, w2, w0\n\tmov\tw2, 100\n\tmul\tw0, w0, w2\n\tsub\tw0, w1, w0\n\tcmp\tw0, 0\n\tbeq\t.L4\n\tmov\tw0, 1\n\tb\t.L3\n.L4:\n\tmov\tw0, 0\n.L3:\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global leapyear\n.type leapyear, %function\nleapyear:\n.LFB13:\n\t.cfi_startproc\n\tmov\tw2, 400\n\tsdiv\tw1, w0, w2\n\tmsub\tw1, w1, w2, w0\n\tcbz\tw1, .L3\n\ttst\tx0, 3\n\tbne\t.L4\n\tmov\tw2, 100\n\tsdiv\tw1, w0, w2\n\tmsub\tw0, w1, w2, w0\n\tcmp\tw0, 0\n\tcset\tw0, ne\n.L1:\n\tret\n.L3:\n\tmov\tw0, 1\n\tb\t.L1\n.L4:\n\tmov\tw0, 0\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global leapyear\n.type leapyear, %function\nleapyear:\n.LFB23:\n\t.cfi_startproc\n\tmov\tw1, 23593\n\tmov\tw3, 47184\n\tmovk\tw3, 0x51e, lsl 16\n\tmovk\tw1, 0xc28f, lsl 16\n\tmov\tw2, 55050\n\tmadd\tw1, w0, w1, w3\n\tmovk\tw2, 0xa3, lsl 16\n\tror\tw3, w1, 4\n\tcmp\tw3, w2\n\tbls\t.L3\n\ttst\tx0, 3\n\tmov\tw0, 0\n\tbne\t.L1\n\tmov\tw0, 23592\n\tror\tw1, w1, 2\n\tmovk\tw0, 0x28f, lsl 16\n\tcmp\tw1, w0\n\tcset\tw0, hi\n.L1:\n\tret\n\t.p2align 2,,3\n.L3:\n\tmov\tw0, 1\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"9"
],
"var": [
"year"
]
},
{
"value": [
"112"
],
"var": [
"year"
]
},
{
"value": [
"5"
],
"var": [
"year"
]
},
{
"value": [
"4"
],
"var": [
"year"
]
},
{
"value": [
"65"
],
"var": [
"year"
]
},
{
"value": [
"120"
],
"var": [
"year"
]
},
{
"value": [
"11"
],
"var": [
"year"
]
},
{
"value": [
"85"
],
"var": [
"year"
]
},
{
"value": [
"15"
],
"var": [
"year"
]
},
{
"value": [
"14"
],
"var": [
"year"
]
}
],
"output": [
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_61od0zydej.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int year, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int year = input_json["year"];
clock_t begin = clock();
int returnv = leapyear(year);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(year, returnv);
}
|
master
|
null
|
{"livein": ["year"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "leapyear", "funargs": ["year"], "typemap": {"year": "int32", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_61od0zydej.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
n-t-roff/DWB3.3/text/troff/n4.c
|
int quant(int n, int m)
{
int i, neg;
neg = 0;
if (n < 0) {
neg++;
n = -n;
}
i = n / m;
if (n - m * i > m / 2)
i += 1;
i *= m;
if (neg)
i = -i;
return(i);
}
|
int quant(intn, intm)
|
int quant(int n, int m)
|
quant
|
[
"int",
"int",
"int"
] |
{
"code": [
".globl quant\n.type quant, @function\nquant:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tcmpl\t$0, -20(%rbp)\n\tjns\t.L2\n\taddl\t$1, -4(%rbp)\n\tnegl\t-20(%rbp)\n.L2:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-24(%rbp), %eax\n\timull\t-8(%rbp), %eax\n\tmovl\t-20(%rbp), %edx\n\tsubl\t%eax, %edx\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\taddl\t%ecx, %eax\n\tsarl\t%eax\n\tcmpl\t%eax, %edx\n\tjle\t.L3\n\taddl\t$1, -8(%rbp)\n.L3:\n\tmovl\t-8(%rbp), %eax\n\timull\t-24(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tje\t.L4\n\tnegl\t-8(%rbp)\n.L4:\n\tmovl\t-8(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl quant\n.type quant, @function\nquant:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%ecx, %ecx\n\ttestl\t%edi, %edi\n\tjns\t.L2\n\tnegl\t%edi\n\tmovl\t$1, %ecx\n.L2:\n\tmovl\t%edi, %eax\n\tmovl\t$2, %r8d\n\tcltd\n\tidivl\t%esi\n\tmovl\t%eax, %edi\n\tmovl\t%esi, %eax\n\tmovl\t%edx, %r9d\n\tcltd\n\tidivl\t%r8d\n\tcmpl\t%r9d, %eax\n\tjge\t.L3\n\tincl\t%edi\n.L3:\n\tmovl\t%edi, %eax\n\timull\t%esi, %eax\n\ttestl\t%ecx, %ecx\n\tje\t.L1\n\tnegl\t%eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl quant\n.type quant, @function\nquant:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%esi, %ecx\n\tmovl\t%edi, %eax\n\tshrl\t$31, %ecx\n\taddl\t%esi, %ecx\n\tsarl\t%ecx\n\ttestl\t%edi, %edi\n\tjs\t.L10\n\tcltd\n\tidivl\t%esi\n\tcmpl\t%edx, %ecx\n\tjge\t.L8\n\taddl\t$1, %eax\n.L8:\n\timull\t%esi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tnegl\t%eax\n\tcltd\n\tidivl\t%esi\n\tcmpl\t%ecx, %edx\n\tjle\t.L7\n\taddl\t$1, %eax\n.L7:\n\timull\t%eax, %esi\n\tmovl\t%esi, %eax\n\tnegl\t%eax\n\tret\n\t.cfi_endproc\n\n",
".global quant\n.type quant, %function\nquant:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tw0, [sp, 12]\n\tstr\tw1, [sp, 8]\n\tstr\twzr, [sp, 28]\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 0\n\tbge\t.L2\n\tldr\tw0, [sp, 28]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 28]\n\tldr\tw0, [sp, 12]\n\tneg\tw0, w0\n\tstr\tw0, [sp, 12]\n.L2:\n\tldr\tw1, [sp, 12]\n\tldr\tw0, [sp, 8]\n\tsdiv\tw0, w1, w0\n\tstr\tw0, [sp, 24]\n\tldr\tw1, [sp, 8]\n\tldr\tw0, [sp, 24]\n\tmul\tw0, w1, w0\n\tldr\tw1, [sp, 12]\n\tsub\tw1, w1, w0\n\tldr\tw0, [sp, 8]\n\tlsr\tw2, w0, 31\n\tadd\tw0, w2, w0\n\tasr\tw0, w0, 1\n\tcmp\tw1, w0\n\tble\t.L3\n\tldr\tw0, [sp, 24]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 24]\n.L3:\n\tldr\tw1, [sp, 24]\n\tldr\tw0, [sp, 8]\n\tmul\tw0, w1, w0\n\tstr\tw0, [sp, 24]\n\tldr\tw0, [sp, 28]\n\tcmp\tw0, 0\n\tbeq\t.L4\n\tldr\tw0, [sp, 24]\n\tneg\tw0, w0\n\tstr\tw0, [sp, 24]\n.L4:\n\tldr\tw0, [sp, 24]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global quant\n.type quant, %function\nquant:\n.LFB0:\n\t.cfi_startproc\n\ttbz\tw0, #31, .L5\n\tneg\tw0, w0\n\tmov\tw4, 1\n.L2:\n\tsdiv\tw2, w0, w1\n\tmov\tw3, 2\n\tsdiv\tw3, w1, w3\n\tmsub\tw0, w2, w1, w0\n\tcmp\tw3, w0\n\tcinc\tw2, w2, lt\n\tmul\tw0, w2, w1\n\tcbz\tw4, .L1\n\tneg\tw0, w0\n.L1:\n\tret\n.L5:\n\tmov\tw4, 0\n\tb\t.L2\n\t.cfi_endproc\n\n",
".global quant\n.type quant, %function\nquant:\n.LFB0:\n\t.cfi_startproc\n\tadd\tw2, w1, w1, lsr 31\n\tasr\tw2, w2, 1\n\ttbnz\tw0, #31, .L8\n\tsdiv\tw4, w0, w1\n\tmul\tw3, w4, w1\n\tmadd\tw1, w4, w1, w1\n\tsub\tw0, w0, w3\n\tcmp\tw2, w0\n\tcsel\tw0, w1, w3, lt\n\tret\n\t.p2align 2,,3\n.L8:\n\tneg\tw0, w0\n\tsdiv\tw4, w0, w1\n\tmul\tw3, w4, w1\n\tmadd\tw1, w4, w1, w1\n\tsub\tw0, w0, w3\n\tcmp\tw0, w2\n\tcsel\tw0, w1, w3, gt\n\tneg\tw0, w0\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"115",
"15"
],
"var": [
"n",
"m"
]
},
{
"value": [
"126",
"70"
],
"var": [
"n",
"m"
]
},
{
"value": [
"112",
"51"
],
"var": [
"n",
"m"
]
},
{
"value": [
"72",
"18"
],
"var": [
"n",
"m"
]
},
{
"value": [
"41",
"53"
],
"var": [
"n",
"m"
]
},
{
"value": [
"112",
"96"
],
"var": [
"n",
"m"
]
},
{
"value": [
"118",
"46"
],
"var": [
"n",
"m"
]
},
{
"value": [
"25",
"112"
],
"var": [
"n",
"m"
]
},
{
"value": [
"7",
"55"
],
"var": [
"n",
"m"
]
},
{
"value": [
"23",
"74"
],
"var": [
"n",
"m"
]
}
],
"output": [
{
"value": [
"120"
],
"var": [
"returnv"
]
},
{
"value": [
"140"
],
"var": [
"returnv"
]
},
{
"value": [
"102"
],
"var": [
"returnv"
]
},
{
"value": [
"72"
],
"var": [
"returnv"
]
},
{
"value": [
"53"
],
"var": [
"returnv"
]
},
{
"value": [
"96"
],
"var": [
"returnv"
]
},
{
"value": [
"138"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_339ai5d10y.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int n, int m, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int n = input_json["n"];
int m = input_json["m"];
clock_t begin = clock();
int returnv = quant(n, m);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(n, m, returnv);
}
|
master
|
null
|
{"livein": ["n", "m"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "quant", "funargs": ["n", "m"], "typemap": {"n": "int32", "m": "int32", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_339ai5d10y.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
yigezhe/algorithm-summary/math/gcd/gcd_idea2_way2.c
|
int gcd(int a,int b) {
int r;
if(a<0) {
a=-a;
}
if(b<0) {
b=-b;
}
if(b>a) {
int tmp=a;
a=b;
b=tmp;
}
# 36 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/yigezhe/algorithm-summary/refs/heads/master/math/gcd/gcd_idea2_way2.c"
while (b != 0) {
r = a % b;
a = b;
b = r;
}
return a;
}
|
int gcd(inta, intb)
|
int gcd(int a,int b)
|
gcd
|
[
"int",
"int",
"int"
] |
{
"code": [
".globl gcd\n.type gcd, @function\ngcd:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tcmpl\t$0, -20(%rbp)\n\tjns\t.L2\n\tnegl\t-20(%rbp)\n.L2:\n\tcmpl\t$0, -24(%rbp)\n\tjns\t.L3\n\tnegl\t-24(%rbp)\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjle\t.L5\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L5:\n\tcmpl\t$0, -24(%rbp)\n\tjne\t.L6\n\tmovl\t-20(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl gcd\n.type gcd, @function\ngcd:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\txorl\t%edx, %eax\n\tsubl\t%edx, %eax\n\tmovl\t%esi, %edx\n\tsarl\t$31, %edx\n\txorl\t%edx, %esi\n\tsubl\t%edx, %esi\n\tmovl\t%eax, %edx\n\tcmpl\t%eax, %esi\n\tjg\t.L5\n.L3:\n\ttestl\t%esi, %esi\n\tje\t.L7\n\tcltd\n\tidivl\t%esi\n.L5:\n\tmovl\t%esi, %eax\n\tmovl\t%edx, %esi\n\tjmp\t.L3\n.L7:\n\tret\n\t.cfi_endproc\n\n",
".globl gcd\n.type gcd, @function\ngcd:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %ecx\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\tsarl\t$31, %ecx\n\txorl\t%ecx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%esi, %ecx\n\tsarl\t$31, %ecx\n\txorl\t%ecx, %edx\n\tsubl\t%ecx, %edx\n\tcmpl\t%eax, %edx\n\tjle\t.L2\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tmovl\t%ecx, %edx\n.L2:\n\ttestl\t%edx, %edx\n\tje\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L4\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t%eax, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".global gcd\n.type gcd, %function\ngcd:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tw0, [sp, 12]\n\tstr\tw1, [sp, 8]\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 0\n\tbge\t.L2\n\tldr\tw0, [sp, 12]\n\tneg\tw0, w0\n\tstr\tw0, [sp, 12]\n.L2:\n\tldr\tw0, [sp, 8]\n\tcmp\tw0, 0\n\tbge\t.L3\n\tldr\tw0, [sp, 8]\n\tneg\tw0, w0\n\tstr\tw0, [sp, 8]\n.L3:\n\tldr\tw1, [sp, 8]\n\tldr\tw0, [sp, 12]\n\tcmp\tw1, w0\n\tble\t.L5\n\tldr\tw0, [sp, 12]\n\tstr\tw0, [sp, 24]\n\tldr\tw0, [sp, 8]\n\tstr\tw0, [sp, 12]\n\tldr\tw0, [sp, 24]\n\tstr\tw0, [sp, 8]\n\tb\t.L5\n.L6:\n\tldr\tw0, [sp, 12]\n\tldr\tw1, [sp, 8]\n\tsdiv\tw2, w0, w1\n\tldr\tw1, [sp, 8]\n\tmul\tw1, w2, w1\n\tsub\tw0, w0, w1\n\tstr\tw0, [sp, 28]\n\tldr\tw0, [sp, 8]\n\tstr\tw0, [sp, 12]\n\tldr\tw0, [sp, 28]\n\tstr\tw0, [sp, 8]\n.L5:\n\tldr\tw0, [sp, 8]\n\tcmp\tw0, 0\n\tbne\t.L6\n\tldr\tw0, [sp, 12]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global gcd\n.type gcd, %function\ngcd:\n.LFB0:\n\t.cfi_startproc\n\tcmp\tw0, 0\n\tcsneg\tw0, w0, w0, ge\n\tcmp\tw1, 0\n\tcsneg\tw1, w1, w1, ge\n\tcmp\tw1, w0\n\tble\t.L3\n\tmov\tw2, w0\n.L5:\n\tmov\tw0, w1\n\tmov\tw1, w2\n.L3:\n\tcbnz\tw1, .L4\n\tret\n.L4:\n\tudiv\tw2, w0, w1\n\tmsub\tw2, w2, w1, w0\n\tb\t.L5\n\t.cfi_endproc\n\n",
".global gcd\n.type gcd, %function\ngcd:\n.LFB0:\n\t.cfi_startproc\n\tcmp\tw0, 0\n\tcsneg\tw2, w0, w0, ge\n\tcmp\tw1, 0\n\tcsneg\tw1, w1, w1, ge\n\tcmp\tw1, w2\n\tcsel\tw0, w2, w1, le\n\tcsel\tw1, w1, w2, le\n\tmov\tw2, w0\n\tcbz\tw1, .L1\n\t.p2align 3,,7\n.L4:\n\tudiv\tw3, w2, w1\n\tmov\tw0, w1\n\tmsub\tw1, w3, w1, w2\n\tmov\tw2, w0\n\tcbnz\tw1, .L4\n.L1:\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"104",
"99"
],
"var": [
"a",
"b"
]
},
{
"value": [
"114",
"93"
],
"var": [
"a",
"b"
]
},
{
"value": [
"57",
"18"
],
"var": [
"a",
"b"
]
},
{
"value": [
"115",
"102"
],
"var": [
"a",
"b"
]
},
{
"value": [
"6",
"4"
],
"var": [
"a",
"b"
]
},
{
"value": [
"84",
"11"
],
"var": [
"a",
"b"
]
},
{
"value": [
"120",
"104"
],
"var": [
"a",
"b"
]
},
{
"value": [
"76",
"22"
],
"var": [
"a",
"b"
]
},
{
"value": [
"110",
"45"
],
"var": [
"a",
"b"
]
},
{
"value": [
"8",
"115"
],
"var": [
"a",
"b"
]
}
],
"output": [
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"3"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"2"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
},
{
"value": [
"8"
],
"var": [
"returnv"
]
},
{
"value": [
"2"
],
"var": [
"returnv"
]
},
{
"value": [
"5"
],
"var": [
"returnv"
]
},
{
"value": [
"1"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_59gy4uj0wf.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int a, int b, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int a = input_json["a"];
int b = input_json["b"];
clock_t begin = clock();
int returnv = gcd(a, b);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(a, b, returnv);
}
|
master
|
null
|
{"livein": ["a", "b"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "gcd", "funargs": ["a", "b"], "typemap": {"a": "int32", "b": "int32", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_59gy4uj0wf.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
dlna/DeveloperToolsForUPnP/Samples/EmbeddedSamples/Micro Av Server/MicroMediaServer.c
|
char MungeHexDigit(char* one_hexdigit)
{
char r = -1;
char c = *one_hexdigit;
if (c >= '0' && c <= '9')
{
r = c - '0';
}
else if (c >= 'A' && c <= 'F')
{
r = c - 'A' + 10;
}
else if (c >= 'a' && c <= 'F')
{
r = c - 'a' + 10;
}
return r;
}
|
char MungeHexDigit(char *one_hexdigit)
|
char MungeHexDigit(char* one_hexdigit)
|
MungeHexDigit
|
[
"char",
"char *"
] |
{
"code": [
".globl MungeHexDigit\n.type MungeHexDigit, @function\nMungeHexDigit:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovb\t$-1, -2(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -1(%rbp)\n\tcmpb\t$47, -1(%rbp)\n\tjle\t.L2\n\tcmpb\t$57, -1(%rbp)\n\tjg\t.L2\n\tmovzbl\t-1(%rbp), %eax\n\tsubl\t$48, %eax\n\tmovb\t%al, -2(%rbp)\n\tjmp\t.L3\n.L2:\n\tcmpb\t$64, -1(%rbp)\n\tjle\t.L4\n\tcmpb\t$70, -1(%rbp)\n\tjg\t.L4\n\tmovzbl\t-1(%rbp), %eax\n\tsubl\t$55, %eax\n\tmovb\t%al, -2(%rbp)\n\tjmp\t.L3\n.L4:\n\tcmpb\t$96, -1(%rbp)\n\tjle\t.L3\n\tcmpb\t$70, -1(%rbp)\n\tjg\t.L3\n\tmovzbl\t-1(%rbp), %eax\n\tsubl\t$87, %eax\n\tmovb\t%al, -2(%rbp)\n.L3:\n\tmovzbl\t-2(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl MungeHexDigit\n.type MungeHexDigit, @function\nMungeHexDigit:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovb\t(%rdi), %dl\n\tleal\t-48(%rdx), %eax\n\tcmpb\t$9, %al\n\tjbe\t.L1\n\tleal\t-65(%rdx), %ecx\n\tmovb\t$-1, %al\n\tcmpb\t$5, %cl\n\tja\t.L1\n\tleal\t-55(%rdx), %eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl MungeHexDigit\n.type MungeHexDigit, @function\nMungeHexDigit:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rdi), %edx\n\tleal\t-48(%rdx), %eax\n\tcmpb\t$9, %al\n\tjbe\t.L1\n\tleal\t-65(%rdx), %eax\n\tcmpb\t$5, %al\n\tja\t.L4\n\tleal\t-55(%rdx), %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t$-1, %eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".global MungeHexDigit\n.type MungeHexDigit, %function\nMungeHexDigit:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tx0, [sp, 8]\n\tmov\tw0, -1\n\tstrb\tw0, [sp, 30]\n\tldr\tx0, [sp, 8]\n\tldrb\tw0, [x0]\n\tstrb\tw0, [sp, 31]\n\tldrb\tw0, [sp, 31]\n\tcmp\tw0, 47\n\tbls\t.L2\n\tldrb\tw0, [sp, 31]\n\tcmp\tw0, 57\n\tbhi\t.L2\n\tldrb\tw0, [sp, 31]\n\tsub\tw0, w0, #48\n\tstrb\tw0, [sp, 30]\n\tb\t.L3\n.L2:\n\tldrb\tw0, [sp, 31]\n\tcmp\tw0, 64\n\tbls\t.L4\n\tldrb\tw0, [sp, 31]\n\tcmp\tw0, 70\n\tbhi\t.L4\n\tldrb\tw0, [sp, 31]\n\tsub\tw0, w0, #55\n\tstrb\tw0, [sp, 30]\n\tb\t.L3\n.L4:\n\tldrb\tw0, [sp, 31]\n\tcmp\tw0, 96\n\tbls\t.L3\n\tldrb\tw0, [sp, 31]\n\tcmp\tw0, 70\n\tbhi\t.L3\n\tldrb\tw0, [sp, 31]\n\tsub\tw0, w0, #87\n\tstrb\tw0, [sp, 30]\n.L3:\n\tldrb\tw0, [sp, 30]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global MungeHexDigit\n.type MungeHexDigit, %function\nMungeHexDigit:\n.LFB0:\n\t.cfi_startproc\n\tldrb\tw1, [x0]\n\tsub\tw0, w1, #48\n\tand\tw0, w0, 255\n\tcmp\tw0, 9\n\tbls\t.L2\n\tsub\tw0, w1, #65\n\tsub\tw1, w1, #55\n\tand\tw0, w0, 255\n\tand\tw1, w1, 255\n\tcmp\tw0, 6\n\tmov\tw0, 255\n\tcsel\tw0, w1, w0, cc\n.L2:\n\tret\n\t.cfi_endproc\n\n",
".global MungeHexDigit\n.type MungeHexDigit, %function\nMungeHexDigit:\n.LFB0:\n\t.cfi_startproc\n\tldrb\tw1, [x0]\n\tsub\tw0, w1, #48\n\tand\tw0, w0, 255\n\tcmp\tw0, 9\n\tbls\t.L2\n\tsub\tw0, w1, #65\n\tsub\tw1, w1, #55\n\tand\tw0, w0, 255\n\tand\tw1, w1, 255\n\tcmp\tw0, 6\n\tmov\tw0, 255\n\tcsel\tw0, w1, w0, cc\n.L2:\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"qfvfw\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"fsajoobzufkdnrusbhoet\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"urirjxxtrfzsctibdphhtm\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"agbtsoejrfuuirpqikltqzoajffrkye\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"kvxowyfwqdvnyoxlkunlqzuhxsazr\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"ydgvnvannhoeecnwnbjtx\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"iqgzrugfumuqwqrgp\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"mmgci\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"ijilfqo\""
],
"var": [
"one_hexdigit"
]
},
{
"value": [
"\"\""
],
"var": [
"one_hexdigit"
]
}
],
"output": [
{
"value": [
"\"qfvfw\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"fsajoobzufkdnrusbhoet\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"urirjxxtrfzsctibdphhtm\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"agbtsoejrfuuirpqikltqzoajffrkye\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"kvxowyfwqdvnyoxlkunlqzuhxsazr\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"ydgvnvannhoeecnwnbjtx\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"iqgzrugfumuqwqrgp\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"mmgci\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"ijilfqo\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
},
{
"value": [
"\"\"",
"-1"
],
"var": [
"one_hexdigit",
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_58e681x_mf.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* one_hexdigit, char returnv) {
json output_json;
output_json["one_hexdigit"] = one_hexdigit;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* one_hexdigit = strdup(input_json["one_hexdigit"].get<std::string>().c_str());
clock_t begin = clock();
char returnv = MungeHexDigit(one_hexdigit);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(one_hexdigit, returnv);
}
|
master
|
null
|
{"livein": ["one_hexdigit"], "liveout": ["one_hexdigit"], "returnvarname": ["returnv"], "execcmd": "", "funname": "MungeHexDigit", "funargs": ["one_hexdigit"], "typemap": {"one_hexdigit": "string", "returnv": "int8"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_58e681x_mf.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
ningwei1993/beginnerOfC/5.c
|
int function(int x, int y)
{
switch (y) {
case 2:
if ((x % 4 == 0 && x % 100 != 0) || x % 400 == 0) {
return 29;
} else {
return 28;
}
case 4:
case 6:
case 9:
case 11:
return 30;
default:
return 31;
}
}
|
int function(intx, inty)
|
int function(int x, int y)
|
function
|
[
"int",
"int",
"int"
] |
{
"code": [
".globl function\n.type function, @function\nfunction:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tcmpl\t$11, -8(%rbp)\n\tja\t.L2\n\tmovl\t-8(%rbp), %eax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\t.L4(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t.L4(%rip), %rdx\n\taddq\t%rdx, %rax\n\tnotrack jmp\t*%rax\n\t.section\t.rodata\n\t.align 4\n\t.align 4\n.L4:\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L5-.L4\n\t.long\t.L2-.L4\n\t.long\t.L3-.L4\n\t.long\t.L2-.L4\n\t.long\t.L3-.L4\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L3-.L4\n\t.long\t.L2-.L4\n\t.long\t.L3-.L4\n\t.text\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tandl\t$3, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L6\n\tmovl\t-4(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1374389535, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%eax, %ecx\n\tsarl\t$5, %ecx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\timull\t$100, %eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L7\n.L6:\n\tmovl\t-4(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1374389535, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%eax, %ecx\n\tsarl\t$7, %ecx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\timull\t$400, %eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L8\n.L7:\n\tmovl\t$29, %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$28, %eax\n\tjmp\t.L9\n.L3:\n\tmovl\t$30, %eax\n\tjmp\t.L9\n.L2:\n\tmovl\t$31, %eax\n.L9:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl function\n.type function, @function\nfunction:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tsubl\t$2, %esi\n\tcmpl\t$9, %esi\n\tja\t.L2\n\tleaq\t.L4(%rip), %rdx\n\tmovslq\t(%rdx,%rsi,4), %rax\n\taddq\t%rdx, %rax\n\tnotrack jmp\t*%rax\n\t.section\t.rodata\n\t.align 4\n\t.align 4\n.L4:\n\t.long\t.L5-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.text\n.L2:\n\tmovl\t$31, %eax\n\tret\n.L5:\n\ttestb\t$3, %dil\n\tjne\t.L6\n\tmovl\t%edi, %eax\n\tmovl\t$100, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t$29, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L1\n.L6:\n\tmovl\t%edi, %eax\n\tmovl\t$400, %ecx\n\tcltd\n\tidivl\t%ecx\n\tcmpl\t$1, %edx\n\tsbbl\t%eax, %eax\n\tnotl\t%eax\n\taddl\t$29, %eax\n\tret\n.L7:\n\tmovl\t$30, %eax\n.L1:\n\tret\n\t.cfi_endproc\n\n",
".globl function\n.type function, @function\nfunction:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t$11, %esi\n\tja\t.L2\n\tleaq\t.L4(%rip), %rdx\n\tmovl\t%esi, %esi\n\tmovslq\t(%rdx,%rsi,4), %rax\n\taddq\t%rdx, %rax\n\tnotrack jmp\t*%rax\n\t.section\t.rodata\n\t.align 4\n\t.align 4\n.L4:\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L5-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.long\t.L2-.L4\n\t.long\t.L7-.L4\n\t.text\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t$30, %eax\n.L1:\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovl\t$31, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\ttestb\t$3, %dil\n\tjne\t.L6\n\timull\t$-1030792151, %edi, %edx\n\tmovl\t$29, %eax\n\taddl\t$85899344, %edx\n\trorl\t$2, %edx\n\tcmpl\t$42949672, %edx\n\tja\t.L1\n.L6:\n\timull\t$-1030792151, %edi, %edi\n\txorl\t%eax, %eax\n\taddl\t$85899344, %edi\n\trorl\t$4, %edi\n\tcmpl\t$10737419, %edi\n\tsetb\t%al\n\taddl\t$28, %eax\n\tret\n\t.cfi_endproc\n\n",
".global function\n.type function, %function\nfunction:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #16\n\t.cfi_def_cfa_offset 16\n\tstr\tw0, [sp, 12]\n\tstr\tw1, [sp, 8]\n\tldr\tw0, [sp, 8]\n\tcmp\tw0, 11\n\tcset\tw1, hi\n\tand\tw1, w1, 255\n\tcmp\tw1, 0\n\tbne\t.L2\n\tmov\tx1, 1\n\tlsl\tx0, x1, x0\n\tmov\tx1, 2640\n\tand\tx1, x0, x1\n\tcmp\tx1, 0\n\tcset\tw1, ne\n\tand\tw1, w1, 255\n\tcmp\tw1, 0\n\tbne\t.L3\n\tand\tx0, x0, 4\n\tcmp\tx0, 0\n\tcset\tw0, ne\n\tand\tw0, w0, 255\n\tcmp\tw0, 0\n\tbeq\t.L2\n\tldr\tw0, [sp, 12]\n\tand\tw0, w0, 3\n\tcmp\tw0, 0\n\tbne\t.L4\n\tldr\tw1, [sp, 12]\n\tmov\tw0, 34079\n\tmovk\tw0, 0x51eb, lsl 16\n\tsmull\tx0, w1, w0\n\tlsr\tx0, x0, 32\n\tasr\tw2, w0, 5\n\tasr\tw0, w1, 31\n\tsub\tw0, w2, w0\n\tmov\tw2, 100\n\tmul\tw0, w0, w2\n\tsub\tw0, w1, w0\n\tcmp\tw0, 0\n\tbne\t.L5\n.L4:\n\tldr\tw1, [sp, 12]\n\tmov\tw0, 34079\n\tmovk\tw0, 0x51eb, lsl 16\n\tsmull\tx0, w1, w0\n\tlsr\tx0, x0, 32\n\tasr\tw2, w0, 7\n\tasr\tw0, w1, 31\n\tsub\tw0, w2, w0\n\tmov\tw2, 400\n\tmul\tw0, w0, w2\n\tsub\tw0, w1, w0\n\tcmp\tw0, 0\n\tbne\t.L6\n.L5:\n\tmov\tw0, 29\n\tb\t.L7\n.L6:\n\tmov\tw0, 28\n\tb\t.L7\n.L3:\n\tmov\tw0, 30\n\tb\t.L7\n.L2:\n\tmov\tw0, 31\n.L7:\n\tadd\tsp, sp, 16\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global function\n.type function, %function\nfunction:\n.LFB13:\n\t.cfi_startproc\n\tsub\tw1, w1, #2\n\tcmp\tw1, 9\n\tbhi\t.L2\n\tadrp\tx2, .L4\n\tadd\tx2, x2, :lo12:.L4\n\tldrb\tw1, [x2,w1,uxtw]\n\tadr\tx2, .Lrtx4\n\tadd\tx1, x2, w1, sxtb #2\n\tbr\tx1\n.Lrtx4:\n\t.section\t.rodata\n\t.align\t0\n\t.align\t2\n.L4:\n\t.byte\t(.L5 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L7 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L7 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L7 - .Lrtx4) / 4\n\t.byte\t(.L2 - .Lrtx4) / 4\n\t.byte\t(.L7 - .Lrtx4) / 4\n\t.text\n.L2:\n\tmov\tw0, 31\n.L1:\n\tret\n.L5:\n\ttst\tx0, 3\n\tbne\t.L6\n\tmov\tw2, 100\n\tsdiv\tw1, w0, w2\n\tmsub\tw1, w1, w2, w0\n\tcbnz\tw1, .L8\n.L6:\n\tmov\tw2, 400\n\tsdiv\tw1, w0, w2\n\tmsub\tw0, w1, w2, w0\n\tcmp\tw0, 0\n\tcset\tw0, eq\n\tadd\tw0, w0, 28\n\tb\t.L1\n.L7:\n\tmov\tw0, 30\n\tb\t.L1\n.L8:\n\tmov\tw0, 29\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global function\n.type function, %function\nfunction:\n.LFB23:\n\t.cfi_startproc\n\tmov\tw3, w0\n\tcmp\tw1, 11\n\tbhi\t.L4\n\tmov\tx2, 1\n\tmov\tx4, 2640\n\tlsl\tx1, x2, x1\n\tmov\tw0, 30\n\ttst\tx1, x4\n\tbne\t.L1\n\tmov\tw0, 31\n\ttbnz\tx1, 2, .L11\n.L1:\n\tret\n.L11:\n\ttst\tx3, 3\n\tbne\t.L3\n\tmov\tw1, 23593\n\tmov\tw4, 47184\n\tmovk\tw1, 0xc28f, lsl 16\n\tmovk\tw4, 0x51e, lsl 16\n\tmov\tw2, 23592\n\tmov\tw0, 29\n\tmadd\tw1, w3, w1, w4\n\tmovk\tw2, 0x28f, lsl 16\n\tror\tw1, w1, 2\n\tcmp\tw1, w2\n\tbhi\t.L1\n.L3:\n\tmov\tw2, 23593\n\tmov\tw0, 47184\n\tmovk\tw2, 0xc28f, lsl 16\n\tmovk\tw0, 0x51e, lsl 16\n\tmov\tw1, 55050\n\tmadd\tw0, w3, w2, w0\n\tmovk\tw1, 0xa3, lsl 16\n\tror\tw0, w0, 4\n\tcmp\tw0, w1\n\tcset\tw0, ls\n\tadd\tw0, w0, 28\n\tret\n\t.p2align 2,,3\n.L4:\n\tmov\tw0, 31\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"88",
"56"
],
"var": [
"x",
"y"
]
},
{
"value": [
"3",
"63"
],
"var": [
"x",
"y"
]
},
{
"value": [
"120",
"113"
],
"var": [
"x",
"y"
]
},
{
"value": [
"7",
"81"
],
"var": [
"x",
"y"
]
},
{
"value": [
"56",
"27"
],
"var": [
"x",
"y"
]
},
{
"value": [
"43",
"8"
],
"var": [
"x",
"y"
]
},
{
"value": [
"123",
"9"
],
"var": [
"x",
"y"
]
},
{
"value": [
"94",
"54"
],
"var": [
"x",
"y"
]
},
{
"value": [
"58",
"10"
],
"var": [
"x",
"y"
]
},
{
"value": [
"83",
"112"
],
"var": [
"x",
"y"
]
}
],
"output": [
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"30"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
},
{
"value": [
"31"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_3011v4bfnu.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int x, int y, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int x = input_json["x"];
int y = input_json["y"];
clock_t begin = clock();
int returnv = function(x, y);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(x, y, returnv);
}
|
master
|
null
|
{"livein": ["x", "y"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "function", "funargs": ["x", "y"], "typemap": {"x": "int32", "y": "int32", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_3011v4bfnu.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
Desartes/VUT/1.projekt/proj1.c
|
int isnum(char *c) {
int i = 0;
while( *(c + i) != '\0' ) {
if ( !(*(c + i) >= 48 && *(c + i) <= 57) )
break;
else
i++;
}
if ( *(c + i) == '\0' )
return 1;
else
return 0;
}
|
int isnum(char *c)
|
int isnum(char *c)
|
isnum
|
[
"int",
"char *"
] |
{
"code": [
".globl isnum\n.type isnum, @function\nisnum:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$47, %al\n\tjle\t.L3\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$57, %al\n\tjg\t.L3\n\taddl\t$1, -4(%rbp)\n.L2:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n.L3:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n\tmovl\t$1, %eax\n\tjmp\t.L6\n.L5:\n\tmovl\t$0, %eax\n.L6:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl isnum\n.type isnum, @function\nisnum:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n.L2:\n\tmovb\t(%rdi), %al\n\ttestb\t%al, %al\n\tje\t.L7\n\tsubl\t$48, %eax\n\tincq\t%rdi\n\tcmpb\t$9, %al\n\tjbe\t.L2\n\txorl\t%eax, %eax\n\tret\n.L7:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n\n",
".globl isnum\n.type isnum, @function\nisnum:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rdi), %eax\n\ttestb\t%al, %al\n\tje\t.L4\n\taddq\t$1, %rdi\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovzbl\t(%rdi), %eax\n\taddq\t$1, %rdi\n\ttestb\t%al, %al\n\tje\t.L4\n.L3:\n\tsubl\t$48, %eax\n\tcmpb\t$9, %al\n\tjbe\t.L8\n\txorl\t%eax, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n\n",
".global isnum\n.type isnum, %function\nisnum:\n.LFB6:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tx0, [sp, 8]\n\tstr\twzr, [sp, 28]\n\tb\t.L2\n.L4:\n\tldrsw\tx0, [sp, 28]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 47\n\tbls\t.L3\n\tldrsw\tx0, [sp, 28]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 57\n\tbhi\t.L3\n\tldr\tw0, [sp, 28]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 28]\n.L2:\n\tldrsw\tx0, [sp, 28]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L4\n.L3:\n\tldrsw\tx0, [sp, 28]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n\tmov\tw0, 1\n\tb\t.L6\n.L5:\n\tmov\tw0, 0\n.L6:\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global isnum\n.type isnum, %function\nisnum:\n.LFB24:\n\t.cfi_startproc\n.L2:\n\tldrb\tw1, [x0]\n\tcbnz\tw1, .L4\n\tmov\tw0, 1\n.L1:\n\tret\n.L4:\n\tsub\tw1, w1, #48\n\tadd\tx0, x0, 1\n\tand\tw1, w1, 255\n\tcmp\tw1, 9\n\tbls\t.L2\n\tmov\tw0, 0\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global isnum\n.type isnum, %function\nisnum:\n.LFB41:\n\t.cfi_startproc\n\tldrb\tw1, [x0]\n\tcbz\tw1, .L4\n\tadd\tx0, x0, 1\n\tb\t.L3\n\t.p2align 2,,3\n.L8:\n\tldrb\tw1, [x0], 1\n\tcbz\tw1, .L4\n.L3:\n\tsub\tw1, w1, #48\n\tand\tw1, w1, 255\n\tcmp\tw1, 9\n\tbls\t.L8\n\tmov\tw0, 0\n\tret\n\t.p2align 2,,3\n.L4:\n\tmov\tw0, 1\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"pqzmjlrel\""
],
"var": [
"c"
]
},
{
"value": [
"\"psqyoivruj\""
],
"var": [
"c"
]
},
{
"value": [
"\"hwxxnyztfr\""
],
"var": [
"c"
]
},
{
"value": [
"\"zdpgtieriuzgfy\""
],
"var": [
"c"
]
},
{
"value": [
"\"blhylwmtljgagq\""
],
"var": [
"c"
]
},
{
"value": [
"\"m\""
],
"var": [
"c"
]
},
{
"value": [
"\"zzglcdwtqvjqodkte\""
],
"var": [
"c"
]
},
{
"value": [
"\"vdcnkwvrwzbmzamaodzlxxijs\""
],
"var": [
"c"
]
},
{
"value": [
"\"ipujvszvijxsmbawfhotamziayyawqi\""
],
"var": [
"c"
]
},
{
"value": [
"\"vfaybzludrrkiiq\""
],
"var": [
"c"
]
}
],
"output": [
{
"value": [
"\"pqzmjlrel\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"psqyoivruj\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"hwxxnyztfr\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"zdpgtieriuzgfy\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"blhylwmtljgagq\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"m\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"zzglcdwtqvjqodkte\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"vdcnkwvrwzbmzamaodzlxxijs\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"ipujvszvijxsmbawfhotamziayyawqi\"",
"0"
],
"var": [
"c",
"returnv"
]
},
{
"value": [
"\"vfaybzludrrkiiq\"",
"0"
],
"var": [
"c",
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_328rtgu9nb.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* c, int returnv) {
json output_json;
output_json["c"] = c;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* c = strdup(input_json["c"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = isnum(c);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(c, returnv);
}
|
master
|
null
|
{"livein": ["c"], "liveout": ["c"], "returnvarname": ["returnv"], "execcmd": "", "funname": "isnum", "funargs": ["c"], "typemap": {"c": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_328rtgu9nb.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
tykowale/learningC/ProgrammingInC/chapter10/ex4.c
|
int my_str_cmp (const char s1[], const char s2[])
{
int i = 0;
int are_equal = 0;
while ( s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0' ) {
++i;
}
if ( s1[i] == '\0' && s2[i] == '\0' ) {
are_equal = 1;
}
return are_equal;
}
|
int my_str_cmp(const char *s1, const char *s2)
|
int my_str_cmp (const char s1[], const char s2[])
|
my_str_cmp
|
[
"int",
"const char *",
"const char *"
] |
{
"code": [
".globl my_str_cmp\n.type my_str_cmp, @function\nmy_str_cmp:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L2\n.L4:\n\taddl\t$1, -8(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tje\t.L3\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n.L3:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n\tmovl\t$1, -4(%rbp)\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl my_str_cmp\n.type my_str_cmp, @function\nmy_str_cmp:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n.L5:\n\tmovb\t(%rdi,%rax), %dl\n\tmovb\t(%rsi,%rax), %cl\n\tcmpb\t%cl, %dl\n\tjne\t.L2\n\ttestb\t%dl, %dl\n\tjne\t.L3\n.L6:\n\txorl\t%eax, %eax\n\ttestb\t%cl, %cl\n\tsete\t%al\n\tret\n.L3:\n\tincq\t%rax\n\tjmp\t.L5\n.L2:\n\ttestb\t%dl, %dl\n\tje\t.L6\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n\n",
".globl my_str_cmp\n.type my_str_cmp, @function\nmy_str_cmp:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rdi), %edx\n\tmovzbl\t(%rsi), %ecx\n\tmovl\t$1, %eax\n\tcmpb\t%dl, %cl\n\tje\t.L2\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\ttestb\t%cl, %cl\n\tje\t.L15\n\tmovzbl\t(%rdi,%rax), %edx\n\taddq\t$1, %rax\n\tmovzbl\t-1(%rsi,%rax), %ecx\n\tcmpb\t%cl, %dl\n\tjne\t.L3\n.L2:\n\ttestb\t%dl, %dl\n\tjne\t.L16\n.L4:\n\txorl\t%eax, %eax\n\ttestb\t%cl, %cl\n\tsete\t%al\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\txorl\t%eax, %eax\n\ttestb\t%dl, %dl\n\tje\t.L4\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n\n",
".global my_str_cmp\n.type my_str_cmp, %function\nmy_str_cmp:\n.LFB0:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tx0, [sp, 8]\n\tstr\tx1, [sp]\n\tstr\twzr, [sp, 24]\n\tstr\twzr, [sp, 28]\n\tb\t.L2\n.L4:\n\tldr\tw0, [sp, 24]\n\tadd\tw0, w0, 1\n\tstr\tw0, [sp, 24]\n.L2:\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw1, [x0]\n\tldrsw\tx0, [sp, 24]\n\tldr\tx2, [sp]\n\tadd\tx0, x2, x0\n\tldrb\tw0, [x0]\n\tcmp\tw1, w0\n\tbne\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbeq\t.L3\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L4\n.L3:\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp, 8]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n\tldrsw\tx0, [sp, 24]\n\tldr\tx1, [sp]\n\tadd\tx0, x1, x0\n\tldrb\tw0, [x0]\n\tcmp\tw0, 0\n\tbne\t.L5\n\tmov\tw0, 1\n\tstr\tw0, [sp, 28]\n.L5:\n\tldr\tw0, [sp, 28]\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global my_str_cmp\n.type my_str_cmp, %function\nmy_str_cmp:\n.LFB13:\n\t.cfi_startproc\n\tmov\tx2, 0\n.L5:\n\tldrb\tw3, [x0, x2]\n\tldrb\tw4, [x1, x2]\n\tcmp\tw3, w4\n\tbne\t.L2\n\tcbnz\tw3, .L3\n.L6:\n\tcmp\tw4, 0\n\tcset\tw0, eq\n.L1:\n\tret\n.L3:\n\tadd\tx2, x2, 1\n\tb\t.L5\n.L2:\n\tcbz\tw3, .L6\n\tmov\tw0, 0\n\tb\t.L1\n\t.cfi_endproc\n\n",
".global my_str_cmp\n.type my_str_cmp, %function\nmy_str_cmp:\n.LFB23:\n\t.cfi_startproc\n\tldrb\tw3, [x0]\n\tsub\tx4, x1, #1\n\tldrb\tw1, [x1]\n\tmov\tx2, 1\n\tcmp\tw1, w3\n\tbne\t.L3\n\t.p2align 3,,7\n.L2:\n\tcbz\tw3, .L4\n\tcbz\tw1, .L14\n\tldrb\tw3, [x0, x2]\n\tadd\tx2, x2, 1\n\tldrb\tw1, [x4, x2]\n\tcmp\tw3, w1\n\tbeq\t.L2\n.L3:\n\tmov\tw0, 0\n\tcbz\tw3, .L4\n\tret\n\t.p2align 2,,3\n.L4:\n\tcmp\tw1, 0\n\tcset\tw0, eq\n\tret\n\t.p2align 2,,3\n.L14:\n\tmov\tw0, 0\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"\"atg\"",
"\"eltutkknguyghbylzimmghyleaiesk\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"xlfklntycd\"",
"\"vgoqfkmozafwexxwizvoepobxdnvq\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"bg\"",
"\"exymguugayaauxitzczqhyg\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"kfntte\"",
"\"mqpyiznjlaexfomfyernh\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"ceqmmxnkldohlrpxgvq\"",
"\"nahtvhdkwkwvpsf\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"bozngeziqfuegefpplhonbhdd\"",
"\"hgsmesopscbggyluhl\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"aiebdiiruntqozhsczxulcvj\"",
"\"gebxrmlslaohptbwfzsb\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"wkznlzbfunmtzsfafrygy\"",
"\"hzvx\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"rchvlqr\"",
"\"ghpsvfrftvxd\""
],
"var": [
"s1",
"s2"
]
},
{
"value": [
"\"conmokdbdzqrxqaccwkaanlwy\"",
"\"pipzkukxvz\""
],
"var": [
"s1",
"s2"
]
}
],
"output": [
{
"value": [
"0",
"\"atg\"",
"\"eltutkknguyghbylzimmghyleaiesk\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"xlfklntycd\"",
"\"vgoqfkmozafwexxwizvoepobxdnvq\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"bg\"",
"\"exymguugayaauxitzczqhyg\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"kfntte\"",
"\"mqpyiznjlaexfomfyernh\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"ceqmmxnkldohlrpxgvq\"",
"\"nahtvhdkwkwvpsf\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"bozngeziqfuegefpplhonbhdd\"",
"\"hgsmesopscbggyluhl\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"aiebdiiruntqozhsczxulcvj\"",
"\"gebxrmlslaohptbwfzsb\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"wkznlzbfunmtzsfafrygy\"",
"\"hzvx\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"rchvlqr\"",
"\"ghpsvfrftvxd\""
],
"var": [
"returnv",
"s1",
"s2"
]
},
{
"value": [
"0",
"\"conmokdbdzqrxqaccwkaanlwy\"",
"\"pipzkukxvz\""
],
"var": [
"returnv",
"s1",
"s2"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_5600ori7sc.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(char* s1, char* s2, int returnv) {
json output_json;
output_json["s1"] = s1;
output_json["s2"] = s2;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
char* s1 = strdup(input_json["s1"].get<std::string>().c_str());
char* s2 = strdup(input_json["s2"].get<std::string>().c_str());
clock_t begin = clock();
int returnv = my_str_cmp(s1, s2);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(s1, s2, returnv);
}
|
master
|
null
|
{"livein": ["s1", "s2"], "liveout": ["s1", "s2"], "returnvarname": ["returnv"], "execcmd": "", "funname": "my_str_cmp", "funargs": ["s1", "s2"], "typemap": {"s1": "string", "s2": "string", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_5600ori7sc.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
andres-erbsen/baseconvert/opt/shortcuts.c
|
int magic(int a, int b) {
if (a < 2 || b < 2) return 0;
int r;
while (1) {
if (b > a) {
r = a;
a = b;
b = r;
}
r = a%b;
a /= b;
if (r) return 0;
else if (a == 1) return b;
}
}
|
int magic(inta, intb)
|
int magic(int a, int b)
|
magic
|
[
"int",
"int",
"int"
] |
{
"code": [
".globl magic\n.type magic, @function\nmagic:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tcmpl\t$1, -20(%rbp)\n\tjle\t.L2\n\tcmpl\t$1, -24(%rbp)\n\tjg\t.L3\n.L2:\n\tmovl\t$0, %eax\n\tjmp\t.L4\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjle\t.L5\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -20(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tje\t.L6\n\tmovl\t$0, %eax\n\tjmp\t.L4\n.L6:\n\tcmpl\t$1, -20(%rbp)\n\tjne\t.L3\n\tmovl\t-24(%rbp), %eax\n.L4:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n\n",
".globl magic\n.type magic, @function\nmagic:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %r8d\n\tcmpl\t$1, %edi\n\tjle\t.L6\n\tcmpl\t$1, %esi\n\tjle\t.L6\n.L4:\n\tcmpl\t%r8d, %eax\n\tjge\t.L3\n\tmovl\t%eax, %edx\n\tmovl\t%r8d, %eax\n\tmovl\t%edx, %r8d\n.L3:\n\tcltd\n\tidivl\t%r8d\n\ttestl\t%edx, %edx\n\tjne\t.L6\n\tcmpl\t$1, %eax\n\tjne\t.L4\n\tjmp\t.L2\n.L6:\n\txorl\t%r8d, %r8d\n.L2:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n\n",
".globl magic\n.type magic, @function\nmagic:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcmpl\t$1, %edi\n\tjle\t.L6\n\tcmpl\t$1, %esi\n\tjg\t.L4\n\tjmp\t.L6\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tcmpl\t$1, %eax\n\tje\t.L9\n.L4:\n\tcmpl\t%esi, %eax\n\tjge\t.L3\n\tmovl\t%eax, %edx\n\tmovl\t%esi, %eax\n\tmovl\t%edx, %esi\n.L3:\n\tcltd\n\tidivl\t%esi\n\ttestl\t%edx, %edx\n\tje\t.L10\n.L6:\n\txorl\t%eax, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovl\t%esi, %eax\n\tret\n\t.cfi_endproc\n\n",
".global magic\n.type magic, %function\nmagic:\n.LFB6:\n\t.cfi_startproc\n\tsub\tsp, sp, #32\n\t.cfi_def_cfa_offset 32\n\tstr\tw0, [sp, 12]\n\tstr\tw1, [sp, 8]\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 1\n\tble\t.L2\n\tldr\tw0, [sp, 8]\n\tcmp\tw0, 1\n\tbgt\t.L3\n.L2:\n\tmov\tw0, 0\n\tb\t.L4\n.L3:\n\tldr\tw1, [sp, 8]\n\tldr\tw0, [sp, 12]\n\tcmp\tw1, w0\n\tble\t.L5\n\tldr\tw0, [sp, 12]\n\tstr\tw0, [sp, 28]\n\tldr\tw0, [sp, 8]\n\tstr\tw0, [sp, 12]\n\tldr\tw0, [sp, 28]\n\tstr\tw0, [sp, 8]\n.L5:\n\tldr\tw0, [sp, 12]\n\tldr\tw1, [sp, 8]\n\tsdiv\tw2, w0, w1\n\tldr\tw1, [sp, 8]\n\tmul\tw1, w2, w1\n\tsub\tw0, w0, w1\n\tstr\tw0, [sp, 28]\n\tldr\tw1, [sp, 12]\n\tldr\tw0, [sp, 8]\n\tsdiv\tw0, w1, w0\n\tstr\tw0, [sp, 12]\n\tldr\tw0, [sp, 28]\n\tcmp\tw0, 0\n\tbeq\t.L6\n\tmov\tw0, 0\n\tb\t.L4\n.L6:\n\tldr\tw0, [sp, 12]\n\tcmp\tw0, 1\n\tbne\t.L3\n\tldr\tw0, [sp, 8]\n.L4:\n\tadd\tsp, sp, 32\n\t.cfi_def_cfa_offset 0\n\tret\n\t.cfi_endproc\n\n",
".global magic\n.type magic, %function\nmagic:\n.LFB24:\n\t.cfi_startproc\n\tmov\tw2, w0\n\tmov\tw0, w1\n\tcmp\tw2, 1\n\tccmp\tw1, 1, 4, gt\n\tble\t.L6\n.L4:\n\tcmp\tw2, w0\n\tbge\t.L3\n\tmov\tw1, w2\n\tmov\tw2, w0\n\tmov\tw0, w1\n.L3:\n\tsdiv\tw1, w2, w0\n\tmsub\tw3, w1, w0, w2\n\tmov\tw2, w1\n\tcbnz\tw3, .L6\n\tcmp\tw1, 1\n\tbne\t.L4\n.L2:\n\tret\n.L6:\n\tmov\tw0, 0\n\tb\t.L2\n\t.cfi_endproc\n\n",
".global magic\n.type magic, %function\nmagic:\n.LFB39:\n\t.cfi_startproc\n\tcmp\tw0, 1\n\tccmp\tw1, 1, 4, gt\n\tbgt\t.L4\n\tb\t.L6\n\t.p2align 2,,3\n.L10:\n\tbeq\t.L9\n.L4:\n\tcmp\tw0, w1\n\tcsel\tw2, w0, w1, ge\n\tcsel\tw1, w1, w0, ge\n\tsdiv\tw0, w2, w1\n\tmsub\tw2, w0, w1, w2\n\tcmp\tw0, 1\n\tcbz\tw2, .L10\n.L6:\n\tmov\tw0, 0\n\tret\n\t.p2align 2,,3\n.L9:\n\tmov\tw0, w1\n\tret\n\t.cfi_endproc\n\n"
],
"target": [
"real_gcc_x86_O0",
"real_gcc_x86_Os",
"real_gcc_x86_O3",
"real_gcc_arm_O0",
"real_gcc_arm_Os",
"real_gcc_arm_O3"
]
}
| null |
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
# 1
| null |
{
"dummy_funcs": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"dummy_funcs_seed": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"input": [
{
"value": [
"76",
"68"
],
"var": [
"a",
"b"
]
},
{
"value": [
"119",
"72"
],
"var": [
"a",
"b"
]
},
{
"value": [
"0",
"117"
],
"var": [
"a",
"b"
]
},
{
"value": [
"61",
"116"
],
"var": [
"a",
"b"
]
},
{
"value": [
"88",
"11"
],
"var": [
"a",
"b"
]
},
{
"value": [
"29",
"35"
],
"var": [
"a",
"b"
]
},
{
"value": [
"31",
"97"
],
"var": [
"a",
"b"
]
},
{
"value": [
"68",
"22"
],
"var": [
"a",
"b"
]
},
{
"value": [
"126",
"124"
],
"var": [
"a",
"b"
]
},
{
"value": [
"30",
"72"
],
"var": [
"a",
"b"
]
}
],
"output": [
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
},
{
"value": [
"0"
],
"var": [
"returnv"
]
}
]
}
| null |
extern "C" {
#include "/tmp/pytmpfile_2d0c40262005_45cw4dgww8.c"
}
#include <vector>
#include <nlohmann/json.hpp>
#include <fstream>
#include <iomanip>
#include <clib/synthesizer.h>
#include <time.h>
#include <math.h>
#include <iostream>
char* output_file;
char* pre_accel_dump_file; // optional dump file.
using json = nlohmann::json;
const char* __asan_default_options() {
return "detect_leaks=0";
}
clock_t AcceleratorStart;
clock_t AcceleratorTotalNanos = 0;
void StartAcceleratorTimer() {
AcceleratorStart = clock();
}
void StopAcceleratorTimer() {
AcceleratorTotalNanos += (clock()) - AcceleratorStart;
}
void write_output(int a, int b, int returnv) {
json output_json;
output_json["returnv"] = returnv;
std::ofstream out_str(output_file);
out_str << std::setw(4) << output_json << std::endl;
}
int main(int argc, char** argv) {
char* inpname = argv[1];
output_file = argv[2];
std::ifstream ifs(inpname);
json input_json = json::parse(ifs);
int a = input_json["a"];
int b = input_json["b"];
clock_t begin = clock();
int returnv = magic(a, b);
clock_t end = clock();
std::cout << "Time: " << (double)(end - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "AccTime: " << (double)AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl;
write_output(a, b, returnv);
}
|
master
|
null
|
{"livein": ["a", "b"], "liveout": [], "returnvarname": ["returnv"], "execcmd": "", "funname": "magic", "funargs": ["a", "b"], "typemap": {"a": "int32", "b": "int32", "returnv": "int32"}, "required_includes": ["/tmp/pytmpfile_2d0c40262005_45cw4dgww8.c"], "classmap": {}, "range": {}, "needs_cast": {}, "globals": []}
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6