data_source stringclasses 2
values | prompt listlengths 1 1 | ability stringclasses 1
value | reward_model dict | extra_info dict | question stringlengths 966 38.9k |
|---|---|---|---|---|---|
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(){\nint n,m,i;\nscanf(\"%d %d\",&n,&m);\nfor(i=0;i<n;i++)scanf(\"%*d\");\nprintf(\"%d\\n\",(n-2)/(m-1)+1);\nreturn 0;\n}\n\nUnoptimized Assemb... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%*d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\t... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%*d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr6... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(){
int n,m,i;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)scanf("%*d");
printf("%d\n",(n-2)/(m-1)+1);
return 0;
}
Unoptimized Assembly Code:
.file "temp.c"
.text
.sectio... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \ni;y;z;main(a){for(;~scanf(\"%d\",&a);)i++?a%2?z--:a%4?y++:z++:0;puts(z<0-!y?\"No\":\"Yes\");}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ti\n... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"No\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"No\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpu... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
i;y;z;main(a){for(;~scanf("%d",&a);)i++?a%2?z--:a%4?y++:z++:0;puts(z<0-!y?"No":"Yes");}
Unoptimized Assembly Code:
.file "temp.c"
.text
.globl i
.bss
.align 4
.type i, @object
.size i, 4... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\n#define MOD_BY 998244353\n\nint add(int a, int b) {\n\treturn a + b - MOD_BY * (a + b >= MOD_BY);\n}\n\nint mul(int a, int b) {\n\tint r = 0;\n\twhi... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tleal\t(%rdi,%rsi), %eax\n\tleal\t-998244353(%rax), %edx\n\tcmpl\t$998244352, %eax\n\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tadd, .-add\n\t.p2align 4... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tleal\t(%rdi,%rsi), %eax\n\tleal\t-998244353(%rax), %edx\n\tcmpl\t$998244352, %eax\n\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tadd, .-add\n\t.p2align 4\n\t.g... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#define MOD_BY 998244353
int add(int a, int b) {
return a + b - MOD_BY * (a + b >= MOD_BY);
}
int mul(int a, int b) {
int r = 0;
while (b > 0) {
if (b & 1) r = add(r, a... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"0\\n\");\n else if(n==0)\n printf(\"1\\n\");\n return 0;\... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n==1)
printf("0\n");
else if(n==0)
printf("1\n");
return 0;
}
Unoptimized Assembly Code:
.file "te... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<string.h>\nint main(void){\nchar s[11];\n scanf(\"%s\",&s);\n \n for(int i=0;i<strlen(s);i+=2){\n if(s[i]!='h'||s[i+1]!='i'){\nprintf(\"No... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n\tendbr6... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tp... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<string.h>
int main(void){
char s[11];
scanf("%s",&s);
for(int i=0;i<strlen(s);i+=2){
if(s[i]!='h'||s[i+1]!='i'){
printf("No");
return 0;
}
}
printf("Y... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <string.h>\n\nint main(void) {\n\t/* [z][y][x] */\n\tchar nowstatus[7][7][7]={0};\n\tchar nextstatus[7][7][7]={0};\n\tchar a[27];\n\tchar b[2... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"Case %d:\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"Case %d:\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n\tendb... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <string.h>
int main(void) {
/* [z][y][x] */
char nowstatus[7][7][7]={0};
char nextstatus[7][7][7]={0};
char a[27];
char b[27];
int N;
int M;
int i,j,k,l,m,n;
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main()\n{\n int N;\n scanf(\"%d\", &N);\n int a[N];\n int all = 0;\n for (int i = 0; i < N; i++)\n {\n scanf(\"%d\", &a... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"\"\n.LC2:\n\t.string\t\"%d \"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"\"\n.LC2:\n\t.string\t\"%d \"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpus... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main()
{
int N;
scanf("%d", &N);
int a[N];
int all = 0;
for (int i = 0; i < N; i++)
{
scanf("%d", &a[i]);
all ^= a[i];
}
f... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\ntypedef long long ll;\ntypedef char keytype;\n\nint gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%ecx, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%ecx, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L2\n\tr... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;
typedef char keytype;
int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct {\n\tint key, id;\n} data;\n\nvoid merge_sort(data x[], int n)\n{\n\tstatic data y[100001] = {};\n\tif (n <= 1) ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.type\tmerge_sort.part.0, @function\nmerge_sort.part.0:\n.LFB44:\n\t.cfi_startproc\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t%esi, %r12d\n\tsarl\t%r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovq... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.type\tmerge_sort.part.0, @function\nmerge_sort.part.0:\n.LFB44:\n\t.cfi_startproc\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t%esi, %r12d\n\tsarl\t%r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovq\t%rdi... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int key, id;
} data;
void merge_sort(data x[], int n)
{
static data y[100001] = {};
if (n <= 1) return;
merge_sort(&(x[0]), n/2);
me... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main(void) {\n\tchar s[16];\n\tint y = 0,i,j,sum = 0,u,p[16] = {0},q[16] = {0,2,3,4,5,6,7,2,3,4,5,6},a = 0,c;\n\tscanf(\"%s\",s);\n\tfor(i = 0;i... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC3:\n\t.string\t\"%d\\n\"\n.LC4:\n\t.string\t\"MULTIPLE\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC3:\n\t.string\t\"%d\\n\"\n.LC4:\n\t.string\t\"MULTIPLE\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendb... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main(void) {
char s[16];
int y = 0,i,j,sum = 0,u,p[16] = {0},q[16] = {0,2,3,4,5,6,7,2,3,4,5,6},a = 0,c;
scanf("%s",s);
for(i = 0;i <= 11;i++){
if(s[11 - i] != '?'){
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(){\n long int i,x,y;\n scanf(\"%ld%ld\",&x,&y);\n for(i=0;x<<i<=y;i++);\n printf(\"%ld\",i);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%ld%ld\"\n.LC1:\n\t.string\t\"%ld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40, %rsp\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%ld%ld\"\n.LC1:\n\t.string\t\"%ld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40, %rsp\n\t.cfi... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(){
long int i,x,y;
scanf("%ld%ld",&x,&y);
for(i=0;x<<i<=y;i++);
printf("%ld",i);
}
Unoptimized Assembly Code:
.file "temp.c"
.text
.section .rodata
.LC0:
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \nunsigned long long popcnt64(unsigned long long n){\n\tconst unsigned long long m1=0x5555555555555555ULL;\n\tconst unsigned long long m2=0x3333333333333333ULL;\n\tconst un... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpopcnt64\n\t.type\tpopcnt64, @function\npopcnt64:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovabsq\t$6148914691236517205, %rdx\n\tmovq\t%rdi, %rax\n\tmovabsq\t$1085102592571150095, %rcx\n\tshrq\t%rax\n\tandq\t%rdx, %rdi\n\tandq\t%rdx, %rax\n\tmov... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpopcnt64\n\t.type\tpopcnt64, @function\npopcnt64:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tmovabsq\t$6148914691236517205, %rdx\n\tmovq\t%rdi, %rax\n\tmovabsq\t$1085102592571150095, %rcx\n\tshrq\t%rax\n\tandq\t%rdx, %rdi\n\tandq\t%rdx, %rax\n\tmovabsq\t... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
unsigned long long popcnt64(unsigned long long n){
const unsigned long long m1=0x5555555555555555ULL;
const unsigned long long m2=0x3333333333333333ULL;
const unsigned long long m4=0x0f0f0f0f0... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint N;\nint a[114514];\n\nint main(void) {\n\tint i;\n\tint minIndex, minValue;\n\tif (scanf(\"%d\", &N) != 1) return 1;\n\tfor (i = 0; i < N; i++) ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_c... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int N;
int a[114514];
int main(void) {
int i;
int minIndex, minValue;
if (scanf("%d", &N) != 1) return 1;
for (i = 0; i < N; i++) {
if (scanf("%d", &a[i]) != 1) return ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n\n\nint top, S[10000];\n\nvoid push(int x){\n S[++top] = x;\n}\n\nint pop(){\n top--;\n return S[top+1];\n}\n\nint main(void)\... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovl\ttop(%rip), %eax\n\tleaq\tS(%rip), %rdx\n\taddl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tcltq\n\tmovl\t%edi, (%rdx,%rax,4)\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovl\ttop(%rip), %eax\n\tleaq\tS(%rip), %rdx\n\taddl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tcltq\n\tmovl\t%edi, (%rdx,%rax,4)\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tpush,... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
int top, S[10000];
void push(int x){
S[++top] = x;
}
int pop(){
top--;
return S[top+1];
}
int main(void)
{
int a, b;
top = 0;
char s[100];
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n//set many funcs template\n//Ver.20181228\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<time.h>\n#define inf 1072114514\n#defi... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tmax, .-max\n\t.p2align 4\n\t.globl\tmin\n\t.type\tmin, @function\nmi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tmax, .-max\n\t.p2align 4\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.L... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
//set many funcs template
//Ver.20181228
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#def... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main() {\n\tlong long int k, s[200050] = {},left,right,memo=0;\n\tscanf(\"%lld\", &k);\n\tfor (int i = 1;... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%lld %lld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%lld %lld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendb... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main() {
long long int k, s[200050] = {},left,right,memo=0;
scanf("%lld", &k);
for (int i = 1; i <= k; i++) {
scanf("%lld", &s[i]... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <limits.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <time.h>\n#include <unistd.h>\n#include <math.h>\n\n#defi... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tcomp, .-comp\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"Y... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tcomp, .-comp\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"Yes\"\n... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#define P 1000000007
int comp(const vo... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \nd,r;char s[9];main(n){for(scanf(\"%d%*c\",&n);n--;d+=*s-65?-1:1,r|=d<0)gets(s);d=!puts(r|d?\"NO\":\"YES\");}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"NO\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"%d%*c\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendb... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"NO\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"%d%*c\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
d,r;char s[9];main(n){for(scanf("%d%*c",&n);n--;d+=*s-65?-1:1,r|=d<0)gets(s);d=!puts(r|d?"NO":"YES");}
Unoptimized Assembly Code:
.file "temp.c"
.text
.globl d
.bss
.align 4
.type d, @obj... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n/* SPDX-License-Identifier: X11\n *\n * Copyright 2020 Elias Yuan <a@jthv.ai>, MIT/X11 License\n * https://jthv.ai/LICENSE/X11.txt\n *\n * ANU-CPC Complexity Workshop -... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lu %lu\"\n.LC1:\n\t.string\t\"%lu\\n\"\n.LC2:\n\t.string\t\"-1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lu %lu\"\n.LC1:\n\t.string\t\"%lu\\n\"\n.LC2:\n\t.string\t\"-1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendb... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
/* SPDX-License-Identifier: X11
*
* Copyright 2020 Elias Yuan <a@jthv.ai>, MIT/X11 License
* https://jthv.ai/LICENSE/X11.txt
*
* ANU-CPC Complexity Workshop - A: Two Integers
* 2020-04-... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n\nint main (void) {\n int n;\n scanf(\"%d\", &n);\n long int a[n + 1];\n\n if (n == 1 || n == 2) {\n printf(\"... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC3:\n\t.string\t\"%ld\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB39:\n\t.cfi_startproc\n\tendb... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC3:\n\t.string\t\"%ld\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
int main (void) {
int n;
scanf("%d", &n);
long int a[n + 1];
if (n == 1 || n == 2) {
printf("0\n");
} else {
a[0] = 1;... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main() {\n\t\n\tint n, k, x=1, y=1, hasil;\n\t\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &k);\n\t\n\tfor(int i=0; i<n; i++){\n\t\tif(x*2<=x+k){\n\t... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_of... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main() {
int n, k, x=1, y=1, hasil;
scanf("%d", &n);
scanf("%d", &k);
for(int i=0; i<n; i++){
if(x*2<=x+k){
x*=2;
}
else if(x*2>x+k){
x+=k;
}
}
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <string.h>\n\nint main(void){\n\n char s[11];\n scanf(\"%s\", s);\n for (int i = 0; i < strlen(s); i += 2) {\n if (s[i] != 'h' || s[i+1... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n\tendbr6... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tp... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <string.h>
int main(void){
char s[11];
scanf("%s", s);
for (int i = 0; i < strlen(s); i += 2) {
if (s[i] != 'h' || s[i+1] != 'i') {
printf("No\n");
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#if 0\ncat <<EOF >mistaken-paste\n#endif\n// thx Ebi-chan!\n\n#pragma GCC diagnostic ignored \"-Wincompatible-pointer-types\"\n#define _USE_MATH_DEFINES\n\n#include <stdi... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpfracomp\n\t.type\tpfracomp, @function\npfracomp:\n.LFB74:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rdx\n\tmovq\t8(%rdi), %rax\n\timulq\t8(%rsi), %rdx\n\timulq\t(%rsi), %rax\n\tcmpq\t%rax, %rdx\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%a... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpfracomp\n\t.type\tpfracomp, @function\npfracomp:\n.LFB74:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rdx\n\tmovq\t8(%rdi), %rax\n\timulq\t8(%rsi), %rdx\n\timulq\t(%rsi), %rax\n\tcmpq\t%rax, %rdx\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %ea... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#if 0
cat <<EOF >mistaken-paste
#endif
// thx Ebi-chan!
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n\nint main(void)\n{\n char s[5];\n scanf(\"%s\", s);\n for (int i=0; i<3; i++){\n if (s[i] == s[i+1]){\n printf(\"Bad\");\n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"Bad\"\n.LC2:\n\t.string\t\"Good\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendb... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"Bad\"\n.LC2:\n\t.string\t\"Good\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void)
{
char s[5];
scanf("%s", s);
for (int i=0; i<3; i++){
if (s[i] == s[i+1]){
printf("Bad");
return 0;
}
}
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main()\n{\n\tint i, N, W, w[101], v[101];\n\tscanf(\"%d %d\", &N, &W);\n\tfor (i = 1; i <= N; i++) scanf(\"%d %d\", &(w[i]), &(v[i]));\n\t\n\tin... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_de... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main()
{
int i, N, W, w[101], v[101];
scanf("%d %d", &N, &W);
for (i = 1; i <= N; i++) scanf("%d %d", &(w[i]), &(v[i]));
int j, k, l, dp[2][101][301] = {};
for (i =... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint A[100005];\nint tmp[100005];\n\nint main() {\n\n\tint N;\n\n\tscanf(\"%d\",&N);\n\n\tint i;\n\n\tfor (i = 0; i < N; i++) {\n\t\tscanf(\" %d\",&A... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\" %d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tend... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\" %d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int A[100005];
int tmp[100005];
int main() {
int N;
scanf("%d",&N);
int i;
for (i = 0; i < N; i++) {
scanf(" %d",&A[i]);
tmp[A[i]]++;
}
int k = 0;
for (i = 0... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <math.h>\n\nint main(int argc, char** argv)\n{\n int n,k;\n\n scanf(\"%d\", &n);\n scanf(\"%d\", &k);\n\n // log_k(n)\n // log... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_c... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <math.h>
int main(int argc, char** argv)
{
int n,k;
scanf("%d", &n);
scanf("%d", &k);
// log_k(n)
// log(n)/log(k)
printf("%d\n", (int)(log(... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main (){\n \n char str[10005];\n scanf(\"%[^\\n]\", str);\n int flag = 0;\n for(int i = 0;str[i] != '\\0';i++){\n \tif(str[i] ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%[^\\n]\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"NO\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\te... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%[^\\n]\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"NO\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main (){
char str[10005];
scanf("%[^\n]", str);
int flag = 0;
for(int i = 0;str[i] != '\0';i++){
if(str[i] == ' '){
if(str[i-1] != str[i+1]... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main()\n{\n\tint i, j, k, N, L[101], count = 0;\n\tscanf(\"%d\", &N);\n\tfor (i = 1; i <= N; i++) scanf(\"%d\", &(L[i]));\n\tfor (i = 1; i <= N ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_c... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main()
{
int i, j, k, N, L[101], count = 0;
scanf("%d", &N);
for (i = 1; i <= N; i++) scanf("%d", &(L[i]));
for (i = 1; i <= N - 2; i++) {
for (j = i + 1; j <= N - 1... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\nint main(){\nint H, W, i, j;\nfor (;;){\nscanf(\"%d %d\", &H, &W);\nif (H == 0 && W == 0 ) break;\nfor ( i = 1; i < H+1; i++ ){\nfor ( j = 1; j < W+1;... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offse... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main(){
int H, W, i, j;
for (;;){
scanf("%d %d", &H, &W);
if (H == 0 && W == 0 ) break;
for ( i = 1; i < H+1; i++ ){
for ( j = 1; j < W+1; j++)
putchar('#');
putchar('\n');... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <float.h>\n#include <limits.h>\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <time.h>\n\n// 内部定数\n#define D_ON\t\t\t... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tfSortFncVd\n\t.type\tfSortFncVd, @function\nfSortFncVd:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tcmpl\t%eax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetl\t%al\n\tmovzbl\t%al, %eax\n\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tfSortFncVd\n\t.type\tfSortFncVd, @function\nfSortFncVd:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tcmpl\t%eax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetl\t%al\n\tmovzbl\t%al, %eax\n\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.siz... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// 内部定数
#define D_ON 1 // 汎用フラグ - ON
#define D_OF... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main (void){\n\n\tchar s[100000];\n\tscanf(\"%s\",s);\n\n\tint count = 0;\n\tint i;\n\n\tfor(i = 0; s[i] != '\\0'; i++){\n\n\t\tif(s[i] != s[i +... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tleaq\t-98304(%rsp),... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tleaq\t-98304(%rsp), %r11\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main (void){
char s[100000];
scanf("%s",s);
int count = 0;
int i;
for(i = 0; s[i] != '\0'; i++){
if(s[i] != s[i + 1]){
count++;
}
}
printf("%d\n", count... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main()\n{\n\tlong long x;\n\tscanf(\"%lld\", &x);\n\t\n\tlong long ans = (x - 1) / 11 * 2;\n\tif ((x - 1) % 11 < 6) ans += 1;\n\telse ans += 2;\... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.c... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main()
{
long long x;
scanf("%lld", &x);
long long ans = (x - 1) / 11 * 2;
if ((x - 1) % 11 < 6) ans += 1;
else ans += 2;
printf("%lld\n", ans);
fflush(stdout);... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint f(long h[2], const int a[2], const int b[2]){\n\tif(a[0]*b[1]>a[1]*b[0]){\n\t\tlo... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %r8d\n\tmovq\t%rdi, %rcx\n\tmovslq\t4(%rsi), %rdi\n\tmovslq\t%r8d, %rsi\n\timull\t4(%rdx), %r8d\n\tmovq\t%rdi, %rax\n\timull\t(%rdx), %eax\n\tcmpl\t%eax, %r8d\n\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %r8d\n\tmovq\t%rdi, %rcx\n\tmovslq\t4(%rsi), %rdi\n\tmovslq\t%r8d, %rsi\n\timull\t4(%rdx), %r8d\n\tmovq\t%rdi, %rax\n\timull\t(%rdx), %eax\n\tcmpl\t%eax, %r8d\n\tjle\t... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int f(long h[2], const int a[2], const int b[2]){
if(a[0]*b[1]>a[1]*b[0]){
long r = (h[1]+a[1]-1)/a[1];
h[0] =... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n\ntypedef int32_t i32;\ntypedef int64_t i64;\n\ntypedef struct directed_edge {\n int32_t... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcmp_deque_size\n\t.type\tcmp_deque_size, @function\ncmp_deque_size:\n.LFB50:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rdx\n\tmovq\t(%rsi), %rcx\n\tmovq\t16(%rdx), %rax\n\tsubq\t8(%rdx), %rax\n\tandq\t24(%rdx), %rax\n\tmovq\t16(%rcx), %rdx\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcmp_deque_size\n\t.type\tcmp_deque_size, @function\ncmp_deque_size:\n.LFB50:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rdx\n\tmovq\t(%rsi), %rcx\n\tmovq\t16(%rdx), %rax\n\tsubq\t8(%rdx), %rax\n\tandq\t24(%rdx), %rax\n\tmovq\t16(%rcx), %rdx\n\tsub... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
typedef int32_t i32;
typedef int64_t i64;
typedef struct directed_edge {
int32_t vertex;
int32_t next;
} graph_e... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n\nint main(void){\n int n , k;\n scanf(\"%d %d\",&n ,&k);\n\n int check[10] = {0} , a;\n for(int i = 0;i < k;i ++){\n scanf(\"%d\",&a);\n che... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\te... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void){
int n , k;
scanf("%d %d",&n ,&k);
int check[10] = {0} , a;
for(int i = 0;i < k;i ++){
scanf("%d",&a);
check[a] ++;
}
int ans , flag = 0;
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define N 2000000\n#define D 20\n\nstruct node{\n int key;\n struct node *next;\n struct node *prev;\n};\n\n... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tinit\n\t.type\tinit, @function\ninit:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %xmm0\n\tmovq\t%rax, nil(%rip)\n\tpunpcklqdq\t%xmm0, %xmm0\n\tmovups\t%... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tinit\n\t.type\tinit, @function\ninit:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %xmm0\n\tmovq\t%rax, nil(%rip)\n\tpunpcklqdq\t%xmm0, %xmm0\n\tmovups\t%xmm0, ... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 2000000
#define D 20
struct node{
int key;
struct node *next;
struct node *prev;
};
typedef struct node * NodePointer;
N... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n\nint main(void)\n{\n int x[60], y[60];\n int n;\n int cnt = 0;\n int i;\n double ans;\n\n while(1){\n scanf(\"%d\", &n);\n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d %d\"\n.LC4:\n\t.string\t\"%d %.1lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startpro... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d %d\"\n.LC4:\n\t.string\t\"%d %.1lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\te... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void)
{
int x[60], y[60];
int n;
int cnt = 0;
int i;
double ans;
while(1){
scanf("%d", &n);
if(n == 0) break;
for(i = ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\nint main(void){\n char ch, C;\n for(;;){\n scanf(\"%c\",&ch);\n if(ch == '\\n'){\n break;\n }\n else if(ch == ' '){\n printf(\" \");\n... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%c\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_of... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%c\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main(void){
char ch, C;
for(;;){
scanf("%c",&ch);
if(ch == '\n'){
break;
}
else if(ch == ' '){
printf(" ");
}
else if('A' <= ch && ch <= 'Z'){
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <string.h>\n\nint main(){\n\tchar a[20];\n\tscanf(\"%s\", &a);\n\tmemset(a+3, '\\0', 17);\n\tprintf(\"%s\\n\", a);\n\n\treturn 0;\n}\n\nUnopt... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_of... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <string.h>
int main(){
char a[20];
scanf("%s", &a);
memset(a+3, '\0', 17);
printf("%s\n", a);
return 0;
}
Unoptimized Assembly Code:
.file "temp.c"
.text
.... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <limits.h>\n#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);\n#define MAX(a... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tcomp, .-comp\n\t.p2align 4\n\t.globl\tfill\n\t.type\tfill, @function\nfill:\n.LFB52... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tcomp, .-comp\n\t.p2align 4\n\t.globl\tfill\n\t.type\tfill, @function\nfill:\n.LFB52:\n\t.... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main()\n{\n int a,b,x,y;\n scanf(\"%d%d\",&a,&b);\n if(a>=b)\n {\n x=a;\n a=a-1;\n if(a>=b)\n {\n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_de... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main()
{
int a,b,x,y;
scanf("%d%d",&a,&b);
if(a>=b)
{
x=a;
a=a-1;
if(a>=b)
{
y=a;
}
else
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <string.h>\n#include <math.h>\n#define Max(a, b) ((a) > (b) ? (a) : (b))\n#define Min(a, b) ((a) >... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendb... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define Abs(x... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \nint main(){\nint n,m;\n\tfor(;scanf(\"%d%d\",&n,&m),n;){\n\t\tint t=1001,pre,ans,cnt=0,i;\n\t\tfor(i=0;i<n;i++){\n\t\t\tint a; scanf(\"%d\",&a);\n\n\t\t\tint j;\n\t\t\tfo... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n.LC2:\n\t.string\t\"%d%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tend... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n.LC2:\n\t.string\t\"%d%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
int main(){
int n,m;
for(;scanf("%d%d",&n,&m),n;){
int t=1001,pre,ans,cnt=0,i;
for(i=0;i<n;i++){
int a; scanf("%d",&a);
int j;
for(j=m;j%a;j--);
if(j<t || (j==t && a<=pre)){
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nstruct tuple {\n int x;\n int y;\n};\n\nint asc(const void *a, const void *b) {\n... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tasc\n\t.type\tasc, @function\nasc:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t4(%rdi), %eax\n\tsubl\t4(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tasc, .-asc\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tasc\n\t.type\tasc, @function\nasc:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t4(%rdi), %eax\n\tsubl\t4(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tasc, .-asc\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
struct tuple {
int x;
int y;
};
int asc(const void *a, const void *b) {
return ((struct tuple *)a)->y - ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n// AOJ 1161: Verbal Arithmetic\n// 2018.1.9 bal4u@uu\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint m, sz;\nchar str[13][11]; int len[13], max;\nc... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcalc\n\t.type\tcalc, @function\ncalc:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\tm(%rip), %r10\n\tleaq\tlen(%rip), %rax\n\tleaq\tstr(%rip), %r8\n\tleaq\tassign(%rip), %rsi\n\tleaq\t(%r10,%r10,4), %rdx\n\tmovslq\t(%rax,%r10,4), %rax\n\tmovq... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcalc\n\t.type\tcalc, @function\ncalc:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\tm(%rip), %r10\n\tleaq\tlen(%rip), %rax\n\tleaq\tstr(%rip), %r8\n\tleaq\tassign(%rip), %rsi\n\tleaq\t(%r10,%r10,4), %rdx\n\tmovslq\t(%rax,%r10,4), %rax\n\tmovq\t%r10... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
// AOJ 1161: Verbal Arithmetic
// 2018.1.9 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int m, sz;
char str[13][11]; int len[13], max;
char tr['Z'+1], assign['Z'+1];
char... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<stdlib.h>\n#include<limits.h>\n\nstruct node {\n int id;\n int weight;\n struct node *next;\n};\nstruct node **list;\nint *dist;\n\nvoid In... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tInsert\n\t.type\tInsert, @function\nInsert:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t%edx, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovl\t%esi, ... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tInsert\n\t.type\tInsert, @function\nInsert:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t%edx, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovl\t%esi, %ebp\n... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
struct node {
int id;
int weight;
struct node *next;
};
struct node **list;
int *dist;
void Insert(int, int, int);
int Bellman(int,... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint a[200000];\nint b[200000];\n\nint main(void)\n{\n\tint n, m, i, j;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", a + i);... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"1\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"1\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpush... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int a[200000];
int b[200000];
int main(void)
{
int n, m, i, j;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", a + i);
}
scanf("%d", &m);
for (i = 0; i < m; i+... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(void)\n{\n\tint t,n,s;\n\tint i;\n\t\n\tfor(i=0;i<4;i++){\n\t\tscanf(\"%d %d\",&t,&n);\n\t\tif(t==1){\n\t\t\ts=n*6000;\n\t\t}\n\t\telse if(t==... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_de... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void)
{
int t,n,s;
int i;
for(i=0;i<4;i++){
scanf("%d %d",&t,&n);
if(t==1){
s=n*6000;
}
else if(t==2){
s=n*4000;
}
else if(t==3){
s=n*3000;
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n/*\n AOJ \n title:#3128\n @kankichi57301\n */\n#include <stdio.h>\n\nint n;\nint main()\n{\n int i,c,c0,min_;\n scanf(\"%d \",&n);\n scanf(\"%d \",&c0);\n for(i=mi... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d \"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d\\n%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d \"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d\\n%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendb... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
/*
AOJ
title:#3128
@kankichi57301
*/
#include <stdio.h>
int n;
int main()
{
int i,c,c0,min_;
scanf("%d ",&n);
scanf("%d ",&c0);
for(i=min_=1;i<n;i++)
{
scanf("%d",&c);
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(void)\n{\n int H,W,n,i;\n for(;;)\n {\n scanf(\"%d %d\",&H,&W);\n \n if((H==0)&&(W==0)) break;\n \n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offse... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void)
{
int H,W,n,i;
for(;;)
{
scanf("%d %d",&H,&W);
if((H==0)&&(W==0)) break;
for(n=0;n<H;n++)
{
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n#define int long long\n#define inf (int)(1e18)\n\nint max(int a, int b){\n\treturn a >= b ? a : b;\n}\n\nsigned main(){\n\tint N,... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovge\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tmax, .-max\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovge\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tmax, .-max\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.stri... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define inf (int)(1e18)
int max(int a, int b){
return a >= b ? a : b;
}
signed main(){
int N, i, j, k;
scanf("%lld", &N);
int **... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n// AOJ GRL_5_D Tree - Range Query on a Tree\n// 2019.3.29 bal4u\n\n#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n#include <stdlib.h>\n\n//// 入力の高速化\n#if 1\n#define... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tstdin(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L11\n\tl... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tstdin(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L11\n\tleaq\t1... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
// AOJ GRL_5_D Tree - Range Query on a Tree
// 2019.3.29 bal4u
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
//// 入力の高速化
#if 1
#define gc() getchar_unlocked()
#define p... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#define MAX 100000\nlong long T[MAX];\nint n,k;\n \nint load(long long P) {\n int i=0,j=0;\n long long t;\n for(i = 0; i < k; i++) {\n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tload\n\t.type\tload, @function\nload:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tk(%rip), %r9d\n\ttestl\t%r9d, %r9d\n\tjle\t.L6\n\tmovl\tn(%rip), %ecx\n\txorl\t%r8d, %r8d\n\txorl\t%esi, %esi\n\tleaq\tT(%rip), %r10\n.L3:\n\tmovslq\t%r8d, %rax... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tload\n\t.type\tload, @function\nload:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tk(%rip), %r9d\n\ttestl\t%r9d, %r9d\n\tjle\t.L6\n\tmovl\tn(%rip), %ecx\n\txorl\t%r8d, %r8d\n\txorl\t%esi, %esi\n\tleaq\tT(%rip), %r10\n.L3:\n\tmovslq\t%r8d, %rax\n\tle... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#define MAX 100000
long long T[MAX];
int n,k;
int load(long long P) {
int i=0,j=0;
long long t;
for(i = 0; i < k; i++) {
t = 0;
while( t+T[j] <=P)... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n\nint main()\n{\n int R;\n\n scanf(\"%d\",&R);\n int Q;\n int maxi=0;\n int total = 0;\n for(int i=1;i<=R;i++)\n {\n scanf(... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr6... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tp... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main()
{
int R;
scanf("%d",&R);
int Q;
int maxi=0;
int total = 0;
for(int i=1;i<=R;i++)
{
scanf("%d",&Q);
total+=Q;
if(... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n\nint compare_int(const void *a, const void *b){\n return *(int*)a - *(int*)b;\n}\n\nint main(){\n int n, x, cnt=0, a[100]=... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcompare_int\n\t.type\tcompare_int, @function\ncompare_int:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tcompare_int, .-compare_int\n\t.section\t.rodata.str1.1,\"aMS\"... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcompare_int\n\t.type\tcompare_int, @function\ncompare_int:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tcompare_int, .-compare_int\n\t.section\t.rodata.str1.1,\"aMS\",@prog... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b){
return *(int*)a - *(int*)b;
}
int main(){
int n, x, cnt=0, a[100]={0};
long long sum=0;
sc... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n// AOJ 2236 Rabbit Plays Games!\n// 2018.2.10 bal4u\n\n#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct { int a; int d; } T;\nT tbl[40002];\nint h[40002], a[4000... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\t4(%rsi), %rax\n\tmovslq\t(%rdi), %rdx\n\tmovslq\t4(%rdi), %rcx\n\timulq\t%rax, %rdx\n\tmovslq\t(%rsi), %rax\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tsetg\t%al... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\t4(%rsi), %rax\n\tmovslq\t(%rdi), %rdx\n\tmovslq\t4(%rdi), %rcx\n\timulq\t%rax, %rdx\n\tmovslq\t(%rsi), %rax\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tsetg\t%al\n\tmo... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
// AOJ 2236 Rabbit Plays Games!
// 2018.2.10 bal4u
#include <stdio.h>
#include <stdlib.h>
typedef struct { int a; int d; } T;
T tbl[40002];
int h[40002], a[40002], d[40002], s[40002];
//#defin... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<math.h>\ndouble x[4],y[4],eps=1e-6;\nint f(int *a,int *b){\n int i;\n for(i=0;i<2;i++)b[i]-=a[i];\n double l=hypot(b[0],b[1]);\n double c=... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tpus... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tpushq\t%r... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<math.h>
double x[4],y[4],eps=1e-6;
int f(int *a,int *b){
int i;
for(i=0;i<2;i++)b[i]-=a[i];
double l=hypot(b[0],b[1]);
double c=acos((a[2]-b[2])/l);//printf("%l... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main()\n{\n\nint x, y;\nscanf(\"%d %d\", &x, &y);\n\n if(x==2||y==2){\n printf(\"No\\n\");\n }\n else if((x==1||x==3||x==5||x==7||x... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tend... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main()
{
int x, y;
scanf("%d %d", &x, &y);
if(x==2||y==2){
printf("No\n");
}
else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <math.h>\n#include <time.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void) {\n int a[5], loss = 0, ans = 0, i;\n\n scanf(\"%... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d %d %d %d\"\n.LC1:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40,... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d %d %d %d\"\n.LC1:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40, %rsp\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <math.h>
#include <time.h>
#include<stdlib.h>
#include<string.h>
int main(void) {
int a[5], loss = 0, ans = 0, i;
scanf("%d %d %d %d %d", &a[0], &a[1], &a[2]... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n\nint main(void) {\n puts(\"square1001\");\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"square1001\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"square1001\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tle... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void) {
puts("square1001");
return 0;
}
Unoptimized Assembly Code:
.file "temp.c"
.text
.section .rodata
.LC0:
.string "square1001"
.text
.globl main
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\nlong long int x[100], y[100];\nint ind[100], ind2[200];\n\nlong long int naiseki(int a, int b){\n long long... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcompare_angle\n\t.type\tcompare_angle, @function\ncompare_angle:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\t(%rdi), %rax\n\tleaq\tx(%rip), %rcx\n\tleaq\ty(%rip), %rdx\n\tmovq\t(%rcx,%rax,8), %rdi\n\tmovq\t(%rdx,%rax,8), %rax\n\ttestq\t%rax... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcompare_angle\n\t.type\tcompare_angle, @function\ncompare_angle:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\t(%rdi), %rax\n\tleaq\tx(%rip), %rcx\n\tleaq\ty(%rip), %rdx\n\tmovq\t(%rcx,%rax,8), %rdi\n\tmovq\t(%rdx,%rax,8), %rax\n\ttestq\t%rax, %rax... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
long long int x[100], y[100];
int ind[100], ind2[200];
long long int naiseki(int a, int b){
long long int x_a = x[ind2[a]];
long ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#define D(i,a,b)for(int i=a;i>=b;--i)\nf[2005],n,k,M=1e9+7;main(){scanf(\"%d%d\",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)f[1]=f[1]*2%M;pr... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC3:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cf... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC3:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#define D(i,a,b)for(int i=a;i>=b;--i)
f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)f[1]=f[1]*2%M;printf("%d\n",f[1]);}
Unoptim... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint z(int a,int b,int c){return a>b&&a>c?a:b<c?c:b;}\nint main(){\n int n,k,i,j,x,y,m[1001][1001]={},s,v,w;\n char a;\n scanf(\"%d%d\",&n,&k);\n fo... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tz\n\t.type\tz, @function\nz:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%edx, %esi\n\tmovl\t%edi, %eax\n\tcmovl\t%edx, %esi\n\tcmpl\t%edi, %esi\n\tcmovge\t%esi, %eax\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tz, .-z\n\t.section\t.rodata.str1.... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tz\n\t.type\tz, @function\nz:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%edx, %esi\n\tmovl\t%edi, %eax\n\tcmovl\t%edx, %esi\n\tcmpl\t%edi, %esi\n\tcmovge\t%esi, %eax\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tz, .-z\n\t.section\t.rodata.str1.1,\"aM... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int z(int a,int b,int c){return a>b&&a>c?a:b<c?c:b;}
int main(){
int n,k,i,j,x,y,m[1001][1001]={},s,v,w;
char a;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++){
scanf("%d%d %... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \ns;i;main(a,b,c){\nfor(scanf(\"%d%d%d\",&a,&b,&c);++i<=b;a*i%b-c||s++);\nputs(s?\"YES\":\"NO\");\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"YES\"\n.LC1:\n\t.string\t\"NO\"\n.LC2:\n\t.string\t\"%d%d%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tend... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"YES\"\n.LC1:\n\t.string\t\"NO\"\n.LC2:\n\t.string\t\"%d%d%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
s;i;main(a,b,c){
for(scanf("%d%d%d",&a,&b,&c);++i<=b;a*i%b-c||s++);
puts(s?"YES":"NO");
}
Unoptimized Assembly Code:
.file "temp.c"
.text
.globl s
.bss
.align 4
.type s, @object
.size s,... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nunsigned xor128() {\n\tstatic unsigned x = 123456789, y = 362436069, z = 521288629, w = 88675123;\n\tunsigned t = x ^ (x << 11);\n\tx = y; y = z; z ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\txor128\n\t.type\txor128, @function\nxor128:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tx.5(%rip), %eax\n\tmovl\tw.2(%rip), %ecx\n\tmovl\t%eax, %edx\n\tsall\t$11, %edx\n\txorl\t%eax, %edx\n\tmovl\ty.4(%rip), %eax\n\tmovl\t%eax, x.5(%rip)\n\tm... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\txor128\n\t.type\txor128, @function\nxor128:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tx.5(%rip), %eax\n\tmovl\tw.2(%rip), %ecx\n\tmovl\t%eax, %edx\n\tsall\t$11, %edx\n\txorl\t%eax, %edx\n\tmovl\ty.4(%rip), %eax\n\tmovl\t%eax, x.5(%rip)\n\tmovl\tz... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
unsigned xor128() {
static unsigned x = 123456789, y = 362436069, z = 521288629, w = 88675123;
unsigned t = x ^ (x << 11);
x = y; y = z; z = w;
return w = w ^ (w >> 19) ^ ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\nint main(void){\n // Your code here!\n char str[200001];\n \n scanf(\"%200000s\",str);\n \n for(int i = 0; str[i] != '\\0'; i++){\n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%200000s\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%200000s\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_of... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main(void){
// Your code here!
char str[200001];
scanf("%200000s",str);
for(int i = 0; str[i] != '\0'; i++){
if(str[i] == '?'){
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <stdbool.h>\n\n#define rep(i, n) for(int i=0; i<(n); ++i)\n... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tup_comp\n\t.type\tup_comp, @function\nup_comp:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tup_comp, .-up_comp\n\t.p2align 4\n\t.globl\tdown_comp\n\t.type\tdown_comp,... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tup_comp\n\t.type\tup_comp, @function\nup_comp:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tup_comp, .-up_comp\n\t.p2align 4\n\t.globl\tdown_comp\n\t.type\tdown_comp, @func... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define max 200001
//qsort(str,... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint dp[100001][3],a[100001][3];\nint main()\n{\n\tint n,i,j,k,max=-1;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tscanf(\"%... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_c... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int dp[100001][3],a[100001][3];
int main()
{
int n,i,j,k,max=-1;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<3;j++){
scanf("%d",&a[i][j]);
}
}
for(i=0;i<n;i++){
fo... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(){\n int n,k,i,j,a,b,c,e,h,mi,min;\n while(scanf(\"%d %d\",&n,&k),n||k){\n int m[100][100]={0};\n while(k--){\n if(scanf(\"%d\",&a)... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d %d %d\"\n.LC2:\n\t.string\t\"%d %d\"\n.LC3:\n\t.string\t\"%d\\n\"\n.LC4:\n\t.string\t\"-1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.ty... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d %d %d\"\n.LC2:\n\t.string\t\"%d %d\"\n.LC3:\n\t.string\t\"%d\\n\"\n.LC4:\n\t.string\t\"-1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tma... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(){
int n,k,i,j,a,b,c,e,h,mi,min;
while(scanf("%d %d",&n,&k),n||k){
int m[100][100]={0};
while(k--){
if(scanf("%d",&a),a){
scanf("%d %d %d",&b,&c,&e);
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#pragma GCC optimize(\"Ofast\")\n#include <stdio.h>\n\nint arr1[10][10] = {\n {0,0,0,0,0,0,0,0,0,0},\n {0,100000,0,9029,0,0,0,7519,7572,1},\n {0,0,0,0,9527,0,0,1... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tputi\n\t.type\tputi, @function\nputi:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tputi\n\t.type\tputi, @function\nputi:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cf... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#pragma GCC optimize("Ofast")
#include <stdio.h>
int arr1[10][10] = {
{0,0,0,0,0,0,0,0,0,0},
{0,100000,0,9029,0,0,0,7519,7572,1},
{0,0,0,0,9527,0,0,13336,0,0},
{0,14416,0,0,0,0,0... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main()\n{\n long long a, b, n;\n scanf(\"%lld %lld %lld\", &a, &b, &n);\n \n printf(\"%lld\", ((n < b) ? (a * n / b) : (a * (b - 1) ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld %lld %lld\"\n.LC1:\n\t.string\t\"%lld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$4... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld %lld %lld\"\n.LC1:\n\t.string\t\"%lld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40, %rs... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main()
{
long long a, b, n;
scanf("%lld %lld %lld", &a, &b, &n);
printf("%lld", ((n < b) ? (a * n / b) : (a * (b - 1) / b)));
return 0;
}
Unoptimized... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\nint main(){\n int n, tmp=0, cnt[10000+1]={0};\n scanf(\"%d\", &n);\n for(int x=1; x<=100; x++){\n for(int y=1; y<=100; y++){\n for(int z=1;... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_c... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main(){
int n, tmp=0, cnt[10000+1]={0};
scanf("%d", &n);
for(int x=1; x<=100; x++){
for(int y=1; y<=100; y++){
for(int z=1; z<=100; z++){
tmp = x*x ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n//set many funcs template\n//Ver.20180717\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<time.h>\n#define inf 1072114514\n#defi... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tmax, .-max\n\t.p2align 4\n\t.globl\tmin\n\t.type\tmin, @function\nmi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tmax, .-max\n\t.p2align 4\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.L... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
//set many funcs template
//Ver.20180717
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#def... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main()\n{\n\tint x,y;\n\tint i,f1=0,f2=0,flg=0;\n\tint a[7]={1,3,5,7,8,10,12},b[4]={4,6,9,11};\n\tscanf(\"%d %d\",&x,&y);\n\tif(x==2&&y==2) flg=1;\... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d %d\"\n.LC5:\n\t.string\t\"Yes\"\n.LC6:\n\t.string\t\"No\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tend... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d %d\"\n.LC5:\n\t.string\t\"Yes\"\n.LC6:\n\t.string\t\"No\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main()
{
int x,y;
int i,f1=0,f2=0,flg=0;
int a[7]={1,3,5,7,8,10,12},b[4]={4,6,9,11};
scanf("%d %d",&x,&y);
if(x==2&&y==2) flg=1;
for(i=0;i<7;i++){
if(x==a[i]) f1=1;
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<stdlib.h>\nint lis(int size, int *A, int *L);\nint main(void)\n{\n int i, n, *a, *l;\n scanf(\"%d\", &n);\n a = (int*)malloc(sizeof(int) * ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tlis\n\t.type\tlis, @function\nlis:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tmovq\t%rdx, %r8\n\tmovl\t%eax, (%rdx)\n\ttestl\t%edi, %edi\n\tjle\t.L10\n\tleal\t-1(%rdi), %edx\n\tmovl\t$1, %r10d\n\tleaq\t4(%rsi,%rdx,4), %r11\n\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tlis\n\t.type\tlis, @function\nlis:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tmovq\t%rdx, %r8\n\tmovl\t%eax, (%rdx)\n\ttestl\t%edi, %edi\n\tjle\t.L10\n\tleal\t-1(%rdi), %edx\n\tmovl\t$1, %r10d\n\tleaq\t4(%rsi,%rdx,4), %r11\n\tjmp\t... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<stdlib.h>
int lis(int size, int *A, int *L);
int main(void)
{
int i, n, *a, *l;
scanf("%d", &n);
a = (int*)malloc(sizeof(int) * n);
l = (int*)malloc(sizeof(int)... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n#define int long long\n#define inf (int)(1e18)\n\ntypedef struct {\n\tint L;\n\tint R;\n}pair;\n\nsigned compair(const void *a, c... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcompair\n\t.type\tcompair, @function\ncompair:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rdx\n\taddq\t8(%rdi), %rdx\n\txorl\t%eax, %eax\n\tsubq\t8(%rsi), %rdx\n\tsubq\t(%rsi), %rdx\n\ttestq\t%rdx, %rdx\n\tmovl\t$-1, %edx\n\tsetne\t... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcompair\n\t.type\tcompair, @function\ncompair:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rdx\n\taddq\t8(%rdi), %rdx\n\txorl\t%eax, %eax\n\tsubq\t8(%rsi), %rdx\n\tsubq\t(%rsi), %rdx\n\ttestq\t%rdx, %rdx\n\tmovl\t$-1, %edx\n\tsetne\t%al\n\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define inf (int)(1e18)
typedef struct {
int L;
int R;
}pair;
signed compair(const void *a, const void *b){
int sub = (((pair *)a... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n\nint main(void){\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a<=8 && b<=8){\n printf(\"Yay!\\n\");\n }else{\n printf(\":(\\n\");\n }\n retur... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Yay!\"\n.LC2:\n\t.string\t\":(\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\ten... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Yay!\"\n.LC2:\n\t.string\t\":(\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if(a<=8 && b<=8){
printf("Yay!\n");
}else{
printf(":(\n");
}
return 0;
}
Unoptimized Assembly Code:
.file ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n\nint main(void){\n\tint A, B, C, X;\n\tint total;\n\tint count;\n\tint i, j, k;\n\n\tscanf(\"%d %d %d %d\", &A, &B, &C, &X);\n\t... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d %d %d %d\"\n.LC3:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r1... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d %d %d %d\"\n.LC3:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
int main(void){
int A, B, C, X;
int total;
int count;
int i, j, k;
scanf("%d %d %d %d", &A, &B, &C, &X);
count = 0;
i = 0;
while (i <= A){
j = 0... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#define MAX 100000\n\nint X[MAX],num;\n\nint partition(int p,int r){\n int y,i,j,m;\n y = X[r];\n i = p-1;\n for(j=p;j<r;j++){\n if(X[j] <= y){\... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpartition\n\t.type\tpartition, @function\npartition:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tX(%rip), %rcx\n\tmovslq\t%esi, %r11\n\tleal\t-1(%rdi), %r8d\n\tmovl\t(%rcx,%r11,4), %r9d\n\tcmpl\t%edi, %esi\n\tjle\t.L5\n\tsubl\t%edi, %esi\n\tm... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tpartition\n\t.type\tpartition, @function\npartition:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tX(%rip), %rcx\n\tmovslq\t%esi, %r11\n\tleal\t-1(%rdi), %r8d\n\tmovl\t(%rcx,%r11,4), %r9d\n\tcmpl\t%edi, %esi\n\tjle\t.L5\n\tsubl\t%edi, %esi\n\tmovslq\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#define MAX 100000
int X[MAX],num;
int partition(int p,int r){
int y,i,j,m;
y = X[r];
i = p-1;
for(j=p;j<r;j++){
if(X[j] <= y){
i++;
m = X[i];
X[... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n#include<string.h>\n\ntypedef int32_t flow_type;\n\nconst flow_type flow_inf = 1000 * 100... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t$32, %esi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovsl... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t$32, %esi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovslq\t%ed... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
typedef int32_t flow_type;
const flow_type flow_inf = 1000 * 1000;
typedef struct flow_edge {
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<string.h>\ntypedef struct i{char f[21];int s,w;} i;\ni g[10];\nint n,t[10],f[10],ans[10],max;\nvoid rec(int d)\n{\n\tint i,w=0,G=0;\n\tif(d==n... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tn(%rip), %eax\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tmovl\t%edi, %ebx\n\tcmpl\t%edi, %eax\n\tje\t.L2\n\ttestl\t%eax, %eax\n\tjle\t.L1\n\... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tn(%rip), %eax\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tmovl\t%edi, %ebx\n\tcmpl\t%edi, %eax\n\tje\t.L2\n\ttestl\t%eax, %eax\n\tjle\t.L1\n\tmovl\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<string.h>
typedef struct i{char f[21];int s,w;} i;
i g[10];
int n,t[10],f[10],ans[10],max;
void rec(int d)
{
int i,w=0,G=0;
if(d==n)
{
for(i=0;i<n;i++)
{
if(w... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <limits.h>\n\n#define int64 long long\n\nint main()\n{\n\tint64 dd, gg, min = LL... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld %lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rb... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld %lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define int64 long long
int main()
{
int64 dd, gg, min = LLONG_MAX, xx;
scanf("%lld %lld", &dd... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(){\n int a,b,h,sum;\n scanf(\"%d\\n%d\\n%d\\n\",&a,&b,&h);\n sum=((a+b)*h)/2;\n printf(\"%d\\n\",sum);\n return 0;\n}\n\n\nUnoptimized As... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\\n%d\\n%d\\n\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\\n%d\\n%d\\n\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40, %... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(){
int a,b,h,sum;
scanf("%d\n%d\n%d\n",&a,&b,&h);
sum=((a+b)*h)/2;
printf("%d\n",sum);
return 0;
}
Unoptimized Assembly Code:
.file "temp.c"
.text
.sect... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(){\n int n,i,b=0,c=0;\n scanf(\"%d\",&n);\n int a[n+1];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]%2==1)\n b++;\n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr6... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tp... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(){
int n,i,b=0,c=0;
scanf("%d",&n);
int a[n+1];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]%2==1)
b++;
if(a[i]%4==0)
c++;
}
if((b-1... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(void){\n\tchar s[10];\n\tint i,max=0,cnt=0;\n\tscanf(\"%s\",s);\n\tfor(i=0;s[i]!='\\0';i++){\n\t\tif(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40, %rsp\n\t.cf... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$40, %rsp\n\t.cfi_def_... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(void){
char s[10];
int i,max=0,cnt=0;
scanf("%s",s);
for(i=0;s[i]!='\0';i++){
if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
cnt++;
}
else{
cnt=0;
}
... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n\ntypedef struct binaryHeap{\n void *array;\n size_t heap_size;\n size_t max_size;\n ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tje\t.L1\n\tsarl\t$31, %eax\n\torl\t$1, %eax\n.L1:\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tcmp, .-cmp\n\t.p2align 4\n\t.type... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rdi), %eax\n\tsubl\t(%rsi), %eax\n\tje\t.L1\n\tsarl\t$31, %eax\n\torl\t$1, %eax\n.L1:\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tcmp, .-cmp\n\t.p2align 4\n\t.type\theap... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
typedef struct binaryHeap{
void *array;
size_t heap_size;
size_t max_size;
size_t val_size;
int (*cmp) (con... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main(){\n long long n,i,a,b,p,d[100010];\n scanf(\"%lld\",&n);\n for(i=0;i<n;i++)scanf(\"%lld\",&d[i]);\n a=b=2;\n d[n]=1e9;\n if(d[n-1]-2)go... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld %lld\\n\"\n.LC2:\n\t.string\t\"-1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startpro... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld %lld\\n\"\n.LC2:\n\t.string\t\"-1\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\te... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main(){
long long n,i,a,b,p,d[100010];
scanf("%lld",&n);
for(i=0;i<n;i++)scanf("%lld",&d[i]);
a=b=2;
d[n]=1e9;
if(d[n-1]-2)goto END;
for(i=n;i--;){
if(a%d[... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint i, N, h[100001];\n\tscanf(\"%d\", &N);\n\tfor (i = 1; i <= N; i++) scanf(\"%d\", &(h[i]));\n\t\n\tconst in... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_c... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, N, h[100001];
scanf("%d", &N);
for (i = 1; i <= N; i++) scanf("%d", &(h[i]));
const int sup = 1 << 30;
int dp[100002];
for (i =... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n/*\ncat <<EOF >mistaken-paste\n*/\n\n#pragma GCC diagnostic ignored \"-Wincompatible-pointer-types\"\n#define _USE_MATH_DEFINES\n\n#include <stdio.h>\n#include <stdint.h>... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tumin\n\t.type\tumin, @function\numin:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovbe\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tumin, .-umin\n\t.p2align 4\n\t.globl\tumax\n\t.type\tumax, @funct... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tumin\n\t.type\tumin, @function\numin:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovbe\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tumin, .-umin\n\t.p2align 4\n\t.globl\tumax\n\t.type\tumax, @function\nu... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
/*
cat <<EOF >mistaken-paste
*/
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stri... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n\nvoid run(void){\n int x,p;\n scanf(\"%d%d\",&x,&p);\n double q=(double)p/100;\n if(x%2==0){\n x/=2;\n printf(\"%.7f\\n\",x/q);\n } else {\... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC2:\n\t.string\t\"%.7f\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.L... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC2:\n\t.string\t\"%.7f\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%ri... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
void run(void){
int x,p;
scanf("%d%d",&x,&p);
double q=(double)p/100;
if(x%2==0){
x/=2;
printf("%.7f\n",x/q);
} else {
double ans=1+q*((x-1)/2/q)+(1-q)*((... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <string.h>\n\nint main(){\n char s[105]; scanf(\"%s\", s);\n int len = strlen(s);\n char key[] = \"keyence\";\n \n int ans = (strcmp(s,... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"YES\"\n.LC1:\n\t.string\t\"NO\"\n.LC2:\n\t.string\t\"%s\"\n.LC3:\n\t.string\t\"keyence\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"YES\"\n.LC1:\n\t.string\t\"NO\"\n.LC2:\n\t.string\t\"%s\"\n.LC3:\n\t.string\t\"keyence\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB35:\n\... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <string.h>
int main(){
char s[105]; scanf("%s", s);
int len = strlen(s);
char key[] = "keyence";
int ans = (strcmp(s, "keyence")==0 ? 1 : 0);
for(int i... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main()\n{\n\tint i, j, p, N;\n\tscanf(\"%d\", &N);\n\tprintf(\"%d\\n\", (N - 1) * (N - 1) / 2);\n\tfor (i = 1, p = 1 - N % 2; i < N; i++) {\n\t\... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n.LC2:\n\t.string\t\"%d %d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n.LC2:\n\t.string\t\"%d %d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendb... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main()
{
int i, j, p, N;
scanf("%d", &N);
printf("%d\n", (N - 1) * (N - 1) / 2);
for (i = 1, p = 1 - N % 2; i < N; i++) {
for (j = i + 1; j <= N; j++) if (j != N - i... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#define stmin(a,b) ((a)<(b)?(a):(b))\ntypedef unsigned long long ull;\nint main(void){\n\tint n;\n\tlong x;\n\tscanf(\"%d %ld\",&n,&x);\n\tlong ar[n*2]... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %ld\"\n.LC1:\n\t.string\t\"%ld\"\n.LC2:\n\t.string\t\"%llu\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\t... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %ld\"\n.LC1:\n\t.string\t\"%ld\"\n.LC2:\n\t.string\t\"%llu\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr6... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#define stmin(a,b) ((a)<(b)?(a):(b))
typedef unsigned long long ull;
int main(void){
int n;
long x;
scanf("%d %ld",&n,&x);
long ar[n*2];
for(int i = 0;i < n;i++)scanf("%ld"... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\nint main()\n{\n\tint n, x;\n\tscanf(\"%d %d\", &n, &x);\n\tint i, j;\n\tint a[200005], b[200005];\n\tif (x == 1 || x == 2 * n - 1)\n\t{\n\t\tprintf(\"N... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n.LC3:\n\t.string\t\"1\\n2\\n3\"\n.LC5:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n.LC3:\n\t.string\t\"1\\n2\\n3\"\n.LC5:\n\t.string\t\"%d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\t... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
int main()
{
int n, x;
scanf("%d %d", &n, &x);
int i, j;
int a[200005], b[200005];
if (x == 1 || x == 2 * n - 1)
{
printf("No\n");
return 0;
}
printf("Yes\n");
if (... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n#include <math.h>\nint main(void){\n int n;\n long long power=1;\n scanf(\"%d\", &n);\n for(int i=1; i<=n; i++) power=(power*i)%(long long... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%lld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%lld\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_de... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
#include <math.h>
int main(void){
int n;
long long power=1;
scanf("%d", &n);
for(int i=1; i<=n; i++) power=(power*i)%(long long)(pow(10, 9)+7);
printf("%lld... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n// AOJ 3024 RMQ 2\n// 2019.4.2 bal4u\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define INF 0x7fffffff\n\n#if 1\n#define gc() getchar_unlocked()\n... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tstdin(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L11\n\tl... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tstdin(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L11\n\tleaq\t1... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
// AOJ 3024 RMQ 2
// 2019.4.2 bal4u
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INF 0x7fffffff
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#e... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<math.h>\n\nint toT(int a,int b,int t)\n{\n\tdouble x,y;\n\ty=a*((100.0+t)/100)+0.000000001;\n\tx=b*((100.0+t)/100)+0.000000001;\n\treturn floo... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\ttoT\n\t.type\ttoT, @function\ntoT:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpxor\t%xmm2, %xmm2\n\tmovsd\t.LC0(%rip), %xmm0\n\tmovsd\t.LC1(%rip), %xmm6\n\tcvtsi2sdl\t%edx, %xmm2\n\tmovq\t.LC3(%rip), %xmm3\n\tmovsd\t.LC2(%rip), %xmm5\n\tmovapd\t%x... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.p2align 4\n\t.globl\ttoT\n\t.type\ttoT, @function\ntoT:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpxor\t%xmm2, %xmm2\n\tmovsd\t.LC0(%rip), %xmm0\n\tmovsd\t.LC1(%rip), %xmm6\n\tcvtsi2sdl\t%edx, %xmm2\n\tmovq\t.LC3(%rip), %xmm3\n\tmovsd\t.LC2(%rip), %xmm5\n\tmovapd\t%xmm3, %... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<math.h>
int toT(int a,int b,int t)
{
double x,y;
y=a*((100.0+t)/100)+0.000000001;
x=b*((100.0+t)/100)+0.000000001;
return floor(x)+floor(y);
}
int main()
{
int x... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include<stdio.h>\n#include<stdio.h>\n#include<stdlib.h>\n\n\nint main() {\n\tint n, two[25] = {},num[25]={},kosuu,hen=0,memo;\n\ttwo[0] = 1;\n\tscanf(\"%d\", &n);\n\tif ... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"2 1\\n1 2 0\"\n.LC2:\n\t.string\t\"%d %d\\n\"\n.LC3:\n\t.string\t\"%d %d 0\\n%d %d %d\\n\"\n.LC4:\n\t.string\t\"%d %d %d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"2 1\\n1 2 0\"\n.LC2:\n\t.string\t\"%d %d\\n\"\n.LC3:\n\t.string\t\"%d %d 0\\n%d %d %d\\n\"\n.LC4:\n\t.string\t\"%d %d %d\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include<stdio.h>
#include<stdio.h>
#include<stdlib.h>
int main() {
int n, two[25] = {},num[25]={},kosuu,hen=0,memo;
two[0] = 1;
scanf("%d", &n);
if (n == 1) { printf("2 1\n1 2 0"); }
for ... |
train | [
{
"content": "Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.\nC Code:\n \n#include <stdio.h>\n\nint main() {\n unsigned long n = 0;\n unsigned long r = 1;\n scanf(\"%lu\", &n);\n while(n != 0) {\n n >>= 1;\n r <<= 1;\n }\n\n printf(... | code | {
"ground_truth": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lu\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_o... | {
"answer": "\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lu\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset ... | Given the following C code and unoptimized assembly code, your task is to generate highly optimized assembly code.
C Code:
#include <stdio.h>
int main() {
unsigned long n = 0;
unsigned long r = 1;
scanf("%lu", &n);
while(n != 0) {
n >>= 1;
r <<= 1;
}
printf("%lu", r - 1);
}
Unoptimized Assembl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.